Anchor-Protocol / anchor-earn

The Earn JavaScript SDK for Anchor Protocol.
Apache License 2.0
45 stars 24 forks source link

anchorEarn.balance error #10

Open SmartAppsX opened 3 years ago

SmartAppsX commented 3 years ago

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)

SmartAppsX commented 3 years ago

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

MSNTCS commented 3 years ago

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

kiruthikraaj commented 3 years ago

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

diegodelrieu commented 3 years ago

Having the same issue, seemingly not resolved yet.

MSNTCS commented 3 years ago

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

kiruthikraaj commented 3 years ago

Great Thanks for the update.

On Fri, 12 Nov 2021 at 11:08, Mohammadsadegh Najafi < @.***> wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Anchor-Protocol/anchor-earn/issues/10#issuecomment-966834596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKR5KBLBJBWZ6I6IIATNPMDULSR3TANCNFSM5BKF4PSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.