• 0 Голоса
    2 Сообщения
    107 Просмотры

    https://docs.ton.org/develop/dapps/ton-connect/message-builders

    Перевод с комментарием - base64

  • 0 Голоса
    1 Сообщения
    304 Просмотры

    Как нам следует написать код, если мы хотим перевести Jetton с кошелька, уже подключенного к tonconnect-ui? Я подключил кошелек и хочу отправить Jetton на адрес получателя другого человека / кошелька. Но я получаю необычную ошибку.

    Ошибка: Если я внесу, я получу ** Не удалось рассчитать комиссию ** на кошелек браузера

    const userFriendlyAddress = useTonAddress();

    const rawAddress = useTonAddress(ложь); const кошелек = useTonWallet(); const [tonConnectUI, setOptions] = useTonConnectUI();

    const jettonAddress = "EQDEPcKFlXaKddKJVUvq2Rfn2QgH7_MyFHxZek99FdMyq8XD"; const receiver_address = "UQA76t6NCey61qBTkqosAs65sSrX2jIk9BloVz3NU76yYMap";

    const jettonTransfer = async () => { let myTransaction; if (userFriendlyAddress) {

    const body = beginCell() .storeUint(0xf8a7ea5, 32) // jetton transfer op code .storeUint(0, 64) // query_id:uint64 .storeCoins(10000000) // amount:(VarUInteger 16) - Jetton amount for transfer (decimals = 6 - jUSDT, 9 - default) .storeAddress(Address.parse(userFriendlyAddress)) // destination:MsgAddress .storeAddress(Address.parse(receiver_address)) // response_destination:MsgAddress .storeUint(0, 1) // custom_payload:(Maybe ^Cell) .storeCoins(50000000) // forward_ton_amount:(VarUInteger 16) .storeUInt(0, 1) // forward_payload:(Either Cell ^Cell) .endCell(); myTransaction = { validUntil: Math.floor(Date.now() / 1000) + 360, messages: [ { address: Address.parse(jettonAddress), // sender jetton wallet amount: 100000000, // for commission fees, excess will be returned payload: body.toBoc().toString("base64"), // payload with jetton transfer body }, ], }; } try { tonConnectUI.sendTransaction(myTransaction); } catch (error) { alert(error); }

    };

    Оригинал вопроса