0.0.236 β€’ Published 16 hours ago

chainmap v0.0.236

Weekly downloads
-
License
-
Repository
github
Last release
16 hours ago

πŸ—ΊοΈ ChainMap

npm

ChainMap provides a comprehensive map of EVM blockchain networks and their associated data. It includes information such as chain IDs, network names, RPC URLs, and currency details.

import chainMap from "chainmap";
import { JsonRpcProvider, formatUnits } from "ethers";

const ethereum = chainMap.ethereum.mainnet;
const provider = new JsonRpcProvider(ethereum.rpc[0]);

Features

  • πŸ—ΊοΈ A Comprehensive map of blockchain networks.
  • πŸ“ Includes chain IDs, network names, image assets, RPC URLs, and currency details.
  • ⚑️ Free RPC URLs for each network.
  • πŸ“… Built daily to ensure RPCs are working.

Installation

You can install ChainMap using npm/yarn/bun:

npm install chainmap

Supported Networks

Arbitrum Goerli (421613), Arbitrum Mainnet (42161), Arbitrum Nova (42170), Arbitrum Sepolia (421614), Avalanche C-chain (43114), Avalanche Fuji Testnet (43113), Base (8453), Binance SmartChain Mainnet (56), Binance SmartChain Testnet (97), Celo Alfajores Testnet (44787), Celo Baklava Testnet (62320), Celo Mainnet (42220), Cronos Mainnet (25), Ethereum Goerli (5), Ethereum Mainnet (1), Ethereum Sepolia (11155111), Fantom Opera (250), Fantom Testnet (4002), Gnosis (100), Harmony Mainnet Shard 0 (1666600000), Harmony Testnet Shard 0 (1666700000), Klayton Mainnet (8217), Moonbase Alpha (1287), Moonbeam (1284), Moonriver (1285), Moonrock (1288), OP Mainnet (10), Polygon (137), Polygon Mumbai (80001), Polygon Zkevm (1101), Polygon Zkevm Testnet (1442), Zora (7777777)

Usage

Get a specific chains data:

import chainMap from "chainmap";

chainMap.ethereum.mainnet.rpc; // <- an array of free RPC URLs
chainMap.ethereum.mainnet.chainId; // <- the chain ID e.g. "1"
chainMap.ethereum.mainnet.name; // <- the network name e.g. "Ethereum Mainnet"
chainMap.ethereum.mainnet.currency; // <- the currency details e.g. { name: "Ether", symbol: "ETH", decimals: 18 }
chainMap.ethereum.mainnet.explorerUrl; // <- the explorer URL e.g. "https://etherscan.io"

Get a chains data by its chain ID:

import chainMap from "chainmap";

const ethereumInfo = chainMap[1] // <- in this example '1' is the chain ID for Ethereum Mainnet.
ethereumInfo.rpc; // <- an array of free RPC URLs
... // etc

Docs

ChainInfo: An object containing information about a blockchain.

PropertyTypeDescription
namestringThe name of the blockchain
chainIdnumberThe ID of the blockchain
rpcstring[]An array of RPC URLs
currencyCurrencyInfoInformation about the blockchain's currency
explorerUrlstring (optional)The URL of the blockchain's explorer (if available)
iconUrlstring (optional)The URL of the blockchain's icon (if available)

CurrencyInfo: An object containing information about a blockchain's currency.

PropertyTypeDescription
namestringThe name of the currency
symbolstringThe symbol of the currency
decimalsnumberThe number of decimal places for the currency
iconUrlstring (optional)The URL of the currency's icon (if available)

Contributing

Chainmap source files are generated from specifications in data directory. During the generation process, rpcs are tested to ensure they are working. If a network fails to connect, it is removed from the generated source files.

✏️ Modify a network

Open the network data file data/<network>.list.ts, and make your modifications, ensuring the default exported Object still confroms to the ChainMap interface.

βž• Add a network

Create a new file in the data directory, named <network>.list.ts. The file should export an object that conforms to the ChainMap interface.

e.g. Creating a new network called mychain with chain ID 1234 and RPC URL https://mychain.com:

import { ChainMap } from "./types";

export const MYC {
  name: "MyCoin",
  symbol: "MYC",
  decimals: 18,
  }

export default {
  mainnet: {
    chainId: 1234,
    name: "MyChain mainnet",
    currency: MYC,
    explorerUrl: "https://mychain.com",
    rpc: [
      "https://rpc.mychain.com",
      "https://rpc2.mychain.com",
    ],
  },
} as ChainMap; // <- ensures the object conforms to the ChainMap interface

Generate and build

Typically source files should be generated by the github action, but you can generate them locally using bun.

Prerequisites:

bun run generate

You can then build the distribution files:

bun run build

Testing networks

You can check that all network RPCs are working by running:

bun test
0.0.236

16 hours ago

0.0.235

2 days ago

0.0.234

3 days ago

0.0.233

4 days ago

0.0.232

5 days ago

0.0.231

6 days ago

0.0.229

8 days ago

0.0.230

7 days ago

0.0.228

9 days ago

0.0.227

10 days ago

0.0.226

11 days ago

0.0.225

12 days ago

0.0.224

13 days ago

0.0.223

14 days ago

0.0.222

15 days ago

0.0.221

16 days ago

0.0.220

17 days ago

0.0.219

18 days ago

0.0.218

19 days ago

0.0.217

20 days ago

0.0.216

21 days ago

0.0.215

22 days ago

0.0.214

23 days ago

0.0.213

24 days ago

0.0.212

25 days ago

0.0.211

26 days ago

0.0.209

28 days ago

0.0.210

27 days ago

0.0.208

29 days ago

0.0.207

30 days ago

0.0.206

1 month ago

0.0.205

1 month ago

0.0.204

1 month ago

0.0.203

1 month ago

0.0.202

1 month ago

0.0.201

1 month ago

0.0.200

1 month ago

0.0.199

1 month ago

0.0.198

1 month ago

0.0.197

1 month ago

0.0.196

1 month ago

0.0.195

1 month ago

0.0.194

1 month ago

0.0.193

1 month ago

0.0.192

1 month ago

0.0.191

2 months ago

0.0.190

2 months ago

0.0.189

2 months ago

0.0.188

2 months ago

0.0.187

2 months ago

0.0.186

2 months ago

0.0.185

2 months ago

0.0.184

2 months ago

0.0.183

2 months ago

0.0.182

2 months ago

0.0.181

2 months ago

0.0.180

2 months ago

0.0.179

2 months ago

0.0.178

2 months ago

0.0.177

2 months ago

0.0.176

2 months ago

0.0.175

2 months ago

0.0.174

2 months ago

0.0.173

2 months ago

0.0.172

2 months ago

0.0.171

2 months ago

0.0.170

2 months ago

0.0.169

2 months ago

0.0.168

2 months ago

0.0.167

2 months ago

0.0.166

2 months ago

0.0.164

2 months ago

0.0.165

2 months ago

0.0.163

2 months ago

0.0.159

3 months ago

0.0.162

2 months ago

0.0.161

3 months ago

0.0.160

3 months ago

0.0.158

3 months ago

0.0.157

3 months ago

0.0.156

3 months ago

0.0.155

3 months ago

0.0.154

3 months ago

0.0.153

3 months ago

0.0.152

3 months ago

0.0.151

3 months ago

0.0.150

3 months ago

0.0.149

3 months ago

0.0.148

3 months ago

0.0.147

3 months ago

0.0.146

3 months ago

0.0.145

3 months ago

0.0.144

3 months ago

0.0.143

3 months ago

0.0.142

3 months ago

0.0.141

3 months ago

0.0.140

3 months ago

0.0.139

3 months ago

0.0.138

3 months ago

0.0.137

3 months ago

0.0.136

3 months ago

0.0.135

3 months ago

0.0.134

3 months ago

0.0.133

3 months ago

0.0.131

4 months ago

0.0.132

3 months ago

0.0.130

4 months ago

0.0.128

4 months ago

0.0.129

4 months ago

0.0.127

4 months ago

0.0.126

4 months ago

0.0.125

4 months ago

0.0.124

4 months ago

0.0.123

4 months ago

0.0.120

4 months ago

0.0.122

4 months ago

0.0.121

4 months ago

0.0.119

4 months ago

0.0.118

4 months ago

0.0.117

4 months ago

0.0.116

4 months ago

0.0.115

4 months ago

0.0.114

4 months ago

0.0.113

4 months ago

0.0.112

4 months ago

0.0.111

4 months ago

0.0.110

4 months ago

0.0.109

4 months ago

0.0.108

4 months ago

0.0.106

4 months ago

0.0.107

4 months ago

0.0.105

4 months ago

0.0.104

4 months ago

0.0.103

4 months ago

0.0.102

4 months ago

0.0.101

5 months ago

0.0.100

5 months ago

0.0.98

5 months ago

0.0.99

5 months ago

0.0.97

5 months ago

0.0.96

5 months ago

0.0.95

5 months ago

0.0.94

5 months ago

0.0.93

5 months ago

0.0.92

5 months ago

0.0.91

5 months ago

0.0.90

5 months ago

0.0.89

5 months ago

0.0.88

5 months ago

0.0.86

5 months ago

0.0.87

5 months ago

0.0.85

5 months ago

0.0.84

5 months ago

0.0.83

5 months ago

0.0.82

5 months ago

0.0.81

5 months ago

0.0.80

5 months ago

0.0.79

5 months ago

0.0.78

5 months ago

0.0.77

5 months ago

0.0.76

5 months ago

0.0.75

5 months ago

0.0.74

5 months ago

0.0.73

5 months ago

0.0.72

5 months ago

0.0.71

6 months ago

0.0.70

6 months ago

0.0.69

6 months ago

0.0.68

6 months ago

0.0.67

6 months ago

0.0.66

6 months ago

0.0.65

6 months ago

0.0.64

6 months ago

0.0.63

6 months ago

0.0.62

6 months ago

0.0.61

6 months ago

0.0.60

6 months ago

0.0.59

6 months ago

0.0.58

6 months ago

0.0.57

6 months ago

0.0.56

6 months ago

0.0.55

6 months ago

0.0.54

6 months ago

0.0.53

6 months ago

0.0.52

6 months ago

0.0.51

6 months ago

0.0.50

6 months ago

0.0.49

6 months ago

0.0.48

6 months ago

0.0.47

6 months ago

0.0.46

6 months ago

0.0.45

6 months ago

0.0.44

6 months ago

0.0.43

6 months ago

0.0.42

6 months ago

0.0.41

7 months ago

0.0.40

7 months ago

0.0.39

7 months ago

0.0.38

7 months ago

0.0.37

7 months ago

0.0.36

7 months ago

0.0.35

7 months ago

0.0.34

7 months ago

0.0.33

7 months ago

0.0.32

7 months ago

0.0.31

7 months ago

0.0.30

7 months ago

0.0.29

7 months ago

0.0.28

7 months ago

0.0.27

7 months ago

0.0.26

7 months ago

0.0.25

7 months ago

0.0.24

7 months ago

0.0.23

7 months ago

0.0.22

7 months ago

0.0.21

7 months ago

0.0.20

7 months ago

0.0.19

7 months ago

0.0.18

7 months ago

0.0.17

7 months ago

0.0.16

7 months ago

0.0.15

7 months ago

0.0.14

7 months ago

0.0.13

7 months ago

0.0.12

7 months ago

0.0.11

8 months ago

0.0.10

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago