MCPcopy Create free account
hub / github.com/Bot80926/ethers-scripts / getTokenBalance

Method getTokenBalance

utils/provider.js:45–66  ·  view source on GitHub ↗
(address, contract, blockTag = "latest")

Source from the content-addressed store, hash-verified

43 }
44
45 async getTokenBalance(address, contract, blockTag = "latest") {
46 const balanceOfAbi = [{
47 "inputs": [{
48 "internalType": "address",
49 "name": "account",
50 "type": "address",
51 }, ],
52 "name": "balanceOf",
53 "outputs": [{
54 "internalType": "uint256",
55 "name": "",
56 "type": "uint256",
57 }, ],
58 "stateMutability": "view",
59 "type": "function",
60 }];
61 const erc20 = new Ethers.Contract(contract, balanceOfAbi, this.provider);
62
63 return await erc20.balanceOf(address, {
64 blockTag
65 });
66 }
67
68 async getTransactionCount(address, blockTag = "latest") {
69 return await this.provider.getTransactionCount(address, blockTag);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected