-
Notifications
You must be signed in to change notification settings - Fork 23
feat: example using hwi signing with #206
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for this! looks like a good simple example for using |
So I think after constructing the psbt we can just call that function and voila. |
|
||
let _ = bb.register_wallet("test-wallet", descriptor).await.unwrap(); | ||
|
||
let bitbox_signer = HwiSigner::new(bb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So at this level we can just call bibox_signer.sign(psbt)
given that the psbt has been constructed with bdk_wallet
or something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think this is the right approach. Even though it makes the example much simpler it's still useful to show the end-to-end flow of using async-hwi
to sign a psbt created with bdk_wallet::TxBuilder
(and eventually the bdk_tx::TxBuilder
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a good idea to add syncing wallet code in the example?
If not what's a good way of mocking the wallet with some utxos to sign?
@notmandatory I also added a feature Please let me know what you think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this one, I left a few comments and also would recommend squashing the commits into a single one and follow the https://www.conventionalcommits.org/en/v1.0.0/ (e.g chore(example): add example using `async-hwi`
.
[dependencies] | ||
bdk_wallet = { path = "../../wallet", features = ["file_store"] } | ||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] } | ||
bitbox-api = {version = "0.6.0", features = ["tokio", "simulator"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably can have this as an optional dependency with the simulator
feature.
Thanks for taking a look @oleonardolima. I've addressed your suggestions. |
Thanks for the updates, I'll do a round of review and testing. |
I recommend a rebase for this after the |
Description
Integrates a new BDK signer using async-hwi.
The included example uses Bitbox02 but can be easily extended to use any other supported device.
Notes for reviewer
It's related to issue #20
Changelog notice
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing