Anchor-Protocol / Anchor-Protocol/anchor.js

[Question] Get `borrower_info` of previous block heights

Open
#54 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
46
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Hello, not sure if this is the right place for this question.
I am trying to get borrowed amount of previous block heights to calculate the occurred loan fees over time.

WIthout previous knowledge, I just was trying within dev tools to change the request as follows but it always returns the current block height. Ideas?

```js
height=5971055;
address="terra...";
(await (await fetch("https://mantle.terra.dev/?borrow--borrower", {
"headers": {
"accept": "application/json",
"content-type": "application/json"
},
"referrer": "https://app.anchorprotocol.com/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{\"query\":\"{\\n marketBorrowerInfo: WasmContractsContractAddressStore(\\n ContractAddress: \\\"terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s\\\"\\n QueryMsg: \\\"{\\\\\\\"borrower_info\\\\\\\":{\\\\\\\"borrower\\\\\\\":\\\\\\\""+address+"\\\\\\\",\\\\\\\"block_height\\\\\\\":"+height+"}}\\\"\\n ) {\\n Result\\n Height\\n }\\n}\\n\",\"variables\":{}}",
"method": "POST",
"mode": "cors",
"credentials": "omit"
})).json()).data.marketBorrowerInfo

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the POST request shown in the issue against mantle.terra.dev with the supplied historical block height, then inspect the returned Height and Result fields. Done means establishing whether borrower_info can return data for a previous height and documenting or implementing the required request behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.