Skip to content

Instantly share code, notes, and snippets.

@dpaluy
Created November 12, 2017 07:03
Show Gist options
  • Save dpaluy/4ecfb1d639ffe54d9de1c3317499e487 to your computer and use it in GitHub Desktop.
Save dpaluy/4ecfb1d639ffe54d9de1c3317499e487 to your computer and use it in GitHub Desktop.
function increaseCounter() {
var account = web3.eth.accounts[0];
var currentNumber = contract_instance.getMyNumber().toNumber();
currentNumber++;
// User dialog goes here
web3.personal.unlockAccount(account, 'secretpasswrod');
contract_instance.setMyNumber(currentNumber, {from: account, gas: 200000}, function(error, result) {
if (error) {
console.error(error);
} else {
var txHash = result;
console.log(txHash);
callWhenMined(txHash, getCounter());
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment