You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const transfer = async () => {
try {
const WalletClass = tonweb.wallet.all['v4R2'];
const wallet = new WalletClass(tonweb.provider, {
publicKey: HOT_WALLET_ADDRESS,
wc: 0
});
// const seqno = await wallet.methods.seqno().call() || 0;
let string_private_key = JSON.parse(HOT_WALLET_PRIVATE_KEY)
const keyPair = TonWeb.utils.nacl.sign.keyPair.fromSecretKey(Buffer.from(string_private_key), "hex");
let amountsToTransfer = TonWeb.utils.toNano('0.01');
console.log(amountsToTransfer);
// Create transfer
const transfer = await wallet.methods.transfer({
secretKey: keyPair.secretKey,
toAddress: 'EQDQfus9g97M88HUtU8JHDPHk_YKGo8u7Zs6yrhOHbqXvImS',
amount: amountsToTransfer, // 0.01 TON
seqno: 0,
payload: 'The aim of this text is to provide a brief',
});
// get estimate fee of transfer
const transferFee = await transfer.estimateFee();
console.log(transferFee);
// send transfer query to blockchain
const transferSended = await transfer.send();
console.log(transferSended);
const query = await transfer.getQuery();
console.log(query);
// const boc = TonWeb.utils.bytesToBase64(await query.toBoc(false)); // serialized query
// // await tonweb.provider.sendBoc(boc); // send query to network
// // Parse query
// try {
// const parsed = WalletClass.parseTransferQuery(TonWeb.boc.Cell.oneFromBoc(TonWeb.utils.base64ToBytes(boc)));
// parsed.value = parsed.value.toString();
// parsed.fromAddress = parsed.fromAddress.toString(true, true, true);
// parsed.toAddress = parsed.toAddress.toString(true, true, true);
// console.log(parsed);
// } catch (e) {
// console.error(e); // not valid wallet transfer query
// }
} catch (error) {
console.log('catch error => ', error)
}
}
transfer();
Getting Issue after running ton transfer method is :
BN { negative: 0, words: [ 10000000 ], length: 1, red: null }
catch error => Error: Invalid character
at assert (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:6:21)
at parseBase (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:269:7)
at BN._parseBase (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:305:14)
at BN.init [as _init] (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:99:12)
at new BN (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:39:12)
at BitString.writeUint (/home/charvik/codes/tests/ton/node_modules/tonweb/src/boc/BitString.js:118:18)
at BitString.writeUint8 (/home/charvik/codes/tests/ton/node_modules/tonweb/src/boc/BitString.js:167:14)
at BitString.writeBytes (/home/charvik/codes/tests/ton/node_modules/tonweb/src/boc/BitString.js:176:18)
at WalletV4ContractR2.createDataCell (/home/charvik/codes/tests/ton/node_modules/tonweb/src/contract/wallet/WalletContractV4R2.js:66:19)
at WalletV4ContractR2.createStateInit (/home/charvik/codes/tests/ton/node_modules/tonweb/src/contract/index.js:51:31)
The text was updated successfully, but these errors were encountered:
My Code :
Getting Issue after running ton transfer method is :
BN { negative: 0, words: [ 10000000 ], length: 1, red: null }
catch error => Error: Invalid character
at assert (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:6:21)
at parseBase (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:269:7)
at BN._parseBase (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:305:14)
at BN.init [as _init] (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:99:12)
at new BN (/home/charvik/codes/tests/ton/node_modules/bn.js/lib/bn.js:39:12)
at BitString.writeUint (/home/charvik/codes/tests/ton/node_modules/tonweb/src/boc/BitString.js:118:18)
at BitString.writeUint8 (/home/charvik/codes/tests/ton/node_modules/tonweb/src/boc/BitString.js:167:14)
at BitString.writeBytes (/home/charvik/codes/tests/ton/node_modules/tonweb/src/boc/BitString.js:176:18)
at WalletV4ContractR2.createDataCell (/home/charvik/codes/tests/ton/node_modules/tonweb/src/contract/wallet/WalletContractV4R2.js:66:19)
at WalletV4ContractR2.createStateInit (/home/charvik/codes/tests/ton/node_modules/tonweb/src/contract/index.js:51:31)
The text was updated successfully, but these errors were encountered: