From 4093ef9ffa0223aaaebe5a745c94b56a61fbfd9d Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 13 Mar 2020 13:39:34 +0100 Subject: [PATCH] Add Identity hasher (#2044) * Add Identity hasher * Expand new V11 storage types * Cleanups, use actual enum keys * Sort augmented output (fy-by enhancement) * Map get * DEFAULT_FN --- packages/api/src/augment/consts.ts | 306 +- packages/api/src/augment/query.ts | 1184 +++---- packages/api/src/augment/tx.ts | 2826 ++++++++--------- .../storage/fromMetadata/getHasher.ts | 33 +- packages/typegen/src/generate/consts.ts | 4 +- packages/typegen/src/generate/query.ts | 4 +- packages/typegen/src/generate/tx.ts | 4 +- .../src/interfaces/metadata/definitions.ts | 58 +- .../types/src/interfaces/metadata/types.ts | 56 +- packages/types/src/primitive/StorageKey.ts | 41 +- 10 files changed, 2305 insertions(+), 2211 deletions(-) diff --git a/packages/api/src/augment/consts.ts b/packages/api/src/augment/consts.ts index 8483e9738b..fdebfe28f6 100644 --- a/packages/api/src/augment/consts.ts +++ b/packages/api/src/augment/consts.ts @@ -27,16 +27,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' { **/ expectedBlockTime: AugmentedConst; }; - timestamp: { - [index: string]: AugmentedConst; - /** - * 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; - }; balances: { [index: string]: AugmentedConst; /** @@ -44,8 +34,70 @@ declare module '@polkadot/metadata/Decorated/consts/types' { **/ existentialDeposit: AugmentedConst; }; - transactionPayment: { + contracts: { [index: string]: AugmentedConst; + /** + * The maximum amount of gas that could be expended per block. A reasonable + * default value is 10_000_000. + **/ + blockGasLimit: AugmentedConst; + /** + * The base fee charged for calling into a contract. A reasonable default + * value is 135. + **/ + callBaseFee: AugmentedConst; + /** + * The fee required to instantiate a contract instance. A reasonable default value + * is 21. + **/ + contractFee: AugmentedConst; + /** + * The base fee charged for instantiating a contract. A reasonable default value + * is 175. + **/ + instantiateBaseFee: AugmentedConst; + /** + * The maximum nesting level of a call/instantiate stack. A reasonable default + * value is 100. + **/ + maxDepth: AugmentedConst; + /** + * The maximum size of a storage value in bytes. A reasonable default is 16 KiB. + **/ + maxValueSize: AugmentedConst; + /** + * Price of a byte of storage per one block interval. Should be greater than 0. + **/ + rentByteFee: AugmentedConst; + /** + * The amount of funds a contract should deposit in order to offset + * the cost of one byte. + * Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day, + * then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent. + * 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; + /** + * 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; + /** + * Size of a contract at the time of instantiation. This is a simple way to ensure that + * empty contracts eventually gets deleted. + **/ + storageSizeOffset: AugmentedConst; + /** + * Reward that is received by the party whose touch has led + * to removal of a contract. + **/ + surchargeReward: AugmentedConst; + /** + * The minimum amount required to generate a tombstone. + **/ + tombstoneDeposit: AugmentedConst; /** * The fee to be paid for making a transaction; the base. **/ @@ -55,27 +107,16 @@ declare module '@polkadot/metadata/Decorated/consts/types' { **/ transactionByteFee: AugmentedConst; }; - staking: { - [index: string]: AugmentedConst; - /** - * Number of sessions per era. - **/ - sessionsPerEra: AugmentedConst; - /** - * Number of eras that staked funds must remain bonded for. - **/ - bondingDuration: AugmentedConst; - }; - session: { - [index: string]: AugmentedConst; - /** - * Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch - * of the trie. - **/ - dedupKeyPrefix: AugmentedConst; - }; democracy: { [index: string]: AugmentedConst; + /** + * Period in blocks where an external proposal may not be re-submitted after being vetoed. + **/ + cooloffPeriod: AugmentedConst; + /** + * Minimum voting period allowed for an emergency referendum. + **/ + emergencyVotingPeriod: AugmentedConst; /** * The minimum period of locking and the period between a proposal being approved and enacted. * It should generally be a little more than the unstake period to ensure that @@ -87,48 +128,113 @@ declare module '@polkadot/metadata/Decorated/consts/types' { * How often (in blocks) new public referenda are launched. **/ launchPeriod: AugmentedConst; - /** - * How often (in blocks) to check for new votes. - **/ - votingPeriod: AugmentedConst; /** * The minimum amount to be used as a deposit for a public referendum proposal. **/ minimumDeposit: AugmentedConst; - /** - * Minimum voting period allowed for an emergency referendum. - **/ - emergencyVotingPeriod: AugmentedConst; - /** - * Period in blocks where an external proposal may not be re-submitted after being vetoed. - **/ - cooloffPeriod: AugmentedConst; /** * The amount of balance that must be deposited per byte of preimage stored. **/ preimageByteDeposit: AugmentedConst; + /** + * How often (in blocks) to check for new votes. + **/ + votingPeriod: AugmentedConst; }; elections: { [index: string]: AugmentedConst; candidacyBond: AugmentedConst; - votingBond: AugmentedConst; desiredMembers: AugmentedConst; desiredRunnersUp: AugmentedConst; termDuration: AugmentedConst; + votingBond: AugmentedConst; }; finalityTracker: { [index: string]: AugmentedConst; - /** - * The number of recent samples to keep from this chain. Default is 101. - **/ - windowSize: AugmentedConst; /** * The delay after which point things become suspicious. Default is 1000. **/ reportLatency: AugmentedConst; + /** + * The number of recent samples to keep from this chain. Default is 101. + **/ + windowSize: AugmentedConst; + }; + session: { + [index: string]: AugmentedConst; + /** + * Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch + * of the trie. + **/ + dedupKeyPrefix: AugmentedConst; + }; + society: { + [index: string]: AugmentedConst; + /** + * The minimum amount of a deposit required for a bid to be made. + **/ + candidateDeposit: AugmentedConst; + /** + * The number of blocks between membership challenges. + **/ + challengePeriod: AugmentedConst; + /** + * 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; + /** + * The amount of incentive paid within each period. Doesn't include VoterTip. + **/ + periodSpend: AugmentedConst; + /** + * The number of blocks between candidate/membership rotation periods. + **/ + rotationPeriod: AugmentedConst; + /** + * 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; + }; + staking: { + [index: string]: AugmentedConst; + /** + * Number of eras that staked funds must remain bonded for. + **/ + bondingDuration: AugmentedConst; + /** + * Number of sessions per era. + **/ + sessionsPerEra: AugmentedConst; + }; + timestamp: { + [index: string]: AugmentedConst; + /** + * 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; + }; + transactionPayment: { + [index: string]: AugmentedConst; + /** + * The fee to be paid for making a transaction; the base. + **/ + transactionBaseFee: AugmentedConst; + /** + * The fee to be paid for making a transaction; the per-byte portion. + **/ + transactionByteFee: AugmentedConst; }; treasury: { [index: string]: AugmentedConst; + /** + * Percentage of spare funds (if any) that are burnt per spend period. + **/ + burn: AugmentedConst; /** * 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. @@ -142,10 +248,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' { * Period between successive spends. **/ spendPeriod: AugmentedConst; - /** - * Percentage of spare funds (if any) that are burnt per spend period. - **/ - burn: AugmentedConst; /** * The period for which a tip remains open after is has achieved threshold tippers. **/ @@ -163,108 +265,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' { **/ tipReportDepositPerByte: AugmentedConst; }; - contracts: { - [index: string]: AugmentedConst; - /** - * 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; - /** - * The minimum amount required to generate a tombstone. - **/ - tombstoneDeposit: AugmentedConst; - /** - * Size of a contract at the time of instantiation. This is a simple way to ensure that - * empty contracts eventually gets deleted. - **/ - storageSizeOffset: AugmentedConst; - /** - * Price of a byte of storage per one block interval. Should be greater than 0. - **/ - rentByteFee: AugmentedConst; - /** - * The amount of funds a contract should deposit in order to offset - * the cost of one byte. - * Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day, - * then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent. - * 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; - /** - * Reward that is received by the party whose touch has led - * to removal of a contract. - **/ - surchargeReward: AugmentedConst; - /** - * The fee to be paid for making a transaction; the base. - **/ - transactionBaseFee: AugmentedConst; - /** - * The fee to be paid for making a transaction; the per-byte portion. - **/ - transactionByteFee: AugmentedConst; - /** - * The fee required to instantiate a contract instance. A reasonable default value - * is 21. - **/ - contractFee: AugmentedConst; - /** - * The base fee charged for calling into a contract. A reasonable default - * value is 135. - **/ - callBaseFee: AugmentedConst; - /** - * The base fee charged for instantiating a contract. A reasonable default value - * is 175. - **/ - instantiateBaseFee: AugmentedConst; - /** - * The maximum nesting level of a call/instantiate stack. A reasonable default - * value is 100. - **/ - maxDepth: AugmentedConst; - /** - * The maximum size of a storage value in bytes. A reasonable default is 16 KiB. - **/ - maxValueSize: AugmentedConst; - /** - * The maximum amount of gas that could be expended per block. A reasonable - * default value is 10_000_000. - **/ - blockGasLimit: AugmentedConst; - }; - society: { - [index: string]: AugmentedConst; - /** - * The minimum amount of a deposit required for a bid to be made. - **/ - candidateDeposit: AugmentedConst; - /** - * 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; - /** - * 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; - /** - * The amount of incentive paid within each period. Doesn't include VoterTip. - **/ - periodSpend: AugmentedConst; - /** - * The number of blocks between candidate/membership rotation periods. - **/ - rotationPeriod: AugmentedConst; - /** - * The number of blocks between membership challenges. - **/ - challengePeriod: AugmentedConst; - }; vesting: { [index: string]: AugmentedConst; /** diff --git a/packages/api/src/augment/query.ts b/packages/api/src/augment/query.ts index 97b45f9caf..2e8d68d692 100644 --- a/packages/api/src/augment/query.ts +++ b/packages/api/src/augment/query.ts @@ -31,98 +31,49 @@ import { ApiTypes } from '@polkadot/api/types'; declare module '@polkadot/api/types/storage' { export interface AugmentedQueries { - system: { + authorship: { [index: string]: QueryableStorageEntry; /** - * The full account information for a particular account ID. + * Author of current block. **/ - account: AugmentedQuery Observable> & QueryableStorageEntry; + author: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * Total extrinsics count for the current block. + * Whether uncles were already set in this block. **/ - extrinsicCount: AugmentedQuery Observable>> & QueryableStorageEntry; + didSetUncles: AugmentedQuery Observable> & QueryableStorageEntry; /** - * Total weight for all extrinsics put together, for the current block. + * Uncles **/ - allExtrinsicsWeight: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Total length (in bytes) for all extrinsics put together, for the current block. - **/ - allExtrinsicsLen: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Map of block numbers to block hashes. - **/ - blockHash: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Extrinsics data for the current block (maps an extrinsic's index to its data). - **/ - extrinsicData: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The current block number being processed. Set by `execute_block`. - **/ - number: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Hash of the previous block. - **/ - parentHash: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Extrinsics root of the current block, also part of the block header. - **/ - extrinsicsRoot: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Digest of the current block, also part of the block header. - **/ - digest: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Events deposited for the current block. - **/ - events: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The number of events in the `Events` list. - **/ - eventCount: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Mapping between a topic (represented by T::Hash) and a vector of indexes - * of events in the `>` list. - * All topic vectors have deterministic storage locations depending on the topic. This - * allows light-clients to leverage the changes trie storage tracking mechanism and - * in case of changes fetch the list of events of interest. - * The value has the type `(T::BlockNumber, EventIndex)` because if we used only just - * the `EventIndex` then in case if the topic has the same contents on the next block - * no notification will be triggered thus the event might be lost. - **/ - eventTopics: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * A bool to track if the runtime was upgraded last block. - **/ - runtimeUpgraded: AugmentedQuery Observable> & QueryableStorageEntry; - }; - utility: { - [index: string]: QueryableStorageEntry; - /** - * The set of open multisig operations. - **/ - multisigs: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; + uncles: AugmentedQuery Observable>> & QueryableStorageEntry; }; babe: { [index: string]: QueryableStorageEntry; - /** - * Current epoch index. - **/ - epochIndex: AugmentedQuery Observable> & QueryableStorageEntry; /** * Current epoch authorities. **/ authorities: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * Current slot number. + **/ + currentSlot: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Current epoch index. + **/ + epochIndex: AugmentedQuery Observable> & QueryableStorageEntry; /** * The slot at which the first epoch actually started. This is 0 * until the first block of the chain. **/ genesisSlot: AugmentedQuery Observable> & QueryableStorageEntry; /** - * Current slot number. + * Temporary value (cleared at block finalization) which is `Some` + * if per-block initialization has already been called for current block. **/ - currentSlot: AugmentedQuery Observable> & QueryableStorageEntry; + initialized: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Next epoch randomness. + **/ + nextRandomness: AugmentedQuery Observable> & QueryableStorageEntry; /** * The epoch randomness for the *current* epoch. * # Security @@ -134,10 +85,6 @@ declare module '@polkadot/api/types/storage' { * adversary, for purposes such as public-coin zero-knowledge proofs. **/ randomness: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Next epoch randomness. - **/ - nextRandomness: AugmentedQuery Observable> & QueryableStorageEntry; /** * Randomness under construction. * We make a tradeoff between storage accesses and list length. @@ -149,51 +96,9 @@ declare module '@polkadot/api/types/storage' { **/ segmentIndex: AugmentedQuery Observable> & QueryableStorageEntry; underConstruction: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Temporary value (cleared at block finalization) which is `Some` - * if per-block initialization has already been called for current block. - **/ - initialized: AugmentedQuery Observable>> & QueryableStorageEntry; - }; - timestamp: { - [index: string]: QueryableStorageEntry; - /** - * Current time for the current block. - **/ - now: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Did the timestamp get updated in this block? - **/ - didUpdate: AugmentedQuery Observable> & QueryableStorageEntry; - }; - authorship: { - [index: string]: QueryableStorageEntry; - /** - * Uncles - **/ - uncles: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Author of current block. - **/ - author: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Whether uncles were already set in this block. - **/ - didSetUncles: AugmentedQuery Observable> & QueryableStorageEntry; - }; - indices: { - [index: string]: QueryableStorageEntry; - /** - * The lookup from index to account. - **/ - accounts: AugmentedQuery Observable>>> & QueryableStorageEntry; }; balances: { [index: string]: QueryableStorageEntry; - /** - * The total units issued in the system. - **/ - totalIssuance: AugmentedQuery Observable> & QueryableStorageEntry; /** * The balance of an account. * NOTE: THIS MAY NEVER BE IN EXISTENCE AND YET HAVE A `total().is_zero()`. If the total @@ -211,61 +116,423 @@ declare module '@polkadot/api/types/storage' { * This is set to v2.0.0 for new networks. **/ storageVersion: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The total units issued in the system. + **/ + totalIssuance: AugmentedQuery Observable> & QueryableStorageEntry; }; - transactionPayment: { + contracts: { [index: string]: QueryableStorageEntry; - nextFeeMultiplier: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The subtrie counter. + **/ + accountCounter: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * A mapping between an original code hash and instrumented wasm code, ready for execution. + **/ + codeStorage: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The code associated with a given account. + **/ + contractInfoOf: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Current cost schedule for contracts. + **/ + currentSchedule: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The price of one unit of gas. + **/ + gasPrice: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Gas spent so far in this block. + **/ + gasSpent: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * A mapping from an original code hash to the original code, untouched by instrumentation. + **/ + pristineCode: AugmentedQuery Observable>> & QueryableStorageEntry; + }; + council: { + [index: string]: QueryableStorageEntry; + /** + * The current members of the collective. This is stored sorted (just by value). + **/ + members: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The member who provides the default vote for any other members that do not vote before + * the timeout. If None, then no member has that privilege. + **/ + prime: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Proposals so far. + **/ + proposalCount: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Actual proposal for a given hash, if it's current. + **/ + proposalOf: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The hashes of the active proposals. + **/ + proposals: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Votes on a given proposal, if it is ongoing. + **/ + voting: AugmentedQuery Observable>> & QueryableStorageEntry; + }; + democracy: { + [index: string]: QueryableStorageEntry; + /** + * 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. + **/ + blacklist: AugmentedQuery Observable]>>>> & QueryableStorageEntry; + /** + * Record of all proposals that have been subject to emergency cancellation. + **/ + cancellations: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Get the account (and lock periods) to which another account is delegating vote. + **/ + delegations: AugmentedQuery Observable, Linkage]>>> & QueryableStorageEntry; + /** + * Those who have locked a deposit. + **/ + depositOf: AugmentedQuery Observable]>>>> & QueryableStorageEntry; + /** + * Queue of successful referenda to be dispatched. Stored ordered by block number. + **/ + dispatchQueue: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * True if the last referendum tabled was submitted externally. False if it was a public + * proposal. + **/ + lastTabledWasExternal: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Accounts for which there are locks in action which may be removed at some point in the + * future. The value is the block number at which the lock expires and may be removed. + **/ + locks: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The lowest referendum index representing an unbaked referendum. Equal to + * `ReferendumCount` if there isn't a unbaked referendum. + **/ + lowestUnbaked: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The referendum to be tabled whenever it would be valid to table an external proposal. + * This happens when a referendum needs to be tabled and one of two conditions are met: + * - `LastTabledWasExternal` is `false`; or + * - `PublicProps` is empty. + **/ + nextExternal: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * Map of hashes to the proposal preimage, along with who registered it and their deposit. + * The block number is the block at which it was deposited. + **/ + preimages: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * Who is able to vote for whom. Value is the fund-holding account, key is the + * vote-transaction-sending account. + **/ + proxy: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The number of (public) proposals that have been made so far. + **/ + publicPropCount: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The public proposals. Unsorted. The second item is the proposal's hash. + **/ + publicProps: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * The next free referendum index, aka the number of referenda started so far. + **/ + referendumCount: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Information concerning any given referendum. + **/ + referendumInfoOf: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Get the vote in a given referendum of a particular voter. The result is meaningful only + * if `voters_for` includes the voter when called with the referendum (you'll get the + * default `Vote` value otherwise). If you don't want to check `voters_for`, then you can + * also check for simple existence with `VoteOf::contains_key` first. + **/ + voteOf: AugmentedQuery | [ReferendumIndex | AnyNumber | Uint8Array, AccountId | string | Uint8Array]) => Observable> & QueryableStorageEntry; + /** + * Get the voters for the current proposal. + **/ + votersFor: AugmentedQuery Observable>> & QueryableStorageEntry; + }; + elections: { + [index: string]: QueryableStorageEntry; + /** + * The present candidate list. Sorted based on account-id. A current member or a runner can + * never enter this vector and is always implicitly assumed to be a candidate. + **/ + candidates: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The total number of vote rounds that have happened, excluding the upcoming one. + **/ + electionRounds: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The current elected membership. Sorted based on account id. + **/ + members: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * The current runners_up. Sorted based on low to high merit (worse to best runner). + **/ + runnersUp: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * Locked stake of a voter. + **/ + stakeOf: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Votes of a particular voter, with the round index of the votes. + **/ + votesOf: AugmentedQuery Observable, Linkage]>>> & QueryableStorageEntry; + }; + grandpa: { + [index: string]: QueryableStorageEntry; + /** + * DEPRECATED + * This used to store the current authority set, which has been migrated to the well-known + * GRANDPA_AUTHORITIES_KEY unhashed key. + **/ + authorities: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The number of changes (both in terms of keys and underlying economic responsibilities) + * in the "set" of Grandpa validators from genesis. + **/ + currentSetId: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * next block number where we can force a change. + **/ + nextForced: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Pending change: (signaled at, scheduled change). + **/ + pendingChange: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible. + **/ + setIdSession: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * `true` if we are currently stalled. + **/ + stalled: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * State of the current authority set. + **/ + state: AugmentedQuery Observable> & QueryableStorageEntry; + }; + identity: { + [index: string]: QueryableStorageEntry; + /** + * Information that is pertinent to identify the entity behind an account. + **/ + identityOf: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The set of registrars. Not expected to get very big as can only be added through a + * special origin (likely a council motion). + * The index into this can be cast to `RegistrarIndex` to get a valid value. + **/ + registrars: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * Alternative "sub" identities of this account. + * The first item is the deposit, the second is a vector of the accounts. + **/ + subsOf: AugmentedQuery Observable]>>> & QueryableStorageEntry; + /** + * The super-identity of an alternative "sub" identity together with its name, within that + * context. If the account is not some other account's sub-identity, then just `None`. + **/ + superOf: AugmentedQuery Observable>>> & QueryableStorageEntry; + }; + imOnline: { + [index: string]: QueryableStorageEntry; + /** + * For each session index, we keep a mapping of `T::ValidatorId` to the + * number of blocks authored by the given authority. + **/ + authoredBlocks: AugmentedQueryDoubleMap Observable> & QueryableStorageEntry; + /** + * The block number after which it's ok to send heartbeats in current session. + * At the beginning of each session we set this to a value that should + * fall roughly in the middle of the session duration. + * The idea is to first wait for the validators to produce a block + * in the current session, so that the heartbeat later on will not be necessary. + **/ + heartbeatAfter: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The current set of keys that may issue a heartbeat. + **/ + keys: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * For each session index, we keep a mapping of `AuthIndex` + * to `offchain::OpaqueNetworkState`. + **/ + receivedHeartbeats: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; + }; + indices: { + [index: string]: QueryableStorageEntry; + /** + * The lookup from index to account. + **/ + accounts: AugmentedQuery Observable>>> & QueryableStorageEntry; + }; + offences: { + [index: string]: QueryableStorageEntry; + /** + * A vector of reports of the same kind that happened at the same time slot. + **/ + concurrentReportsIndex: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; + /** + * The primary structure that holds all offence records keyed by report identifiers. + **/ + reports: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Enumerates all reports of a kind along with the time they happened. + * All reports are sorted by the time of offence. + * Note that the actual type of this mapping is `Vec`, this is because values of + * different types are not supported at the moment so we are doing the manual serialization. + **/ + reportsByKindIndex: AugmentedQuery Observable> & QueryableStorageEntry; + }; + randomnessCollectiveFlip: { + [index: string]: QueryableStorageEntry; + /** + * 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 + * the oldest hash. + **/ + randomMaterial: AugmentedQuery Observable>> & QueryableStorageEntry; + }; + recovery: { + [index: string]: QueryableStorageEntry; + /** + * Active recovery attempts. + * First account is the account to be recovered, and the second account + * is the user trying to recover the account. + **/ + activeRecoveries: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; + /** + * The list of allowed proxy accounts. + * Map from the user who can access it to the recovered account. + **/ + proxy: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The set of recoverable accounts and their recovery configuration. + **/ + recoverable: AugmentedQuery Observable>> & QueryableStorageEntry; + }; + session: { + [index: string]: QueryableStorageEntry; + /** + * Current index of the session. + **/ + currentIndex: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Indices of disabled validators. + * The set is cleared when `on_session_ending` returns a new set of identities. + **/ + disabledValidators: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The owner of a key. The second key is the `KeyTypeId` + the encoded key. + * The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of + * the trie. Having all data in the same branch should prevent slowing down other queries. + **/ + keyOwner: AugmentedQueryDoubleMap | [KeyTypeId | AnyNumber | Uint8Array, Bytes | string | Uint8Array]) => Observable>> & QueryableStorageEntry; + /** + * The next session keys for a validator. + * The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of + * the trie. Having all data in the same branch should prevent slowing down other queries. + **/ + nextKeys: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; + /** + * True if the underlying economic identities or weighting behind the validators + * has changed in the queued validator set. + **/ + queuedChanged: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The queued keys for the next session. When the next session begins, these keys + * will be used to determine the validator's session keys. + **/ + queuedKeys: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * The current set of validators. + **/ + validators: AugmentedQuery Observable>> & QueryableStorageEntry; + }; + society: { + [index: string]: QueryableStorageEntry; + /** + * The current bids, stored ordered by the value of the bid. + **/ + bids: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The current set of candidates; bidders that are attempting to become members. + **/ + candidates: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The defending member currently being challenged. + **/ + defender: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Votes for the defender. + **/ + defenderVotes: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The first member. + **/ + founder: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The most primary from the most recently approved members. + **/ + head: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The max number of members for the society at one time. + **/ + maxMembers: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The current set of members, ordered. + **/ + members: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Pending payouts; ordered by block number, with the amount that should be paid out. + **/ + payouts: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * Amount of our account balance that is specifically for the next round's bid(s). + **/ + pot: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * A hash of the rules of this society concerning membership. Can only be set once and + * only by the founder. + **/ + rules: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The ongoing number of losing votes cast by the member. + **/ + strikes: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The set of suspended candidates. + **/ + suspendedCandidates: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * The set of suspended members. + **/ + suspendedMembers: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Double map from Candidate -> Voter -> (Maybe) Vote. + **/ + votes: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; + /** + * Members currently vouching or banned from vouching again + **/ + vouching: AugmentedQuery Observable>> & QueryableStorageEntry; }; staking: { [index: string]: QueryableStorageEntry; - /** - * Number of era to keep in history. - * Information is kept for eras in `[current_era - history_depth; current_era] - * Must be more than the number of era delayed by session otherwise. - * i.e. active era must always be in history. - * i.e. `active_era > current_era - history_depth` must be guaranteed. - **/ - historyDepth: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The ideal number of staking participants. - **/ - validatorCount: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Minimum number of staking participants before emergency conditions are imposed. - **/ - minimumValidatorCount: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Any validators that may never be slashed or forcibly kicked. It's a Vec since they're - * easy to initialize and the performance hit is minimal (we expect no more than four - * invulnerables) and restricted to testnets. - **/ - invulnerables: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Map from all locked "stash" accounts to the controller account. - **/ - bonded: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Map from all (unlocked) "controller" accounts to the info regarding the staking. - **/ - ledger: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Where the reward payment should be made. Keyed by stash. - **/ - payee: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The map from (wannabe) validator stash key to the preferences of that validator. - **/ - validators: AugmentedQuery Observable]>>> & QueryableStorageEntry; - /** - * The map from nominator stash key to the set of stash keys of all validators to nominate. - **/ - nominators: AugmentedQuery Observable]>>>> & QueryableStorageEntry; - /** - * The current era index. - * This is the latest planned era, depending on how session module queues the validator - * set, it might be active or not. - **/ - currentEra: AugmentedQuery Observable>> & QueryableStorageEntry; /** * The active era information, it holds index and start. * The active era is the era currently rewarded. @@ -273,9 +540,35 @@ declare module '@polkadot/api/types/storage' { **/ activeEra: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * The session index at which the era start for the last `HISTORY_DEPTH` eras + * Map from all locked "stash" accounts to the controller account. **/ - erasStartSessionIndex: AugmentedQuery Observable>> & QueryableStorageEntry; + bonded: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * A mapping from still-bonded eras to the first session index of that era. + * Must contains information for eras for the range: + * `[active_era - bounding_duration; active_era]` + **/ + bondedEras: AugmentedQuery Observable>>> & QueryableStorageEntry; + /** + * The amount of currency given to reporters of a slash event which was + * canceled by extraordinary circumstances (e.g. governance). + **/ + canceledSlashPayout: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The current era index. + * This is the latest planned era, depending on how session module queues the validator + * set, it might be active or not. + **/ + currentEra: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The earliest era for which we have a pending, unapplied slash. + **/ + earliestUnappliedSlash: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Rewards for the last `HISTORY_DEPTH` eras. + * If reward hasn't been set or has been removed then 0 reward is returned. + **/ + erasRewardPoints: AugmentedQuery Observable> & QueryableStorageEntry; /** * Exposure of validator at era. * This is keyed first by the era index to allow bulk deletion and then the stash account. @@ -293,6 +586,15 @@ declare module '@polkadot/api/types/storage' { * If stakers hasn't been set or has been removed then empty exposure is returned. **/ erasStakersClipped: AugmentedQueryDoubleMap Observable> & QueryableStorageEntry; + /** + * The session index at which the era start for the last `HISTORY_DEPTH` eras + **/ + erasStartSessionIndex: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The total amount staked for the last `HISTORY_DEPTH` eras. + * If total hasn't been set or has been removed then 0 stake is returned. + **/ + erasTotalStake: AugmentedQuery Observable> & QueryableStorageEntry; /** * Similarly to `ErasStakers` this holds the preferences of validators. * This is keyed fist by the era index to allow bulk deletion and then the stash account. @@ -304,235 +606,156 @@ declare module '@polkadot/api/types/storage' { * Eras that haven't finished yet or has been removed doesn't have reward. **/ erasValidatorReward: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Rewards for the last `HISTORY_DEPTH` eras. - * If reward hasn't been set or has been removed then 0 reward is returned. - **/ - erasRewardPoints: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The total amount staked for the last `HISTORY_DEPTH` eras. - * If total hasn't been set or has been removed then 0 stake is returned. - **/ - erasTotalStake: AugmentedQuery Observable> & QueryableStorageEntry; /** * True if the next session change will be a new era regardless of index. **/ forceEra: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Number of era to keep in history. + * Information is kept for eras in `[current_era - history_depth; current_era] + * Must be more than the number of era delayed by session otherwise. + * i.e. active era must always be in history. + * i.e. `active_era > current_era - history_depth` must be guaranteed. + **/ + historyDepth: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Any validators that may never be slashed or forcibly kicked. It's a Vec since they're + * easy to initialize and the performance hit is minimal (we expect no more than four + * invulnerables) and restricted to testnets. + **/ + invulnerables: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Map from all (unlocked) "controller" accounts to the info regarding the staking. + **/ + ledger: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * Minimum number of staking participants before emergency conditions are imposed. + **/ + minimumValidatorCount: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The map from nominator stash key to the set of stash keys of all validators to nominate. + **/ + nominators: AugmentedQuery Observable, Linkage]>>> & QueryableStorageEntry; + /** + * All slashing events on nominators, mapped by era to the highest slash value of the era. + **/ + nominatorSlashInEra: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; + /** + * Where the reward payment should be made. Keyed by stash. + **/ + payee: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * Slashing spans for stash accounts. + **/ + slashingSpans: AugmentedQuery Observable>> & QueryableStorageEntry; /** * The percentage of the slash that is distributed to reporters. * The rest of the slashed value is handled by the `Slash`. **/ slashRewardFraction: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The amount of currency given to reporters of a slash event which was - * canceled by extraordinary circumstances (e.g. governance). - **/ - canceledSlashPayout: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * All unapplied slashes that are queued for later. - **/ - unappliedSlashes: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * A mapping from still-bonded eras to the first session index of that era. - * Must contains information for eras for the range: - * `[active_era - bounding_duration; active_era]` - **/ - bondedEras: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * All slashing events on validators, mapped by era to the highest slash proportion - * and slash value of the era. - **/ - validatorSlashInEra: AugmentedQueryDoubleMap Observable>>> & QueryableStorageEntry; - /** - * All slashing events on nominators, mapped by era to the highest slash value of the era. - **/ - nominatorSlashInEra: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; - /** - * Slashing spans for stash accounts. - **/ - slashingSpans: AugmentedQuery Observable>> & QueryableStorageEntry; /** * Records information about the maximum slash of a stash within a slashing span, * as well as how much reward has been paid out. **/ spanSlash: AugmentedQuery | [AccountId | string | Uint8Array, SpanIndex | AnyNumber | Uint8Array]) => Observable> & QueryableStorageEntry; - /** - * The earliest era for which we have a pending, unapplied slash. - **/ - earliestUnappliedSlash: AugmentedQuery Observable>> & QueryableStorageEntry; /** * Storage version of the pallet. * This is set to v2.0.0 for new networks. **/ storageVersion: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * All unapplied slashes that are queued for later. + **/ + unappliedSlashes: AugmentedQuery Observable>> & QueryableStorageEntry; + /** + * The ideal number of staking participants. + **/ + validatorCount: AugmentedQuery Observable> & QueryableStorageEntry; + /** + * The map from (wannabe) validator stash key to the preferences of that validator. + **/ + validators: AugmentedQuery Observable]>>> & QueryableStorageEntry; + /** + * All slashing events on validators, mapped by era to the highest slash proportion + * and slash value of the era. + **/ + validatorSlashInEra: AugmentedQueryDoubleMap Observable>>> & QueryableStorageEntry; }; - session: { + sudo: { [index: string]: QueryableStorageEntry; /** - * The current set of validators. + * The `AccountId` of the sudo key. **/ - validators: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Current index of the session. - **/ - currentIndex: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * True if the underlying economic identities or weighting behind the validators - * has changed in the queued validator set. - **/ - queuedChanged: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The queued keys for the next session. When the next session begins, these keys - * will be used to determine the validator's session keys. - **/ - queuedKeys: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * Indices of disabled validators. - * The set is cleared when `on_session_ending` returns a new set of identities. - **/ - disabledValidators: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The next session keys for a validator. - * The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of - * the trie. Having all data in the same branch should prevent slowing down other queries. - **/ - nextKeys: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; - /** - * The owner of a key. The second key is the `KeyTypeId` + the encoded key. - * The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of - * the trie. Having all data in the same branch should prevent slowing down other queries. - **/ - keyOwner: AugmentedQueryDoubleMap | [KeyTypeId | AnyNumber | Uint8Array, Bytes | string | Uint8Array]) => Observable>> & QueryableStorageEntry; + key: AugmentedQuery Observable> & QueryableStorageEntry; }; - democracy: { + system: { [index: string]: QueryableStorageEntry; /** - * The number of (public) proposals that have been made so far. + * The full account information for a particular account ID. **/ - publicPropCount: AugmentedQuery Observable> & QueryableStorageEntry; + account: AugmentedQuery Observable> & QueryableStorageEntry; /** - * The public proposals. Unsorted. The second item is the proposal's hash. + * Total length (in bytes) for all extrinsics put together, for the current block. **/ - publicProps: AugmentedQuery Observable>>> & QueryableStorageEntry; + allExtrinsicsLen: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * Map of hashes to the proposal preimage, along with who registered it and their deposit. - * The block number is the block at which it was deposited. + * Total weight for all extrinsics put together, for the current block. **/ - preimages: AugmentedQuery Observable>>> & QueryableStorageEntry; + allExtrinsicsWeight: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * Those who have locked a deposit. + * Map of block numbers to block hashes. **/ - depositOf: AugmentedQuery Observable]>>>> & QueryableStorageEntry; + blockHash: AugmentedQuery Observable> & QueryableStorageEntry; /** - * The next free referendum index, aka the number of referenda started so far. + * Digest of the current block, also part of the block header. **/ - referendumCount: AugmentedQuery Observable> & QueryableStorageEntry; + digest: AugmentedQuery Observable> & QueryableStorageEntry; /** - * The lowest referendum index representing an unbaked referendum. Equal to - * `ReferendumCount` if there isn't a unbaked referendum. + * The number of events in the `Events` list. **/ - lowestUnbaked: AugmentedQuery Observable> & QueryableStorageEntry; + eventCount: AugmentedQuery Observable> & QueryableStorageEntry; /** - * Information concerning any given referendum. + * Events deposited for the current block. **/ - referendumInfoOf: AugmentedQuery Observable>> & QueryableStorageEntry; + events: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * Queue of successful referenda to be dispatched. Stored ordered by block number. + * Mapping between a topic (represented by T::Hash) and a vector of indexes + * of events in the `>` list. + * All topic vectors have deterministic storage locations depending on the topic. This + * allows light-clients to leverage the changes trie storage tracking mechanism and + * in case of changes fetch the list of events of interest. + * The value has the type `(T::BlockNumber, EventIndex)` because if we used only just + * the `EventIndex` then in case if the topic has the same contents on the next block + * no notification will be triggered thus the event might be lost. **/ - dispatchQueue: AugmentedQuery Observable>>> & QueryableStorageEntry; + eventTopics: AugmentedQuery Observable>>> & QueryableStorageEntry; /** - * Get the voters for the current proposal. + * Total extrinsics count for the current block. **/ - votersFor: AugmentedQuery Observable>> & QueryableStorageEntry; + extrinsicCount: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * Get the vote in a given referendum of a particular voter. The result is meaningful only - * if `voters_for` includes the voter when called with the referendum (you'll get the - * default `Vote` value otherwise). If you don't want to check `voters_for`, then you can - * also check for simple existence with `VoteOf::contains_key` first. + * Extrinsics data for the current block (maps an extrinsic's index to its data). **/ - voteOf: AugmentedQuery | [ReferendumIndex | AnyNumber | Uint8Array, AccountId | string | Uint8Array]) => Observable> & QueryableStorageEntry; + extrinsicData: AugmentedQuery Observable> & QueryableStorageEntry; /** - * Who is able to vote for whom. Value is the fund-holding account, key is the - * vote-transaction-sending account. + * Extrinsics root of the current block, also part of the block header. **/ - proxy: AugmentedQuery Observable>> & QueryableStorageEntry; + extrinsicsRoot: AugmentedQuery Observable> & QueryableStorageEntry; /** - * Get the account (and lock periods) to which another account is delegating vote. + * The current block number being processed. Set by `execute_block`. **/ - delegations: AugmentedQuery Observable, Linkage]>>> & QueryableStorageEntry; + number: AugmentedQuery Observable> & QueryableStorageEntry; /** - * Accounts for which there are locks in action which may be removed at some point in the - * future. The value is the block number at which the lock expires and may be removed. + * Hash of the previous block. **/ - locks: AugmentedQuery Observable>> & QueryableStorageEntry; + parentHash: AugmentedQuery Observable> & QueryableStorageEntry; /** - * True if the last referendum tabled was submitted externally. False if it was a public - * proposal. + * A bool to track if the runtime was upgraded last block. **/ - lastTabledWasExternal: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The referendum to be tabled whenever it would be valid to table an external proposal. - * This happens when a referendum needs to be tabled and one of two conditions are met: - * - `LastTabledWasExternal` is `false`; or - * - `PublicProps` is empty. - **/ - nextExternal: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * 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. - **/ - blacklist: AugmentedQuery Observable]>>>> & QueryableStorageEntry; - /** - * Record of all proposals that have been subject to emergency cancellation. - **/ - cancellations: AugmentedQuery Observable> & QueryableStorageEntry; - }; - council: { - [index: string]: QueryableStorageEntry; - /** - * The hashes of the active proposals. - **/ - proposals: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Actual proposal for a given hash, if it's current. - **/ - proposalOf: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Votes on a given proposal, if it is ongoing. - **/ - voting: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Proposals so far. - **/ - proposalCount: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The current members of the collective. This is stored sorted (just by value). - **/ - members: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The member who provides the default vote for any other members that do not vote before - * the timeout. If None, then no member has that privilege. - **/ - prime: AugmentedQuery Observable>> & QueryableStorageEntry; + runtimeUpgraded: AugmentedQuery Observable> & QueryableStorageEntry; }; technicalCommittee: { [index: string]: QueryableStorageEntry; - /** - * The hashes of the active proposals. - **/ - proposals: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Actual proposal for a given hash, if it's current. - **/ - proposalOf: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Votes on a given proposal, if it is ongoing. - **/ - voting: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Proposals so far. - **/ - proposalCount: AugmentedQuery Observable> & QueryableStorageEntry; /** * The current members of the collective. This is stored sorted (just by value). **/ @@ -542,34 +765,22 @@ declare module '@polkadot/api/types/storage' { * the timeout. If None, then no member has that privilege. **/ prime: AugmentedQuery Observable>> & QueryableStorageEntry; - }; - elections: { - [index: string]: QueryableStorageEntry; /** - * The current elected membership. Sorted based on account id. + * Proposals so far. **/ - members: AugmentedQuery Observable>>> & QueryableStorageEntry; + proposalCount: AugmentedQuery Observable> & QueryableStorageEntry; /** - * The current runners_up. Sorted based on low to high merit (worse to best runner). + * Actual proposal for a given hash, if it's current. **/ - runnersUp: AugmentedQuery Observable>>> & QueryableStorageEntry; + proposalOf: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * The total number of vote rounds that have happened, excluding the upcoming one. + * The hashes of the active proposals. **/ - electionRounds: AugmentedQuery Observable> & QueryableStorageEntry; + proposals: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * Votes of a particular voter, with the round index of the votes. + * Votes on a given proposal, if it is ongoing. **/ - votesOf: AugmentedQuery Observable, Linkage]>>> & QueryableStorageEntry; - /** - * Locked stake of a voter. - **/ - stakeOf: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The present candidate list. Sorted based on account-id. A current member or a runner can - * never enter this vector and is always implicitly assumed to be a candidate. - **/ - candidates: AugmentedQuery Observable>> & QueryableStorageEntry; + voting: AugmentedQuery Observable>> & QueryableStorageEntry; }; technicalMembership: { [index: string]: QueryableStorageEntry; @@ -582,42 +793,27 @@ declare module '@polkadot/api/types/storage' { **/ prime: AugmentedQuery Observable>> & QueryableStorageEntry; }; - grandpa: { + timestamp: { [index: string]: QueryableStorageEntry; /** - * DEPRECATED - * This used to store the current authority set, which has been migrated to the well-known - * GRANDPA_AUTHORITIES_KEY unhashed key. + * Did the timestamp get updated in this block? **/ - authorities: AugmentedQuery Observable> & QueryableStorageEntry; + didUpdate: AugmentedQuery Observable> & QueryableStorageEntry; /** - * State of the current authority set. + * Current time for the current block. **/ - state: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Pending change: (signaled at, scheduled change). - **/ - pendingChange: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * next block number where we can force a change. - **/ - nextForced: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * `true` if we are currently stalled. - **/ - stalled: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * The number of changes (both in terms of keys and underlying economic responsibilities) - * in the "set" of Grandpa validators from genesis. - **/ - currentSetId: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible. - **/ - setIdSession: AugmentedQuery Observable>> & QueryableStorageEntry; + now: AugmentedQuery Observable> & QueryableStorageEntry; + }; + transactionPayment: { + [index: string]: QueryableStorageEntry; + nextFeeMultiplier: AugmentedQuery Observable> & QueryableStorageEntry; }; treasury: { [index: string]: QueryableStorageEntry; + /** + * Proposal indices that have been approved but not yet awarded. + **/ + approvals: AugmentedQuery Observable>> & QueryableStorageEntry; /** * Number of proposals that have been made. **/ @@ -627,219 +823,23 @@ declare module '@polkadot/api/types/storage' { **/ proposals: AugmentedQuery Observable>> & QueryableStorageEntry; /** - * Proposal indices that have been approved but not yet awarded. + * Simple preimage lookup from the reason's hash to the original data. Again, has an + * insecure enumerable hash since the key is guaranteed to be the result of a secure hash. **/ - approvals: AugmentedQuery Observable>> & QueryableStorageEntry; + reasons: AugmentedQuery Observable>> & QueryableStorageEntry; /** * Tips that are not yet completed. Keyed by the hash of `(reason, who)` from the value. * This has the insecure enumerable hash function since the key itself is already * guaranteed to be a secure hash. **/ tips: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Simple preimage lookup from the reason's hash to the original data. Again, has an - * insecure enumerable hash since the key is guaranteed to be the result of a secure hash. - **/ - reasons: AugmentedQuery Observable>> & QueryableStorageEntry; }; - contracts: { + utility: { [index: string]: QueryableStorageEntry; /** - * Gas spent so far in this block. + * The set of open multisig operations. **/ - gasSpent: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Current cost schedule for contracts. - **/ - currentSchedule: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * A mapping from an original code hash to the original code, untouched by instrumentation. - **/ - pristineCode: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * A mapping between an original code hash and instrumented wasm code, ready for execution. - **/ - codeStorage: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The subtrie counter. - **/ - accountCounter: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The code associated with a given account. - **/ - contractInfoOf: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The price of one unit of gas. - **/ - gasPrice: AugmentedQuery Observable> & QueryableStorageEntry; - }; - sudo: { - [index: string]: QueryableStorageEntry; - /** - * The `AccountId` of the sudo key. - **/ - key: AugmentedQuery Observable> & QueryableStorageEntry; - }; - imOnline: { - [index: string]: QueryableStorageEntry; - /** - * The block number after which it's ok to send heartbeats in current session. - * At the beginning of each session we set this to a value that should - * fall roughly in the middle of the session duration. - * The idea is to first wait for the validators to produce a block - * in the current session, so that the heartbeat later on will not be necessary. - **/ - heartbeatAfter: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The current set of keys that may issue a heartbeat. - **/ - keys: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * For each session index, we keep a mapping of `AuthIndex` - * to `offchain::OpaqueNetworkState`. - **/ - receivedHeartbeats: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; - /** - * For each session index, we keep a mapping of `T::ValidatorId` to the - * number of blocks authored by the given authority. - **/ - authoredBlocks: AugmentedQueryDoubleMap Observable> & QueryableStorageEntry; - }; - offences: { - [index: string]: QueryableStorageEntry; - /** - * The primary structure that holds all offence records keyed by report identifiers. - **/ - reports: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * A vector of reports of the same kind that happened at the same time slot. - **/ - concurrentReportsIndex: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; - /** - * Enumerates all reports of a kind along with the time they happened. - * All reports are sorted by the time of offence. - * Note that the actual type of this mapping is `Vec`, this is because values of - * different types are not supported at the moment so we are doing the manual serialization. - **/ - reportsByKindIndex: AugmentedQuery Observable> & QueryableStorageEntry; - }; - randomnessCollectiveFlip: { - [index: string]: QueryableStorageEntry; - /** - * 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 - * the oldest hash. - **/ - randomMaterial: AugmentedQuery Observable>> & QueryableStorageEntry; - }; - identity: { - [index: string]: QueryableStorageEntry; - /** - * Information that is pertinent to identify the entity behind an account. - **/ - identityOf: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The super-identity of an alternative "sub" identity together with its name, within that - * context. If the account is not some other account's sub-identity, then just `None`. - **/ - superOf: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * Alternative "sub" identities of this account. - * The first item is the deposit, the second is a vector of the accounts. - **/ - subsOf: AugmentedQuery Observable]>>> & QueryableStorageEntry; - /** - * The set of registrars. Not expected to get very big as can only be added through a - * special origin (likely a council motion). - * The index into this can be cast to `RegistrarIndex` to get a valid value. - **/ - registrars: AugmentedQuery Observable>>> & QueryableStorageEntry; - }; - society: { - [index: string]: QueryableStorageEntry; - /** - * The first member. - **/ - founder: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * A hash of the rules of this society concerning membership. Can only be set once and - * only by the founder. - **/ - rules: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The current set of candidates; bidders that are attempting to become members. - **/ - candidates: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The set of suspended candidates. - **/ - suspendedCandidates: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * Amount of our account balance that is specifically for the next round's bid(s). - **/ - pot: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The most primary from the most recently approved members. - **/ - head: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The current set of members, ordered. - **/ - members: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The set of suspended members. - **/ - suspendedMembers: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * The current bids, stored ordered by the value of the bid. - **/ - bids: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Members currently vouching or banned from vouching again - **/ - vouching: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Pending payouts; ordered by block number, with the amount that should be paid out. - **/ - payouts: AugmentedQuery Observable>>> & QueryableStorageEntry; - /** - * The ongoing number of losing votes cast by the member. - **/ - strikes: AugmentedQuery Observable> & QueryableStorageEntry; - /** - * Double map from Candidate -> Voter -> (Maybe) Vote. - **/ - votes: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; - /** - * The defending member currently being challenged. - **/ - defender: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Votes for the defender. - **/ - defenderVotes: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * The max number of members for the society at one time. - **/ - maxMembers: AugmentedQuery Observable> & QueryableStorageEntry; - }; - recovery: { - [index: string]: QueryableStorageEntry; - /** - * The set of recoverable accounts and their recovery configuration. - **/ - recoverable: AugmentedQuery Observable>> & QueryableStorageEntry; - /** - * Active recovery attempts. - * First account is the account to be recovered, and the second account - * is the user trying to recover the account. - **/ - activeRecoveries: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; - /** - * The list of allowed proxy accounts. - * Map from the user who can access it to the recovered account. - **/ - proxy: AugmentedQuery Observable>> & QueryableStorageEntry; + multisigs: AugmentedQueryDoubleMap Observable>> & QueryableStorageEntry; }; vesting: { [index: string]: QueryableStorageEntry; diff --git a/packages/api/src/augment/tx.ts b/packages/api/src/augment/tx.ts index d9fc522925..80a15bd31a 100644 --- a/packages/api/src/augment/tx.ts +++ b/packages/api/src/augment/tx.ts @@ -22,178 +22,6 @@ import { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types'; declare module '@polkadot/api/types/submittable' { export interface AugmentedSubmittables { - system: { - [index: string]: SubmittableExtrinsicFunction; - /** - * A dispatch that will fill the block weight up to the given ratio. - **/ - fillBlock: AugmentedSubmittable<(ratio: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Make some on-chain remark. - **/ - remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the number of pages in the WebAssembly environment's heap. - **/ - setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the new runtime code. - **/ - setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the new runtime code without doing any checks of the given `code`. - **/ - setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the new changes trie configuration. - **/ - setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Set some items of storage. - **/ - setStorage: AugmentedSubmittable<(items: Vec | (KeyValue)[]) => SubmittableExtrinsic>; - /** - * Kill some items from storage. - **/ - killStorage: AugmentedSubmittable<(keys: Vec | (Key | string | Uint8Array)[]) => SubmittableExtrinsic>; - /** - * Kill all storage items with a key that starts with the given prefix. - **/ - killPrefix: AugmentedSubmittable<(prefix: Key | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Kill the sending account, assuming there are no references outstanding and the composite - * data is equal to its default value. - **/ - suicide: AugmentedSubmittable<() => SubmittableExtrinsic>; - }; - utility: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Send a batch of dispatch calls. - * This will execute until the first one fails and then stop. - * May be called from any origin. - * - `calls`: The calls to be dispatched from the same origin. - * # - * - The sum of the weights of the `calls`. - * - One event. - * # - * This will return `Ok` in all circumstances. To determine the success of the batch, an - * event is deposited. If a call failed and the batch was interrupted, then the - * `BatchInterrupted` event is deposited, along with the number of successful calls made - * and the error of the failed call. If all were successful, then the `BatchCompleted` - * event is deposited. - **/ - batch: AugmentedSubmittable<(calls: Vec | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic>; - /** - * Send a call through an indexed pseudonym of the sender. - * The dispatch origin for this call must be _Signed_. - * # - * - The weight of the `call` + 10,000. - * # - **/ - asSub: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Register approval for a dispatch to be made from a deterministic composite account if - * approved by a total of `threshold - 1` of `other_signatories`. - * If there are enough, then dispatch the call. - * Payment: `MultisigDepositBase` will be reserved if this is the first approval, plus - * `threshold` times `MultisigDepositFactor`. It is returned once this dispatch happens or - * is cancelled. - * The dispatch origin for this call must be _Signed_. - * - `threshold`: The total number of approvals for this dispatch before it is executed. - * - `other_signatories`: The accounts (other than the sender) who can approve this - * dispatch. May not be empty. - * - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is - * not the first approval, then it must be `Some`, with the timepoint (block number and - * transaction index) of the first approval transaction. - * - `call`: The call to be executed. - * NOTE: Unless this is the final approval, you will generally want to use - * `approve_as_multi` instead, since it only requires a hash of the call. - * Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise - * on success, result is `Ok` and the result from the interior call, if it was executed, - * may be found in the deposited `MultisigExecuted` event. - * # - * - `O(S + Z + Call)`. - * - Up to one balance-reserve or unreserve operation. - * - One passthrough operation, one insert, both `O(S)` where `S` is the number of - * signatories. `S` is capped by `MaxSignatories`, with weight being proportional. - * - One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len. - * - One encode & hash, both of complexity `O(S)`. - * - Up to one binary search and insert (`O(logS + S)`). - * - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. - * - One event. - * - The weight of the `call`. - * - Storage: inserts one item, value size bounded by `MaxSignatories`, with a - * deposit taken for its lifetime of - * `MultisigDepositBase + threshold * MultisigDepositFactor`. - * # - **/ - asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec | (AccountId | string | Uint8Array)[], maybeTimepoint: Option | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Register approval for a dispatch to be made from a deterministic composite account if - * approved by a total of `threshold - 1` of `other_signatories`. - * Payment: `MultisigDepositBase` will be reserved if this is the first approval, plus - * `threshold` times `MultisigDepositFactor`. It is returned once this dispatch happens or - * is cancelled. - * The dispatch origin for this call must be _Signed_. - * - `threshold`: The total number of approvals for this dispatch before it is executed. - * - `other_signatories`: The accounts (other than the sender) who can approve this - * dispatch. May not be empty. - * - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is - * not the first approval, then it must be `Some`, with the timepoint (block number and - * transaction index) of the first approval transaction. - * - `call_hash`: The hash of the call to be executed. - * NOTE: If this is the final approval, you will want to use `as_multi` instead. - * # - * - `O(S)`. - * - Up to one balance-reserve or unreserve operation. - * - One passthrough operation, one insert, both `O(S)` where `S` is the number of - * signatories. `S` is capped by `MaxSignatories`, with weight being proportional. - * - One encode & hash, both of complexity `O(S)`. - * - Up to one binary search and insert (`O(logS + S)`). - * - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. - * - One event. - * - Storage: inserts one item, value size bounded by `MaxSignatories`, with a - * deposit taken for its lifetime of - * `MultisigDepositBase + threshold * MultisigDepositFactor`. - * # - **/ - approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec | (AccountId | string | Uint8Array)[], maybeTimepoint: Option | null | object | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously - * for this operation will be unreserved on success. - * The dispatch origin for this call must be _Signed_. - * - `threshold`: The total number of approvals for this dispatch before it is executed. - * - `other_signatories`: The accounts (other than the sender) who can approve this - * dispatch. May not be empty. - * - `timepoint`: The timepoint (block number and transaction index) of the first approval - * transaction for this dispatch. - * - `call_hash`: The hash of the call to be executed. - * # - * - `O(S)`. - * - Up to one balance-reserve or unreserve operation. - * - One passthrough operation, one insert, both `O(S)` where `S` is the number of - * signatories. `S` is capped by `MaxSignatories`, with weight being proportional. - * - One encode & hash, both of complexity `O(S)`. - * - One event. - * - I/O: 1 read `O(S)`, one remove. - * - Storage: removes one item. - * # - **/ - cancelAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec | (AccountId | string | Uint8Array)[], timepoint: Timepoint | { height?: any; index?: any } | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic>; - }; - timestamp: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Set the current time. - * This call should be invoked exactly once per block. It will panic at the finalization - * phase, if this call hasn't been invoked by that time. - * The timestamp should be greater than the previous one by the amount specified by - * `MinimumPeriod`. - * The dispatch origin for this call must be `Inherent`. - **/ - set: AugmentedSubmittable<(now: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - }; authorship: { [index: string]: SubmittableExtrinsicFunction; /** @@ -201,69 +29,26 @@ declare module '@polkadot/api/types/submittable' { **/ setUncles: AugmentedSubmittable<(newUncles: Vec
| (Header | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic>; }; - indices: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Assign an previously unassigned index. - * Payment: `Deposit` is reserved from the sender account. - * The dispatch origin for this call must be _Signed_. - * - `index`: the index to be claimed. This must not be in use. - * Emits `IndexAssigned` if successful. - * # - * - `O(1)`. - * - One storage mutation (codec `O(1)`). - * - One reserve operation. - * - One event. - * # - **/ - claim: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Assign an index already owned by the sender to another account. The balance reservation - * is effectively transferred to the new account. - * The dispatch origin for this call must be _Signed_. - * - `index`: the index to be re-assigned. This must be owned by the sender. - * - `new`: the new owner of the index. This function is a no-op if it is equal to sender. - * Emits `IndexAssigned` if successful. - * # - * - `O(1)`. - * - One storage mutation (codec `O(1)`). - * - One transfer operation. - * - One event. - * # - **/ - transfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Free up an index owned by the sender. - * Payment: Any previous deposit placed for the index is unreserved in the sender account. - * The dispatch origin for this call must be _Signed_ and the sender must own the index. - * - `index`: the index to be freed. This must be owned by the sender. - * Emits `IndexFreed` if successful. - * # - * - `O(1)`. - * - One storage mutation (codec `O(1)`). - * - One reserve operation. - * - One event. - * # - **/ - free: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Force an index to an account. This doesn't require a deposit. If the index is already - * held, then any deposit is reimbursed to its current owner. - * The dispatch origin for this call must be _Root_. - * - `index`: the index to be (re-)assigned. - * - `new`: the new owner of the index. This function is a no-op if it is equal to sender. - * Emits `IndexAssigned` if successful. - * # - * - `O(1)`. - * - One storage mutation (codec `O(1)`). - * - Up to one reserve operation. - * - One event. - * # - **/ - forceTransfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - }; balances: { [index: string]: SubmittableExtrinsicFunction; + /** + * Exactly as `transfer`, except the origin must be root and the source account may be + * specified. + **/ + forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the balances of a given account. + * This will alter `FreeBalance` and `ReservedBalance` in storage. it will + * also decrease the total issuance of the system (`TotalIssuance`). + * If the new free or reserved balance is below the existential deposit, + * it will reset the account nonce (`frame_system::AccountNonce`). + * The dispatch origin for this call is `root`. + * # + * - Independent of the arguments. + * - Contains a limited number of reads and writes. + * # + **/ + setBalance: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, newFree: Compact | AnyNumber | Uint8Array, newReserved: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; /** * Transfer some liquid free balance to another account. * `transfer` will set the `FreeBalance` of the sender and receiver. @@ -285,24 +70,6 @@ declare module '@polkadot/api/types/submittable' { * # **/ transfer: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the balances of a given account. - * This will alter `FreeBalance` and `ReservedBalance` in storage. it will - * also decrease the total issuance of the system (`TotalIssuance`). - * If the new free or reserved balance is below the existential deposit, - * it will reset the account nonce (`frame_system::AccountNonce`). - * The dispatch origin for this call is `root`. - * # - * - Independent of the arguments. - * - Contains a limited number of reads and writes. - * # - **/ - setBalance: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, newFree: Compact | AnyNumber | Uint8Array, newReserved: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Exactly as `transfer`, except the origin must be root and the source account may be - * specified. - **/ - forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; /** * Same as the [`transfer`] call, but with a check that the transfer will not kill the * origin account. @@ -311,402 +78,91 @@ declare module '@polkadot/api/types/submittable' { **/ transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; }; - staking: { + contracts: { [index: string]: SubmittableExtrinsicFunction; /** - * Take the origin account as a stash and lock up `value` of its balance. `controller` will - * be the account that controls it. - * `value` must be more than the `minimum_balance` specified by `T::Currency`. - * The dispatch origin for this call must be _Signed_ by the stash account. - * # - * - Independent of the arguments. Moderate complexity. - * - O(1). - * - Three extra DB entries. - * NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned unless - * the `origin` falls below _existential deposit_ and gets removed as dust. - * # + * Makes a call to an account, optionally transferring some balance. + * * If the account is a smart-contract account, the associated code will be + * executed and any value will be transferred. + * * If the account is a regular account, any value will be transferred. + * * If no account exists and the call value is not less than `existential_deposit`, + * a regular account will be created and any value will be transferred. **/ - bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic>; + call: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, gasLimit: Compact | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic>; /** - * Add some extra amount that have appeared in the stash `free_balance` into the balance up - * for staking. - * Use this if there are additional funds in your stash account that you wish to bond. - * Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount - * that can be added. - * The dispatch origin for this call must be _Signed_ by the stash, not the controller. - * # - * - Independent of the arguments. Insignificant complexity. - * - O(1). - * - One DB entry. - * # + * Allows block producers to claim a small reward for evicting a contract. If a block producer + * fails to do so, a regular users will be allowed to claim the reward. + * If contract is not evicted as a result of this call, no actions are taken and + * the sender is not eligible for the reward. **/ - bondExtra: AugmentedSubmittable<(maxAdditional: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + claimSurcharge: AugmentedSubmittable<(dest: AccountId | string | Uint8Array, auxSender: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; /** - * Schedule a portion of the stash to be unlocked ready for transfer out after the bond - * period ends. If this leaves an amount actively bonded less than - * T::Currency::minimum_balance(), then it is increased to the full amount. - * Once the unlock period is done, you can call `withdraw_unbonded` to actually move - * the funds out of management ready for transfer. - * No more than a limited number of unlocking chunks (see `MAX_UNLOCKING_CHUNKS`) - * can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need - * to be called first to remove some of the chunks (if possible). - * The dispatch origin for this call must be _Signed_ by the controller, not the stash. - * See also [`Call::withdraw_unbonded`]. - * # - * - Independent of the arguments. Limited but potentially exploitable complexity. - * - Contains a limited number of reads. - * - Each call (requires the remainder of the bonded balance to be above `minimum_balance`) - * will cause a new entry to be inserted into a vector (`Ledger.unlocking`) kept in storage. - * The only way to clean the aforementioned storage item is also user-controlled via - * `withdraw_unbonded`. - * - One DB entry. - * + * Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance. + * Instantiation is executed as follows: + * - The destination address is computed based on the sender and hash of the code. + * - The smart-contract account is created at the computed address. + * - The `ctor_code` is executed in the context of the newly-created account. Buffer returned + * after the execution is saved as the `code` of the account. That code will be invoked + * upon any call received by this account. + * - The contract is initialized. **/ - unbond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + instantiate: AugmentedSubmittable<(endowment: Compact | AnyNumber | Uint8Array, gasLimit: Compact | AnyNumber | Uint8Array, codeHash: CodeHash | string | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic>; /** - * Remove any unlocked chunks from the `unlocking` queue from our management. - * This essentially frees up that balance to be used by the stash account to do - * whatever it wants. - * The dispatch origin for this call must be _Signed_ by the controller, not the stash. - * See also [`Call::unbond`]. - * # - * - Could be dependent on the `origin` argument and how much `unlocking` chunks exist. - * It implies `consolidate_unlocked` which loops over `Ledger.unlocking`, which is - * indirectly user-controlled. See [`unbond`] for more detail. - * - Contains a limited number of reads, yet the size of which could be large based on `ledger`. - * - Writes are limited to the `origin` account key. - * # + * Stores the given binary Wasm code into the chain's storage and returns its `codehash`. + * You can instantiate contracts only with stored code. **/ - withdrawUnbonded: AugmentedSubmittable<() => SubmittableExtrinsic>; + putCode: AugmentedSubmittable<(gasLimit: Compact | AnyNumber | Uint8Array, code: Bytes | string | Uint8Array) => SubmittableExtrinsic>; /** - * Declare the desire to validate for the origin controller. - * Effects will be felt at the beginning of the next era. - * The dispatch origin for this call must be _Signed_ by the controller, not the stash. - * # - * - Independent of the arguments. Insignificant complexity. - * - Contains a limited number of reads. - * - Writes are limited to the `origin` account key. - * # + * Updates the schedule for metering contracts. + * The schedule must have a greater version than the stored schedule. **/ - validate: AugmentedSubmittable<(prefs: ValidatorPrefs | { commission?: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Declare the desire to nominate `targets` for the origin controller. - * Effects will be felt at the beginning of the next era. - * The dispatch origin for this call must be _Signed_ by the controller, not the stash. - * # - * - The transaction's complexity is proportional to the size of `targets`, - * which is capped at `MAX_NOMINATIONS`. - * - Both the reads and writes follow a similar pattern. - * # - **/ - nominate: AugmentedSubmittable<(targets: Vec | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic>; - /** - * Declare no desire to either validate or nominate. - * Effects will be felt at the beginning of the next era. - * The dispatch origin for this call must be _Signed_ by the controller, not the stash. - * # - * - Independent of the arguments. Insignificant complexity. - * - Contains one read. - * - Writes are limited to the `origin` account key. - * # - **/ - chill: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * (Re-)set the payment target for a controller. - * Effects will be felt at the beginning of the next era. - * The dispatch origin for this call must be _Signed_ by the controller, not the stash. - * # - * - Independent of the arguments. Insignificant complexity. - * - Contains a limited number of reads. - * - Writes are limited to the `origin` account key. - * # - **/ - setPayee: AugmentedSubmittable<(payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic>; - /** - * (Re-)set the controller of a stash. - * Effects will be felt at the beginning of the next era. - * The dispatch origin for this call must be _Signed_ by the stash, not the controller. - * # - * - Independent of the arguments. Insignificant complexity. - * - Contains a limited number of reads. - * - Writes are limited to the `origin` account key. - * # - **/ - setController: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; - /** - * The ideal number of validators. - **/ - setValidatorCount: AugmentedSubmittable<(updated: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Force there to be no new eras indefinitely. - * # - * - No arguments. - * # - **/ - forceNoEras: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * Force there to be a new era at the end of the next session. After this, it will be - * reset to normal (non-forced) behaviour. - * # - * - No arguments. - * # - **/ - forceNewEra: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * Set the validators who cannot be slashed (if any). - **/ - setInvulnerables: AugmentedSubmittable<(validators: Vec | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic>; - /** - * Force a current staker to become completely unstaked, immediately. - **/ - forceUnstake: AugmentedSubmittable<(stash: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Force there to be a new era at the end of sessions indefinitely. - * # - * - One storage write - * # - **/ - forceNewEraAlways: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * Cancel enactment of a deferred slash. Can be called by either the root origin or - * the `T::SlashCancelOrigin`. - * passing the era and indices of the slashes for that era to kill. - * # - * - One storage write. - * # - **/ - cancelDeferredSlash: AugmentedSubmittable<(era: EraIndex | AnyNumber | Uint8Array, slashIndices: Vec | (u32 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic>; - /** - * Make one nominator's payout for one era. - * - `who` is the controller account of the nominator to pay out. - * - `era` may not be lower than one following the most recently paid era. If it is higher, - * then it indicates an instruction to skip the payout of all previous eras. - * - `validators` is the list of all validators that `who` had exposure to during `era`. - * If it is incomplete, then less than the full reward will be paid out. - * It must not exceed `MAX_NOMINATIONS`. - * WARNING: once an era is payed for a validator such validator can't claim the payout of - * previous era. - * WARNING: Incorrect arguments here can result in loss of payout. Be very careful. - * # - * - Number of storage read of `O(validators)`; `validators` is the argument of the call, - * and is bounded by `MAX_NOMINATIONS`. - * - Each storage read is `O(N)` size and decode complexity; `N` is the maximum - * nominations that can be given to a single validator. - * - Computation complexity: `O(MAX_NOMINATIONS * logN)`; `MAX_NOMINATIONS` is the - * maximum number of validators that may be nominated by a single nominator, it is - * bounded only economically (all nominators are required to place a minimum stake). - * # - **/ - payoutNominator: AugmentedSubmittable<(era: EraIndex | AnyNumber | Uint8Array, validators: Vec> | ([AccountId | string | Uint8Array, u32 | AnyNumber | Uint8Array])[]) => SubmittableExtrinsic>; - /** - * Make one validator's payout for one era. - * - `who` is the controller account of the validator to pay out. - * - `era` may not be lower than one following the most recently paid era. If it is higher, - * then it indicates an instruction to skip the payout of all previous eras. - * WARNING: once an era is payed for a validator such validator can't claim the payout of - * previous era. - * WARNING: Incorrect arguments here can result in loss of payout. Be very careful. - * # - * - Time complexity: O(1). - * - Contains a limited number of reads and writes. - * # - **/ - payoutValidator: AugmentedSubmittable<(era: EraIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Rebond a portion of the stash scheduled to be unlocked. - * # - * - Time complexity: O(1). Bounded by `MAX_UNLOCKING_CHUNKS`. - * - Storage changes: Can't increase storage, only decrease it. - * # - **/ - rebond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Set history_depth value. - * Origin must be root. - **/ - setHistoryDepth: AugmentedSubmittable<(newHistoryDepth: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Remove all data structure concerning a staker/stash once its balance is zero. - * This is essentially equivalent to `withdraw_unbonded` except it can be called by anyone - * and the target `stash` must have no funds left. - * This can be called from any origin. - * - `stash`: The stash account to reap. Its balance must be zero. - **/ - reapStash: AugmentedSubmittable<(stash: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + 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>; }; - session: { + council: { [index: string]: SubmittableExtrinsicFunction; /** - * Sets the session key(s) of the function caller to `keys`. - * Allows an account to set its session key prior to becoming a validator. - * This doesn't take effect until the next session. - * The dispatch origin of this function must be signed. - * # - * - O(log n) in number of accounts. - * - One extra DB entry. - * - Increases system account refs by one on success iff there were previously no keys set. - * In this case, purge_keys will need to be called before the account can be removed. - * # + * May be called by any signed account after the voting duration has ended in order to + * finish voting and close the proposal. + * Abstentions are counted as rejections unless there is a prime member set and the prime + * member cast an approval. + * - the weight of `proposal` preimage. + * - up to three events deposited. + * - one read, two removals, one mutation. (plus three static reads.) + * - computation and i/o `O(P + L + M)` where: + * - `M` is number of members, + * - `P` is number of active proposals, + * - `L` is the encoded length of `proposal` preimage. **/ - setKeys: AugmentedSubmittable<(keys: Keys, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic>; + close: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Dispatch a proposal from a member using the `Member` origin. + * Origin must be a member of the collective. + **/ + execute: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; /** - * Removes any session key(s) of the function caller. - * This doesn't take effect until the next session. - * The dispatch origin of this function must be signed. * # - * - O(N) in number of key types. - * - Removes N + 1 DB entries. - * - Reduces system account refs by one on success. + * - Bounded storage reads and writes. + * - Argument `threshold` has bearing on weight. * # **/ - purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic>; + propose: AugmentedSubmittable<(threshold: Compact | AnyNumber | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the collective's membership. + * - `new_members`: The new member list. Be nice to the chain and + * - `prime`: The prime member whose vote sets the default. + * Requires root origin. + **/ + setMembers: AugmentedSubmittable<(newMembers: Vec | (AccountId | string | Uint8Array)[], prime: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; + /** + * # + * - Bounded storage read and writes. + * - Will be slightly heavier if the proposal is approved / disapproved after the vote. + * # + **/ + vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; }; democracy: { [index: string]: SubmittableExtrinsicFunction; - /** - * Propose a sensitive action to be taken. - * The dispatch origin of this call must be _Signed_ and the sender must - * have funds to cover the deposit. - * - `proposal_hash`: The hash of the proposal preimage. - * - `value`: The amount of deposit (must be at least `MinimumDeposit`). - * Emits `Proposed`. - * # - * - `O(1)`. - * - Two DB changes, one DB entry. - * # - **/ - propose: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Signals agreement with a particular proposal. - * The dispatch origin of this call must be _Signed_ and the sender - * must have funds to cover the deposit, equal to the original deposit. - * - `proposal`: The index of the proposal to second. - * # - * - `O(1)`. - * - One DB entry. - * # - **/ - second: AugmentedSubmittable<(proposal: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Vote in a referendum. If `vote.is_aye()`, the vote is to enact the proposal; - * otherwise it is a vote to keep the status quo. - * The dispatch origin of this call must be _Signed_. - * - `ref_index`: The index of the referendum to vote for. - * - `vote`: The vote configuration. - * # - * - `O(1)`. - * - One DB change, one DB entry. - * # - **/ - vote: AugmentedSubmittable<(refIndex: Compact | AnyNumber | Uint8Array, vote: Vote | { aye: boolean; conviction?: ('None' | 'Locked1x' | 'Locked2x' | 'Locked3x' | 'Locked4x' | 'Locked5x' | 'Locked6x') | number } | boolean | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Vote in a referendum on behalf of a stash. If `vote.is_aye()`, the vote is to enact - * the proposal; otherwise it is a vote to keep the status quo. - * The dispatch origin of this call must be _Signed_. - * - `ref_index`: The index of the referendum to proxy vote for. - * - `vote`: The vote configuration. - * # - * - `O(1)`. - * - One DB change, one DB entry. - * # - **/ - proxyVote: AugmentedSubmittable<(refIndex: Compact | AnyNumber | Uint8Array, vote: Vote | { aye: boolean; conviction?: ('None' | 'Locked1x' | 'Locked2x' | 'Locked3x' | 'Locked4x' | 'Locked5x' | 'Locked6x') | number } | boolean | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Schedule an emergency cancellation of a referendum. Cannot happen twice to the same - * referendum. - * The dispatch origin of this call must be `CancellationOrigin`. - * -`ref_index`: The index of the referendum to cancel. - * # - * - Depends on size of storage vec `VotersFor` for this referendum. - * # - **/ - emergencyCancel: AugmentedSubmittable<(refIndex: ReferendumIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Schedule a referendum to be tabled once it is legal to schedule an external - * referendum. - * The dispatch origin of this call must be `ExternalOrigin`. - * - `proposal_hash`: The preimage hash of the proposal. - * # - * - `O(1)`. - * - One DB change. - * # - **/ - externalPropose: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Schedule a majority-carries referendum to be tabled next once it is legal to schedule - * an external referendum. - * The dispatch of this call must be `ExternalMajorityOrigin`. - * - `proposal_hash`: The preimage hash of the proposal. - * Unlike `external_propose`, blacklisting has no effect on this and it may replace a - * pre-scheduled `external_propose` call. - * # - * - `O(1)`. - * - One DB change. - * # - **/ - externalProposeMajority: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Schedule a negative-turnout-bias referendum to be tabled next once it is legal to - * schedule an external referendum. - * The dispatch of this call must be `ExternalDefaultOrigin`. - * - `proposal_hash`: The preimage hash of the proposal. - * Unlike `external_propose`, blacklisting has no effect on this and it may replace a - * pre-scheduled `external_propose` call. - * # - * - `O(1)`. - * - One DB change. - * # - **/ - externalProposeDefault: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Schedule the currently externally-proposed majority-carries referendum to be tabled - * immediately. If there is no externally-proposed referendum currently, or if there is one - * but it is not a majority-carries referendum then it fails. - * The dispatch of this call must be `FastTrackOrigin`. - * - `proposal_hash`: The hash of the current external proposal. - * - `voting_period`: The period that is allowed for voting on this proposal. Increased to - * `EmergencyVotingPeriod` if too low. - * - `delay`: The number of block after voting has ended in approval and this should be - * enacted. This doesn't have a minimum amount. - * Emits `Started`. - * # - * - One DB clear. - * - One DB change. - * - One extra DB entry. - * # - **/ - fastTrack: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array, votingPeriod: BlockNumber | AnyNumber | Uint8Array, delay: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Veto and blacklist the external proposal hash. - * The dispatch origin of this call must be `VetoOrigin`. - * - `proposal_hash`: The preimage hash of the proposal to veto and blacklist. - * Emits `Vetoed`. - * # - * - Two DB entries. - * - One DB clear. - * - Performs a binary search on `existing_vetoers` which should not - * be very large. - * # - **/ - vetoExternal: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Remove a referendum. - * The dispatch origin of this call must be _Root_. - * - `ref_index`: The index of the referendum to cancel. - * # - * - `O(1)`. - * # - **/ - cancelReferendum: AugmentedSubmittable<(refIndex: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Cancel a proposal queued for enactment. - * The dispatch origin of this call must be _Root_. - * - `which`: The index of the referendum to cancel. - * # - * - One DB change. - * # - **/ - cancelQueued: AugmentedSubmittable<(which: ReferendumIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; /** * Specify a proxy that is already open to us. Called by the stash. * NOTE: Used to be called `set_proxy`. @@ -717,6 +173,33 @@ declare module '@polkadot/api/types/submittable' { * # **/ activateProxy: AugmentedSubmittable<(proxy: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Cancel a proposal queued for enactment. + * The dispatch origin of this call must be _Root_. + * - `which`: The index of the referendum to cancel. + * # + * - One DB change. + * # + **/ + cancelQueued: AugmentedSubmittable<(which: ReferendumIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Remove a referendum. + * The dispatch origin of this call must be _Root_. + * - `ref_index`: The index of the referendum to cancel. + * # + * - `O(1)`. + * # + **/ + cancelReferendum: AugmentedSubmittable<(refIndex: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Clears all public proposals. + * The dispatch origin of this call must be _Root_. + * # + * - `O(1)`. + * - One DB clear. + * # + **/ + clearPublicProposals: AugmentedSubmittable<() => SubmittableExtrinsic>; /** * Clear the proxy. Called by the proxy. * NOTE: Used to be called `resign_proxy`. @@ -751,26 +234,81 @@ declare module '@polkadot/api/types/submittable' { **/ delegate: AugmentedSubmittable<(to: AccountId | string | Uint8Array, conviction: Conviction | ('None' | 'Locked1x' | 'Locked2x' | 'Locked3x' | 'Locked4x' | 'Locked5x' | 'Locked6x') | number | Uint8Array) => SubmittableExtrinsic>; /** - * Undelegate vote. - * Must be sent from an account that has called delegate previously. - * The tokens will be reduced from an indefinite lock to the maximum - * possible according to the conviction of the prior delegation. - * The dispatch origin of this call must be _Signed_. - * Emits `Undelegated`. + * Schedule an emergency cancellation of a referendum. Cannot happen twice to the same + * referendum. + * The dispatch origin of this call must be `CancellationOrigin`. + * -`ref_index`: The index of the referendum to cancel. * # - * - O(1). + * - Depends on size of storage vec `VotersFor` for this referendum. * # **/ - undelegate: AugmentedSubmittable<() => SubmittableExtrinsic>; + emergencyCancel: AugmentedSubmittable<(refIndex: ReferendumIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; /** - * Clears all public proposals. - * The dispatch origin of this call must be _Root_. + * Schedule a referendum to be tabled once it is legal to schedule an external + * referendum. + * The dispatch origin of this call must be `ExternalOrigin`. + * - `proposal_hash`: The preimage hash of the proposal. * # * - `O(1)`. - * - One DB clear. + * - One DB change. * # **/ - clearPublicProposals: AugmentedSubmittable<() => SubmittableExtrinsic>; + externalPropose: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Schedule a negative-turnout-bias referendum to be tabled next once it is legal to + * schedule an external referendum. + * The dispatch of this call must be `ExternalDefaultOrigin`. + * - `proposal_hash`: The preimage hash of the proposal. + * Unlike `external_propose`, blacklisting has no effect on this and it may replace a + * pre-scheduled `external_propose` call. + * # + * - `O(1)`. + * - One DB change. + * # + **/ + externalProposeDefault: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Schedule a majority-carries referendum to be tabled next once it is legal to schedule + * an external referendum. + * The dispatch of this call must be `ExternalMajorityOrigin`. + * - `proposal_hash`: The preimage hash of the proposal. + * Unlike `external_propose`, blacklisting has no effect on this and it may replace a + * pre-scheduled `external_propose` call. + * # + * - `O(1)`. + * - One DB change. + * # + **/ + externalProposeMajority: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Schedule the currently externally-proposed majority-carries referendum to be tabled + * immediately. If there is no externally-proposed referendum currently, or if there is one + * but it is not a majority-carries referendum then it fails. + * The dispatch of this call must be `FastTrackOrigin`. + * - `proposal_hash`: The hash of the current external proposal. + * - `voting_period`: The period that is allowed for voting on this proposal. Increased to + * `EmergencyVotingPeriod` if too low. + * - `delay`: The number of block after voting has ended in approval and this should be + * enacted. This doesn't have a minimum amount. + * Emits `Started`. + * # + * - One DB clear. + * - One DB change. + * - One extra DB entry. + * # + **/ + fastTrack: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array, votingPeriod: BlockNumber | AnyNumber | Uint8Array, delay: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Register the preimage for an upcoming proposal. This requires the proposal to be + * in the dispatch queue. No deposit is needed. + * The dispatch origin of this call must be _Signed_. + * - `encoded_proposal`: The preimage of a proposal. + * Emits `PreimageNoted`. + * # + * - Dependent on the size of `encoded_proposal`. + * # + **/ + noteImminentPreimage: AugmentedSubmittable<(encodedProposal: Bytes | string | Uint8Array) => SubmittableExtrinsic>; /** * Register the preimage for an upcoming proposal. This doesn't require the proposal to be * in the dispatch queue but does require a deposit, returned once enacted. @@ -784,16 +322,41 @@ declare module '@polkadot/api/types/submittable' { **/ notePreimage: AugmentedSubmittable<(encodedProposal: Bytes | string | Uint8Array) => SubmittableExtrinsic>; /** - * Register the preimage for an upcoming proposal. This requires the proposal to be - * in the dispatch queue. No deposit is needed. - * The dispatch origin of this call must be _Signed_. - * - `encoded_proposal`: The preimage of a proposal. - * Emits `PreimageNoted`. + * Become a proxy. + * This must be called prior to a later `activate_proxy`. + * Origin must be a Signed. + * - `target`: The account whose votes will later be proxied. + * `close_proxy` must be called before the account can be destroyed. * # - * - Dependent on the size of `encoded_proposal`. + * - One extra DB entry. * # **/ - noteImminentPreimage: AugmentedSubmittable<(encodedProposal: Bytes | string | Uint8Array) => SubmittableExtrinsic>; + openProxy: AugmentedSubmittable<(target: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Propose a sensitive action to be taken. + * The dispatch origin of this call must be _Signed_ and the sender must + * have funds to cover the deposit. + * - `proposal_hash`: The hash of the proposal preimage. + * - `value`: The amount of deposit (must be at least `MinimumDeposit`). + * Emits `Proposed`. + * # + * - `O(1)`. + * - Two DB changes, one DB entry. + * # + **/ + propose: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Vote in a referendum on behalf of a stash. If `vote.is_aye()`, the vote is to enact + * the proposal; otherwise it is a vote to keep the status quo. + * The dispatch origin of this call must be _Signed_. + * - `ref_index`: The index of the referendum to proxy vote for. + * - `vote`: The vote configuration. + * # + * - `O(1)`. + * - One DB change, one DB entry. + * # + **/ + proxyVote: AugmentedSubmittable<(refIndex: Compact | AnyNumber | Uint8Array, vote: Vote | { aye: boolean; conviction?: ('None' | 'Locked1x' | 'Locked2x' | 'Locked3x' | 'Locked4x' | 'Locked5x' | 'Locked6x') | number } | boolean | string | Uint8Array) => SubmittableExtrinsic>; /** * Remove an expired proposal preimage and collect the deposit. * The dispatch origin of this call must be _Signed_. @@ -807,6 +370,29 @@ declare module '@polkadot/api/types/submittable' { * # **/ reapPreimage: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Signals agreement with a particular proposal. + * The dispatch origin of this call must be _Signed_ and the sender + * must have funds to cover the deposit, equal to the original deposit. + * - `proposal`: The index of the proposal to second. + * # + * - `O(1)`. + * - One DB entry. + * # + **/ + second: AugmentedSubmittable<(proposal: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Undelegate vote. + * Must be sent from an account that has called delegate previously. + * The tokens will be reduced from an indefinite lock to the maximum + * possible according to the conviction of the prior delegation. + * The dispatch origin of this call must be _Signed_. + * Emits `Undelegated`. + * # + * - O(1). + * # + **/ + undelegate: AugmentedSubmittable<() => SubmittableExtrinsic>; /** * Unlock tokens that have an expired lock. * The dispatch origin of this call must be _Signed_. @@ -818,120 +404,46 @@ declare module '@polkadot/api/types/submittable' { **/ unlock: AugmentedSubmittable<(target: AccountId | string | Uint8Array) => SubmittableExtrinsic>; /** - * Become a proxy. - * This must be called prior to a later `activate_proxy`. - * Origin must be a Signed. - * - `target`: The account whose votes will later be proxied. - * `close_proxy` must be called before the account can be destroyed. + * Veto and blacklist the external proposal hash. + * The dispatch origin of this call must be `VetoOrigin`. + * - `proposal_hash`: The preimage hash of the proposal to veto and blacklist. + * Emits `Vetoed`. * # - * - One extra DB entry. + * - Two DB entries. + * - One DB clear. + * - Performs a binary search on `existing_vetoers` which should not + * be very large. * # **/ - openProxy: AugmentedSubmittable<(target: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - }; - council: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Set the collective's membership. - * - `new_members`: The new member list. Be nice to the chain and - * - `prime`: The prime member whose vote sets the default. - * Requires root origin. - **/ - setMembers: AugmentedSubmittable<(newMembers: Vec | (AccountId | string | Uint8Array)[], prime: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Dispatch a proposal from a member using the `Member` origin. - * Origin must be a member of the collective. - **/ - execute: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + vetoExternal: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic>; /** + * Vote in a referendum. If `vote.is_aye()`, the vote is to enact the proposal; + * otherwise it is a vote to keep the status quo. + * The dispatch origin of this call must be _Signed_. + * - `ref_index`: The index of the referendum to vote for. + * - `vote`: The vote configuration. * # - * - Bounded storage reads and writes. - * - Argument `threshold` has bearing on weight. + * - `O(1)`. + * - One DB change, one DB entry. * # **/ - propose: AugmentedSubmittable<(threshold: Compact | AnyNumber | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * # - * - Bounded storage read and writes. - * - Will be slightly heavier if the proposal is approved / disapproved after the vote. - * # - **/ - vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; - /** - * May be called by any signed account after the voting duration has ended in order to - * finish voting and close the proposal. - * Abstentions are counted as rejections unless there is a prime member set and the prime - * member cast an approval. - * - the weight of `proposal` preimage. - * - up to three events deposited. - * - one read, two removals, one mutation. (plus three static reads.) - * - computation and i/o `O(P + L + M)` where: - * - `M` is number of members, - * - `P` is number of active proposals, - * - `L` is the encoded length of `proposal` preimage. - **/ - close: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - }; - technicalCommittee: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Set the collective's membership. - * - `new_members`: The new member list. Be nice to the chain and - * - `prime`: The prime member whose vote sets the default. - * Requires root origin. - **/ - setMembers: AugmentedSubmittable<(newMembers: Vec | (AccountId | string | Uint8Array)[], prime: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Dispatch a proposal from a member using the `Member` origin. - * Origin must be a member of the collective. - **/ - execute: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * # - * - Bounded storage reads and writes. - * - Argument `threshold` has bearing on weight. - * # - **/ - propose: AugmentedSubmittable<(threshold: Compact | AnyNumber | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * # - * - Bounded storage read and writes. - * - Will be slightly heavier if the proposal is approved / disapproved after the vote. - * # - **/ - vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; - /** - * May be called by any signed account after the voting duration has ended in order to - * finish voting and close the proposal. - * Abstentions are counted as rejections unless there is a prime member set and the prime - * member cast an approval. - * - the weight of `proposal` preimage. - * - up to three events deposited. - * - one read, two removals, one mutation. (plus three static reads.) - * - computation and i/o `O(P + L + M)` where: - * - `M` is number of members, - * - `P` is number of active proposals, - * - `L` is the encoded length of `proposal` preimage. - **/ - close: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + vote: AugmentedSubmittable<(refIndex: Compact | AnyNumber | Uint8Array, vote: Vote | { aye: boolean; conviction?: ('None' | 'Locked1x' | 'Locked2x' | 'Locked3x' | 'Locked4x' | 'Locked5x' | 'Locked6x') | number } | boolean | string | Uint8Array) => SubmittableExtrinsic>; }; elections: { [index: string]: SubmittableExtrinsicFunction; /** - * Vote for a set of candidates for the upcoming round of election. - * The `votes` should: - * - not be empty. - * - be less than the number of candidates. - * Upon voting, `value` units of `who`'s balance is locked and a bond amount is reserved. - * It is the responsibility of the caller to not place all of their balance into the lock - * and keep some for further transactions. + * Remove a particular member from the set. This is effective immediately and the bond of + * the outgoing member is slashed. + * If a runner-up is available, then the best runner-up will be removed and replaces the + * outgoing member. Otherwise, a new phragmen round is started. + * Note that this does not affect the designated block number of the next election. * # * #### State - * Reads: O(1) - * Writes: O(V) given `V` votes. V is bounded by 16. + * Reads: O(do_phragmen) + * Writes: O(do_phragmen) * # **/ - vote: AugmentedSubmittable<(votes: Vec | (AccountId | string | Uint8Array)[], value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + removeMember: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; /** * Remove `origin` as a voter. This removes the lock and returns the bond. * # @@ -941,6 +453,18 @@ declare module '@polkadot/api/types/submittable' { * # **/ removeVoter: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Renounce one's intention to be a candidate for the next election round. 3 potential + * outcomes exist: + * - `origin` is a candidate and not elected in any set. In this case, the bond is + * unreserved, returned and origin is removed as a candidate. + * - `origin` is a current runner up. In this case, the bond is unreserved, returned and + * origin is removed as a runner. + * - `origin` is a current member. In this case, the bond is unreserved and origin is + * removed as a member, consequently not being a candidate for the next round anymore. + * Similar to [`remove_voter`], if replacement runners exists, they are immediately used. + **/ + renounceCandidacy: AugmentedSubmittable<() => SubmittableExtrinsic>; /** * Report `target` for being an defunct voter. In case of a valid report, the reporter is * rewarded by the bond amount of `target`. Otherwise, the reporter itself is removed and @@ -970,69 +494,20 @@ declare module '@polkadot/api/types/submittable' { **/ submitCandidacy: AugmentedSubmittable<() => SubmittableExtrinsic>; /** - * Renounce one's intention to be a candidate for the next election round. 3 potential - * outcomes exist: - * - `origin` is a candidate and not elected in any set. In this case, the bond is - * unreserved, returned and origin is removed as a candidate. - * - `origin` is a current runner up. In this case, the bond is unreserved, returned and - * origin is removed as a runner. - * - `origin` is a current member. In this case, the bond is unreserved and origin is - * removed as a member, consequently not being a candidate for the next round anymore. - * Similar to [`remove_voter`], if replacement runners exists, they are immediately used. - **/ - renounceCandidacy: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * Remove a particular member from the set. This is effective immediately and the bond of - * the outgoing member is slashed. - * If a runner-up is available, then the best runner-up will be removed and replaces the - * outgoing member. Otherwise, a new phragmen round is started. - * Note that this does not affect the designated block number of the next election. + * Vote for a set of candidates for the upcoming round of election. + * The `votes` should: + * - not be empty. + * - be less than the number of candidates. + * Upon voting, `value` units of `who`'s balance is locked and a bond amount is reserved. + * It is the responsibility of the caller to not place all of their balance into the lock + * and keep some for further transactions. * # * #### State - * Reads: O(do_phragmen) - * Writes: O(do_phragmen) + * Reads: O(1) + * Writes: O(V) given `V` votes. V is bounded by 16. * # **/ - removeMember: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; - }; - technicalMembership: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Add a member `who` to the set. - * May only be called from `AddOrigin` or root. - **/ - addMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Remove a member `who` from the set. - * May only be called from `RemoveOrigin` or root. - **/ - removeMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Swap out one member `remove` for another `add`. - * May only be called from `SwapOrigin` or root. - * Prime membership is *not* passed from `remove` to `add`, if extant. - **/ - swapMember: AugmentedSubmittable<(remove: AccountId | string | Uint8Array, add: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Change the membership to a new set, disregarding the existing membership. Be nice and - * pass `members` pre-sorted. - * May only be called from `ResetOrigin` or root. - **/ - resetMembers: AugmentedSubmittable<(members: Vec | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic>; - /** - * Swap out the sending member for some other key `new`. - * May only be called from `Signed` origin of a current member. - * Prime membership is passed from the origin account to `new`, if extant. - **/ - changeKey: AugmentedSubmittable<(updated: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the prime member. Must be a current member. - **/ - setPrime: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Remove the prime member if it exists. - **/ - clearPrime: AugmentedSubmittable<() => SubmittableExtrinsic>; + vote: AugmentedSubmittable<(votes: Vec | (AccountId | string | Uint8Array)[], value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; }; finalityTracker: { [index: string]: SubmittableExtrinsicFunction; @@ -1049,202 +524,6 @@ declare module '@polkadot/api/types/submittable' { **/ reportMisbehavior: AugmentedSubmittable<(report: Bytes | string | Uint8Array) => SubmittableExtrinsic>; }; - treasury: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Put forward a suggestion for spending. A deposit proportional to the value - * is reserved and slashed if the proposal is rejected. It is returned once the - * proposal is awarded. - * # - * - O(1). - * - Limited storage reads. - * - One DB change, one extra DB entry. - * # - **/ - proposeSpend: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Reject a proposed spend. The original deposit will be slashed. - * # - * - O(1). - * - Limited storage reads. - * - One DB clear. - * # - **/ - rejectProposal: AugmentedSubmittable<(proposalId: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Approve a proposal. At a later time, the proposal will be allocated to the beneficiary - * and the original deposit will be returned. - * # - * - O(1). - * - Limited storage reads. - * - One DB change. - * # - **/ - approveProposal: AugmentedSubmittable<(proposalId: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Report something `reason` that deserves a tip and claim any eventual the finder's fee. - * The dispatch origin for this call must be _Signed_. - * Payment: `TipReportDepositBase` will be reserved from the origin account, as well as - * `TipReportDepositPerByte` for each byte in `reason`. - * - `reason`: The reason for, or the thing that deserves, the tip; generally this will be - * a UTF-8-encoded URL. - * - `who`: The account which should be credited for the tip. - * Emits `NewTip` if successful. - * # - * - `O(R)` where `R` length of `reason`. - * - One balance operation. - * - One storage mutation (codec `O(R)`). - * - One event. - * # - **/ - reportAwesome: AugmentedSubmittable<(reason: Bytes | string | Uint8Array, who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Retract a prior tip-report from `report_awesome`, and cancel the process of tipping. - * If successful, the original deposit will be unreserved. - * The dispatch origin for this call must be _Signed_ and the tip identified by `hash` - * must have been reported by the signing account through `report_awesome` (and not - * through `tip_new`). - * - `hash`: The identity of the open tip for which a tip value is declared. This is formed - * as the hash of the tuple of the original tip `reason` and the beneficiary account ID. - * Emits `TipRetracted` if successful. - * # - * - `O(T)` - * - One balance operation. - * - Two storage removals (one read, codec `O(T)`). - * - One event. - * # - **/ - retractTip: AugmentedSubmittable<(hash: Hash | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Give a tip for something new; no finder's fee will be taken. - * The dispatch origin for this call must be _Signed_ and the signing account must be a - * member of the `Tippers` set. - * - `reason`: The reason for, or the thing that deserves, the tip; generally this will be - * a UTF-8-encoded URL. - * - `who`: The account which should be credited for the tip. - * - `tip_value`: The amount of tip that the sender would like to give. The median tip - * value of active tippers will be given to the `who`. - * Emits `NewTip` if successful. - * # - * - `O(R + T)` where `R` length of `reason`, `T` is the number of tippers. `T` is - * naturally capped as a membership set, `R` is limited through transaction-size. - * - Two storage insertions (codecs `O(R)`, `O(T)`), one read `O(1)`. - * - One event. - * # - **/ - tipNew: AugmentedSubmittable<(reason: Bytes | string | Uint8Array, who: AccountId | string | Uint8Array, tipValue: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Declare a tip value for an already-open tip. - * The dispatch origin for this call must be _Signed_ and the signing account must be a - * member of the `Tippers` set. - * - `hash`: The identity of the open tip for which a tip value is declared. This is formed - * as the hash of the tuple of the hash of the original tip `reason` and the beneficiary - * account ID. - * - `tip_value`: The amount of tip that the sender would like to give. The median tip - * value of active tippers will be given to the `who`. - * Emits `TipClosing` if the threshold of tippers has been reached and the countdown period - * has started. - * # - * - `O(T)` - * - One storage mutation (codec `O(T)`), one storage read `O(1)`. - * - Up to one event. - * # - **/ - tip: AugmentedSubmittable<(hash: Hash | string | Uint8Array, tipValue: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Close and payout a tip. - * The dispatch origin for this call must be _Signed_. - * The tip identified by `hash` must have finished its countdown period. - * - `hash`: The identity of the open tip for which a tip value is declared. This is formed - * as the hash of the tuple of the original tip `reason` and the beneficiary account ID. - * # - * - `O(T)` - * - One storage retrieval (codec `O(T)`) and two removals. - * - Up to three balance operations. - * # - **/ - closeTip: AugmentedSubmittable<(hash: Hash | string | Uint8Array) => SubmittableExtrinsic>; - }; - contracts: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Updates the schedule for metering contracts. - * The schedule must have a greater version than the stored schedule. - **/ - 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>; - /** - * Stores the given binary Wasm code into the chain's storage and returns its `codehash`. - * You can instantiate contracts only with stored code. - **/ - putCode: AugmentedSubmittable<(gasLimit: Compact | AnyNumber | Uint8Array, code: Bytes | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Makes a call to an account, optionally transferring some balance. - * * If the account is a smart-contract account, the associated code will be - * executed and any value will be transferred. - * * If the account is a regular account, any value will be transferred. - * * If no account exists and the call value is not less than `existential_deposit`, - * a regular account will be created and any value will be transferred. - **/ - call: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, gasLimit: Compact | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance. - * Instantiation is executed as follows: - * - The destination address is computed based on the sender and hash of the code. - * - The smart-contract account is created at the computed address. - * - The `ctor_code` is executed in the context of the newly-created account. Buffer returned - * after the execution is saved as the `code` of the account. That code will be invoked - * upon any call received by this account. - * - The contract is initialized. - **/ - instantiate: AugmentedSubmittable<(endowment: Compact | AnyNumber | Uint8Array, gasLimit: Compact | AnyNumber | Uint8Array, codeHash: CodeHash | string | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Allows block producers to claim a small reward for evicting a contract. If a block producer - * fails to do so, a regular users will be allowed to claim the reward. - * If contract is not evicted as a result of this call, no actions are taken and - * the sender is not eligible for the reward. - **/ - claimSurcharge: AugmentedSubmittable<(dest: AccountId | string | Uint8Array, auxSender: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; - }; - sudo: { - [index: string]: SubmittableExtrinsicFunction; - /** - * Authenticates the sudo key and dispatches a function call with `Root` origin. - * The dispatch origin for this call must be _Signed_. - * # - * - O(1). - * - Limited storage reads. - * - One DB write (event). - * - Weight of derivative `call` execution + 10,000. - * # - **/ - sudo: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key. - * The dispatch origin for this call must be _Signed_. - * # - * - O(1). - * - Limited storage reads. - * - One DB change. - * # - **/ - setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Authenticates the sudo key and dispatches a function call with `Signed` origin from - * a given account. - * The dispatch origin for this call must be _Signed_. - * # - * - O(1). - * - Limited storage reads. - * - One DB write (event). - * - Weight of derivative `call` execution + 10,000. - * # - **/ - sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; - }; - imOnline: { - [index: string]: SubmittableExtrinsicFunction; - heartbeat: AugmentedSubmittable<(heartbeat: Heartbeat | { blockNumber?: any; networkState?: any; sessionIndex?: any; authorityIndex?: any } | string | Uint8Array, signature: Signature | string | Uint8Array) => SubmittableExtrinsic>; - }; identity: { [index: string]: SubmittableExtrinsicFunction; /** @@ -1259,6 +538,126 @@ declare module '@polkadot/api/types/submittable' { * # **/ addRegistrar: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Cancel a previous request. + * Payment: A previously reserved deposit is returned on success. + * The dispatch origin for this call must be _Signed_ and the sender must have a + * registered identity. + * - `reg_index`: The index of the registrar whose judgement is no longer requested. + * Emits `JudgementUnrequested` if successful. + * # + * - `O(R + X)`. + * - One balance-reserve operation. + * - One storage mutation `O(R + X)`. + * - One event. + * # + **/ + cancelRequest: AugmentedSubmittable<(regIndex: RegistrarIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Clear an account's identity info and all sub-account and return all deposits. + * Payment: All reserved balances on the account are returned. + * The dispatch origin for this call must be _Signed_ and the sender must have a registered + * identity. + * Emits `IdentityCleared` if successful. + * # + * - `O(R + S + X)`. + * - One balance-reserve operation. + * - `S + 2` storage deletions. + * - One event. + * # + **/ + clearIdentity: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Remove an account's identity and sub-account information and slash the deposits. + * Payment: Reserved balances from `set_subs` and `set_identity` are slashed and handled by + * `Slash`. Verification request deposits are not returned; they should be cancelled + * manually using `cancel_request`. + * The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`. + * - `target`: the account whose identity the judgement is upon. This must be an account + * with a registered identity. + * Emits `IdentityKilled` if successful. + * # + * - `O(R + S + X)`. + * - One balance-reserve operation. + * - `S + 2` storage mutations. + * - One event. + * # + **/ + killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Provide a judgement for an account's identity. + * The dispatch origin for this call must be _Signed_ and the sender must be the account + * of the registrar whose index is `reg_index`. + * - `reg_index`: the index of the registrar whose judgement is being made. + * - `target`: the account whose identity the judgement is upon. This must be an account + * with a registered identity. + * - `judgement`: the judgement of the registrar of index `reg_index` about `target`. + * Emits `JudgementGiven` if successful. + * # + * - `O(R + X)`. + * - One balance-transfer operation. + * - Up to one account-lookup operation. + * - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`. + * - One event. + * # + **/ + provideJudgement: AugmentedSubmittable<(regIndex: Compact | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { unknown: any } | { feePaid: any } | { reasonable: any } | { knownGood: any } | { outOfDate: any } | { lowQuality: any } | { erroneous: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Request a judgement from a registrar. + * Payment: At most `max_fee` will be reserved for payment to the registrar if judgement + * given. + * The dispatch origin for this call must be _Signed_ and the sender must have a + * registered identity. + * - `reg_index`: The index of the registrar whose judgement is requested. + * - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as: + * ```nocompile + * Self::registrars(reg_index).unwrap().fee + * ``` + * Emits `JudgementRequested` if successful. + * # + * - `O(R + X)`. + * - One balance-reserve operation. + * - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`. + * - One event. + * # + **/ + requestJudgement: AugmentedSubmittable<(regIndex: Compact | AnyNumber | Uint8Array, maxFee: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Change the account associated with a registrar. + * The dispatch origin for this call must be _Signed_ and the sender must be the account + * of the registrar whose index is `index`. + * - `index`: the index of the registrar whose fee is to be set. + * - `new`: the new account ID. + * # + * - `O(R)`. + * - One storage mutation `O(R)`. + * # + **/ + setAccountId: AugmentedSubmittable<(index: Compact | AnyNumber | Uint8Array, updated: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the fee required for a judgement to be requested from a registrar. + * The dispatch origin for this call must be _Signed_ and the sender must be the account + * of the registrar whose index is `index`. + * - `index`: the index of the registrar whose fee is to be set. + * - `fee`: the new fee. + * # + * - `O(R)`. + * - One storage mutation `O(R)`. + * # + **/ + setFee: AugmentedSubmittable<(index: Compact | AnyNumber | Uint8Array, fee: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the field information for a registrar. + * The dispatch origin for this call must be _Signed_ and the sender must be the account + * of the registrar whose index is `index`. + * - `index`: the index of the registrar whose fee is to be set. + * - `fields`: the fields that the registrar concerns themselves with. + * # + * - `O(R)`. + * - One storage mutation `O(R)`. + * # + **/ + setFields: AugmentedSubmittable<(index: Compact | AnyNumber | Uint8Array, fields: IdentityFields) => SubmittableExtrinsic>; /** * Set an account's identity information and reserve the appropriate deposit. * If the account already has identity information, the deposit is taken as part payment @@ -1290,388 +689,71 @@ declare module '@polkadot/api/types/submittable' { * # **/ setSubs: AugmentedSubmittable<(subs: Vec> | ([AccountId | string | Uint8Array, Data | { none: any } | { raw: any } | { blakeTwo256: any } | { sha256: any } | { keccak256: any } | { shaThree256: any } | string | Uint8Array])[]) => SubmittableExtrinsic>; - /** - * Clear an account's identity info and all sub-account and return all deposits. - * Payment: All reserved balances on the account are returned. - * The dispatch origin for this call must be _Signed_ and the sender must have a registered - * identity. - * Emits `IdentityCleared` if successful. - * # - * - `O(R + S + X)`. - * - One balance-reserve operation. - * - `S + 2` storage deletions. - * - One event. - * # - **/ - clearIdentity: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * Request a judgement from a registrar. - * Payment: At most `max_fee` will be reserved for payment to the registrar if judgement - * given. - * The dispatch origin for this call must be _Signed_ and the sender must have a - * registered identity. - * - `reg_index`: The index of the registrar whose judgement is requested. - * - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as: - * ```nocompile - * Self::registrars(reg_index).unwrap().fee - * ``` - * Emits `JudgementRequested` if successful. - * # - * - `O(R + X)`. - * - One balance-reserve operation. - * - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`. - * - One event. - * # - **/ - requestJudgement: AugmentedSubmittable<(regIndex: Compact | AnyNumber | Uint8Array, maxFee: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Cancel a previous request. - * Payment: A previously reserved deposit is returned on success. - * The dispatch origin for this call must be _Signed_ and the sender must have a - * registered identity. - * - `reg_index`: The index of the registrar whose judgement is no longer requested. - * Emits `JudgementUnrequested` if successful. - * # - * - `O(R + X)`. - * - One balance-reserve operation. - * - One storage mutation `O(R + X)`. - * - One event. - * # - **/ - cancelRequest: AugmentedSubmittable<(regIndex: RegistrarIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the fee required for a judgement to be requested from a registrar. - * The dispatch origin for this call must be _Signed_ and the sender must be the account - * of the registrar whose index is `index`. - * - `index`: the index of the registrar whose fee is to be set. - * - `fee`: the new fee. - * # - * - `O(R)`. - * - One storage mutation `O(R)`. - * # - **/ - setFee: AugmentedSubmittable<(index: Compact | AnyNumber | Uint8Array, fee: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * Change the account associated with a registrar. - * The dispatch origin for this call must be _Signed_ and the sender must be the account - * of the registrar whose index is `index`. - * - `index`: the index of the registrar whose fee is to be set. - * - `new`: the new account ID. - * # - * - `O(R)`. - * - One storage mutation `O(R)`. - * # - **/ - setAccountId: AugmentedSubmittable<(index: Compact | AnyNumber | Uint8Array, updated: AccountId | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Set the field information for a registrar. - * The dispatch origin for this call must be _Signed_ and the sender must be the account - * of the registrar whose index is `index`. - * - `index`: the index of the registrar whose fee is to be set. - * - `fields`: the fields that the registrar concerns themselves with. - * # - * - `O(R)`. - * - One storage mutation `O(R)`. - * # - **/ - setFields: AugmentedSubmittable<(index: Compact | AnyNumber | Uint8Array, fields: IdentityFields) => SubmittableExtrinsic>; - /** - * Provide a judgement for an account's identity. - * The dispatch origin for this call must be _Signed_ and the sender must be the account - * of the registrar whose index is `reg_index`. - * - `reg_index`: the index of the registrar whose judgement is being made. - * - `target`: the account whose identity the judgement is upon. This must be an account - * with a registered identity. - * - `judgement`: the judgement of the registrar of index `reg_index` about `target`. - * Emits `JudgementGiven` if successful. - * # - * - `O(R + X)`. - * - One balance-transfer operation. - * - Up to one account-lookup operation. - * - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`. - * - One event. - * # - **/ - provideJudgement: AugmentedSubmittable<(regIndex: Compact | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { unknown: any } | { feePaid: any } | { reasonable: any } | { knownGood: any } | { outOfDate: any } | { lowQuality: any } | { erroneous: any } | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Remove an account's identity and sub-account information and slash the deposits. - * Payment: Reserved balances from `set_subs` and `set_identity` are slashed and handled by - * `Slash`. Verification request deposits are not returned; they should be cancelled - * manually using `cancel_request`. - * The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`. - * - `target`: the account whose identity the judgement is upon. This must be an account - * with a registered identity. - * Emits `IdentityKilled` if successful. - * # - * - `O(R + S + X)`. - * - One balance-reserve operation. - * - `S + 2` storage mutations. - * - One event. - * # - **/ - killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; }; - society: { + imOnline: { + [index: string]: SubmittableExtrinsicFunction; + heartbeat: AugmentedSubmittable<(heartbeat: Heartbeat | { blockNumber?: any; networkState?: any; sessionIndex?: any; authorityIndex?: any } | string | Uint8Array, signature: Signature | string | Uint8Array) => SubmittableExtrinsic>; + }; + indices: { [index: string]: SubmittableExtrinsicFunction; /** - * A user outside of the society can make a bid for entry. - * Payment: `CandidateDeposit` will be reserved for making a bid. It is returned - * when the bid becomes a member, or if the bid calls `unbid`. + * Assign an previously unassigned index. + * Payment: `Deposit` is reserved from the sender account. * The dispatch origin for this call must be _Signed_. - * Parameters: - * - `value`: A one time payment the bid would like to receive when joining the society. + * - `index`: the index to be claimed. This must not be in use. + * Emits `IndexAssigned` if successful. * # - * Key: B (len of bids), C (len of candidates), M (len of members), X (balance reserve) - * - Storage Reads: - * - One storage read to check for suspended candidate. O(1) - * - One storage read to check for suspended member. O(1) - * - One storage read to retrieve all current bids. O(B) - * - One storage read to retrieve all current candidates. O(C) - * - One storage read to retrieve all members. O(M) - * - Storage Writes: - * - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization w/ read) - * - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1) - * - Notable Computation: - * - O(B + C + log M) search to check user is not already a part of society. - * - O(log B) search to insert the new bid sorted. - * - External Module Operations: - * - One balance reserve operation. O(X) - * - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT. - * - Events: - * - One event for new bid. - * - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT. - * Total Complexity: O(M + B + C + logM + logB + X) - * # - **/ - bid: AugmentedSubmittable<(value: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * A bidder can remove their bid for entry into society. - * By doing so, they will have their candidate deposit returned or - * they will unvouch their voucher. - * Payment: The bid deposit is unreserved if the user made a bid. - * The dispatch origin for this call must be _Signed_ and a bidder. - * Parameters: - * - `pos`: Position in the `Bids` vector of the bid who wants to unbid. - * # - * Key: B (len of bids), X (balance unreserve) - * - One storage read and write to retrieve and update the bids. O(B) - * - Either one unreserve balance action O(X) or one vouching storage removal. O(1) + * - `O(1)`. + * - One storage mutation (codec `O(1)`). + * - One reserve operation. * - One event. - * Total Complexity: O(B + X) * # **/ - unbid: AugmentedSubmittable<(pos: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + claim: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; /** - * As a member, vouch for someone to join society by placing a bid on their behalf. - * There is no deposit required to vouch for a new bid, but a member can only vouch for - * one bid at a time. If the bid becomes a suspended candidate and ultimately rejected by - * the suspension judgement origin, the member will be banned from vouching again. - * As a vouching member, you can claim a tip if the candidate is accepted. This tip will - * be paid as a portion of the reward the member will receive for joining the society. - * The dispatch origin for this call must be _Signed_ and a member. - * Parameters: - * - `who`: The user who you would like to vouch for. - * - `value`: The total reward to be paid between you and the candidate if they become - * a member in the society. - * - `tip`: Your cut of the total `value` payout when the candidate is inducted into - * the society. Tips larger than `value` will be saturated upon payout. + * Force an index to an account. This doesn't require a deposit. If the index is already + * held, then any deposit is reimbursed to its current owner. + * The dispatch origin for this call must be _Root_. + * - `index`: the index to be (re-)assigned. + * - `new`: the new owner of the index. This function is a no-op if it is equal to sender. + * Emits `IndexAssigned` if successful. * # - * Key: B (len of bids), C (len of candidates), M (len of members) - * - Storage Reads: - * - One storage read to retrieve all members. O(M) - * - One storage read to check member is not already vouching. O(1) - * - One storage read to check for suspended candidate. O(1) - * - One storage read to check for suspended member. O(1) - * - One storage read to retrieve all current bids. O(B) - * - One storage read to retrieve all current candidates. O(C) - * - Storage Writes: - * - One storage write to insert vouching status to the member. O(1) - * - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization w/ read) - * - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1) - * - Notable Computation: - * - O(log M) search to check sender is a member. - * - O(B + C + log M) search to check user is not already a part of society. - * - O(log B) search to insert the new bid sorted. - * - External Module Operations: - * - One balance reserve operation. O(X) - * - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT. - * - Events: - * - One event for vouch. - * - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT. - * Total Complexity: O(M + B + C + logM + logB + X) - * # - **/ - vouch: AugmentedSubmittable<(who: AccountId | string | Uint8Array, value: BalanceOf | AnyNumber | Uint8Array, tip: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; - /** - * As a vouching member, unvouch a bid. This only works while vouched user is - * only a bidder (and not a candidate). - * The dispatch origin for this call must be _Signed_ and a vouching member. - * Parameters: - * - `pos`: Position in the `Bids` vector of the bid who should be unvouched. - * # - * Key: B (len of bids) - * - One storage read O(1) to check the signer is a vouching member. - * - One storage mutate to retrieve and update the bids. O(B) - * - One vouching storage removal. O(1) + * - `O(1)`. + * - One storage mutation (codec `O(1)`). + * - Up to one reserve operation. * - One event. - * Total Complexity: O(B) * # **/ - unvouch: AugmentedSubmittable<(pos: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + forceTransfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; /** - * As a member, vote on a candidate. - * The dispatch origin for this call must be _Signed_ and a member. - * Parameters: - * - `candidate`: The candidate that the member would like to bid on. - * - `approve`: A boolean which says if the candidate should be - * approved (`true`) or rejected (`false`). + * Free up an index owned by the sender. + * Payment: Any previous deposit placed for the index is unreserved in the sender account. + * The dispatch origin for this call must be _Signed_ and the sender must own the index. + * - `index`: the index to be freed. This must be owned by the sender. + * Emits `IndexFreed` if successful. * # - * Key: C (len of candidates), M (len of members) - * - One storage read O(M) and O(log M) search to check user is a member. - * - One account lookup. - * - One storage read O(C) and O(C) search to check that user is a candidate. - * - One storage write to add vote to votes. O(1) + * - `O(1)`. + * - One storage mutation (codec `O(1)`). + * - One reserve operation. * - One event. - * Total Complexity: O(M + logM + C) * # **/ - vote: AugmentedSubmittable<(candidate: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; + free: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; /** - * As a member, vote on the defender. - * The dispatch origin for this call must be _Signed_ and a member. - * Parameters: - * - `approve`: A boolean which says if the candidate should be - * approved (`true`) or rejected (`false`). + * Assign an index already owned by the sender to another account. The balance reservation + * is effectively transferred to the new account. + * The dispatch origin for this call must be _Signed_. + * - `index`: the index to be re-assigned. This must be owned by the sender. + * - `new`: the new owner of the index. This function is a no-op if it is equal to sender. + * Emits `IndexAssigned` if successful. * # - * - Key: M (len of members) - * - One storage read O(M) and O(log M) search to check user is a member. - * - One storage write to add vote to votes. O(1) + * - `O(1)`. + * - One storage mutation (codec `O(1)`). + * - One transfer operation. * - One event. - * Total Complexity: O(M + logM) * # **/ - defenderVote: AugmentedSubmittable<(approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; - /** - * Transfer the first matured payout for the sender and remove it from the records. - * NOTE: This extrinsic needs to be called multiple times to claim multiple matured payouts. - * Payment: The member will receive a payment equal to their first matured - * payout to their free balance. - * The dispatch origin for this call must be _Signed_ and a member with - * payouts remaining. - * # - * Key: M (len of members), P (number of payouts for a particular member) - * - One storage read O(M) and O(log M) search to check signer is a member. - * - One storage read O(P) to get all payouts for a member. - * - One storage read O(1) to get the current block number. - * - One currency transfer call. O(X) - * - One storage write or removal to update the member's payouts. O(P) - * Total Complexity: O(M + logM + P + X) - * # - **/ - payout: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * Found the society. - * This is done as a discrete action in order to allow for the - * module to be included into a running chain and can only be done once. - * The dispatch origin for this call must be from the _FounderSetOrigin_. - * Parameters: - * - `founder` - The first member and head of the newly founded society. - * - `max_members` - The initial max number of members for the society. - * - `rules` - The rules of this society concerning membership. - * # - * - Two storage mutates to set `Head` and `Founder`. O(1) - * - One storage write to add the first member to society. O(1) - * - One event. - * Total Complexity: O(1) - * # - **/ - found: AugmentedSubmittable<(founder: AccountId | string | Uint8Array, maxMembers: u32 | AnyNumber | Uint8Array, rules: Bytes | string | Uint8Array) => SubmittableExtrinsic>; - /** - * Annul the founding of the society. - * The dispatch origin for this call must be Signed, and the signing account must be both - * the `Founder` and the `Head`. This implies that it may only be done when there is one - * member. - * # - * - Two storage reads O(1). - * - Four storage removals O(1). - * - One event. - * Total Complexity: O(1) - * # - **/ - unfound: AugmentedSubmittable<() => SubmittableExtrinsic>; - /** - * Allow suspension judgement origin to make judgement on a suspended member. - * If a suspended member is forgiven, we simply add them back as a member, not affecting - * any of the existing storage items for that member. - * If a suspended member is rejected, remove all associated storage items, including - * their payouts, and remove any vouched bids they currently have. - * The dispatch origin for this call must be from the _SuspensionJudgementOrigin_. - * Parameters: - * - `who` - The suspended member to be judged. - * - `forgive` - A boolean representing whether the suspension judgement origin - * forgives (`true`) or rejects (`false`) a suspended member. - * # - * Key: B (len of bids), M (len of members) - * - One storage read to check `who` is a suspended member. O(1) - * - Up to one storage write O(M) with O(log M) binary search to add a member back to society. - * - Up to 3 storage removals O(1) to clean up a removed member. - * - Up to one storage write O(B) with O(B) search to remove vouched bid from bids. - * - Up to one additional event if unvouch takes place. - * - One storage removal. O(1) - * - One event for the judgement. - * Total Complexity: O(M + logM + B) - * # - **/ - judgeSuspendedMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array, forgive: bool | boolean | Uint8Array) => SubmittableExtrinsic>; - /** - * Allow suspended judgement origin to make judgement on a suspended candidate. - * If the judgement is `Approve`, we add them to society as a member with the appropriate - * payment for joining society. - * If the judgement is `Reject`, we either slash the deposit of the bid, giving it back - * to the society treasury, or we ban the voucher from vouching again. - * If the judgement is `Rebid`, we put the candidate back in the bid pool and let them go - * through the induction process again. - * The dispatch origin for this call must be from the _SuspensionJudgementOrigin_. - * Parameters: - * - `who` - The suspended candidate to be judged. - * - `judgement` - `Approve`, `Reject`, or `Rebid`. - * # - * Key: B (len of bids), M (len of members), X (balance action) - * - One storage read to check `who` is a suspended candidate. - * - One storage removal of the suspended candidate. - * - Approve Logic - * - One storage read to get the available pot to pay users with. O(1) - * - One storage write to update the available pot. O(1) - * - One storage read to get the current block number. O(1) - * - One storage read to get all members. O(M) - * - Up to one unreserve currency action. - * - Up to two new storage writes to payouts. - * - Up to one storage write with O(log M) binary search to add a member to society. - * - Reject Logic - * - Up to one repatriate reserved currency action. O(X) - * - Up to one storage write to ban the vouching member from vouching again. - * - Rebid Logic - * - Storage mutate with O(log B) binary search to place the user back into bids. - * - Up to one additional event if unvouch takes place. - * - One storage removal. - * - One event for the judgement. - * Total Complexity: O(M + logM + B + X) - * # - **/ - judgeSuspendedCandidate: AugmentedSubmittable<(who: AccountId | string | Uint8Array, judgement: SocietyJudgement | ('Rebid' | 'Reject' | 'Approve') | number | Uint8Array) => SubmittableExtrinsic>; - /** - * Allows root origin to change the maximum number of members in society. - * Max membership count must be greater than 1. - * The dispatch origin for this call must be from _ROOT_. - * Parameters: - * - `max` - The maximum number of members for the society. - * # - * - One storage write to update the max. O(1) - * - One event. - * Total Complexity: O(1) - * # - **/ - setMaxMembers: AugmentedSubmittable<(max: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + transfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; }; recovery: { [index: string]: SubmittableExtrinsicFunction; @@ -1689,18 +771,53 @@ declare module '@polkadot/api/types/submittable' { **/ asRecovered: AugmentedSubmittable<(account: AccountId | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; /** - * Allow ROOT to bypass the recovery process and set an a rescuer account - * for a lost account directly. - * The dispatch origin for this call must be _ROOT_. + * Cancel the ability to use `as_recovered` for `account`. + * The dispatch origin for this call must be _Signed_ and registered to + * be able to make calls on behalf of the recovered account. * Parameters: - * - `lost`: The "lost account" to be recovered. - * - `rescuer`: The "rescuer account" which can call as the lost account. + * - `account`: The recovered account you are able to call on-behalf-of. * # - * - One storage write O(1) - * - One event + * - One storage mutation to check account is recovered by `who`. O(1) * # **/ - setRecovered: AugmentedSubmittable<(lost: AccountId | string | Uint8Array, rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + cancelRecovered: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Allow a successful rescuer to claim their recovered account. + * The dispatch origin for this call must be _Signed_ and must be a "rescuer" + * who has successfully completed the account recovery process: collected + * `threshold` or more vouches, waited `delay_period` blocks since initiation. + * Parameters: + * - `account`: The lost account that you want to claim has been successfully + * recovered by you. + * # + * Key: F (len of friends in config), V (len of vouching friends) + * - One storage read to get the recovery configuration. O(1), Codec O(F) + * - One storage read to get the active recovery process. O(1), Codec O(V) + * - One storage read to get the current block number. O(1) + * - One storage write. O(1), Codec O(V). + * - One event. + * Total Complexity: O(F + V) + * # + **/ + claimRecovery: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * As the controller of a recoverable account, close an active recovery + * process for your account. + * Payment: By calling this function, the recoverable account will receive + * the recovery deposit `RecoveryDeposit` placed by the rescuer. + * The dispatch origin for this call must be _Signed_ and must be a + * recoverable account with an active recovery process for it. + * Parameters: + * - `rescuer`: The account trying to rescue this recoverable account. + * # + * Key: V (len of vouching friends) + * - One storage read/remove to get the active recovery process. O(1), Codec O(V) + * - One balance call to repatriate reserved. O(X) + * - One event. + * Total Complexity: O(V + X) + * # + **/ + closeRecovery: AugmentedSubmittable<(rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic>; /** * Create a recovery configuration for your account. This makes your account recoverable. * Payment: `ConfigDepositBase` + `FriendDepositFactor` * #_of_friends balance @@ -1746,6 +863,38 @@ declare module '@polkadot/api/types/submittable' { * # **/ initiateRecovery: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Remove the recovery process for your account. Recovered accounts are still accessible. + * NOTE: The user must make sure to call `close_recovery` on all active + * recovery attempts before calling this function else it will fail. + * Payment: By calling this function the recoverable account will unreserve + * their recovery configuration deposit. + * (`ConfigDepositBase` + `FriendDepositFactor` * #_of_friends) + * The dispatch origin for this call must be _Signed_ and must be a + * recoverable account (i.e. has a recovery configuration). + * # + * Key: F (len of friends) + * - One storage read to get the prefix iterator for active recoveries. O(1) + * - One storage read/remove to get the recovery configuration. O(1), Codec O(F) + * - One balance call to unreserved. O(X) + * - One event. + * Total Complexity: O(F + X) + * # + **/ + removeRecovery: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Allow ROOT to bypass the recovery process and set an a rescuer account + * for a lost account directly. + * The dispatch origin for this call must be _ROOT_. + * Parameters: + * - `lost`: The "lost account" to be recovered. + * - `rescuer`: The "rescuer account" which can call as the lost account. + * # + * - One storage write O(1) + * - One event + * # + **/ + setRecovered: AugmentedSubmittable<(lost: AccountId | string | Uint8Array, rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic>; /** * Allow a "friend" of a recoverable account to vouch for an active recovery * process for that account. @@ -1769,73 +918,924 @@ declare module '@polkadot/api/types/submittable' { * # **/ vouchRecovery: AugmentedSubmittable<(lost: AccountId | string | Uint8Array, rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + }; + session: { + [index: string]: SubmittableExtrinsicFunction; /** - * Allow a successful rescuer to claim their recovered account. - * The dispatch origin for this call must be _Signed_ and must be a "rescuer" - * who has successfully completed the account recovery process: collected - * `threshold` or more vouches, waited `delay_period` blocks since initiation. - * Parameters: - * - `account`: The lost account that you want to claim has been successfully - * recovered by you. + * Removes any session key(s) of the function caller. + * This doesn't take effect until the next session. + * The dispatch origin of this function must be signed. * # - * Key: F (len of friends in config), V (len of vouching friends) - * - One storage read to get the recovery configuration. O(1), Codec O(F) - * - One storage read to get the active recovery process. O(1), Codec O(V) + * - O(N) in number of key types. + * - Removes N + 1 DB entries. + * - Reduces system account refs by one on success. + * # + **/ + purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Sets the session key(s) of the function caller to `keys`. + * Allows an account to set its session key prior to becoming a validator. + * This doesn't take effect until the next session. + * The dispatch origin of this function must be signed. + * # + * - O(log n) in number of accounts. + * - One extra DB entry. + * - Increases system account refs by one on success iff there were previously no keys set. + * In this case, purge_keys will need to be called before the account can be removed. + * # + **/ + setKeys: AugmentedSubmittable<(keys: Keys, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic>; + }; + society: { + [index: string]: SubmittableExtrinsicFunction; + /** + * A user outside of the society can make a bid for entry. + * Payment: `CandidateDeposit` will be reserved for making a bid. It is returned + * when the bid becomes a member, or if the bid calls `unbid`. + * The dispatch origin for this call must be _Signed_. + * Parameters: + * - `value`: A one time payment the bid would like to receive when joining the society. + * # + * Key: B (len of bids), C (len of candidates), M (len of members), X (balance reserve) + * - Storage Reads: + * - One storage read to check for suspended candidate. O(1) + * - One storage read to check for suspended member. O(1) + * - One storage read to retrieve all current bids. O(B) + * - One storage read to retrieve all current candidates. O(C) + * - One storage read to retrieve all members. O(M) + * - Storage Writes: + * - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization w/ read) + * - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1) + * - Notable Computation: + * - O(B + C + log M) search to check user is not already a part of society. + * - O(log B) search to insert the new bid sorted. + * - External Module Operations: + * - One balance reserve operation. O(X) + * - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT. + * - Events: + * - One event for new bid. + * - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT. + * Total Complexity: O(M + B + C + logM + logB + X) + * # + **/ + bid: AugmentedSubmittable<(value: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * As a member, vote on the defender. + * The dispatch origin for this call must be _Signed_ and a member. + * Parameters: + * - `approve`: A boolean which says if the candidate should be + * approved (`true`) or rejected (`false`). + * # + * - Key: M (len of members) + * - One storage read O(M) and O(log M) search to check user is a member. + * - One storage write to add vote to votes. O(1) + * - One event. + * Total Complexity: O(M + logM) + * # + **/ + defenderVote: AugmentedSubmittable<(approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; + /** + * Found the society. + * This is done as a discrete action in order to allow for the + * module to be included into a running chain and can only be done once. + * The dispatch origin for this call must be from the _FounderSetOrigin_. + * Parameters: + * - `founder` - The first member and head of the newly founded society. + * - `max_members` - The initial max number of members for the society. + * - `rules` - The rules of this society concerning membership. + * # + * - Two storage mutates to set `Head` and `Founder`. O(1) + * - One storage write to add the first member to society. O(1) + * - One event. + * Total Complexity: O(1) + * # + **/ + found: AugmentedSubmittable<(founder: AccountId | string | Uint8Array, maxMembers: u32 | AnyNumber | Uint8Array, rules: Bytes | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Allow suspended judgement origin to make judgement on a suspended candidate. + * If the judgement is `Approve`, we add them to society as a member with the appropriate + * payment for joining society. + * If the judgement is `Reject`, we either slash the deposit of the bid, giving it back + * to the society treasury, or we ban the voucher from vouching again. + * If the judgement is `Rebid`, we put the candidate back in the bid pool and let them go + * through the induction process again. + * The dispatch origin for this call must be from the _SuspensionJudgementOrigin_. + * Parameters: + * - `who` - The suspended candidate to be judged. + * - `judgement` - `Approve`, `Reject`, or `Rebid`. + * # + * Key: B (len of bids), M (len of members), X (balance action) + * - One storage read to check `who` is a suspended candidate. + * - One storage removal of the suspended candidate. + * - Approve Logic + * - One storage read to get the available pot to pay users with. O(1) + * - One storage write to update the available pot. O(1) * - One storage read to get the current block number. O(1) - * - One storage write. O(1), Codec O(V). - * - One event. - * Total Complexity: O(F + V) + * - One storage read to get all members. O(M) + * - Up to one unreserve currency action. + * - Up to two new storage writes to payouts. + * - Up to one storage write with O(log M) binary search to add a member to society. + * - Reject Logic + * - Up to one repatriate reserved currency action. O(X) + * - Up to one storage write to ban the vouching member from vouching again. + * - Rebid Logic + * - Storage mutate with O(log B) binary search to place the user back into bids. + * - Up to one additional event if unvouch takes place. + * - One storage removal. + * - One event for the judgement. + * Total Complexity: O(M + logM + B + X) * # **/ - claimRecovery: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + judgeSuspendedCandidate: AugmentedSubmittable<(who: AccountId | string | Uint8Array, judgement: SocietyJudgement | ('Rebid' | 'Reject' | 'Approve') | number | Uint8Array) => SubmittableExtrinsic>; /** - * As the controller of a recoverable account, close an active recovery - * process for your account. - * Payment: By calling this function, the recoverable account will receive - * the recovery deposit `RecoveryDeposit` placed by the rescuer. - * The dispatch origin for this call must be _Signed_ and must be a - * recoverable account with an active recovery process for it. + * Allow suspension judgement origin to make judgement on a suspended member. + * If a suspended member is forgiven, we simply add them back as a member, not affecting + * any of the existing storage items for that member. + * If a suspended member is rejected, remove all associated storage items, including + * their payouts, and remove any vouched bids they currently have. + * The dispatch origin for this call must be from the _SuspensionJudgementOrigin_. * Parameters: - * - `rescuer`: The account trying to rescue this recoverable account. + * - `who` - The suspended member to be judged. + * - `forgive` - A boolean representing whether the suspension judgement origin + * forgives (`true`) or rejects (`false`) a suspended member. * # - * Key: V (len of vouching friends) - * - One storage read/remove to get the active recovery process. O(1), Codec O(V) - * - One balance call to repatriate reserved. O(X) - * - One event. - * Total Complexity: O(V + X) + * Key: B (len of bids), M (len of members) + * - One storage read to check `who` is a suspended member. O(1) + * - Up to one storage write O(M) with O(log M) binary search to add a member back to society. + * - Up to 3 storage removals O(1) to clean up a removed member. + * - Up to one storage write O(B) with O(B) search to remove vouched bid from bids. + * - Up to one additional event if unvouch takes place. + * - One storage removal. O(1) + * - One event for the judgement. + * Total Complexity: O(M + logM + B) * # **/ - closeRecovery: AugmentedSubmittable<(rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + judgeSuspendedMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array, forgive: bool | boolean | Uint8Array) => SubmittableExtrinsic>; /** - * Remove the recovery process for your account. Recovered accounts are still accessible. - * NOTE: The user must make sure to call `close_recovery` on all active - * recovery attempts before calling this function else it will fail. - * Payment: By calling this function the recoverable account will unreserve - * their recovery configuration deposit. - * (`ConfigDepositBase` + `FriendDepositFactor` * #_of_friends) - * The dispatch origin for this call must be _Signed_ and must be a - * recoverable account (i.e. has a recovery configuration). + * Transfer the first matured payout for the sender and remove it from the records. + * NOTE: This extrinsic needs to be called multiple times to claim multiple matured payouts. + * Payment: The member will receive a payment equal to their first matured + * payout to their free balance. + * The dispatch origin for this call must be _Signed_ and a member with + * payouts remaining. * # - * Key: F (len of friends) - * - One storage read to get the prefix iterator for active recoveries. O(1) - * - One storage read/remove to get the recovery configuration. O(1), Codec O(F) - * - One balance call to unreserved. O(X) - * - One event. - * Total Complexity: O(F + X) + * Key: M (len of members), P (number of payouts for a particular member) + * - One storage read O(M) and O(log M) search to check signer is a member. + * - One storage read O(P) to get all payouts for a member. + * - One storage read O(1) to get the current block number. + * - One currency transfer call. O(X) + * - One storage write or removal to update the member's payouts. O(P) + * Total Complexity: O(M + logM + P + X) * # **/ - removeRecovery: AugmentedSubmittable<() => SubmittableExtrinsic>; + payout: AugmentedSubmittable<() => SubmittableExtrinsic>; /** - * Cancel the ability to use `as_recovered` for `account`. - * The dispatch origin for this call must be _Signed_ and registered to - * be able to make calls on behalf of the recovered account. + * Allows root origin to change the maximum number of members in society. + * Max membership count must be greater than 1. + * The dispatch origin for this call must be from _ROOT_. * Parameters: - * - `account`: The recovered account you are able to call on-behalf-of. + * - `max` - The maximum number of members for the society. * # - * - One storage mutation to check account is recovered by `who`. O(1) + * - One storage write to update the max. O(1) + * - One event. + * Total Complexity: O(1) * # **/ - cancelRecovered: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + setMaxMembers: AugmentedSubmittable<(max: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * A bidder can remove their bid for entry into society. + * By doing so, they will have their candidate deposit returned or + * they will unvouch their voucher. + * Payment: The bid deposit is unreserved if the user made a bid. + * The dispatch origin for this call must be _Signed_ and a bidder. + * Parameters: + * - `pos`: Position in the `Bids` vector of the bid who wants to unbid. + * # + * Key: B (len of bids), X (balance unreserve) + * - One storage read and write to retrieve and update the bids. O(B) + * - Either one unreserve balance action O(X) or one vouching storage removal. O(1) + * - One event. + * Total Complexity: O(B + X) + * # + **/ + unbid: AugmentedSubmittable<(pos: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Annul the founding of the society. + * The dispatch origin for this call must be Signed, and the signing account must be both + * the `Founder` and the `Head`. This implies that it may only be done when there is one + * member. + * # + * - Two storage reads O(1). + * - Four storage removals O(1). + * - One event. + * Total Complexity: O(1) + * # + **/ + unfound: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * As a vouching member, unvouch a bid. This only works while vouched user is + * only a bidder (and not a candidate). + * The dispatch origin for this call must be _Signed_ and a vouching member. + * Parameters: + * - `pos`: Position in the `Bids` vector of the bid who should be unvouched. + * # + * Key: B (len of bids) + * - One storage read O(1) to check the signer is a vouching member. + * - One storage mutate to retrieve and update the bids. O(B) + * - One vouching storage removal. O(1) + * - One event. + * Total Complexity: O(B) + * # + **/ + unvouch: AugmentedSubmittable<(pos: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * As a member, vote on a candidate. + * The dispatch origin for this call must be _Signed_ and a member. + * Parameters: + * - `candidate`: The candidate that the member would like to bid on. + * - `approve`: A boolean which says if the candidate should be + * approved (`true`) or rejected (`false`). + * # + * Key: C (len of candidates), M (len of members) + * - One storage read O(M) and O(log M) search to check user is a member. + * - One account lookup. + * - One storage read O(C) and O(C) search to check that user is a candidate. + * - One storage write to add vote to votes. O(1) + * - One event. + * Total Complexity: O(M + logM + C) + * # + **/ + vote: AugmentedSubmittable<(candidate: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; + /** + * As a member, vouch for someone to join society by placing a bid on their behalf. + * There is no deposit required to vouch for a new bid, but a member can only vouch for + * one bid at a time. If the bid becomes a suspended candidate and ultimately rejected by + * the suspension judgement origin, the member will be banned from vouching again. + * As a vouching member, you can claim a tip if the candidate is accepted. This tip will + * be paid as a portion of the reward the member will receive for joining the society. + * The dispatch origin for this call must be _Signed_ and a member. + * Parameters: + * - `who`: The user who you would like to vouch for. + * - `value`: The total reward to be paid between you and the candidate if they become + * a member in the society. + * - `tip`: Your cut of the total `value` payout when the candidate is inducted into + * the society. Tips larger than `value` will be saturated upon payout. + * # + * Key: B (len of bids), C (len of candidates), M (len of members) + * - Storage Reads: + * - One storage read to retrieve all members. O(M) + * - One storage read to check member is not already vouching. O(1) + * - One storage read to check for suspended candidate. O(1) + * - One storage read to check for suspended member. O(1) + * - One storage read to retrieve all current bids. O(B) + * - One storage read to retrieve all current candidates. O(C) + * - Storage Writes: + * - One storage write to insert vouching status to the member. O(1) + * - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization w/ read) + * - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1) + * - Notable Computation: + * - O(log M) search to check sender is a member. + * - O(B + C + log M) search to check user is not already a part of society. + * - O(log B) search to insert the new bid sorted. + * - External Module Operations: + * - One balance reserve operation. O(X) + * - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT. + * - Events: + * - One event for vouch. + * - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT. + * Total Complexity: O(M + B + C + logM + logB + X) + * # + **/ + vouch: AugmentedSubmittable<(who: AccountId | string | Uint8Array, value: BalanceOf | AnyNumber | Uint8Array, tip: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + }; + staking: { + [index: string]: SubmittableExtrinsicFunction; + /** + * Take the origin account as a stash and lock up `value` of its balance. `controller` will + * be the account that controls it. + * `value` must be more than the `minimum_balance` specified by `T::Currency`. + * The dispatch origin for this call must be _Signed_ by the stash account. + * # + * - Independent of the arguments. Moderate complexity. + * - O(1). + * - Three extra DB entries. + * NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned unless + * the `origin` falls below _existential deposit_ and gets removed as dust. + * # + **/ + bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic>; + /** + * Add some extra amount that have appeared in the stash `free_balance` into the balance up + * for staking. + * Use this if there are additional funds in your stash account that you wish to bond. + * Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount + * that can be added. + * The dispatch origin for this call must be _Signed_ by the stash, not the controller. + * # + * - Independent of the arguments. Insignificant complexity. + * - O(1). + * - One DB entry. + * # + **/ + bondExtra: AugmentedSubmittable<(maxAdditional: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Cancel enactment of a deferred slash. Can be called by either the root origin or + * the `T::SlashCancelOrigin`. + * passing the era and indices of the slashes for that era to kill. + * # + * - One storage write. + * # + **/ + cancelDeferredSlash: AugmentedSubmittable<(era: EraIndex | AnyNumber | Uint8Array, slashIndices: Vec | (u32 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic>; + /** + * Declare no desire to either validate or nominate. + * Effects will be felt at the beginning of the next era. + * The dispatch origin for this call must be _Signed_ by the controller, not the stash. + * # + * - Independent of the arguments. Insignificant complexity. + * - Contains one read. + * - Writes are limited to the `origin` account key. + * # + **/ + chill: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Force there to be a new era at the end of the next session. After this, it will be + * reset to normal (non-forced) behaviour. + * # + * - No arguments. + * # + **/ + forceNewEra: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Force there to be a new era at the end of sessions indefinitely. + * # + * - One storage write + * # + **/ + forceNewEraAlways: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Force there to be no new eras indefinitely. + * # + * - No arguments. + * # + **/ + forceNoEras: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Force a current staker to become completely unstaked, immediately. + **/ + forceUnstake: AugmentedSubmittable<(stash: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Declare the desire to nominate `targets` for the origin controller. + * Effects will be felt at the beginning of the next era. + * The dispatch origin for this call must be _Signed_ by the controller, not the stash. + * # + * - The transaction's complexity is proportional to the size of `targets`, + * which is capped at `MAX_NOMINATIONS`. + * - Both the reads and writes follow a similar pattern. + * # + **/ + nominate: AugmentedSubmittable<(targets: Vec | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic>; + /** + * Make one nominator's payout for one era. + * - `who` is the controller account of the nominator to pay out. + * - `era` may not be lower than one following the most recently paid era. If it is higher, + * then it indicates an instruction to skip the payout of all previous eras. + * - `validators` is the list of all validators that `who` had exposure to during `era`. + * If it is incomplete, then less than the full reward will be paid out. + * It must not exceed `MAX_NOMINATIONS`. + * WARNING: once an era is payed for a validator such validator can't claim the payout of + * previous era. + * WARNING: Incorrect arguments here can result in loss of payout. Be very careful. + * # + * - Number of storage read of `O(validators)`; `validators` is the argument of the call, + * and is bounded by `MAX_NOMINATIONS`. + * - Each storage read is `O(N)` size and decode complexity; `N` is the maximum + * nominations that can be given to a single validator. + * - Computation complexity: `O(MAX_NOMINATIONS * logN)`; `MAX_NOMINATIONS` is the + * maximum number of validators that may be nominated by a single nominator, it is + * bounded only economically (all nominators are required to place a minimum stake). + * # + **/ + payoutNominator: AugmentedSubmittable<(era: EraIndex | AnyNumber | Uint8Array, validators: Vec> | ([AccountId | string | Uint8Array, u32 | AnyNumber | Uint8Array])[]) => SubmittableExtrinsic>; + /** + * Make one validator's payout for one era. + * - `who` is the controller account of the validator to pay out. + * - `era` may not be lower than one following the most recently paid era. If it is higher, + * then it indicates an instruction to skip the payout of all previous eras. + * WARNING: once an era is payed for a validator such validator can't claim the payout of + * previous era. + * WARNING: Incorrect arguments here can result in loss of payout. Be very careful. + * # + * - Time complexity: O(1). + * - Contains a limited number of reads and writes. + * # + **/ + payoutValidator: AugmentedSubmittable<(era: EraIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Remove all data structure concerning a staker/stash once its balance is zero. + * This is essentially equivalent to `withdraw_unbonded` except it can be called by anyone + * and the target `stash` must have no funds left. + * This can be called from any origin. + * - `stash`: The stash account to reap. Its balance must be zero. + **/ + reapStash: AugmentedSubmittable<(stash: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Rebond a portion of the stash scheduled to be unlocked. + * # + * - Time complexity: O(1). Bounded by `MAX_UNLOCKING_CHUNKS`. + * - Storage changes: Can't increase storage, only decrease it. + * # + **/ + rebond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * (Re-)set the controller of a stash. + * Effects will be felt at the beginning of the next era. + * The dispatch origin for this call must be _Signed_ by the stash, not the controller. + * # + * - Independent of the arguments. Insignificant complexity. + * - Contains a limited number of reads. + * - Writes are limited to the `origin` account key. + * # + **/ + setController: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set history_depth value. + * Origin must be root. + **/ + setHistoryDepth: AugmentedSubmittable<(newHistoryDepth: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the validators who cannot be slashed (if any). + **/ + setInvulnerables: AugmentedSubmittable<(validators: Vec | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic>; + /** + * (Re-)set the payment target for a controller. + * Effects will be felt at the beginning of the next era. + * The dispatch origin for this call must be _Signed_ by the controller, not the stash. + * # + * - Independent of the arguments. Insignificant complexity. + * - Contains a limited number of reads. + * - Writes are limited to the `origin` account key. + * # + **/ + setPayee: AugmentedSubmittable<(payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic>; + /** + * The ideal number of validators. + **/ + setValidatorCount: AugmentedSubmittable<(updated: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Schedule a portion of the stash to be unlocked ready for transfer out after the bond + * period ends. If this leaves an amount actively bonded less than + * T::Currency::minimum_balance(), then it is increased to the full amount. + * Once the unlock period is done, you can call `withdraw_unbonded` to actually move + * the funds out of management ready for transfer. + * No more than a limited number of unlocking chunks (see `MAX_UNLOCKING_CHUNKS`) + * can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need + * to be called first to remove some of the chunks (if possible). + * The dispatch origin for this call must be _Signed_ by the controller, not the stash. + * See also [`Call::withdraw_unbonded`]. + * # + * - Independent of the arguments. Limited but potentially exploitable complexity. + * - Contains a limited number of reads. + * - Each call (requires the remainder of the bonded balance to be above `minimum_balance`) + * will cause a new entry to be inserted into a vector (`Ledger.unlocking`) kept in storage. + * The only way to clean the aforementioned storage item is also user-controlled via + * `withdraw_unbonded`. + * - One DB entry. + * + **/ + unbond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Declare the desire to validate for the origin controller. + * Effects will be felt at the beginning of the next era. + * The dispatch origin for this call must be _Signed_ by the controller, not the stash. + * # + * - Independent of the arguments. Insignificant complexity. + * - Contains a limited number of reads. + * - Writes are limited to the `origin` account key. + * # + **/ + validate: AugmentedSubmittable<(prefs: ValidatorPrefs | { commission?: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Remove any unlocked chunks from the `unlocking` queue from our management. + * This essentially frees up that balance to be used by the stash account to do + * whatever it wants. + * The dispatch origin for this call must be _Signed_ by the controller, not the stash. + * See also [`Call::unbond`]. + * # + * - Could be dependent on the `origin` argument and how much `unlocking` chunks exist. + * It implies `consolidate_unlocked` which loops over `Ledger.unlocking`, which is + * indirectly user-controlled. See [`unbond`] for more detail. + * - Contains a limited number of reads, yet the size of which could be large based on `ledger`. + * - Writes are limited to the `origin` account key. + * # + **/ + withdrawUnbonded: AugmentedSubmittable<() => SubmittableExtrinsic>; + }; + sudo: { + [index: string]: SubmittableExtrinsicFunction; + /** + * Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key. + * The dispatch origin for this call must be _Signed_. + * # + * - O(1). + * - Limited storage reads. + * - One DB change. + * # + **/ + setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Authenticates the sudo key and dispatches a function call with `Root` origin. + * The dispatch origin for this call must be _Signed_. + * # + * - O(1). + * - Limited storage reads. + * - One DB write (event). + * - Weight of derivative `call` execution + 10,000. + * # + **/ + sudo: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Authenticates the sudo key and dispatches a function call with `Signed` origin from + * a given account. + * The dispatch origin for this call must be _Signed_. + * # + * - O(1). + * - Limited storage reads. + * - One DB write (event). + * - Weight of derivative `call` execution + 10,000. + * # + **/ + sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + }; + system: { + [index: string]: SubmittableExtrinsicFunction; + /** + * A dispatch that will fill the block weight up to the given ratio. + **/ + fillBlock: AugmentedSubmittable<(ratio: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Kill all storage items with a key that starts with the given prefix. + **/ + killPrefix: AugmentedSubmittable<(prefix: Key | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Kill some items from storage. + **/ + killStorage: AugmentedSubmittable<(keys: Vec | (Key | string | Uint8Array)[]) => SubmittableExtrinsic>; + /** + * Make some on-chain remark. + **/ + remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the new changes trie configuration. + **/ + setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the new runtime code. + **/ + setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the new runtime code without doing any checks of the given `code`. + **/ + setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the number of pages in the WebAssembly environment's heap. + **/ + setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Set some items of storage. + **/ + setStorage: AugmentedSubmittable<(items: Vec | (KeyValue)[]) => SubmittableExtrinsic>; + /** + * Kill the sending account, assuming there are no references outstanding and the composite + * data is equal to its default value. + **/ + suicide: AugmentedSubmittable<() => SubmittableExtrinsic>; + }; + technicalCommittee: { + [index: string]: SubmittableExtrinsicFunction; + /** + * May be called by any signed account after the voting duration has ended in order to + * finish voting and close the proposal. + * Abstentions are counted as rejections unless there is a prime member set and the prime + * member cast an approval. + * - the weight of `proposal` preimage. + * - up to three events deposited. + * - one read, two removals, one mutation. (plus three static reads.) + * - computation and i/o `O(P + L + M)` where: + * - `M` is number of members, + * - `P` is number of active proposals, + * - `L` is the encoded length of `proposal` preimage. + **/ + close: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Dispatch a proposal from a member using the `Member` origin. + * Origin must be a member of the collective. + **/ + execute: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * # + * - Bounded storage reads and writes. + * - Argument `threshold` has bearing on weight. + * # + **/ + propose: AugmentedSubmittable<(threshold: Compact | AnyNumber | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Set the collective's membership. + * - `new_members`: The new member list. Be nice to the chain and + * - `prime`: The prime member whose vote sets the default. + * Requires root origin. + **/ + setMembers: AugmentedSubmittable<(newMembers: Vec | (AccountId | string | Uint8Array)[], prime: Option | null | object | string | Uint8Array) => SubmittableExtrinsic>; + /** + * # + * - Bounded storage read and writes. + * - Will be slightly heavier if the proposal is approved / disapproved after the vote. + * # + **/ + vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic>; + }; + technicalMembership: { + [index: string]: SubmittableExtrinsicFunction; + /** + * Add a member `who` to the set. + * May only be called from `AddOrigin` or root. + **/ + addMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Swap out the sending member for some other key `new`. + * May only be called from `Signed` origin of a current member. + * Prime membership is passed from the origin account to `new`, if extant. + **/ + changeKey: AugmentedSubmittable<(updated: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Remove the prime member if it exists. + **/ + clearPrime: AugmentedSubmittable<() => SubmittableExtrinsic>; + /** + * Remove a member `who` from the set. + * May only be called from `RemoveOrigin` or root. + **/ + removeMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Change the membership to a new set, disregarding the existing membership. Be nice and + * pass `members` pre-sorted. + * May only be called from `ResetOrigin` or root. + **/ + resetMembers: AugmentedSubmittable<(members: Vec | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic>; + /** + * Set the prime member. Must be a current member. + **/ + setPrime: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Swap out one member `remove` for another `add`. + * May only be called from `SwapOrigin` or root. + * Prime membership is *not* passed from `remove` to `add`, if extant. + **/ + swapMember: AugmentedSubmittable<(remove: AccountId | string | Uint8Array, add: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + }; + timestamp: { + [index: string]: SubmittableExtrinsicFunction; + /** + * Set the current time. + * This call should be invoked exactly once per block. It will panic at the finalization + * phase, if this call hasn't been invoked by that time. + * The timestamp should be greater than the previous one by the amount specified by + * `MinimumPeriod`. + * The dispatch origin for this call must be `Inherent`. + **/ + set: AugmentedSubmittable<(now: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + }; + treasury: { + [index: string]: SubmittableExtrinsicFunction; + /** + * Approve a proposal. At a later time, the proposal will be allocated to the beneficiary + * and the original deposit will be returned. + * # + * - O(1). + * - Limited storage reads. + * - One DB change. + * # + **/ + approveProposal: AugmentedSubmittable<(proposalId: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Close and payout a tip. + * The dispatch origin for this call must be _Signed_. + * The tip identified by `hash` must have finished its countdown period. + * - `hash`: The identity of the open tip for which a tip value is declared. This is formed + * as the hash of the tuple of the original tip `reason` and the beneficiary account ID. + * # + * - `O(T)` + * - One storage retrieval (codec `O(T)`) and two removals. + * - Up to three balance operations. + * # + **/ + closeTip: AugmentedSubmittable<(hash: Hash | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Put forward a suggestion for spending. A deposit proportional to the value + * is reserved and slashed if the proposal is rejected. It is returned once the + * proposal is awarded. + * # + * - O(1). + * - Limited storage reads. + * - One DB change, one extra DB entry. + * # + **/ + proposeSpend: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Reject a proposed spend. The original deposit will be slashed. + * # + * - O(1). + * - Limited storage reads. + * - One DB clear. + * # + **/ + rejectProposal: AugmentedSubmittable<(proposalId: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Report something `reason` that deserves a tip and claim any eventual the finder's fee. + * The dispatch origin for this call must be _Signed_. + * Payment: `TipReportDepositBase` will be reserved from the origin account, as well as + * `TipReportDepositPerByte` for each byte in `reason`. + * - `reason`: The reason for, or the thing that deserves, the tip; generally this will be + * a UTF-8-encoded URL. + * - `who`: The account which should be credited for the tip. + * Emits `NewTip` if successful. + * # + * - `O(R)` where `R` length of `reason`. + * - One balance operation. + * - One storage mutation (codec `O(R)`). + * - One event. + * # + **/ + reportAwesome: AugmentedSubmittable<(reason: Bytes | string | Uint8Array, who: AccountId | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Retract a prior tip-report from `report_awesome`, and cancel the process of tipping. + * If successful, the original deposit will be unreserved. + * The dispatch origin for this call must be _Signed_ and the tip identified by `hash` + * must have been reported by the signing account through `report_awesome` (and not + * through `tip_new`). + * - `hash`: The identity of the open tip for which a tip value is declared. This is formed + * as the hash of the tuple of the original tip `reason` and the beneficiary account ID. + * Emits `TipRetracted` if successful. + * # + * - `O(T)` + * - One balance operation. + * - Two storage removals (one read, codec `O(T)`). + * - One event. + * # + **/ + retractTip: AugmentedSubmittable<(hash: Hash | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Declare a tip value for an already-open tip. + * The dispatch origin for this call must be _Signed_ and the signing account must be a + * member of the `Tippers` set. + * - `hash`: The identity of the open tip for which a tip value is declared. This is formed + * as the hash of the tuple of the hash of the original tip `reason` and the beneficiary + * account ID. + * - `tip_value`: The amount of tip that the sender would like to give. The median tip + * value of active tippers will be given to the `who`. + * Emits `TipClosing` if the threshold of tippers has been reached and the countdown period + * has started. + * # + * - `O(T)` + * - One storage mutation (codec `O(T)`), one storage read `O(1)`. + * - Up to one event. + * # + **/ + tip: AugmentedSubmittable<(hash: Hash | string | Uint8Array, tipValue: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + /** + * Give a tip for something new; no finder's fee will be taken. + * The dispatch origin for this call must be _Signed_ and the signing account must be a + * member of the `Tippers` set. + * - `reason`: The reason for, or the thing that deserves, the tip; generally this will be + * a UTF-8-encoded URL. + * - `who`: The account which should be credited for the tip. + * - `tip_value`: The amount of tip that the sender would like to give. The median tip + * value of active tippers will be given to the `who`. + * Emits `NewTip` if successful. + * # + * - `O(R + T)` where `R` length of `reason`, `T` is the number of tippers. `T` is + * naturally capped as a membership set, `R` is limited through transaction-size. + * - Two storage insertions (codecs `O(R)`, `O(T)`), one read `O(1)`. + * - One event. + * # + **/ + tipNew: AugmentedSubmittable<(reason: Bytes | string | Uint8Array, who: AccountId | string | Uint8Array, tipValue: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic>; + }; + utility: { + [index: string]: SubmittableExtrinsicFunction; + /** + * Register approval for a dispatch to be made from a deterministic composite account if + * approved by a total of `threshold - 1` of `other_signatories`. + * Payment: `MultisigDepositBase` will be reserved if this is the first approval, plus + * `threshold` times `MultisigDepositFactor`. It is returned once this dispatch happens or + * is cancelled. + * The dispatch origin for this call must be _Signed_. + * - `threshold`: The total number of approvals for this dispatch before it is executed. + * - `other_signatories`: The accounts (other than the sender) who can approve this + * dispatch. May not be empty. + * - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is + * not the first approval, then it must be `Some`, with the timepoint (block number and + * transaction index) of the first approval transaction. + * - `call_hash`: The hash of the call to be executed. + * NOTE: If this is the final approval, you will want to use `as_multi` instead. + * # + * - `O(S)`. + * - Up to one balance-reserve or unreserve operation. + * - One passthrough operation, one insert, both `O(S)` where `S` is the number of + * signatories. `S` is capped by `MaxSignatories`, with weight being proportional. + * - One encode & hash, both of complexity `O(S)`. + * - Up to one binary search and insert (`O(logS + S)`). + * - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. + * - One event. + * - Storage: inserts one item, value size bounded by `MaxSignatories`, with a + * deposit taken for its lifetime of + * `MultisigDepositBase + threshold * MultisigDepositFactor`. + * # + **/ + approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec | (AccountId | string | Uint8Array)[], maybeTimepoint: Option | null | object | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Register approval for a dispatch to be made from a deterministic composite account if + * approved by a total of `threshold - 1` of `other_signatories`. + * If there are enough, then dispatch the call. + * Payment: `MultisigDepositBase` will be reserved if this is the first approval, plus + * `threshold` times `MultisigDepositFactor`. It is returned once this dispatch happens or + * is cancelled. + * The dispatch origin for this call must be _Signed_. + * - `threshold`: The total number of approvals for this dispatch before it is executed. + * - `other_signatories`: The accounts (other than the sender) who can approve this + * dispatch. May not be empty. + * - `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is + * not the first approval, then it must be `Some`, with the timepoint (block number and + * transaction index) of the first approval transaction. + * - `call`: The call to be executed. + * NOTE: Unless this is the final approval, you will generally want to use + * `approve_as_multi` instead, since it only requires a hash of the call. + * Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise + * on success, result is `Ok` and the result from the interior call, if it was executed, + * may be found in the deposited `MultisigExecuted` event. + * # + * - `O(S + Z + Call)`. + * - Up to one balance-reserve or unreserve operation. + * - One passthrough operation, one insert, both `O(S)` where `S` is the number of + * signatories. `S` is capped by `MaxSignatories`, with weight being proportional. + * - One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len. + * - One encode & hash, both of complexity `O(S)`. + * - Up to one binary search and insert (`O(logS + S)`). + * - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. + * - One event. + * - The weight of the `call`. + * - Storage: inserts one item, value size bounded by `MaxSignatories`, with a + * deposit taken for its lifetime of + * `MultisigDepositBase + threshold * MultisigDepositFactor`. + * # + **/ + asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec | (AccountId | string | Uint8Array)[], maybeTimepoint: Option | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Send a call through an indexed pseudonym of the sender. + * The dispatch origin for this call must be _Signed_. + * # + * - The weight of the `call` + 10,000. + * # + **/ + asSub: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic>; + /** + * Send a batch of dispatch calls. + * This will execute until the first one fails and then stop. + * May be called from any origin. + * - `calls`: The calls to be dispatched from the same origin. + * # + * - The sum of the weights of the `calls`. + * - One event. + * # + * This will return `Ok` in all circumstances. To determine the success of the batch, an + * event is deposited. If a call failed and the batch was interrupted, then the + * `BatchInterrupted` event is deposited, along with the number of successful calls made + * and the error of the failed call. If all were successful, then the `BatchCompleted` + * event is deposited. + **/ + batch: AugmentedSubmittable<(calls: Vec | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic>; + /** + * Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously + * for this operation will be unreserved on success. + * The dispatch origin for this call must be _Signed_. + * - `threshold`: The total number of approvals for this dispatch before it is executed. + * - `other_signatories`: The accounts (other than the sender) who can approve this + * dispatch. May not be empty. + * - `timepoint`: The timepoint (block number and transaction index) of the first approval + * transaction for this dispatch. + * - `call_hash`: The hash of the call to be executed. + * # + * - `O(S)`. + * - Up to one balance-reserve or unreserve operation. + * - One passthrough operation, one insert, both `O(S)` where `S` is the number of + * signatories. `S` is capped by `MaxSignatories`, with weight being proportional. + * - One encode & hash, both of complexity `O(S)`. + * - One event. + * - I/O: 1 read `O(S)`, one remove. + * - Storage: removes one item. + * # + **/ + cancelAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec | (AccountId | string | Uint8Array)[], timepoint: Timepoint | { height?: any; index?: any } | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic>; }; vesting: { [index: string]: SubmittableExtrinsicFunction; diff --git a/packages/metadata/src/Decorated/storage/fromMetadata/getHasher.ts b/packages/metadata/src/Decorated/storage/fromMetadata/getHasher.ts index f8f76e9942..1dc3e66b94 100644 --- a/packages/metadata/src/Decorated/storage/fromMetadata/getHasher.ts +++ b/packages/metadata/src/Decorated/storage/fromMetadata/getHasher.ts @@ -2,6 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import metadataDefs from '@polkadot/types/interfaces/metadata/definitions'; import { StorageHasher } from '@polkadot/types/interfaces'; import { u8aConcat, u8aToU8a } from '@polkadot/util'; import { blake2AsU8a, xxhashAsU8a } from '@polkadot/util-crypto'; @@ -10,24 +11,26 @@ export type HasherInput = string | Buffer | Uint8Array; export type HasherFunction = (data: HasherInput) => Uint8Array; -type HasherCheck = 'isBlake2128' | 'isBlake2128Concat' | 'isBlake2256' | 'isTwox128' | 'isTwox256' | 'isTwox64Concat'; +const DEFAULT_FN = (data: HasherInput): Uint8Array => xxhashAsU8a(data, 128); -const DEFAULT = (data: HasherInput): Uint8Array => xxhashAsU8a(data, 128); - -const map: Record = { - isBlake2128: (data: HasherInput): Uint8Array => blake2AsU8a(data, 128), - isBlake2128Concat: (data: HasherInput): Uint8Array => u8aConcat(blake2AsU8a(data, 128), u8aToU8a(data)), - isBlake2256: (data: HasherInput): Uint8Array => blake2AsU8a(data, 256), - isTwox128: (data: HasherInput): Uint8Array => xxhashAsU8a(data, 128), - isTwox256: (data: HasherInput): Uint8Array => xxhashAsU8a(data, 256), - isTwox64Concat: (data: HasherInput): Uint8Array => u8aConcat(xxhashAsU8a(data, 64), u8aToU8a(data)) +const HASHERS: Record = { + Blake2_128: (data: HasherInput): Uint8Array => // eslint-disable-line @typescript-eslint/camelcase + blake2AsU8a(data, 128), + Blake2_128Concat: (data: HasherInput): Uint8Array => // eslint-disable-line @typescript-eslint/camelcase + u8aConcat(blake2AsU8a(data, 128), u8aToU8a(data)), + Blake2_256: (data: HasherInput): Uint8Array => // eslint-disable-line @typescript-eslint/camelcase + blake2AsU8a(data, 256), + Identity: (data: HasherInput): Uint8Array => + u8aToU8a(data), + Twox128: (data: HasherInput): Uint8Array => + xxhashAsU8a(data, 128), + Twox256: (data: HasherInput): Uint8Array => + xxhashAsU8a(data, 256), + Twox64Concat: (data: HasherInput): Uint8Array => + u8aConcat(xxhashAsU8a(data, 64), u8aToU8a(data)) }; /** @internal */ export default function getHasher (hasher?: StorageHasher): HasherFunction { - const [, fn] = (hasher && Object.entries(map).find(([check]): boolean => - hasher[check as HasherCheck] - )) || [undefined, DEFAULT]; - - return fn; + return HASHERS[hasher?.type as 'Identity'] || DEFAULT_FN; } diff --git a/packages/typegen/src/generate/consts.ts b/packages/typegen/src/generate/consts.ts index 1fb0db7b4b..cc89f9da5a 100644 --- a/packages/typegen/src/generate/consts.ts +++ b/packages/typegen/src/generate/consts.ts @@ -25,7 +25,7 @@ function generateModule (allDefs: object, { constants, name }: ModuleMetadataLat return [indent(4)(`${stringCamelCase(name.toString())}: {`)] .concat(isStrict ? '' : indent(6)('[index: string]: AugmentedConst;')) - .concat(constants.map(({ documentation, name, type }): string => { + .concat(constants.sort((a, b) => a.name.localeCompare(b.name.toString())).map(({ documentation, name, type }): string => { setImports(allDefs, imports, [type.toString()]); return createDocComments(6, documentation) + @@ -42,7 +42,7 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: Record { return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs); }, {}); - const body = meta.asLatest.modules.reduce((acc, mod): string[] => { + const body = meta.asLatest.modules.sort((a, b) => a.name.localeCompare(b.name.toString())).reduce((acc, mod): string[] => { return acc.concat(generateModule(allDefs, mod, imports, isStrict)); }, [] as string[]); const header = createImportCode(HEADER('chain'), imports, [ diff --git a/packages/typegen/src/generate/query.ts b/packages/typegen/src/generate/query.ts index bf61ca691c..a39b540fc0 100644 --- a/packages/typegen/src/generate/query.ts +++ b/packages/typegen/src/generate/query.ts @@ -69,7 +69,7 @@ function generateModule (allDefs: object, registry: Registry, { name, storage }: return [indent(4)(`${stringLowerFirst(name.toString())}: {`)] .concat(isStrict ? '' : indent(6)('[index: string]: QueryableStorageEntry;')) - .concat(storage.unwrap().items.map((storageEntry): string => { + .concat(storage.unwrap().items.sort((a, b) => a.name.localeCompare(b.name.toString())).map((storageEntry): string => { const [args, returnType] = entrySignature(allDefs, registry, storageEntry, imports); let entryType = 'AugmentedQuery'; @@ -91,7 +91,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => { return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs); }, {}); - const body = meta.asLatest.modules.reduce((acc: string[], mod): string[] => { + const body = meta.asLatest.modules.sort((a, b) => a.name.localeCompare(b.name.toString())).reduce((acc: string[], mod): string[] => { return acc.concat(generateModule(allDefs, registry, mod, imports, isStrict)); }, []); const header = createImportCode(HEADER('chain'), imports, [ diff --git a/packages/typegen/src/generate/tx.ts b/packages/typegen/src/generate/tx.ts index e9f66f3ca2..b3d2d97e30 100644 --- a/packages/typegen/src/generate/tx.ts +++ b/packages/typegen/src/generate/tx.ts @@ -38,7 +38,7 @@ function generateModule (registry: Registry, allDefs: object, { calls, name }: M return [indent(4)(`${stringCamelCase(name.toString())}: {`)] .concat(isStrict ? '' : indent(6)('[index: string]: SubmittableExtrinsicFunction;')) - .concat(allCalls.map(({ args, documentation, name }): string => { + .concat(allCalls.sort((a, b) => a.name.localeCompare(b.name.toString())).map(({ args, documentation, name }): string => { const params = args .map(({ name, type }): [string, string, string] => { const typeStr = type.toString(); @@ -66,7 +66,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => { return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs); }, {}); - const body = meta.asLatest.modules.reduce((acc, mod): string[] => { + const body = meta.asLatest.modules.sort((a, b) => a.name.localeCompare(b.name.toString())).reduce((acc, mod): string[] => { return acc.concat(generateModule(registry, allDefs, mod, imports, isStrict)); }, [] as string[]); const header = createImportCode(HEADER('chain'), imports, [ diff --git a/packages/types/src/interfaces/metadata/definitions.ts b/packages/types/src/interfaces/metadata/definitions.ts index ea5c5f9ea9..e6adea2fa4 100644 --- a/packages/types/src/interfaces/metadata/definitions.ts +++ b/packages/types/src/interfaces/metadata/definitions.ts @@ -431,7 +431,13 @@ export default { }, // v11 - DoubleMapTypeV11: 'DoubleMapTypeV10', + DoubleMapTypeV11: { + hasher: 'StorageHasherV11', + key1: 'Type', + key2: 'Type', + value: 'Type', + key2Hasher: 'StorageHasherV11' + }, ErrorMetadataV11: 'ErrorMetadataV10', EventMetadataV11: 'EventMetadataV10', ExtrinsicMetadataV11: { @@ -440,19 +446,57 @@ export default { }, FunctionArgumentMetadataV11: 'FunctionArgumentMetadataV10', FunctionMetadataV11: 'FunctionMetadataV10', - MapTypeV11: 'MapTypeV10', + MapTypeV11: { + hasher: 'StorageHasherV11', + key: 'Type', + value: 'Type', + linked: 'bool' + }, MetadataV11: { modules: 'Vec', extrinsic: 'ExtrinsicMetadataV11' }, ModuleConstantMetadataV11: 'ModuleConstantMetadataV10', - ModuleMetadataV11: 'ModuleMetadataV10', + ModuleMetadataV11: { + name: 'Text', + storage: 'Option', + calls: 'Option>', + events: 'Option>', + constants: 'Vec', + errors: 'Vec' + }, PlainTypeV11: 'Type', StorageEntryModifierV11: 'StorageEntryModifierV10', - StorageEntryMetadataV11: 'StorageEntryMetadataV10', - StorageEntryTypeV11: 'StorageEntryTypeV10', - StorageMetadataV11: 'StorageMetadataV10', - StorageHasherV11: 'StorageHasherV10', + StorageEntryMetadataV11: { + name: 'Text', + modifier: 'StorageEntryModifierV11', + type: 'StorageEntryTypeV11', + fallback: 'Bytes', + documentation: 'Vec' + }, + StorageEntryTypeV11: { + _enum: { + Plain: 'PlainTypeV11', + Map: 'MapTypeV11', + DoubleMap: 'DoubleMapTypeV11' + } + }, + StorageMetadataV11: { + prefix: 'Text', + items: 'Vec' + }, + StorageHasherV11: { + _enum: { + Blake2_128: null, // eslint-disable-line @typescript-eslint/camelcase + Blake2_256: null, // eslint-disable-line @typescript-eslint/camelcase + Blake2_128Concat: null, // eslint-disable-line @typescript-eslint/camelcase + Twox128: null, + Twox256: null, + Twox64Concat: null, + // new in v11 + Identity: null + } + }, // This always maps to the latest DoubleMapTypeLatest: 'DoubleMapTypeV11', diff --git a/packages/types/src/interfaces/metadata/types.ts b/packages/types/src/interfaces/metadata/types.ts index 8c65093b95..194e04fdf0 100644 --- a/packages/types/src/interfaces/metadata/types.ts +++ b/packages/types/src/interfaces/metadata/types.ts @@ -24,7 +24,13 @@ export interface DoubleMapTypeV10 extends Struct { } /** @name DoubleMapTypeV11 */ -export interface DoubleMapTypeV11 extends DoubleMapTypeV10 {} +export interface DoubleMapTypeV11 extends Struct { + readonly hasher: StorageHasherV11; + readonly key1: Type; + readonly key2: Type; + readonly value: Type; + readonly key2Hasher: StorageHasherV11; +} /** @name DoubleMapTypeV3 */ export interface DoubleMapTypeV3 extends Struct { @@ -239,7 +245,12 @@ export interface MapTypeV10 extends Struct { } /** @name MapTypeV11 */ -export interface MapTypeV11 extends MapTypeV10 {} +export interface MapTypeV11 extends Struct { + readonly hasher: StorageHasherV11; + readonly key: Type; + readonly value: Type; + readonly linked: bool; +} /** @name MapTypeV2 */ export interface MapTypeV2 extends Struct { @@ -421,7 +432,14 @@ export interface ModuleMetadataV10 extends Struct { } /** @name ModuleMetadataV11 */ -export interface ModuleMetadataV11 extends ModuleMetadataV10 {} +export interface ModuleMetadataV11 extends Struct { + readonly name: Text; + readonly storage: Option; + readonly calls: Option>; + readonly events: Option>; + readonly constants: Vec; + readonly errors: Vec; +} /** @name ModuleMetadataV2 */ export interface ModuleMetadataV2 extends Struct { @@ -572,7 +590,13 @@ export interface StorageEntryMetadataV10 extends Struct { } /** @name StorageEntryMetadataV11 */ -export interface StorageEntryMetadataV11 extends StorageEntryMetadataV10 {} +export interface StorageEntryMetadataV11 extends Struct { + readonly name: Text; + readonly modifier: StorageEntryModifierV11; + readonly type: StorageEntryTypeV11; + readonly fallback: Bytes; + readonly documentation: Vec; +} /** @name StorageEntryMetadataV6 */ export interface StorageEntryMetadataV6 extends StorageFunctionMetadataV5 {} @@ -621,7 +645,14 @@ export interface StorageEntryTypeV10 extends Enum { } /** @name StorageEntryTypeV11 */ -export interface StorageEntryTypeV11 extends StorageEntryTypeV10 {} +export interface StorageEntryTypeV11 extends Enum { + readonly isPlain: boolean; + readonly asPlain: PlainTypeV11; + readonly isMap: boolean; + readonly asMap: MapTypeV11; + readonly isDoubleMap: boolean; + readonly asDoubleMap: DoubleMapTypeV11; +} /** @name StorageEntryTypeV6 */ export interface StorageEntryTypeV6 extends StorageFunctionTypeV5 {} @@ -768,7 +799,15 @@ export interface StorageHasherV10 extends Enum { } /** @name StorageHasherV11 */ -export interface StorageHasherV11 extends StorageHasherV10 {} +export interface StorageHasherV11 extends Enum { + readonly isBlake2128: boolean; + readonly isBlake2256: boolean; + readonly isBlake2128Concat: boolean; + readonly isTwox128: boolean; + readonly isTwox256: boolean; + readonly isTwox64Concat: boolean; + readonly isIdentity: boolean; +} /** @name StorageHasherV4 */ export interface StorageHasherV4 extends Enum { @@ -810,7 +849,10 @@ export interface StorageMetadataV10 extends Struct { } /** @name StorageMetadataV11 */ -export interface StorageMetadataV11 extends StorageMetadataV10 {} +export interface StorageMetadataV11 extends Struct { + readonly prefix: Text; + readonly items: Vec; +} /** @name StorageMetadataV7 */ export interface StorageMetadataV7 extends Struct { diff --git a/packages/types/src/primitive/StorageKey.ts b/packages/types/src/primitive/StorageKey.ts index 86385ef02b..c67e635d0d 100644 --- a/packages/types/src/primitive/StorageKey.ts +++ b/packages/types/src/primitive/StorageKey.ts @@ -32,39 +32,45 @@ interface StorageKeyExtra { section: string; } -// order important, matching enum -const HASHER_MAP: Record = { +const HASHER_MAP: Record = { + // opaque Blake2_128: [16, false], // eslint-disable-line @typescript-eslint/camelcase Blake2_256: [32, false], // eslint-disable-line @typescript-eslint/camelcase - Blake2_128Concat: [16, true], // eslint-disable-line @typescript-eslint/camelcase Twox128: [16, false], Twox256: [32, false], - Twox64Concat: [8, true] -}; -const HASHER_OPTS = Object.values(HASHER_MAP); -function getStorageType (type: StorageEntryTypeLatest): string { + // can decode + Blake2_128Concat: [16, true], // eslint-disable-line @typescript-eslint/camelcase + Twox64Concat: [8, true], + Identity: [0, true] +}; + +function getStorageType (type: StorageEntryTypeLatest, isOptionalLinked?: boolean): [boolean, string] { if (type.isPlain) { - return type.asPlain.toString() as keyof InterfaceTypes; + return [false, type.asPlain.toString()]; } else if (type.isDoubleMap) { - return type.asDoubleMap.value.toString() as keyof InterfaceTypes; + return [false, type.asDoubleMap.value.toString()]; } const map = type.asMap; if (map.linked.isTrue) { - return `(${map.value.toString()}, Linkage<${map.key.toString()}>)` as keyof InterfaceTypes; + const [pre, post] = isOptionalLinked + ? ['Option<', '>'] + : ['', '']; + + return [true, `(${pre}${map.value.toString()}${post}, Linkage<${map.key.toString()}>)`]; } - return map.value.toString(); + return [false, map.value.toString()]; } // we unwrap the type here, turning into an output usable for createType /** @internal */ export function unwrapStorageType (type: StorageEntryTypeLatest, isOptional?: boolean): keyof InterfaceTypes { - const outputType = getStorageType(type); + const [hasWrapper, outputType] = getStorageType(type, isOptional); - return isOptional + return isOptional && !hasWrapper ? `Option<${outputType}>` as keyof InterfaceTypes : outputType as keyof InterfaceTypes; } @@ -104,14 +110,13 @@ function decodeStorageKey (value?: AnyU8a | StorageKey | StorageEntry | [Storage function decodeHashers (registry: Registry, value: Uint8Array, hashers: [StorageHasher, string][]): Codec[] { // the storage entry is xxhashAsU8a(prefix, 128) + xxhashAsU8a(method, 128), 256 bits total - const encoded = value.subarray(32); - let offset = 0; + let offset = 32; return hashers.reduce((result: Codec[], [hasher, type]): Codec[] => { - const [hashLen, canDecode] = HASHER_OPTS[hasher.index]; + const [hashLen, canDecode] = HASHER_MAP[hasher.type as 'Identity']; const decoded = canDecode - ? registry.createType(type as 'Raw', encoded.subarray(offset + hashLen)) - : registry.createType('Raw', encoded.subarray(offset, offset + hashLen)); + ? registry.createType(type as 'Raw', value.subarray(offset + hashLen)) + : registry.createType('Raw', value.subarray(offset, offset + hashLen)); offset += hashLen + (canDecode ? decoded.encodedLength : 0); result.push(decoded);