Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xdapps/ethers-event-listeners-lib

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xdapps/ethers-event-listeners-lib

Basic event listener library for ERC-20, ERC-721, and ERC-1155 Transfer events using Ethers.js

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ERC Token Utils

This is a basic wrapper around Ethers.js with static methods for interacting with ERC-20, ERC-721, or ERC-1155 contracts.

Basics

  1. Import the protocol you want to interact with.
  2. Pass in a contract address with a provider and then you can call any of the static methods.

How To Use

import {ERC20} from "erc-token-utils"
const contractAddress = "0x.....";
const provider = new ethers.JsonRpcProvider("RPC_URL_ADDRESS");
const name = await ERC20.getName(contractAddress, provider);
const symbol = await ERC20.getSymbol(contractAddress, provider);
const decimals = await ERC20.getDecimals(contractAddress, provider);
const supply = await ERC20.getTotalSupply(contractAddress, provider);
const balance = await ERC20.balanceOf(contractAddress, provider);
//This method would require a provider with signer.
const wallet = ethers.Wallet.fromMnemonic(process.env.MNEMONIC);; //
const walletWithProvider = wallet.connect(this.provider);
const txResult = await ERC20.transferFrom(contractAddress, provider);

FAQs

Package last updated on 09 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc