Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Add ERC20 decimal field support #115

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/abi/erc20.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [{ "name": "", "type": "uint8" }],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
Expand Down
7 changes: 7 additions & 0 deletions src/erc20/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ export class Erc20TokenContract {
.call()
.catch(() => undefined);
}

public async decimals() {
return this._contract.methods
.decimals()
.call()
.catch(() => undefined);
}
}

export class Erc20TokenHolder {
Expand Down
1 change: 1 addition & 0 deletions src/erc20/schema/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ type TokenContract {
account: Account
symbol: String
totalSupply: Long
decimals: Int
}
`;