@dcspark/cip34-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

CIP34-JS

A JS library for CIP34 that defines chain IDs for Cardano.

Example

Network name CIP34 chain ID
PreProduction cip34:0-1
Mainnet cip34:1-764824073

Usage

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);

Updating

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.

npm run update-submodule && npm run regen-types && npm run build

Package Sidebar

Install

npm i @dcspark/cip34-js

Weekly Downloads

75

Version

1.0.1

License

Apache-2.0 OR MIT

Unpacked Size

8.87 kB

Total Files

12

Last publish

Collaborators

  • robkorn
  • sebastiengllmt