erc20-instance
v2.0.0
Published
A package exports the common erc20 instance with type support
Downloads
5
Readme
erc20-instance
A package helps you to create an erc20 contract instance easily.
Installation
npm install erc20-instance
Usage
Only use common ERC20 ABI:
import { ERC20ABI } from "erc20-instance"; const erc20Token = new Contract(contractAddress, ERC20ABI, provider);
Use erc20 ABI with
ERC20Contract
type:For my personal preference, I also introduce a pre-defined type
ERC20Contract
to help support typescript better.ERC20Contract
is a type generated from a common ERC20 contract code with the toolTypechain
.import { createERC20Instance } from "erc20-instance"; let erc20Token = createERC20Instance(contractAddress, provider);
In this example,
erc20Token
is anERC20Contract
instance instead of aContract
instance.
Contribute
Any contribution is welcomed to make it better.
If you have any questions, please create an issue.