Skip to content

Instantly share code, notes, and snippets.

@pawiromitchel
Created April 21, 2022 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawiromitchel/8a244c04efdb3f149efaac5be7cc77a4 to your computer and use it in GitHub Desktop.
Save pawiromitchel/8a244c04efdb3f149efaac5be7cc77a4 to your computer and use it in GitHub Desktop.
interact with a smart contract
const Contract = require('web3-eth-contract');
const url = `INFURA/QUICKNODE-API-ENDPOINT`;
Contract.setProvider(url);
let tokenAddress = "0x...";
let ABI = require('./ABI/erc20.json');
const contract = new Contract(ABI, tokenAddress);
contract.methods.totalSupply().call().then(console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment