Skip to main content
Version: 6.0.4

send() <src>

Use send to execute a non-pure or modify smart contract method on a given smart contract that modifies or changes values on the blockchain. These methods consume resources(bandwidth and energy) to perform as the changes need to be broadcasted out to the network.

Usage

let abi = [...] as const;
let contract = await tronWeb.contract(abi, 'contractAddress');
let result = await contract.function_name(param1,param2,...).send({
feeLimit:100_000_000,
callValue:0,
tokenId:'1000036',
tokenValue:100,
shouldPollResponse:true
});

Parameters

ParameterDescriptionData Type
feeLimitOptional. The maximum SUN consumes by calling this contract method. Hard capped at 15000 TRX. (1TRX = 1,000,000SUN)Integer
callValueOptional. Amount of TRX transferred with this transaction, measured in SUN (1 TRX = 1,000,000 SUN).Integer
shouldPollResponseOptional. If set to TRUE, this will wait until the transaction is confirmed on the solidity node before returning the result.Boolean
keepTxIDOptional. If both shouldPollResponse and keepTxID set to TRUE, the method will return txID and poll result.Boolean
rawResponseOptional. If set to TRUE, this will return the raw response.Boolean
pollTimesOptional. If shouldPollResponse is set to TRUE, this will wait until the transaction is confirmed on the solidity node or the result has been polled the times specified by this parameter.Integer
tokenIdOptional. If the function accepts a trc 10 token ,then the id of the sameString
tokenValueOptional. Amount of token sent with the call.Integer

Returns

Object - Method calling result. or String - Transaction ID.

Example

async function triggercontract(){
try {
let abi = [...] as const;
let instance = await tronWeb.contract(abi, 'TQQg4EL8o1BSeKJY4MJ8TB8XK7xufxFBvK');
let res = await instance.transfer('TWbcHNCYzqAGbrQteKnseKJdxfzBHyTfuh',500).send({
feeLimit:100_000_000,
callValue:0,
shouldPollResponse:true
});

console.log(res);

} catch (error) {
console.log(error);
}
}

triggercontract();