@contractjs/erc20
Version:
A TypeScript utility library for ERC20 contracts.
34 lines • 1.96 kB
TypeScript
import { Address } from "ox";
import { SYMBOL_TO_ADDRESS } from "./constants";
import { ChainIdentifier } from "./utils";
export type BalanceOfResult = {
balance: bigint;
formattedBalance: string;
valueInUSD: number;
};
export declare const nameCalldata: () => `0x${string}`;
export declare const symbolCalldata: () => `0x${string}`;
export declare const decimalsCalldata: () => `0x${string}`;
export declare const totalSupplyCalldata: () => `0x${string}`;
export declare const balanceOfCalldata: (account: Address.Address) => `0x${string}`;
export declare const allowanceCalldata: (owner: Address.Address, spender: Address.Address) => `0x${string}`;
export declare const transferCalldata: (to: Address.Address, value: bigint) => `0x${string}`;
export declare const transferFromCalldata: (from: Address.Address, to: Address.Address, value: bigint) => `0x${string}`;
export declare const approveCalldata: (spender: Address.Address, amount: bigint) => `0x${string}`;
export declare const burnCalldata: (value: bigint) => `0x${string}`;
export declare const burnFromCalldata: (account: Address.Address, value: bigint) => `0x${string}`;
export declare const permitCalldata: (owner: Address.Address, spender: Address.Address, value: bigint, deadline: bigint, v: number, r: `0x${string}`, s: `0x${string}`) => `0x${string}`;
/**
* Gets the token address on the specified chain.
* @param tokenSymbol - The token symbol. Currently supported tokens are USDC, USDT, LINK, and WETH.
* @returns The token contract address for the specified chain
*/
export declare const addressOf: (tokenSymbol: keyof typeof SYMBOL_TO_ADDRESS) => {
/**
* Gets the token address on the specified chain.
* @param chain - The chain identifier (e.g., 'base', 8453, or a viem Chain object)
* @returns The token contract address for the specified chain
*/
onChain: (chain: ChainIdentifier) => Address.Address;
};
//# sourceMappingURL=erc20Utils.d.ts.map