• STON.fi Простой обмен TON -> USDT

    TON Overflow на русском
    0 Голоса
    1 Сообщения
    23 Просмотры

    Я пытаюсь выполнить простой обмен TON -> USDT на STON.fi. Это, кажется, сложнее, чем ожидалось. Смотрите ниже функции. Буду признателен за любые советы. Транзакция проходит, но я не получаю токены.

    async function stonfi(mnemonic) { const keyPair = await mnemonicToWalletKey(mnemonic.split(' ')); const tonweb = new TonWeb(new TonWeb.HttpProvider('https://toncenter.com/api/v2/jsonRPC', { apiKey: 'e4cf6......' })); const WalletClass = tonweb.wallet.all.v4R2; const wallet = new WalletClass(tonweb.provider, { publicKey: keyPair.publicKey, }); const address = await wallet.getAddress(); const JETTON0 = 'EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA'; //USDT; const PROXY_TON = 'EQCM3B12QK1e4yZSf8GtBRT0aLMNyEsBc_DhVfRRtOEffLez'; const router = new Router(tonweb.provider, { revision: ROUTER_REVISION.V1, address: ROUTER_REVISION_ADDRESS.V1, }); const tonToJettonTxParams = await router.buildSwapProxyTonTxParams({ // address of the wallet that holds TON you want to swap userWalletAddress: address, proxyTonAddress: PROXY_TON, // amount of the TON you want to swap offerAmount: new TonWeb.utils.BN('1000000'), // address of the jetton you want to receive askJettonAddress: JETTON0, // minimal amount of the jetton you want to receive as a result of the swap. // If the amount of the jetton you want to receive is less than minAskAmount // the transaction will bounce minAskAmount: new TonWeb.utils.BN(1), // query id to identify your transaction in the blockchain (optional) queryId: 12345, // address of the wallet to receive the referral fee (optional) referralAddress: undefined, }); const seqno = (await wallet.methods.seqno().call()) || 0; var result = await wallet.methods .transfer({ secretKey: keyPair.secretKey, toAddress: ROUTER_REVISION_ADDRESS.V1, amount: '1000000', seqno: seqno, payload: tonToJettonTxParams.payload }) .send(); }

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