Quickstart
yarn add @depay/web3-blockchains
or
npm install --save @depay/web3-blockchains
import Blockchains from '@depay/web3-blockchains'
Blockchains.all
Blockchains.findByName('ethereum')
Blockchains.findById('0x1')
Blockchains.findByNetworkId(1)
or
import { all, findByName, findById, findByNetworkId } from '@depay/web3-blockchains'
all
findByName('ethereum')
findById('0x1')
findByNetworkId(1)
Support
This library supports the following blockchains:
Data Structure
Blockchain data is provided in the following structure:
{
name: String,
id: String,
networkId: String,
namespace: String,
label: String,
fullName: String,
logo: String (SVG),
currency: { Object
name: String,
symbol: String,
decimals: String,
address: String,
},
wrapped: { Object
address: String
},
stables: { Object
usd: [ Array
String
]
},
explorer: String (URL),
explorerUrlFor: Function ({ transaction || token }) returns String,
rpc: String (URL),
tokens: [ Array
{ Object
address: String,
symbol: String,
name: String,
decimals: Integer,
logo: String(URL|Data URL),
type: String,
},
],
zero: String,
maxInt: String,
}
explorerUrlFor
Transaction
blockchain.explorerUrlFor({ transaction: '0x51ae8875028b7ed004253f679076851abbd3a49e26faf8d7dac6bb283ca10536' })
Token
blockchain.explorerUrlFor({ token: '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb' })
Address
blockchain.explorerUrlFor({ address: '0x08B277154218CCF3380CAE48d630DA13462E3950' })
Functionalities
all: Retreive all information for all blockchains
import Blockchains from '@depay/web3-blockchains'
Blockchains.all
findById: Get blockchain by blockchain id
import Blockchains from '@depay/web3-blockchains'
Blockchains.findById('0x1')
Blockchains.findById('0x38')
findByName: Get blockchain by blockchain name
import Blockchains from '@depay/web3-blockchains'
Blockchains.findByName('ethereum')
Blockchains.findByName('bsc')
findByNetworkId: Get blockchain by network id
import Blockchains from '@depay/web3-blockchains'
Blockchains.findByNetworkId(1)
Blockchains.findByNetworkId('56')
Development
Get started
yarn install
yarn dev