Skip to content
Docs

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

FieldRequiredDescription
chainsNo`GrayChainId`, catalog entries, `pathSlotsForFamily`, helpers
addressesNoValidate/normalize Bitcoin, EVM, Solana, …
errorsNo`GrayError`, `isGrayError`, HTTP status helpers
creditsNo`CREDIT_METERS` — cloud metering keys
shared typesNotransactions, 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

FieldRequiredDescription
id / chainIdYes`string` — must be a `GrayChainId` for require/get helpers
familyYes`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

FieldRequiredDescription
invalid_argument / not_foundNo`requireChain(id)` when id is unknown (via client re-export).

Human-readable guide: How to read the catalog.