Skip to content

Instantly share code, notes, and snippets.

@nglglhtr

nglglhtr/test.js Secret

Created Jul 7, 2020
Embed
What would you like to do?
const Web3 = require("web3");
const { GSNProvider } = require("@openzeppelin/gsn-provider");
const web3 = new Web3(new GSNProvider("http://localhost:8545"));
const address = '0x4e065E5201e281fd9285616E4a6bE477fb1C5C07'
const abi = require('../build/contracts/Counter.json').abi;
const user1 = '0x7e8bc270e87fadef902b08527d18e3b0e107a5b6e791cb6100ad93453026d59f'
const user2 = '0x2181145e30198499792536c2a26849e1febdfa6bb38c47fa32e410ffdfc85dd8'
const counter = new web3.eth.Contract(abi, address);
web3.eth.accounts.wallet.add (user1)
async function test () {
let c = await counter.methods.getCounter().call();
console.log ('count - ', c)
let r = await counter.methods.increaseCounter(1).send ({
// from: '0xC57e99E374A90a08EED17583ddf1C3dE5240059c',
from: web3.eth.accounts.wallet[0].address,
})
console.log (r)
}
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.