@avalanche-sdk/interchain
Version:
Interchain package for handling ICM/ICTT messages
31 lines • 960 B
JavaScript
import { createPublicClient, http } from "viem";
import { erc20ABI } from "../../abis/erc20ABI";
export async function getERC20TokenInfo(chain, erc20TokenAddress) {
const sourcePublicClient = createPublicClient({
chain,
transport: http(),
});
const [tokenName, tokenSymbol, tokenDecimals] = await Promise.all([
sourcePublicClient.readContract({
address: erc20TokenAddress,
abi: erc20ABI.abi,
functionName: "name",
}),
sourcePublicClient.readContract({
address: erc20TokenAddress,
abi: erc20ABI.abi,
functionName: "symbol",
}),
sourcePublicClient.readContract({
address: erc20TokenAddress,
abi: erc20ABI.abi,
functionName: "decimals",
}),
]);
return {
tokenName,
tokenSymbol,
tokenDecimals,
};
}
//# sourceMappingURL=getERC20TokenInfo.js.map