https://github.com/skippia/getter-erc-20-balance
https://github.com/skippia/getter-erc-20-balance
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/skippia/getter-erc-20-balance
- Owner: Skippia
- Created: 2024-02-04T08:35:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-22T04:10:18.000Z (8 months ago)
- Last Synced: 2025-05-31T12:15:55.824Z (5 months ago)
- Language: TypeScript
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Description
This npm package provides a class called `ERC20Balance` that allows you to retrieve the balance of an ERC20 contract for a given wallet address using `getERC20BalanceOf` method.
## Installation
```bash
npm install getter-erc-20-balance
```## API
To import `ERC20Balance` class use:
```js
import { ERC20Balance } from 'getter-erc-20-balance'
```The `ERC20Balance` class provides the following method:
- `getERC20BalanceOf(contractAddress: string, walletAddress: string, provider: JsonRpcProvider): Promise`
This asynchronous method retrieves the balance of an ERC20 contract for the specified wallet address:
1. `contractAddress` (string): The address of the ERC20 contract.
2. `walletAddress` (string): The address for which the balance should be retrieved.
3. `provider` (JsonRpcProvider): An instance of JsonRpcProvider from the ethers.js library, connected to an Ethereum JSON-RPC provider.Returns a Promise that resolves to the balance as a string
Good luck!