EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

getCurrencyBalance() params accept appoint token account seem not work #256

Closed elliottssu closed 6 years ago

elliottssu commented 6 years ago

As the document write, how to get current account balance

eosjs: const balance = await eos.getCurrencyBalance('eosio.token', 'myaccount', 'TOK')

cleos: $ cleos get currency balance eosio.token myaccount TOK

well, cleos can be get the account is 'myaccount' like: 200.0000 TOK

however, getCurrencyBalance() params accept token account, no matter what account i write, it still return a array like : [ "200.0000 TOK"]

jcalfee commented 6 years ago

I get different results:

> eos.getCurrencyBalance('eosio.token', 'geydcmrxg4gf', 'EOS')
api > post   https://mainnet.eoscanada.com/v1/chain/get_currency_balance {"code":"eosio.token","account":"geydcmrxg4gf","symbol":"EOS"}
api < response   https://mainnet.eoscanada.com/v1/chain/get_currency_balance ["3.0000 EOS"]

> eos.getCurrencyBalance('eosio.token', 'geydcmrxg4gg', 'EOS')
api > post   https://mainnet.eoscanada.com/v1/chain/get_currency_balance {"code":"eosio.token","account":"geydcmrxg4gg","symbol":"EOS"}
api < response   https://mainnet.eoscanada.com/v1/chain/get_currency_balance []