hirosystems/stacks.js

Building testnet sBTC deposit transaction failing

kenrogers opened this issue · 1 comments

What version of Stacks.js are you using?

Using sBTC package

Describe the bug

When I try to build a new deposit transaction using the testnet helper, it fails due to lack of funds. I've verified that the address does indeed have UTXOs to spend. Checking the UTXOs in the console successfully shows them.

How to reproduce

Here is the code calling the function:

  const test = new TestnetHelper();
    const dev = new DevEnvHelper();

    const utxos = await test.fetchUtxos(
      userData.profile.btcAddress.p2wpkh.testnet
    );

    // get sBTC deposit address from bridge API
    const response = await fetch(
      "https://bridge.sbtc.tech/bridge-api/testnet/v1/sbtc/init-ui"
    );
    const data = await response.json();

    const tx = await sbtcDepositHelper({
      network: TESTNET,
      pegAddress: data.sbtcContractData.sbtcWalletAddress,
      stacksAddress: userData.profile.stxAddress.testnet,
      amountSats: satoshis,
      feeRate: test.estimateFeeRate("low"),
      utxos,
      bitcoinChangeAddress: userData.profile.btcAddress.p2wpkh.testnet,
    });
    console.log(tx);
    return;

Additional context

Bitcoin address being used to fetch UTXOs: tb1q3zl64vadtuh3vnsuhdgv6pm93n82ye8qc36c07

image

I think this is one we figured out, feel free to reopen if I'm misremembering 👍