🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@idecentralize/erclib

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@idecentralize/erclib

ERC library for blockchain development

1.5.13
Source
npm
Version published
Weekly downloads
66
1220%
Maintainers
1
Weekly downloads
 
Created
Source

erclib

Version npm Node.js CI

ERC library for blockchain Development

added colors for network and asset's

In development. More networks, asset's and features are coming...

Install and import

npm install @idecentralize/erclib

import ERC20 from "@idecentralize/erclib"

address should be checksumed

Usage

set the chain ID

const chainId = 137 // Polygon

for non ethereum metamask (not included ny default in metamask)

you can get the RPC, explorer to add the rpc to metamask or connect to the selected network

NETWORK[chainId].rpc // output the rpc URI

get the asset into on the specific network.

const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"

ERC20[chainId][usdc].decimals // output decimals of asset

ERC20[chainId][usdc].compound // output cToken address

ERC20[chainId][usdc].colors // HTML color

import IPFS_SVG_PATH from "@idecentralize/erclib"

<image src={IPFS_SVG_PATH + ERC20[network_id][usdc].symbol + '.svg'} alt={ERC20[network_id][usdc].symbol} />

FORKING

network_id should be the chain id return by the provider. When forking the mainnet using hardhat, the network id is 31337 and we want to use the mainnet asset under network id 1.

ERC20[network_id === 31337 ? 1 : network_id][usdc].decimals // output decimals of asset

This will use the mainnet id on the library when forking.

Supported Network

  • IPFS
  • Ethereum
  • Polygon
  • BSC
  • Aurora
  • Avanlance
  • xDai

Supported Testnet & protocols

  • Compound
  • Aave
  • Yearn v2

Please report any issues!

To have add some assets please submit a PR and provide the SVG logo.

Keywords

erclib

FAQs

Package last updated on 18 Jun 2023

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