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!: update polkadot-js, and adjust for breaking changes (/accounts/{accountId}/balance-info) #1255

Merged
merged 16 commits into from
Apr 12, 2023

Conversation

TarikGul
Copy link
Member

@TarikGul TarikGul commented Mar 27, 2023

Breaking Changes

The following PR introduces some minor breaking changes to /accounts/{accountId}/balance-info but breaking none the less.

Summary

With paritytech/substrate#12951 merged we now need to take into account that the AccountInfo provided from api.query.system.account will not return the same format. Previously both miscFrozen and feeFrozen were returned whereas now only frozen is returned. In order to keep historical integrity we have kept each field, and added frozen as a new key. This breaking change being, when a specific key is not supported in the runtime instead of a balance being inputted into the key, it will have a message like 'miscFrozen does not exist for this runtime'. A sample return value would be:

{
  "at": {
    "hash": "0x7b713de604a99857f6c25eacc115a4f28d2611a23d9ddff99ab0e4f1c17a8578",
    "height": "789629"
  },
  "nonce": "6",
  "tokenSymbol": "DOT",
  "free": "501090793179",
  "reserved": "0",
  "miscFrozen": "miscFrozen does not exist for this runtime",
  "feeFrozen": "feeFrozen does not exist for this runtime",
  "frozen": "100000000000",
  "locks": [
    {
      "id": "0x7374616b696e6720",
      "amount": "100000000000",
      "reasons": "All"
    }
  ]
}

The new return type looks like:

export interface IAccountBalanceInfo {
	at: IAt;
	tokenSymbol: string;
	nonce: Index;
	free: Balance | string;
	reserved: Balance | string;
	miscFrozen: Balance | string; // Note this can now return a not supported message
	feeFrozen: Balance | string; // Note this can now return a not supported message
	frozen: Balance | string; // Note this can now return a not supported message
	locks: Vec<BalanceLock> | IBalanceLock[];
}

Additional Notes:

The historical e2e-tests were all updated.

Unit tests are tracked in this issue: #1262

Additional Changes:

There was also a local type change from PolkadotPrimitivesV2CandidateReceipt to PolkadotPrimitivesV4CandidateReceipt. This change does not impact any users.

@TarikGul TarikGul requested a review from a team as a code owner March 27, 2023 07:35
@TarikGul TarikGul changed the title [WIP] chore(deps): update polkadot-js fix!: update polkadot-js, and adjust for breaking changes (/accounts/{accountId}/balance-info) Apr 9, 2023
docs/src/openapi-v1.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

@marshacb marshacb left a comment

Choose a reason for hiding this comment

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

just a minor spelling nit. Looks great to me!

TarikGul and others added 2 commits April 10, 2023 10:10
Co-authored-by: Cameron Marshall <cameron.marshall12@gmail.com>
Copy link
Contributor

@CurlyBracketEffect CurlyBracketEffect left a comment

Choose a reason for hiding this comment

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

👀 🤯
👍

@TarikGul TarikGul merged commit 8964882 into master Apr 12, 2023
@TarikGul TarikGul deleted the tarik-update-pjs branch April 12, 2023 17:15
@TarikGul TarikGul mentioned this pull request Apr 19, 2023
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.

3 participants