Created
February 14, 2020 06:47
-
-
Save dapplion/31cbfcc22817109855f383c716d1d229 to your computer and use it in GitHub Desktop.
Expand original in3 example interacting with contracts but through web3. Extends https://gist.github.com/simon-jentzsch/48fd7a5e9fd59e6d3a0c00815d37d24d
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
// import in3-Module | |
const In3Client = require("in3").default; | |
const Web3 = require("web3"); | |
// use the In3Client as Http-Provider | |
const web3 = new Web3( | |
new In3Client({ | |
proof: "standard", | |
signatureCount: 1, | |
requestCount: 2, | |
chainId: "mainnet", | |
replaceLatestBlock: 50 | |
}).createWeb3Provider() | |
); | |
const myTokenContract = "0xdac17f958d2ee523a2206206994597c13d831ec7"; | |
const myAccount = "0x5754284f345afc66a98fbb0a0afe71e0f007b949"; | |
const erc20Abi = [ | |
{ | |
constant: true, | |
inputs: [{ name: "_owner", type: "address" }], | |
name: "balanceOf", | |
outputs: [{ name: "balance", type: "uint256" }], | |
payable: false, | |
stateMutability: "view", | |
type: "function" | |
} | |
]; | |
const tokenContract = new web3.eth.Contract(erc20Abi, myTokenContract); | |
tokenContract.methods | |
.balanceOf(myAccount) | |
.call() | |
.then(balance => console.log("balance:", balance), console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an interessting error, since this is what happens:
The result looks good, so now we are trying to verify it.
base fee exceeds gas limit