Anchor-Protocol / Anchor-Protocol/anchor.js
anchor.borrow.getCollateralValue fails
- Dominant language
- TypeScript
- Stars
- 46
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
Other functions return correct values, but getCollateralValue fails:
```
const main = async (): Promise => {
const wallet = new Wallet(lcd, key)
const anchor = new Anchor(lcd, addressProvider)
const walletDenom = {
address: wallet.key.accAddress,
market: MARKET_DENOMS.UUSD,
}
try {
const totalDeposits = await anchor.earn.getTotalDeposit(walletDenom)
const borrowedValue = await anchor.borrow.getBorrowedValue(walletDenom)
const collateralValue = await anchor.borrow.getCollateralValue(walletDenom)
// console.log(totalDeposits) // returns correct value
// console.log(borrowedValue) // returns correct value
console.log(collateralValue) // data: { error: 'decoding bech32 failed: invalid separator index -1' }
} catch(error) {
console.log(error)
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the anchor.borrow.getCollateralValue entry point and compare its inputs and address handling with the working getTotalDeposit and getBorrowedValue calls shown in the report. Reproduce the call using the provided walletDenom, then confirm that it no longer returns the bech32 decoding error and produces the collateral value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100