Skip to content

feat: add get_address_utxos method #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

luisschwab
Copy link
Member

Closes #133.

This PR adds the get_address_utxos method, which hits the /address/{addr}/utxo endpoint, returning a Vec<Utxo>.

Changelog

  • Create UtxoStatus.
  • Create Utxo.
  • Create get_address_utxos for both blocking and async clients.
  • Add a functional test for it.

`get_address_utxos` hits the `/address/{address}/utxo` endpoint
and returns a `Vec<Utxo>`
@luisschwab luisschwab added the enhancement New feature or request label Aug 7, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 16817757977

Details

  • 27 of 27 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 87.216%

Totals Coverage Status
Change from base Build 16626978737: 0.3%
Covered Lines: 1037
Relevant Lines: 1189

💛 - Coveralls

Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

tACK 86d3d44

I've tested it with blocking client, and it worked just fine on both happy path, too many histories error and when it's unconfirmed.

Comment on lines +126 to +129
/// Information about an UTXO's status: confirmation status,
/// confirmation height, confirmation block hash and confirmation block time.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)]
pub struct UtxoStatus {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding docs here. Question: isn't this the same as the TxStatus type?

Copy link
Member Author

@luisschwab luisschwab Aug 19, 2025

Choose a reason for hiding this comment

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

Indeed, structurally they are the same. But I preferred to create another struct with a name that matches what it models. We could change the name of TxStatus to something generic, but I don't think that's very elegant, since these types are ad-hoc to what the API returns.

Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

ACK 86d3d44

@oleonardolima oleonardolima merged commit 0cef6a9 into bitcoindevkit:master Aug 22, 2025
25 checks passed
@github-project-automation github-project-automation bot moved this from Needs Review to Done in BDK Chain Aug 22, 2025
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
Status: Done
Development

Successfully merging this pull request may close these issues.

feat: /address/:address/utxo
4 participants