How I could obtain the current earnings of a farm from Maiar Exchange via Elrond REST API? For example, for the LKMEX farm I want to determine the current earnings (My Earned MEX) in MEX and/or USDT since the latest harverst or 'reinvest'. Thanks!
Asked
Active
Viewed 143 times
1 Answers
0
Based on what I was looking in maiar.exchange. You can determine there is a graphql request for this.
You can do graphql
request to https://graph.maiar.exchange/graphql
. I did not search if there is any OpenAPI spec to know if there is any security bound to this route. However, to help you out, here is the graphql (with redacted content), that is used to get current amount in farm with current harvestable amount:
{
"variables": {
"getRewardsForPositionArgs": {
"farmsPositions": [
{
"attributes": "XXXX",
"identifier": "MEXFARM-XXXXX-XXXXX",
"farmAddress": "erd1XXXX",
"liquidity": "19700000000000000000000000"
},
{
"attributes": "XXX",
"identifier": "LKFARM-XXXXXXX-XXXXXX",
"farmAddress": "erd1XXXXX",
"liquidity": "19700000000000000000000000"
},
]
}
},
"query": "query ($getRewardsForPositionArgs: BatchFarmRewardsComputeArgs!) {\n getRewardsForPosition(farmsPositions: $getRewardsForPositionArgs) {\n rewards\n remainingFarmingEpochs\n decodedAttributes {\n aprMultiplier\n compoundedReward\n initialFarmingAmount\n currentFarmAmount\n lockedRewards\n identifier\n __typename\n }\n __typename\n }\n}\n"
}
Liquidity is from where you want to get the data. There might be a need to do another graphql request before doing this to know where you are for liquidity
.
-
With this method I received an error "You are not authorized to make this request" ... – Hugo Levet Sep 10 '22 at 21:29