I'm writing a simple DApp in webpack sample(metacoin) in truffle,there is a function that need to call with 2 ether and 1 input parameter. And my question is how to call that function in the index.js,should i use xx.methods.function().send(from:,value:)?

Thanks so much.


Since you need to call a function with 2 ether and 1 input parameter, the right way of doing this will be:

let valueToSend = 2 * 10^18
        from: accountFromWhichTxIsInvoked,
        value: valueToSend

Note: -> 1 ether = 1 * 10^18

| improve this answer | |

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.