Common

The @wharfkit/common is an open-source library that provides shared types and functionality across the Wharf project. It is published on npmjs.org, and is available on Github. It is automatically included with many Wharf packages and made available as part of their distribution.

Listed below are the components found within this package.

Chains

import { Chains } from "@wharfkit/common"

The Chains constant is a predefined list of known blockchains. Each blockchain stored here contains a completed ChainDefinition that is ready for use in an application. These can be passed in during the initialization of the Session Kit or the Contract Kit.

const sessionKit = new SessionKit({
  // ...arguments
  chains: [Chains.Jungle4],
})

The current list of available blockchains within the Chains constant can be found on Github.

ChainDefinition

import { ChainDefinition } from "@wharfkit/common"

The ChainDefinition class is provided to define the information required to describe an Antelope blockchain. It contains identifying information about the network and connection information.

The most basic instantiation of a ChainDefinition requires passing the blockchain’s ID and the URL of an API it can use to connect with.

const jungle = ChainDefinition.from({
  id: "73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d",
  url: "https://jungle4.greymass.com",
})

This information will then be typed using Antelope types and helper functions made available to reference related information.