Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Back to post

Revisions 2

5 months ago
Zero amount jettons in transaction
Zerom amount jettons in transaction
I'm trying to send jettons from one wallet to another. For this I use the library tonweb. Whenever i send transaction, i get a zero amount of tokens. Why is this and how can i fix it? My code looks like: ``` import Env from "@ioc:Adonis/Core/Env"; import TonWeb from "tonweb"; import {mnemonicToWalletKey} from "@ton/crypto"; const mnemonic = Env.get('TON_MNEMONIC'); const tonweb = new TonWeb(new TonWeb.HttpProvider('https://toncenter.com/api/v2/jsonRPC', {apiKey: 'e................4fef9'})); export const SendTokens = async () => { const keyPair = await mnemonicToWalletKey(mnemonic.split(" ")); const WalletClass = tonweb.wallet.all.v4R2; const wallet = new WalletClass(tonweb.provider, { publicKey: keyPair.publicKey }); const address = await wallet.getAddress(); console.log("my address", address.toString()); const jettonMinter = new TonWeb.token.jetton.JettonMinter(tonweb.provider, { adminAddress: address, jettonContentUri: "", jettonWalletCodeHex: "GEM", address: "0:e609c3e241e054e3f078a974e7cd46ea49bcb3e3d8ac4d48c658d27970edb072"}); const data = await jettonMinter.getJettonData(); console.log('Total supply:', data.totalSupply.toString()); console.log('URI to off-chain metadata:', data.jettonContentUri); //console.log('Owner address:', data.adminAddress(true, true, true)); const jettonWalletAddress = await jettonMinter.getJettonWalletAddress(address); console.log("jetton wallet address", jettonWalletAddress.toString()) const jettonWallet = new TonWeb.token.jetton.JettonWallet(tonweb.provider, { address: jettonWalletAddress }); const jettonData = await jettonWallet.getData(); console.log("minter address", jettonData.jettonMinterAddress.toString()); console.log('Jetton wallet address:', address.toString(true, true, true)); const seqno = (await wallet.methods.seqno().call()) || 0; console.log('Secno:', seqno); const comment = new Uint8Array([... new Uint8Array(4), ... new TextEncoder().encode('transfer GEM 3')]); await wallet.methods.transfer({ secretKey: keyPair.secretKey, toAddress: jettonWalletAddress, // address of Jetton wallet of Jetton sender amount: TonWeb.utils.toNano('0.05'), // total amount of TONs attached to the transfer message seqno: seqno, payload: await jettonWallet.createTransferBody({ queryId: seqno, tokenAmount: TonWeb.utils.toNano('0.05'), // Jetton amount (in basic indivisible units) toAddress: new TonWeb.utils.Address("0:19b46402e5e4c173ea84d8125345f67fe0a07f113588ab897408231d482044b1"), // recepient user's wallet address (not Jetton wallet) forwardAmount: TonWeb.utils.toNano('0.01'), // some amount of TONs to invoke Transfer notification message forwardPayload: comment, // text comment for Transfer notification message responseAddress: address // return the TONs after deducting commissions back to the sender's wallet address }), sendMode: 3, }).send() } ``` zero transactions in viewer https://tonviewer.com/EQAxLtVoJedFWnlIw0Z35Bjmw3HSY8D9fg-mAxwj5AJ_3Us-/jetton/EQDmCcPiQeBU4_B4qXTnzUbqSbyz49isTUjGWNJ5cO2wcs5s
I'm trying to send jettons from one wallet to another. For this I use the library tonweb. Whenever i send transaction, i get a zero amount of tokens. Why is this and how can i fix it? My code looks like: ``` import Env from "@ioc:Adonis/Core/Env"; import TonWeb from "tonweb"; import {mnemonicToWalletKey} from "@ton/crypto"; const mnemonic = Env.get('TON_MNEMONIC'); const tonweb = new TonWeb(new TonWeb.HttpProvider('https://toncenter.com/api/v2/jsonRPC', {apiKey: 'e................4fef9'})); export const SendTokens = async () => { const keyPair = await mnemonicToWalletKey(mnemonic.split(" ")); const WalletClass = tonweb.wallet.all.v4R2; const wallet = new WalletClass(tonweb.provider, { publicKey: keyPair.publicKey }); const address = await wallet.getAddress(); console.log("my address", address.toString()); const jettonMinter = new TonWeb.token.jetton.JettonMinter(tonweb.provider, { adminAddress: address, jettonContentUri: "", jettonWalletCodeHex: "GEM", address: "0:e609c3e241e054e3f078a974e7cd46ea49bcb3e3d8ac4d48c658d27970edb072"}); const data = await jettonMinter.getJettonData(); console.log('Total supply:', data.totalSupply.toString()); console.log('URI to off-chain metadata:', data.jettonContentUri); //console.log('Owner address:', data.adminAddress(true, true, true)); const jettonWalletAddress = await jettonMinter.getJettonWalletAddress(address); console.log("jetton wallet address", jettonWalletAddress.toString()) const jettonWallet = new TonWeb.token.jetton.JettonWallet(tonweb.provider, { address: jettonWalletAddress }); const jettonData = await jettonWallet.getData(); console.log("minter address", jettonData.jettonMinterAddress.toString()); console.log('Jetton wallet address:', address.toString(true, true, true)); const seqno = (await wallet.methods.seqno().call()) || 0; console.log('Secno:', seqno); const comment = new Uint8Array([... new Uint8Array(4), ... new TextEncoder().encode('transfer GEM 3')]); await wallet.methods.transfer({ secretKey: keyPair.secretKey, toAddress: jettonWalletAddress, // address of Jetton wallet of Jetton sender amount: TonWeb.utils.toNano('0.05'), // total amount of TONs attached to the transfer message seqno: seqno, payload: await jettonWallet.createTransferBody({ queryId: seqno, tokenAmount: TonWeb.utils.toNano('0.05'), // Jetton amount (in basic indivisible units) toAddress: new TonWeb.utils.Address("0:19b46402e5e4c173ea84d8125345f67fe0a07f113588ab897408231d482044b1"), // recepient user's wallet address (not Jetton wallet) forwardAmount: TonWeb.utils.toNano('0.01'), // some amount of TONs to invoke Transfer notification message forwardPayload: comment, // text comment for Transfer notification message responseAddress: address // return the TONs after deducting commissions back to the sender's wallet address }), sendMode: 3, }).send() } ``` zero transactions in viewer https://tonviewer.com/EQAxLtVoJedFWnlIw0Z35Bjmw3HSY8D9fg-mAxwj5AJ_3Us-/jetton/EQDmCcPiQeBU4_B4qXTnzUbqSbyz49isTUjGWNJ5cO2wcs5s
#js #jetton #tonweb
#js #jetton #tonweb
5 months ago
Original
Zerom amount jettons in transaction

I'm trying to send jettons from one wallet to another. For this I use the library tonweb. Whenever i send transaction, i get a zero amount of tokens. Why is this and how can i fix it? My code looks like: ``` import Env from "@ioc:Adonis/Core/Env"; import TonWeb from "tonweb"; import {mnemonicToWalletKey} from "@ton/crypto"; const mnemonic = Env.get('TON_MNEMONIC'); const tonweb = new TonWeb(new TonWeb.HttpProvider('https://toncenter.com/api/v2/jsonRPC', {apiKey: 'e................4fef9'})); export const SendTokens = async () => { const keyPair = await mnemonicToWalletKey(mnemonic.split(" ")); const WalletClass = tonweb.wallet.all.v4R2; const wallet = new WalletClass(tonweb.provider, { publicKey: keyPair.publicKey }); const address = await wallet.getAddress(); console.log("my address", address.toString()); const jettonMinter = new TonWeb.token.jetton.JettonMinter(tonweb.provider, { adminAddress: address, jettonContentUri: "", jettonWalletCodeHex: "GEM", address: "0:e609c3e241e054e3f078a974e7cd46ea49bcb3e3d8ac4d48c658d27970edb072"}); const data = await jettonMinter.getJettonData(); console.log('Total supply:', data.totalSupply.toString()); console.log('URI to off-chain metadata:', data.jettonContentUri); //console.log('Owner address:', data.adminAddress(true, true, true)); const jettonWalletAddress = await jettonMinter.getJettonWalletAddress(address); console.log("jetton wallet address", jettonWalletAddress.toString()) const jettonWallet = new TonWeb.token.jetton.JettonWallet(tonweb.provider, { address: jettonWalletAddress }); const jettonData = await jettonWallet.getData(); console.log("minter address", jettonData.jettonMinterAddress.toString()); console.log('Jetton wallet address:', address.toString(true, true, true)); const seqno = (await wallet.methods.seqno().call()) || 0; console.log('Secno:', seqno); const comment = new Uint8Array([... new Uint8Array(4), ... new TextEncoder().encode('transfer GEM 3')]); await wallet.methods.transfer({ secretKey: keyPair.secretKey, toAddress: jettonWalletAddress, // address of Jetton wallet of Jetton sender amount: TonWeb.utils.toNano('0.05'), // total amount of TONs attached to the transfer message seqno: seqno, payload: await jettonWallet.createTransferBody({ queryId: seqno, tokenAmount: TonWeb.utils.toNano('0.05'), // Jetton amount (in basic indivisible units) toAddress: new TonWeb.utils.Address("0:19b46402e5e4c173ea84d8125345f67fe0a07f113588ab897408231d482044b1"), // recepient user's wallet address (not Jetton wallet) forwardAmount: TonWeb.utils.toNano('0.01'), // some amount of TONs to invoke Transfer notification message forwardPayload: comment, // text comment for Transfer notification message responseAddress: address // return the TONs after deducting commissions back to the sender's wallet address }), sendMode: 3, }).send() } ``` zero transactions in viewer https://tonviewer.com/EQAxLtVoJedFWnlIw0Z35Bjmw3HSY8D9fg-mAxwj5AJ_3Us-/jetton/EQDmCcPiQeBU4_B4qXTnzUbqSbyz49isTUjGWNJ5cO2wcs5s
#js #jetton #tonweb