Skip to main content
Version: 6.0.0-beta.3 - 6.0.0-beta.4

send()

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 = [...];
let contract = await tronWeb.contract(abi, 'contractAddress'); 
let result = await contract.function_name(para1,para2,...).send({
    feeLimit:100_000_000,
    callValue:0,
  tokenId:1000036,
  tokenValue:100,
  shouldPollResponse:true
});

Parameters

ParameterDescriptionData Type
feeLimitThe maximum SUN consumes by calling this contract method. Hard capped at 10000 TRX. (1TRX = 1,000,000SUN)Integer
callValueAmount of TRX transferred with this transaction, measured in SUN (1 TRX = 1,000,000 SUN).Integer
shouldPollResponseIf set to TRUE, this will wait until the transaction is confirmed on the solidity node before returning the result.Boolean
keepTxIDIf both shouldPollResponse and keepTxID set to TRUE, the method will return txID and poll result.Boolean
pollTimesIf 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
tokenIdIf the function accepts a trc 10 token ,then the id of the sameString
tokenValueAmount of token sent with the call.Integer

Returns

Object

Example

async function triggercontract(){
    try {
        let abi = [...];
        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();