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

fix: add nominations in staking-info endpoint #1448

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Conversation

Imod7
Copy link
Contributor

@Imod7 Imod7 commented Jun 5, 2024

Description

Closes #1446

This PR adds the field nominations in the staking-info endpoint's response which was missing. This information is retrieved from the api.query.staking.nominators call.

Response (before the fix)

When connected to the Polkadot chain, the following request

http://127.0.0.1:8080/accounts/16GMHo9HZv8CcJy4WLoMaU9qusgzx2wxKDLbXStEBvt5274B/staking-info?at=20300500

results in the response below:

{
  "at": {
    "hash": "0xfee9a90faaaa0e29f3feb53360bf8527ffdfa295267602b35ed8990bf01d5493",
    "height": "20300500"
  },
  "controller": "16eM1npMwKzpGy48NDna1jC6P71S783wjpbdeKT8RgzQx8Jd",
  "rewardDestination": {
    "account": "13FzGLWoueKvUqFePiJgvFYWhH5KckHGtVBXvAX7SBtVZbXu"
  },
  "numSlashingSpans": "0",
  "staking": {
    ...
    "claimedRewards": [
      "104",
       ...
      "187"
    ]
  }
}

Response (after the fix)

{
  "at": {
    "hash": "0xfee9a90faaaa0e29f3feb53360bf8527ffdfa295267602b35ed8990bf01d5493",
    "height": "20300500"
  },
  "controller": "16eM1npMwKzpGy48NDna1jC6P71S783wjpbdeKT8RgzQx8Jd",
  "rewardDestination": {
    "account": "13FzGLWoueKvUqFePiJgvFYWhH5KckHGtVBXvAX7SBtVZbXu"
  },
  "numSlashingSpans": "0",
  "nominations": {
    "targets": [
      "16CdHjb4nxVwF6uwmPm6A29pc4ubnLiY7UqasMxt7cT9BcoK",
      "12YUDdiZCHE47WqR6etGD4gfdpSUhrRFvASrVhtc1RcbLva8",
      "1AvwyrRcECEWUnkRoqfcyT2oA11uBT66aS4p127Mbs4ocjq",
      "1JoBYyPoUdsuU7vZi3KgQAaQYn6WhKqUDXRDmsaJ8Zgxr4T",
      "13VS9jM2pkKNwd8LFpQNNRPBKUonU9jzGZ5fTEZiuB4nYF6Y"
    ],
    "submittedIn": "1409",
    "suppressed": false
  },
  "staking": {
    ...
    "claimedRewards": [
      "104",
      ....
      "187"
    ]
  }
}

The result in nominations was also cross checked with pjs-apps call staking.nominators for the same account and block (block hash : 0xfee9a90faaaa0e29f3feb53360bf8527ffdfa295267602b35ed8990bf01d5493)

Todos

  • Docs were not updated since the nominations information was already included
  • Update tests

@Imod7 Imod7 requested a review from a team as a code owner June 5, 2024 20:58
@Imod7 Imod7 requested a review from IkerAlus June 5, 2024 21:03
Copy link
Contributor

@IkerAlus IkerAlus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Imod7 Imod7 merged commit b048648 into master Jun 6, 2024
15 checks passed
@Imod7 Imod7 deleted the domi-fix-nominations branch June 6, 2024 11:02
This pull request was closed.
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

Successfully merging this pull request may close these issues.

Add nominations to the GET /accounts/{accountId}/staking-info endpoint as per stated in the docs
3 participants