Skip to content

Instantly share code, notes, and snippets.

@13x54n
Created May 8, 2024 16:40
Show Gist options
  • Save 13x54n/f9875c0bbce5262c4eb8f7bfd24366cf to your computer and use it in GitHub Desktop.
Save 13x54n/f9875c0bbce5262c4eb8f7bfd24366cf to your computer and use it in GitHub Desktop.
// Setup: npm install alchemy-sdk
import { Alchemy, Network } from "alchemy-sdk";
const config = {
apiKey: "<-- ALCHEMY APP API KEY -->",
network: Network.ETH_MAINNET,
};
const alchemy = new Alchemy(config);
//Feel free to switch this wallet address with another address
const ownerAddress = "0x00000000219ab540356cbb839cbe05303d7705fa";
//The below token contract address corresponds to USDT
const tokenContractAddresses = ["0xdAC17F958D2ee523a2206206994597C13D831ec7"];
const data = await alchemy.core.getTokenBalances(
ownerAddress,
tokenContractAddresses
);
console.log("Token balance for Address");
console.log(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment