method.send()

Use send to execute a non-pure or modify smart contract method on a given smart contract that modify or change 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 contract = await tronWeb.contract.at('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
tokenIdIf the function accepts a trc 10 token , then the id of the sameString
tokenValueAmount of token sent with the call.Integer

Parameters
No need to pass parameters

Returns
Object

Example

async function triggercontract(){
    try {
        let instance = await tronWeb.contract().at('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();