-
Notifications
You must be signed in to change notification settings - Fork 25
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
Redemption- select wallet #532
Conversation
Check if there is a wallet in network that has enough BTC to handle a redemption request. If such a wallet exists we trigger the submit function and pass the wallet data to this function. Otherewise the function from the threshold-ts lib throws an error and we set an error message for the `amount` field.
Add a new method to the `ITBTC` interface that requests redemption. The implementation of this interface uses the `requestRedemption` fn from `tbtc-v2.ts` lib. As a temporary soultion here we hardcode the redemption request data in component- once we merge the #532 we will pass these params via props to the component.
To request redemption we need the wallet public key(compressed public key of the ECDSA Wallet) instead of hash. Here we update wallet data prop field name to point out that this is a wallet public key not wallet public key hash.
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.
LGTM 🔥
Tested it out using electrum and goerli contracts + linked tbtc-v2.ts lib and it found the wallet. Left some minor comments here and there.
Since keep-network/tbtc-v2#630 is merged then we could release the new version of tbtc-v2.ts
lib and add it here to package.json
before we merge it.
To use the latest redemption API.
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.
Left one more comment here:
Adjust the code to the latest changes from `tbtc-v2.ts` lib. We must pass redeemer output script to the `findWalletForRedemption` fn from the `tbtc-v2.ts` lib. In the dapp we operate on the bitcoin address so we convert this address to a script under the hood and then call the function from `tbtc-v2.ts` lib.
0f3518f
to
0e3556b
Compare
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.
Left one small comment
Print errors that will happen on submit function above the `Unmint` button.
40e4397
to
547ee40
Compare
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.
LGTM 🔥
Depends on: keep-network/tbtc-v2#630Depends on: #523Check if there is a wallet in network that has enough BTC to handle a redemption request. If such a wallet exists we trigger the submit function and pass the wallet data to this function. Otherwise, the function from the threshold-ts lib throws an error and we set an error message for the
amount
field.