I have a function in my contract, suppose
function foo(uint _param1) payable {
require(msg.value == 1000);
someArray.push(x);
}
Then I have my Javascript code:
contract = web3.eth.contract(abi).at(address);
contract.foo("Hello World!", function(err, res){
alert("Transaction sent");
});
Now, I have the web3 injected by Metamask, so I must use the asynchronous method because MetaMask doesn't support the synchronous method without the callback. I have tried several ways to add an amount to my transaction, e.g. I've tried
contract.foo("Hello World!",
{from: web3.eth.coinbase, value: 1000},
function(err, res){
alert("Transaction sent");
}
);
but there is nothing that works!
So, how to solve it?