> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# routes: Token registry

> Token registry: the declaration and description of each of the 15 exports of @eco-incorp/sauce.

The `routes` namespace compiles a SauceScript program for one chain by name and builds the calls that run it. `routes.compileSauceProgram(chain, source, options?)` compiles with the chain's token symbols, protocol namespaces and `@sauce/token` in scope; `routes.encodeEntryArguments(program, values)` encodes `main`'s run-time arguments; `routes.buildSauceEvmCall(params)` builds one `cook(engine, program)` call on a Pot. The chain exports (`Base`, `Solana`, ...), `chain` and `Token` are named exports of the root, and importing the package puts nothing on `globalThis`.

```typescript theme={null}
import { routes, Base } from "@eco-incorp/sauce";
```

Generated from the type declarations of `@eco-incorp/sauce`.

### `routes.knownTokenSymbols`

*Function* · `@eco-incorp/sauce`

Every symbol this registry knows for `chain`, sorted for stable diagnostics/tests.

```typescript theme={null}
export declare function knownTokenSymbols(chain: CanonicalChain): readonly string[];
```

### `routes.registryTokenAddress`

*Function* · `@eco-incorp/sauce`

The registry's own value for `symbol` on `chain`, or `undefined` if unregistered: a token's
address on an EVM chain, a mint's 32-byte key on Solana.

```typescript theme={null}
export declare function registryTokenAddress(chain: CanonicalChain, symbol: string): bigint | undefined;
```

### `routes.registryTokens`

*Function* · `@eco-incorp/sauce`

Every registry token on `chain`, by symbol, each a frozen `RegistryToken`: an EVM chain's
tokens, or a Solana cluster's registered mints. The same objects on every call. Empty for a
chain the registry has no row for.

```typescript theme={null}
export declare function registryTokens(chain: CanonicalChain): Readonly<Record<string, RegistryToken>>;
```

### `routes.resolveTokenMap`

*Function* · `@eco-incorp/sauce`

THE one precedence resolver every token-address consumer goes through: registry rows for `chain`
first (an EVM chain's tokens, an svm chain's cluster mints as 32-byte keys), then `callerTokens`
merged PER KEY on top -- overriding one symbol (e.g. `USDC`) never drops an unrelated registry
symbol (e.g. `WETH`) for the same chain. With no `callerTokens`, the chain's registry map: the
same map on every call.

```typescript theme={null}
export declare function resolveTokenMap(chain: CanonicalChain, callerTokens?: Readonly<Record<string, AddressInput>>): ReadonlyMap<string, bigint>;
```

### `routes.SVM_TOKEN_REGISTRY`

*Variable* · `@eco-incorp/sauce`

Registered SPL mints, per Solana cluster: a program compiled for `solana` resolves its symbols
to `mainnet-beta`'s, one compiled for `solana-devnet` to `devnet`'s and one compiled for
`solana-testnet` to `testnet`'s.

```typescript theme={null}
SVM_TOKEN_REGISTRY: Readonly<Record<SvmTokenCluster, readonly SvmTokenRow[]>>
```

### `routes.svmTokenRows`

*Function* · `@eco-incorp/sauce`

The registered mints a program compiled for `chain` resolves its symbols to: none off SVM.

```typescript theme={null}
export declare function svmTokenRows(chain: CanonicalChain): readonly SvmTokenRow[];
```

### `routes.TOKEN_REGISTRY`

*Variable* · `@eco-incorp/sauce`

Keyed by canonical EVM chain id (`CanonicalChain.id`).

```typescript theme={null}
TOKEN_REGISTRY: Readonly<Record<number, readonly TokenRegistryRow[]>>
```

### `routes.RegistryToken`

*Interface* · `@eco-incorp/sauce`

One registry token on one chain, as a chain export carries it (`Base.USDC`): the same row a
compiled program's `USDC` resolves to on that chain.

```typescript theme={null}
export interface RegistryToken {
    readonly address: `0x${string}`;
    readonly decimals: number;
    readonly symbol: string;
    readonly chain: CanonicalChain;
    readonly mint?: string;
}
```

### `routes.StockToken`

*Interface* · `@eco-incorp/sauce`

What a stock row carries beyond a token's (`stock-tokens.ts`).

```typescript theme={null}
export interface StockToken {
    readonly issuer: StockIssuer;
    readonly name: string;
    readonly ticker: string;
}
```

### `routes.SvmTokenCluster`

*Type* · `@eco-incorp/sauce`

A Solana cluster a mint is registered on. `mainnet-beta` is the canonical `solana` chain.

```typescript theme={null}
export type SvmTokenCluster = "mainnet-beta" | "devnet" | "testnet";
```

### `routes.SvmTokenRow`

*Interface* · `@eco-incorp/sauce`

```typescript theme={null}
export interface SvmTokenRow {
    readonly symbol: string;
    readonly mint: string;
    readonly tokenProgram: SolanaAddress;
    readonly address: `0x${string}`;
    readonly stock?: StockToken;
    readonly decimals: number;
    readonly source: string;
}
```

### `routes.TokenRegistryRow`

*Interface* · `@eco-incorp/sauce`

```typescript theme={null}
export interface TokenRegistryRow {
    readonly symbol: string;
    readonly onchainSymbol?: string;
    readonly address: `0x${string}`;
    readonly decimals: number;
    readonly source: string;
    readonly stock?: StockToken;
}
```

### `routes.STOCK_ISSUERS`

*Variable* · `@eco-incorp/sauce`

Each issuer's name, the published list its rows are copied from, and whether its Solana mints
charge a transfer fee (Token-2022's TransferFee, withheld from what the recipient gets), which
the evidence holds every mint to.

```typescript theme={null}
STOCK_ISSUERS: Readonly<Record<StockIssuer, {
    readonly name: string;
    readonly source: string;
    readonly transferFee?: true;
}>>
```

### `routes.stockSymbol`

*Function* · `@eco-incorp/sauce`

The registry symbol for an issuer's symbol: the same, with a "." as "\_".

```typescript theme={null}
export declare function stockSymbol(symbol: string): string;
```

### `routes.StockIssuer`

*Type* · `@eco-incorp/sauce`

An issuer whose list `stock-tokens.generated.ts` copies.

```typescript theme={null}
export type StockIssuer = "backed" | "ondo" | "coinbase" | "mtpelerin" | "backpack" | "prestocks";
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.