Hello
Does anybody know about send trx fromAccount to another account like bellow ?
const privateKey = "private-key";
const fromAccount = "from-account";
const toAccount = "to-account";
const memo = "transfer";
const TronWeb = require('tronweb');
const HttpProvider = TronWeb.providers.HttpProvider;
const fullNode = new HttpProvider("api.trongrid.io");
const solidityNode = new HttpProvider("api.trongrid.io");
const eventServer = new HttpProvider("api.trongrid.io");
const tronWeb = new TronWeb(fullNode, solidityNode, eventServer, privateKey);
async function main() {
console.log(tronWeb.defaultAddress.base58, "=>", toAccount);
const unSignedTxn = await tronWeb.transactionBuilder.sendTrx(fromAccount, 1, toAccount);
const unSignedTxnWithNote = await tronWeb.transactionBuilder.addUpdateData(unSignedTxn, memo, 'utf8');
const signedTxn = await tronWeb.trx.sign(unSignedTxnWithNote);
console.log("signed =>", signedTxn);
const ret = await tronWeb.trx.sendRawTransaction(signedTxn);
console.log("broadcast =>", ret);
};
main();
the error is : Validate TransferContract error, no OwnerAccount.
what is the syntax of .sendTrx();
Please guide me ...
May 25, 2021, 4:15 PM