Skip to main content
@chipi-stack/core is in development (v0.1.0). APIs may change before stable release.

Overview

TokenRegistry provides a lookup table for token metadata (symbol, decimals, address, name) on StarkNet networks. It ships with built-in presets for mainnet and Sepolia, eliminating the need to hardcode token addresses.

Usage

Constructor

Parameters

  • network ("mainnet" | "sepolia"): The StarkNet network to load presets for

Throws

  • If network is not "mainnet" or "sepolia"

Methods

bySymbol(symbol)

Find a token by its symbol (case-insensitive).

Parameters

  • symbol (string): Token symbol (e.g., "USDC", "ETH")

Returns

TokenEntry | undefined

byAddress(address)

Find a token by its contract address (case-insensitive).

Parameters

  • address (string): Token contract address

Returns

TokenEntry | undefined

all()

List all tokens in this registry.

Returns

TokenEntry[]

Built-in Presets

Mainnet

Sepolia (Testnet)

TokenEntry Type

TokenEntry extends TokenInfo (used by Amount.parse()) with an additional name field.

Example

  • Amount: Use TokenEntry from the registry with Amount.parse()
  • Erc20: Pass TokenEntry to the Erc20 constructor