You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

发送Jetton时持续出现Failed错误的原因排查求助

排查TON Jetton转账持续失败问题

我已经修改过query_id及其他参数,但始终收到Failed错误。

JavaScript实现代码

const receiver = 'UQBgyXy6AhPB_rVRaTlc40IFMSpAFm_KrQYzKNbKZzxoKGRA';
const sender = 'UQB3yamV4Zt69EqTigJDHPDt2pO_zeO7xxslihmCJUvtSGSt';

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

const base64 = body.toBoc().toString("base64");

const tonweb = new TonWeb();
const jettonMinter = new TonWeb.token.jetton.JettonMinter(tonweb.provider, { address: "EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT" });
const address = await jettonMinter.getJettonWalletAddress(new TonWeb.utils.Address(sender));
let a = address.toString(true, true, true);

const transaction = {
    validUntil: Math.floor(Date.now() / 1000) + 60, // 60 sec
    messages: [
        {
            address: a,
            amount: 8e6,
            payload: base64
        }
    ]
}

const result = await tonConnectUI.sendTransaction(transaction);

C#实现代码

// Create a receiver address and the amount to send
Address receiver = new("UQBgyXy6AhPB_rVRaTlc40IFMSpAFm_KrQYzKNbKZzxoKGRA");
Address sender = new("UQB3yamV4Zt69EqTigJDHPDt2pO_zeO7xxslihmCJUvtSGSt");

// define jetton amount to send
Coins amount = new Coins(100); // for ex 100 jettons

Random random = new Random();
ulong randomUlong = (ulong)random.Next() | ((ulong)random.Next() << 32);
// create jetton transfer options
JettonTransferOptions options = new JettonTransferOptions()
{
    Amount = amount,
    Destination = receiver,
    QueryId = randomUlong
};

// create a message body for the jetton transfer
Cell jettonTransfer = JettonWallet.CreateTransferRequest(options);

// Create an array of messages to send
Message[] sendTons =
{
    new Message(
        sender,
        new("0.01"),
        payload: jettonTransfer),
};

// Set the valid until timestamp for the transaction (expiration time in seconds from the current moment)
long validUntil = DateTimeOffset.Now.ToUnixTimeSeconds() + 600;

// Create a SendTransactionRequest object
SendTransactionRequest transactionRequest = new SendTransactionRequest(sendTons, validUntil);

核心排查方向

  • Jetton Minter地址错误:JS代码中的EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT是占位符,必须替换为目标Jetton的真实Minter地址,否则无法获取正确的Jetton钱包地址。
  • C#消息接收方错误:当前C#代码中Message的第一个参数是sender,但Jetton转账消息应该发送到你的Jetton钱包地址,而非普通钱包地址,这会导致交易无法被正确处理。
  • 金额单位不匹配:
    • 如果是jUSDT(6位小数),JS中storeCoins(10000000000)对应10000个jUSDT,若你只想转10个,应改为10000000;
    • C#中Coins amount = new Coins(100)需确认是否为Jetton最小单位,部分库的Coins构造器直接接收Jetton数量,需核对文档调整。
  • Gas费用不足:JS中amount: 8e6仅0.008TON,建议提升到1e7(0.01TON)以上,确保覆盖转账的gas消耗。
  • 网络一致性:确认代码连接的网络(主网/测试网)与钱包使用的网络完全一致,跨网络交易会直接失败。
  • QueryId唯一性:确保每次交易生成的query_id都是唯一的,避免重复提交同一query_id的交易。

内容的提问来源于stack exchange,提问作者Александр А

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 12:15:13