Skip to content

feat(wallet-service): added a new param to the getUtxos endpoint to …#329

Merged
andreabadesso merged 9 commits intomasterfrom
feat/max-amount
Jan 28, 2026
Merged

feat(wallet-service): added a new param to the getUtxos endpoint to …#329
andreabadesso merged 9 commits intomasterfrom
feat/max-amount

Conversation

@andreabadesso
Copy link
Copy Markdown
Collaborator

@andreabadesso andreabadesso commented Dec 5, 2025

Motivation

The totalAmount parameter returns UTXOs summing to at least the specified amount (for transaction building).

Users needed a way to query UTXOs with an upper bound, returning UTXOs summing to at most a specified amount.

Acceptance Criteria

  • Add maxAmount query parameter to /wallet/tx_outputs and /wallet/utxos endpoints
  • When maxAmount is provided, return UTXOs whose total value does not exceed the specified amount
  • Return 400 error if both totalAmount and maxAmount are provided simultaneously

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged
  • Make sure either the unit tests and/or the QA tests are capable of testing the new features
  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

…eturn utxos that fit inside the requested value
@andreabadesso andreabadesso self-assigned this Dec 5, 2025
@andreabadesso andreabadesso added the enhancement New feature or request label Dec 5, 2025
@andreabadesso andreabadesso moved this to In Progress (Done) in Hathor Network Dec 5, 2025
@andreabadesso andreabadesso moved this from In Progress (Done) to In Progress (WIP) in Hathor Network Dec 5, 2025
@andreabadesso andreabadesso moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Dec 17, 2025
@andreabadesso andreabadesso requested a review from r4mmer December 18, 2025 17:01
pedroferreira1
pedroferreira1 previously approved these changes Dec 23, 2025
@andreabadesso andreabadesso moved this from In Progress (Done) to In Review (WIP) in Hathor Network Dec 26, 2025
Comment on lines +233 to +234
// txOutputs are sorted by value DESC from the database, so we iterate
// from smallest to largest to maximize the number of UTXOs within the limit
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to "maximize" the number of utxos?
In the wallet-lib when an amount limit is given we usually try to select as few utxos as possible to avoid hitting the tx input limit (255)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, refactored it to invert the logic

@r4mmer r4mmer moved this from In Review (WIP) to In Review (Done) in Hathor Network Jan 2, 2026
@andreabadesso andreabadesso moved this from In Review (Done) to In Progress (Done) in Hathor Network Jan 28, 2026
Comment thread packages/daemon/acceptance.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should not be commited

Comment thread packages/daemon/explanation.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should not have been commited as well

@github-project-automation github-project-automation Bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Jan 28, 2026
@andreabadesso andreabadesso merged commit 03e8ae4 into master Jan 28, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Jan 28, 2026
@andreabadesso andreabadesso deleted the feat/max-amount branch January 28, 2026 18:47
@andreabadesso andreabadesso mentioned this pull request Jan 28, 2026
2 tasks
@andreabadesso andreabadesso moved this from Waiting to be deployed to Done in Hathor Network Jan 28, 2026
This was referenced Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants