Align costs typing with queries (#2564)

* Align costs typing with queries

* better...

* ... and better

* ... progress

* better, down to 8

* ... down to 3

* ... 2

* Down to 1

* It builds.

* ... it really builds
This commit is contained in:
Jaco Greeff
2020-09-02 12:19:09 +02:00
committed by GitHub
parent 1214572f02
commit eb6b3c5bd4
15 changed files with 238 additions and 206 deletions
+101 -97
View File
@@ -8,17 +8,17 @@ import { Balance, BalanceOf, BlockNumber, LockIdentifier, ModuleId, Moment, Perb
import { SessionIndex } from '@polkadot/types/interfaces/session';
import { EraIndex } from '@polkadot/types/interfaces/staking';
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/metadata/Decorated/consts/types' {
export interface Constants {
[index: string]: ModuleConstants;
declare module '@polkadot/api/types/consts' {
export interface AugmentedConsts<ApiType> {
babe: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The number of **slots** that an epoch takes. We couple sessions to
* epochs, i.e. we start a new session once the new epoch begins.
**/
epochDuration: AugmentedConst<u64>;
epochDuration: u64 & AugmentedConst<ApiType>;
/**
* The expected average block time at which BABE should be creating
* blocks. Since BABE is probabilistic it is not trivial to figure out
@@ -26,30 +26,30 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* duration and the security parameter `c` (where `1 - c` represents
* the probability of a slot being empty).
**/
expectedBlockTime: AugmentedConst<Moment>;
expectedBlockTime: Moment & AugmentedConst<ApiType>;
};
balances: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The minimum amount required to keep an account open.
**/
existentialDeposit: AugmentedConst<Balance>;
existentialDeposit: Balance & AugmentedConst<ApiType>;
};
contracts: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The maximum nesting level of a call/instantiate stack. A reasonable default
* value is 100.
**/
maxDepth: AugmentedConst<u32>;
maxDepth: u32 & AugmentedConst<ApiType>;
/**
* The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
**/
maxValueSize: AugmentedConst<u32>;
maxValueSize: u32 & AugmentedConst<ApiType>;
/**
* Price of a byte of storage per one block interval. Should be greater than 0.
**/
rentByteFee: AugmentedConst<BalanceOf>;
rentByteFee: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount of funds a contract should deposit in order to offset
* the cost of one byte.
@@ -59,14 +59,14 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000,
* then it would pay 500 BU/day.
**/
rentDepositOffset: AugmentedConst<BalanceOf>;
rentDepositOffset: BalanceOf & AugmentedConst<ApiType>;
/**
* Number of block delay an extrinsic claim surcharge has.
*
* When claim surcharge is called by an extrinsic the rent is checked
* for current_block - delay
**/
signedClaimHandicap: AugmentedConst<BlockNumber>;
signedClaimHandicap: BlockNumber & AugmentedConst<ApiType>;
/**
* A size offset for an contract. A just created account with untouched storage will have that
* much of storage from the perspective of the state rent.
@@ -75,23 +75,23 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* by making them pay rent. This creates an incentive to remove them early in order to save
* rent.
**/
storageSizeOffset: AugmentedConst<u32>;
storageSizeOffset: u32 & AugmentedConst<ApiType>;
/**
* Reward that is received by the party whose touch has led
* to removal of a contract.
**/
surchargeReward: AugmentedConst<BalanceOf>;
surchargeReward: BalanceOf & AugmentedConst<ApiType>;
/**
* The minimum amount required to generate a tombstone.
**/
tombstoneDeposit: AugmentedConst<BalanceOf>;
tombstoneDeposit: BalanceOf & AugmentedConst<ApiType>;
};
democracy: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* Period in blocks where an external proposal may not be re-submitted after being vetoed.
**/
cooloffPeriod: AugmentedConst<BlockNumber>;
cooloffPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The minimum period of locking and the period between a proposal being approved and enacted.
*
@@ -99,175 +99,175 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* voting stakers have an opportunity to remove themselves from the system in the case where
* they are on the losing side of a vote.
**/
enactmentPeriod: AugmentedConst<BlockNumber>;
enactmentPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* Minimum voting period allowed for an emergency referendum.
**/
fastTrackVotingPeriod: AugmentedConst<BlockNumber>;
fastTrackVotingPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* How often (in blocks) new public referenda are launched.
**/
launchPeriod: AugmentedConst<BlockNumber>;
launchPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The maximum number of votes for an account.
**/
maxVotes: AugmentedConst<u32>;
maxVotes: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount to be used as a deposit for a public referendum proposal.
**/
minimumDeposit: AugmentedConst<BalanceOf>;
minimumDeposit: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount of balance that must be deposited per byte of preimage stored.
**/
preimageByteDeposit: AugmentedConst<BalanceOf>;
preimageByteDeposit: BalanceOf & AugmentedConst<ApiType>;
/**
* How often (in blocks) to check for new votes.
**/
votingPeriod: AugmentedConst<BlockNumber>;
votingPeriod: BlockNumber & AugmentedConst<ApiType>;
};
elections: {
[index: string]: AugmentedConst<object & Codec>;
candidacyBond: AugmentedConst<BalanceOf>;
desiredMembers: AugmentedConst<u32>;
desiredRunnersUp: AugmentedConst<u32>;
moduleId: AugmentedConst<LockIdentifier>;
termDuration: AugmentedConst<BlockNumber>;
votingBond: AugmentedConst<BalanceOf>;
[key: string]: Codec;
candidacyBond: BalanceOf & AugmentedConst<ApiType>;
desiredMembers: u32 & AugmentedConst<ApiType>;
desiredRunnersUp: u32 & AugmentedConst<ApiType>;
moduleId: LockIdentifier & AugmentedConst<ApiType>;
termDuration: BlockNumber & AugmentedConst<ApiType>;
votingBond: BalanceOf & AugmentedConst<ApiType>;
};
finalityTracker: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The delay after which point things become suspicious. Default is 1000.
**/
reportLatency: AugmentedConst<BlockNumber>;
reportLatency: BlockNumber & AugmentedConst<ApiType>;
/**
* The number of recent samples to keep from this chain. Default is 101.
**/
windowSize: AugmentedConst<BlockNumber>;
windowSize: BlockNumber & AugmentedConst<ApiType>;
};
identity: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The amount held on deposit for a registered identity.
**/
basicDeposit: AugmentedConst<BalanceOf>;
basicDeposit: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount held on deposit per additional field for a registered identity.
**/
fieldDeposit: AugmentedConst<BalanceOf>;
fieldDeposit: BalanceOf & AugmentedConst<ApiType>;
/**
* Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O
* required to access an identity, but can be pretty high.
**/
maxAdditionalFields: AugmentedConst<u32>;
maxAdditionalFields: u32 & AugmentedConst<ApiType>;
/**
* Maxmimum number of registrars allowed in the system. Needed to bound the complexity
* of, e.g., updating judgements.
**/
maxRegistrars: AugmentedConst<u32>;
maxRegistrars: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of sub-accounts allowed per identified account.
**/
maxSubAccounts: AugmentedConst<u32>;
maxSubAccounts: u32 & AugmentedConst<ApiType>;
/**
* The amount held on deposit for a registered subaccount. This should account for the fact
* that one storage item's value will increase by the size of an account ID, and there will be
* another trie item whose value is the size of an account ID plus 32 bytes.
**/
subAccountDeposit: AugmentedConst<BalanceOf>;
subAccountDeposit: BalanceOf & AugmentedConst<ApiType>;
};
indices: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The deposit needed for reserving an index.
**/
deposit: AugmentedConst<BalanceOf>;
deposit: BalanceOf & AugmentedConst<ApiType>;
};
proxy: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* `AnnouncementDepositBase` metadata shadow.
**/
announcementDepositBase: AugmentedConst<BalanceOf>;
announcementDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
* `AnnouncementDepositFactor` metadata shadow.
**/
announcementDepositFactor: AugmentedConst<BalanceOf>;
announcementDepositFactor: BalanceOf & AugmentedConst<ApiType>;
/**
* `MaxPending` metadata shadow.
**/
maxPending: AugmentedConst<u32>;
maxPending: u32 & AugmentedConst<ApiType>;
/**
* The maximum amount of proxies allowed for a single account.
**/
maxProxies: AugmentedConst<u16>;
maxProxies: u16 & AugmentedConst<ApiType>;
/**
* The base amount of currency needed to reserve for creating a proxy.
**/
proxyDepositBase: AugmentedConst<BalanceOf>;
proxyDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount of currency needed per proxy added.
**/
proxyDepositFactor: AugmentedConst<BalanceOf>;
proxyDepositFactor: BalanceOf & AugmentedConst<ApiType>;
};
recovery: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The base amount of currency needed to reserve for creating a recovery configuration.
**/
configDepositBase: AugmentedConst<BalanceOf>;
configDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount of currency needed per additional user when creating a recovery configuration.
**/
friendDepositFactor: AugmentedConst<BalanceOf>;
friendDepositFactor: BalanceOf & AugmentedConst<ApiType>;
/**
* The maximum amount of friends allowed in a recovery configuration.
**/
maxFriends: AugmentedConst<u16>;
maxFriends: u16 & AugmentedConst<ApiType>;
/**
* The base amount of currency needed to reserve for starting a recovery.
**/
recoveryDeposit: AugmentedConst<BalanceOf>;
recoveryDeposit: BalanceOf & AugmentedConst<ApiType>;
};
society: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The minimum amount of a deposit required for a bid to be made.
**/
candidateDeposit: AugmentedConst<BalanceOf>;
candidateDeposit: BalanceOf & AugmentedConst<ApiType>;
/**
* The number of blocks between membership challenges.
**/
challengePeriod: AugmentedConst<BlockNumber>;
challengePeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The number of times a member may vote the wrong way (or not at all, when they are a skeptic)
* before they become suspended.
**/
maxStrikes: AugmentedConst<u32>;
maxStrikes: u32 & AugmentedConst<ApiType>;
/**
* The societies's module id
**/
moduleId: AugmentedConst<ModuleId>;
moduleId: ModuleId & AugmentedConst<ApiType>;
/**
* The amount of incentive paid within each period. Doesn't include VoterTip.
**/
periodSpend: AugmentedConst<BalanceOf>;
periodSpend: BalanceOf & AugmentedConst<ApiType>;
/**
* The number of blocks between candidate/membership rotation periods.
**/
rotationPeriod: AugmentedConst<BlockNumber>;
rotationPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The amount of the unpaid reward that gets deducted in the case that either a skeptic
* doesn't vote or someone votes in the wrong way.
**/
wrongSideDeduction: AugmentedConst<BalanceOf>;
wrongSideDeduction: BalanceOf & AugmentedConst<ApiType>;
};
staking: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* Number of eras that staked funds must remain bonded for.
**/
bondingDuration: AugmentedConst<EraIndex>;
bondingDuration: EraIndex & AugmentedConst<ApiType>;
/**
* The number of blocks before the end of the era from which election submissions are allowed.
*
@@ -277,28 +277,28 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* This is bounded by being within the last session. Hence, setting it to a value more than the
* length of a session will be pointless.
**/
electionLookahead: AugmentedConst<BlockNumber>;
electionLookahead: BlockNumber & AugmentedConst<ApiType>;
/**
* Maximum number of balancing iterations to run in the offchain submission.
*
* If set to 0, balance_solution will not be executed at all.
**/
maxIterations: AugmentedConst<u32>;
maxIterations: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of nominators rewarded for each validator.
*
* For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can claim
* their reward. This used to limit the i/o cost for the nominator payout.
**/
maxNominatorRewardedPerValidator: AugmentedConst<u32>;
maxNominatorRewardedPerValidator: u32 & AugmentedConst<ApiType>;
/**
* The threshold of improvement that should be provided for a new solution to be accepted.
**/
minSolutionScoreBump: AugmentedConst<Perbill>;
minSolutionScoreBump: Perbill & AugmentedConst<ApiType>;
/**
* Number of sessions per era.
**/
sessionsPerEra: AugmentedConst<SessionIndex>;
sessionsPerEra: SessionIndex & AugmentedConst<ApiType>;
/**
* Number of eras that slashes are deferred by, after computation.
*
@@ -306,102 +306,106 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* Set to 0 if slashes should be applied immediately, without opportunity for
* intervention.
**/
slashDeferDuration: AugmentedConst<EraIndex>;
slashDeferDuration: EraIndex & AugmentedConst<ApiType>;
};
system: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The base weight of executing a block, independent of the transactions in the block.
**/
blockExecutionWeight: AugmentedConst<Weight>;
blockExecutionWeight: Weight & AugmentedConst<ApiType>;
/**
* The maximum number of blocks to allow in mortal eras.
**/
blockHashCount: AugmentedConst<BlockNumber>;
blockHashCount: BlockNumber & AugmentedConst<ApiType>;
/**
* The weight of runtime database operations the runtime can invoke.
**/
dbWeight: AugmentedConst<RuntimeDbWeight>;
dbWeight: RuntimeDbWeight & AugmentedConst<ApiType>;
/**
* The base weight of an Extrinsic in the block, independent of the of extrinsic being executed.
**/
extrinsicBaseWeight: AugmentedConst<Weight>;
extrinsicBaseWeight: Weight & AugmentedConst<ApiType>;
/**
* The maximum length of a block (in bytes).
**/
maximumBlockLength: AugmentedConst<u32>;
maximumBlockLength: u32 & AugmentedConst<ApiType>;
/**
* The maximum weight of a block.
**/
maximumBlockWeight: AugmentedConst<Weight>;
maximumBlockWeight: Weight & AugmentedConst<ApiType>;
};
timestamp: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The minimum period between blocks. Beware that this is different to the *expected* period
* that the block production apparatus provides. Your chosen consensus system will generally
* work with this to determine a sensible block time. e.g. For Aura, it will be double this
* period on default settings.
**/
minimumPeriod: AugmentedConst<Moment>;
minimumPeriod: Moment & AugmentedConst<ApiType>;
};
transactionPayment: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: AugmentedConst<BalanceOf>;
transactionByteFee: BalanceOf & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
weightToFee: AugmentedConst<Vec<WeightToFeeCoefficient>>;
weightToFee: Vec<WeightToFeeCoefficient> & AugmentedConst<ApiType>;
};
treasury: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* Percentage of spare funds (if any) that are burnt per spend period.
**/
burn: AugmentedConst<Permill>;
burn: Permill & AugmentedConst<ApiType>;
/**
* The treasury's module id, used for deriving its sovereign account ID.
**/
moduleId: AugmentedConst<ModuleId>;
moduleId: ModuleId & AugmentedConst<ApiType>;
/**
* Fraction of a proposal's value that should be bonded in order to place the proposal.
* An accepted proposal gets these back. A rejected proposal does not.
**/
proposalBond: AugmentedConst<Permill>;
proposalBond: Permill & AugmentedConst<ApiType>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
proposalBondMinimum: AugmentedConst<BalanceOf>;
proposalBondMinimum: BalanceOf & AugmentedConst<ApiType>;
/**
* Period between successive spends.
**/
spendPeriod: AugmentedConst<BlockNumber>;
spendPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The period for which a tip remains open after is has achieved threshold tippers.
**/
tipCountdown: AugmentedConst<BlockNumber>;
tipCountdown: BlockNumber & AugmentedConst<ApiType>;
/**
* The amount of the final tip which goes to the original reporter of the tip.
**/
tipFindersFee: AugmentedConst<Percent>;
tipFindersFee: Percent & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a tip report.
**/
tipReportDepositBase: AugmentedConst<BalanceOf>;
tipReportDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount held on deposit per byte within the tip report reason.
**/
tipReportDepositPerByte: AugmentedConst<BalanceOf>;
tipReportDepositPerByte: BalanceOf & AugmentedConst<ApiType>;
};
vesting: {
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
/**
* The minimum amount to be transferred to create a new vesting schedule.
**/
minVestedTransfer: AugmentedConst<BalanceOf>;
minVestedTransfer: BalanceOf & AugmentedConst<ApiType>;
};
}
export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> {
[key: string]: QueryableModuleConsts;
}
}
+29 -29
View File
@@ -33,7 +33,7 @@ import { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/api/types/storage' {
export interface AugmentedQueries<ApiType> {
authorship: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Author of current block.
**/
@@ -48,7 +48,7 @@ declare module '@polkadot/api/types/storage' {
uncles: AugmentedQuery<ApiType, () => Observable<Vec<UncleEntryItem>>> & QueryableStorageEntry<ApiType>;
};
babe: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Current epoch authorities.
**/
@@ -118,7 +118,7 @@ declare module '@polkadot/api/types/storage' {
underConstruction: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Randomness>>> & QueryableStorageEntry<ApiType>;
};
balances: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The balance of an account.
*
@@ -142,7 +142,7 @@ declare module '@polkadot/api/types/storage' {
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>> & QueryableStorageEntry<ApiType>;
};
contracts: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The subtrie counter.
**/
@@ -167,7 +167,7 @@ declare module '@polkadot/api/types/storage' {
pristineCode: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
};
council: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The current members of the collective. This is stored sorted (just by value).
**/
@@ -195,7 +195,7 @@ declare module '@polkadot/api/types/storage' {
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>> & QueryableStorageEntry<ApiType>;
};
democracy: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* A record of who vetoed what. Maps proposal hash to a possible existent block number
* (until when it may not be resubmitted) and who vetoed it.
@@ -273,7 +273,7 @@ declare module '@polkadot/api/types/storage' {
votingOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Voting>> & QueryableStorageEntry<ApiType>;
};
elections: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The present candidate list. Sorted based on account-id. A current member or runner-up
* can never enter this vector and is always implicitly assumed to be a candidate.
@@ -299,7 +299,7 @@ declare module '@polkadot/api/types/storage' {
voting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>> & QueryableStorageEntry<ApiType>;
};
grandpa: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The number of changes (both in terms of keys and underlying economic responsibilities)
* in the "set" of Grandpa validators from genesis.
@@ -330,7 +330,7 @@ declare module '@polkadot/api/types/storage' {
state: AugmentedQuery<ApiType, () => Observable<StoredState>> & QueryableStorageEntry<ApiType>;
};
identity: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Information that is pertinent to identify the entity behind an account.
*
@@ -359,7 +359,7 @@ declare module '@polkadot/api/types/storage' {
superOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[AccountId, Data]>>>> & QueryableStorageEntry<ApiType>;
};
imOnline: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* For each session index, we keep a mapping of `T::ValidatorId` to the
* number of blocks authored by the given authority.
@@ -385,14 +385,14 @@ declare module '@polkadot/api/types/storage' {
receivedHeartbeats: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
};
indices: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The lookup from index to account.
**/
accounts: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[AccountId, BalanceOf, bool]>>>> & QueryableStorageEntry<ApiType>;
};
multisig: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
calls: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Option<ITuple<[OpaqueCall, AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* The set of open multisig operations.
@@ -400,7 +400,7 @@ declare module '@polkadot/api/types/storage' {
multisigs: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: U8aFixed | string | Uint8Array) => Observable<Option<Multisig>>> & QueryableStorageEntry<ApiType>;
};
offences: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* A vector of reports of the same kind that happened at the same time slot.
**/
@@ -425,7 +425,7 @@ declare module '@polkadot/api/types/storage' {
reportsByKindIndex: AugmentedQuery<ApiType, (arg: Kind | string | Uint8Array) => Observable<Bytes>> & QueryableStorageEntry<ApiType>;
};
proxy: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The announcements made by the proxy (key).
**/
@@ -437,7 +437,7 @@ declare module '@polkadot/api/types/storage' {
proxies: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[Vec<ProxyDefinition>, BalanceOf]>>> & QueryableStorageEntry<ApiType>;
};
randomnessCollectiveFlip: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Series of block headers from the last 81 blocks that acts as random seed material. This
* is arranged as a ring buffer with `block_number % 81` being the index into the `Vec` of
@@ -446,7 +446,7 @@ declare module '@polkadot/api/types/storage' {
randomMaterial: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>> & QueryableStorageEntry<ApiType>;
};
recovery: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Active recovery attempts.
*
@@ -466,7 +466,7 @@ declare module '@polkadot/api/types/storage' {
recoverable: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<RecoveryConfig>>> & QueryableStorageEntry<ApiType>;
};
scheduler: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Items to be executed, indexed by the block number that they should be executed on.
**/
@@ -483,7 +483,7 @@ declare module '@polkadot/api/types/storage' {
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>> & QueryableStorageEntry<ApiType>;
};
session: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Current index of the session.
**/
@@ -518,7 +518,7 @@ declare module '@polkadot/api/types/storage' {
validators: AugmentedQuery<ApiType, () => Observable<Vec<ValidatorId>>> & QueryableStorageEntry<ApiType>;
};
society: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The current bids, stored ordered by the value of the bid.
**/
@@ -586,7 +586,7 @@ declare module '@polkadot/api/types/storage' {
vouching: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VouchingStatus>>> & QueryableStorageEntry<ApiType>;
};
staking: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The active era information, it holds index and start.
*
@@ -783,14 +783,14 @@ declare module '@polkadot/api/types/storage' {
validatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
};
sudo: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The `AccountId` of the sudo key.
**/
key: AugmentedQuery<ApiType, () => Observable<AccountId>> & QueryableStorageEntry<ApiType>;
};
system: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The full account information for a particular account ID.
**/
@@ -862,7 +862,7 @@ declare module '@polkadot/api/types/storage' {
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>> & QueryableStorageEntry<ApiType>;
};
technicalCommittee: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The current members of the collective. This is stored sorted (just by value).
**/
@@ -890,7 +890,7 @@ declare module '@polkadot/api/types/storage' {
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>> & QueryableStorageEntry<ApiType>;
};
technicalMembership: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The current membership, stored as an ordered Vec.
**/
@@ -901,7 +901,7 @@ declare module '@polkadot/api/types/storage' {
prime: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
};
timestamp: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Did the timestamp get updated in this block?
**/
@@ -912,12 +912,12 @@ declare module '@polkadot/api/types/storage' {
now: AugmentedQuery<ApiType, () => Observable<Moment>> & QueryableStorageEntry<ApiType>;
};
transactionPayment: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
nextFeeMultiplier: AugmentedQuery<ApiType, () => Observable<Multiplier>> & QueryableStorageEntry<ApiType>;
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>> & QueryableStorageEntry<ApiType>;
};
treasury: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Proposal indices that have been approved but not yet awarded.
**/
@@ -943,7 +943,7 @@ declare module '@polkadot/api/types/storage' {
tips: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<OpenTip>>> & QueryableStorageEntry<ApiType>;
};
vesting: {
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
/**
* Information regarding the vesting of a given account.
**/
@@ -952,6 +952,6 @@ declare module '@polkadot/api/types/storage' {
}
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
[index: string]: QueryableModuleStorage<ApiType>;
[key: string]: QueryableModuleStorage<ApiType>;
}
}
+28 -28
View File
@@ -27,14 +27,14 @@ import { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
declare module '@polkadot/api/types/submittable' {
export interface AugmentedSubmittables<ApiType> {
authorship: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Provide a set of uncles.
**/
setUncles: AugmentedSubmittable<(newUncles: Vec<Header> | (Header | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
};
babe: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Report authority equivocation/misbehavior. This method will verify
* the equivocation proof and validate the given key ownership proof
@@ -55,7 +55,7 @@ declare module '@polkadot/api/types/submittable' {
reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: BabeEquivocationProof | { offender?: any; slotNumber?: any; firstHeader?: any; secondHeader?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
balances: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Exactly as `transfer`, except the origin must be root and the source account may be
* specified.
@@ -132,7 +132,7 @@ declare module '@polkadot/api/types/submittable' {
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | LookupSource | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
contracts: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Makes a call to an account, optionally transferring some balance.
*
@@ -177,7 +177,7 @@ declare module '@polkadot/api/types/submittable' {
updateSchedule: AugmentedSubmittable<(schedule: Schedule | { version?: any; putCodePerByteCost?: any; growMemCost?: any; regularOpCost?: any; returnDataPerByteCost?: any; eventDataPerByteCost?: any; eventPerTopicCost?: any; eventBaseCost?: any; sandboxDataReadCost?: any; sandboxDataWriteCost?: any; transferCost?: any; maxEventTopics?: any; maxStackHeight?: any; maxMemoryPages?: any; enablePrintln?: any; maxSubjectLen?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
council: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Close a vote that is either approved, disapproved or whose voting period has ended.
*
@@ -311,7 +311,7 @@ declare module '@polkadot/api/types/submittable' {
vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact<ProposalIndex> | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
democracy: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Cancel a proposal queued for enactment.
*
@@ -699,7 +699,7 @@ declare module '@polkadot/api/types/submittable' {
vote: AugmentedSubmittable<(refIndex: Compact<ReferendumIndex> | AnyNumber | Uint8Array, vote: AccountVote | { Standard: any } | { Split: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
elections: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Remove a particular member from the set. This is effective immediately and the bond of
* the outgoing member is slashed.
@@ -862,7 +862,7 @@ declare module '@polkadot/api/types/submittable' {
vote: AugmentedSubmittable<(votes: Vec<AccountId> | (AccountId | string | Uint8Array)[], value: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
finalityTracker: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Hint that the author of this block thinks the best finalized
* block is the given number.
@@ -870,7 +870,7 @@ declare module '@polkadot/api/types/submittable' {
finalHint: AugmentedSubmittable<(hint: Compact<BlockNumber> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
grandpa: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Note that the current authority set of the GRANDPA finality gadget has
* stalled. This will trigger a forced authority set change at the beginning
@@ -902,7 +902,7 @@ declare module '@polkadot/api/types/submittable' {
reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: GrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
identity: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Add a registrar to the system.
*
@@ -1166,7 +1166,7 @@ declare module '@polkadot/api/types/submittable' {
setSubs: AugmentedSubmittable<(subs: Vec<ITuple<[AccountId, Data]>> | ([AccountId | string | Uint8Array, Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>>;
};
imOnline: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* # <weight>
* - Complexity: `O(K + E)` where K is length of `Keys` and E is length of
@@ -1182,7 +1182,7 @@ declare module '@polkadot/api/types/submittable' {
heartbeat: AugmentedSubmittable<(heartbeat: Heartbeat | { blockNumber?: any; networkState?: any; sessionIndex?: any; authorityIndex?: any; validatorsLen?: any } | string | Uint8Array, signature: Signature | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
indices: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Assign an previously unassigned index.
*
@@ -1299,7 +1299,7 @@ declare module '@polkadot/api/types/submittable' {
transfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
multisig: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Register approval for a dispatch to be made from a deterministic composite account if
* approved by a total of `threshold - 1` of `other_signatories`.
@@ -1448,7 +1448,7 @@ declare module '@polkadot/api/types/submittable' {
cancelAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], timepoint: Timepoint | { height?: any; index?: any } | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
proxy: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Register a proxy account for the sender that is able to make calls on its behalf.
*
@@ -1641,7 +1641,7 @@ declare module '@polkadot/api/types/submittable' {
removeProxy: AugmentedSubmittable<(delegate: AccountId | string | Uint8Array, proxyType: ProxyType | 'Any'|'NonTransfer'|'Governance'|'Staking' | number | Uint8Array, delay: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
recovery: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Send a call through a recovered account.
*
@@ -1843,7 +1843,7 @@ declare module '@polkadot/api/types/submittable' {
vouchRecovery: AugmentedSubmittable<(lost: AccountId | string | Uint8Array, rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
scheduler: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Cancel an anonymously scheduled task.
*
@@ -1914,7 +1914,7 @@ declare module '@polkadot/api/types/submittable' {
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
session: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Removes any session key(s) of the function caller.
* This doesn't take effect until the next session.
@@ -1949,7 +1949,7 @@ declare module '@polkadot/api/types/submittable' {
setKeys: AugmentedSubmittable<(keys: Keys, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
society: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* A user outside of the society can make a bid for entry.
*
@@ -2269,7 +2269,7 @@ declare module '@polkadot/api/types/submittable' {
vouch: AugmentedSubmittable<(who: AccountId | string | Uint8Array, value: BalanceOf | AnyNumber | Uint8Array, tip: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
staking: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Take the origin account as a stash and lock up `value` of its balance. `controller` will
* be the account that controls it.
@@ -2753,7 +2753,7 @@ declare module '@polkadot/api/types/submittable' {
withdrawUnbonded: AugmentedSubmittable<(numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
sudo: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key.
*
@@ -2808,7 +2808,7 @@ declare module '@polkadot/api/types/submittable' {
sudoUncheckedWeight: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array, weight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
system: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* A dispatch that will fill the block weight up to the given ratio.
**/
@@ -2922,7 +2922,7 @@ declare module '@polkadot/api/types/submittable' {
suicide: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
};
technicalCommittee: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Close a vote that is either approved, disapproved or whose voting period has ended.
*
@@ -3056,7 +3056,7 @@ declare module '@polkadot/api/types/submittable' {
vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact<ProposalIndex> | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
technicalMembership: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Add a member `who` to the set.
*
@@ -3106,7 +3106,7 @@ declare module '@polkadot/api/types/submittable' {
swapMember: AugmentedSubmittable<(remove: AccountId | string | Uint8Array, add: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
timestamp: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Set the current time.
*
@@ -3127,7 +3127,7 @@ declare module '@polkadot/api/types/submittable' {
set: AugmentedSubmittable<(now: Compact<Moment> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
treasury: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Approve a proposal. At a later time, the proposal will be allocated to the beneficiary
* and the original deposit will be returned.
@@ -3284,7 +3284,7 @@ declare module '@polkadot/api/types/submittable' {
tipNew: AugmentedSubmittable<(reason: Bytes | string | Uint8Array, who: AccountId | string | Uint8Array, tipValue: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
utility: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Send a call through an indexed pseudonym of the sender.
*
@@ -3326,7 +3326,7 @@ declare module '@polkadot/api/types/submittable' {
batch: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
};
vesting: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Force a vested transfer.
*
@@ -3417,6 +3417,6 @@ declare module '@polkadot/api/types/submittable' {
export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> {
(extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType>;
[index: string]: SubmittableModuleExtrinsics<ApiType>;
[key: string]: SubmittableModuleExtrinsics<ApiType>;
}
}
+2 -2
View File
@@ -7,7 +7,7 @@ import { RpcInterface } from '@polkadot/rpc-core/types';
import { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { AnyFunction, CallFunction, Codec, CodecArg as Arg, ITuple, InterfaceTypes, ModulesWithCalls, Registry, RegistryTypes } from '@polkadot/types/types';
import { SubmittableExtrinsic } from '../submittable/types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecorateMethod, DecoratedRpc, DecoratedRpcSection, PaginationOptions, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecorateMethod, DecoratedRpc, DecoratedRpcSection, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import BN from 'bn.js';
import { BehaviorSubject, Observable, combineLatest, of } from 'rxjs';
@@ -50,7 +50,7 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
// HACK Use BN import so decorateDerive works... yes, wtf.
protected __phantom = new BN(0);
protected _consts: Constants = {} as Constants;
protected _consts: QueryableConsts<ApiType> = {} as QueryableConsts<ApiType>;
protected _derive?: ReturnType<Decorate<ApiType>['_decorateDerive']>;
+4 -11
View File
@@ -5,8 +5,8 @@
import { SignedBlock, RuntimeVersion } from '@polkadot/types/interfaces';
import { Registry } from '@polkadot/types/types';
import { ApiBase, ApiOptions, ApiTypes, DecorateMethod } from '../types';
import { VersionedRegistry } from './types';
import BN from 'bn.js';
import { Observable, Subscription, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Metadata, Text, TypeRegistry } from '@polkadot/types';
@@ -17,14 +17,6 @@ import { cryptoWaitReady } from '@polkadot/util-crypto';
import Decorate from './Decorate';
interface VersionedRegistry {
isDefault: boolean;
lastBlockHash: Uint8Array | null;
metadata: Metadata;
registry: Registry;
specVersion: BN;
}
const KEEPALIVE_INTERVAL = 15000;
const DEFAULT_BLOCKNUMBER = { unwrap: () => BN_ZERO };
@@ -127,7 +119,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
// retrieve the metadata now that we have all types set
const metadata = await this._rpcCore.state.getMetadata(header.parentHash).toPromise();
const result = { isDefault: false, lastBlockHash, metadata, registry, specVersion: version.specVersion };
const result = { isDefault: false, lastBlockHash, metadata, metadataConsts: null, registry, specVersion: version.specVersion };
// TODO: Not convinced (yet) that we really want to re-decorate, keep on ice since it does muddle-up
// this.injectMetadata(metadata, false);
@@ -213,6 +205,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
assert(thisRegistry, 'Initialization error, cannot find the default registry');
thisRegistry.metadata = metadata;
thisRegistry.metadataConsts = null;
thisRegistry.specVersion = version.specVersion;
thisRegistry.registry.register(getSpecTypes(thisRegistry.registry, this._runtimeChain as Text, version.specName, version.specVersion));
this.injectMetadata(metadata, false, thisRegistry.registry);
@@ -284,7 +277,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
// setup the initial registry, when we have none
if (!this.#registries.length) {
this.#registries.push({ isDefault: true, lastBlockHash: null, metadata, registry: this.registry, specVersion: runtimeVersion.specVersion });
this.#registries.push({ isDefault: true, lastBlockHash: null, metadata, metadataConsts: null, registry: this.registry, specVersion: runtimeVersion.specVersion });
}
// get unique types & validate
+2 -3
View File
@@ -2,11 +2,10 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Constants } from '@polkadot/metadata/Decorated/types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { CallFunction, RegistryError, SignerPayloadRawBase } from '@polkadot/types/types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedRpc, DecorateMethod, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics, Signer } from '../types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedRpc, DecorateMethod, QueryableConsts, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics, Signer } from '../types';
import { Metadata } from '@polkadot/types';
import { assert, isString, isUndefined, u8aToHex, u8aToU8a } from '@polkadot/util';
@@ -77,7 +76,7 @@ export default abstract class ApiBase<ApiType extends ApiTypes> extends Init<Api
* console.log(api.consts.democracy.enactmentPeriod.toString())
* ```
*/
public get consts (): Constants {
public get consts (): QueryableConsts<ApiType> {
return assertResult(this._consts);
}
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Constants } from '@polkadot/metadata/Decorated/types';
import { Metadata } from '@polkadot/types';
import { Registry } from '@polkadot/types/types';
import BN from 'bn.js';
export interface VersionedRegistry {
isDefault: boolean;
lastBlockHash: Uint8Array | null;
metadata: Metadata;
metadataConsts: Constants | null;
registry: Registry;
specVersion: BN;
}
+22
View File
@@ -0,0 +1,22 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// import { Hash } from '@polkadot/types/interfaces';
import { ModuleConstantMetadataLatest } from '@polkadot/types/interfaces';
import { Codec } from '@polkadot/types/types';
import { ApiTypes } from './base';
// import { ApiTypes, PromiseOrObs } from './base';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedConsts<ApiType extends ApiTypes> { }
export interface AugmentedConst<ApiType extends ApiTypes> {
// at: (hash: Hash | Uint8Array | string) => PromiseOrObs<ApiType, T>;
meta: ModuleConstantMetadataLatest;
}
export interface QueryableModuleConsts {
[key: string]: Codec;
}
+3 -2
View File
@@ -7,7 +7,6 @@ import '@polkadot/api/augment';
import type BN from 'bn.js';
import { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import { Constants } from '@polkadot/metadata/Decorated/types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import { Metadata } from '@polkadot/types';
@@ -16,6 +15,7 @@ import { DefinitionRpc, DefinitionRpcSub, Signer, SignatureOptions, Registry, Re
import { DeriveAllSections } from '../util/decorate';
import ApiBase from '../base';
import { QueryableConsts } from './consts';
import { DecoratedRpc } from './rpc';
import { QueryableStorage, QueryableStorageMulti } from './storage';
import { SubmittableExtrinsics } from './submittable';
@@ -24,6 +24,7 @@ export { Signer, SignerResult } from '@polkadot/types/types';
export { default as ApiBase } from '../base';
export * from '../submittable/types';
export * from './base';
export * from './consts';
export * from './rpc';
export * from './storage';
export * from './submittable';
@@ -67,7 +68,7 @@ export interface ApiOptions extends RegisteredTypes {
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
export interface ApiInterfaceRx {
consts: Constants;
consts: QueryableConsts<'rxjs'>;
// TODO This needs to be typed correctly
derive: DeriveAllSections<'rxjs', ExactDerive>;
extrinsicType: number;
@@ -1,18 +0,0 @@
// Copyright 2017-2020 @polkadot/metadata authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Codec } from '@polkadot/types/types';
import { ModuleConstantMetadataLatest } from '@polkadot/types/interfaces';
export type AugmentedConst<T extends Codec> = T & ConstantCodec;
export type ModuleConstants = Record<string, Codec>;
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Constants {}
export interface ConstantCodec extends Codec {
meta: ModuleConstantMetadataLatest;
}
+10 -4
View File
@@ -2,15 +2,21 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AugmentedConst, QueryableConsts, QueryableModuleConsts } from '@polkadot/api/types/consts';
import { Codec } from '@polkadot/types/types';
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
export * from './consts/types';
export interface ModuleStorage {
[key: string]: StorageEntry;
}
export type Constants = QueryableConsts<'rxjs'>;
export type ConstantCodec = Codec & AugmentedConst<'rxjs'>;
export type ModuleConstants = QueryableModuleConsts;
export interface Storage {
[key: string]: ModuleStorage; // Will hold modules returned by state_getMetadata
substrate: { [key: string]: StorageEntry };
[key: string]: ModuleStorage;
substrate: ModuleStorage;
}
+5 -1
View File
@@ -54,7 +54,11 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: Record<strin
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
}))
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
];
return generateForMetaTemplate({
+10 -7
View File
@@ -2,22 +2,25 @@
{{{ imports }}}
declare module '@polkadot/metadata/Decorated/consts/types' {
export interface Constants {
{{#unless isStrict}}
[index: string]: ModuleConstants;
{{/unless}}
declare module '@polkadot/api/types/consts' {
export interface AugmentedConsts<ApiType> {
{{#each modules}}
{{{name}}}: {
{{#unless @root.isStrict}}
[index: string]: AugmentedConst<object & Codec>;
[key: string]: Codec;
{{/unless}}
{{~#each items}}
{{> docs}}
{{{name}}}: AugmentedConst<{{{type}}}>;
{{{name}}}: {{{type}}} & AugmentedConst<ApiType>;
{{/each}}
};
{{/each}}
}
export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> {
{{#unless isStrict}}
[key: string]: QueryableModuleConsts;
{{/unless}}
}
}
{{> footer }}
+2 -2
View File
@@ -7,7 +7,7 @@ declare module '@polkadot/api/types/storage' {
{{#each modules}}
{{{name}}}: {
{{#unless @root.isStrict}}
[index: string]: QueryableStorageEntry<ApiType>;
[key: string]: QueryableStorageEntry<ApiType>;
{{/unless}}
{{~#each items}}
{{> docs}}
@@ -19,7 +19,7 @@ declare module '@polkadot/api/types/storage' {
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
{{#unless isStrict}}
[index: string]: QueryableModuleStorage<ApiType>;
[key: string]: QueryableModuleStorage<ApiType>;
{{/unless}}
}
}
+2 -2
View File
@@ -7,7 +7,7 @@ declare module '@polkadot/api/types/submittable' {
{{#each modules}}
{{{name}}}: {
{{#unless @root.isStrict}}
[index: string]: SubmittableExtrinsicFunction<ApiType>;
[key: string]: SubmittableExtrinsicFunction<ApiType>;
{{/unless}}
{{~#each items}}
{{> docs}}
@@ -20,7 +20,7 @@ declare module '@polkadot/api/types/submittable' {
export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> {
(extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType>;
{{#unless isStrict}}
[index: string]: SubmittableModuleExtrinsics<ApiType>;
[key: string]: SubmittableModuleExtrinsics<ApiType>;
{{/unless}}
}
}