From cb076fb70e12ded1fd327e8feaf7887404ee9268 Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 6 Jul 2023 15:12:22 +0200 Subject: [PATCH] Update `requestRedemption` API Adjust request redemption function to the latest changes from `tbtc-v2.ts` lib. See https://github.com/keep-network/tbtc-v2/pull/632 --- src/components/Modal/tBTC/InitiateUnminting.tsx | 14 ++++---------- src/threshold-ts/tbtc/index.ts | 8 +------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/components/Modal/tBTC/InitiateUnminting.tsx b/src/components/Modal/tBTC/InitiateUnminting.tsx index ff4d1da75..389748104 100644 --- a/src/components/Modal/tBTC/InitiateUnminting.tsx +++ b/src/components/Modal/tBTC/InitiateUnminting.tsx @@ -62,22 +62,16 @@ const InitiateUnmintingBase: FC = ({ // TODO: Temporary solution- we will pass this data via props once we merge // https://github.com/threshold-network/token-dashboard/pull/532 const walletPublicKey = - "028ed84936be6a9f594a2dcc636d4bebf132713da3ce4dac5c61afbf8bbb47d6f7" + "025183c15164e1b2211eb359fce2ceeefc3abad3af6d760cc6355f9de99bf60229" const utxo: UnspentTransactionOutput = { transactionHash: Hex.from( - "0x5b6d040eb06b3de1a819890d55d251112e55c31db4a3f5eb7cfacf519fad7adb" + "0xda0e364abb3ed952bcc694e48bbcff19131ba9513fe981b303fa900cff0f9fbc" ), outputIndex: 0, - value: BigNumber.from("791613461"), + value: BigNumber.from("164380000"), } - await sendTransaction( - account!, - walletPublicKey, - utxo, - btcAddress, - unmintAmount - ) + await sendTransaction(walletPublicKey, utxo, btcAddress, unmintAmount) } return ( diff --git a/src/threshold-ts/tbtc/index.ts b/src/threshold-ts/tbtc/index.ts index 689d4b3c7..9b3fd7d19 100644 --- a/src/threshold-ts/tbtc/index.ts +++ b/src/threshold-ts/tbtc/index.ts @@ -206,7 +206,6 @@ export interface ITBTC { /** * Requests a redemption from the on-chain Bridge contract. - * @param redeemer On-chain identifier of the redeemer. * @param walletPublicKey The Bitcoin public key of the wallet. Must be in * the compressed form (33 bytes long with 02 or 03 prefix). * @param mainUtxo The main UTXO of the wallet. Must match the main UTXO @@ -217,7 +216,6 @@ export interface ITBTC { * @returns Transaction hash of the request redemption transaction. */ requestRedemption( - redeemer: string, walletPublicKey: string, mainUtxo: UnspentTransactionOutput, btcAddress: string, @@ -666,7 +664,6 @@ export class TBTC implements ITBTC { } requestRedemption = async ( - redeemer: string, walletPublicKey: string, mainUtxo: UnspentTransactionOutput, btcAddress: string, @@ -683,13 +680,10 @@ export class TBTC implements ITBTC { } const tx = await requestRedemption( - getChainIdentifier(redeemer), walletPublicKey, mainUtxo, - createOutputScriptFromAddress(btcAddress), + createOutputScriptFromAddress(btcAddress).toString(), BigNumber.from(amount), - getChainIdentifier(this._tbtcVault.address), - this._bridge, this._token )