wealdtech / ethereal

Apache License 2.0
209 stars 41 forks source link

How to get token balance? #32

Closed danimesq closed 2 years ago

danimesq commented 2 years ago

Have tried ethereal contract call --contract=0xc944e90c64b2c07662a292be6244bdf05cda44a7 --call='balanceOf(0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91)' --from=0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91 to get the balance I hold of GRT (The Graph's token) but then:

Failed to parse call: unknown method name balanceOf

danimesq commented 2 years ago

Using ABI JSON:

ethereal contract call --contract=0xc944e90c64b2c07662a292be6244bdf05cda44a7 --json=abi.json --call='balanceOf(0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91)' --from=0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91

Failed to parse JSON: JSON does not contain contracts element

abi.json:

{ "constant": true, "inputs": [ { "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "balance", "type": "uint256" } ], "payable": false, "type": "function" }

mcdee commented 2 years ago
$ ethereal token balance --holder=0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91 --token=0xc944e90c64b2c07662a292be6244bdf05cda44a7
685