Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check token balance of an address in js

const minABI = [
  {
    constant: true,

    inputs: [{ name: "_owner", type: "address" }],

    name: "balanceOf",

    outputs: [{ name: "balance", type: "uint256" }],

    type: "function",
  },
];

const web3client = new Web3(new Web3.providers.HttpProvider(provider));

const getBalance = async (client, contractAddress, walletAddress) => {
  const contract = new client.eth.Contract(minABI, contractAddress);
  const result = await contract.methods.balanceOf(walletAddress).call();
  const format = client.utils.fromWei(result);
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: onclick readmore and readless react js 
Javascript :: NavBar with divs 
Javascript :: Backbone View Template 
Javascript :: problem with Next.js and @material-ui. 
Javascript :: camelcase to css variable javascript 
Javascript :: How to Loop Through an Array with a While Loop in JavaScript 
Javascript :: mongodb instructions 
Javascript :: miragejs url parameters 
Javascript :: Update react final form field 
Javascript :: strictPopulate 
Javascript :: Populate a Select Dropdown List using JSON 
Javascript :: Backbone View Notes 
Javascript :: Solution-2--solution options for reverse bits algorithm js 
Javascript :: nested object in javascript 
Javascript :: responsive navbar react 
Javascript :: electron npm start not working 
Javascript :: newtonsoft json parse string 
Javascript :: javascript change checkbox state 
Javascript :: regex in javascript 
Javascript :: subarray javascript 
Javascript :: req.body showing undefined 
Javascript :: how to add prefix to a string in javascript 
Javascript :: javascript if object element exists 
Javascript :: Convert to String Explicitly 
Javascript :: Export Multiple Objects 
Javascript :: javascript Undeclared variable is not allowed 
Javascript :: javascript even/uneven numbers 
Javascript :: convert to slug javascript 
Javascript :: get page scrolling amount js 
Javascript :: phaser set x y 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =