ton-connect / sdk

SDK for TON Connect 2.0 — a comprehensive communication protocol between wallets and apps in TON ecosystem
Apache License 2.0
326 stars 92 forks source link

[UI-REACT]: Send USDT follow official docs not work #217

Open EF09FE opened 3 months ago

EF09FE commented 3 months ago

Describe the bug

Follow the official docs to prepare jetton transfer transaction: https://docs.ton.org/develop/dapps/ton-connect/message-builders#jetton-transfer

// get user USDT wallet address from USDT Jetton Master
const userUSDTAddress = await getUserJettonWalletAddress(walletAddress, USDTJettonMasterAddress)

const body = beginCell()
            .storeUint(0xf8a7ea5, 32)                 // jetton transfer op code
            .storeUint(0, 64)                         // query_id:uint64
            .storeCoins(1000000)                      // amount:(VarUInteger 16) -  Jetton amount for transfer (decimals = 6 - jUSDT, 9 - default)
            .storeAddress(Address.parse(to))  // destination:MsgAddress
            .storeAddress(Address.parse(walletAddress))  // response_destination:MsgAddress
            .storeUint(0, 1)                          // custom_payload:(Maybe ^Cell)
            .storeCoins(toNano(0.05))                 // forward_ton_amount:(VarUInteger 16) - if >0, will send notification message
            .storeUint(0,1)                           // forward_payload:(Either Cell ^Cell)
            .endCell();

        const transaction = {
            validUntil: Math.floor(Date.now() / 1000) + 360,
            messages: [
                {
                    address: userUSDTAddress.toRawString(), // sender jetton wallet
                    amount: toNano(0.05).toString(), // for commission fees, excess will be returned
                    payload: body.toBoc().toString("base64") // payload with jetton transfer and comment body
                }
            ]
        }

      const txRes = await tonConnectUI.sendTransaction(transaction as SendTransactionRequest)

Expected behavior

Launch Ton Wallet miniapp and confirm to send transaction

Current behavior

Launch Ton Wallet miniapp but it's keep loading, and then toast a message: Unable to verify transaction

Here is console log:

image

Steps to Reproduce

see describe code

Environment

MacOS

Additional context

No response

heydarbadirli commented 1 month ago

Hi @thekiba Is there any update on the issue?