39.0.0 • Published 4 days ago

@revoke.cash/chains v39.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 days ago

Publish npm

Eth Chains

Helper module for getting EVM chain info from chainid.network.

Note: This package was initially created by @taylorjdawson. We forked the repository so we can control the release process with an automated script. The original package can be found here.

Installation

yarn add @revoke.cash/chains

Note on versioning

@revoke.cash/chains uses a weekly automated release script that updates its chain data. This release script takes breaking changes into account, so breaking changes (e.g. renamed chains) are released as a new major version, while non-breaking changes (e.g. new chains) are released as a new minor version.

Usage

Import chains methods and enums:

import chains, { ChainId, ChainName } from '@revoke.cash/chains'

Easily get most popular chains:

import { chain } from '@revoke.cash/chains'

console.log(chain.ethereum.rinkeby)

console.log(chain.polygon.mumbai)

Chain names and ids via Enums:

console.log(ChainId.EthereumMainnet) // 1
console.log(ChainId.BinanceSmartChainMainnet) // 56
console.log(ChainName.EthereumMainnet) // "Ethereum Mainnet"
console.log(ChainName.Rinkeby) // "Rinkeby"

Chain by ID:

chains.getById(ChainId.EthereumMainnet) // { name: "Ethereum Mainnet", ..., "infoURL": "https://ethereum.org" }
// Equivalent
chains.getById(1)

Chain by Name:

chains.getByName(ChainName.EthereumMainnet) // { name: "Ethereum Mainnet", ..., "infoURL": "https://ethereum.org" }
// Equivalent
chains.getByName('Ethereum Mainnet')

Get all Chains:

const allChains = chains.all()
// { 1: { name: "Ethereum Mainnet", ..., "infoURL": "https://ethereum.org" }, 2: {...}}

Typescript Types:

import { Chain, NativeCurrency, Explorer } from '@revoke.cash/chains'
const ethereum: Chain = chains.getById(ChainId.EthereumMainnet)
ethereum.chain // 'ETH'
39.0.0

4 days ago

38.0.0

28 days ago

37.0.0

1 month ago

36.0.0

1 month ago

35.0.0

2 months ago

34.0.0

2 months ago

32.0.0

2 months ago

33.0.0

2 months ago

31.0.0

3 months ago

30.0.0

4 months ago

29.0.0

4 months ago

28.0.0

4 months ago

27.0.0

4 months ago

26.0.0

5 months ago

25.0.0

5 months ago

19.0.0

7 months ago

15.0.0

8 months ago

6.1.0

10 months ago

10.0.0

9 months ago

23.0.0

6 months ago

22.0.0

6 months ago

14.0.0

8 months ago

13.0.0

8 months ago

7.0.0

10 months ago

18.1.0

7 months ago

18.0.0

7 months ago

7.1.0

10 months ago

21.0.0

6 months ago

12.0.0

9 months ago

8.0.0

10 months ago

17.0.0

8 months ago

20.0.0

7 months ago

16.0.0

8 months ago

9.0.0

10 months ago

24.1.0

5 months ago

24.0.0

6 months ago

11.0.0

9 months ago

11.1.0

9 months ago

6.0.0

11 months ago

5.1.0

11 months ago

5.0.0

11 months ago

4.0.0

11 months ago

3.0.0

12 months ago

2.0.0

12 months ago

1.1.0

1 year ago

1.0.0

1 year ago