Compare commits

..
44 Commits
Author SHA1 Message Date
github-actions[bot] e16786a5f6 [CI Skip] release/stable 7.1.1
skip-checks: true
2021-12-26 08:41:55 +00:00
Jaco e388e473be 7.1.1 (#4396)
* 7.1.1

* Ensure all deps are fixed
2021-12-26 10:32:49 +02:00
github-actions[bot] 029c4d7f7f [CI Skip] release/beta 7.0.3-15
skip-checks: true
2021-12-26 08:12:45 +00:00
Jaco 5d6c2dd9f2 DRY cleanups for contracts (#4395) 2021-12-26 10:03:28 +02:00
github-actions[bot] ade5dc45d1 [CI Skip] release/beta 7.0.3-14
skip-checks: true
2021-12-25 10:22:06 +00:00
Jaco 8e578a643a Bump berry (#4394) 2021-12-25 12:14:04 +02:00
github-actions[bot] 8a67405fd7 [CI Skip] release/beta 7.0.3-13
skip-checks: true
2021-12-25 07:19:29 +00:00
Jaco 851bbe4cc6 Use assertReturn as applicable (#4393) 2021-12-25 09:09:13 +02:00
github-actions[bot] 0fec7506b7 [CI Skip] release/beta 7.0.3-12
skip-checks: true
2021-12-25 06:24:04 +00:00
Jaco 63b80b823e Metadata bump (#4392) 2021-12-25 08:16:30 +02:00
github-actions[bot] d3f9cdbec3 [CI Skip] release/beta 7.0.3-11
skip-checks: true
2021-12-24 14:49:31 +00:00
Jaco 6de4293f9f Remove @polkadot/ts dependency (#4391)
* Remove @polkadot/ts dependency

* Remove VoidCallback

* Bump dev
2021-12-24 16:42:12 +02:00
github-actions[bot] e1d2e2c7d5 [CI Skip] release/beta 7.0.3-10
skip-checks: true
2021-12-24 13:31:06 +00:00
Jaco 11f8cb6cfa Align types-augment with api-augment (#4390)
* Align types-augment with api-augment

* Adjust CHANGELOG

* Dependencies

* Definitions

* Adjust dependencies
2021-12-24 15:22:15 +02:00
github-actions[bot] 2f0fecf89b [CI Skip] release/beta 7.0.3-9
skip-checks: true
2021-12-24 12:08:09 +00:00
Jaco acfb193270 Provide polkadot/kusama augmentation (#4388)
* Provide polkadot/kusama augmentation

* Generate all

* Dev dump

* Build kusama/polkadot with no augmentation overlaps

* CHANGELOG
2021-12-24 14:01:05 +02:00
github-actions[bot] ccd4de824f [CI Skip] release/beta 7.0.3-8
skip-checks: true
2021-12-24 07:16:30 +00:00
Jaco 9800a3b55d Expose txHash on submittable results (#4387)
* Expose txHash on submittable results

* CHANGELOG

* CHANGELOG
2021-12-24 09:08:56 +02:00
github-actions[bot] 938eb7d390 [CI Skip] release/beta 7.0.3-7
skip-checks: true
2021-12-23 09:52:10 +00:00
Jaco d0b4542c94 Align query name generation (#4383) 2021-12-23 11:44:36 +02:00
github-actions[bot] bb2833ae51 [CI Skip] release/beta 7.0.3-6
skip-checks: true
2021-12-23 09:40:18 +00:00
Jaco cfff5b6be6 Dev w/ checks for tsconfig.spec.json (#4384)
* Dev w/ checks for tsconfig.spec.json

* bump
2021-12-23 11:30:19 +02:00
github-actions[bot] d29d1df84b [CI Skip] release/beta 7.0.3-5
skip-checks: true
2021-12-23 07:03:09 +00:00
Jaco 79cca97c03 Dev bump (w/ types key in export map) (#4382) 2021-12-23 08:55:32 +02:00
github-actions[bot] a807ab6b04 [CI Skip] release/beta 7.0.3-4
skip-checks: true
2021-12-22 14:37:03 +00:00
Jaco 517a4d1f09 Extended tsconfig lint cleanups (#4379) 2021-12-22 16:29:42 +02:00
github-actions[bot] e19eeb8a60 [CI Skip] release/beta 7.0.3-3
skip-checks: true
2021-12-22 09:45:51 +00:00
Jaco 1af5fb35bc Additional Option tests (#4378) 2021-12-22 11:35:45 +02:00
github-actions[bot] adbc1799a2 [CI Skip] release/beta 7.0.3-2
skip-checks: true
2021-12-22 07:20:59 +00:00
Jaco f51dbd7df9 Fix jest alias config (#4377)
* Fix jest alias config

* Dedupe
2021-12-22 09:12:02 +02:00
github-actions[bot] f11c8f9360 [CI Skip] release/beta 7.0.3-1
skip-checks: true
2021-12-21 17:11:21 +00:00
Jaco 46fdc22201 Split registry & lookup augmentation (#4376)
* Split registry & lookup augmentation

* Fix package path

* Adjust CC paths, fix detectPackage

* Adjust rollup config

* Adjust rollup in-process packages

* Re-adjust rollup (OCD...)
2021-12-21 19:02:38 +02:00
github-actions[bot] 2ba4233645 [CI Skip] release/beta 7.0.3-0
skip-checks: true
2021-12-21 11:18:15 +00:00
Keith Ingram a868233c2f Storage deposit limit changes (#4370) 2021-12-21 13:09:37 +02:00
github-actions[bot] a7752f3c18 [CI Skip] release/stable 7.0.2
skip-checks: true
2021-12-21 08:41:54 +00:00
Jaco 3a06775f9f 7.0.2 (#4375) 2021-12-21 10:34:28 +02:00
github-actions[bot] 936b5d9b72 [CI Skip] release/beta 7.0.2-3
skip-checks: true
2021-12-21 08:26:30 +00:00
Jaco 523f1622b5 Collective aliases (don't apply to derive naming) (#4374)
* Collective aliases (don't apply to derive naming)

* Fix build (aka new form apply to prime)
2021-12-21 10:17:41 +02:00
github-actions[bot] a2c027b7b7 [CI Skip] release/beta 7.0.2-2
skip-checks: true
2021-12-21 08:16:23 +00:00
Jaco d13f66eb5b Prep for preimage pallet usage (#4372)
* Prep for preimage pallet usage

* info uses derives

* adjust
2021-12-21 10:07:13 +02:00
github-actions[bot] 9f400ea15c [CI Skip] release/beta 7.0.2-1
skip-checks: true
2021-12-21 06:42:37 +00:00
Jaco c0e841031a Update Substrate metadata & scheduler usage (#4371) 2021-12-21 08:33:23 +02:00
github-actions[bot] 34f6b7b560 [CI Skip] release/beta 7.0.2-0
skip-checks: true
2021-12-20 16:05:36 +00:00
Jaco 55fe455713 Small import cleanups (#4368) 2021-12-20 17:58:16 +02:00
151 changed files with 27013 additions and 5126 deletions
+3 -1
View File
@@ -45,4 +45,6 @@
6.7.2
6.9.2
6.10.2
6.10.3
6.10.3
7.0.2
+1
View File
@@ -20,6 +20,7 @@ exclude_patterns:
- "docs/**/*.js"
- "docs/**/*.ts"
- "packages/*-augment/"
- "packages/*-augment-*/"
- "packages/typegen/scripts"
- "packages/typegen/src"
- "packages/types/src/interfaces/"
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-631
View File
File diff suppressed because one or more lines are too long
+768
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.0.1.cjs
yarnPath: .yarn/releases/yarn-3.1.1.cjs
+29
View File
@@ -1,5 +1,34 @@
# CHANGELOG
## 7.1.1 Dev 26, 2021
Upgrade priority: Low. Recommended for users of contracts form Substrate master & Polkador/Kusama TS app developers where specific chain augmentation would be helpful.
Contributed:
- Expose `storageDepositLimit` on contract options (Thanks to https://github.com/kwingram25)
Changes:
- Expose `@polkadot/api-augment/{kusama, polkadot, substrate}` for specific augmentations (The bare `@polkadot/api-augment` is equivalent to `/substrate`, keeping the existing behavior)
- Expose `@polkadot/types-augment/{lookup, registry}` variants (The bare `@polkadot/types-augment` applies both)
- Expose `txHash` on submittable results, e.g. `tx.signAndSend(..., ({ txHash }) => ...)`
- Align casing for TS & exposed queries (adjusts for `ALLCAPS` entries)
- Additional tests for `Option` codec (explicit in expectations)
- Update to latest Substrate, Kusama & Polkadot static metadata
## 7.0.2 Dec 21, 2021
Upgrade priority: Low. Recommended for applications where collective derives with aliasses are being used.
Changes:
- Fix alias module mapping in collective derives
- Update `dispathchQueue` derive to align with latest Substrate
- Update to latest Substrate metadata
## 7.0.1 Dec 20, 2021
Upgrade priority: Low. Recommended for TS users with their own non-Polkadot/Kusama chains.
+1 -1
View File
@@ -11,7 +11,7 @@ module.exports = {
'@polkadot/api(.*)$': '<rootDir>/packages/api/src/$1',
'@polkadot/rpc-(augment|core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
'@polkadot/types-(augment|codec|create|known|support)(.*)$': '<rootDir>/packages/types-$1/src/$2',
'@polkadot/types-(augment-lookup|augment-registry|augment|codec|create|known|support)(.*)$': '<rootDir>/packages/types-$1/src/$2',
// eslint-disable-next-line sort-keys
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
},
+2 -3
View File
@@ -11,7 +11,7 @@
},
"sideEffects": false,
"type": "commonjs",
"version": "7.0.1",
"version": "7.1.1",
"workspaces": [
"packages/*"
],
@@ -34,8 +34,7 @@
"@babel/core": "^7.16.5",
"@babel/register": "^7.16.5",
"@babel/runtime": "^7.16.5",
"@polkadot/dev": "^0.64.8",
"@polkadot/ts": "^0.4.20",
"@polkadot/dev": "^0.64.22",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.0.3",
"copyfiles": "^2.4.1"
+6 -6
View File
@@ -20,15 +20,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/api-base": "7.0.1",
"@polkadot/rpc-augment": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/types-augment": "7.0.1",
"@polkadot/types-codec": "7.0.1",
"@polkadot/api-base": "7.1.1",
"@polkadot/rpc-augment": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-augment": "7.1.1",
"@polkadot/types-codec": "7.1.1",
"@polkadot/util": "^8.2.2"
}
}
@@ -4,9 +4,3 @@
// for the API, we decorate not only the endpoints, but all types
import '@polkadot/rpc-augment';
import '@polkadot/types-augment';
// the augmentated types (on top of @polkadot/api-base)
import './consts';
import './errors';
import './events';
import './query';
import './tx';
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './augment';
import './substrate';
export { packageInfo } from './packageInfo';
+896
View File
@@ -0,0 +1,896 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Bytes, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types';
import type { Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> {
auctions: {
/**
* The number of blocks over which an auction may be retroactively ended.
**/
endingPeriod: u32 & AugmentedConst<ApiType>;
leasePeriodsPerSlot: u32 & AugmentedConst<ApiType>;
/**
* The length of each sample to take during the ending period.
*
* `EndingPeriod` / `SampleLength` = Total # of Samples
**/
sampleLength: u32 & AugmentedConst<ApiType>;
slotRangeCount: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
authorship: {
/**
* The number of blocks back we should accept uncles.
* This means that we will deal with uncle-parents that are
* `UncleGenerations + 1` before `now`.
**/
uncleGenerations: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
babe: {
/**
* The amount of time, in slots, that each epoch should last.
* NOTE: Currently it is not possible to change the epoch duration after
* the chain has started. Attempting to do so will brick block production.
**/
epochDuration: u64 & AugmentedConst<ApiType>;
/**
* The expected average block time at which BABE should be creating
* blocks. Since BABE is probabilistic it is not trivial to figure out
* what the expected average block time should be based on the slot
* duration and the security parameter `c` (where `1 - c` represents
* the probability of a slot being empty).
**/
expectedBlockTime: u64 & AugmentedConst<ApiType>;
/**
* Max number of authorities allowed
**/
maxAuthorities: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
bagsList: {
/**
* The list of thresholds separating the various bags.
*
* Ids are separated into unsorted bags according to their vote weight. This specifies the
* thresholds separating the bags. An id's bag is the largest bag for which the id's weight
* is less than or equal to its upper threshold.
*
* When ids are iterated, higher bags are iterated completely before lower bags. This means
* that iteration is _semi-sorted_: ids of higher weight tend to come before ids of lower
* weight, but peer ids within a particular bag are sorted in insertion order.
*
* # Expressing the constant
*
* This constant must be sorted in strictly increasing order. Duplicate items are not
* permitted.
*
* There is an implied upper limit of `VoteWeight::MAX`; that value does not need to be
* specified within the bag. For any two threshold lists, if one ends with
* `VoteWeight::MAX`, the other one does not, and they are otherwise equal, the two lists
* will behave identically.
*
* # Calculation
*
* It is recommended to generate the set of thresholds in a geometric series, such that
* there exists some constant ratio such that `threshold[k + 1] == (threshold[k] *
* constant_ratio).max(threshold[k] + 1)` for all `k`.
*
* The helpers in the `/utils/frame/generate-bags` module can simplify this calculation.
*
* # Examples
*
* - If `BagThresholds::get().is_empty()`, then all ids are put into the same bag, and
* iteration is strictly in insertion order.
* - If `BagThresholds::get().len() == 64`, and the thresholds are determined according to
* the procedure given above, then the constant ratio is equal to 2.
* - If `BagThresholds::get().len() == 200`, and the thresholds are determined according to
* the procedure given above, then the constant ratio is approximately equal to 1.248.
* - If the threshold list begins `[1, 2, 3, ...]`, then an id with weight 0 or 1 will fall
* into bag 0, an id with weight 2 will fall into bag 1, etc.
*
* # Migration
*
* In the event that this list ever changes, a copy of the old bags list must be retained.
* With that `List::migrate` can be called, which will perform the appropriate migration.
**/
bagThresholds: Vec<u64> & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
balances: {
/**
* The minimum amount required to keep an account open.
**/
existentialDeposit: u128 & AugmentedConst<ApiType>;
/**
* The maximum number of locks that should exist on an account.
* Not strictly enforced, but used for weight estimation.
**/
maxLocks: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of named reserves that can exist on an account.
**/
maxReserves: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
bounties: {
/**
* Percentage of the curator fee that will be reserved upfront as deposit for bounty
* curator.
**/
bountyCuratorDeposit: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a bounty proposal.
**/
bountyDepositBase: u128 & AugmentedConst<ApiType>;
/**
* The delay period for which a bounty beneficiary need to wait before claim the payout.
**/
bountyDepositPayoutDelay: u32 & AugmentedConst<ApiType>;
/**
* Bounty duration in blocks.
**/
bountyUpdatePeriod: u32 & AugmentedConst<ApiType>;
/**
* Minimum value for a bounty.
**/
bountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* The amount held on deposit per byte within the tip report reason or bounty description.
**/
dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/**
* Maximum acceptable reason length.
*
* Benchmarks depend on this value, be sure to update weights file when changing this value
**/
maximumReasonLength: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
claims: {
prefix: Bytes & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
crowdloan: {
/**
* The minimum amount that may be contributed into a crowdloan. Should almost certainly be at
* least `ExistentialDeposit`.
**/
minContribution: u128 & AugmentedConst<ApiType>;
/**
* `PalletId` for the crowdloan pallet. An appropriate value could be `PalletId(*b"py/cfund")`
**/
palletId: FrameSupportPalletId & AugmentedConst<ApiType>;
/**
* Max number of storage keys to remove per extrinsic call.
**/
removeKeysLimit: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
democracy: {
/**
* Period in blocks where an external proposal may not be re-submitted after being vetoed.
**/
cooloffPeriod: u32 & AugmentedConst<ApiType>;
/**
* The period between a proposal being approved and enacted.
*
* It should generally be a little more than the unstake period to ensure that
* voting stakers have an opportunity to remove themselves from the system in the case
* where they are on the losing side of a vote.
**/
enactmentPeriod: u32 & AugmentedConst<ApiType>;
/**
* Minimum voting period allowed for a fast-track referendum.
**/
fastTrackVotingPeriod: u32 & AugmentedConst<ApiType>;
/**
* Indicator for whether an emergency origin is even allowed to happen. Some chains may
* want to set this permanently to `false`, others may want to condition it on things such
* as an upgrade having happened recently.
**/
instantAllowed: bool & AugmentedConst<ApiType>;
/**
* How often (in blocks) new public referenda are launched.
**/
launchPeriod: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of public proposals that can exist at any time.
**/
maxProposals: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of votes for an account.
*
* Also used to compute weight, an overly big value can
* lead to extrinsic with very big weight: see `delegate` for instance.
**/
maxVotes: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount to be used as a deposit for a public referendum proposal.
**/
minimumDeposit: u128 & AugmentedConst<ApiType>;
/**
* The amount of balance that must be deposited per byte of preimage stored.
**/
preimageByteDeposit: u128 & AugmentedConst<ApiType>;
/**
* The minimum period of vote locking.
*
* It should be no shorter than enactment period to ensure that in the case of an approval,
* those successful voters are locked into the consequences that their votes entail.
**/
voteLockingPeriod: u32 & AugmentedConst<ApiType>;
/**
* How often (in blocks) to check for new votes.
**/
votingPeriod: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
electionProviderMultiPhase: {
/**
* Maximum length (bytes) that the mined solution should consume.
*
* The miner will ensure that the total length of the unsigned solution will not exceed
* this value.
**/
minerMaxLength: u32 & AugmentedConst<ApiType>;
/**
* Maximum weight that the miner should consume.
*
* The miner will ensure that the total weight of the unsigned solution will not exceed
* this value, based on [`WeightInfo::submit_unsigned`].
**/
minerMaxWeight: u64 & AugmentedConst<ApiType>;
/**
* The priority of the unsigned transaction submitted in the unsigned-phase
**/
minerTxPriority: u64 & AugmentedConst<ApiType>;
/**
* The repeat threshold of the offchain worker.
*
* For example, if it is 5, that means that at least 5 blocks will elapse between attempts
* to submit the worker's solution.
**/
offchainRepeat: u32 & AugmentedConst<ApiType>;
/**
* Base deposit for a signed solution.
**/
signedDepositBase: u128 & AugmentedConst<ApiType>;
/**
* Per-byte deposit for a signed solution.
**/
signedDepositByte: u128 & AugmentedConst<ApiType>;
/**
* Per-weight deposit for a signed solution.
**/
signedDepositWeight: u128 & AugmentedConst<ApiType>;
/**
* Maximum number of signed submissions that can be queued.
*
* It is best to avoid adjusting this during an election, as it impacts downstream data
* structures. In particular, `SignedSubmissionIndices<T>` is bounded on this value. If you
* update this value during an election, you _must_ ensure that
* `SignedSubmissionIndices.len()` is less than or equal to the new value. Otherwise,
* attempts to submit new solutions may cause a runtime panic.
**/
signedMaxSubmissions: u32 & AugmentedConst<ApiType>;
/**
* Maximum weight of a signed solution.
*
* This should probably be similar to [`Config::MinerMaxWeight`].
**/
signedMaxWeight: u64 & AugmentedConst<ApiType>;
/**
* Duration of the signed phase.
**/
signedPhase: u32 & AugmentedConst<ApiType>;
/**
* Base reward for a signed solution
**/
signedRewardBase: u128 & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" (in any phase).
**/
solutionImprovementThreshold: Perbill & AugmentedConst<ApiType>;
/**
* Duration of the unsigned phase.
**/
unsignedPhase: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of voters to put in the snapshot. At the moment, snapshots are only
* over a single block, but once multi-block elections are introduced they will take place
* over multiple blocks.
*
* Also, note the data type: If the voters are represented by a `u32` in `type
* CompactSolution`, the same `u32` is used here to ensure bounds are respected.
**/
voterSnapshotPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
gilt: {
/**
* Portion of the queue which is free from ordering and just a FIFO.
*
* Must be no greater than `MaxQueueLen`.
**/
fifoQueueLen: u32 & AugmentedConst<ApiType>;
/**
* The number of blocks between consecutive attempts to issue more gilts in an effort to
* get to the target amount to be frozen.
*
* A larger value results in fewer storage hits each block, but a slower period to get to
* the target.
**/
intakePeriod: u32 & AugmentedConst<ApiType>;
/**
* The maximum amount of bids that can be turned into issued gilts each block. A larger
* value here means less of the block available for transactions should there be a glut of
* bids to make into gilts to reach the target.
**/
maxIntakeBids: u32 & AugmentedConst<ApiType>;
/**
* Maximum number of items that may be in each duration queue.
**/
maxQueueLen: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount of funds that may be offered to freeze for a gilt. Note that this
* does not actually limit the amount which may be frozen in a gilt since gilts may be
* split up in order to satisfy the desired amount of funds under gilts.
*
* It should be at least big enough to ensure that there is no possible storage spam attack
* or queue-filling attack.
**/
minFreeze: u128 & AugmentedConst<ApiType>;
/**
* The base period for the duration queues. This is the common multiple across all
* supported freezing durations that can be bid upon.
**/
period: u32 & AugmentedConst<ApiType>;
/**
* Number of duration queues in total. This sets the maximum duration supported, which is
* this value multiplied by `Period`.
**/
queueCount: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
grandpa: {
/**
* Max Authorities in use
**/
maxAuthorities: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
identity: {
/**
* The amount held on deposit for a registered identity
**/
basicDeposit: u128 & AugmentedConst<ApiType>;
/**
* The amount held on deposit per additional field for a registered identity.
**/
fieldDeposit: u128 & AugmentedConst<ApiType>;
/**
* Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O
* required to access an identity, but can be pretty high.
**/
maxAdditionalFields: u32 & AugmentedConst<ApiType>;
/**
* Maxmimum number of registrars allowed in the system. Needed to bound the complexity
* of, e.g., updating judgements.
**/
maxRegistrars: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of sub-accounts allowed per identified account.
**/
maxSubAccounts: u32 & AugmentedConst<ApiType>;
/**
* The amount held on deposit for a registered subaccount. This should account for the fact
* that one storage item's value will increase by the size of an account ID, and there will
* be another trie item whose value is the size of an account ID plus 32 bytes.
**/
subAccountDeposit: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
imOnline: {
/**
* A configuration for base priority of unsigned transactions.
*
* This is exposed so that it can be tuned for particular runtime, when
* multiple pallets send unsigned transactions.
**/
unsignedPriority: u64 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
indices: {
/**
* The deposit needed for reserving an index.
**/
deposit: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
multisig: {
/**
* The base amount of currency needed to reserve for creating a multisig execution or to
* store a dispatch call for later.
*
* This is held for an additional storage item whose value size is
* `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is
* `32 + sizeof(AccountId)` bytes.
**/
depositBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of currency needed per unit threshold when creating a multisig execution.
*
* This is held for adding 32 bytes more into a pre-existing storage value.
**/
depositFactor: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of signatories allowed in the multisig.
**/
maxSignatories: u16 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
paras: {
unsignedPriority: u64 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
phragmenElection: {
/**
* How much should be locked up in order to submit one's candidacy.
**/
candidacyBond: u128 & AugmentedConst<ApiType>;
/**
* Number of members to elect.
**/
desiredMembers: u32 & AugmentedConst<ApiType>;
/**
* Number of runners_up to keep.
**/
desiredRunnersUp: u32 & AugmentedConst<ApiType>;
/**
* Identifier for the elections-phragmen pallet's lock
**/
palletId: U8aFixed & AugmentedConst<ApiType>;
/**
* How long each seat is kept. This defines the next block number at which an election
* round will happen. If set to zero, no elections are ever triggered and the module will
* be in passive mode.
**/
termDuration: u32 & AugmentedConst<ApiType>;
/**
* Base deposit associated with voting.
*
* This should be sensibly high to economically ensure the pallet cannot be attacked by
* creating a gigantic number of votes.
**/
votingBondBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of bond that need to be locked for each vote (32 bytes).
**/
votingBondFactor: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
proxy: {
/**
* The base amount of currency needed to reserve for creating an announcement.
*
* This is held when a new storage item holding a `Balance` is created (typically 16
* bytes).
**/
announcementDepositBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of currency needed per announcement made.
*
* This is held for adding an `AccountId`, `Hash` and `BlockNumber` (typically 68 bytes)
* into a pre-existing storage value.
**/
announcementDepositFactor: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of time-delayed announcements that are allowed to be pending.
**/
maxPending: u32 & AugmentedConst<ApiType>;
/**
* The maximum amount of proxies allowed for a single account.
**/
maxProxies: u32 & AugmentedConst<ApiType>;
/**
* The base amount of currency needed to reserve for creating a proxy.
*
* This is held for an additional storage item whose value size is
* `sizeof(Balance)` bytes and whose key size is `sizeof(AccountId)` bytes.
**/
proxyDepositBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of currency needed per proxy added.
*
* This is held for adding 32 bytes plus an instance of `ProxyType` more into a
* pre-existing storage value. Thus, when configuring `ProxyDepositFactor` one should take
* into account `32 + proxy_type.encode().len()` bytes of data.
**/
proxyDepositFactor: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
recovery: {
/**
* The base amount of currency needed to reserve for creating a recovery configuration.
*
* This is held for an additional storage item whose value size is
* `2 + sizeof(BlockNumber, Balance)` bytes.
**/
configDepositBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of currency needed per additional user when creating a recovery
* configuration.
*
* This is held for adding `sizeof(AccountId)` bytes more into a pre-existing storage
* value.
**/
friendDepositFactor: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of friends allowed in a recovery configuration.
**/
maxFriends: u16 & AugmentedConst<ApiType>;
/**
* The base amount of currency needed to reserve for starting a recovery.
*
* This is primarily held for deterring malicious recovery attempts, and should
* have a value large enough that a bad actor would choose not to place this
* deposit. It also acts to fund additional storage item whose value size is
* `sizeof(BlockNumber, Balance + T * AccountId)` bytes. Where T is a configurable
* threshold.
**/
recoveryDeposit: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
registrar: {
/**
* The deposit to be paid per byte stored on chain.
**/
dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/**
* The deposit to be paid to run a parathread.
* This should include the cost for storing the genesis head and validation code.
**/
paraDeposit: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
scheduler: {
/**
* The maximum weight that may be scheduled per block for any dispatchables of less
* priority than `schedule::HARD_DEADLINE`.
**/
maximumWeight: u64 & AugmentedConst<ApiType>;
/**
* The maximum number of scheduled calls in the queue for a single block.
* Not strictly enforced, but used for weight estimation.
**/
maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
slots: {
/**
* The number of blocks to offset each lease period by.
**/
leaseOffset: u32 & AugmentedConst<ApiType>;
/**
* The number of blocks over which a single period lasts.
**/
leasePeriod: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
society: {
/**
* The minimum amount of a deposit required for a bid to be made.
**/
candidateDeposit: u128 & AugmentedConst<ApiType>;
/**
* The number of blocks between membership challenges.
**/
challengePeriod: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of candidates that we accept per round.
**/
maxCandidateIntake: u32 & AugmentedConst<ApiType>;
/**
* The maximum duration of the payout lock.
**/
maxLockDuration: u32 & AugmentedConst<ApiType>;
/**
* The number of times a member may vote the wrong way (or not at all, when they are a
* skeptic) before they become suspended.
**/
maxStrikes: u32 & AugmentedConst<ApiType>;
/**
* The societies's pallet id
**/
palletId: FrameSupportPalletId & AugmentedConst<ApiType>;
/**
* The amount of incentive paid within each period. Doesn't include VoterTip.
**/
periodSpend: u128 & AugmentedConst<ApiType>;
/**
* The number of blocks between candidate/membership rotation periods.
**/
rotationPeriod: u32 & AugmentedConst<ApiType>;
/**
* The amount of the unpaid reward that gets deducted in the case that either a skeptic
* doesn't vote or someone votes in the wrong way.
**/
wrongSideDeduction: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
staking: {
/**
* Number of eras that staked funds must remain bonded for.
**/
bondingDuration: u32 & AugmentedConst<ApiType>;
maxNominations: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of nominators rewarded for each validator.
*
* For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can
* claim their reward. This used to limit the i/o cost for the nominator payout.
**/
maxNominatorRewardedPerValidator: u32 & AugmentedConst<ApiType>;
/**
* Number of sessions per era.
**/
sessionsPerEra: u32 & AugmentedConst<ApiType>;
/**
* Number of eras that slashes are deferred by, after computation.
*
* This should be less than the bonding duration. Set to 0 if slashes
* should be applied immediately, without opportunity for intervention.
**/
slashDeferDuration: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
system: {
/**
* Maximum number of block number to block hash mappings to keep (oldest pruned first).
**/
blockHashCount: u32 & AugmentedConst<ApiType>;
/**
* The maximum length of a block (in bytes).
**/
blockLength: FrameSystemLimitsBlockLength & AugmentedConst<ApiType>;
/**
* Block & extrinsics weights: base values and limits.
**/
blockWeights: FrameSystemLimitsBlockWeights & AugmentedConst<ApiType>;
/**
* The weight of runtime database operations the runtime can invoke.
**/
dbWeight: FrameSupportWeightsRuntimeDbWeight & AugmentedConst<ApiType>;
/**
* The designated SS85 prefix of this chain.
*
* This replaces the "ss58Format" property declared in the chain spec. Reason is
* that the runtime should know about the prefix in order to make use of it as
* an identifier of the chain.
**/
ss58Prefix: u16 & AugmentedConst<ApiType>;
/**
* Get the chain's current version.
**/
version: SpVersionRuntimeVersion & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
timestamp: {
/**
* 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: u64 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
tips: {
/**
* The amount held on deposit per byte within the tip report reason or bounty description.
**/
dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/**
* Maximum acceptable reason length.
*
* Benchmarks depend on this value, be sure to update weights file when changing this value
**/
maximumReasonLength: u32 & AugmentedConst<ApiType>;
/**
* The period for which a tip remains open after is has achieved threshold tippers.
**/
tipCountdown: u32 & AugmentedConst<ApiType>;
/**
* The percent of the final tip which goes to the original reporter of the tip.
**/
tipFindersFee: Percent & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a tip report.
**/
tipReportDepositBase: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
transactionPayment: {
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
*
* This value is multipled by the `final_fee` to obtain a "virtual tip" that is later
* added to a tip component in regular `priority` calculations.
* It means that a `Normal` transaction can front-run a similarly-sized `Operational`
* extrinsic (with no tip), by including a tip value greater than the virtual tip.
*
* ```rust,ignore
* // For `Normal`
* let priority = priority_calc(tip);
*
* // For `Operational`
* let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier;
* let priority = priority_calc(tip + virtual_tip);
* ```
*
* Note that since we use `final_fee` the multiplier applies also to the regular `tip`
* sent with the transaction. So, not only does the transaction get a priority bump based
* on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational`
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
weightToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
treasury: {
/**
* Percentage of spare funds (if any) that are burnt per spend period.
**/
burn: Permill & AugmentedConst<ApiType>;
/**
* The maximum number of approvals that can wait in the spending queue.
**/
maxApprovals: u32 & AugmentedConst<ApiType>;
/**
* The treasury's pallet id, used for deriving its sovereign account ID.
**/
palletId: FrameSupportPalletId & AugmentedConst<ApiType>;
/**
* Fraction of a proposal's value that should be bonded in order to place the proposal.
* An accepted proposal gets these back. A rejected proposal does not.
**/
proposalBond: Permill & AugmentedConst<ApiType>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
proposalBondMinimum: u128 & AugmentedConst<ApiType>;
/**
* Period between successive spends.
**/
spendPeriod: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
utility: {
/**
* The limit on the number of batched calls.
**/
batchedCallsLimit: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
vesting: {
maxVestingSchedules: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount transferred to call `vested_transfer`.
**/
minVestedTransfer: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
} // AugmentedConsts
} // declare module
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../base';
import './consts';
import './errors';
import './events';
import './query';
import './tx';
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-augment', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/api-augment', version: '7.1.1' };
+768
View File
@@ -0,0 +1,768 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Bytes, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types';
import type { Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> {
auctions: {
/**
* The number of blocks over which an auction may be retroactively ended.
**/
endingPeriod: u32 & AugmentedConst<ApiType>;
leasePeriodsPerSlot: u32 & AugmentedConst<ApiType>;
/**
* The length of each sample to take during the ending period.
*
* `EndingPeriod` / `SampleLength` = Total # of Samples
**/
sampleLength: u32 & AugmentedConst<ApiType>;
slotRangeCount: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
authorship: {
/**
* The number of blocks back we should accept uncles.
* This means that we will deal with uncle-parents that are
* `UncleGenerations + 1` before `now`.
**/
uncleGenerations: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
babe: {
/**
* The amount of time, in slots, that each epoch should last.
* NOTE: Currently it is not possible to change the epoch duration after
* the chain has started. Attempting to do so will brick block production.
**/
epochDuration: u64 & AugmentedConst<ApiType>;
/**
* The expected average block time at which BABE should be creating
* blocks. Since BABE is probabilistic it is not trivial to figure out
* what the expected average block time should be based on the slot
* duration and the security parameter `c` (where `1 - c` represents
* the probability of a slot being empty).
**/
expectedBlockTime: u64 & AugmentedConst<ApiType>;
/**
* Max number of authorities allowed
**/
maxAuthorities: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
bagsList: {
/**
* The list of thresholds separating the various bags.
*
* Ids are separated into unsorted bags according to their vote weight. This specifies the
* thresholds separating the bags. An id's bag is the largest bag for which the id's weight
* is less than or equal to its upper threshold.
*
* When ids are iterated, higher bags are iterated completely before lower bags. This means
* that iteration is _semi-sorted_: ids of higher weight tend to come before ids of lower
* weight, but peer ids within a particular bag are sorted in insertion order.
*
* # Expressing the constant
*
* This constant must be sorted in strictly increasing order. Duplicate items are not
* permitted.
*
* There is an implied upper limit of `VoteWeight::MAX`; that value does not need to be
* specified within the bag. For any two threshold lists, if one ends with
* `VoteWeight::MAX`, the other one does not, and they are otherwise equal, the two lists
* will behave identically.
*
* # Calculation
*
* It is recommended to generate the set of thresholds in a geometric series, such that
* there exists some constant ratio such that `threshold[k + 1] == (threshold[k] *
* constant_ratio).max(threshold[k] + 1)` for all `k`.
*
* The helpers in the `/utils/frame/generate-bags` module can simplify this calculation.
*
* # Examples
*
* - If `BagThresholds::get().is_empty()`, then all ids are put into the same bag, and
* iteration is strictly in insertion order.
* - If `BagThresholds::get().len() == 64`, and the thresholds are determined according to
* the procedure given above, then the constant ratio is equal to 2.
* - If `BagThresholds::get().len() == 200`, and the thresholds are determined according to
* the procedure given above, then the constant ratio is approximately equal to 1.248.
* - If the threshold list begins `[1, 2, 3, ...]`, then an id with weight 0 or 1 will fall
* into bag 0, an id with weight 2 will fall into bag 1, etc.
*
* # Migration
*
* In the event that this list ever changes, a copy of the old bags list must be retained.
* With that `List::migrate` can be called, which will perform the appropriate migration.
**/
bagThresholds: Vec<u64> & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
balances: {
/**
* The minimum amount required to keep an account open.
**/
existentialDeposit: u128 & AugmentedConst<ApiType>;
/**
* The maximum number of locks that should exist on an account.
* Not strictly enforced, but used for weight estimation.
**/
maxLocks: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of named reserves that can exist on an account.
**/
maxReserves: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
bounties: {
/**
* Percentage of the curator fee that will be reserved upfront as deposit for bounty
* curator.
**/
bountyCuratorDeposit: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a bounty proposal.
**/
bountyDepositBase: u128 & AugmentedConst<ApiType>;
/**
* The delay period for which a bounty beneficiary need to wait before claim the payout.
**/
bountyDepositPayoutDelay: u32 & AugmentedConst<ApiType>;
/**
* Bounty duration in blocks.
**/
bountyUpdatePeriod: u32 & AugmentedConst<ApiType>;
/**
* Minimum value for a bounty.
**/
bountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* The amount held on deposit per byte within the tip report reason or bounty description.
**/
dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/**
* Maximum acceptable reason length.
*
* Benchmarks depend on this value, be sure to update weights file when changing this value
**/
maximumReasonLength: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
claims: {
prefix: Bytes & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
crowdloan: {
/**
* The minimum amount that may be contributed into a crowdloan. Should almost certainly be at
* least `ExistentialDeposit`.
**/
minContribution: u128 & AugmentedConst<ApiType>;
/**
* `PalletId` for the crowdloan pallet. An appropriate value could be `PalletId(*b"py/cfund")`
**/
palletId: FrameSupportPalletId & AugmentedConst<ApiType>;
/**
* Max number of storage keys to remove per extrinsic call.
**/
removeKeysLimit: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
democracy: {
/**
* Period in blocks where an external proposal may not be re-submitted after being vetoed.
**/
cooloffPeriod: u32 & AugmentedConst<ApiType>;
/**
* The period between a proposal being approved and enacted.
*
* It should generally be a little more than the unstake period to ensure that
* voting stakers have an opportunity to remove themselves from the system in the case
* where they are on the losing side of a vote.
**/
enactmentPeriod: u32 & AugmentedConst<ApiType>;
/**
* Minimum voting period allowed for a fast-track referendum.
**/
fastTrackVotingPeriod: u32 & AugmentedConst<ApiType>;
/**
* Indicator for whether an emergency origin is even allowed to happen. Some chains may
* want to set this permanently to `false`, others may want to condition it on things such
* as an upgrade having happened recently.
**/
instantAllowed: bool & AugmentedConst<ApiType>;
/**
* How often (in blocks) new public referenda are launched.
**/
launchPeriod: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of public proposals that can exist at any time.
**/
maxProposals: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of votes for an account.
*
* Also used to compute weight, an overly big value can
* lead to extrinsic with very big weight: see `delegate` for instance.
**/
maxVotes: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount to be used as a deposit for a public referendum proposal.
**/
minimumDeposit: u128 & AugmentedConst<ApiType>;
/**
* The amount of balance that must be deposited per byte of preimage stored.
**/
preimageByteDeposit: u128 & AugmentedConst<ApiType>;
/**
* The minimum period of vote locking.
*
* It should be no shorter than enactment period to ensure that in the case of an approval,
* those successful voters are locked into the consequences that their votes entail.
**/
voteLockingPeriod: u32 & AugmentedConst<ApiType>;
/**
* How often (in blocks) to check for new votes.
**/
votingPeriod: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
electionProviderMultiPhase: {
/**
* Maximum length (bytes) that the mined solution should consume.
*
* The miner will ensure that the total length of the unsigned solution will not exceed
* this value.
**/
minerMaxLength: u32 & AugmentedConst<ApiType>;
/**
* Maximum weight that the miner should consume.
*
* The miner will ensure that the total weight of the unsigned solution will not exceed
* this value, based on [`WeightInfo::submit_unsigned`].
**/
minerMaxWeight: u64 & AugmentedConst<ApiType>;
/**
* The priority of the unsigned transaction submitted in the unsigned-phase
**/
minerTxPriority: u64 & AugmentedConst<ApiType>;
/**
* The repeat threshold of the offchain worker.
*
* For example, if it is 5, that means that at least 5 blocks will elapse between attempts
* to submit the worker's solution.
**/
offchainRepeat: u32 & AugmentedConst<ApiType>;
/**
* Base deposit for a signed solution.
**/
signedDepositBase: u128 & AugmentedConst<ApiType>;
/**
* Per-byte deposit for a signed solution.
**/
signedDepositByte: u128 & AugmentedConst<ApiType>;
/**
* Per-weight deposit for a signed solution.
**/
signedDepositWeight: u128 & AugmentedConst<ApiType>;
/**
* Maximum number of signed submissions that can be queued.
*
* It is best to avoid adjusting this during an election, as it impacts downstream data
* structures. In particular, `SignedSubmissionIndices<T>` is bounded on this value. If you
* update this value during an election, you _must_ ensure that
* `SignedSubmissionIndices.len()` is less than or equal to the new value. Otherwise,
* attempts to submit new solutions may cause a runtime panic.
**/
signedMaxSubmissions: u32 & AugmentedConst<ApiType>;
/**
* Maximum weight of a signed solution.
*
* This should probably be similar to [`Config::MinerMaxWeight`].
**/
signedMaxWeight: u64 & AugmentedConst<ApiType>;
/**
* Duration of the signed phase.
**/
signedPhase: u32 & AugmentedConst<ApiType>;
/**
* Base reward for a signed solution
**/
signedRewardBase: u128 & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" (in any phase).
**/
solutionImprovementThreshold: Perbill & AugmentedConst<ApiType>;
/**
* Duration of the unsigned phase.
**/
unsignedPhase: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of voters to put in the snapshot. At the moment, snapshots are only
* over a single block, but once multi-block elections are introduced they will take place
* over multiple blocks.
*
* Also, note the data type: If the voters are represented by a `u32` in `type
* CompactSolution`, the same `u32` is used here to ensure bounds are respected.
**/
voterSnapshotPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
grandpa: {
/**
* Max Authorities in use
**/
maxAuthorities: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
identity: {
/**
* The amount held on deposit for a registered identity
**/
basicDeposit: u128 & AugmentedConst<ApiType>;
/**
* The amount held on deposit per additional field for a registered identity.
**/
fieldDeposit: u128 & AugmentedConst<ApiType>;
/**
* Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O
* required to access an identity, but can be pretty high.
**/
maxAdditionalFields: u32 & AugmentedConst<ApiType>;
/**
* Maxmimum number of registrars allowed in the system. Needed to bound the complexity
* of, e.g., updating judgements.
**/
maxRegistrars: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of sub-accounts allowed per identified account.
**/
maxSubAccounts: u32 & AugmentedConst<ApiType>;
/**
* The amount held on deposit for a registered subaccount. This should account for the fact
* that one storage item's value will increase by the size of an account ID, and there will
* be another trie item whose value is the size of an account ID plus 32 bytes.
**/
subAccountDeposit: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
imOnline: {
/**
* A configuration for base priority of unsigned transactions.
*
* This is exposed so that it can be tuned for particular runtime, when
* multiple pallets send unsigned transactions.
**/
unsignedPriority: u64 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
indices: {
/**
* The deposit needed for reserving an index.
**/
deposit: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
multisig: {
/**
* The base amount of currency needed to reserve for creating a multisig execution or to
* store a dispatch call for later.
*
* This is held for an additional storage item whose value size is
* `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is
* `32 + sizeof(AccountId)` bytes.
**/
depositBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of currency needed per unit threshold when creating a multisig execution.
*
* This is held for adding 32 bytes more into a pre-existing storage value.
**/
depositFactor: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of signatories allowed in the multisig.
**/
maxSignatories: u16 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
paras: {
unsignedPriority: u64 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
phragmenElection: {
/**
* How much should be locked up in order to submit one's candidacy.
**/
candidacyBond: u128 & AugmentedConst<ApiType>;
/**
* Number of members to elect.
**/
desiredMembers: u32 & AugmentedConst<ApiType>;
/**
* Number of runners_up to keep.
**/
desiredRunnersUp: u32 & AugmentedConst<ApiType>;
/**
* Identifier for the elections-phragmen pallet's lock
**/
palletId: U8aFixed & AugmentedConst<ApiType>;
/**
* How long each seat is kept. This defines the next block number at which an election
* round will happen. If set to zero, no elections are ever triggered and the module will
* be in passive mode.
**/
termDuration: u32 & AugmentedConst<ApiType>;
/**
* Base deposit associated with voting.
*
* This should be sensibly high to economically ensure the pallet cannot be attacked by
* creating a gigantic number of votes.
**/
votingBondBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of bond that need to be locked for each vote (32 bytes).
**/
votingBondFactor: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
proxy: {
/**
* The base amount of currency needed to reserve for creating an announcement.
*
* This is held when a new storage item holding a `Balance` is created (typically 16
* bytes).
**/
announcementDepositBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of currency needed per announcement made.
*
* This is held for adding an `AccountId`, `Hash` and `BlockNumber` (typically 68 bytes)
* into a pre-existing storage value.
**/
announcementDepositFactor: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of time-delayed announcements that are allowed to be pending.
**/
maxPending: u32 & AugmentedConst<ApiType>;
/**
* The maximum amount of proxies allowed for a single account.
**/
maxProxies: u32 & AugmentedConst<ApiType>;
/**
* The base amount of currency needed to reserve for creating a proxy.
*
* This is held for an additional storage item whose value size is
* `sizeof(Balance)` bytes and whose key size is `sizeof(AccountId)` bytes.
**/
proxyDepositBase: u128 & AugmentedConst<ApiType>;
/**
* The amount of currency needed per proxy added.
*
* This is held for adding 32 bytes plus an instance of `ProxyType` more into a
* pre-existing storage value. Thus, when configuring `ProxyDepositFactor` one should take
* into account `32 + proxy_type.encode().len()` bytes of data.
**/
proxyDepositFactor: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
registrar: {
/**
* The deposit to be paid per byte stored on chain.
**/
dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/**
* The deposit to be paid to run a parathread.
* This should include the cost for storing the genesis head and validation code.
**/
paraDeposit: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
scheduler: {
/**
* The maximum weight that may be scheduled per block for any dispatchables of less
* priority than `schedule::HARD_DEADLINE`.
**/
maximumWeight: u64 & AugmentedConst<ApiType>;
/**
* The maximum number of scheduled calls in the queue for a single block.
* Not strictly enforced, but used for weight estimation.
**/
maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
slots: {
/**
* The number of blocks to offset each lease period by.
**/
leaseOffset: u32 & AugmentedConst<ApiType>;
/**
* The number of blocks over which a single period lasts.
**/
leasePeriod: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
staking: {
/**
* Number of eras that staked funds must remain bonded for.
**/
bondingDuration: u32 & AugmentedConst<ApiType>;
maxNominations: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of nominators rewarded for each validator.
*
* For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can
* claim their reward. This used to limit the i/o cost for the nominator payout.
**/
maxNominatorRewardedPerValidator: u32 & AugmentedConst<ApiType>;
/**
* Number of sessions per era.
**/
sessionsPerEra: u32 & AugmentedConst<ApiType>;
/**
* Number of eras that slashes are deferred by, after computation.
*
* This should be less than the bonding duration. Set to 0 if slashes
* should be applied immediately, without opportunity for intervention.
**/
slashDeferDuration: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
system: {
/**
* Maximum number of block number to block hash mappings to keep (oldest pruned first).
**/
blockHashCount: u32 & AugmentedConst<ApiType>;
/**
* The maximum length of a block (in bytes).
**/
blockLength: FrameSystemLimitsBlockLength & AugmentedConst<ApiType>;
/**
* Block & extrinsics weights: base values and limits.
**/
blockWeights: FrameSystemLimitsBlockWeights & AugmentedConst<ApiType>;
/**
* The weight of runtime database operations the runtime can invoke.
**/
dbWeight: FrameSupportWeightsRuntimeDbWeight & AugmentedConst<ApiType>;
/**
* The designated SS85 prefix of this chain.
*
* This replaces the "ss58Format" property declared in the chain spec. Reason is
* that the runtime should know about the prefix in order to make use of it as
* an identifier of the chain.
**/
ss58Prefix: u16 & AugmentedConst<ApiType>;
/**
* Get the chain's current version.
**/
version: SpVersionRuntimeVersion & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
timestamp: {
/**
* 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: u64 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
tips: {
/**
* The amount held on deposit per byte within the tip report reason or bounty description.
**/
dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/**
* Maximum acceptable reason length.
*
* Benchmarks depend on this value, be sure to update weights file when changing this value
**/
maximumReasonLength: u32 & AugmentedConst<ApiType>;
/**
* The period for which a tip remains open after is has achieved threshold tippers.
**/
tipCountdown: u32 & AugmentedConst<ApiType>;
/**
* The percent of the final tip which goes to the original reporter of the tip.
**/
tipFindersFee: Percent & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a tip report.
**/
tipReportDepositBase: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
transactionPayment: {
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
*
* This value is multipled by the `final_fee` to obtain a "virtual tip" that is later
* added to a tip component in regular `priority` calculations.
* It means that a `Normal` transaction can front-run a similarly-sized `Operational`
* extrinsic (with no tip), by including a tip value greater than the virtual tip.
*
* ```rust,ignore
* // For `Normal`
* let priority = priority_calc(tip);
*
* // For `Operational`
* let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier;
* let priority = priority_calc(tip + virtual_tip);
* ```
*
* Note that since we use `final_fee` the multiplier applies also to the regular `tip`
* sent with the transaction. So, not only does the transaction get a priority bump based
* on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational`
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
weightToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
treasury: {
/**
* Percentage of spare funds (if any) that are burnt per spend period.
**/
burn: Permill & AugmentedConst<ApiType>;
/**
* The maximum number of approvals that can wait in the spending queue.
**/
maxApprovals: u32 & AugmentedConst<ApiType>;
/**
* The treasury's pallet id, used for deriving its sovereign account ID.
**/
palletId: FrameSupportPalletId & AugmentedConst<ApiType>;
/**
* Fraction of a proposal's value that should be bonded in order to place the proposal.
* An accepted proposal gets these back. A rejected proposal does not.
**/
proposalBond: Permill & AugmentedConst<ApiType>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
proposalBondMinimum: u128 & AugmentedConst<ApiType>;
/**
* Period between successive spends.
**/
spendPeriod: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
utility: {
/**
* The limit on the number of batched calls.
**/
batchedCallsLimit: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
vesting: {
maxVestingSchedules: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount transferred to call `vested_transfer`.
**/
minVestedTransfer: u128 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
} // AugmentedConsts
} // declare module
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../base';
import './consts';
import './errors';
import './events';
import './query';
import './tx';
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -14,6 +14,11 @@ declare module '@polkadot/api-base/types/consts' {
* The amount of funds that must be reserved when creating a new approval.
**/
approvalDeposit: u128 & AugmentedConst<ApiType>;
/**
* The amount of funds that must be reserved for a non-provider asset account to be
* maintained.
**/
assetAccountDeposit: u128 & AugmentedConst<ApiType>;
/**
* The basic amount of funds that must be reserved for an asset.
**/
@@ -6,6 +6,10 @@ import type { ApiTypes } from '@polkadot/api-base/types';
declare module '@polkadot/api-base/types/errors' {
export interface AugmentedErrors<ApiType extends ApiTypes> {
assets: {
/**
* The asset-account already exists.
**/
AlreadyExists: AugmentedError<ApiType>;
/**
* Invalid metadata given.
**/
@@ -18,10 +22,6 @@ declare module '@polkadot/api-base/types/errors' {
* Account balance must be greater than or equal to the transfer amount.
**/
BalanceLow: AugmentedError<ApiType>;
/**
* Balance should be non-zero.
**/
BalanceZero: AugmentedError<ApiType>;
/**
* The origin account is frozen.
**/
@@ -34,13 +34,22 @@ declare module '@polkadot/api-base/types/errors' {
* Minimum balance should be non-zero.
**/
MinBalanceZero: AugmentedError<ApiType>;
/**
* The account to alter does not exist.
**/
NoAccount: AugmentedError<ApiType>;
/**
* The asset-account doesn't have an associated deposit.
**/
NoDeposit: AugmentedError<ApiType>;
/**
* The signing account has no permission to do the operation.
**/
NoPermission: AugmentedError<ApiType>;
/**
* No provider reference exists to allow a non-zero balance of a non-self-sufficient
* asset.
* Unable to increment the consumer reference counters on the account. Either no provider
* reference exists to allow a non-zero balance of a non-self-sufficient asset, or the
* maximum number of consumers has been reached.
**/
NoProvider: AugmentedError<ApiType>;
/**
@@ -51,6 +60,10 @@ declare module '@polkadot/api-base/types/errors' {
* The given asset ID is unknown.
**/
Unknown: AugmentedError<ApiType>;
/**
* The operation would result in funds being burned.
**/
WouldBurn: AugmentedError<ApiType>;
/**
* The source account would not survive the transfer and it needs to stay alive.
**/
@@ -251,6 +264,13 @@ declare module '@polkadot/api-base/types/errors' {
* No contract was found at the specified address.
**/
ContractNotFound: AugmentedError<ApiType>;
/**
* The contract ran to completion but decided to revert its storage changes.
* Please note that this error is only returned from extrinsics. When called directly
* or via RPC an `Ok` will be returned. In this case the caller needs to inspect the flags
* to determine whether a reversion has taken place.
**/
ContractReverted: AugmentedError<ApiType>;
/**
* Contract trapped during execution.
**/
@@ -925,6 +945,36 @@ declare module '@polkadot/api-base/types/errors' {
**/
[key: string]: AugmentedError<ApiType>;
};
preimage: {
/**
* Preimage has already been noted on-chain.
**/
AlreadyNoted: AugmentedError<ApiType>;
/**
* The user is not authorized to perform this action.
**/
NotAuthorized: AugmentedError<ApiType>;
/**
* The preimage cannot be removed since it has not yet been noted.
**/
NotNoted: AugmentedError<ApiType>;
/**
* The preimage request cannot be removed since no outstanding requests exist.
**/
NotRequested: AugmentedError<ApiType>;
/**
* A preimage may not be removed when there are outstanding requests.
**/
Requested: AugmentedError<ApiType>;
/**
* Preimage is too large to store on-chain.
**/
TooLarge: AugmentedError<ApiType>;
/**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
};
proxy: {
/**
* Account is already a proxy.
@@ -5,7 +5,7 @@ import type { ApiTypes } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, NodeRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError } from '@polkadot/types/lookup';
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, NodeRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> {
@@ -609,6 +609,24 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
preimage: {
/**
* A preimage has ben cleared.
**/
Cleared: AugmentedEvent<ApiType, [H256]>;
/**
* A preimage has been noted.
**/
Noted: AugmentedEvent<ApiType, [H256]>;
/**
* A preimage has been requested.
**/
Requested: AugmentedEvent<ApiType, [H256]>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
proxy: {
/**
* An announcement was placed to make a call in the future.
@@ -663,6 +681,10 @@ declare module '@polkadot/api-base/types/events' {
[key: string]: AugmentedEvent<ApiType>;
};
scheduler: {
/**
* The call for the provided hash was not found so the task has been aborted.
**/
CallLookupFailed: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<Bytes>, FrameSupportScheduleLookupError]>;
/**
* Canceled some task.
**/
@@ -829,9 +851,9 @@ declare module '@polkadot/api-base/types/events' {
};
sudo: {
/**
* The \[sudoer\] just switched identity; the old key is supplied.
* The \[sudoer\] just switched identity; the old key is supplied if one existed.
**/
KeyChanged: AugmentedEvent<ApiType, [AccountId32]>;
KeyChanged: AugmentedEvent<ApiType, [Option<AccountId32>]>;
/**
* A sudo just took place. \[result\]
**/
@@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../base';
import './consts';
import './errors';
import './events';
import './query';
import './tx';
@@ -6,16 +6,16 @@ import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetAccount, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV3, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';
declare module '@polkadot/api-base/types/storage' {
export interface AugmentedQueries<ApiType extends ApiTypes> {
assets: {
/**
* The number of units of assets held by any given account.
* The holdings of a specific account for a specific asset.
**/
account: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<PalletAssetsAssetBalance>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
account: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<PalletAssetsAssetAccount>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
/**
* Approved balance transfers. First balance is the amount approved for transfer. Second
* is the amount of `T::Currency` reserved for storing this.
@@ -478,7 +478,7 @@ declare module '@polkadot/api-base/types/storage' {
* Twox note: the key of the map is an auto-incrementing index which users cannot inspect or
* affect; we shouldn't need a cryptographically secure hasher.
**/
signedSubmissionsMap: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<PalletElectionProviderMultiPhaseSignedSignedSubmission>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
signedSubmissionsMap: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletElectionProviderMultiPhaseSignedSignedSubmission>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Snapshot data of the round.
*
@@ -756,6 +756,20 @@ declare module '@polkadot/api-base/types/storage' {
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
preimage: {
/**
* The preimages stored by this pallet.
**/
preimageFor: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<Bytes>>, [H256]> & QueryableStorageEntry<ApiType, [H256]>;
/**
* The request status of a given hash.
**/
statusFor: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<PalletPreimageRequestStatus>>, [H256]> & QueryableStorageEntry<ApiType, [H256]>;
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
proxy: {
/**
* The announcements made by the proxy (key).
@@ -810,7 +824,7 @@ declare module '@polkadot/api-base/types/storage' {
/**
* Items to be executed, indexed by the block number that they should be executed on.
**/
agenda: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Option<PalletSchedulerScheduledV2>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
agenda: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Option<PalletSchedulerScheduledV3>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Lookup from identity to the block number and index of the task.
**/
@@ -1172,7 +1186,7 @@ declare module '@polkadot/api-base/types/storage' {
/**
* The `AccountId` of the sudo key.
**/
key: AugmentedQuery<ApiType, () => Observable<AccountId32>, []> & QueryableStorageEntry<ApiType, []>;
key: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Generic query
**/
@@ -1420,6 +1434,11 @@ declare module '@polkadot/api-base/types/storage' {
* Details of an asset class.
**/
class: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletUniquesClassDetails>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* The classes owned by any given account; set out this way so that classes owned by a single
* account can be enumerated.
**/
classAccount: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<Null>>, [AccountId32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32]>;
/**
* Metadata of an asset class.
**/
@@ -6,7 +6,7 @@ import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
import type { NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
import type { FrameSupportScheduleMaybeHashed, NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/submittable' {
export interface AugmentedSubmittables<ApiType extends ApiTypes> {
@@ -39,7 +39,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Origin must be Signed and the sender should be the Manager of the asset `id`.
*
* Bails with `BalanceZero` if the `who` is already dead.
* Bails with `NoAccount` if the `who` is already dead.
*
* - `id`: The identifier of the asset to have some amount burned.
* - `who`: The account to be debited from.
@@ -281,6 +281,17 @@ declare module '@polkadot/api-base/types/submittable' {
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
**/
mint: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/**
* Return the deposit (if any) of an asset account.
*
* The origin must be Signed.
*
* - `id`: The identifier of the asset for the account to be created.
* - `allow_burn`: If `true` then assets may be destroyed in order to complete the refund.
*
* Emits `Refunded` event when successful.
**/
refund: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, allowBurn: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, bool]>;
/**
* Set the metadata for an asset.
*
@@ -340,6 +351,18 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight: `O(1)`
**/
thawAsset: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Create an asset account for non-provider assets.
*
* A deposit will be taken from the signer account.
*
* - `origin`: Must be Signed; the signer account must have sufficient funds for a deposit
* to be taken.
* - `id`: The identifier of the asset for the account to be created.
*
* Emits `Touched` event when successful.
**/
touch: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Move some assets from the sender account to another.
*
@@ -2297,6 +2320,36 @@ declare module '@polkadot/api-base/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
preimage: {
/**
* Register a preimage on-chain.
*
* If the preimage was previously requested, no fees or deposits are taken for providing
* the preimage. Otherwise, a deposit is taken proportional to the size of the preimage.
**/
notePreimage: AugmentedSubmittable<(bytes: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
* Request a preimage be uploaded to the chain without paying any fees or deposits.
*
* If the preimage requests has already been provided on-chain, we unreserve any deposit
* a user may have paid, and take the control of the preimage out of their hands.
**/
requestPreimage: AugmentedSubmittable<(hash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;
/**
* Clear an unrequested preimage from the runtime storage.
**/
unnotePreimage: AugmentedSubmittable<(hash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;
/**
* Clear a previously made request for a preimage.
*
* NOTE: THIS MUST NOT BE CALLED ON `hash` MORE TIMES THAN `request_preimage`.
**/
unrequestPreimage: AugmentedSubmittable<(hash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
proxy: {
/**
* Register a proxy account for the sender that is able to make calls on its behalf.
@@ -2711,7 +2764,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* Anonymously schedule a task.
**/
schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/**
* Anonymously schedule a task after a delay.
*
@@ -2719,11 +2772,11 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule`].
* # </weight>
**/
scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/**
* Schedule a named task.
**/
scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/**
* Schedule a named task after a delay.
*
@@ -2731,7 +2784,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule_named`](Self::schedule_named).
* # </weight>
**/
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/**
* Generic tx
**/
+4
View File
@@ -5,6 +5,10 @@
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/kusama/*.ts",
"**/polkadot/*.ts"
],
"references": [
{ "path": "../api-base" },
{ "path": "../rpc-augment" },
+19
View File
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"include": [
"**/base.ts",
"**/kusama/*.ts"
],
"references": [
{ "path": "../api-base" },
{ "path": "../rpc-augment" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-augment" }
]
}
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"include": [
"**/base.ts",
"**/polkadot/*.ts"
],
"references": [
{ "path": "../api-base" },
{ "path": "../rpc-augment" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-augment" }
]
}
+3 -3
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/rpc-core": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/rpc-core": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/util": "^8.2.2",
"rxjs": "^7.4.0"
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-base', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/api-base', version: '7.1.1' };
@@ -65,6 +65,7 @@ export interface SubmittableResultValue {
events?: EventRecord[];
internalError?: Error;
status: ExtrinsicStatus;
txHash: Hash;
}
export interface SubmittableExtrinsic<ApiType extends ApiTypes, R extends ISubmittableResult = ISubmittableResult> extends Extrinsic {
+9 -4
View File
@@ -20,15 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/api": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/types-create": "7.0.1",
"@polkadot/api": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-codec": "7.1.1",
"@polkadot/types-create": "7.1.1",
"@polkadot/util": "^8.2.2",
"@polkadot/util-crypto": "^8.2.2",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@polkadot/api-augment": "7.1.1",
"@polkadot/keyring": "^8.2.2"
}
}
+10 -10
View File
@@ -56,21 +56,21 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
const hasStorageDeposit = this.api.tx.contracts.instantiate.meta.args.length === 6;
const storageDepositLimit = null;
const encParams = this.abi.findConstructor(constructorOrId).toU8a(params);
const encSalt = encodeSalt(salt);
const tx = hasStorageDeposit
? this.api.tx.contracts.instantiate(value, gasLimit, storageDepositLimit, this.codeHash, this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt))
? this.api.tx.contracts.instantiate(value, gasLimit, storageDepositLimit, this.codeHash, encParams, encSalt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old style without storage deposit
: this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt));
: this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encParams, encSalt);
return tx
.withResultTransform((result: ISubmittableResult) =>
new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) =>
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
))
);
return tx.withResultTransform((result: ISubmittableResult) =>
new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) =>
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
))
);
};
}
+6 -4
View File
@@ -61,14 +61,16 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
const hasStorageDeposit = this.api.tx.contracts.instantiateWithCode.meta.args.length === 6;
const storageDepositLimit = null;
const encCode = compactAddLength(this.code);
const encParams = this.abi.findConstructor(constructorOrId).toU8a(params);
const encSalt = encodeSalt(salt);
const tx = hasStorageDeposit
? this.api.tx.contracts.instantiateWithCode(value, gasLimit, storageDepositLimit, compactAddLength(this.code), this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt))
? this.api.tx.contracts.instantiateWithCode(value, gasLimit, storageDepositLimit, encCode, encParams, encSalt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old style without storage deposit
: this.api.tx.contracts.instantiateWithCode(value, gasLimit, compactAddLength(this.code), this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt));
: this.api.tx.contracts.instantiateWithCode(value, gasLimit, encCode, encParams, encSalt);
return tx.withResultTransform((result: ISubmittableResult) =>
new CodeSubmittableResult(result, ...(applyOnEvent(result, ['CodeStored', 'Instantiated'], (records: EventRecord[]) =>
+13 -11
View File
@@ -106,14 +106,15 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
: gasLimit;
};
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic<ApiType> => {
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, storageDepositLimit = null, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic<ApiType> => {
const hasStorageDeposit = this.api.tx.contracts.call.meta.args.length === 5;
const storageDepositLimit = null;
const gas = this.#getGas(gasLimit);
const encParams = this.abi.findMessage(messageOrId).toU8a(params);
const tx = hasStorageDeposit
? this.api.tx.contracts.call(this.address, value, this.#getGas(gasLimit), storageDepositLimit, this.abi.findMessage(messageOrId).toU8a(params))
? this.api.tx.contracts.call(this.address, value, gas, storageDepositLimit, encParams)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old style without storage deposit
: this.api.tx.contracts.call(this.address, value, this.#getGas(gasLimit), this.abi.findMessage(messageOrId).toU8a(params));
: this.api.tx.contracts.call(this.address, value, gas, encParams);
return tx.withResultTransform((result: ISubmittableResult) =>
// ContractEmitted is the current generation, ContractExecution is the previous generation
@@ -133,7 +134,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
);
};
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, storageDepositLimit = null, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
const message = this.abi.findMessage(messageOrId);
@@ -142,11 +143,12 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
send: this._decorateMethod((origin: string | AccountId | Uint8Array) => {
const hasStorageDeposit = this.api.tx.contracts.call.meta.args.length === 5;
const inputData = message.toU8a(params);
const rpc = hasStorageDeposit
? this.api.rx.rpc.contracts.call({ dest: this.address, gasLimit: this.#getGas(gasLimit, true), inputData: message.toU8a(params), origin, value })
: this.api.rx.rpc.contracts.call({ dest: this.address, gasLimit: this.#getGas(gasLimit, true), inputData: message.toU8a(params), origin, value });
? this.api.rx.rpc.contracts.call({ dest: this.address, gasLimit: this.#getGas(gasLimit, true), inputData, origin, storageDepositLimit, value })
: this.api.rx.rpc.contracts.call({ dest: this.address, gasLimit: this.#getGas(gasLimit, true), inputData, origin, value });
const mapFn = ({ debugMessage, gasConsumed, gasRequired, result }: ContractExecResult): ContractCallOutcome => ({
const mapFn = ({ debugMessage, gasConsumed, gasRequired, result, storageDeposit }: ContractExecResult): ContractCallOutcome => ({
debugMessage,
gasConsumed,
gasRequired: gasRequired && !gasRequired.isZero()
@@ -155,12 +157,12 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
output: result.isOk && message.returnType
? this.abi.registry.createTypeUnsafe(message.returnType.lookupName || message.returnType.type, [result.asOk.data.toU8a(true)], { isPedantic: true })
: null,
result
result,
storageDeposit
});
return rpc.pipe(map(mapFn));
}
)
})
};
};
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/api-contract', version: '7.1.1' };
+8 -8
View File
@@ -4,7 +4,7 @@
import type { ApiBase } from '@polkadot/api/base';
import type { ApiTypes } from '@polkadot/api/types';
import type { Text, u64 } from '@polkadot/types';
import type { ContractExecResultResult, ContractSelector } from '@polkadot/types/interfaces';
import type { ContractExecResultResult, ContractSelector, StorageDeposit } from '@polkadot/types/interfaces';
import type { Codec, TypeDef } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { Abi } from '.';
@@ -58,6 +58,7 @@ export interface ContractCallOutcome {
gasRequired: u64;
output: Codec | null;
result: ContractExecResultResult;
storageDeposit: StorageDeposit;
}
export interface DecodedEvent {
@@ -70,13 +71,12 @@ export interface DecodedMessage {
message: AbiMessage;
}
export interface BlueprintOptions {
gasLimit?: bigint | string | number | BN;
salt?: Uint8Array | string | null;
value?: bigint | string | number | BN;
}
export interface ContractOptions {
gasLimit?: bigint | BN | string | number;
gasLimit?: bigint | string | number | BN;
storageDepositLimit?: bigint | string | number | BN | null;
value?: bigint | BN | string | number;
}
export interface BlueprintOptions extends ContractOptions {
salt?: Uint8Array | string | null;
}
+2 -2
View File
@@ -16,7 +16,7 @@
"references": [
{ "path": "../api" },
{ "path": "../types" },
{ "path": "../types-create" },
{ "path": "../types-support" }
{ "path": "../types-codec" },
{ "path": "../types-create" }
]
}
+1
View File
@@ -18,6 +18,7 @@
],
"references": [
{ "path": "../api" },
{ "path": "../api-augment" },
{ "path": "../api-contract" },
{ "path": "../types" }
]
+12 -9
View File
@@ -20,22 +20,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/api": "7.0.1",
"@polkadot/api-base": "7.0.1",
"@polkadot/rpc-core": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/types-codec": "7.0.1",
"@polkadot/api": "7.1.1",
"@polkadot/api-augment": "7.1.1",
"@polkadot/api-base": "7.1.1",
"@polkadot/rpc-core": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-codec": "7.1.1",
"@polkadot/util": "^8.2.2",
"@polkadot/util-crypto": "^8.2.2",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@polkadot/api": "7.0.1",
"@polkadot/api-augment": "7.0.1",
"@polkadot/rpc-augment": "7.0.1"
"@polkadot/api": "7.1.1",
"@polkadot/api-augment": "7.1.1",
"@polkadot/rpc-augment": "7.1.1",
"@polkadot/rpc-provider": "7.1.1",
"@polkadot/types-support": "7.1.1"
}
}
+5 -5
View File
@@ -3,6 +3,7 @@
import type { Observable } from 'rxjs';
import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import type { Option } from '@polkadot/types-codec';
import type { DeriveAccountFlags, DeriveApi } from '../types';
import { combineLatest, map, of } from 'rxjs';
@@ -14,19 +15,18 @@ type FlagsIntermediate = [
AccountId[],
AccountId[],
AccountId[],
AccountId | undefined
Option<AccountId> | AccountId | undefined
];
function parseFlags (address: AccountId | Address | string | null | undefined, [electionsMembers, councilMembers, technicalCommitteeMembers, societyMembers, sudoKey]: FlagsIntermediate): DeriveAccountFlags {
const addrStr = address && address.toString();
const isIncluded = (id: AccountId | Address | string) =>
address
? id.toString() === address.toString()
: false;
id.toString() === addrStr;
return {
isCouncil: (electionsMembers?.map(([id]) => id) || councilMembers || []).some(isIncluded),
isSociety: (societyMembers || []).some(isIncluded),
isSudo: sudoKey?.toString() === address?.toString(),
isSudo: sudoKey?.toString() === addrStr,
isTechCommittee: (technicalCommitteeMembers || []).some(isIncluded)
};
}
+11 -10
View File
@@ -11,25 +11,26 @@ import { isFunction } from '@polkadot/util';
import { memo } from '../util';
export function getInstance (api: DeriveApi, section: string): string {
export function getInstance (api: DeriveApi, section: string): DeriveApi['query']['council'] {
const instances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), section);
return instances && instances.length
const name = instances && instances.length
? instances[0]
: section;
return api.query[name as 'council'];
}
export function withSection <T, F extends (...args: any[]) => Observable<T>> (_section: Collective, fn: (section: string, api: DeriveApi, instanceId: string) => F): (instanceId: string, api: DeriveApi) => F {
export function withSection <T, F extends (...args: any[]) => Observable<T>> (section: Collective, fn: (query: DeriveApi['query']['council'], api: DeriveApi, instanceId: string) => F): (instanceId: string, api: DeriveApi) => F {
return (instanceId: string, api: DeriveApi) =>
memo(instanceId, fn(getInstance(api, _section), api, instanceId)) as unknown as F;
memo(instanceId, fn(getInstance(api, section), api, instanceId)) as unknown as F;
}
export function callMethod <T> (method: 'members' | 'proposals' | 'proposalCount', empty: T): (_section: Collective) => (instanceId: string, api: DeriveApi) => () => Observable<T> {
return (_section: Collective) =>
withSection(_section, (section, api) =>
export function callMethod <T> (method: 'members' | 'proposals' | 'proposalCount', empty: T): (section: Collective) => (instanceId: string, api: DeriveApi) => () => Observable<T> {
return (section: Collective) =>
withSection(section, (query) =>
(): Observable<T> =>
isFunction(api.query[section]?.[method])
? api.query[section as 'council'][method]() as unknown as Observable<T>
isFunction(query?.[method])
? query[method]() as unknown as Observable<T>
: of(empty)
);
}
+6 -6
View File
@@ -15,13 +15,13 @@ import { withSection } from './helpers';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { AccountId } from '@polkadot/types/interfaces';
export function prime (_section: Collective): (instanceId: string, api: DeriveApi) => () => Observable<AccountId | null> {
return withSection(_section, (section, api) =>
export function prime (section: Collective): (instanceId: string, api: DeriveApi) => () => Observable<AccountId | null> {
return withSection(section, (query) =>
(): Observable<AccountId | null> =>
isFunction(api.query[section as 'council']?.prime)
? api.query[section as 'council'].prime().pipe(
map((optPrime): AccountId | null =>
optPrime.unwrapOr(null)
isFunction(query?.prime)
? query.prime().pipe(
map((o): AccountId | null =>
o.unwrapOr(null)
)
)
: of(null)
+15 -15
View File
@@ -34,19 +34,19 @@ function parse (api: DeriveApi, [hashes, proposals, votes]: Result): DeriveColle
.filter((proposal): proposal is DeriveCollectiveProposal => !!proposal);
}
function _proposalsFrom (section: string, api: DeriveApi, hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> {
return (isFunction(api.query[section]?.proposals) && hashes.length
function _proposalsFrom (api: DeriveApi, query: DeriveApi['query']['council'], hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> {
return (isFunction(query?.proposals) && hashes.length
? combineLatest([
of(hashes),
// this should simply be api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
// however we have had cases on Edgeware where the indices have moved around after an
// upgrade, which results in invalid on-chain data
combineLatest(hashes.map((h) =>
api.query[section].proposalOf<Option<Proposal>>(h).pipe(
query.proposalOf<Option<Proposal>>(h).pipe(
catchError(() => of(null))
)
)),
api.query[section].voting.multi<Option<Votes>>(hashes)
query.voting.multi<Option<Votes>>(hashes)
])
: of<Result>([[], [], []])
).pipe(
@@ -54,27 +54,27 @@ function _proposalsFrom (section: string, api: DeriveApi, hashes: (Hash | Uint8A
);
}
export function hasProposals (_section: Collective): (instanceId: string, api: DeriveApi) => () => Observable<boolean> {
return withSection(_section, (section, api) =>
export function hasProposals (section: Collective): (instanceId: string, api: DeriveApi) => () => Observable<boolean> {
return withSection(section, (query) =>
(): Observable<boolean> =>
of(isFunction(api.query[section]?.proposals))
of(isFunction(query?.proposals))
);
}
export function proposals (_section: Collective): (instanceId: string, api: DeriveApi) => () => Observable<DeriveCollectiveProposal[]> {
return withSection(_section, (section, api) =>
export function proposals (section: Collective): (instanceId: string, api: DeriveApi) => () => Observable<DeriveCollectiveProposal[]> {
return withSection(section, (query, api) =>
(): Observable<DeriveCollectiveProposal[]> =>
api.derive[section as 'council'].proposalHashes().pipe(
switchMap((all) => _proposalsFrom(section, api, all))
api.derive[section].proposalHashes().pipe(
switchMap((all) => _proposalsFrom(api, query, all))
)
);
}
export function proposal (_section: Collective): (instanceId: string, api: DeriveApi) => (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
return withSection(_section, (section, api) =>
export function proposal (section: Collective): (instanceId: string, api: DeriveApi) => (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
return withSection(section, (query, api) =>
(hash: Hash | Uint8Array | string): Observable<DeriveCollectiveProposal | null> =>
isFunction(api.query[section]?.proposals)
? firstObservable(_proposalsFrom(section, api, [hash]))
isFunction(query?.proposals)
? firstObservable(_proposalsFrom(api, query, [hash]))
: of(null)
);
}
@@ -3,8 +3,8 @@
import type { Observable } from 'rxjs';
import type { Option, Vec } from '@polkadot/types';
import type { BlockNumber, Hash, ReferendumIndex } from '@polkadot/types/interfaces';
import type { PalletSchedulerScheduledV2 } from '@polkadot/types/lookup';
import type { BlockNumber, Call, Hash, ReferendumIndex, Scheduled } from '@polkadot/types/interfaces';
import type { FrameSupportScheduleMaybeHashed, PalletSchedulerScheduledV3 } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveDispatch, DeriveProposalImage } from '../types';
@@ -22,6 +22,11 @@ interface SchedulerInfo {
index: ReferendumIndex;
}
function isMaybeHashed (call: FrameSupportScheduleMaybeHashed | Call): call is FrameSupportScheduleMaybeHashed {
// check for enum
return (call as FrameSupportScheduleMaybeHashed).isBasic === false;
}
function queryQueue (api: DeriveApi): Observable<DeriveDispatch[]> {
return api.query.democracy.dispatchQueue<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>().pipe(
switchMap((dispatches) =>
@@ -42,7 +47,7 @@ function queryQueue (api: DeriveApi): Observable<DeriveDispatch[]> {
);
}
function schedulerEntries (api: DeriveApi): Observable<[BlockNumber[], (Option<PalletSchedulerScheduledV2>[] | null)[]]> {
function schedulerEntries (api: DeriveApi): Observable<[BlockNumber[], (Option<PalletSchedulerScheduledV3 | Scheduled>[] | null)[]]> {
// We don't get entries, but rather we get the keys (triggered via finished referendums) and
// the subscribe to those keys - this means we pickup when the schedulers actually executes
// at a block, the entry for that block will become empty
@@ -81,7 +86,15 @@ function queryScheduler (api: DeriveApi): Observable<DeriveDispatch[]> {
if (scheduled.maybeId.isSome) {
const id = scheduled.maybeId.unwrap().toHex();
id.startsWith(DEMOCRACY_ID) && result.push({ at, imageHash: scheduled.call.args[0] as Hash, index: api.registry.createType('(u64, ReferendumIndex)', id)[1] });
if (id.startsWith(DEMOCRACY_ID)) {
const imageHash = isMaybeHashed(scheduled.call)
? scheduled.call.isHash
? scheduled.call.asHash
: scheduled.call.asValue.args[0] as Hash
: scheduled.call.args[0] as Hash;
result.push({ at, imageHash, index: api.registry.createType('(u64, ReferendumIndex)', id)[1] });
}
}
});
});
@@ -4,7 +4,6 @@
export * from './dispatchQueue';
export * from './locks';
export * from './nextExternal';
export * from './preimage';
export * from './preimages';
export * from './proposals';
export * from './referendumIds';
@@ -1,19 +0,0 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Hash } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveProposalImage } from '../types';
import { map } from 'rxjs';
import { memo } from '../util';
import { parseImage } from './util';
export function preimage (instanceId: string, api: DeriveApi): (hash: Hash) => Observable<DeriveProposalImage | undefined> {
return memo(instanceId, (hash: Hash): Observable<DeriveProposalImage | undefined> =>
api.query.democracy.preimages(hash).pipe(
map((imageOpt) => parseImage(api, imageOpt))
)
);
}
+63 -10
View File
@@ -2,22 +2,75 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Hash } from '@polkadot/types/interfaces';
import type { AccountId, Balance, BlockNumber, Hash, PreimageStatus, Proposal } from '@polkadot/types/interfaces';
import type { Bytes, Option } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { DeriveApi, DeriveProposalImage } from '../types';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { parseImage } from './util';
import { isFunction } from '@polkadot/util';
export function preimages (instanceId: string, api: DeriveApi): (hashes: Hash[]) => Observable<(DeriveProposalImage | undefined)[]> {
return memo(instanceId, (hashes: Hash[]): Observable<(DeriveProposalImage | undefined)[]> =>
import { firstMemo, memo } from '../util';
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
type OldPreimage = ITuple<PreimageInfo>;
function isDemocracyPreimage (api: DeriveApi, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): imageOpt is Option<PreimageStatus> {
return !!imageOpt && !api.query.democracy.dispatchQueue;
}
function constructProposal (api: DeriveApi, [bytes, proposer, balance, at]: PreimageInfo): DeriveProposalImage {
let proposal: Proposal | undefined;
try {
proposal = api.registry.createType('Proposal', bytes.toU8a(true));
} catch (error) {
console.error(error);
}
return { at, balance, proposal, proposer };
}
function parseDemocracy (api: DeriveApi, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): DeriveProposalImage | undefined {
if (imageOpt.isNone) {
return;
}
if (isDemocracyPreimage(api, imageOpt)) {
const status = imageOpt.unwrap();
if (status.isMissing) {
return;
}
const { data, deposit, provider, since } = status.asAvailable;
return constructProposal(api, [data, provider, deposit, since]);
}
return constructProposal(api, imageOpt.unwrap());
}
function getDemocracyImages (api: DeriveApi, hashes: (Hash | Uint8Array | string)[]): Observable<(DeriveProposalImage | undefined)[]> {
return api.query.democracy.preimages.multi(hashes).pipe(
map((images): (DeriveProposalImage | undefined)[] =>
images.map((imageOpt) => parseDemocracy(api, imageOpt))
)
);
}
export function preimages (instanceId: string, api: DeriveApi): (hashes: (Hash | Uint8Array | string)[]) => Observable<(DeriveProposalImage | undefined)[]> {
return memo(instanceId, (hashes: (Hash | Uint8Array | string)[]): Observable<(DeriveProposalImage | undefined)[]> =>
hashes.length
? api.query.democracy.preimages.multi(hashes).pipe(
map((images): (DeriveProposalImage | undefined)[] =>
images.map((imageOpt) => parseImage(api, imageOpt))
)
)
? isFunction(api.query.democracy.preimages)
? getDemocracyImages(api, hashes)
: of([])
: of([])
);
}
export const preimage = firstMemo(
(api: DeriveApi, hash: Hash | Uint8Array | string) =>
api.derive.democracy.preimages([hash])
);
@@ -13,7 +13,7 @@ import { combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { calcVotes, getStatus, parseImage } from './util';
import { calcVotes, getStatus } from './util';
type VotingDelegating = PalletDemocracyVoteVoting['asDelegating'];
type VotingDirect = PalletDemocracyVoteVoting['asDirect'];
@@ -132,9 +132,9 @@ export function _referendumInfo (instanceId: string, api: DeriveApi): (index: BN
const status = getStatus(info);
return status
? api.query.democracy.preimages(status.proposalHash).pipe(
map((preimage): DeriveReferendum => ({
image: parseImage(api, preimage),
? api.derive.democracy.preimage(status.proposalHash).pipe(
map((image): DeriveReferendum => ({
image,
imageHash: status.proposalHash,
index: api.registry.createType('ReferendumIndex', index),
status
+9 -51
View File
@@ -1,17 +1,13 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, ReferendumInfoTo239, Tally } from '@polkadot/types/interfaces';
import type { ReferendumInfoTo239, Tally } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
import type { Option } from '@polkadot/types-codec';
import type { DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
import { BN, bnSqrt } from '@polkadot/util';
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
type OldPreimage = ITuple<PreimageInfo>;
interface ApproxState {
votedAye: BN;
votedNay: BN;
@@ -26,10 +22,6 @@ function isCurrentStatus (status: PalletDemocracyReferendumStatus | ReferendumIn
return !!(status as PalletDemocracyReferendumStatus).tally;
}
function isCurrentPreimage (api: DeriveApi, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): imageOpt is Option<PreimageStatus> {
return !!imageOpt && !api.query.democracy.dispatchQueue;
}
export function compareRationals (n1: BN, d1: BN, n2: BN, d2: BN): boolean {
while (true) {
const q1 = n1.div(d1);
@@ -141,44 +133,10 @@ export function getStatus (info: Option<PalletDemocracyReferendumInfo | Referend
const unwrapped = info.unwrap();
if (isOldInfo(unwrapped)) {
return unwrapped;
} else if (unwrapped.isOngoing) {
return unwrapped.asOngoing;
}
// done, we don't include it here... only currently active
return null;
}
function constructProposal (api: DeriveApi, [bytes, proposer, balance, at]: PreimageInfo): DeriveProposalImage {
let proposal: Proposal | undefined;
try {
proposal = api.registry.createType('Proposal', bytes.toU8a(true));
} catch (error) {
console.error(error);
}
return { at, balance, proposal, proposer };
}
export function parseImage (api: DeriveApi, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): DeriveProposalImage | undefined {
if (imageOpt.isNone) {
return;
}
if (isCurrentPreimage(api, imageOpt)) {
const status = imageOpt.unwrap();
if (status.isMissing) {
return;
}
const { data, deposit, provider, since } = status.asAvailable;
return constructProposal(api, [data, provider, deposit, since]);
}
return constructProposal(api, imageOpt.unwrap());
return isOldInfo(unwrapped)
? unwrapped
: unwrapped.isOngoing
? unwrapped.asOngoing
// done, we don't include it here... only currently active
: null;
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/api-derive', version: '7.1.1' };
-1
View File
@@ -13,7 +13,6 @@
"references": [
{ "path": "../api-base" },
{ "path": "../api-augment" },
{ "path": "../rpc-augment" },
{ "path": "../rpc-core" },
{ "path": "../types" },
{ "path": "../types-codec" }
+2 -1
View File
@@ -18,9 +18,10 @@
{ "path": "../api-base" },
{ "path": "../api-derive" },
{ "path": "../rpc-augment" },
{ "path": "../rpc-provider" },
{ "path": "../types" },
{ "path": "../types-augment" },
{ "path": "../types-codec" },
{ "path": "../types-support" },
{ "path": "../types-support" }
]
}
+14 -13
View File
@@ -20,28 +20,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/api-augment": "7.0.1",
"@polkadot/api-base": "7.0.1",
"@polkadot/api-derive": "7.0.1",
"@polkadot/api-augment": "7.1.1",
"@polkadot/api-base": "7.1.1",
"@polkadot/api-derive": "7.1.1",
"@polkadot/keyring": "^8.2.2",
"@polkadot/rpc-augment": "7.0.1",
"@polkadot/rpc-core": "7.0.1",
"@polkadot/rpc-provider": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/types-augment": "7.0.1",
"@polkadot/types-codec": "7.0.1",
"@polkadot/types-create": "7.0.1",
"@polkadot/types-known": "7.0.1",
"@polkadot/rpc-augment": "7.1.1",
"@polkadot/rpc-core": "7.1.1",
"@polkadot/rpc-provider": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-augment": "7.1.1",
"@polkadot/types-codec": "7.1.1",
"@polkadot/types-create": "7.1.1",
"@polkadot/types-known": "7.1.1",
"@polkadot/util": "^8.2.2",
"@polkadot/util-crypto": "^8.2.2",
"eventemitter3": "^4.0.7",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@polkadot/api-augment": "7.0.1"
"@polkadot/api-augment": "7.1.1",
"@polkadot/types-support": "7.1.1"
}
}
+2 -4
View File
@@ -19,7 +19,7 @@ import { getAvailableDerives } from '@polkadot/api-derive';
import { memo, RpcCore } from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider';
import { expandMetadata, Metadata, TypeRegistry, unwrapStorageType } from '@polkadot/types';
import { arrayChunk, arrayFlatten, assert, BN, BN_ZERO, compactStripLength, lazyMethod, lazyMethods, logger, objectSpread, u8aToHex } from '@polkadot/util';
import { arrayChunk, arrayFlatten, assert, assertReturn, BN, BN_ZERO, compactStripLength, lazyMethod, lazyMethods, logger, objectSpread, u8aToHex } from '@polkadot/util';
import { createSubmittable } from '../submittable';
import { augmentObject } from '../util/augmentObject';
@@ -50,9 +50,7 @@ const l = logger('api/init');
let instanceCounter = 0;
function getAtQueryFn<ApiType extends ApiTypes> (api: ApiDecoration<ApiType>, { method, section }: StorageEntry): AugmentedQuery<'rxjs', GenericStorageEntryFunction, AnyTuple> {
assert(api.rx.query[section] && api.rx.query[section][method], () => `query.${section}.${method} is not available in this version of the metadata`);
return api.rx.query[section][method];
return assertReturn(api.rx.query[section] && api.rx.query[section][method], () => `query.${section}.${method} is not available in this version of the metadata`);
}
export abstract class Decorate<ApiType extends ApiTypes> extends Events {
+5 -10
View File
@@ -4,7 +4,7 @@
import type { Observable, Subscription } from 'rxjs';
import type { Text } from '@polkadot/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { ChainProperties, Hash, HeaderPartial, RuntimeVersion, RuntimeVersionPartial } from '@polkadot/types/interfaces';
import type { ChainProperties, Hash, RuntimeVersion, RuntimeVersionPartial } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types';
@@ -15,7 +15,7 @@ import { firstValueFrom, map, of, switchMap } from 'rxjs';
import { Metadata, TypeRegistry } from '@polkadot/types';
import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
import { assert, BN_ZERO, isUndefined, logger, objectSpread, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
import { assert, assertReturn, BN_ZERO, isUndefined, logger, objectSpread, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import { Decorate } from './Decorate';
@@ -102,12 +102,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
* @description Returns the default versioned registry
*/
private _getDefaultRegistry (): VersionedRegistry<ApiType> {
// get the default registry version
const thisRegistry = this.#registries.find(({ isDefault }) => isDefault);
assert(thisRegistry, 'Initialization error, cannot find the default registry');
return thisRegistry;
return assertReturn(this.#registries.find(({ isDefault }) => isDefault), 'Initialization error, cannot find the default registry');
}
/**
@@ -151,7 +146,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
this._genesisHash.eq(blockHash)
? { number: BN_ZERO, parentHash: this._genesisHash }
: await firstValueFrom(this._rpcCore.chain.getHeader.raw(blockHash))
) as unknown as HeaderPartial;
);
assert(!header.parentHash.isEmpty, 'Unable to retrieve header and parent from supplied hash');
@@ -161,7 +156,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
(firstVersion && (lastVersion || firstVersion.specVersion.eq(this._runtimeVersion.specVersion)))
? { specName: this._runtimeVersion.specName, specVersion: firstVersion.specVersion }
: await firstValueFrom(this._rpcCore.state.getRuntimeVersion.raw(header.parentHash))
) as unknown as RuntimeVersionPartial;
);
const existingViaVersion = this._getBlockRegistryViaVersion(blockHash, version);
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/api', version: '7.1.1' };
+5 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DispatchError, DispatchInfo, EventRecord, ExtrinsicStatus } from '@polkadot/types/interfaces';
import type { DispatchError, DispatchInfo, EventRecord, ExtrinsicStatus, Hash } from '@polkadot/types/interfaces';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { SubmittableResultValue } from './types';
@@ -45,12 +45,15 @@ export class SubmittableResult implements ISubmittableResult {
public readonly status: ExtrinsicStatus;
constructor ({ dispatchError, dispatchInfo, events, internalError, status }: SubmittableResultValue) {
public readonly txHash: Hash;
constructor ({ dispatchError, dispatchInfo, events, internalError, status, txHash }: SubmittableResultValue) {
this.dispatchError = dispatchError || extractError(events);
this.dispatchInfo = dispatchInfo || extractInfo(events);
this.events = events || [];
this.internalError = internalError;
this.status = status;
this.txHash = txHash;
}
public get isCompleted (): boolean {
+10 -7
View File
@@ -233,10 +233,11 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
);
};
#observeStatus = (hash: Hash, status: ExtrinsicStatus): Observable<ISubmittableResult> => {
#observeStatus = (txHash: Hash, status: ExtrinsicStatus): Observable<ISubmittableResult> => {
if (!status.isFinalized && !status.isInBlock) {
return of(this.#transformResult(new SubmittableResult({
status
status,
txHash
})));
}
@@ -247,14 +248,16 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
return api.derive.tx.events(blockHash).pipe(
map(({ block, events }): ISubmittableResult =>
this.#transformResult(new SubmittableResult({
events: filterEvents(hash, block, events, status),
status
events: filterEvents(txHash, block, events, status),
status,
txHash
}))
),
catchError((internalError: Error) =>
of(this.#transformResult(new SubmittableResult({
internalError,
status
status,
txHash
})))
)
);
@@ -269,11 +272,11 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
};
#observeSubscribe = (updateId = -1): Observable<ISubmittableResult> => {
const hash = this.hash;
const txHash = this.hash;
return api.rpc.author.submitAndWatchExtrinsic(this).pipe(
switchMap((status): Observable<ISubmittableResult> =>
this.#observeStatus(hash, status)
this.#observeStatus(txHash, status)
),
tap((status): void => {
this.#updateSigner(updateId, status);
+4 -4
View File
@@ -5,10 +5,10 @@ import type { EventRecord, ExtrinsicStatus, H256, SignedBlock } from '@polkadot/
import { l } from './logging';
export function filterEvents (extHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): EventRecord[] | undefined {
export function filterEvents (txHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): EventRecord[] | undefined {
// extrinsics to hashes
for (const [index, extrinsic] of extrinsics.entries()) {
if (extrinsic.hash.eq(extHash)) {
for (const [index, x] of extrinsics.entries()) {
if (x.hash.eq(txHash)) {
return allEvents.filter(({ phase }) =>
// only ApplyExtrinsic has the extrinsic index
phase.isApplyExtrinsic && phase.asApplyExtrinsic.eqn(index)
@@ -21,7 +21,7 @@ export function filterEvents (extHash: H256, { block: { extrinsics, header } }:
if (status.isInBlock) {
const allHashes = extrinsics.map((x) => x.hash.toHex());
l.warn(`block ${header.hash.toHex()}: Unable to find extrinsic ${extHash.toHex()} inside ${allHashes.join(', ')}`);
l.warn(`block ${header.hash.toHex()}: Unable to find extrinsic ${txHash.toHex()} inside ${allHashes.join(', ')}`);
}
return undefined;
+1
View File
@@ -17,6 +17,7 @@
{ "path": "../rpc-core" },
{ "path": "../rpc-provider" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-known" }
]
}
+2 -1
View File
@@ -20,6 +20,7 @@
{ "path": "../rpc-core" },
{ "path": "../rpc-provider" },
{ "path": "../types" },
{ "path": "../types-known" }
{ "path": "../types-known" },
{ "path": "../types-support" }
]
}
+4 -4
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/rpc-core": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/types-codec": "7.0.1",
"@polkadot/rpc-core": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-codec": "7.1.1",
"@polkadot/util": "^8.2.2"
}
}
+2 -2
View File
@@ -133,7 +133,7 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
/**
* Executes a call to a contract
**/
call: AugmentedRpc<(callRequest: ContractCallRequest | { origin?: any; dest?: any; value?: any; gasLimit?: any; inputData?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractExecResult>>;
call: AugmentedRpc<(callRequest: ContractCallRequest | { origin?: any; dest?: any; value?: any; gasLimit?: any; storageDepositLimit?: any; inputData?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractExecResult>>;
/**
* Returns the value under a specified storage key in a contract
**/
@@ -141,7 +141,7 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
/**
* Instantiate a new contract
**/
instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; value?: any; gasLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;
instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; value?: any; gasLimit?: any; storageDepositLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;
/**
* Returns the projected time a given contract will be able to sustain paying its rent
**/
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-augment', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/rpc-augment', version: '7.1.1' };
+5 -5
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/rpc-augment": "7.0.1",
"@polkadot/rpc-provider": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/rpc-augment": "7.1.1",
"@polkadot/rpc-provider": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/util": "^8.2.2",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@polkadot/keyring": "^8.2.2",
"@polkadot/rpc-augment": "7.0.1"
"@polkadot/rpc-augment": "7.1.1"
}
}
+2 -2
View File
@@ -212,7 +212,7 @@ export class RpcCore {
const creator = <T> (isScale: boolean) => (...values: unknown[]): Observable<T> => {
const isDelayed = isScale && hashIndex !== -1 && !!values[hashIndex];
return new Observable((observer: Observer<T>): VoidCallback => {
return new Observable((observer: Observer<T>): () => void => {
callWithRegistry<T>(isScale, values)
.then((value): void => {
observer.next(value);
@@ -263,7 +263,7 @@ export class RpcCore {
let memoized: null | Memoized<RpcInterfaceMethod> = null;
const creator = <T> (isScale: boolean) => (...values: unknown[]): Observable<T> => {
return new Observable((observer: Observer<T>): VoidCallback => {
return new Observable((observer: Observer<T>): () => void => {
// Have at least an empty promise, as used in the unsubscribe
let subscriptionPromise: Promise<number | string | null> = Promise.resolve(null);
const registry = this.#registryDefault;
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/rpc-core', version: '7.1.1' };
+3 -3
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/keyring": "^8.2.2",
"@polkadot/types": "7.0.1",
"@polkadot/types-support": "7.0.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-support": "7.1.1",
"@polkadot/util": "^8.2.2",
"@polkadot/util-crypto": "^8.2.2",
"@polkadot/x-fetch": "^8.2.2",
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', version: '7.1.1' };
+12 -11
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -33,22 +33,23 @@
"@babel/core": "^7.16.5",
"@babel/register": "^7.16.5",
"@babel/runtime": "^7.16.5",
"@polkadot/api": "7.0.1",
"@polkadot/rpc-augment": "7.0.1",
"@polkadot/rpc-provider": "7.0.1",
"@polkadot/types": "7.0.1",
"@polkadot/types-augment": "7.0.1",
"@polkadot/types-codec": "7.0.1",
"@polkadot/types-create": "7.0.1",
"@polkadot/types-support": "7.0.1",
"@polkadot/api": "7.1.1",
"@polkadot/api-augment": "7.1.1",
"@polkadot/rpc-augment": "7.1.1",
"@polkadot/rpc-provider": "7.1.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-augment": "7.1.1",
"@polkadot/types-codec": "7.1.1",
"@polkadot/types-create": "7.1.1",
"@polkadot/types-support": "7.1.1",
"@polkadot/util": "^8.2.2",
"@polkadot/x-ws": "^8.2.2",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.3.0"
"yargs": "^17.3.1"
},
"devDependencies": {
"@types/websocket": "^1.0.4",
"@types/yargs": "^17.0.7"
"@types/yargs": "^17.0.8"
}
}
-28
View File
@@ -1,28 +0,0 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
const alias = {
'^@polkadot/api-augment(.*)': './packages/api-augment/src\\1',
'^@polkadot/api-base(.*)': './packages/api-base/src\\1',
'^@polkadot/api-derive(.*)': './packages/api-derive/src\\1',
'^@polkadot/api(.*)': './packages/api/src/\\1',
'^@polkadot/rpc-augment(.*)': './packages/rpc-augment/src\\1',
'^@polkadot/rpc-core(.*)': './packages/rpc-core/src\\1',
'^@polkadot/rpc-provider(.*)': './packages/rpc-provider/src\\1',
'^@polkadot/types-(augment)(.*)': './packages/types-\\1/src\\2',
'^@polkadot/types-codec(.*)': './packages/types-codec/src\\1',
'^@polkadot/types-create(.*)': './packages/types-create/src\\1',
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-metadata(.*)': './packages/types-metadata/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
};
require('@babel/register')({
extensions: ['.js', '.ts'],
plugins: [
['module-resolver', { alias }]
]
});
+36
View File
@@ -0,0 +1,36 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = function (file) {
let main;
try {
main = require(`../${file}.cjs`).main;
} catch (error) {
// required for dev-only setups
process.env.JEST_WORKER_ID = '123';
// register aliases
require('@babel/register')({
extensions: ['.js', '.ts'],
plugins: [
['module-resolver', {
alias: {
'^@polkadot/api-(augment|base|derive)(.*)': './packages/api-\\1/src\\2',
// eslint-disable-next-line sort-keys
'^@polkadot/api(.*)': './packages/api/src/\\1',
'^@polkadot/rpc-(augment|core|provider)(.*)': './packages/rpc-\\1/src\\2',
'^@polkadot/types-(augment|codec|create|known|metadata|support)(.*)': './packages/types-\\1/src\\2',
// eslint-disable-next-line sort-keys
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
]
});
// get ts source
main = require(`../src/${file}.ts`).main;
}
main();
};
@@ -2,16 +2,4 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
let main;
try {
main = require('../extractChain.cjs').main;
} catch (error) {
process.env.JEST_WORKER_ID = '123';
require('./aliases.cjs');
main = require('../src/extractChain.ts').main;
}
main();
require('./execWithSrc.cjs')('extractChain');
@@ -2,16 +2,4 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
let main;
try {
main = require('../fromChain.cjs').main;
} catch (error) {
process.env.JEST_WORKER_ID = '123';
require('./aliases.cjs');
main = require('../src/fromChain').main;
}
main();
require('./execWithSrc.cjs')('fromChain');
@@ -2,16 +2,4 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
let main;
try {
main = require('../fromDefs.cjs').main;
} catch (error) {
process.env.JEST_WORKER_ID = '123';
require('./aliases.cjs');
main = require('../src/fromDefs.ts').main;
}
main();
require('./execWithSrc.cjs')('fromDefs');
@@ -2,16 +2,4 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
let main;
try {
main = require('../interfacesTs.cjs').main;
} catch (error) {
process.env.JEST_WORKER_ID = '123';
require('./aliases.cjs');
main = require('../src/interfacesTs.ts').main;
}
main();
require('./execWithSrc.cjs')('interfacesTs');
@@ -2,16 +2,4 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
let main;
try {
main = require('../metadataMd.cjs').main;
} catch (error) {
process.env.JEST_WORKER_ID = '123';
require('./aliases.cjs');
main = require('../src/metadataMd.ts').main;
}
main();
require('./execWithSrc.cjs')('metadataMd');
+2 -2
View File
@@ -9,7 +9,7 @@ import Handlebars from 'handlebars';
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { Definitions } from '@polkadot/types/types';
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
import lookupDefinitions from '@polkadot/types-augment/lookup/definitions';
import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -85,7 +85,7 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
// Call `generateForMeta()` with current static metadata
/** @internal */
export function generateDefaultConsts (dest = 'packages/api-augment/src/augment/consts.ts', data?: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
export function generateDefaultConsts (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata } = initMeta(data, extraTypes);
return generateForMeta(metadata, dest, extraTypes, isStrict, customLookupDefinitions);
+1 -1
View File
@@ -48,7 +48,7 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
// Call `generateForMeta()` with current static metadata
/** @internal */
export function generateDefaultErrors (dest = 'packages/api-augment/src/augment/errors.ts', data?: HexString, extraTypes: ExtraTypes = {}, isStrict = false): void {
export function generateDefaultErrors (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false): void {
const { metadata } = initMeta(data, extraTypes);
return generateForMeta(metadata, dest, isStrict);
+2 -2
View File
@@ -9,7 +9,7 @@ import Handlebars from 'handlebars';
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { Definitions } from '@polkadot/types/types';
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
import lookupDefinitions from '@polkadot/types-augment/lookup/definitions';
import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -77,7 +77,7 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
// Call `generateForMeta()` with current static metadata
/** @internal */
export function generateDefaultEvents (dest = 'packages/api-augment/src/augment/events.ts', data?: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
export function generateDefaultEvents (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata } = initMeta(data, extraTypes);
return generateForMeta(metadata, dest, extraTypes, isStrict, customLookupDefinitions);
@@ -79,6 +79,6 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
export function generateDefaultInterface (): void {
generateInterfaceTypes(
{ '@polkadot/types/interfaces': defaultDefinitions },
'packages/types-augment/src/augment/registry.ts'
'packages/types-augment/src/registry.ts'
);
}
+1 -1
View File
@@ -231,7 +231,7 @@ function generateLookup (destDir: string, entries: [string | undefined, HexStrin
}
// Generate `packages/types/src/lookup/*s`, the registry of all lookup types
export function generateDefaultLookup (destDir = 'packages/types-augment/src/augment/lookup', staticData?: HexString): void {
export function generateDefaultLookup (destDir = 'packages/types-augment/src/lookup', staticData?: HexString): void {
generateLookup(
destDir,
staticData
+2 -2
View File
@@ -11,7 +11,7 @@ import Handlebars from 'handlebars';
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { unwrapStorageSi } from '@polkadot/types/primitive/StorageKey';
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
import lookupDefinitions from '@polkadot/types-augment/lookup/definitions';
import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, TypeImports, writeFile } from '../util';
@@ -134,7 +134,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
// Call `generateForMeta()` with current static metadata
/** @internal */
export function generateDefaultQuery (dest = 'packages/api-augment/src/augment/query.ts', data?: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
export function generateDefaultQuery (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata, registry } = initMeta(data, extraTypes);
return generateForMeta(registry, metadata, dest, extraTypes, isStrict, customLookupDefinitions);
+2 -1
View File
@@ -8,6 +8,7 @@ import type { ExtraTypes } from './types';
import Handlebars from 'handlebars';
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
import staticSubstrate from '@polkadot/types-support/metadata/static-substrate';
import { createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -144,7 +145,7 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
}
export function generateDefaultRpc (dest = 'packages/rpc-augment/src/augment/jsonrpc.ts', extraTypes: ExtraTypes = {}): void {
const { registry } = initMeta(undefined, extraTypes);
const { registry } = initMeta(staticSubstrate, extraTypes);
generateRpcTypes(
registry,
+2 -2
View File
@@ -10,7 +10,7 @@ import Handlebars from 'handlebars';
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { Text } from '@polkadot/types/primitive';
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
import lookupDefinitions from '@polkadot/types-augment/lookup/definitions';
import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -119,7 +119,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
// Call `generateForMeta()` with current static metadata
/** @internal */
export function generateDefaultTx (dest = 'packages/api-augment/src/augment/tx.ts', data?: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
export function generateDefaultTx (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata, registry } = initMeta(data, extraTypes);
return generateForMeta(registry, metadata, dest, extraTypes, isStrict, customLookupDefinitions);
+20 -7
View File
@@ -1,18 +1,31 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import kusama from '@polkadot/types-support/metadata/static-kusama';
import polkadot from '@polkadot/types-support/metadata/static-polkadot';
import substrate from '@polkadot/types-support/metadata/static-substrate';
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultInterface, generateDefaultLookup, generateDefaultQuery, generateDefaultRpc, generateDefaultTsDef, generateDefaultTx } from './generate';
const BASE = 'packages/api-augment/src';
const METAS = Object.entries({ kusama, polkadot, substrate }) as [string, HexString][];
export function main (): void {
generateDefaultLookup();
generateDefaultInterface();
generateDefaultConsts();
generateDefaultErrors();
generateDefaultEvents();
generateDefaultQuery();
generateDefaultTx();
generateDefaultRpc();
generateDefaultTsDef();
for (const [name, staticMeta] of METAS) {
console.log();
console.log(`*** Generating for ${name}`);
generateDefaultConsts(`${BASE}/${name}/consts.ts`, staticMeta);
generateDefaultErrors(`${BASE}/${name}/errors.ts`, staticMeta);
generateDefaultEvents(`${BASE}/${name}/events.ts`, staticMeta);
generateDefaultQuery(`${BASE}/${name}/query.ts`, staticMeta);
generateDefaultTx(`${BASE}/${name}/tx.ts`, staticMeta);
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '7.0.1' };
export const packageInfo = { name: '@polkadot/typegen', version: '7.1.1' };
+1 -2
View File
@@ -5,7 +5,6 @@ import type { HexString } from '@polkadot/util/types';
import type { ExtraTypes } from '../generate/types';
import { Metadata, TypeRegistry } from '@polkadot/types';
import staticSubstrate from '@polkadot/types-support/metadata/static-substrate';
import { registerDefinitions } from './register';
@@ -14,7 +13,7 @@ interface Result {
registry: TypeRegistry;
}
export function initMeta (staticMeta: HexString = staticSubstrate, extraTypes: ExtraTypes = {}): Result {
export function initMeta (staticMeta: HexString, extraTypes: ExtraTypes = {}): Result {
const registry = new TypeRegistry();
registerDefinitions(registry, extraTypes);
+3 -3
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.0.1",
"version": "7.1.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.5",
"@polkadot/types": "7.0.1",
"@polkadot/types-codec": "7.0.1",
"@polkadot/types": "7.1.1",
"@polkadot/types-codec": "7.1.1",
"@polkadot/util": "^8.2.2"
}
}
+2 -1
View File
@@ -2,8 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { packageInfo as codecInfo } from '@polkadot/types-codec/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [typesInfo]);
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [typesInfo, codecInfo]);

Some files were not shown because too many files have changed in this diff Show More