Skip to content

Commit

Permalink
add properties list
Browse files Browse the repository at this point in the history
  • Loading branch information
clbrge committed Apr 17, 2023
1 parent fd3ff1d commit 5985194
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ Install the package using npm:
npm install erc-token-js
```

## Usage

### Importing the Library
## Importing the Library

```javascript
import { Token, TokenAmount, expandToNDecimals } from 'erc-token-js'
```

### Creating Tokens
## Creating Tokens

Create a new token from an object:

Expand All @@ -45,6 +43,19 @@ const token = Token.from({
})
```

When creating a Token instance, you need to provide an object with the following properties:
Mandatory properties

- `chainId`: The chain ID of the Ethereum network the token is on (e.g., 1 for Ethereum Mainnet, 3 for Ropsten, etc.).
- `address`: The contract address of the ERC20 token on the Ethereum blockchain.
- `decimals`: The number of decimal places the token uses (e.g., 18 for most ERC20 tokens).

Optional properties

- `name`: The full name of the token (e.g., "Dai Stablecoin").
- `symbol`: The symbol used to represent the token (e.g., "DAI").
- `formatSymbol`: A custom symbol used for formatting display purposes (e.g., "Ξ" for Ether). If not provided, the library will use the symbol property instead.

Create a new token from an ethers.js contract:

```javascript
Expand Down

0 comments on commit 5985194

Please sign in to comment.