Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const TonWeb = require('tonweb');
- const Address = TonWeb.utils.Address;
- const NftUtils = require('tonweb/src/contract/token/nft/NftUtils');
- const utils = TonWeb.utils;
- const Cell = TonWeb.boc.Cell;
- const { JettonMinter, JettonWallet } = TonWeb.token.jetton;
- const TonMnemonic = require('tonweb-mnemonic');
- const BN = require('bn.js');
- const toWallet = new Address('Ef8WbMN3cjOX59wsztE5e4y9lfryzP6js7ahFpE797XOxkwA');
- const tonApiKey = "";
- const tonweb = new TonWeb(new TonWeb.HttpProvider('https://testnet.toncenter.com/api/v2/jsonRPC', { apiKey: tonApiKey }));
- const walletMnemonic = [
- '', '', '',
- '', '', '',
- '', '', '',
- '', '', '',
- '', '', '',
- '', '', '',
- '', '', '',
- '', '', ''
- ];
- async function run() {
- async function getWalletKeys(walletMnemonic) {
- return await TonMnemonic.mnemonicToKeyPair(walletMnemonic);
- }
- const walletKeys = await getWalletKeys(walletMnemonic);
- const WalletClass = tonweb.wallet.all['v4R2'];
- const wallet = new WalletClass(tonweb.provider, {
- publicKey: walletKeys.publicKey,
- });
- const walletAddress = await wallet.getAddress();
- const walletBalance = await tonweb.getBalance(walletAddress);
- console.log(`wallet: ${walletAddress.toString(true, true, true)} balance: ${walletBalance} nanoTON`);
- const seqno = (await wallet.methods.seqno().call()) || 0;
- const sendKoteResult = await wallet.methods.transfer({
- secretKey: walletKeys.secretKey,
- toAddress: 'Ef8WbMN3cjOX59wsztE5e4y9lfryzP6js7ahFpE797XOxkwA',
- amount: TonWeb.utils.toNano(0.04),
- seqno: seqno,
- payload: null,
- sendMode: 32,
- }).send();
- console.log(sendKoteResult);
- }
- run();
Advertisement
Add Comment
Please, Sign In to add comment