1.0.2 • Published 1 year ago

like-chainlist v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

like-chainlist

Get RPC providers for any blockchain

npm i like-chainlist

Depends on third-party API requests. Open an issue if it breaks, will fix.

Usage

const chainlist = require('like-chainlist')

const list = await chainlist.list()
// => [{ name, chain, icon, chainId, networkId, nativeCurrency, rpc, explorers }]

const selected = list.find(c => c.name === 'Ethereum Mainnet')

const networks = await chainlist.networks()
const rpcs = networks[selected.chainId]
// => ['https://...']

const image = await chainlist.icon(selected.icon)
// => <Buffer ...> or null

The list() also has a minimal RPC list for each network.

Then networks() will give you extra RPCs.

Notes

The list() and networks() uses different remote APIs.

You might get networks that are not in the list, and vice versa.

For common networks you should always have a match.

License

MIT

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago