EOSIO / eosjs

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

eos.getAccount() not behaving as expected #76

Closed outdoteth closed 6 years ago

outdoteth commented 6 years ago

When I run eos.getAccount("dylan1").then(function(res){ console.log(res) });

It returns this: { account_name: 'dylan1', permissions: [ { perm_name: 'active', parent: 'owner', required_auth: [Object] }, { perm_name: 'owner', parent: '', required_auth: [Object] } ] }

Expected should be: { "account_name": "name", "eos_balance": "uint64", "staked_balance": "uint64", "unstaking_balance": "uint64", "last_unstaking_time": "time", "permissions": "vector<permission>", "producer": "optional<producer_info>" }

As you can see, "eos_balance": "uint64", "staked_balance": "uint64", "unstaking_balance": "uint64", "last_unstaking_time": "time", are all missing...

jcalfee commented 6 years ago

Eosjs is just pass-through for nodeos .. It is defainately your nodeos version. How are you connecting to the backend?

outdoteth commented 6 years ago

Hmmm, I seem to have gotten it fixed thanks to some help in the Eos Developer chat by using getTableRows(). Apparently the data is no longer accessible with getAccount().

ripley commented 6 years ago

@Dylan-Phoon Could you tell which API can get those info for now?

plazav commented 6 years ago

@Dylan-Phoon, please share your solution

outdoteth commented 6 years ago

@ripley @plazav This will log the balance of the accounts for the eosio.token contract.

eos.getTableRows({ code: "eosio.token", scope: <name_of_your_account>, table: "accounts", json: true }).then(res => {
  console.log(res);
}