Core
Chain catalog
Import GrayChainId and catalog helpers from @gray3/core—single source of truth.
Overview
@gray3/core is the source of truth for on-chain catalog data: GrayChainId, families, native symbols, explorers, pathSlots, and related types. No network I/O. Client and Cloud APIs import from here—do not fork chain lists in your app.
Install
bash
pnpm add @gray3/core@gray3/client depends on @gray3/core and re-exports its chain helpers, so wallet apps usually do not need to install it separately.
Exports
| Field | Required | Description |
|---|---|---|
| chains | No | `GrayChainId`, catalog entries, `pathSlotsForFamily`, helpers |
| addresses | No | Validate/normalize Bitcoin, EVM, Solana, … |
| errors | No | `GrayError`, `isGrayError`, HTTP status helpers |
| credits | No | `CREDIT_METERS` — cloud metering keys |
| shared types | No | transactions, activity, portfolio, … for SDKs and docs |
Signature
js
import {
listChains,
getChain,
requireChain,
isGrayChainId,
pathSlotsForFamily,
GRAY_CHAIN_IDS,
} from "@gray3/core";
// The same helpers are re-exported from @gray3/client.Parameters
| Field | Required | Description |
|---|---|---|
| id / chainId | Yes | `string` — must be a `GrayChainId` for require/get helpers |
| family | Yes | `ChainFamily` — for `pathSlotsForFamily(family)` |
Response
ts
const eth = requireChain("ethereum");
// eth.pathSlots === 3, family, native symbol, explorer, …
listChains(); // readonly catalog entries
isGrayChainId("base"); // boolean
pathSlotsForFamily("solana"); // 2
GRAY_CHAIN_IDS // readonly GrayChainId[] (mainnets + testnets)Usage
js
const eth = requireChain("ethereum");
if (!isGrayChainId(userInput)) throw new Error("unknown chain");
const client = await GrayClient.create({
chains: ["ethereum", "base", "solana"],
});
// Full id lists: /sdks/chains/chain-ids
// Cloud GET /v1/chains returns plan-filtered entries derived from this catalog.Throws
| Field | Required | Description |
|---|---|---|
| invalid_argument / not_found | No | `requireChain(id)` when id is unknown (via client re-export). |
Human-readable guide: How to read the catalog.