@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
27 lines (24 loc) • 719 B
text/typescript
import { Network } from "./types.js";
/**
* The address of an ERC20 token for a given network.
*/
const addressMap = {
base: {
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
},
"base-sepolia": {
usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
},
};
/**
* Get the address of an ERC20 token for a given network.
* If a contract address is provided, it will not be found in the map and will be returned as is.
*
* @param token - The token symbol or contract address.
* @param network - The network to get the address for.
*
* @returns The address of the ERC20 token.
*/
export function getErc20Address(token: string, network: Network) {
return addressMap[network][token] ?? token;
}