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

is it possible to get pendingRewards for an account member of a pool? #220

Open
p4tpr0 opened this issue Apr 26, 2023 · 8 comments
Open

Comments

@p4tpr0
Copy link

p4tpr0 commented Apr 26, 2023

If I understand correctly (I'm not a dev), https://polkadot.js.org/docs/substrate/runtime/#pendingrewardsmember-accountid-balance shows that it should be possible to retrieve pendingRewards of a member of a pool. Is that correct? And if so, is it possible to get this information with an API Call on subscan?

@freehere107
Copy link
Collaborator

@p4tpr0 Of course. you can try to use this

https://support.subscan.io/#pool-members

@p4tpr0
Copy link
Author

p4tpr0 commented Apr 27, 2023

It seems I can't get it work:
$ curl -X POST 'https://westend.api.subscan.io/api/scan/nomination_pool/pool/members' --header 'Content-Type: application/json' --header 'X-API-Key: ****************' --data-raw '{ "pool_id": "91" }' {"code":400,"message":"json: cannot unmarshal string into Go struct field .pool_id of type uint","generated_at":1682569130}

And more importantly, I can see how this call can retrieve api.call.nominationPoolsApi.pendingRewards for a member of the pool.

@freehere107
Copy link
Collaborator

curl -X POST 'https://westend.api.subscan.io/api/scan/nomination_pool/pool/members' --header 'Content-Type: application/json' --header 'X-API-Key: ****************' --data-raw '{ "pool_id": 91,"row":10 }'

@p4tpr0
Copy link
Author

p4tpr0 commented Apr 27, 2023

Ok, thanks, works better without quotes around the effective pool ID (might need to fix the example in the doc).

I find the result a bit odd. Issuing this: curl -X POST 'https://westend.api.subscan.io/api/scan/nomination_pool/pool/members' --header 'Content-Type: application/json' --header 'X-API-Key: ****************' --data-raw '{ "pool_id": 91 }'

returns a list of 159 pool members when the real pool currently has only 6 members. My address is not in the result when it's currently a member of that pool.
If I'm not mistaken, pool IP 91 should correspond to pool address 13UVJyLnbVp8c4FQeiGJLuQxR1TcPHRTvbH8JsviRtjKizh8

It looks like I'm not sending my request to the right provider. Does westend.api.subscan.io serves polkadot production data or testing data?

@freehere107
Copy link
Collaborator

@p4tpr0 Sorry, I didn't understand what you mean, can you explain the problem to me in detail?

@p4tpr0
Copy link
Author

p4tpr0 commented Apr 28, 2023

OK :)
I would like to retrieve the following info: "how much Unclaimed Rewards have I earned from participating to polkadot staking pool ID 91". See screenshot.

As far as I know, this particular information is stored here: https://polkadot.js.org/docs/substrate/runtime/#pendingrewardsmember-accountid-balance but it seems I can't get it.
Screenshot 2023-04-28 at 06 56 51

@freehere107
Copy link
Collaborator

You can use https://support.subscan.io/#pool-members and claimable is what you need

{
  "code": 0,
  "message": "Success",
  "generated_at": 1655113061,
  "data": {
    "count": 7,
    "list": [
      {
        "pool_id": 45,
        "bonded": "3000000000000",
        "claimable": "0",
        "account_display": {
          "address": "5D7zYmyEEmtTVg6RhUcCRP11J1Rc6FK2Xh2hUZQzD5K57bHF"
        }
      }
    ]
  }
}

@p4tpr0
Copy link
Author

p4tpr0 commented Apr 28, 2023

EDIT : OK, nevermind, I was not hitting the proper provider.
I've finally spotted my mistake and its all good.

Sorry for the noise.

_I've tried this already, but like I wrote earlier: output is not what I expect. Pool ID 91 has 6 members and

$ curl -X POST 'https://westend.api.subscan.io/api/scan/nomination_pool/pool/members' --header 'Content-Type: application/json' --header 'X-API-Key: ****' --data-raw '{ "pool_id": 91 }'
returns a list of 159 members. Every member is identical except for the address: same bonded (1 DOT), same claimable (0).
{"pool_id":91,"bonded":"1000000000000","account_display":{"address":"5FnwBT6S1***rs4Uo4ADPeJV"},"claimable":"0"},{"pool_id":91,"bonded":"1000000000000","account_display":{"address":"5FWLug16K***fNyyfcPz9MNT"},"claimable":"0"},_

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