Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anchor.borrow.getCollateralValue fails #59

Open
pmannle opened this issue Feb 10, 2022 · 2 comments
Open

anchor.borrow.getCollateralValue fails #59

pmannle opened this issue Feb 10, 2022 · 2 comments

Comments

@pmannle
Copy link
Contributor

pmannle commented Feb 10, 2022

Other functions return correct values, but getCollateralValue fails:


const main = async (): Promise<void> => {

    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)
    }

}

@erlyfall
Copy link

@pmannle might be related to #30 .

@pmannle
Copy link
Contributor Author

pmannle commented Feb 13, 2022

Thank you, that was instrumental - I've merged with master, then made one more tweak... all working now, hopefully we can get this merged with the following pull request:

#60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants