Payable Function – Sending Ether to a Payable Function from Nethereum

contract-invocationethernethereumpayable

I have created a payable function in a smart contract and deployed it in a private blockchain network. Now I am using Nethereum to make rpc calls to the geth node on which the network is running.

But I am unable to find how to pass ether while calling a payable function from nethereum.

The geth equivalent of what I want is

Contract.function({from:"address, value:"amount"})

Best Answer

suppose my_function is a payable function why not to use?

function.SendTransactionAsync(addressFrom, gas, valueAmount, augEvent);. } in the valueAmount you specify the ethers to send.

For example :

 var my_functionFunction = contract.GetFunction("my_function");
            var tx = await my_functionFunction.SendTransactionAsync(addressFrom, gas, valueAmount, augEvent);

if you want to provide the function's parameters (e.g my_function(param1,param2, param3)) use :

  transactionHash = await my_functionFunction.SendTransactionAsync(addressFrom, gas, valueAmount, param1, param2, param3);
Related Topic