Created
February 15, 2023 10:34
Revisions
-
syshen created this gist
Feb 15, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ const Web3 = require('web3'); const web3 = new Web3(new Web3.providers.HttpProvider('<Node API endpoint>')); const balanceOfABI = [ { "constant": true, "inputs": [ { "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "balance", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, ]; const usdt = new web3.eth.Contract(balanceOfABI, '0xdAC17F958D2ee523a2206206994597C13D831ec7'); async function getUSDTBalance(walletAddress) { const result = await usdt.methods.balanceOf(walletAddress).call({}, '16632997'); console.log(result); } getUSDTBalance('0xDFd5293D8e347dFe59E90eFd55b2956a1343963d').then(console.log).catch(console.error);