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

Update api.derive.staking calls with breaking changes #5860

Merged
merged 11 commits into from Apr 22, 2024

Conversation

TarikGul
Copy link
Member

@TarikGul TarikGul commented Apr 22, 2024

This updates the staking derives with the updated breaking changes. More info here: 5771 and polkadot-js/apps#10004

Changes

api.derive.staking.ownExposure:

Now takes in a 3rd param page to allow for paged calls, since it internally uses erasStakersPaged. If no page is passed in, it will default to 0.

The output has new additions. This includes exposurePaged, and exposureMeta. The old fields remain since _ownExposures internally is used by other calls that may query a historical range.

export interface DeriveOwnExposure {
  clipped: SpStakingExposure;
  exposurePaged: Option<SpStakingExposurePage>;
  era: EraIndex;
  exposure: SpStakingExposure;
  exposureMeta: Option<SpStakingPagedExposureMetadata>;
}

api.derive.staking.ownExposures:

Now takes in a 4th param page to allow for paged calls, since it internally uses erasStakersPaged. If no page is passed in, it will default to 0.

The output has new additions. This includes exposurePaged, and exposureMeta. The old fields remain since _ownExposures internally is used by other calls that may query a historical range.

export interface DeriveOwnExposure {
  clipped: SpStakingExposure;
  exposurePaged: Option<SpStakingExposurePage>;
  era: EraIndex;
  exposure: SpStakingExposure;
  exposureMeta: Option<SpStakingPagedExposureMetadata>;
}

api.derive.staking.query:

Now takes in a 3rd param page to allow for paged calls, since it internally uses erasStakersPaged. If no page is passed in, it will default to 0.

The output has additions and changes. This includes the addition of the exposureMeta field, and the change of exposure to exposurePaged.

export interface DeriveStakingStash {
  controllerId: AccountId | null;
  exposurePaged: Option<SpStakingExposurePage>;
  exposureMeta: Option<SpStakingPagedExposureMetadata>;
  nominators: AccountId[];
  rewardDestination: PalletStakingRewardDestination | null;
  stashId: AccountId;
  validatorPrefs: PalletStakingValidatorPrefs;
}
export interface DeriveStakingQuery extends DeriveStakingStash {
  accountId: AccountId;
  stakingLedger: PalletStakingStakingLedger;
}

api.derive.staking.nextElected && api.derive.staking.validators:

Just an internal change but nextElected now uses erasStakersPaged.keys to get all validator accounts which is threaded to validators.

Derives to fix:

  • ownExposure
  • ownExposures
  • query
  • validators
  • nextElected

@TarikGul TarikGul added the -auto label Apr 22, 2024
@polkadot-js-bot polkadot-js-bot merged commit c4e8270 into master Apr 22, 2024
6 checks passed
@polkadot-js-bot polkadot-js-bot deleted the tg-fix-derives branch April 22, 2024 19:46
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants