> ## 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.

# chains: Chains record

> Chains record: the declaration and description of each of the 7 exports of @eco-incorp/sauce, @eco-incorp/sauce/chains.

Two registries. `CANONICAL_CHAINS` holds every chain a program can name, EVM chains and Solana, and is read by `requireChain`, `resolveChain` and the slug, id and alias lookups. The `chains` record, read by `getChain`, holds native-currency and explorer metadata for most EVM chains. The same exports come from the root and from `@eco-incorp/sauce/chains`.

```typescript theme={null}
import { requireChain, getChain } from "@eco-incorp/sauce/chains";
```

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

### `getChain`

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

```typescript theme={null}
export declare function getChain(chainId: number): Chain | undefined;
```

### `isTestnet`

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

Whether `chain` is a test network, whose coin and tokens have no value.

```typescript theme={null}
export declare function isTestnet(chain: CanonicalChain): boolean;
```

### `nativeCoinSymbol`

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

The symbol of `chain`'s native coin - ETH, SOL, AVAX, … - as `chains` records it, or for a
canonical chain it does not carry, as the table above does. A program reads a holder's balance of
the coin as `<holder>.balance` (`pot.balance`); `<holder>.<symbol>` is refused, naming it, unless
the symbol is also a token the chain registers (Arc's USDC), which it then reads.

```typescript theme={null}
export declare function nativeCoinSymbol(chain: CanonicalChain): string | undefined;
```

### `getAllChainIds`

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

```typescript theme={null}
export declare function getAllChainIds(): number[];
```

### `nativeErc20`

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

The ERC-20 that IS `chainId`'s native coin, or `undefined` on a chain whose native coin is
separate from every token (ETH, POL, …). Where it is defined the chain has no canonical wrapped
native (nothing needs wrapping), and the native balance and the token balance are one balance on
two decimal scales - see `NativeErc20`.

```typescript theme={null}
export declare function nativeErc20(chainId: number): NativeErc20 | undefined;
```

### `nativeToErc20Amount`

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

Converts a native amount (wei) on `chainId` to its native ERC-20's units, rounding down the way
`balanceOf` reads it: on Arc, `floor(wei / 1e12)`, so any amount below 1e12 wei reads as 0.
Throws on a chain whose native coin is not an ERC-20.

```typescript theme={null}
export declare function nativeToErc20Amount(chainId: number, wei: bigint): bigint;
```

### `chains`

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

All supported EVM chains. No RPC endpoints: callers bring their own.

```typescript theme={null}
chains: Record<number, Chain>
```


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