3

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"})
  • Try this - Contract.function("function parameter if any", {from: "address", value: web3.toWei("value in ether")}) – Sanchit Jun 19 '17 at 9:07
1

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);
  • My requirement is to also send parameters to the function. So I should modify the code as var my_functionFunction = contract.GetFunction("my_function"); var tx = await my_functionFunction.SendTransactionAsync(addressFrom, gas, valueAmount, augEvent, parameters); Also What does the argument augEvent signify ? – vitoscalleta Jun 19 '17 at 10:05
  • check my previous answer i've edited it – Badr Bellaj Jun 19 '17 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.