From be2723fda1a0882704ab4153c9ca4574f9d38a8c Mon Sep 17 00:00:00 2001 From: Fara Woolf Date: Fri, 13 Dec 2024 20:51:27 -0500 Subject: [PATCH] feat: update sbtc package --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- .../pages/swap/hooks/use-sbtc-deposit-transaction.tsx | 11 ++++------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index f9f3b610aa..ea5234797e 100644 --- a/package.json +++ b/package.json @@ -248,7 +248,7 @@ "redux-persist": "6.0.0", "remark-gfm": "4.0.0", "rxjs": "7.8.1", - "sbtc": "0.2.5", + "sbtc": "0.3.0", "style-loader": "3.3.4", "ts-debounce": "4.0.0", "url": "0.11.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 818f14456f..ae1e45c173 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -354,8 +354,8 @@ importers: specifier: 7.8.1 version: 7.8.1 sbtc: - specifier: 0.2.5 - version: 0.2.5(encoding@0.1.13) + specifier: 0.3.0 + version: 0.3.0(encoding@0.1.13) style-loader: specifier: 3.3.4 version: 3.3.4(webpack@5.94.0(@swc/core@1.9.3)(esbuild@0.24.0)(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2)(webpack-dev-server@4.15.1)(webpack@5.94.0))) @@ -13239,8 +13239,8 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - sbtc@0.2.5: - resolution: {integrity: sha512-CXdgh4xq/86VqmvtHtFGQlL0R2ZjKdnuVgUh3mzya1blBNm0qlKYrC/woUgA0Gxth8uBUQh1cn+dduihxNoFvg==} + sbtc@0.3.0: + resolution: {integrity: sha512-nB6lAEdm+c12RteLeDmdzEqZ57KEB/yPZUiKjeYVTN2VtipXj7wNyudwiT786Qux40LROLUbL2x5yrKYriU0Zg==} sc-errors@3.0.0: resolution: {integrity: sha512-rIqv2HTPb9DVreZwK/DV0ytRUqyw2DbDcoB9XTKjEQL7oMEQKsfPA8V8dGGr7p8ZYfmvaRIGZ4Wu5qwvs/hGDA==} @@ -31394,7 +31394,7 @@ snapshots: dependencies: xmlchars: 2.2.0 - sbtc@0.2.5(encoding@0.1.13): + sbtc@0.3.0(encoding@0.1.13): dependencies: '@btc-helpers/rpc': 2.0.0(encoding@0.1.13) '@noble/secp256k1': 2.1.0 diff --git a/src/app/pages/swap/hooks/use-sbtc-deposit-transaction.tsx b/src/app/pages/swap/hooks/use-sbtc-deposit-transaction.tsx index 9f13ec9d60..ec4843d9a4 100644 --- a/src/app/pages/swap/hooks/use-sbtc-deposit-transaction.tsx +++ b/src/app/pages/swap/hooks/use-sbtc-deposit-transaction.tsx @@ -3,12 +3,13 @@ import { useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; +import { bytesToHex } from '@noble/hashes/utils'; import * as btc from '@scure/btc-signer'; import type { P2TROut } from '@scure/btc-signer/payment'; import { MAINNET, REGTEST, - SbtcApiClient, + SbtcApiClientMainnet, SbtcApiClientTestnet, TESTNET, buildSbtcDepositTx, @@ -57,12 +58,7 @@ function getSbtcNetworkConfig(network: BitcoinNetworkModes) { } // TODO: Set config paths, or likely remove when defaults are published -const clientMainnet = new SbtcApiClient({ - sbtcContract: '', - btcApiUrl: '', - stxApiUrl: '', - sbtcApiUrl: '', -}); +const clientMainnet = new SbtcApiClientMainnet(); const clientTestnet = new SbtcApiClientTestnet(); export function useSbtcDepositTransaction() { @@ -96,6 +92,7 @@ export function useSbtcDepositTransaction() { signersPublicKey: await client.fetchSignersPublicKey(), maxSignerFee, reclaimLockTime, + reclaimPublicKey: bytesToHex(signer.publicKey).slice(2), }); const { inputs, outputs, fee } = determineUtxosForSpend({