-
-
Save NaoyaTabakomori/1d6e203ac7fe2c6154edcb42aacbdb0c to your computer and use it in GitHub Desktop.
クリアのご褒美としてトークンをおねだりする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var Web3 = require('web3'); | |
var web3 = new Web3('wss://ropsten.infura.io/ws'); | |
var santaClausABI = JSON.parse(fs.readFileSync('./build/contracts/SantaClaus.json')).abi; | |
var santaClausAddress = '0x05d9cbEe05e82D492ad66842fc7C0Cb363B384EA'; | |
var santaClaus = new web3.eth.Contract(santaClausABI, santaClausAddress); | |
var address = 'your address'; | |
var privkey = 'your priv key'; | |
async function giveMeToken() { | |
web3.eth.defaultAccount = address; | |
web3.eth.accounts.wallet.add(privkey); | |
var pray = await santaClaus.methods.requestToken().send({ | |
from: address, | |
gas: 4700000, | |
gasPrice: 20000000000, | |
}); | |
console.log(pray); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment