CAIP standard utils
import { ChainId } from "caip";
const chainId = new ChainId("eip155:1");
// OR
const chainId = new ChainId({ namespace: "eip155", reference: "1" });
// THEN
chainId.toString();
// "eip155:1"
chainId.toJSON();
// { namespace: "eip155", reference: "1" }
import { ChainId } from "caip";
ChainId.parse("eip155:1");
// { namespace: "eip155", reference: "1" }
// AND
ChainId.format({ namespace: "eip155", reference: "1" });
// "eip155:1"
import { AccountId } from "caip";
const accountId = new AccountId(
"eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb"
);
// OR
const accountId = new AccountId({
chainId: { namespace: "eip155", reference: "1" },
address: <