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 deps #677

Merged
merged 10 commits into from
Sep 22, 2021
Merged

fix: update polkadot-js deps #677

merged 10 commits into from
Sep 22, 2021

Conversation

TarikGul
Copy link
Member

@TarikGul TarikGul commented Sep 19, 2021

This updates polkadot-js to 6.0.5 which has some major changes.

Places where we were affected:

  1. AccountAssetsBalances: We no longer receive the AssetBalance type but PalletAssetsAssetBalance instead which changes isSufficient -> sufficient. I made sure to account for runtimes that have either isSufficient or sufficient keys. MockApi also had to be adjusted.

  2. Changed BalanceOf to u128 in the BlocksService test suite

  3. The PalletsStorage service uses V12 as (asLatest) in order to get the { modules }, but now with V14 the metadata return { pallets }, this fix is to make sure the current api doesnt break. But that being said the endpoint needs to be updated to deal with V14 as well. Tracking issue here Issue #678;

@TarikGul
Copy link
Member Author

Not Ready to merge as this breaks a lot of getStorage rpc calls.

Example: querying http://127.0.0.1:8080/blocks/1603025

2021-09-19 11:11:16 error: RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(LastRuntimeUpgradeInfo):: {"specVersion":"Compact<u32>","specName":"Text"}:: Decoded input doesn't match input, received 0x1c0000000000000080e36a090000000002000000010000000000000000000000…0100000000000000000000000000000300000000008093dc1400000000000000 (209 bytes), created 0x1c00 (2 bytes)
2021-09-19 11:11:16 error: RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage session.validators:: createType(ValidatorId):: AccountId:: Decoded input doesn't match input, received 0x15030ea81d109d526eebecfc18c680281235a4bf23fade14e838d120a2943a48…9c6bae578812080b2f9ecdef913f4f68abc3dcee697f505625e8430c8ce3122c (6306 bytes), created 0x15030ea81d109d526eebecfc18c680281235a4bf23fade14e838d120a2943a48 (32 bytes)

src/services/accounts/AccountsAssetsService.ts Outdated Show resolved Hide resolved
@@ -143,7 +138,7 @@ describe('BlocksService', () => {

it('Return an error with a null calcFee when perByte is undefined', async () => {
mockApi.consts.transactionPayment.transactionByteFee =
undefined as unknown as BalanceOf & AugmentedConst<'promise'>;
undefined as unknown as u128 & AugmentedConst<'promise'>;
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the & AugmentedConst<'promise'> part do?

Copy link
Member Author

Choose a reason for hiding this comment

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

So an AugmentedConst takes in an ApiType -> AugmentedConst<ApiType>. ApiType is a union of 'promise' | 'rxjs'. The way I interperate it is its a wrapper type that denotes what type of ApiType is involved with the const. In this case transactionByteFee. That being said this same wrapper exists for query -> AugmentedQuery, rpc, and so on.

@insipx insipx merged commit f14f2c2 into master Sep 22, 2021
@insipx insipx deleted the tarik-update-polkadot-js branch September 22, 2021 17:06
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