Skip to content

Commit c0e8410

Browse files
authored
Update Substrate metadata & scheduler usage (#4371)
1 parent 34f6b7b commit c0e8410

File tree

18 files changed

+3413
-2476
lines changed

18 files changed

+3413
-2476
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# CHANGELOG
22

3+
## master
4+
5+
Changes:
6+
7+
- Update `dispathchQueue` derive to align with latest Substrate
8+
- Update to latest Substrate metadata
9+
10+
311
## 7.0.1 Dec 20, 2021
412

513
Upgrade priority: Low. Recommended for TS users with their own non-Polkadot/Kusama chains.

packages/api-augment/src/augment/consts.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ declare module '@polkadot/api-base/types/consts' {
1414
* The amount of funds that must be reserved when creating a new approval.
1515
**/
1616
approvalDeposit: u128 & AugmentedConst<ApiType>;
17+
/**
18+
* The amount of funds that must be reserved for a non-provider asset account to be
19+
* maintained.
20+
**/
21+
assetAccountDeposit: u128 & AugmentedConst<ApiType>;
1722
/**
1823
* The basic amount of funds that must be reserved for an asset.
1924
**/

packages/api-augment/src/augment/errors.ts

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import type { ApiTypes } from '@polkadot/api-base/types';
66
declare module '@polkadot/api-base/types/errors' {
77
export interface AugmentedErrors<ApiType extends ApiTypes> {
88
assets: {
9+
/**
10+
* The asset-account already exists.
11+
**/
12+
AlreadyExists: AugmentedError<ApiType>;
913
/**
1014
* Invalid metadata given.
1115
**/
@@ -18,10 +22,6 @@ declare module '@polkadot/api-base/types/errors' {
1822
* Account balance must be greater than or equal to the transfer amount.
1923
**/
2024
BalanceLow: AugmentedError<ApiType>;
21-
/**
22-
* Balance should be non-zero.
23-
**/
24-
BalanceZero: AugmentedError<ApiType>;
2525
/**
2626
* The origin account is frozen.
2727
**/
@@ -34,13 +34,22 @@ declare module '@polkadot/api-base/types/errors' {
3434
* Minimum balance should be non-zero.
3535
**/
3636
MinBalanceZero: AugmentedError<ApiType>;
37+
/**
38+
* The account to alter does not exist.
39+
**/
40+
NoAccount: AugmentedError<ApiType>;
41+
/**
42+
* The asset-account doesn't have an associated deposit.
43+
**/
44+
NoDeposit: AugmentedError<ApiType>;
3745
/**
3846
* The signing account has no permission to do the operation.
3947
**/
4048
NoPermission: AugmentedError<ApiType>;
4149
/**
42-
* No provider reference exists to allow a non-zero balance of a non-self-sufficient
43-
* asset.
50+
* Unable to increment the consumer reference counters on the account. Either no provider
51+
* reference exists to allow a non-zero balance of a non-self-sufficient asset, or the
52+
* maximum number of consumers has been reached.
4453
**/
4554
NoProvider: AugmentedError<ApiType>;
4655
/**
@@ -51,6 +60,10 @@ declare module '@polkadot/api-base/types/errors' {
5160
* The given asset ID is unknown.
5261
**/
5362
Unknown: AugmentedError<ApiType>;
63+
/**
64+
* The operation would result in funds being burned.
65+
**/
66+
WouldBurn: AugmentedError<ApiType>;
5467
/**
5568
* The source account would not survive the transfer and it needs to stay alive.
5669
**/
@@ -251,6 +264,13 @@ declare module '@polkadot/api-base/types/errors' {
251264
* No contract was found at the specified address.
252265
**/
253266
ContractNotFound: AugmentedError<ApiType>;
267+
/**
268+
* The contract ran to completion but decided to revert its storage changes.
269+
* Please note that this error is only returned from extrinsics. When called directly
270+
* or via RPC an `Ok` will be returned. In this case the caller needs to inspect the flags
271+
* to determine whether a reversion has taken place.
272+
**/
273+
ContractReverted: AugmentedError<ApiType>;
254274
/**
255275
* Contract trapped during execution.
256276
**/
@@ -925,6 +945,36 @@ declare module '@polkadot/api-base/types/errors' {
925945
**/
926946
[key: string]: AugmentedError<ApiType>;
927947
};
948+
preimage: {
949+
/**
950+
* Preimage has already been noted on-chain.
951+
**/
952+
AlreadyNoted: AugmentedError<ApiType>;
953+
/**
954+
* The user is not authorized to perform this action.
955+
**/
956+
NotAuthorized: AugmentedError<ApiType>;
957+
/**
958+
* The preimage cannot be removed since it has not yet been noted.
959+
**/
960+
NotNoted: AugmentedError<ApiType>;
961+
/**
962+
* The preimage request cannot be removed since no outstanding requests exist.
963+
**/
964+
NotRequested: AugmentedError<ApiType>;
965+
/**
966+
* A preimage may not be removed when there are outstanding requests.
967+
**/
968+
Requested: AugmentedError<ApiType>;
969+
/**
970+
* Preimage is too large to store on-chain.
971+
**/
972+
TooLarge: AugmentedError<ApiType>;
973+
/**
974+
* Generic error
975+
**/
976+
[key: string]: AugmentedError<ApiType>;
977+
};
928978
proxy: {
929979
/**
930980
* Account is already a proxy.

packages/api-augment/src/augment/events.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ApiTypes } from '@polkadot/api-base/types';
55
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
66
import type { ITuple } from '@polkadot/types-codec/types';
77
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
8-
import type { FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, NodeRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError } from '@polkadot/types/lookup';
8+
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, NodeRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError } from '@polkadot/types/lookup';
99

1010
declare module '@polkadot/api-base/types/events' {
1111
export interface AugmentedEvents<ApiType extends ApiTypes> {
@@ -609,6 +609,24 @@ declare module '@polkadot/api-base/types/events' {
609609
**/
610610
[key: string]: AugmentedEvent<ApiType>;
611611
};
612+
preimage: {
613+
/**
614+
* A preimage has ben cleared.
615+
**/
616+
Cleared: AugmentedEvent<ApiType, [H256]>;
617+
/**
618+
* A preimage has been noted.
619+
**/
620+
Noted: AugmentedEvent<ApiType, [H256]>;
621+
/**
622+
* A preimage has been requested.
623+
**/
624+
Requested: AugmentedEvent<ApiType, [H256]>;
625+
/**
626+
* Generic event
627+
**/
628+
[key: string]: AugmentedEvent<ApiType>;
629+
};
612630
proxy: {
613631
/**
614632
* An announcement was placed to make a call in the future.
@@ -663,6 +681,10 @@ declare module '@polkadot/api-base/types/events' {
663681
[key: string]: AugmentedEvent<ApiType>;
664682
};
665683
scheduler: {
684+
/**
685+
* The call for the provided hash was not found so the task has been aborted.
686+
**/
687+
CallLookupFailed: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<Bytes>, FrameSupportScheduleLookupError]>;
666688
/**
667689
* Canceled some task.
668690
**/
@@ -829,9 +851,9 @@ declare module '@polkadot/api-base/types/events' {
829851
};
830852
sudo: {
831853
/**
832-
* The \[sudoer\] just switched identity; the old key is supplied.
854+
* The \[sudoer\] just switched identity; the old key is supplied if one existed.
833855
**/
834-
KeyChanged: AugmentedEvent<ApiType, [AccountId32]>;
856+
KeyChanged: AugmentedEvent<ApiType, [Option<AccountId32>]>;
835857
/**
836858
* A sudo just took place. \[result\]
837859
**/

packages/api-augment/src/augment/query.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import type { Data } from '@polkadot/types';
66
import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types-codec';
77
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
88
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
9-
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
9+
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetAccount, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV3, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
1010
import type { Observable } from '@polkadot/types/types';
1111

1212
declare module '@polkadot/api-base/types/storage' {
1313
export interface AugmentedQueries<ApiType extends ApiTypes> {
1414
assets: {
1515
/**
16-
* The number of units of assets held by any given account.
16+
* The holdings of a specific account for a specific asset.
1717
**/
18-
account: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<PalletAssetsAssetBalance>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
18+
account: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<PalletAssetsAssetAccount>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
1919
/**
2020
* Approved balance transfers. First balance is the amount approved for transfer. Second
2121
* is the amount of `T::Currency` reserved for storing this.
@@ -478,7 +478,7 @@ declare module '@polkadot/api-base/types/storage' {
478478
* Twox note: the key of the map is an auto-incrementing index which users cannot inspect or
479479
* affect; we shouldn't need a cryptographically secure hasher.
480480
**/
481-
signedSubmissionsMap: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<PalletElectionProviderMultiPhaseSignedSignedSubmission>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
481+
signedSubmissionsMap: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletElectionProviderMultiPhaseSignedSignedSubmission>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
482482
/**
483483
* Snapshot data of the round.
484484
*
@@ -756,6 +756,20 @@ declare module '@polkadot/api-base/types/storage' {
756756
**/
757757
[key: string]: QueryableStorageEntry<ApiType>;
758758
};
759+
preimage: {
760+
/**
761+
* The preimages stored by this pallet.
762+
**/
763+
preimageFor: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<Bytes>>, [H256]> & QueryableStorageEntry<ApiType, [H256]>;
764+
/**
765+
* The request status of a given hash.
766+
**/
767+
statusFor: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<PalletPreimageRequestStatus>>, [H256]> & QueryableStorageEntry<ApiType, [H256]>;
768+
/**
769+
* Generic query
770+
**/
771+
[key: string]: QueryableStorageEntry<ApiType>;
772+
};
759773
proxy: {
760774
/**
761775
* The announcements made by the proxy (key).
@@ -810,7 +824,7 @@ declare module '@polkadot/api-base/types/storage' {
810824
/**
811825
* Items to be executed, indexed by the block number that they should be executed on.
812826
**/
813-
agenda: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Option<PalletSchedulerScheduledV2>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
827+
agenda: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Option<PalletSchedulerScheduledV3>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
814828
/**
815829
* Lookup from identity to the block number and index of the task.
816830
**/
@@ -1172,7 +1186,7 @@ declare module '@polkadot/api-base/types/storage' {
11721186
/**
11731187
* The `AccountId` of the sudo key.
11741188
**/
1175-
key: AugmentedQuery<ApiType, () => Observable<AccountId32>, []> & QueryableStorageEntry<ApiType, []>;
1189+
key: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
11761190
/**
11771191
* Generic query
11781192
**/
@@ -1420,6 +1434,11 @@ declare module '@polkadot/api-base/types/storage' {
14201434
* Details of an asset class.
14211435
**/
14221436
class: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletUniquesClassDetails>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
1437+
/**
1438+
* The classes owned by any given account; set out this way so that classes owned by a single
1439+
* account can be enumerated.
1440+
**/
1441+
classAccount: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<Null>>, [AccountId32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32]>;
14231442
/**
14241443
* Metadata of an asset class.
14251444
**/

0 commit comments

Comments
 (0)