Anchor-Protocol / anchor-earn

The Earn JavaScript SDK for Anchor Protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

anchorEarn.balance error

SmartAppsX opened this issue · comments

I got this error after query the balance with anchorEarn.balance

Cannot read property 'amount' of undefined
at TerraAnchorEarn. (\node_modules@anchor-protocol\anchor-earn\dist\facade\terra-anchor-earn.js:325:71)
at Generator.next ()
at fulfilled (\node_modules@anchor-protocol\anchor-earn\dist\facade\terra-anchor-earn.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:95:5)

It seems to happen when the account is recently created and doesn't have any funds.

terra-anchor-earn.js

account_balance: getNaturalDecimals(accountBalance[0].amount.toString()),

In this line the var accountBalance is undefined and can't access to the [0] item

Thanks for the report, we will reflect that on the new release.

Is this issue resolved ? I am still facing the error.

commented

Having the same issue, seemingly not resolved yet.

@SmartAppsX thank you for the report. @diegodelrieu @kiruthikraaj v1.1.1 is just released, please use that. That has the fix.