Withdraw crypto using NodeJS SDK problem

Hello. I want to withdraw BTC from my Incognito wallet to the outer wallet using NodeJS SDK. Important - I am in the testnet.

According to the docs (https://github.com/incognitochain/sdk-v2), I have to call bridgeWithdraw method. изображение

But each time when I do it I am getting the following error:
TypeError: walletBTCToken.bridgeWithdraw is not a function.

I am calling bridgeWithdraw with the following code snippet:

const masterAccount = await wallet.masterAccount.getAccountByName(masterAccountName)
const walletBTCToken = await masterAccount.getFollowingPrivacyToken(BTCTokenId)
await walletBTCToken.bridgeWithdraw(outerWalletAddress, amountToWithdraw)

Maybe I have the wrong version of the SDK or should I use another method? Thanks.

I have also tried to use bridgeBurningCentralized and then bridgeWithdrawCentralized methods but each time when I call bridgeBurningCentralized I get the error saying:

Token 4584d5e9b2fc0337dfb17f4b5bb025e5b82c38cfa4f54e8a3d4fcdd03954ff82 is not has exchange rate.

Does walletBTCToken have a value? When javascript/nodescript mentions it is not a function it is most often because the variable is undefined/null/empty.

Yes. It is an object of PrivacyToken class.

Hi, SDK-V2 is still developing and you can use branch develop for sdk-v2 by install the branch https://github.com/incognitochain/sdk-v2#develop and reference project https://github.com/incognitochain/incognito-extension-wallet.
We have two examples about bridgeWithdrawCentralized by native fee (PRV) and pToken fee

1 Like