How to send TRX to a smart contract function in tronlink web

1.4k views Asked by At

How can I send tron to a smart contract function in tronlink web. I am trying the below method, but not working.

var contract = await tronweb.contract().at('{{env('CONTRACT_ADDRESS')}}')
await contract.Invest({{session('member_id')}}).address.send(amount);

it's calling the smart contract function but not sending tron.

1

There are 1 answers

0
Ming On BEST ANSWER

callValue - Amount of SUN transferred to the contract with this transaction. (1TRX = 1,000,000 SUN)

await contract.Invest({{session('member_id')}}).send({callValue: amount})

You can check tronweb documentation for send () parameters.