Anchor-Protocol / anchor-earn

The Earn JavaScript SDK for Anchor Protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

userCoins.get is not a function while accessing anchorEarn.balance

sriharikapu opened this issue · comments

this occurred while querying for anchorEarn.balance

  • there is no issue when we invoke this on testnet
  • but the issue occurs while using the same method on mainnet

Just got the same error and found it was discussed & fixed at #17.
Try running with yarn add @anchor-protocol/anchor-earn@2.0.0-alpha1.

private async getNativeBalance(
getNativeBalanceOption: GetUstBalanceOption,
): Promise<Coin> {
const userCoins = await this._lcd.bank.balance(
accAddress(getNativeBalanceOption.address),
);
const coins:Coins = userCoins[0];
return coins.get(getNativeBalanceOption.currency);
}

Same here upgrading the alpha version fixed for me.