A JS library for CIP34 that defines chain IDs for Cardano.
Network name | CIP34 chain ID |
---|---|
PreProduction | cip34:0-1 |
Mainnet | cip34:1-764824073 |
Generate chain ID from registry data
import { toChainId } from "@dcspark/cip34-js";
import registry from "@dcspark/cip34-js/registry";
const chainId = toChainId({
networkId: registry.Mainnet.NetworkId,
networkMagic: registry.Mainnet.NetworkMagic,
});
Get parts from chain ID
import { fromChainId } from "@dcspark/cip34-js";
const { networkId, networkMagic } = fromChainId(chainId);
The current status of the registry is tracked inside the CIP repository. To keep things in sync, this project uses the CIP repo as a git submodule.
To use the latest version of the registry,
git submodule init
git submodule update
- (whenever you want to update afterwards)
npm run update-submodule