New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

depay-web3-blockchains

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

depay-web3-blockchains

JavaScript library containing aggregated information and abstractions for web3 blockchains.

latest
Source
npmnpm
Version
2.6.0
Version published
Maintainers
1
Created
Source

Quickstart

yarn add depay-web3-blockchains

or

npm install --save depay-web3-blockchains
import { Blockchain } from 'depay-web3-blockchains'

Blockchain.all
// [
//   { name: 'ethereum', id: '0x1', label: 'Ethereum', logo: '...' },
//   { name: 'bsc', id: '0x38', label: 'Binance Smart Chain', logo: '...' },
//   ...
// ]

Blockchain.findById('0x1')
// { name: 'ethereum', id: '0x1', label: 'Ethereum', logo: '...' }

Blockchain.findByName('ethereum')
// { name: 'ethereum', id: '0x1', label: 'Ethereum', logo: '...' }

Blockchain.findByNetworkId(1)
// { name: 'ethereum', id: '0x1', label: 'Ethereum', logo: '...' }

Support

This library supports the following blockchains:

  • Ethereum
  • Binance Smart Chain
  • Polygon

Data Structure

Blockchain data is provided in the following structure:

{
  name: String, // e.g. ethereum, bsc ...
  id: String, // e.g. 0x1, 0x38, ...
  networkId: String, // 1, 56, ...
  label: String, // Ethereum, Binance Smart Chain ...
  fullName: String, // Ethereum Mainnet, Binance Smart Chain Mainnet ...
  logo: String (base64 encoded PNG),
  currency: { Object
    name: String, // Ether, Binance Coin, ...
    symbol: String, // ETH, BNB, ...
    decimals: String, // 18
  },
  explorer: String (URL), // https://etherscan.io, https://bncscan.com, ...
  explorerUrlFor: Function ({ transaction (with id) }) returns String, // https://etherscan.io/tx/..., https://etherscan.io/tx/...
  rpc: String (URL) // ...
}

Functionalities

all: Retreive all information for all blockchains

import { Blockchain } from 'depay-web3-blockchains'

Blockchain.all
// [
//   { name: 'ethereum', id: '0x1', networkId: '1', label: 'Ethereum', logo: '...' },
//   { name: 'bsc', id: '0x38', networkId: '56', label: 'Binance Smart Chain', logo: '...' },
//   ...
// ]

findById: Get blockchain by blockchain id

import { Blockchain } from 'depay-web3-blockchains'

Blockchain.findById('0x1')
// { name: 'ethereum', id: '0x1', networkId: '1', label: 'Ethereum', logo: '...' }

Blockchain.findById('0x38')
// { name: 'bsc', id: '0x38', networkId: '56', label: 'Binance Smart Chain', logo: '...' }

findByName: Get blockchain by blockchain name

import { Blockchain } from 'depay-web3-blockchains'

Blockchain.findByName('ethereum')
// { name: 'ethereum', id: '0x1', networkId: '1', label: 'Ethereum', logo: '...' }

Blockchain.findByName('bsc')
// { name: 'bsc', id: '0x38', networkId: '56', label: 'Binance Smart Chain', logo: '...' }

findByNetworkId: Get blockchain by network id

import { Blockchain } from 'depay-web3-blockchains'

Blockchain.findByNetworkId(1)
// { name: 'ethereum', id: '0x1', networkId: '1', label: 'Ethereum', logo: '...' }

Blockchain.findByNetworkId('56')
// { name: 'bsc', id: '0x38', networkId: '56', label: 'Binance Smart Chain', logo: '...' }

Development

Get started

yarn install
yarn dev

Release

npm publish

Keywords

web3

FAQs

Package last updated on 25 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts