steemit/steem-js

Exception: Cannot read property 'total_vesting_shares' of undefined

Closed this issue · 5 comments

Sorry for the sloppy report, but I am in a hurry. Encountered this problem:

Take the result of appicsSteem.steem.api.getAccounts(['leoney']) and use appicsSteem.steem.formatter.estimateAccountValue(account);

I get the following error:

TypeError: Cannot read property 'total_vesting_shares' of undefined 
at vestingSteem (/app/node_modules/steem/lib/formatter.js:20:41) 
at /app/node_modules/steem/lib/formatter.js:90:27 
...

Environment information

node 8.11.4
steem.js 0.7.3

bra1n commented

It seems like this is caused when the Steem API does not return the appropriate props Property for a formatter.js triggered /@username API call. The subsequent call to vestingSteem() fails in this case. Maybe some better error handling in the formatter.js would be useful here.

bra1n commented

Actually, that line seems to be the cause of the whole issue:

steemAPI.getStateAsync(`/@{username}`).then(data => {

/@{username} is not how ES6 string patterns work, correct would be: /@${username}

bra1n commented

I opened a PR that includes a fix for this issue.

The fix is legit but no one merge it?

bra1n commented

Seems like the maintainers have lost interest in this project.