Compare commits

...
66 Commits
Author SHA1 Message Date
Github Actions 6c8dd4be3b [CI Skip] 1.2.1
skip-checks: true
2020-02-16 07:28:13 +00:00
Jaco Greeff a339491d07 1.2 (#1867) 2020-02-16 08:21:50 +01:00
Github Actions ea87472354 [CI Skip] 1.2.0-beta.30
skip-checks: true
2020-02-16 07:01:44 +00:00
Jaco Greeff 0ed156e5d9 FAQ entry for system.account (#1866) 2020-02-16 07:54:46 +01:00
Github Actions 59590540d8 [CI Skip] 1.2.0-beta.29
skip-checks: true
2020-02-16 06:41:42 +00:00
Jaco Greeff c465252e69 Make Metadata <-> hex encoding work (#1862)
* Make Metadata <-> hex encoding work

* Cleanup encoded, only toString exposes santized

* toHex is actual original toHex, remove override

* Update CHANGELOG

* CHANGELOG for .entries argument typing

* Update CHANGELOG.md

* Manual check type for DoubleMap

* Comment around super.toString usage

* Runtime version
2020-02-16 07:34:45 +01:00
Github Actions 0822d4d8c6 [CI Skip] 1.2.0-beta.28
skip-checks: true
2020-02-15 16:58:04 +00:00
Jeremías Díaz 2c3eee4c67 fix: make entries accept args for double maps (#1864) 2020-02-15 17:51:01 +01:00
Github Actions b069710008 [CI Skip] 1.2.0-beta.27
skip-checks: true
2020-02-15 12:10:44 +00:00
Jaco Greeff 9a7e0bf82d Bump deps (#1861)
* Bump deps

* Bump common
2020-02-15 13:03:34 +01:00
Github Actions 4f520f5de6 [CI Skip] 1.2.0-beta.26
skip-checks: true
2020-02-15 08:56:55 +00:00
Jaco Greeff 79ee2ede3d Cleanup date test with locale offset (#1860)
* Cleanup date test with locale offset

* CHANGELOG

* Add dates to CHANGELOG
2020-02-15 09:49:39 +01:00
Github Actions f6b02e1de1 [CI Skip] 1.2.0-beta.25
skip-checks: true
2020-02-15 08:23:22 +00:00
Jaco Greeff c11b0dffc5 Adjust CHANGELOG with all latest changes (#1859) 2020-02-15 09:17:07 +01:00
Github Actions 0935c39906 [CI Skip] 1.2.0-beta.24
skip-checks: true
2020-02-15 07:59:29 +00:00
Keith IngramandJaco Greeff ee622f3d2b Add api.derive.registrar.parachains (#1856)
* api.derive.registrar.parachains

* remove api parse

* suggestions

* some

* Update packages/api-derive/src/parachains/all.ts

* Update packages/api-derive/src/index.ts

* Update packages/api-derive/src/index.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-02-15 08:52:40 +01:00
Github Actions ae350aae6f [CI Skip] 1.2.0-beta.23
skip-checks: true
2020-02-15 07:41:46 +00:00
Axel Chalon 26c59f6d6e Format documentation strings properly & refactor MetadataMd (#1858)
* Format docs strings properly

* Refactor MetadataMd
2020-02-15 08:35:15 +01:00
Github Actions 51c6262327 [CI Skip] 1.2.0-beta.22
skip-checks: true
2020-02-14 15:21:11 +00:00
Jaco Greeff 07ed405610 Bump common (& add @types/bn.js) (#1855) 2020-02-14 16:14:18 +01:00
Github Actions cd5d7b10c3 [CI Skip] 1.2.0-beta.21
skip-checks: true
2020-02-14 14:47:36 +00:00
Jaco Greeff 8e5b43bf62 Add isInBlock, isRetracted (...) to status enum (#1852) 2020-02-14 15:40:56 +01:00
Github Actions 49f3e36c46 [CI Skip] 1.2.0-beta.20
skip-checks: true
2020-02-14 13:54:07 +00:00
Jaco Greeff 7e25145fbf Format known storage (align with others) (#1851) 2020-02-14 14:46:42 +01:00
Github Actions b5bc2ccfaf [CI Skip] 1.2.0-beta.19
skip-checks: true
2020-02-14 13:28:31 +00:00
Jaco Greeff 0e7c508d7f Split private statics from Call (#1849) 2020-02-14 14:21:38 +01:00
Github Actions 4e1c377ceb [CI Skip] 1.2.0-beta.18
skip-checks: true
2020-02-14 12:59:42 +00:00
Jaco Greeff 5c4920db6f Remove balances.freeBalance & system.accountNonce refs (#1847)
* Remove freeBalance references

* Cleanup placeholders

* Add substrate templates to .gitignore

* Swap all use of system.accountNonce

* typo
2020-02-14 13:52:45 +01:00
Github Actions 679e31668e [CI Skip] 1.2.0-beta.17
skip-checks: true
2020-02-14 09:21:48 +00:00
Jaco Greeff 00e567b662 Bump metadata (#1844)
* Bump metadata

* Copy error

* Bump dev

* Fix linting

* Adjust some tests

* FIXME for formatting
2020-02-14 10:15:11 +01:00
Github Actions 503193d6c2 [CI Skip] 1.2.0-beta.16
skip-checks: true
2020-02-14 07:18:45 +00:00
Jaco Greeff 5e82c97c8a Bump dev (#1843)
* Bump dev

* Bumps
2020-02-14 08:12:57 +01:00
Github Actions 8c12c227b4 [CI Skip] 1.2.0-beta.15
skip-checks: true
2020-02-13 23:11:05 +00:00
Jaco Greeff d72456fb26 Bump dev (#1842) 2020-02-14 00:04:43 +01:00
Github Actions ca6d78e7ec [CI Skip] 1.2.0-beta.14
skip-checks: true
2020-02-13 22:08:12 +00:00
Axel Chalon 8210c708ac Add errors to documentation (#1841)
* Add errors to docs

* Fix broken anchor links (camel-case links but lowercase anchors)
2020-02-13 23:01:05 +01:00
Github Actions 41764562e1 [CI Skip] 1.2.0-beta.13
skip-checks: true
2020-02-13 21:32:08 +00:00
Axel Chalon 66c8e5b4e8 Add author_{hasKey, hasSessionKeys} RPCs (#1837)
* Add author_{hasKey, hasSessionKeys} RPCs

* yarn docs

* Revert "yarn docs"

This reverts commit c23624e1d844fcd8821ccf4bd73f0175a3a10526.
2020-02-13 22:24:11 +01:00
Github Actions ca7fe86089 [CI Skip] 1.2.0-beta.12
skip-checks: true
2020-02-13 14:47:22 +00:00
Jaco Greeff cf2fbfce26 Bump dev (#1839) 2020-02-13 15:39:40 +01:00
Github Actions d69113ca5a [CI Skip] 1.2.0-beta.11
skip-checks: true
2020-02-12 17:07:57 +00:00
Jaco Greeff d7eb40caf5 Additional explicit packages (#1836)
* Additional explicit packages

* Package name
2020-02-12 17:59:54 +01:00
Github Actions 2eda438eac [CI Skip] 1.2.0-beta.10
skip-checks: true
2020-02-12 15:41:07 +00:00
Jaco Greeff beddc3e0a5 Explicit deps & bumps (#1835)
* Explicit deps & bumps

* Update CHANGELOG.md
2020-02-12 16:33:57 +01:00
Github Actions ac1ae34e37 [CI Skip] 1.2.0-beta.9
skip-checks: true
2020-02-11 20:35:54 +00:00
Jaco Greeff 52953f248b Adjust composite version (#1833) 2020-02-11 21:28:29 +01:00
Github Actions e027f865aa [CI Skip] 1.2.0-beta.8
skip-checks: true
2020-02-11 13:23:21 +00:00
Jaco Greeff d4e3e546dc Cleanup sanitize with groupings (#1832)
* Cleanup sanitize with groupings

* Small additional cleanups
2020-02-11 14:16:01 +01:00
Github Actions 6cb5476c80 [CI Skip] 1.2.0-beta.7
skip-checks: true
2020-02-11 09:43:56 +00:00
Jaco Greeff 52ffa175a9 Versioned polkadot overrides (#1831) 2020-02-11 10:36:01 +01:00
Github Actions ba2cd0cff5 [CI Skip] 1.2.0-beta.6
skip-checks: true
2020-02-10 20:33:01 +00:00
Keith Ingram fefcc2e0dc update parachains types (#1830) 2020-02-10 15:25:14 -05:00
Github Actions c8fbed2a12 [CI Skip] 1.2.0-beta.5
skip-checks: true
2020-02-10 17:52:41 +00:00
Jaco Greeff 6581d779c7 Alias Address -> AccountId for polkadot/kusama (#1825)
* Swap Address -> LookupSource (correct aliasses)

* Adjust overrides with explicit LookupSource

* Map Lookup{Source,Target}

* Adjust overrides

* Comment Address -> AccountId (for now)

* Fix typo in comments

* Map Address -> AccountId

* CHANGELOG
2020-02-10 18:44:12 +01:00
Github Actions cab5b8bff7 [CI Skip] 1.2.0-beta.4
skip-checks: true
2020-02-08 14:03:31 +00:00
Jaco Greeff 480c0abda8 Add BitVec type (#1822)
* Add BitVec type

* Update comments

* Fixup decoding check

* Fix linting
2020-02-08 14:56:08 +01:00
Github Actions 866c5769bb [CI Skip] 1.2.0-beta.3
skip-checks: true
2020-02-08 13:53:08 +00:00
Jaco Greeff d8141198e1 Provide mapping for LookupSource & LookupTarget (#1823)
* Provide mapping for LookupSource & LookupTarget

* Type overrides for Kusama-next

* Fix LookupSource for Kusama-next

* Fixup tests with lookup
2020-02-08 14:46:08 +01:00
Github Actions a6a1a52d61 [CI Skip] 1.2.0-beta.2
skip-checks: true
2020-02-08 12:19:01 +00:00
Jaco Greeff b6534d2958 Polkadot V11 metadata (#1821) 2020-02-08 13:11:33 +01:00
Github Actions 3645cde156 [CI Skip] 1.2.0-beta.1
skip-checks: true
2020-02-07 14:50:37 +00:00
Jaco Greeff 2ac3640900 Update AccountIndex derive (#1820) 2020-02-07 15:43:21 +01:00
Github Actions e379e7fabd [CI Skip] 1.2.0-beta.0
skip-checks: true
2020-02-07 13:42:08 +00:00
Jaco Greeff 69dae84a42 Update .123trigger (#1819) 2020-02-07 14:34:57 +01:00
Jaco Greeff fe52484547 Query nonce/data from system.account (as available) (#1814)
* Query nonce/data from sustem.account (as available)

* Detect new nonce query, retrieve

* Call system.account for nonce & balance

* Update CHANGELOG
2020-02-07 14:20:34 +01:00
Jaco Greeff faa12a68f7 Move internal decoding to top-level-functions (#1818)
* Move internal decoding to top-level-functions

* Cleanup imports
2020-02-07 14:12:30 +01:00
136 changed files with 9386 additions and 3292 deletions
+1 -1
View File
@@ -1 +1 @@
17
18
+2 -2
View File
@@ -29,7 +29,7 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn polkadot-dev-ghact-build
yarn polkadot-ci-ghact-build
build_docs:
name: Build Docs
@@ -52,7 +52,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn polkadot-dev-ghact-docs
yarn polkadot-ci-ghact-docs
dummy:
name: Dummy
+1
View File
@@ -3,6 +3,7 @@ build/
build-docs/
coverage/
docs/.vuepress/dist/
docs/substrate/*.md
node_modules/
tmp/
.DS_Store
+102 -43
View File
@@ -1,5 +1,24 @@
# 1.1.1
# 1.2.1 Feb 16, 2020
- **Important** Update RPC status codes (latest Substrate 2), with the `isInBlock` (`isFinalized` now indicates finality)
- Storage `.entries(arg?: any)` now has the correct argument type for DoubleMap (Thanks to https://github.com/monitz87)
- Swap Kusama and Polkadot aliasses for `Address` to `AccountId` (future update)
- Add `LookupSource` and `LookupTarget` types instead of mapping these directly for aliassing
- Add `BitVec` type primitive
- Add support for `system.account` for balance & nonce queries in derives as well as Submittables (Substrate composites)
- Add `rpc.author.hasKey` and `rpc.author.hasSessinKeys` RPCs
- Add derives for the parachains interfaces
- Applied the latest types for Polkadot parachains
- `registry.findMetaError` now can take in a `DispatchErrorModule` object for error lookups (from `asModule` in `DispatchError`)
- Metadata now correctly serializes to the original input data via `toHex()` & `toU8a()`
- Metadata dcocumentation generation rework, including the output of errors from metadata
- Update all examples and comments to use latest `system.account` queries (instead of `system.accountNonce` and `balances.freeBalance`/`balances.reservedBalance`)
- Cleanup `codec/Date` tests to make it run properly on all timezones
- Add explicit dependencies to all packages and move TypeScript `@types/*` to dev deps
# 1.1.1 Feb 06, 2020
- **Important** Chains without `balances.account` or `system.account` should supply `"BalanceLock": "BalanceLockTo212"` to their types to use the previous-generation `BalanceLock` (when querying locks)
- Add support for `balances.account` in all applicable derives (incl. `vesting` module)
- Inject and use SignedExtensions by name from V11 metadata (V4 extrinsics only)
- Add typings for `api.tx.*.*` - the `polkadot-types-from-chain` now also generates these
@@ -11,7 +30,7 @@
- Adjust balances fees derivation with optional transfer and creation fees (removed in Substrate)
- Adjust enum `.toJSON()` to return type name as specified
# 1.0.1
# 1.0.1 Jan 30, 2020
- **Breaking change** Drop support for Substrate v1 chain in all derives
- Return unsub functions from provider .on emitters (Thanks to https://github.com/jak-pan)
@@ -23,14 +42,14 @@
- Allow type-aliases on a per-module basis (e.g. `Judgement` in identity as well as society)
- Allow passing `{ signer }` to both `api.tx.*` and `api.sign` (in addition to `api.setSigner`)
- Add derives for the society module
- Don't map empty tuples, e.. `()` to `Null`, rather keep them empty
- Don't map empty tuples, e.g. `()` to `Null`, rather keep them empty
- Add lookups to the metadata errors via `findMetaError`
- Update metadata and types for the latest Substrate & Polkadot versions
- Support metadata V11 as per latest Substrate
- Remove support for un-deployed metadata
- Remove old known types for Substrate V1
# 0.100.1
# 0.100.1 Jan 13, 2020
- **Important** This will the the last API version with Substrate 1.x support. Although you will still be able to use subsequent versions with older chans, dependent libraries such as sr25519 may not be compatible.
- Add support for the Substrate identity module
@@ -41,7 +60,7 @@
- Add support for latest Polkadot/Substrate types
- Add `paymentInfo` to submittables to calculate fees
# 0.99.1
# 0.99.1 Dec 13, 2019
- **Breaking change** The `Data` and `U8a` type has been renamed and just replaced with the `Raw` type
- **Breaking change** The `api.derive.staking.info` has been split into 2 - `staking.query` for non-balance related information (more effective) and `staking.account` that enhances query for all the information previously found `.info`
@@ -50,7 +69,7 @@
- Add additional derives for both council & treasury
- Alignment with latest Polkadot/Substrate master branch types
# 0.98.1
# 0.98.1 Dec 04, 2019
- Make the TypeScript generation script mor re-usable (Thanks to https://github.com/xlc)
- Add `.entries()` for all map-types, returning storage keys and values
@@ -59,7 +78,7 @@
- Support for new Substrate democracy with preimages in derive
- Alignment of types with Substrate/Polkadot master branches
# 0.97.1
# 0.97.1 Nov 29, 2019
- **Breaking change** Add the passing on an explicit `Registry` to all calls to `createType` as well as all codec classes. If you are upgrading form an older version, use the [migration guide](UPGRADING.md) to walk through the changes required.
- **Breaking change** The metadata classes have been moved from `@polkadot/types` into `@polkadot/metadata`. If you explicitly create `Metadata` classes, you now would need to do so with the `import Metadata from '@polkadot/metadata';` This is a decorated class, where the previous metadata is now available on `Metadata.metadata`, alongside decorated `consts.*`', `tx.*` and `query.*`.
@@ -71,7 +90,7 @@
- Support for Metadata V9, which adjusts the hashing methods of storage entries
- Support for Metadata V10 (still un-released), which includes prefixed map support
# 0.96.1
# 0.96.1 Nov 09, 2019
- Updated types for latest Kusama
- Add `filterRecords` (in addition to `findRecord`) on submittable results
@@ -81,11 +100,11 @@
- Update council derives for the latest Substrate master support (with constants)
- Derive cleanups, including sharing of instances between the API and internal to derives
# 0.95.2
# 0.95.2 Oct 25, 2019
- Temporary removal of `account_nextIndex` use, will be re-added in a future release
# 0.95.1
# 0.95.1 Oct 25, 2019
- Support Extrinsic V4 with additional signature indicator (Latest Polkadot/Substrate/Kusama)
- Adjust subscription update checks to avoid duplicated data updates
@@ -95,7 +114,7 @@
- All latest Polkadot & Substrate types (as per master branches)
- **Breaking change** `Call.injectMethods` is moved to `Call.injectMetadata` to align with `Events` (This _should_ not be used externally, however mentioned as breaking here)
# 0.94.1
# 0.94.1 Oct 07, 2019
- Add handling of `Result<Ok, Error>` definitions
- Adjust API cloning now takes RPC filters from source into account
@@ -107,7 +126,7 @@
- Add documentation for custom extrinsic formats (advanced chains)
- Update to latest substrate master metadata
# 0.93.1
# 0.93.1 Sep 26, 2019
- Support for Kusama CC2
- In extrinsic submission, use `rpc.account.nextIndex` to retrieve the nonce when available
@@ -117,7 +136,7 @@
- Support recursive type registration (self-referencing via `Box`) in addition to better sanitation of user-defined-types
- Documentation and example updates (thanks mostly to contributions)
# 0.92.1
# 0.92.1 Sep 12, 2019
- The API now correctly sets the ss58 prefix as retrieved from the chain properties via `ss58Format`
- Bump to `@polkadot/util` 1.4.1, removing use of `ExtError`
@@ -125,7 +144,7 @@
- Support the latest Polkadot & Substrate master branches (incl. metadata updates)
- Getting started documentation has been made available
# 0.91.1
# 0.91.1 Sep 09, 2019
- This release was focussed on stability, with a number of cleanups and bug-fixes
- Adjustments for Substrate 1.x chain detection (with auto-types) and Substrate 2.x support has been extended with all latest types
@@ -139,7 +158,7 @@
- **Breaking change** `SignerPayload` is renamed to `SignerPayloadJSON`
- **Breaking change** `SignerPayloadJSON`, `SignerPayloadRawBase` and `SignerPayloadRaw` are all moved to `@polkadot/types`
# 0.90.1
# 0.90.1 Aug 24, 2019
If you are upgrading form an older version, use the CHANGELOG hand-in-hand with the [migration guide](UPGRADING.md).
@@ -157,7 +176,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- The `types/codec/createType` has been moved to `types/codec/create` with the same exports. If you explicitly imported from here (and not doing the suggested `import { createType } from '@polkadot/types`), the reference needs to be updated
# 0.82.0-beta.x
# 0.82.0-beta.x Jul 28, 2019
- Support for substrate 2.x (master) has been extended,
- Additional types have been addedd for the modules
@@ -176,7 +195,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- The `ContractsAbi` type has been moved from `@polkadot/types` to `import { Abi } from '@polkadot/api-contract`. This paves the way for an enhanced contracts interface, instead of dealing with low-level API calls.
# 0.81.1
# 0.81.1 Jun 14, 2019
- The dependency on `@polkadot/keyring` has been removed - if you relied on the API to provide this, you would now need to manually add it
- `createType` allows for the creation of `[u8; <length>]` types (opening the door for contract support)
@@ -196,7 +215,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- Add `off` method to `Api` (Base, for both `ApiPromise` & `ApiRx`) to remove an event listener
# 0.80.1
# 0.80.1 Jun 04, 2019
- Support for mortal transactions
- Better DoubleMap storage support
@@ -206,7 +225,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- Misc. cleanups and fixes
# 0.79.1
# 0.79.1 May 22, 2019
- DoubleMap query support
- Support latest EventRecord metadata (substrate master)
@@ -218,7 +237,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- Add `toRawType` on all type classes (breakdown into primitive types)
# 0.78.1
# 0.78.1 May 08, 2019
- Fix linked-maps (not working since 0.77.1)
- Convert Usize to U32 (as found in WASM environments)
@@ -229,13 +248,13 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- Metadata updates for substrate (WithdrawReasons, ContractInfo)
# 0.77.1
# 0.77.1 Apr 25, 2019
- Support Metadata v4, which introduces the use of a custom hasher to hash storage map keys.
- Add TreasuryProposal (not the same as democracy, type aliased)
# 0.76.1
# 0.76.1 Apr 03, 2019
- Caching improvements (duplicate queries, no duplicate subscriptions)
- Experimental contract API
@@ -243,12 +262,12 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- Update @polkadot/util-crypto with smaller footprint
# 0.75.1
# 0.75.1 Mar 29, 2019
- Start journey to 1.0
# 0.53.1
# 0.53.1 Mar 29, 2019
- Change spelling to US English as per substrate master (1.0-rc1). Breaking changes as a result:
- For extrinsic status results, if you have checked the type returns, i.e. `result.type === 'Finalised'` now check on the status for `result.status.isFinalized` or `result.status.isBroadcast`, ... (the `type` property is now accessible only on `result.status.type`)
@@ -259,7 +278,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- All examples have been updated with sr25519 addresses (with the new checksums)
# 0.52.1
# 0.52.1 Mar 28, 2019
- Support queries to linked mapped storage (found in new staking interfaces)
- Add `derive.staking.controllers` to retrieve all active staking controllers
@@ -269,42 +288,42 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
- Check for single instances for api and types as they are loaded (assertSingletonPackage)
# 0.51.1
# 0.51.1 Mar 25, 2019
- Support metadata V2 as per latest substrate master
- Update metadata with new types as per latest substrate master
# 0.50.1
# 0.50.1 Mar 23, 2019
- Latest util-crypto (usage of WASM with JS fallbacks if not available)
- Update upstream @polkadot dependencies (for new crypto)
# 0.49.1
# 0.49.1 Mar 20, 2019
- Fix large message signing on non-known nodes (default is now hashing, there has been enough time between upgrades)
# 0.48.1
# 0.48.1 Mar 18, 2019
- Pull in new sr25519 capable keyring for dev nodes
- When using dev mode, it assumes that the node is the latest with derived sr25519 keys
# 0.47.1
# 0.47.1 Mar 14, 2019
- Swap to publishing -beta.x on merge (non-breaking testing)
# 0.46.1
# 0.46.1 Mar 01, 2019
- Extended type registration to now handle internal types as well. Additionally the built-in Extrinsic type can now we overridden with a custom version.
- Where `Extrinsic` and `Method` is used as types, consider importing `{ IMethod, IExtrinsic }` from `@polkadot/types/types`, especially in the cases where this is used from a `SubmittableExtrinsic`
- The `typeRegistry` constant is now `getTypeRegistry()` as a function
# 0.45.1
# 0.45.1 Feb 19, 2019
- Storage with option values now correctly return `Option<Type>` and is indicated as such in the documentation
@@ -321,7 +340,7 @@ console.log('llo', llo.unwrapOr('not set') /* Option<BlockNumber> */)
```
# 0.44.1
# 0.44.1 Feb 19, 2019
- Split primitives and types into separate folders. This should not affect external use since the exports remain the same, however does have an impact where classes are referenced directly. e.g.
@@ -339,45 +358,45 @@ import { Method, Signature } from '@polkadot/types';
```
# 0.43.1
# 0.43.1 Feb 14, 2019
- Introduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considered breaking since @polkadot/keyring has interface changes. (Unless needed, don't rush the upgrade)
# 0.42.1
# 0.42.1 Jan 31, 2019
- Support for substrate hash signing with implVersion >= 18
- Changed signatures for Extrinsic signing, this should not have (much) of an impact since it is generally not used directly. SubmittableExtrinsic (as exposed by the API), supports the old-style use.
# 0.41.1
# 0.41.1 Jan 26, 2019
- Support the V1 metadata specification from Substrate in addition to the currently testnet active V0 version
# 0.40.1
# 0.40.1 Jan 16, 2019
- The API interfaces now require a WS-compatible provider, e.g. subscription support is a must. Previously the HTTPProvider could be use (although it was very limited in the interactions).
# 0.39.1
# 0.39.1 Jan 11, 2019
- The Promise API now returns a `Promise<UnsubFunction>` instead of `UnsubFunction` when making subscriptions.
# 0.38.1
# 0.38.1 Jan 08, 2019
Substrate has been updated with a breaking new transaction format where the Index/Nonce is now encoded as a Compact. This change is being rolled out to both Alexander (Polkadot testnet) as well as Charred Cherry (Substrate testnet) - transactions between old and new are not compatible.
# 0.37.1
# 0.37.1 Jan 04, 2019
api-observable has been removed. This was only used in /apps and inconsistent with the api/rx and api/promise APIs. Future work will include derives like was included in api-observable into the base.
Tuples now return single types when only one type is available, i.e. `(AccountId)` would now resolve as `AccountId`. The extra type wrapper adds no benefit to users here.
# 0.36.1
# 0.36.1 Jan 03, 2019
Api Promise has been updated in the way we deal with subscriptions. Previously a subscription returned `Promise<number>` where the caller was to keep track of the id and use it in subsequent unsubscribes. Now any subscriptions return an unsubscribe/destroy function `(): void`, that is use for removing the subscriptions, e.g.
@@ -388,11 +407,51 @@ unsubscribe(); // here we destroy the subscription
```
# 0.35.1
# 0.35.1 Dec 20, 2018
Swapped to new metadata structures from Substrate. If the API is not working with your node, update Substrate to latest master branch. (Or 0.9.1 for Charred Cherry). Dropped support for old metadata as found as far back as BBQ Birch.
# 0.34.1
# 0.34.1 Dec 18, 2018
Changed the send signature (for future expansion of eg. events) to return `result: { status: ExtrinsicStatus }` instead of `status: ExtrinsicStatus`. For most cases where only status `type` checks are used, i.e. `status.type === 'Finalised'` this should not be a breaking change. Deep inspection of the status object however will need to adapt.
# 0.33.1 Dec 06, 2018
# 0.32.1 Nov 21, 2018
# 0.31.1 Oct 10, 2018
# 0.30.1 Sep 27, 2018
# 0.29.1 Sep 14, 2018
# 0.28.1 Aug 11, 2018
# 0.15.1 Aug 07, 2018
# 0.14.1 Jun 23, 2018
# 0.13.1 May 29, 2018
# 0.12.1 May 18, 2018
# 0.11.1 May 16, 2018
# 0.10.1 May 07, 2018
# 0.9.1 Apr 24, 2018
# 0.8.1 Mar 15, 2018
# 0.7.1 Jan 25, 2018
# 0.6.1 Dec 03, 2017
# 0.5.1 Nov 28, 2017
# 0.4.1 Nov 19, 2017
# 0.3.1 Nov 19, 2017
# 0.2.1 Nov 18, 2017
+3 -1
View File
@@ -68,6 +68,7 @@ module.exports = {
},
{
title: 'Substrate defaults',
path: '/substrate/',
collapsable: false,
sidebarDepth: 0,
children: [
@@ -75,7 +76,8 @@ module.exports = {
['substrate/constants.md', 'Constants'],
['substrate/storage.md', 'State storage'],
['substrate/extrinsics.md', 'Extrinsics'],
['substrate/events.md', 'System events']
['substrate/events.md', 'System events'],
['substrate/errors.md', 'Errors']
]
},
['/api/', '@polkadot/api'],
@@ -13,21 +13,23 @@ async function main () {
// Retrieve the initial balance. Since the call has no callback, it is simply a promise
// that resolves to the current on-chain value
let previous = await api.query.balances.freeBalance(Alice);
let [previousNonce, { free: previousFree }] = await api.query.system.account(Alice);
console.log(`${Alice} has a balance of ${previous}`);
console.log(`${Alice} has a balance of ${previousFree}, nonce ${previousNonce}`);
console.log(`You may leave this example running and start example 06 or transfer any value to ${Alice}`);
// Here we subscribe to any balance changes and update the on-screen value
api.query.balances.freeBalance(Alice, (current) => {
api.query.system.account(Alice, ([currentNonce, { free: currentFree }]) => {
// Calculate the delta
const change = current.sub(previous);
const change = currentFree.sub(previousFree);
// Only display positive value changes (Since we are pulling `previous` above already,
// the initial balance change will also be zero)
if (!change.isZero()) {
previous = current;
console.log(`New balance change of: ${change}`);
console.log(`New balance change of ${change}, nonce ${currentNonce}`);
previousFree = currentFree;
previousNonce = currentNonce;
}
});
}
@@ -15,8 +15,8 @@ async function main () {
console.log('Tracking balances for:', [ALICE, BOB]);
// Subscribe and listen to several balance changes
api.query.balances.freeBalance.multi([ALICE, BOB], (balances) => {
console.log('Change detected, new balances: ', balances);
api.query.system.account.multi([ALICE, BOB], (balances) => {
console.log('Change detected, new balances: ', balances.map(([, { free }]) => free));
});
}
@@ -12,8 +12,8 @@ async function main () {
const api = await ApiPromise.create();
// Make our basic chain state/storage queries, all in one go
const [accountNonce, now, validators] = await Promise.all([
api.query.system.accountNonce(ALICE),
const [[accountNonce], now, validators] = await Promise.all([
api.query.system.account(ALICE),
api.query.timestamp.now(),
api.query.session.validators()
]);
@@ -25,14 +25,15 @@ async function main () {
// Retrieve the balances for all validators
const validatorBalances = await Promise.all(
validators.map(authorityId =>
api.query.balances.freeBalance(authorityId)
api.query.system.account(authorityId)
)
);
// Print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index].toString()
balance: validatorBalances[index][1].free.toString(),
nonce: validatorBalances[index][0].toString()
})));
}
}
@@ -19,14 +19,14 @@ async function main () {
// Retrieve the balance at the preceding block for Alice. For at queries
// the format is always `.at(<blockhash>, ...params)`
const balance = await api.query.balances.freeBalance.at(parentHash, ALICE);
const balance = await api.query.system.account.at(parentHash, ALICE);
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance}`);
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance[1].free}`);
// Now perform a multi query, returning multiple balances at once
const balances = await api.query.balances.freeBalance.multi([ALICE, BOB]);
const balances = await api.query.system.account.multi([ALICE, BOB]);
console.log(`Current balances for Alice and Bob are ${balances[0]} and ${balances[1]}`);
console.log(`Current balances for Alice and Bob are ${balances[0][1].free} and ${balances[1][1].free}`);
}
main().catch(console.error).finally(() => process.exit());
@@ -19,7 +19,7 @@ async function main () {
const alice = keyring.addFromUri('//Alice');
// Get nonce for account
const nonce = await api.query.system.accountNonce(alice.address);
const [nonce] = await api.query.system.account(alice.address);
// Get current block
const signedBlock = await api.rpc.chain.getBlock();
@@ -24,7 +24,7 @@ async function main () {
const keyring = testKeyring.default();
// Get the nonce for the admin key
const nonce = await api.query.system.accountNonce(ALICE);
const [nonce] = await api.query.system.account(ALICE);
// Find the actual keypair in the keyring
const alicePair = keyring.getPair(ALICE);
@@ -14,7 +14,7 @@ async function main () {
// Here we subscribe to any balance changes and update the on-screen value.
// We're using RxJs pairwise() operator to get the previous and current values as an array.
api.query.balances.freeBalance(Alice)
api.query.system.account(Alice)
.pipe(
// since pairwise only starts emitting values on the second emission, we prepend an
// initial value with the startWith() operator to be able to also receive the first value
@@ -25,12 +25,13 @@ async function main () {
if (balance[0] === 'first') {
// Now we know that if the previous value emitted as balance[0] is `first`,
// then balance[1] is the initial value of Alice account.
console.log(`Alice ${Alice} has a balance of ${balance[1]}`);
console.log(`Alice ${Alice} has a balance of ${balance[1][1].free}`);
console.log('You may leave this example running and start the "Make a transfer" example or transfer any value to Alice address');
return;
}
const change = balance[1].sub(balance[0]);
const change = balance[1][1].free.sub(balance[0][1].free);
// Only display value changes
if (!change.isZero()) {
console.log(`New balance change of: ${change}`);
+5 -4
View File
@@ -22,13 +22,13 @@ function main () {
// In the next step, we're checking if the node has active validators.
// If it does, we're making another call to the api to get the balances for all validators
const balances = (validators && validators.length > 0)
? combineLatest(validators.map(authorityId => api.query.balances.freeBalance(authorityId).pipe(first())))
? combineLatest(validators.map(authorityId => api.query.system.account(authorityId).pipe(first())))
: of(null);
// We're combining the results together with the emitted value 'validators',
// which we're turning back into an observable using of()
return combineLatest(
api.query.system.accountNonce(Alice).pipe(first()),
api.query.system.account(Alice).pipe(first()),
api.query.timestamp.blockPeriod().pipe(first()),
of(validators),
balances
@@ -36,7 +36,7 @@ function main () {
})
)
// Then we're subscribing to the emitted results
.subscribe(([accountNonce, blockPeriod, validators, validatorBalances]) => {
.subscribe(([[accountNonce], blockPeriod, validators, validatorBalances]) => {
console.log(`accountNonce(${Alice}) ${accountNonce}`);
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
@@ -44,7 +44,8 @@ function main () {
// And lastly we print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index].toString()
balance: validatorBalances[index][1].free.toString(),
nonce: validatorBalances[index][0].toString()
})));
}
});
+6
View File
@@ -33,3 +33,9 @@ Tuples, as defined in the Polkadot/Substrate types appear as `(TypeA, TypeB)`. F
Polkadot/Substrate supports both immortal and mortal transactions. For immortal, this means that the transaction has an infinite lifetime, for mortals, the transactions expire after a defined period. By default the API sends mortal transactions when no explicit extrinsic era has been specified. This means that all transaction has a limited lifetime and will expire if not included in the period set.
The length for this transaction validity is set to 50 blocks, which translates to 5 minutes assuming a default of 6 second blocktimes. (10 blocks per minute in this default configuration).
## My chain does not support system.account queries
The API always tracks the latest Substrate master in terms of examples. This means that nonce & balance queries are done via the `api.query.system.account(<account>)` which returns a Tuple `(Index, AccountData)` where the first is the nonce, the second a struct containing the free and reserved balances. As with all `api.query.*` endpoint, this is decorated based on what the chain you connect to support.
It is possible that you are connecting to an older chain that has not been upgraded yet. For these chains, this storage entry won't be available (yet). To query the nonce on older chains, you can do a query to `api.query.system.accountNonce(<account>)` and balances can be retrieved via `api.query.balances.freeBalance(<account>)`.
+6 -10
View File
@@ -16,24 +16,20 @@ const ADDR = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE';
// Retrieve the last timestamp
const now = await api.query.timestamp.now();
// Retrieve the account nonce via the system module
const nonce = await api.query.system.accountNonce(ADDR);
// Retrieve the account balance & nonce via the system module
const [nonce, balance] = await api.query.system.account(ADDR);
// Retrieve the account balance via the balances module
const balance = await api.query.balances.freeBalance(ADDR);
console.log(`${now}: balance of ${balance} and a nonce of ${nonce}`);
console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);
```
There have been some additions in the code above comparing with retrieving runtime constants. In these cases, since we are making a query to the actual chain, we use the `await` syntax to retrieve the information. Since the API is Promise-based, this means we can also rewrite the above to follow a Promise pattern,
```js
...
// Retrieve last block timestamp, account nonce & balance
const [now, nonce, balance] = await Promise.all([
// Retrieve last block timestamp, account nonce & balances
const [now, [nonce, balances]] = await Promise.all([
api.query.timestamp.now(),
api.query.system.accountNonce(ADDR),
api.query.balances.freeBalance(ADDR)
api.query.system.account(ADDR)
]);
```
+10 -11
View File
@@ -10,14 +10,14 @@ Where possible, the use of multi queries are encouraged since it tracks a number
...
// Subscribe to balance changes for 2 accounts, ADDR1 & ADDR2 (already defined)
const unsub = await api.query.balances.freeBalance.multi([ADDR1, ADDR2], (balances) => {
const [balance1, balance2] = balances;
const unsub = await api.query.system.account.multi([ADDR1, ADDR2], (balances) => {
const [[, balance1], [, balance2]] = balances;
console.log(`The balances are ${balance1} and ${balance2}`);
console.log(`The balances are ${balance1.free} and ${balance2.free}`);
});
```
A couple of items to note in the example above: we don't call `freeBalance` directly, but rather `freeBalance.multi`. We pass the addresses we want to query as an array, and the length thereof would depend on the number of addresses we want to query. As an extended example, we can track the balances of a list of validators,
A couple of items to note in the example above: we don't call `account` directly, but rather `account.multi`. We pass the addresses we want to query as an array, and the length thereof would depend on the number of addresses we want to query. As an extended example, we can track the balances of a list of validators,
```js
...
@@ -26,8 +26,8 @@ A couple of items to note in the example above: we don't call `freeBalance` dire
const validators = await api.query.session.validators();
// Subscribe to the balances for these accounts
const unsub = await api.query.balances.freeBalance.multi(validators, (balances) => {
console.log(`The balances are: ${balances}`);
const unsub = await api.query.balances.account.multi(validators, (balances) => {
console.log(`The nonce and free balances are: ${balances.map(([nonce, { free }]) => [nonce, free])}`);
});
```
@@ -43,17 +43,16 @@ The previous `.multi` examples assumes that we do queries for the same types, i.
// Subscribe to the timestamp, our index and balance
const unsub = await api.queryMulti([
api.query.timestamp.now,
[api.query.system.accountNonce, ADDR],
[api.query.balances.freeBalance, ADDR]
], ([now, nonce, balance]) => {
console.log(`${now}: balance of ${balance} and a nonce of ${nonce}`);
[api.query.system.account, ADDR]
], ([now, [nonce, balance]]) => {
console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);
});
```
The above example certainly does not quite look as ergonomic and clean, but the API needs to understand (a) which are all the calls we need to make and (b) the calls and their params (if required). So breaking it down -
- `api.query.timestamp.now` - the timestamp is passed naked without any params. Also note that we do not call it while passing, but rather only provides a reference to the function, i.e. we do not have the expected `()` at the end. (This could also be of the form `[api.query.timestamp.now]`, aligning with subsequent entries)
- `[api.query.system.accountNonce, ADDR]` - the nonce query is passed as an array containing the function (once again naked), followed by the parameters that apply.
- `[api.query.system.account, ADDR]` - the nonce & balance query is passed as an array containing the function (once again naked), followed by the parameters that apply.
## Rounding out queries
+8 -8
View File
@@ -13,13 +13,13 @@ Quite often is is useful (taking pruning into account, more on this later) to re
const lastHdr = await api.rpc.chain.getHeader();
// Retrieve the balance at both the current and the parent hashes
const [balanceNow, balancePrev] = await Promise.all([
api.query.balances.freeBalance.at(lastHdr.hash, ADDR),
api.query.balances.freeBalance.at(lastHdr.parentHash, ADDR)
const [[, balanceNow], [, balancePrev]] = await Promise.all([
api.query.system.account.at(lastHdr.hash, ADDR),
api.query.system.account.at(lastHdr.parentHash, ADDR)
]);
// Display the difference
console.log(`The delta was ${balanceNow.sub(balancePrev)}`);
console.log(`The delta was ${balanceNow.free.sub(balancePrev.free)}`);
```
In the above example, we introduce the `.at(<hash>[, ...params])` query. For all `.at` queries, the first parameter is always the block hash at which we want to make the query, in our example we use both the last retrieved block and the parent thereof. The params are optional as per the type of query made, for instance to retrieve the timestamp for a previous block, it would be -
@@ -44,8 +44,8 @@ In addition to using `api.query` to make actual on-chain queries, it can also be
// Retrieve the hash & size of the entry as stored on-chain
const [entryHash, entrySize] = await Promise.all([
api.query.balances.freeBalance.hash(ADDR),
api.query.balances.freeBalance.size(ADDR)
api.query.system.account.hash(ADDR),
api.query.system.account.size(ADDR)
]);
// Output the info
@@ -60,11 +60,11 @@ It has been explained that the `api.query` interfaces are decorated from the met
```js
// Extract the info
const { meta, method, section } = api.query.balances.freeBalance;
const { meta, method, section } = api.query.system.account;
// Display some info on a specific entry
console.log(`${section}.${method}: ${meta.documentation.join(' ')}`);
console.log(`query key: ${api.query.balances.freeBalance.key(ADDR)}`);
console.log(`query key: ${api.query.system.account.key(ADDR)}`);
```
The `section` & `method` is an indication of where it is exposed on the API. In addition the `meta` holds an array with the metadata documentation for the entry.
+2 -2
View File
@@ -25,8 +25,8 @@ If we had a query with parameters, i.e. where we wish to perform a query for a s
...
// Subscribe to balance changes for our account
const unsub = await api.query.balances.freeBalance(ADDR, (balance) => {
console.log(`Your account balance is ${balance}`);
const unsub = await api.query.system.account(ADDR, ([nonce, balance]) => {
console.log(`free balance is ${balance.freee} with ${balance.reserved} reserved and a nonce of ${nonce}`);
});
```
+2 -2
View File
@@ -8,8 +8,8 @@ To unpack this, we will start with the Metadata and explain what it actually pro
When the API connects to a node, one of the first things it does is to retrieve the metadata. The metadata, effectively provides data in the form of `api.<type>.<module>.<section>` that fits into one of the following categories -
- [consts](../substrate/constants.md) - All runtime constants, e.g. `api.consts.balances.creationFee`. These are not functions, rather accessing the endpoint immediately yields the result as defined.
- [query](../substrate/storage.md) - All chain state, e.g. `api.query.balances.freeBalance(<accountId>)`.
- [consts](../substrate/constants.md) - All runtime constants, e.g. `api.consts.balances.existentialDeposit`. These are not functions, rather accessing the endpoint immediately yields the result as defined.
- [query](../substrate/storage.md) - All chain state, e.g. `api.query.system.account(<accountId>)`.
- [tx](../substrate/extrinsics.md) - All extrinsics, e.g. `api.tx.balances.transfer(<accountId>, <value>)`.
Additionally the metadata also provides information on [events](../substrate/events.md), these are query-able via the `api.query.system.events()` interface and also appear on transactions... both these cases are detailed later.
+2 -3
View File
@@ -30,11 +30,10 @@ For any interface injected by metadata, the types are not available by default (
However, to make this sane from a developer perspective the injected methods are generic, effectively making the following possible -
```js
import { Balance, Index } from '@polkadot/types/interfaces';
import { AccountData, Index } from '@polkadot/types/interfaces';
...
const nonce = await api.query.system.accountNonce<Index>(ADDR);
const balance = await api.query.balances.freeBalance<Balance>(ADDR);
const [nonce, balance] = await api.query.system.account<[Index, AccountData]>(ADDR);
```
In both these case we can instruct the TypeScript compiler that the type we are expecting in `Index` and `Balance` respectively, not just pure `Codec`. This means that functions like `.toNumber()` is available on both these types - as opposed to just the [general type defaults](types.basics.md#everything-is-a-type) with `.toHex()` and friends.
-225
View File
@@ -1,225 +0,0 @@
## Constants
The following sections contain the module constants, also known as parameter types. These can only be changed as part of a runtime upgrade. On the api, these are exposed via `api.consts.<module>.<method>`.
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
- **[babe](#babe)**
- **[balances](#balances)**
- **[contracts](#contracts)**
- **[democracy](#democracy)**
- **[elections](#elections)**
- **[finalityTracker](#finalityTracker)**
- **[session](#session)**
- **[staking](#staking)**
- **[timestamp](#timestamp)**
- **[treasury](#treasury)**
___
### babe
▸ **epochDuration**: `u64`
- **summary**: The number of **slots** that an epoch takes. We couple sessions to epochs, i.e. we start a new session once the new epoch begins.
▸ **expectedBlockTime**: `Moment`
- **summary**: 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).
___
### balances
▸ **creationFee**: `Balance`
- **summary**: The fee required to create an account.
▸ **existentialDeposit**: `Balance`
- **summary**: The minimum amount required to keep an account open.
▸ **transactionBaseFee**: `Balance`
- **summary**: The fee to be paid for making a transaction; the base.
▸ **transactionByteFee**: `Balance`
- **summary**: The fee to be paid for making a transaction; the per-byte portion.
▸ **transferFee**: `Balance`
- **summary**: The fee required to make a transfer.
___
### contracts
▸ **blockGasLimit**: `Gas`
- **summary**: The maximum amount of gas that could be expended per block. A reasonable default value is 10_000_000.
▸ **callBaseFee**: `Gas`
- **summary**: The base fee charged for calling into a contract. A reasonable default value is 135.
▸ **contractFee**: `BalanceOf`
- **summary**: The fee required to instantiate a contract instance. A reasonable default value is 21.
▸ **creationFee**: `BalanceOf`
- **summary**: The fee required to create an account.
▸ **instantiateBaseFee**: `Gas`
- **summary**: The base fee charged for instantiating a contract. A reasonable default value is 175.
▸ **maxDepth**: `u32`
- **summary**: The maximum nesting level of a call/instantiate stack. A reasonable default value is 100.
▸ **maxValueSize**: `u32`
- **summary**: The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
▸ **rentByteFee**: `BalanceOf`
- **summary**: Price of a byte of storage per one block interval. Should be greater than 0.
▸ **rentDepositOffset**: `BalanceOf`
- **summary**: The amount of funds a contract should deposit in order to offset the cost of one byte. Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day, then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent. But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000, then it would pay 500 BU/day.
▸ **signedClaimHandicap**: `BlockNumber`
- **summary**: Number of block delay an extrinsic claim surcharge has. When claim surcharge is called by an extrinsic the rent is checked for current_block - delay
▸ **storageSizeOffset**: `u32`
- **summary**: Size of a contract at the time of instantiaion. This is a simple way to ensure that empty contracts eventually gets deleted.
▸ **surchargeReward**: `BalanceOf`
- **summary**: Reward that is received by the party whose touch has led to removal of a contract.
▸ **tombstoneDeposit**: `BalanceOf`
- **summary**: The minimum amount required to generate a tombstone.
▸ **transactionBaseFee**: `BalanceOf`
- **summary**: The fee to be paid for making a transaction; the base.
▸ **transactionByteFee**: `BalanceOf`
- **summary**: The fee to be paid for making a transaction; the per-byte portion.
▸ **transferFee**: `BalanceOf`
- **summary**: The fee required to make a transfer.
___
### democracy
▸ **cooloffPeriod**: `BlockNumber`
- **summary**: Period in blocks where an external proposal may not be re-submitted after being vetoed.
▸ **emergencyVotingPeriod**: `BlockNumber`
- **summary**: Minimum voting period allowed for an emergency referendum.
▸ **enactmentPeriod**: `BlockNumber`
- **summary**: The minimum period of locking and the period between a proposal being approved and enacted. It should generally be a little more than the unstake period to ensure that voting stakers have an opportunity to remove themselves from the system in the case where they are on the losing side of a vote.
▸ **launchPeriod**: `BlockNumber`
- **summary**: How often (in blocks) new public referenda are launched.
▸ **minimumDeposit**: `BalanceOf`
- **summary**: The minimum amount to be used as a deposit for a public referendum proposal.
▸ **votingPeriod**: `BlockNumber`
- **summary**: How often (in blocks) to check for new votes.
___
### elections
▸ **approvalSetSize**: `u32`
- **summary**: The chunk size of the approval vector.
▸ **candidacyBond**: `BalanceOf`
- **summary**: How much should be locked up in order to submit one's candidacy. A reasonable default value is 9.
▸ **carryCount**: `u32`
- **summary**: How many runners-up should have their approvals persist until the next vote. A reasonable default value is 2.
▸ **decayRatio**: `u32`
- **summary**: Decay factor of weight when being accumulated. It should typically be set to __at least__ `membership_size -1` to keep the collective secure. When set to `N`, it indicates `(1/N)^t` of staked is decayed at weight increment step `t`. 0 will result in no weight being added at all (normal approval voting). A reasonable default value is 24.
▸ **inactiveGracePeriod**: `VoteIndex`
- **summary**: How many vote indices need to go by after a target voter's last vote before they can be reaped if their approvals are moot. A reasonable default value is 1.
▸ **minimumVotingLock**: `BalanceOf`
- **summary**: Minimum about that can be used as the locked value for voting.
▸ **presentSlashPerVoter**: `BalanceOf`
- **summary**: The punishment, per voter, if you provide an invalid presentation. A reasonable default value is 1.
▸ **voterSetSize**: `u32`
- **summary**: The chunk size of the voter vector.
▸ **votingBond**: `BalanceOf`
- **summary**: How much should be locked up in order to be able to submit votes.
▸ **votingFee**: `BalanceOf`
- **summary**: The amount of fee paid upon each vote submission, unless if they submit a _hole_ index and replace it.
▸ **votingPeriod**: `BlockNumber`
- **summary**: How often (in blocks) to check for new votes. A reasonable default value is 1000.
___
### finalityTracker
▸ **reportLatency**: `BlockNumber`
- **summary**: The delay after which point things become suspicious. Default is 1000.
▸ **windowSize**: `BlockNumber`
- **summary**: The number of recent samples to keep from this chain. Default is 101.
___
### session
▸ **dedupKeyPrefix**: `Bytes`
- **summary**: Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch of the trie.
___
### staking
▸ **bondingDuration**: `EraIndex`
- **summary**: Number of eras that staked funds must remain bonded for.
▸ **sessionsPerEra**: `SessionIndex`
- **summary**: Number of sessions per era.
___
### timestamp
▸ **minimumPeriod**: `Moment`
- **summary**: 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.
___
### treasury
▸ **burn**: `Permill`
- **summary**: Percentage of spare funds (if any) that are burnt per spend period.
▸ **proposalBond**: `Permill`
- **summary**: 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.
▸ **proposalBondMinimum**: `BalanceOf`
- **summary**: Minimum amount of funds that should be placed in a deposit for making a proposal.
▸ **spendPeriod**: `BlockNumber`
- **summary**: Period between successive spends.
-298
View File
@@ -1,298 +0,0 @@
## Events
Events are emitted for certain operations on the runtime. The following sections describe the events that are part of the default Substrate runtime.
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
- **[balances](#balances)**
- **[contracts](#contracts)**
- **[council](#council)**
- **[democracy](#democracy)**
- **[elections](#elections)**
- **[grandpa](#grandpa)**
- **[imOnline](#imOnline)**
- **[indices](#indices)**
- **[offences](#offences)**
- **[session](#session)**
- **[staking](#staking)**
- **[sudo](#sudo)**
- **[system](#system)**
- **[technicalCommittee](#technicalCommittee)**
- **[technicalMembership](#technicalMembership)**
- **[treasury](#treasury)**
- **[utility](#utility)**
___
### balances
▸ **NewAccount**(`AccountId`, `Balance`)
- **summary**: A new account was created.
▸ **ReapedAccount**(`AccountId`)
- **summary**: An account was reaped.
▸ **Transfer**(`AccountId`, `AccountId`, `Balance`, `Balance`)
- **summary**: Transfer succeeded (from, to, value, fees).
___
### contracts
▸ **CodeStored**(`Hash`)
- **summary**: Code with the specified hash has been stored.
▸ **Contract**(`AccountId`, `Bytes`)
- **summary**: An event from contract of account.
▸ **Dispatched**(`AccountId`, `bool`)
- **summary**: A call was dispatched from the given account. The bool signals whether it was successful execution or not.
▸ **Instantiated**(`AccountId`, `AccountId`)
- **summary**: Contract deployed by address at the specified address.
▸ **ScheduleUpdated**(`u32`)
- **summary**: Triggered when the current schedule is updated.
▸ **Transfer**(`AccountId`, `AccountId`, `Balance`)
- **summary**: Transfer happened `from` to `to` with given `value` as part of a `call` or `instantiate`.
___
### council
▸ **Approved**(`Hash`)
- **summary**: A motion was approved by the required threshold.
▸ **Disapproved**(`Hash`)
- **summary**: A motion was not approved by the required threshold.
▸ **Executed**(`Hash`, `bool`)
- **summary**: A motion was executed; `bool` is true if returned without error.
▸ **MemberExecuted**(`Hash`, `bool`)
- **summary**: A single member did some action; `bool` is true if returned without error.
▸ **Proposed**(`AccountId`, `ProposalIndex`, `Hash`, `MemberCount`)
- **summary**: A motion (given hash) has been proposed (by given account) with a threshold (given `MemberCount`).
▸ **Voted**(`AccountId`, `Hash`, `bool`, `MemberCount`, `MemberCount`)
- **summary**: A motion (given hash) has been voted on by given account, leaving a tally (yes votes and no votes given respectively as `MemberCount`).
___
### democracy
▸ **Cancelled**(`ReferendumIndex`)
▸ **Delegated**(`AccountId`, `AccountId`)
▸ **Executed**(`ReferendumIndex`, `bool`)
▸ **ExternalTabled**()
▸ **NotPassed**(`ReferendumIndex`)
▸ **Passed**(`ReferendumIndex`)
▸ **Proposed**(`PropIndex`, `Balance`)
▸ **Started**(`ReferendumIndex`, `VoteThreshold`)
▸ **Tabled**(`PropIndex`, `Balance`, `Vec<AccountId>`)
▸ **Undelegated**(`AccountId`)
▸ **Vetoed**(`AccountId`, `Hash`, `BlockNumber`)
___
### elections
▸ **BadReaperSlashed**(`AccountId`)
- **summary**: slashed reaper
▸ **TallyFinalized**(`Vec<AccountId>`, `Vec<AccountId>`)
- **summary**: A tally (for approval votes of seat(s)) has ended (with one or more new members).
▸ **TallyStarted**(`u32`)
- **summary**: A tally (for approval votes of seat(s)) has started.
▸ **VoterReaped**(`AccountId`, `AccountId`)
- **summary**: reaped voter, reaper
___
### grandpa
▸ **NewAuthorities**(`Vec<(AuthorityId,AuthorityWeight)>`)
- **summary**: New authority set has been applied.
▸ **Paused**()
- **summary**: Current authority set has been paused.
▸ **Resumed**()
- **summary**: Current authority set has been resumed.
___
### imOnline
▸ **HeartbeatReceived**(`AuthorityId`)
- **summary**: A new heartbeat was received from `AuthorityId`
___
### indices
▸ **NewAccountIndex**(`AccountId`, `AccountIndex`)
- **summary**: A new account index was assigned. This event is not triggered when an existing index is reassigned to another `AccountId`.
___
### offences
▸ **Offence**(`Kind`, `OpaqueTimeSlot`)
- **summary**: There is an offence reported of the given `kind` happened at the `session_index` and (kind-specific) time slot. This event is not deposited for duplicate slashes.
___
### session
▸ **NewSession**(`SessionIndex`)
- **summary**: New session has happened. Note that the argument is the session index, not the block number as the type might suggest.
___
### staking
▸ **OldSlashingReportDiscarded**(`SessionIndex`)
- **summary**: An old slashing report from a prior era was discarded because it could not be processed.
▸ **Reward**(`Balance`)
- **summary**: All validators have been rewarded by the given balance.
▸ **Slash**(`AccountId`, `Balance`)
- **summary**: One validator (and its nominators) has been slashed by the given amount.
___
### sudo
▸ **KeyChanged**(`AccountId`)
- **summary**: The sudoer just switched identity; the old key is supplied.
▸ **Sudid**(`bool`)
- **summary**: A sudo just took place.
▸ **SudoAsDone**(`bool`)
- **summary**: A sudo just took place.
___
### system
▸ **ExtrinsicFailed**(`DispatchError`)
- **summary**: An extrinsic failed.
▸ **ExtrinsicSuccess**()
- **summary**: An extrinsic completed successfully.
___
### technicalCommittee
▸ **Approved**(`Hash`)
- **summary**: A motion was approved by the required threshold.
▸ **Disapproved**(`Hash`)
- **summary**: A motion was not approved by the required threshold.
▸ **Executed**(`Hash`, `bool`)
- **summary**: A motion was executed; `bool` is true if returned without error.
▸ **MemberExecuted**(`Hash`, `bool`)
- **summary**: A single member did some action; `bool` is true if returned without error.
▸ **Proposed**(`AccountId`, `ProposalIndex`, `Hash`, `MemberCount`)
- **summary**: A motion (given hash) has been proposed (by given account) with a threshold (given `MemberCount`).
▸ **Voted**(`AccountId`, `Hash`, `bool`, `MemberCount`, `MemberCount`)
- **summary**: A motion (given hash) has been voted on by given account, leaving a tally (yes votes and no votes given respectively as `MemberCount`).
___
### technicalMembership
▸ **Dummy**(`PhantomData`)
- **summary**: Phantom member, never used.
▸ **MemberAdded**()
- **summary**: The given member was added; see the transaction for who.
▸ **MemberRemoved**()
- **summary**: The given member was removed; see the transaction for who.
▸ **MembersReset**()
- **summary**: The membership was reset; see the transaction for who the new set is.
▸ **MembersSwapped**()
- **summary**: Two members were swapped; see the transaction for who.
___
### treasury
▸ **Awarded**(`ProposalIndex`, `Balance`, `AccountId`)
- **summary**: Some funds have been allocated.
▸ **Burnt**(`Balance`)
- **summary**: Some of our funds have been burnt.
▸ **Proposed**(`ProposalIndex`)
- **summary**: New proposal.
▸ **Rollover**(`Balance`)
- **summary**: Spending has finished; this is the amount that rolls over until next spend.
▸ **Spending**(`Balance`)
- **summary**: We have ended a spend period and will now allocate funds.
___
### utility
▸ **BatchExecuted**(`Vec<DispatchResult>`)
-370
View File
@@ -1,370 +0,0 @@
## Extrinsics
The following sections contain Extrinsics methods are part of the default Substrate runtime. On the api, these are exposed via `api.tx.<module>.<method>`.
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
- **[authorship](#authorship)**
- **[balances](#balances)**
- **[contracts](#contracts)**
- **[council](#council)**
- **[democracy](#democracy)**
- **[elections](#elections)**
- **[finalityTracker](#finalityTracker)**
- **[grandpa](#grandpa)**
- **[imOnline](#imOnline)**
- **[session](#session)**
- **[staking](#staking)**
- **[sudo](#sudo)**
- **[system](#system)**
- **[technicalCommittee](#technicalCommittee)**
- **[technicalMembership](#technicalMembership)**
- **[timestamp](#timestamp)**
- **[treasury](#treasury)**
- **[utility](#utility)**
___
### authorship
▸ **setUncles**(new_uncles: `Vec<Header>`)
- **summary**: Provide a set of uncles.
___
### balances
▸ **forceTransfer**(source: `Address`, dest: `Address`, value: `Compact<Balance>`)
- **summary**: Exactly as `transfer`, except the origin must be root and the source account may be specified.
▸ **setBalance**(who: `Address`, new_free: `Compact<Balance>`, new_reserved: `Compact<Balance>`)
- **summary**: Set the balances of a given account. This will alter `FreeBalance` and `ReservedBalance` in storage. it will also decrease the total issuance of the system (`TotalIssuance`). If the new free or reserved balance is below the existential deposit, it will reset the account nonce (`system::AccountNonce`). The dispatch origin for this call is `root`. # <weight> - Independent of the arguments. - Contains a limited number of reads and writes. # </weight>
▸ **transfer**(dest: `Address`, value: `Compact<Balance>`)
- **summary**: Transfer some liquid free balance to another account. `transfer` will set the `FreeBalance` of the sender and receiver. It will decrease the total issuance of the system by the `TransferFee`. If the sender's account is below the existential deposit as a result of the transfer, the account will be reaped. The dispatch origin for this call must be `Signed` by the transactor. # <weight> - Dependent on arguments but not critical, given proper implementations for input config types. See related functions below. - It contains a limited number of reads and writes internally and no complex computation. Related functions: - `ensure_can_withdraw` is always called internally but has a bounded complexity. - Transferring balances to accounts that did not exist before will cause `T::OnNewAccount::on_new_account` to be called. - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced` and `T::OnFreeBalanceZero::on_free_balance_zero`. # </weight>
___
### contracts
▸ **call**(dest: `Address`, value: `Compact<BalanceOf>`, gas_limit: `Compact<Gas>`, data: `Bytes`)
- **summary**: Makes a call to an account, optionally transferring some balance. * If the account is a smart-contract account, the associated code will be executed and any value will be transferred. * If the account is a regular account, any value will be transferred. * If no account exists and the call value is not less than `existential_deposit`, a regular account will be created and any value will be transferred.
▸ **claimSurcharge**(dest: `AccountId`, aux_sender: `Option<AccountId>`)
- **summary**: Allows block producers to claim a small reward for evicting a contract. If a block producer fails to do so, a regular users will be allowed to claim the reward. If contract is not evicted as a result of this call, no actions are taken and the sender is not eligible for the reward.
▸ **instantiate**(endowment: `Compact<BalanceOf>`, gas_limit: `Compact<Gas>`, code_hash: `CodeHash`, data: `Bytes`)
- **summary**: Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance. Instantiation is executed as follows: - The destination address is computed based on the sender and hash of the code. - The smart-contract account is created at the computed address. - The `ctor_code` is executed in the context of the newly-created account. Buffer returned after the execution is saved as the `code` of the account. That code will be invoked upon any call received by this account. - The contract is initialized.
▸ **putCode**(gas_limit: `Compact<Gas>`, code: `Bytes`)
- **summary**: Stores the given binary Wasm code into the chain's storage and returns its `codehash`. You can instantiate contracts only with stored code.
▸ **updateSchedule**(schedule: `Schedule`)
- **summary**: Updates the schedule for metering contracts. The schedule must have a greater version than the stored schedule.
___
### council
▸ **execute**(proposal: `Proposal`)
- **summary**: Dispatch a proposal from a member using the `Member` origin. Origin must be a member of the collective.
▸ **propose**(threshold: `Compact<MemberCount>`, proposal: `Proposal`)
- **summary**: # <weight> - Bounded storage reads and writes. - Argument `threshold` has bearing on weight. # </weight>
▸ **setMembers**(new_members: `Vec<AccountId>`)
- **summary**: Set the collective's membership manually to `new_members`. Be nice to the chain and provide it pre-sorted. Requires root origin.
▸ **vote**(proposal: `Hash`, index: `Compact<ProposalIndex>`, approve: `bool`)
- **summary**: # <weight> - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. # </weight>
___
### democracy
▸ **cancelQueued**(when: `Compact<BlockNumber>`, which: `Compact<u32>`, what: `Compact<ReferendumIndex>`)
- **summary**: Cancel a proposal queued for enactment.
▸ **cancelReferendum**(ref_index: `Compact<ReferendumIndex>`)
- **summary**: Remove a referendum.
▸ **delegate**(to: `AccountId`, conviction: `Conviction`)
- **summary**: Delegate vote. # <weight> - One extra DB entry. # </weight>
▸ **emergencyCancel**(ref_index: `ReferendumIndex`)
- **summary**: Schedule an emergency cancellation of a referendum. Cannot happen twice to the same referendum.
▸ **externalPropose**(proposal: `Proposal`)
- **summary**: Schedule a referendum to be tabled once it is legal to schedule an external referendum.
▸ **externalProposeDefault**(proposal: `Proposal`)
- **summary**: Schedule a negative-turnout-bias referendum to be tabled next once it is legal to schedule an external referendum. Unlike `external_propose`, blacklisting has no effect on this and it may replace a pre-scheduled `external_propose` call.
▸ **externalProposeMajority**(proposal: `Proposal`)
- **summary**: Schedule a majority-carries referendum to be tabled next once it is legal to schedule an external referendum. Unlike `external_propose`, blacklisting has no effect on this and it may replace a pre-scheduled `external_propose` call.
▸ **fastTrack**(proposal_hash: `Hash`, voting_period: `BlockNumber`, delay: `BlockNumber`)
- **summary**: Schedule the currently externally-proposed majority-carries referendum to be tabled immediately. If there is no externally-proposed referendum currently, or if there is one but it is not a majority-carries referendum then it fails. - `proposal_hash`: The hash of the current external proposal. - `voting_period`: The period that is allowed for voting on this proposal. - `delay`: The number of block after voting has ended in approval and this should be enacted. Increased to `EmergencyVotingPeriod` if too low.
▸ **propose**(proposal: `Proposal`, value: `Compact<BalanceOf>`)
- **summary**: Propose a sensitive action to be taken. # <weight> - O(1). - Two DB changes, one DB entry. # </weight>
▸ **proxyVote**(ref_index: `Compact<ReferendumIndex>`, vote: `Vote`)
- **summary**: Vote in a referendum on behalf of a stash. If `vote.is_aye()`, the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # <weight> - O(1). - One DB change, one DB entry. # </weight>
▸ **removeProxy**(proxy: `AccountId`)
- **summary**: Clear the proxy. Called by the stash. # <weight> - One DB clear. # </weight>
▸ **resignProxy**()
- **summary**: Clear the proxy. Called by the proxy. # <weight> - One DB clear. # </weight>
▸ **second**(proposal: `Compact<PropIndex>`)
- **summary**: Propose a sensitive action to be taken. # <weight> - O(1). - One DB entry. # </weight>
▸ **setProxy**(proxy: `AccountId`)
- **summary**: Specify a proxy. Called by the stash. # <weight> - One extra DB entry. # </weight>
▸ **undelegate**()
- **summary**: Undelegate vote. # <weight> - O(1). # </weight>
▸ **vetoExternal**(proposal_hash: `Hash`)
- **summary**: Veto and blacklist the external proposal hash.
▸ **vote**(ref_index: `Compact<ReferendumIndex>`, vote: `Vote`)
- **summary**: Vote in a referendum. If `vote.is_aye()`, the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # <weight> - O(1). - One DB change, one DB entry. # </weight>
___
### elections
▸ **presentWinner**(candidate: `Address`, total: `Compact<BalanceOf>`, index: `Compact<VoteIndex>`)
- **summary**: Claim that `candidate` is one of the top `carry_count + desired_seats` candidates. Only works iff the presentation period is active. `candidate` should have at least collected some non-zero `total` votes and `origin` must have enough funds to pay for a potential slash. # <weight> - O(voters) compute. - One DB change. # </weight>
▸ **proxySetApprovals**(votes: `Vec<bool>`, index: `Compact<VoteIndex>`, hint: `SetIndex`, value: `Compact<BalanceOf>`)
- **summary**: Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in those slots are registered. # <weight> - Same as `set_approvals` with one additional storage read. # </weight>
▸ **reapInactiveVoter**(reporter_index: `Compact<u32>`, who: `Address`, who_index: `Compact<u32>`, assumed_vote_index: `Compact<VoteIndex>`)
- **summary**: Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices must now be either unregistered or registered to a candidate that registered the slot after the voter gave their last approval set. Both indices must be provided as explained in [`voter_at`] function. May be called by anyone. Returns the voter deposit to `signed`. # <weight> - O(1). - Two fewer DB entries, one DB change. # </weight>
▸ **removeMember**(who: `Address`)
- **summary**: Remove a particular member from the set. This is effective immediately. Note: A tally should happen instantly (if not already in a presentation period) to fill the seat if removal means that the desired members are not met.
▸ **retractVoter**(index: `Compact<u32>`)
- **summary**: Remove a voter. All votes are cancelled and the voter deposit is returned. The index must be provided as explained in [`voter_at`] function. Also removes the lock on the balance of the voter. See [`do_set_approvals()`]. # <weight> - O(1). - Two fewer DB entries, one DB change. # </weight>
▸ **setApprovals**(votes: `Vec<bool>`, index: `Compact<VoteIndex>`, hint: `SetIndex`, value: `Compact<BalanceOf>`)
- **summary**: Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered. Locks `value` from the balance of `origin` indefinitely. Only [`retract_voter`] or [`reap_inactive_voter`] can unlock the balance. `hint` argument is interpreted differently based on: - if `origin` is setting approvals for the first time: The index will be checked for being a valid _hole_ in the voter list. - if the hint is correctly pointing to a hole, no fee is deducted from `origin`. - Otherwise, the call will succeed but the index is ignored and simply a push to the last chunk with free space happens. If the new push causes a new chunk to be created, a fee indicated by [`VotingFee`] is deducted. - if `origin` is already a voter: the index __must__ be valid and point to the correct position of the `origin` in the current voters list. Note that any trailing `false` votes in `votes` is ignored; In approval voting, not voting for a candidate and voting false, are equal. # <weight> - O(1). - Two extra DB entries, one DB change. - Argument `votes` is limited in length to number of candidates. # </weight>
▸ **setDesiredSeats**(count: `Compact<u32>`)
- **summary**: Set the desired member count; if lower than the current count, then seats will not be up election when they expire. If more, then a new vote will be started if one is not already in progress.
▸ **setPresentationDuration**(count: `Compact<BlockNumber>`)
- **summary**: Set the presentation duration. If there is currently a vote being presented for, will invoke `finalize_vote`.
▸ **setTermDuration**(count: `Compact<BlockNumber>`)
- **summary**: Set the presentation duration. If there is current a vote being presented for, will invoke `finalize_vote`.
▸ **submitCandidacy**(slot: `Compact<u32>`)
- **summary**: Submit oneself for candidacy. Account must have enough transferrable funds in it to pay the bond. NOTE: if `origin` has already assigned approvals via [`set_approvals`], it will NOT have any usable funds to pass candidacy bond and must first retract. Note that setting approvals will lock the entire balance of the voter until retraction or being reported. # <weight> - Independent of input. - Three DB changes. # </weight>
___
### finalityTracker
▸ **finalHint**(hint: `Compact<BlockNumber>`)
- **summary**: Hint that the author of this block thinks the best finalized block is the given number.
___
### grandpa
▸ **reportMisbehavior**(_report: `Bytes`)
- **summary**: Report some misbehavior.
___
### imOnline
▸ **heartbeat**(heartbeat: `Heartbeat`, signature: `Signature`)
___
### session
▸ **setKeys**(keys: `Keys`, proof: `Bytes`)
- **summary**: Sets the session key(s) of the function caller to `key`. Allows an account to set its session key prior to becoming a validator. This doesn't take effect until the next session. The dispatch origin of this function must be signed. # <weight> - O(log n) in number of accounts. - One extra DB entry. # </weight>
___
### staking
▸ **bond**(controller: `Address`, value: `Compact<BalanceOf>`, payee: `RewardDestination`)
- **summary**: Take the origin account as a stash and lock up `value` of its balance. `controller` will be the account that controls it. `value` must be more than the `minimum_balance` specified by `T::Currency`. The dispatch origin for this call must be _Signed_ by the stash account. # <weight> - Independent of the arguments. Moderate complexity. - O(1). - Three extra DB entries. NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned unless the `origin` falls below _existential deposit_ and gets removed as dust. # </weight>
▸ **bondExtra**(max_additional: `Compact<BalanceOf>`)
- **summary**: Add some extra amount that have appeared in the stash `free_balance` into the balance up for staking. Use this if there are additional funds in your stash account that you wish to bond. Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount that can be added. The dispatch origin for this call must be _Signed_ by the stash, not the controller. # <weight> - Independent of the arguments. Insignificant complexity. - O(1). - One DB entry. # </weight>
▸ **chill**()
- **summary**: Declare no desire to either validate or nominate. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - Independent of the arguments. Insignificant complexity. - Contains one read. - Writes are limited to the `origin` account key. # </weight>
▸ **forceNewEra**()
- **summary**: Force there to be a new era at the end of the next session. After this, it will be reset to normal (non-forced) behaviour. # <weight> - No arguments. # </weight>
▸ **forceNoEras**()
- **summary**: Force there to be no new eras indefinitely. # <weight> - No arguments. # </weight>
▸ **nominate**(targets: `Vec<Address>`)
- **summary**: Declare the desire to nominate `targets` for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - The transaction's complexity is proportional to the size of `targets`, which is capped at `MAX_NOMINATIONS`. - Both the reads and writes follow a similar pattern. # </weight>
▸ **setController**(controller: `Address`)
- **summary**: (Re-)set the controller of a stash. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the stash, not the controller. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
▸ **setInvulnerables**(validators: `Vec<AccountId>`)
- **summary**: Set the validators who cannot be slashed (if any).
▸ **setPayee**(payee: `RewardDestination`)
- **summary**: (Re-)set the payment target for a controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
▸ **setValidatorCount**(new: `Compact<u32>`)
- **summary**: The ideal number of validators.
▸ **unbond**(value: `Compact<BalanceOf>`)
- **summary**: Schedule a portion of the stash to be unlocked ready for transfer out after the bond period ends. If this leaves an amount actively bonded less than T::Currency::minimum_balance(), then it is increased to the full amount. Once the unlock period is done, you can call `withdraw_unbonded` to actually move the funds out of management ready for transfer. No more than a limited number of unlocking chunks (see `MAX_UNLOCKING_CHUNKS`) can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need to be called first to remove some of the chunks (if possible). The dispatch origin for this call must be _Signed_ by the controller, not the stash. See also [`Call::withdraw_unbonded`]. # <weight> - Independent of the arguments. Limited but potentially exploitable complexity. - Contains a limited number of reads. - Each call (requires the remainder of the bonded balance to be above `minimum_balance`) will cause a new entry to be inserted into a vector (`Ledger.unlocking`) kept in storage. The only way to clean the aforementioned storage item is also user-controlled via `withdraw_unbonded`. - One DB entry. </weight>
▸ **validate**(prefs: `ValidatorPrefs`)
- **summary**: Declare the desire to validate for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
▸ **withdrawUnbonded**()
- **summary**: Remove any unlocked chunks from the `unlocking` queue from our management. This essentially frees up that balance to be used by the stash account to do whatever it wants. The dispatch origin for this call must be _Signed_ by the controller, not the stash. See also [`Call::unbond`]. # <weight> - Could be dependent on the `origin` argument and how much `unlocking` chunks exist. It implies `consolidate_unlocked` which loops over `Ledger.unlocking`, which is indirectly user-controlled. See [`unbond`] for more detail. - Contains a limited number of reads, yet the size of which could be large based on `ledger`. - Writes are limited to the `origin` account key. # </weight>
___
### sudo
▸ **setKey**(new: `Address`)
- **summary**: Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - One DB change. # </weight>
▸ **sudo**(proposal: `Proposal`)
- **summary**: Authenticates the sudo key and dispatches a function call with `Root` origin. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - One DB write (event). - Unknown weight of derivative `proposal` execution. # </weight>
▸ **sudoAs**(who: `Address`, proposal: `Proposal`)
- **summary**: Authenticates the sudo key and dispatches a function call with `Signed` origin from a given account. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - One DB write (event). - Unknown weight of derivative `proposal` execution. # </weight>
___
### system
▸ **fillBlock**()
- **summary**: A big dispatch that will disallow any other transaction to be included.
▸ **killPrefix**(prefix: `Key`)
- **summary**: Kill all storage items with a key that starts with the given prefix.
▸ **killStorage**(keys: `Vec<Key>`)
- **summary**: Kill some items from storage.
▸ **remark**(_remark: `Bytes`)
- **summary**: Make some on-chain remark.
▸ **setCode**(new: `Bytes`)
- **summary**: Set the new code.
▸ **setHeapPages**(pages: `u64`)
- **summary**: Set the number of pages in the WebAssembly environment's heap.
▸ **setStorage**(items: `Vec<KeyValue>`)
- **summary**: Set some items of storage.
___
### technicalCommittee
▸ **execute**(proposal: `Proposal`)
- **summary**: Dispatch a proposal from a member using the `Member` origin. Origin must be a member of the collective.
▸ **propose**(threshold: `Compact<MemberCount>`, proposal: `Proposal`)
- **summary**: # <weight> - Bounded storage reads and writes. - Argument `threshold` has bearing on weight. # </weight>
▸ **setMembers**(new_members: `Vec<AccountId>`)
- **summary**: Set the collective's membership manually to `new_members`. Be nice to the chain and provide it pre-sorted. Requires root origin.
▸ **vote**(proposal: `Hash`, index: `Compact<ProposalIndex>`, approve: `bool`)
- **summary**: # <weight> - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. # </weight>
___
### technicalMembership
▸ **addMember**(who: `AccountId`)
- **summary**: Add a member `who` to the set. May only be called from `AddOrigin` or root.
▸ **removeMember**(who: `AccountId`)
- **summary**: Remove a member `who` from the set. May only be called from `RemoveOrigin` or root.
▸ **resetMembers**(members: `Vec<AccountId>`)
- **summary**: Change the membership to a new set, disregarding the existing membership. Be nice and pass `members` pre-sorted. May only be called from `ResetOrigin` or root.
▸ **swapMember**(remove: `AccountId`, add: `AccountId`)
- **summary**: Swap out one member `remove` for another `add`. May only be called from `SwapOrigin` or root.
___
### timestamp
▸ **set**(now: `Compact<Moment>`)
- **summary**: Set the current time. This call should be invoked exactly once per block. It will panic at the finalization phase, if this call hasn't been invoked by that time. The timestamp should be greater than the previous one by the amount specified by `MinimumPeriod`. The dispatch origin for this call must be `Inherent`.
___
### treasury
▸ **approveProposal**(proposal_id: `Compact<ProposalIndex>`)
- **summary**: Approve a proposal. At a later time, the proposal will be allocated to the beneficiary and the original deposit will be returned. # <weight> - O(1). - Limited storage reads. - One DB change. # </weight>
▸ **proposeSpend**(value: `Compact<BalanceOf>`, beneficiary: `Address`)
- **summary**: Put forward a suggestion for spending. A deposit proportional to the value is reserved and slashed if the proposal is rejected. It is returned once the proposal is awarded. # <weight> - O(1). - Limited storage reads. - One DB change, one extra DB entry. # </weight>
▸ **rejectProposal**(proposal_id: `Compact<ProposalIndex>`)
- **summary**: Reject a proposed spend. The original deposit will be slashed. # <weight> - O(1). - Limited storage reads. - One DB clear. # </weight>
___
### utility
▸ **batch**(calls: `Vec<Call>`)
- **summary**: Send a batch of dispatch calls (only root).
-175
View File
@@ -1,175 +0,0 @@
## JSON-RPC
The following sections contain RPC methods that are Remote Calls available by default and allow you to interact with the actual node, query, and submit.
- **[account](#account)**
- **[author](#author)**
- **[chain](#chain)**
- **[contracts](#contracts)**
- **[rpc](#rpc)**
- **[state](#state)**
- **[system](#system)**
___
### account
_(Optional) Methods that retrieves account-specific information_
▸ **nextIndex**(accountId: `AccountId`): `Index`
- **summary**: Retrieves the next accountIndex as available on the node
___
### author
_Authoring of network items_
▸ **insertKey**(keyType: `Text`, suri: `Text`, publicKey: `Bytes`): `Bytes`
- **summary**: Insert a key into the keystore.
▸ **pendingExtrinsics**(): `Vec<Extrinsic>`
- **summary**: Returns all pending extrinsics, potentially grouped by sender
▸ **removeExtrinsic**(bytesOrHash: `Vec<ExtrinsicOrHash>`): `Vec<Hash>`
- **summary**: Remove given extrinsic from the pool and temporarily ban it to prevent reimporting
▸ **rotateKeys**(): `Bytes`
- **summary**: Generate new session keys and returns the corresponding public keys
▸ **submitAndWatchExtrinsic**(extrinsic: `Extrinsic`): `ExtrinsicStatus`
- **summary**: Submit and subscribe to watch an extrinsic until unsubscribed
▸ **submitExtrinsic**(extrinsic: `Extrinsic`): `Hash`
- **summary**: Submit a fully formatted extrinsic for block inclusion
___
### chain
_Retrieval of chain data_
▸ **getBlock**(hash?: `Hash`): `SignedBlock`
- **summary**: Get header and body of a relay chain block
▸ **getBlockHash**(blockNumber?: `BlockNumber`): `Hash`
- **summary**: Get the block hash for a specific block
▸ **getFinalizedHead**(): `Hash`
- **summary**: Get hash of the last finalized block in the canon chain
▸ **getHeader**(hash?: `Hash`): `Header`
- **summary**: Retrieves the header for a specific block
▸ **subscribeFinalizedHeads**(): `Header`
- **summary**: Retrieves the best finalized header via subscription
▸ **subscribeNewHeads**(): `Header`
- **summary**: Retrieves the best header via subscription
___
### contracts
_(Optional) Methods that performs actions on contracts_
▸ **call**(callRequest: `ContractCallRequest`, at?: `Hash`): `ContractExecResult`
- **summary**: Executes a call to a contract
___
### rpc
_Retrieves information about the RPC endpoints_
▸ **methods**(): `RpcMethods`
- **summary**: Retrieves the list of RPC methods that are exposed by the node
___
### state
_Query of state_
▸ **call**(method: `Text`, data: `Bytes`, block?: `Hash`): `Bytes`
- **summary**: Perform a call to a builtin on the chain
▸ **getChildKeys**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
- **summary**: Retrieves the keys with prefix of a specific child storage
▸ **getChildStorage**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `StorageData`
- **summary**: Retrieves the child storage for a key
▸ **getChildStorageHash**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Hash`
- **summary**: Retrieves the child storage hash
▸ **getChildStorageSize**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `u64`
- **summary**: Retrieves the child storage size
▸ **getKeys**(key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
- **summary**: Retrieves the keys with a certain prefix
▸ **getMetadata**(block?: `Hash`): `Metadata`
- **summary**: Returns the runtime metadata
▸ **getRuntimeVersion**(hash?: `Hash`): `RuntimeVersion`
- **summary**: Get the runtime version
▸ **getStorage**(key: `StorageKey`, block?: `Hash`): `StorageData`
- **summary**: Retrieves the storage for a key
▸ **getStorageHash**(key: `StorageKey`, block?: `Hash`): `Hash`
- **summary**: Retrieves the storage hash
▸ **getStorageSize**(key: `StorageKey`, block?: `Hash`): `u64`
- **summary**: Retrieves the storage size
▸ **queryStorage**(keys: `Vec<StorageKey>`, startBlock: `Hash`, block?: `Hash`): `Vec<StorageChangeSet>`
- **summary**: Query historical storage entries (by key) starting from a start block
▸ **subscribeRuntimeVersion**(): `RuntimeVersion`
- **summary**: Retrieves the runtime version via subscription
▸ **subscribeStorage**(keys: `Vec<StorageKey>`): `StorageChangeSet`
- **summary**: Subscribes to storage changes for the provided keys
___
### system
_Calls to retrieve system info_
▸ **chain**(): `Text`
- **summary**: Retrieves the chain
▸ **health**(): `Health`
- **summary**: Return health status of the node
▸ **name**(): `Text`
- **summary**: Retrieves the node name
▸ **networkState**(): `NetworkState`
- **summary**: Returns current state of the network
▸ **peers**(): `Vec<PeerInfo>`
- **summary**: Returns the currently connected peers
▸ **properties**(): `ChainProperties`
- **summary**: Get a custom set of properties as a JSON object, defined in the chain spec
▸ **version**(): `Text`
- **summary**: Retrieves the version of the node
+26
View File
@@ -0,0 +1,26 @@
{
"name": "substrate",
"description": "These are keys that are always available to the runtime implementation",
"items": [
{
"name": "changesTrieConfig(): `u32`",
"summary": "Changes trie configuration is stored under this key."
},
{
"name": "childStorageKeyPrefix(): `u32`",
"summary": "Prefix of child storage keys."
},
{
"name": "code(): `Bytes`",
"summary": "Wasm code of the runtime."
},
{
"name": "extrinsicIndex(): `u32`",
"summary": "Current extrinsic index (u32) is stored under this key."
},
{
"name": "heapPages(): `u64`",
"summary": "Number of wasm linear memory pages required for execution of the runtime."
}
]
}
-23
View File
@@ -1,23 +0,0 @@
---
### substrate
_These are keys that are always available to the runtime implementation_
▸ **changesTrieConfig**(): `u32`
- **summary**: Changes trie configuration is stored under this key.
▸ **childStorageKeyPrefix**(): `u32`
- **summary**: Prefix of child storage keys.
▸ **code**(): `Bytes`
- **summary**: Wasm code of the runtime.
▸ **extrinsicIndex**(): `u32`
- **summary**: Current extrinsic index (u32) is stored under this key.
▸ **heapPages**(): `u64`
- **summary**: Number of wasm linear memory pages required for execution of the runtime.
---
-545
View File
@@ -1,545 +0,0 @@
## Storage
The following sections contain Storage methods are part of the default Substrate runtime. On the api, these are exposed via `api.query.<module>.<method>`.
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
- **[authorship](#authorship)**
- **[babe](#babe)**
- **[balances](#balances)**
- **[contracts](#contracts)**
- **[council](#council)**
- **[democracy](#democracy)**
- **[elections](#elections)**
- **[grandpa](#grandpa)**
- **[imOnline](#imOnline)**
- **[indices](#indices)**
- **[offences](#offences)**
- **[session](#session)**
- **[staking](#staking)**
- **[sudo](#sudo)**
- **[system](#system)**
- **[technicalCommittee](#technicalCommittee)**
- **[technicalMembership](#technicalMembership)**
- **[timestamp](#timestamp)**
- **[treasury](#treasury)**
- **[substrate](#substrate)**
___
### authorship
▸ **author**(): `Option<AccountId>`
- **summary**: Author of current block.
▸ **didSetUncles**(): `bool`
- **summary**: Whether uncles were already set in this block.
▸ **uncles**(): `Vec<UncleEntryItem>`
- **summary**: Uncles
___
### babe
▸ **authorities**(): `Vec<(AuthorityId,BabeAuthorityWeight)>`
- **summary**: Current epoch authorities.
▸ **currentSlot**(): `u64`
- **summary**: Current slot number.
▸ **epochIndex**(): `u64`
- **summary**: Current epoch index.
▸ **genesisSlot**(): `u64`
- **summary**: The slot at which the first epoch actually started. This is 0 until the first block of the chain.
▸ **initialized**(): `Option<MaybeVrf>`
- **summary**: Temporary value (cleared at block finalization) which is `Some` if per-block initialization has already been called for current block.
▸ **nextRandomness**(): `[u8;32]`
- **summary**: Next epoch randomness.
▸ **randomness**(): `[u8;32]`
- **summary**: The epoch randomness for the *current* epoch. # Security This MUST NOT be used for gambling, as it can be influenced by a malicious validator in the short term. It MAY be used in many cryptographic protocols, however, so long as one remembers that this (like everything else on-chain) it is public. For example, it can be used where a number is needed that cannot have been chosen by an adversary, for purposes such as public-coin zero-knowledge proofs.
▸ **segmentIndex**(): `u32`
- **summary**: Randomness under construction. We make a tradeoff between storage accesses and list length. We store the under-construction randomness in segments of up to `UNDER_CONSTRUCTION_SEGMENT_LENGTH`. Once a segment reaches this length, we begin the next one. We reset all segments and return to `0` at the beginning of every epoch.
▸ **underConstruction**(`u32`): `Vec<[u8;32]>`
___
### balances
▸ **freeBalance**(`AccountId`): `Balance`
- **summary**: The 'free' balance of a given account. This is the only balance that matters in terms of most operations on tokens. It alone is used to determine the balance when in the contract execution environment. When this balance falls below the value of `ExistentialDeposit`, then the 'current account' is deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback is invoked, giving a chance to external modules to clean up data associated with the deleted account. `system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets collapsed to zero if it ever becomes less than `ExistentialDeposit`.
▸ **locks**(`AccountId`): `Vec<BalanceLock>`
- **summary**: Any liquidity locks on some account balances.
▸ **reservedBalance**(`AccountId`): `Balance`
- **summary**: The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. This balance is a 'reserve' balance that other subsystems use in order to set aside tokens that are still 'owned' by the account holder, but which are suspendable. When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account' is deleted: specifically, `ReservedBalance`. `system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
▸ **totalIssuance**(): `Balance`
- **summary**: The total units issued in the system.
▸ **vesting**(`AccountId`): `Option<VestingSchedule>`
- **summary**: Information regarding the vesting of a given account.
___
### contracts
▸ **accountCounter**(): `u64`
- **summary**: The subtrie counter.
▸ **codeStorage**(`CodeHash`): `Option<PrefabWasmModule>`
- **summary**: A mapping between an original code hash and instrumented wasm code, ready for execution.
▸ **contractInfoOf**(`AccountId`): `Option<ContractInfo>`
- **summary**: The code associated with a given account.
▸ **currentSchedule**(): `Schedule`
- **summary**: Current cost schedule for contracts.
▸ **gasPrice**(): `BalanceOf`
- **summary**: The price of one unit of gas.
▸ **gasSpent**(): `Gas`
- **summary**: Gas spent so far in this block.
▸ **pristineCode**(`CodeHash`): `Option<Bytes>`
- **summary**: A mapping from an original code hash to the original code, untouched by instrumentation.
___
### council
▸ **members**(): `Vec<AccountId>`
- **summary**: The current members of the collective. This is stored sorted (just by value).
▸ **proposalCount**(): `u32`
- **summary**: Proposals so far.
▸ **proposalOf**(`Hash`): `Option<Proposal>`
- **summary**: Actual proposal for a given hash, if it's current.
▸ **proposals**(): `Vec<Hash>`
- **summary**: The hashes of the active proposals.
▸ **voting**(`Hash`): `Option<Votes>`
- **summary**: Votes on a given proposal, if it is ongoing.
___
### democracy
▸ **blacklist**(`Hash`): `Option<(BlockNumber,Vec<AccountId>)>`
- **summary**: A record of who vetoed what. Maps proposal hash to a possible existent block number (until when it may not be resubmitted) and who vetoed it.
▸ **cancellations**(`Hash`): `bool`
- **summary**: Record of all proposals that have been subject to emergency cancellation.
▸ **delegations**(`AccountId`): `((AccountId,Conviction), Linkage<AccountId>)`
- **summary**: Get the account (and lock periods) to which another account is delegating vote.
▸ **depositOf**(`PropIndex`): `Option<(BalanceOf,Vec<AccountId>)>`
- **summary**: Those who have locked a deposit.
▸ **dispatchQueue**(`BlockNumber`): `Vec<Option<(Proposal,ReferendumIndex)>>`
- **summary**: Queue of successful referenda to be dispatched.
▸ **lastTabledWasExternal**(): `bool`
- **summary**: True if the last referendum tabled was submitted externally. False if it was a public proposal.
▸ **nextExternal**(): `Option<(Proposal,VoteThreshold)>`
- **summary**: The referendum to be tabled whenever it would be valid to table an external proposal. This happens when a referendum needs to be tabled and one of two conditions are met: - `LastTabledWasExternal` is `false`; or - `PublicProps` is empty.
▸ **nextTally**(): `ReferendumIndex`
- **summary**: The next referendum index that should be tallied.
▸ **proxy**(`AccountId`): `Option<AccountId>`
- **summary**: Who is able to vote for whom. Value is the fund-holding account, key is the vote-transaction-sending account.
▸ **publicPropCount**(): `PropIndex`
- **summary**: The number of (public) proposals that have been made so far.
▸ **publicProps**(): `Vec<(PropIndex,Proposal,AccountId)>`
- **summary**: The public proposals. Unsorted.
▸ **referendumCount**(): `ReferendumIndex`
- **summary**: The next free referendum index, aka the number of referenda started so far.
▸ **referendumInfoOf**(`ReferendumIndex`): `Option<ReferendumInfo>`
- **summary**: Information concerning any given referendum.
▸ **voteOf**(`(ReferendumIndex,AccountId)`): `Vote`
- **summary**: Get the vote in a given referendum of a particular voter. The result is meaningful only if `voters_for` includes the voter when called with the referendum (you'll get the default `Vote` value otherwise). If you don't want to check `voters_for`, then you can also check for simple existence with `VoteOf::exists` first.
▸ **votersFor**(`ReferendumIndex`): `Vec<AccountId>`
- **summary**: Get the voters for the current proposal.
___
### elections
▸ **approvalsOf**(`(AccountId,SetIndex)`): `Vec<ApprovalFlag>`
▸ **candidateCount**(): `u32`
- **summary**: Current number of active candidates
▸ **candidates**(): `Vec<AccountId>`
- **summary**: The present candidate list.
▸ **desiredSeats**(): `u32`
- **summary**: Number of accounts that should constitute the collective.
▸ **leaderboard**(): `Option<Vec<(BalanceOf,AccountId)>>`
- **summary**: Get the leaderboard if we're in the presentation phase. The first element is the weight of each entry; It may be the direct summed approval stakes, or a weighted version of it. Sorted from low to high.
▸ **members**(): `Vec<(AccountId,BlockNumber)>`
- **summary**: The current membership. When there's a vote going on, this should still be used for executive matters. The block number (second element in the tuple) is the block that their position is active until (calculated by the sum of the block number when the member was elected and their term duration).
▸ **nextFinalize**(): `Option<(BlockNumber,u32,Vec<AccountId>)>`
- **summary**: The accounts holding the seats that will become free on the next tally.
▸ **nextVoterSet**(): `SetIndex`
- **summary**: the next free set to store a voter in. This will keep growing.
▸ **presentationDuration**(): `BlockNumber`
- **summary**: How long to give each top candidate to present themselves after the vote ends.
▸ **proxy**(`AccountId`): `Option<AccountId>`
- **summary**: Who is able to vote for whom. Value is the fund-holding account, key is the vote-transaction-sending account.
▸ **registerInfoOf**(`AccountId`): `Option<(VoteIndex,u32)>`
- **summary**: The vote index and list slot that the candidate `who` was registered or `None` if they are not currently registered.
▸ **termDuration**(): `BlockNumber`
- **summary**: How long each position is active for.
▸ **voteCount**(): `VoteIndex`
- **summary**: The total number of vote rounds that have happened or are in progress.
▸ **voterCount**(): `SetIndex`
- **summary**: Current number of Voters.
▸ **voterInfoOf**(`AccountId`): `Option<VoterInfo>`
- **summary**: Basic information about a voter.
▸ **voters**(`SetIndex`): `Vec<Option<AccountId>>`
- **summary**: The present voter list (chunked and capped at [`VOTER_SET_SIZE`]).
___
### grandpa
▸ **authorities**(): `Vec<(AuthorityId,AuthorityWeight)>`
- **summary**: The current authority set.
▸ **currentSetId**(): `SetId`
- **summary**: The number of changes (both in terms of keys and underlying economic responsibilities) in the "set" of Grandpa validators from genesis.
▸ **nextForced**(): `Option<BlockNumber>`
- **summary**: next block number where we can force a change.
▸ **pendingChange**(): `Option<StoredPendingChange>`
- **summary**: Pending change: (signaled at, scheduled change).
▸ **setIdSession**(`SetId`): `Option<SessionIndex>`
- **summary**: A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible.
▸ **stalled**(): `Option<(BlockNumber,BlockNumber)>`
- **summary**: `true` if we are currently stalled.
▸ **state**(): `StoredState`
- **summary**: State of the current authority set.
___
### imOnline
▸ **gossipAt**(): `BlockNumber`
- **summary**: The block number when we should gossip.
▸ **keys**(): `Vec<AuthorityId>`
- **summary**: The current set of keys that may issue a heartbeat.
▸ **receivedHeartbeats**(`SessionIndex, AuthIndex`): `Bytes`
- **summary**: For each session index we keep a mapping of `AuthorityId` to `offchain::OpaqueNetworkState`.
___
### indices
▸ **enumSet**(`AccountIndex`): `Vec<AccountId>`
- **summary**: The enumeration sets.
▸ **nextEnumSet**(): `AccountIndex`
- **summary**: The next free enumeration set.
___
### offences
▸ **concurrentReportsIndex**(`Kind, OpaqueTimeSlot`): `Vec<ReportIdOf>`
- **summary**: A vector of reports of the same kind that happened at the same time slot.
▸ **reports**(`ReportIdOf`): `Option<OffenceDetails>`
- **summary**: The primary structure that holds all offence records keyed by report identifiers.
▸ **reportsByKindIndex**(`Kind`): `Bytes`
- **summary**: Enumerates all reports of a kind along with the time they happened. All reports are sorted by the time of offence. Note that the actual type of this mapping is `Vec<u8>`, this is because values of different types are not supported at the moment so we are doing the manual serialization.
___
### session
▸ **currentIndex**(): `SessionIndex`
- **summary**: Current index of the session.
▸ **disabledValidators**(): `Vec<u32>`
- **summary**: Indices of disabled validators. The set is cleared when `on_session_ending` returns a new set of identities.
▸ **keyOwner**(`Bytes, (KeyTypeId,Bytes)`): `Option<ValidatorId>`
- **summary**: The owner of a key. The second key is the `KeyTypeId` + the encoded key. The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of the trie. Having all data in the same branch should prevent slowing down other queries.
▸ **nextKeys**(`Bytes, ValidatorId`): `Option<Keys>`
- **summary**: The next session keys for a validator. The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of the trie. Having all data in the same branch should prevent slowing down other queries.
▸ **queuedChanged**(): `bool`
- **summary**: True if the underlying economic identities or weighting behind the validators has changed in the queued validator set.
▸ **queuedKeys**(): `Vec<(ValidatorId,Keys)>`
- **summary**: The queued keys for the next session. When the next session begins, these keys will be used to determine the validator's session keys.
▸ **validators**(): `Vec<ValidatorId>`
- **summary**: The current set of validators.
___
### staking
▸ **bonded**(`AccountId`): `Option<AccountId>`
- **summary**: Map from all locked "stash" accounts to the controller account.
▸ **bondedEras**(): `Vec<(EraIndex,SessionIndex)>`
- **summary**: A mapping from still-bonded eras to the first session index of that era.
▸ **currentElected**(): `Vec<AccountId>`
- **summary**: The currently elected validator set keyed by stash account ID.
▸ **currentEra**(): `EraIndex`
- **summary**: The current era index.
▸ **currentEraPointsEarned**(): `EraPoints`
- **summary**: Rewards for the current era. Using indices of current elected set.
▸ **currentEraStart**(): `MomentOf`
- **summary**: The start of the current era.
▸ **currentEraStartSessionIndex**(): `SessionIndex`
- **summary**: The session index at which the current era started.
▸ **eraSlashJournal**(`EraIndex`): `Vec<SlashJournalEntry>`
- **summary**: All slashes that have occurred in a given era.
▸ **forceEra**(): `Forcing`
- **summary**: True if the next session change will be a new era regardless of index.
▸ **invulnerables**(): `Vec<AccountId>`
- **summary**: Any validators that may never be slashed or forcibly kicked. It's a Vec since they're easy to initialize and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets.
▸ **ledger**(`AccountId`): `Option<StakingLedger>`
- **summary**: Map from all (unlocked) "controller" accounts to the info regarding the staking.
▸ **minimumValidatorCount**(): `u32`
- **summary**: Minimum number of staking participants before emergency conditions are imposed.
▸ **nominators**(`AccountId`): `(Vec<AccountId>, Linkage<AccountId>)`
- **summary**: The map from nominator stash key to the set of stash keys of all validators to nominate.
▸ **payee**(`AccountId`): `RewardDestination`
- **summary**: Where the reward payment should be made. Keyed by stash.
▸ **slashRewardFraction**(): `Perbill`
- **summary**: The percentage of the slash that is distributed to reporters. The rest of the slashed value is handled by the `Slash`.
▸ **slotStake**(): `BalanceOf`
- **summary**: The amount of balance actively at stake for each validator slot, currently. This is used to derive rewards and punishments.
▸ **stakers**(`AccountId`): `Exposure`
- **summary**: Nominators for a particular account that is in action right now. You can't iterate through validators here, but you can find them in the Session module. This is keyed by the stash account.
▸ **validatorCount**(): `u32`
- **summary**: The ideal number of staking participants.
▸ **validators**(`AccountId`): `(ValidatorPrefs, Linkage<AccountId>)`
- **summary**: The map from (wannabe) validator stash key to the preferences of that validator.
___
### sudo
▸ **key**(): `AccountId`
- **summary**: The `AccountId` of the sudo key.
___
### system
▸ **accountNonce**(`AccountId`): `Index`
- **summary**: Extrinsics nonce for accounts.
▸ **allExtrinsicsLen**(): `Option<u32>`
- **summary**: Total length (in bytes) for all extrinsics put together, for the current block.
▸ **allExtrinsicsWeight**(): `Option<Weight>`
- **summary**: Total weight for all extrinsics put together, for the current block.
▸ **blockHash**(`BlockNumber`): `Hash`
- **summary**: Map of block numbers to block hashes.
▸ **digest**(): `DigestOf`
- **summary**: Digest of the current block, also part of the block header.
▸ **eventCount**(): `EventIndex`
- **summary**: The number of events in the `Events<T>` list.
▸ **events**(): `Vec<EventRecord>`
- **summary**: Events deposited for the current block.
▸ **eventTopics**(`Null, Hash`): `Vec<(BlockNumber,EventIndex)>`
- **summary**: Mapping between a topic (represented by T::Hash) and a vector of indexes of events in the `<Events<T>>` list. The first key serves no purpose. This field is declared as double_map just for convenience of using `remove_prefix`. All topic vectors have deterministic storage locations depending on the topic. This allows light-clients to leverage the changes trie storage tracking mechanism and in case of changes fetch the list of events of interest. The value has the type `(T::BlockNumber, EventIndex)` because if we used only just the `EventIndex` then in case if the topic has the same contents on the next block no notification will be triggered thus the event might be lost.
▸ **extrinsicCount**(): `Option<u32>`
- **summary**: Total extrinsics count for the current block.
▸ **extrinsicData**(`u32`): `Bytes`
- **summary**: Extrinsics data for the current block (maps an extrinsic's index to its data).
▸ **extrinsicsRoot**(): `Hash`
- **summary**: Extrinsics root of the current block, also part of the block header.
▸ **nextWeightMultiplier**(): `WeightMultiplier`
- **summary**: The next weight multiplier. This should be updated at the end of each block based on the saturation level (weight).
▸ **number**(): `BlockNumber`
- **summary**: The current block number being processed. Set by `execute_block`.
▸ **parentHash**(): `Hash`
- **summary**: Hash of the previous block.
▸ **randomMaterial**(): `(i8,Vec<Hash>)`
- **summary**: Series of block headers from the last 81 blocks that acts as random seed material. This is arranged as a ring buffer with the `i8` prefix being the index into the `Vec` of the oldest hash.
___
### technicalCommittee
▸ **members**(): `Vec<AccountId>`
- **summary**: The current members of the collective. This is stored sorted (just by value).
▸ **proposalCount**(): `u32`
- **summary**: Proposals so far.
▸ **proposalOf**(`Hash`): `Option<Proposal>`
- **summary**: Actual proposal for a given hash, if it's current.
▸ **proposals**(): `Vec<Hash>`
- **summary**: The hashes of the active proposals.
▸ **voting**(`Hash`): `Option<Votes>`
- **summary**: Votes on a given proposal, if it is ongoing.
___
### technicalMembership
▸ **members**(): `Vec<AccountId>`
- **summary**: The current membership, stored as an ordered Vec.
___
### timestamp
▸ **didUpdate**(): `bool`
- **summary**: Did the timestamp get updated in this block?
▸ **now**(): `Moment`
- **summary**: Current time for the current block.
___
### treasury
▸ **approvals**(): `Vec<ProposalIndex>`
- **summary**: Proposal indices that have been approved but not yet awarded.
▸ **proposalCount**(): `ProposalIndex`
- **summary**: Number of proposals that have been made.
▸ **proposals**(`ProposalIndex`): `Option<TreasuryProposal>`
- **summary**: Proposals that have been made.
---
### substrate
_These are keys that are always available to the runtime implementation_
▸ **changesTrieConfig**(): `u32`
- **summary**: Changes trie configuration is stored under this key.
▸ **childStorageKeyPrefix**(): `u32`
- **summary**: Prefix of child storage keys.
▸ **code**(): `Bytes`
- **summary**: Wasm code of the runtime.
▸ **extrinsicIndex**(): `u32`
- **summary**: Current extrinsic index (u32) is stored under this key.
▸ **heapPages**(): `u64`
- **summary**: Number of wasm linear memory pages required for execution of the runtime.
---
-1
View File
@@ -7,7 +7,6 @@ const path = require('path');
module.exports = function resolver (file, config) {
if (file.includes('package.json')) {
console.error(file, config);
return path.join(config.basedir.replace('/src', '/'), file);
}
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.1.1"
"version": "1.2.1"
}
+9 -11
View File
@@ -1,5 +1,5 @@
{
"version": "1.1.1",
"version": "1.2.1",
"private": true,
"engines": {
"yarn": "^1.10.1"
@@ -8,7 +8,6 @@
"packages/*"
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "^3.7.5"
},
"scripts": {
@@ -17,19 +16,18 @@
"circular": "madge --circular --extensions ts ./",
"docs": "node packages/types/src/scripts/MetadataMdWrapper.js && polkadot-dev-build-docs",
"chain:info": "node packages/types/src/scripts/extractChainWrapper.js",
"lint": "eslint --ext .js,.jsx,.ts,.tsx . && tsc --noEmit --pretty",
"lint": "polkadot-dev-run-lint",
"clean": "polkadot-dev-clean-build",
"postinstall": "polkadot-dev-yarn-only",
"test": "jest --coverage --runInBand --testPathIgnorePatterns e2e",
"test:all": "jest",
"test:one": "jest",
"test:watch": "jest --coverage --watch"
"test": "polkadot-dev-run-test --coverage --runInBand --testPathIgnorePatterns e2e",
"test:one": "polkadot-dev-run-test",
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/core": "^7.8.4",
"@babel/register": "^7.8.3",
"@babel/runtime": "^7.8.3",
"@polkadot/dev": "^0.33.3",
"@polkadot/ts": "^0.2.1"
"@babel/runtime": "^7.8.4",
"@polkadot/dev": "^0.40.16",
"@polkadot/ts": "^0.2.3"
}
}
+8 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.1.1",
"version": "1.2.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -26,7 +26,12 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/types": "^1.1.1"
"@babel/runtime": "^7.8.4",
"@polkadot/api": "^1.2.1",
"@polkadot/rpc-core": "^1.2.1",
"@polkadot/types": "^1.2.1",
"@polkadot/util": "^2.3.1",
"bn.js": "^5.1.1",
"rxjs": "^6.5.4"
}
}
+1 -1
View File
@@ -62,7 +62,7 @@ export default class Blueprint<ApiType extends ApiTypes> extends BaseWithTx<ApiT
private createResult = (result: SubmittableResult): BlueprintCreateResult<ApiType> => {
let contract: Contract<ApiType> | undefined;
if (result.isFinalized) {
if (result.isInBlock) {
const record = result.findRecord('contract', 'Instantiated');
if (record) {
+1 -1
View File
@@ -58,7 +58,7 @@ export default class Code<ApiType extends ApiTypes> extends BaseWithTx<ApiType>
private createResult = (result: SubmittableResultImpl): CodePutCodeResult<ApiType> => {
let blueprint: Blueprint<ApiType> | undefined;
if (result.isFinalized) {
if (result.isInBlock) {
const record = result.findRecord('contract', 'CodeStored');
if (record) {
+12 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.1.1",
"version": "1.2.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -27,11 +27,18 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/api": "^1.1.1",
"@polkadot/types": "^1.1.1"
"@babel/runtime": "^7.8.4",
"@polkadot/api": "^1.2.1",
"@polkadot/rpc-core": "^1.2.1",
"@polkadot/rpc-provider": "^1.2.1",
"@polkadot/types": "^1.2.1",
"@polkadot/util": "^2.3.1",
"@polkadot/util-crypto": "^2.3.1",
"bn.js": "^5.1.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@polkadot/keyring": "^2.2.1"
"@polkadot/keyring": "^2.3.1"
}
}
+32 -16
View File
@@ -2,16 +2,39 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import { AccountId, AccountIndex, BalanceOf } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { Observable, of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ENUMSET_SIZE } from '@polkadot/types/primitive/Generic/AccountIndex';
import { ClassOf, Vec, createType } from '@polkadot/types';
import { ClassOf, Option, Vec, createType } from '@polkadot/types';
import { memo } from '../util';
function queryEnumSet (api: ApiInterfaceRx, _accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
const accountIndex = _accountIndex instanceof ClassOf(api.registry, 'AccountIndex')
? _accountIndex
: createType(api.registry, 'AccountIndex', _accountIndex);
return api.query.indices.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
startWith([]),
map((accounts): AccountId | undefined =>
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
)
);
}
// current
function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
return api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
map((optResult): AccountId | undefined =>
optResult.unwrapOr([])[0]
)
);
}
/**
* @name indexToId
* @param {( AccountIndex | string )} accountIndex - An accounts index in different formats.
@@ -26,18 +49,11 @@ import { memo } from '../util';
* ```
*/
export function indexToId (api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> {
return memo((_accountIndex: AccountIndex | string): Observable<AccountId | undefined> => {
const accountIndex = _accountIndex instanceof ClassOf(api.registry, 'AccountIndex')
? _accountIndex
: createType(api.registry, 'AccountIndex', _accountIndex);
return api.query.indices.enumSet
? api.query.indices.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
startWith([]),
map((accounts): AccountId | undefined =>
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
)
)
: of(undefined);
});
return memo((accountIndex: AccountIndex | string): Observable<AccountId | undefined> =>
api.query.indices
? api.query.indices.accounts
? query(api, accountIndex)
: queryEnumSet(api, accountIndex)
: of(undefined)
);
}
+36 -25
View File
@@ -15,6 +15,36 @@ import { memo } from '../util';
const enumsetSize = ENUMSET_SIZE.toNumber();
function queryEnumSet (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.nextEnumSet<AccountIndex>().pipe(
// use the nextEnumSet (which is a counter of the number of sets) to construct
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
// containing an AccountId
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
),
map((all: AccountId[][]): AccountIndexes =>
all.reduce((result: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
// re-create the index based on position 0 is [0][0] and likewise
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
const index = (outerIndex * enumsetSize) + innerIndex;
result[accountId.toString()] = createType(api.registry, 'AccountIndex', index);
});
return result;
}, {})
)
);
}
// TODO Reverse lookup (via query keys)
function query (): Observable<AccountIndexes> {
return of({} as AccountIndexes);
}
/**
* @name indexes
* @returns Returns all the indexes on the system.
@@ -32,29 +62,10 @@ const enumsetSize = ENUMSET_SIZE.toNumber();
*/
export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes> {
return memo((): Observable<AccountIndexes> =>
(api.query.indices.nextEnumSet
? api.query.indices.nextEnumSet<AccountIndex>().pipe(
// use the nextEnumSet (which is a counter of the number of sets) to construct
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
// containing an AccountId
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
)
)
: of([] as AccountId[][])
).pipe(
map((all: AccountId[][]): AccountIndexes =>
all.reduce((result: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
// re-create the index based on position 0 is [0][0] and likewise
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
const index = (outerIndex * enumsetSize) + innerIndex;
result[accountId.toString()] = createType(api.registry, 'AccountIndex', index);
});
return result;
}, {}))
));
api.query.indices
? api.query.indices.accounts
? query()
: queryEnumSet(api)
: of({} as AccountIndexes)
);
}
+15 -4
View File
@@ -3,6 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountData, AccountIndex, Address, Balance, Index } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DerivedBalancesAccount } from '../types';
import { combineLatest, of, Observable } from 'rxjs';
@@ -27,7 +28,7 @@ function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBa
}
// old
function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[Balance, Balance, Index]>([
[api.query.balances.freeBalance, accountId],
[api.query.balances.reservedBalance, accountId],
@@ -39,7 +40,7 @@ function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result
);
}
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[AccountData, Index]>([
[api.query.balances.account, accountId],
[api.query.system.accountNonce, accountId]
@@ -50,6 +51,14 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
);
}
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.query.system.account<ITuple<[Index, AccountData]>>(accountId).pipe(
map(([accountNonce, { free, reserved, miscFrozen, feeFrozen }]): Result =>
[free, reserved, feeFrozen, miscFrozen, accountNonce]
)
);
}
/**
* @name account
* @param {( AccountIndex | AccountId | Address | string )} address - An accounts Id in different formats.
@@ -72,9 +81,11 @@ export function account (api: ApiInterfaceRx): (address: AccountIndex | AccountI
(accountId
? combineLatest([
of(accountId),
api.query.balances.account
api.query.system.account
? queryCurrent(api, accountId)
: queryOld(api, accountId)
: api.query.balances.account
? queryBalancesAccount(api, accountId)
: queryBalancesFree(api, accountId)
])
: of([createType(api.registry, 'AccountId'), [createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Index')]])
)
+2 -1
View File
@@ -15,6 +15,7 @@ import * as council from './council';
import * as democracy from './democracy';
import * as elections from './elections';
import * as imOnline from './imOnline';
import * as parachains from './parachains';
import * as session from './session';
import * as society from './society';
import * as staking from './staking';
@@ -23,7 +24,7 @@ import * as treasury from './treasury';
export * from './type';
export const derive = { accounts, balances, chain, contracts, council, democracy, elections, imOnline, session, society, staking, technicalCommittee, treasury };
export const derive = { accounts, balances, chain, contracts, council, democracy, elections, imOnline, parachains, session, society, staking, technicalCommittee, treasury };
type DeriveSection<Section> = {
[Method in keyof Section]: Section[Method] extends AnyFunction
+120
View File
@@ -0,0 +1,120 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { BlockNumber, CollatorId, ParaId, ParaInfo, Retriable, UpwardMessage } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveParachain, DeriveParachainActive } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Bytes, Option, Vec } from '@polkadot/types';
import { memo } from '../util';
type ParaIds = ParaId[];
type ParaInfoResult = Option<ParaInfo>;
type PendingSwap = Option<ParaId>;
type Active = ITuple<[ParaId, Option<ITuple<[CollatorId, Retriable]>>]>[];
type RetryQueue = ITuple<[ParaId, CollatorId]>[][]
type SelectedThreads = ITuple<[ParaId, CollatorId]>[][];
type Heads = Bytes;
type RelayDispatchQueue = Vec<UpwardMessage>
type Watermarks = Option<BlockNumber>;
type DidUpdate = Option<Vec<ParaId>>;
type Result = [
ParaId[],
[
Active,
RetryQueue,
SelectedThreads,
DidUpdate
],
ParaInfoResult[],
PendingSwap[],
Heads[],
RelayDispatchQueue[],
Watermarks[],
];
function parseActive (id: ParaId, active: Active): DeriveParachainActive | null {
const found = active.find(([paraId]): boolean => paraId === id);
if (found && found[1].isSome) {
const [collatorId, retriable] = found[1].unwrap();
return {
collatorId,
...(
retriable.isWithRetries
? {
isRetriable: true,
retries: retriable.asWithRetries.toNumber()
}
: {
isRetriable: false,
retries: 0
}
)
};
}
return null;
}
function parseCollators (id: ParaId, collatorQueue: SelectedThreads | RetryQueue): (CollatorId | null)[] {
return collatorQueue
.map((queue): CollatorId | null => {
const found = queue.find(([paraId]): boolean => paraId === id);
return found ? found[1] : null;
});
}
function parse ([ids, [active, retryQueue, selectedThreads, didUpdate], infos, pendingSwaps, heads, relayDispatchQueues, watermarks]: Result): DeriveParachain[] {
return ids.map((id, index): DeriveParachain => {
return {
active: parseActive(id, active),
didUpdate: didUpdate.isSome
? didUpdate.unwrap().some((paraId): boolean => paraId === id)
: false,
heads: heads[index],
id,
info: infos[index].unwrapOr(null),
pendingSwapId: pendingSwaps[index].unwrapOr(null),
relayDispatchQueue: relayDispatchQueues[index],
retryCollators: parseCollators(id, retryQueue),
selectedCollators: parseCollators(id, selectedThreads),
watermark: watermarks[index].unwrapOr(null)
};
});
}
export function all (api: ApiInterfaceRx): () => Observable<DeriveParachain[]> {
return memo((): Observable<DeriveParachain[]> =>
api.query.registrar?.parachains && api.query.parachains
? api.query.registrar.parachains<ParaIds>().pipe(
switchMap((paraIds) =>
combineLatest([
of(paraIds),
api.queryMulti([
api.query.registrar.active,
api.query.registrar.retryQueue,
api.query.registrar.selectedThreads,
api.query.parachains.didUpdate
]),
api.query.registrar.paras.multi<ParaInfo>(paraIds),
api.query.registrar.pendingSwap.multi<PendingSwap>(paraIds),
api.query.parachains.heads.multi<Heads>(paraIds),
api.query.parachains.relayDispatchQueue.multi<RelayDispatchQueue>(paraIds),
api.query.parachains.watermarks.multi<Watermarks>(paraIds)
]) as Observable<Result>
),
map((result: Result): DeriveParachain[] =>
parse(result)
)
)
: of([] as DeriveParachain[])
);
}
@@ -0,0 +1,5 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
export * from './all';
+21 -2
View File
@@ -2,10 +2,10 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, EraIndex, EraPoints, Exposure, Hash, Index, Keys, Proposal, PropIndex, ProposalIndex, ReferendumInfo, RegistrationJudgement, RewardDestination, SessionIndex, SetIndex, SocietyVote, StakingLedger, StrikeCount, TreasuryProposal, ValidatorPrefs, Vote, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import { AccountId, AccountIndex, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, CollatorId, EraIndex, EraPoints, Exposure, Hash, Index, Keys, ParaId, ParaInfo, Proposal, PropIndex, ProposalIndex, ReferendumInfo, RegistrationJudgement, RewardDestination, SessionIndex, SetIndex, SocietyVote, StakingLedger, StrikeCount, TreasuryProposal, UpwardMessage, ValidatorPrefs, Vote, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import { u32, Vec } from '@polkadot/types';
import { Bytes, u32, Vec } from '@polkadot/types';
export type AccountIndexes = Record<string, AccountIndex>;
@@ -107,6 +107,25 @@ export interface RecentlyOffline {
count: BN;
}
export interface DeriveParachainActive {
collatorId: CollatorId;
isRetriable: boolean;
retries: number;
}
export interface DeriveParachain {
active: DeriveParachainActive | null;
didUpdate: boolean;
pendingSwapId: ParaId | null;
heads: Bytes | null;
id: ParaId;
info: ParaInfo | null;
relayDispatchQueue: UpwardMessage[];
retryCollators: (CollatorId | null)[];
selectedCollators: (CollatorId | null)[];
watermark: BlockNumber | null;
}
export interface DeriveProposalPreImage {
at: BlockNumber;
balance: Balance;
+14 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.1.1",
"version": "1.2.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -26,16 +26,20 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/api-derive": "^1.1.1",
"@polkadot/keyring": "^2.2.1",
"@polkadot/metadata": "^1.1.1",
"@polkadot/rpc-core": "^1.1.1",
"@polkadot/rpc-provider": "^1.1.1",
"@polkadot/types": "^1.1.1",
"@polkadot/util-crypto": "^2.2.1"
"@babel/runtime": "^7.8.4",
"@polkadot/api-derive": "^1.2.1",
"@polkadot/keyring": "^2.3.1",
"@polkadot/metadata": "^1.2.1",
"@polkadot/rpc-core": "^1.2.1",
"@polkadot/rpc-provider": "^1.2.1",
"@polkadot/types": "^1.2.1",
"@polkadot/util": "^2.3.1",
"@polkadot/util-crypto": "^2.3.1",
"bn.js": "^5.1.1",
"eventemitter3": "^4.0.0",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@polkadot/keyring": "^2.2.1"
"@polkadot/keyring": "^2.3.1"
}
}
+6 -6
View File
@@ -123,14 +123,14 @@ export default abstract class ApiBase<ApiType extends ApiTypes> extends Init<Api
/**
* @description Contains all the chain state modules and their subsequent methods in the API. These are attached dynamically from the runtime metadata.
*
* All calls inside the namespace, is denoted by `section`.`method` and may take an optional query parameter. As an example, `api.query.timestamp.now()` (current block timestamp) does not take parameters, while `api.query.system.accountNonce(<accountId>)` (retrieving the associated nonce for an account), takes the `AccountId` as a parameter.
* All calls inside the namespace, is denoted by `section`.`method` and may take an optional query parameter. As an example, `api.query.timestamp.now()` (current block timestamp) does not take parameters, while `api.query.system.account(<accountId>)` (retrieving the associated nonce & balances for an account), takes the `AccountId` as a parameter.
*
* @example
* <BR>
*
* ```javascript
* api.query.balances.freeBalance(<accountId>, (balance) => {
* console.log('new balance', balance);
* api.query.system.account(<accountId>, ([nonce, balance]) => {
* console.log('new free balance', balance.free, 'new nonce', nonce);
* });
* ```
*/
@@ -150,10 +150,10 @@ export default abstract class ApiBase<ApiType extends ApiTypes> extends Init<Api
* // you can include the storage without any parameters
* api.query.balances.totalIssuance,
* // or you can pass parameters to the storage query
* [api.query.balances.freeBalance, '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY']
* [api.query.system.account, '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY']
* ],
* ([existential, balance]) => {
* console.log(`You have ${balance.sub(existential)} more than the existential deposit`);
* ([existential, [, { free }]]) => {
* console.log(`You have ${free.sub(existential)} more than the existential deposit`);
*
* unsub();
* }
+15 -10
View File
@@ -20,8 +20,8 @@ function consts (api: ApiPromise): void {
// constants has actual value & metadata
console.log(
api.consts.foo.bar,
api.consts.balances.creationFee.toNumber(),
api.consts.balances.creationFee.meta.documentation.map((s): string => s.toString()).join('')
api.consts.balances.existentialDeposit.toNumber(),
api.consts.balances.existentialDeposit.meta.documentation.map((s): string => s.toString()).join('')
);
}
@@ -40,24 +40,29 @@ async function query (api: ApiPromise, keyring: TestKeyringMap): Promise<void> {
// api.query.*.* is well-typed
const bar = await api.query.foo.bar(); // bar is Codec (unknown module)
const bal = await api.query.balances.freeBalance(keyring.alice.address); // bal is Balance
const bal2 = await api.query.balances.freeBalance(keyring.alice.address, 'WRONG_ARG'); // bal2 is Codec (wrong args)
const override = await api.query.balances.freeBalance<Header>(keyring.alice.address); // override is still available
const oldBal = await api.query.balances.freeBalance.at('abcd', keyring.alice.address);
const bal = await api.query.balances.totalIssuance(); // bal is Balance
const bal2 = await api.query.balances.totalIssuance('WRONG_ARG'); // bal2 is Codec (wrong args)
const override = await api.query.balances.totalIssuance<Header>(); // override is still available
const oldBal = await api.query.balances.totalIssuance.at('abcd');
// It's hard to correctly type .multi. Expected: `Balance[]`, actual: Codec[].
// In the meantime, we can case with `<Balance>`
// In the meantime, we can case with `<Balance>` (this is not available on recent chains)
const multi = await api.query.balances.freeBalance.multi<Balance>([keyring.alice.address, keyring.bob.address]);
console.log('query types:', bar, bal, bal2, override, oldBal, multi);
// check multi for unsub
const multiUnsub = await api.queryMulti([
[api.query.system.accountNonce, keyring.eve.address],
[api.query.system.account, keyring.eve.address],
// older chains only
[api.query.system.accountNonce, keyring.bob.address]
], (balances): void => {
console.log('balances', balances);
], (values): void => {
console.log('values', values);
multiUnsub();
});
// check entries()
await api.query.system.account.entries(); // should not take a param
await api.query.staking.nominatorSlashInEra.entries(123); // should take a param
}
async function rpc (api: ApiPromise): Promise<void> {
+4 -5
View File
@@ -154,7 +154,7 @@ export function decorateMethod<Method extends AnyFunction> (method: Method, opti
* import ApiPromise from '@polkadot/api/promise';
*
* ApiPromise.create().then((api) => {
* const nonce = await api.query.system.accountNonce(keyring.alice.address);
* const [nonce] = await api.query.system.account(keyring.alice.address);
*
* api.tx.balances
* // create transfer
@@ -256,10 +256,9 @@ export default class ApiPromise extends ApiBase<'promise'> {
* // combines values from balance & nonce as it updates
* api.combineLatest([
* api.rpc.chain.subscribeNewHeads,
* [api.query.balances.freeBalance, address],
* (cb) => api.query.system.accountNonce(address, cb)
* ], ([head, balance, nonce]) => {
* console.log(`#${head.number}: You have ${balance} units, with ${nonce} transactions sent`);
* (cb) => api.query.system.account(address, cb)
* ], ([head, [balance, nonce]]) => {
* console.log(`#${head.number}: You have ${balance.free} units, with ${nonce} transactions sent`);
* });
* ```
*/
+3 -3
View File
@@ -91,11 +91,11 @@ export function decorateMethod <Method extends AnyFunction> (method: Method): Me
*
* // retrieve nonce for the account
* api.query.system
* .accountNonce(keyring.alice.address)
* .account(keyring.alice.address)
* .pipe(
* first(),
* // pipe nonce into transfer
* switchMap((nonce) =>
* switchMap(([nonce]) =>
* api.tx.balances
* // create transfer
* .transfer(keyring.bob.address, 12345)
@@ -107,7 +107,7 @@ export function decorateMethod <Method extends AnyFunction> (method: Method): Me
* )
* // subscribe to overall result
* .subscribe(({ status }) => {
* if (status.isFinalized) {
* if (status.isInBlock) {
* console.log('Completed at block hash', status.asFinalized.toHex());
* }
* });
+6 -2
View File
@@ -16,17 +16,21 @@ export default class SubmittableResult implements SubmittableResultImpl {
}
public get isCompleted (): boolean {
return this.isError || this.isFinalized;
return this.isError || this.status.isInBlock || this.status.isFinalized;
}
public get isError (): boolean {
return this.status.isDropped || this.status.isInvalid || this.status.isUsurped;
return this.status.isDropped || this.status.isFinalityTimeout || this.status.isInvalid || this.status.isRetracted || this.status.isUsurped;
}
public get isFinalized (): boolean {
return this.status.isFinalized;
}
public get isInBlock (): boolean {
return this.status.isInBlock;
}
/**
* @description Filters EventRecords for the specified method & section (there could be multiple)
*/
+11 -5
View File
@@ -3,8 +3,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Call, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
import { Callback, Codec, Constructor, IKeyringPair, Registry, SignatureOptions } from '@polkadot/types/types';
import { AccountData, Address, Call, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
import { Callback, Codec, Constructor, IKeyringPair, ITuple, Registry, SignatureOptions } from '@polkadot/types/types';
import { ApiInterfaceRx, ApiTypes, SignerResult } from '../types';
import { AddressOrPair, SignerOptions, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultImpl, SubmittableResultResult, SubmittableResultSubscription, SubmittableThis } from './types';
@@ -235,7 +235,11 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
// ? this._api.rpc.account.nextIndex
// ? this._api.rpc.account.nextIndex(address)
// : this._api.query.system.accountNonce(address)
? this._api.query.system.accountNonce(address)
? this._api.query.system.account
? this._api.query.system.account<ITuple<[Index, AccountData]>>(address).pipe(
map(([nonce]): Index => nonce)
)
: this._api.query.system.accountNonce<Index>(address)
: of(createType(this.registry, 'Index', options.nonce)),
// if we have an era provided already or eraLength is <= 0 (immortal)
// don't get the latest block, just pass null, handle in mergeMap
@@ -252,11 +256,13 @@ export default function createClass <ApiType extends ApiTypes> ({ api, apiType,
}
private _statusObservable (status: ExtrinsicStatus): Observable<SubmittableResultImpl> {
if (!status.isFinalized) {
if (!status.isFinalized && !status.isInBlock) {
return of(new SubmittableResult({ status }));
}
const blockHash = status.asFinalized;
const blockHash = status.isInBlock
? status.asInBlock
: status.asFinalized;
return combineLatest([
this._api.rpc.chain.getBlock(blockHash),
+3 -2
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Address, ExtrinsicStatus, EventRecord, Hash, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
import { AnyNumber, AnyU8a, Callback, IExtrinsic, IExtrinsicEra, IKeyringPair, SignatureOptions } from '@polkadot/types/types';
import { AnyNumber, AnyU8a, Callback, Codec, IExtrinsic, IExtrinsicEra, IKeyringPair, SignatureOptions } from '@polkadot/types/types';
import { ApiTypes, Signer } from '../types';
import { Observable } from 'rxjs';
@@ -14,6 +14,7 @@ export interface SubmittableResultImpl {
readonly isCompleted: boolean;
readonly isError: boolean;
readonly isFinalized: boolean;
readonly isInBlock: boolean;
filterRecords (section: string, method: string): EventRecord[];
findRecord (section: string, method: string): EventRecord | undefined;
@@ -47,7 +48,7 @@ export type SubmittableThis<ApiType extends ApiTypes, THIS> =
export interface SignerOptions {
blockHash: AnyU8a;
era?: IExtrinsicEra | number;
nonce: AnyNumber;
nonce: AnyNumber | Codec;
signer?: Signer;
tip?: AnyNumber;
}
-8
View File
@@ -42,10 +42,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* The minimum amount required to keep an account open.
**/
existentialDeposit: AugmentedConst<Balance>;
/**
* The fee required to create an account.
**/
creationFee: AugmentedConst<Balance>;
};
transactionPayment: {
[index: string]: Codec;
@@ -201,10 +197,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* to removal of a contract.
**/
surchargeReward: AugmentedConst<BalanceOf>;
/**
* The fee required to create an account.
**/
creationFee: AugmentedConst<BalanceOf>;
/**
* The fee to be paid for making a transaction; the base.
**/
+16 -23
View File
@@ -33,9 +33,9 @@ declare module '@polkadot/api/types/storage' {
system: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Extrinsics nonce for accounts.
* The full account information for a particular account ID.
**/
accountNonce: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Index>> & QueryableStorageEntry<ApiType>;
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[Index, AccountData]>>> & QueryableStorageEntry<ApiType>;
/**
* Total extrinsics count for the current block.
**/
@@ -97,7 +97,7 @@ declare module '@polkadot/api/types/storage' {
/**
* The set of open multisig operations.
**/
multisigs: AugmentedQuery<ApiType, (key1: AccountId | string | Uint8Array, key2: Raw | string | Uint8Array) => Observable<Option<Multisig>>> & QueryableStorageEntry<ApiType>;
multisigs: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: Raw | string | Uint8Array) => Observable<Option<Multisig>>, AccountId | string | Uint8Array> & QueryableStorageEntry<ApiType>;
};
babe: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -179,13 +179,9 @@ declare module '@polkadot/api/types/storage' {
indices: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The next free enumeration set.
* The lookup from index to account.
**/
nextEnumSet: AugmentedQuery<ApiType, () => Observable<AccountIndex>> & QueryableStorageEntry<ApiType>;
/**
* The enumeration sets.
**/
enumSet: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
accounts: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
};
balances: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -197,6 +193,7 @@ declare module '@polkadot/api/types/storage' {
* The balance of an account.
* NOTE: THIS MAY NEVER BE IN EXISTENCE AND YET HAVE A `total().is_zero()`. If the total
* is ever zero, then the entry *MUST* be removed.
* NOTE: This is only used in the case that this module is used to store balances.
**/
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<AccountData>> & QueryableStorageEntry<ApiType>;
/**
@@ -309,11 +306,11 @@ declare module '@polkadot/api/types/storage' {
* All slashing events on validators, mapped by era to the highest slash proportion
* and slash value of the era.
**/
validatorSlashInEra: AugmentedQuery<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
validatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>, EraIndex | AnyNumber | Uint8Array> & QueryableStorageEntry<ApiType>;
/**
* All slashing events on nominators, mapped by era to the highest slash value of the era.
**/
nominatorSlashInEra: AugmentedQuery<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<BalanceOf>>> & QueryableStorageEntry<ApiType>;
nominatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<BalanceOf>>, EraIndex | AnyNumber | Uint8Array> & QueryableStorageEntry<ApiType>;
/**
* Slashing spans for stash accounts.
**/
@@ -327,10 +324,6 @@ declare module '@polkadot/api/types/storage' {
* The earliest era for which we have a pending, unapplied slash.
**/
earliestUnappliedSlash: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>> & QueryableStorageEntry<ApiType>;
/**
* The version of storage for upgrade.
**/
storageVersion: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
};
session: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -362,13 +355,13 @@ declare module '@polkadot/api/types/storage' {
* The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of
* the trie. Having all data in the same branch should prevent slowing down other queries.
**/
nextKeys: AugmentedQuery<ApiType, (key1: Bytes | string | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<Option<Keys>>> & QueryableStorageEntry<ApiType>;
nextKeys: AugmentedQueryDoubleMap<ApiType, (key1: Bytes | string | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<Option<Keys>>, Bytes | string | Uint8Array> & QueryableStorageEntry<ApiType>;
/**
* The owner of a key. The second key is the `KeyTypeId` + the encoded key.
* The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of
* the trie. Having all data in the same branch should prevent slowing down other queries.
**/
keyOwner: AugmentedQuery<ApiType, (key1: Bytes | string | Uint8Array, key2: ITuple<[KeyTypeId, Bytes]>) => Observable<Option<ValidatorId>>> & QueryableStorageEntry<ApiType>;
keyOwner: AugmentedQueryDoubleMap<ApiType, (key1: Bytes | string | Uint8Array, key2: ITuple<[KeyTypeId, Bytes]>) => Observable<Option<ValidatorId>>, Bytes | string | Uint8Array> & QueryableStorageEntry<ApiType>;
};
democracy: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -414,7 +407,7 @@ declare module '@polkadot/api/types/storage' {
* Get the vote in a given referendum of a particular voter. The result is meaningful only
* if `voters_for` includes the voter when called with the referendum (you'll get the
* default `Vote` value otherwise). If you don't want to check `voters_for`, then you can
* also check for simple existence with `VoteOf::exists` first.
* also check for simple existence with `VoteOf::contains_key` first.
**/
voteOf: AugmentedQuery<ApiType, (arg: ITuple<[ReferendumIndex, AccountId]>) => Observable<Vote>> & QueryableStorageEntry<ApiType>;
/**
@@ -650,12 +643,12 @@ declare module '@polkadot/api/types/storage' {
* For each session index, we keep a mapping of `AuthIndex`
* to `offchain::OpaqueNetworkState`.
**/
receivedHeartbeats: AugmentedQuery<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
receivedHeartbeats: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>, SessionIndex | AnyNumber | Uint8Array> & QueryableStorageEntry<ApiType>;
/**
* For each session index, we keep a mapping of `T::ValidatorId` to the
* number of blocks authored by the given authority.
**/
authoredBlocks: AugmentedQuery<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>> & QueryableStorageEntry<ApiType>;
authoredBlocks: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>, SessionIndex | AnyNumber | Uint8Array> & QueryableStorageEntry<ApiType>;
};
offences: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -666,7 +659,7 @@ declare module '@polkadot/api/types/storage' {
/**
* A vector of reports of the same kind that happened at the same time slot.
**/
concurrentReportsIndex: AugmentedQuery<ApiType, (key1: Kind | string | Uint8Array, key2: OpaqueTimeSlot | string | Uint8Array) => Observable<Vec<ReportIdOf>>> & QueryableStorageEntry<ApiType>;
concurrentReportsIndex: AugmentedQueryDoubleMap<ApiType, (key1: Kind | string | Uint8Array, key2: OpaqueTimeSlot | string | Uint8Array) => Observable<Vec<ReportIdOf>>, Kind | string | Uint8Array> & QueryableStorageEntry<ApiType>;
/**
* Enumerates all reports of a kind along with the time they happened.
* All reports are sorted by the time of offence.
@@ -761,7 +754,7 @@ declare module '@polkadot/api/types/storage' {
/**
* Double map from Candidate -> Voter -> (Maybe) Vote.
**/
votes: AugmentedQuery<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<SocietyVote>>> & QueryableStorageEntry<ApiType>;
votes: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<SocietyVote>>, AccountId | string | Uint8Array> & QueryableStorageEntry<ApiType>;
/**
* The defending member currently being challenged.
**/
@@ -786,7 +779,7 @@ declare module '@polkadot/api/types/storage' {
* First account is the account to be recovered, and the second account
* is the user trying to recover the account.
**/
activeRecoveries: AugmentedQuery<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ActiveRecovery>>> & QueryableStorageEntry<ApiType>;
activeRecoveries: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ActiveRecovery>>, AccountId | string | Uint8Array> & QueryableStorageEntry<ApiType>;
/**
* The final list of recovered accounts.
* Map from the recovered account to the user who can access it.
+9 -1
View File
@@ -3,7 +3,7 @@
import { AnyNumber, Codec, IExtrinsic } from '@polkadot/types/types';
import { Option, Vec } from '@polkadot/types/codec';
import { Bytes, H256, StorageData, StorageKey, Text, u32, u64 } from '@polkadot/types/primitive';
import { Bytes, H256, StorageData, StorageKey, Text, bool, u32, u64 } from '@polkadot/types/primitive';
import { Metadata } from '@polkadot/types';
import { AccountId, BlockNumber, Extrinsic, Hash, Header, Index, SignedBlock } from '@polkadot/types/interfaces/runtime';
import { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
@@ -19,6 +19,14 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
nextIndex(accountId: AccountId | string | Uint8Array): Observable<Index>;
};
author: {
/**
* Returns true if the keystore has private keys for the given public key and key type.
**/
hasKey(publicKey: Bytes | string | Uint8Array, keyType: Text | string): Observable<bool>;
/**
* Returns true if the keystore has private keys for the given session public keys.
**/
hasSessionKeys(sessionKeys: Bytes | string | Uint8Array): Observable<bool>;
/**
* Insert a key into the keystore.
**/
+79 -18
View File
@@ -4,7 +4,7 @@
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
import { Bytes, Data, IdentityFields, bool, u16, u32, u64 } from '@polkadot/types/primitive';
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, Moment, Signature } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, Signature } from '@polkadot/types/interfaces/runtime';
import { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
@@ -194,6 +194,67 @@ declare module '@polkadot/api/types/submittable' {
**/
setUncles: AugmentedSubmittable<(newUncles: Vec<Header> | (Header | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
};
indices: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Assign an previously unassigned index.
* Payment: `Deposit` is reserved from the sender account.
* The dispatch origin for this call must be _Signed_.
* - `index`: the index to be claimed. This must not be in use.
* Emits `IndexAssigned` if successful.
* # <weight>
* - `O(1)`.
* - One storage mutation (codec `O(1)`).
* - One reserve operation.
* - One event.
* # </weight>
**/
claim: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Assign an index already owned by the sender to another account. The balance reservation
* is effectively transfered to the new account.
* The dispatch origin for this call must be _Signed_.
* - `index`: the index to be re-assigned. This must be owned by the sender.
* - `new`: the new owner of the index. This function is a no-op if it is equal to sender.
* Emits `IndexAssigned` if successful.
* # <weight>
* - `O(1)`.
* - One storage mutation (codec `O(1)`).
* - One transfer operation.
* - One event.
* # </weight>
**/
transfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Free up an index owned by the sender.
* Payment: Any previous deposit placed for the index is unreserved in the sender account.
* The dispatch origin for this call must be _Signed_ and the sender must own the index.
* - `index`: the index to be freed. This must be owned by the sender.
* Emits `IndexFreed` if successful.
* # <weight>
* - `O(1)`.
* - One storage mutation (codec `O(1)`).
* - One reserve operation.
* - One event.
* # </weight>
**/
free: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Force an index to an account. This doesn't require a deposit. If the index is already
* held, then any deposit is reimbursed to its current owner.
* The dispatch origin for this call must be _Root_.
* - `index`: the index to be (re-)assigned.
* - `new`: the new owner of the index. This function is a no-op if it is equal to sender.
* Emits `IndexAssigned` if successful.
* # <weight>
* - `O(1)`.
* - One storage mutation (codec `O(1)`).
* - Up to one reserve operation.
* - One event.
* # </weight>
**/
forceTransfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
balances: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
@@ -216,7 +277,7 @@ declare module '@polkadot/api/types/submittable' {
* check that the transfer will not kill the origin account.
* # </weight>
**/
transfer: AugmentedSubmittable<(dest: Address | string | AccountId | AccountIndex | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
transfer: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Set the balances of a given account.
* This will alter `FreeBalance` and `ReservedBalance` in storage. it will
@@ -229,19 +290,19 @@ declare module '@polkadot/api/types/submittable' {
* - Contains a limited number of reads and writes.
* # </weight>
**/
setBalance: AugmentedSubmittable<(who: Address | string | AccountId | AccountIndex | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
setBalance: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Exactly as `transfer`, except the origin must be root and the source account may be
* specified.
**/
forceTransfer: AugmentedSubmittable<(source: Address | string | AccountId | AccountIndex | Uint8Array, dest: Address | string | AccountId | AccountIndex | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Same as the [`transfer`] call, but with a check that the transfer will not kill the
* origin account.
* 99% of the time you want [`transfer`] instead.
* [`transfer`]: struct.Module.html#method.transfer
**/
transferKeepAlive: AugmentedSubmittable<(dest: Address | string | AccountId | AccountIndex | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
staking: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -258,7 +319,7 @@ declare module '@polkadot/api/types/submittable' {
* the `origin` falls below _existential deposit_ and gets removed as dust.
* # </weight>
**/
bond: AugmentedSubmittable<(controller: Address | string | AccountId | AccountIndex | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic<ApiType>>;
bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Add some extra amount that have appeared in the stash `free_balance` into the balance up
* for staking.
@@ -330,7 +391,7 @@ declare module '@polkadot/api/types/submittable' {
* - Both the reads and writes follow a similar pattern.
* # </weight>
**/
nominate: AugmentedSubmittable<(targets: Vec<Address> | (Address | string | AccountId | AccountIndex | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
nominate: AugmentedSubmittable<(targets: Vec<LookupSource> | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
/**
* Declare no desire to either validate or nominate.
* Effects will be felt at the beginning of the next era.
@@ -363,7 +424,7 @@ declare module '@polkadot/api/types/submittable' {
* - Writes are limited to the `origin` account key.
* # </weight>
**/
setController: AugmentedSubmittable<(controller: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
setController: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* The ideal number of validators.
**/
@@ -666,7 +727,7 @@ declare module '@polkadot/api/types/submittable' {
* Writes: O(1)
* # </weight>
**/
reportDefunctVoter: AugmentedSubmittable<(target: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
reportDefunctVoter: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Submit oneself for candidacy.
* A candidate will either:
@@ -705,7 +766,7 @@ declare module '@polkadot/api/types/submittable' {
* Writes: O(do_phragmen)
* # </weight>
**/
removeMember: AugmentedSubmittable<(who: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
removeMember: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
technicalMembership: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -763,7 +824,7 @@ declare module '@polkadot/api/types/submittable' {
* - One DB change, one extra DB entry.
* # </weight>
**/
proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Reject a proposed spend. The original deposit will be slashed.
* # <weight>
@@ -887,7 +948,7 @@ declare module '@polkadot/api/types/submittable' {
* * If no account exists and the call value is not less than `existential_deposit`,
* a regular account will be created and any value will be transferred.
**/
call: AugmentedSubmittable<(dest: Address | string | AccountId | AccountIndex | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
call: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance.
* Instantiation is executed as follows:
@@ -929,7 +990,7 @@ declare module '@polkadot/api/types/submittable' {
* - One DB change.
* # </weight>
**/
setKey: AugmentedSubmittable<(updated: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Authenticates the sudo key and dispatches a function call with `Signed` origin from
* a given account.
@@ -941,7 +1002,7 @@ declare module '@polkadot/api/types/submittable' {
* - Unknown weight of derivative `proposal` execution.
* # </weight>
**/
sudoAs: AugmentedSubmittable<(who: Address | string | AccountId | AccountIndex | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
imOnline: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -1094,7 +1155,7 @@ declare module '@polkadot/api/types/submittable' {
* - One event.
* # </weight>
**/
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: Address | string | AccountId | AccountIndex | Uint8Array, judgement: IdentityJudgement | { unknown: any } | { feePaid: any } | { reasonable: any } | { knownGood: any } | { outOfDate: any } | { lowQuality: any } | { erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { unknown: any } | { feePaid: any } | { reasonable: any } | { knownGood: any } | { outOfDate: any } | { lowQuality: any } | { erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Remove an account's identity and sub-account information and slash the deposits.
* Payment: Reserved balances from `set_subs` and `set_identity` are slashed and handled by
@@ -1111,7 +1172,7 @@ declare module '@polkadot/api/types/submittable' {
* - One event.
* # </weight>
**/
killIdentity: AugmentedSubmittable<(target: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
society: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -1237,7 +1298,7 @@ declare module '@polkadot/api/types/submittable' {
* Total Complexity: O(M + logM + C)
* # </weight>
**/
vote: AugmentedSubmittable<(candidate: Address | string | AccountId | AccountIndex | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
vote: AugmentedSubmittable<(candidate: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* As a member, vote on the defender.
* The dispatch origin for this call must be _Signed_ and a member.
@@ -1557,7 +1618,7 @@ declare module '@polkadot/api/types/submittable' {
* - One event.
* # </weight>
**/
vestOther: AugmentedSubmittable<(target: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
vestOther: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
}
}
+7 -1
View File
@@ -15,6 +15,8 @@ export interface AugmentedQueries<ApiType extends ApiTypes> { }
export type AugmentedQuery<ApiType extends ApiTypes, F extends AnyFunction> = MethodResult<ApiType, F> & StorageEntryBase<ApiType, F>
export type AugmentedQueryDoubleMap<ApiType extends ApiTypes, F extends AnyFunction, FirstKeyType = any> = MethodResult<ApiType, F> & StorageEntryDoubleMap<ApiType, F, FirstKeyType>
// This is the most generic typings we can have for a storage entry function
type GenericStorageEntryFunction = (arg1?: CodecArg, arg2?: CodecArg) => Observable<Codec>
@@ -26,7 +28,7 @@ export type QueryableStorageEntry<ApiType extends ApiTypes> =
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction> {
at: (hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, ObsInnerType<ReturnType<F>>>;
creator: StorageEntry;
entries: () => PromiseOrObs<ApiType, [StorageKey, ObsInnerType<ReturnType<F>>][]>;
entries: (arg?: any) => PromiseOrObs<ApiType, [StorageKey, ObsInnerType<ReturnType<F>>][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
key: (...args: Parameters<F>) => string;
keyPrefix: () => string;
@@ -34,6 +36,10 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
multi: ApiType extends 'rxjs' ? StorageEntryObservableMulti : StorageEntryPromiseMulti;
}
export interface StorageEntryDoubleMap<ApiType extends ApiTypes, F extends AnyFunction, FirstKeyType> extends StorageEntryBase<ApiType, F> {
entries: (arg?: FirstKeyType) => PromiseOrObs<ApiType, [StorageKey, ObsInnerType<ReturnType<F>>][]>;
}
interface StorageEntryObservableMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Observable<T[]>;
}
+1 -1
View File
@@ -11,7 +11,7 @@ export const logEvents = (done: () => {}): (r: SubmittableResult) => void =>
({ events, status }: SubmittableResult): void => {
console.log('Transaction status:', status.type);
if (status.isFinalized) {
if (status.isInBlock) {
console.log('Completed at block hash', status.value.toHex());
console.log('Events:');
+7 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.1.1",
"version": "1.2.1",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -26,12 +26,13 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/types": "^1.1.1",
"@polkadot/util": "^2.2.1",
"@polkadot/util-crypto": "^2.2.1"
"@babel/runtime": "^7.8.4",
"@polkadot/types": "^1.2.1",
"@polkadot/util": "^2.3.1",
"@polkadot/util-crypto": "^2.3.1",
"bn.js": "^5.1.1"
},
"devDependencies": {
"@polkadot/keyring": "^2.2.1"
"@polkadot/keyring": "^2.3.1"
}
}
@@ -15,10 +15,10 @@ describe('Decorated', () => {
it('should correctly get Alice\'s nonce storage key (u8a)', (): void => {
expect(
u8aToHex(
decorated.query.system.accountNonce('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
decorated.query.system.account('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
)
).toEqual(
'0x010126aa394eea5630e07c48ae0c9558cef79c2f82b23e5fd031fb54c292794b4cc42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
'0x010126aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da92e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
);
});
@@ -196,7 +196,7 @@ export default function createFunction (registry: Registry, itemFn: CreateItemFn
const [hasher, key2Hasher] = getHashers(itemFn);
// Can only have zero or one argument:
// - storage.balances.freeBalance(address)
// - storage.system.account(address)
// - storage.timestamp.blockPeriod()
// For doublemap queries the params is passed in as an tuple, [key1, key2]
const _storageFn = (arg?: CreateArgType | [CreateArgType?, CreateArgType?]): Uint8Array =>
@@ -28,11 +28,11 @@ describe('fromMetadata', (): void => {
it('should return the correct length-prefixed storage key', (): void => {
expect(
u8aToHex(
decorated.query.system.accountNonce(keyring.alice.address)
decorated.query.system.account(keyring.alice.address)
)
).toEqual(
// new storage key format
'0x010126aa394eea5630e07c48ae0c9558cef79c2f82b23e5fd031fb54c292794b4cc42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
'0x010126aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da92e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
);
});
});
@@ -23,7 +23,7 @@ export default function fromMetadata (registry: Registry, metadata: Metadata): S
const unwrapped = moduleMetadata.storage.unwrap();
const prefix = unwrapped.prefix.toString();
// For access, we change the index names, i.e. Balances.FreeBalance -> balances.freeBalance
// For access, we change the index names, i.e. System.Account -> system.account
result[section] = unwrapped.items.reduce((newModule, meta): ModuleStorage => {
const method = meta.name.toString();
@@ -0,0 +1,18 @@
// Copyright 2017-2020 @polkadot/metadata authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { TypeRegistry } from '@polkadot/types';
import substrateData from './static';
import Metadata from './Metadata';
describe('Metadata', (): void => {
it('allows creation from hex with JSON equivalence', (): void => {
const test = new Metadata(new TypeRegistry(), substrateData);
expect(
new Metadata(new TypeRegistry(), test.toHex()).toJSON()
).toEqual(test.toJSON());
});
});
+27 -27
View File
@@ -9,6 +9,32 @@ import { bnToU8a, isHex, hexToU8a, u8aConcat } from '@polkadot/util';
import { MAGIC_NUMBER } from './MagicNumber';
import MetadataVersioned from './MetadataVersioned';
// first we try and parse using the versioned structure, if this does fail,
// we adjust with the magic number and a manual version and re-try. As soon as
// we remove support for V0, we will just do a new here
function decodeMetadata (registry: Registry, _value: Uint8Array | string = new Uint8Array()): MetadataVersioned {
const value = isHex(_value)
? hexToU8a(_value)
: _value;
try {
return new MetadataVersioned(registry, value);
} catch (error) {
if (error.message.indexOf('MagicNumber mismatch') === -1) {
throw error;
}
}
return new MetadataVersioned(
registry,
u8aConcat(
bnToU8a(MAGIC_NUMBER), // manually add the magic number
Uint8Array.from([0]), // add the version for the original
value // the actual data as retrieved
)
);
}
/**
* @name Metadata
* @description
@@ -16,32 +42,6 @@ import MetadataVersioned from './MetadataVersioned';
*/
export default class Metadata extends MetadataVersioned {
constructor (registry: Registry, value?: Uint8Array | string) {
super(registry, Metadata.decodeMetadata(registry, value));
}
// first we try and parse using the versioned structure, if this does fail,
// we adjust with the magic number and a manual version and re-try. As soon as
// we remove support for V0, we will just do a new here
private static decodeMetadata (registry: Registry, _value: Uint8Array | string = new Uint8Array()): MetadataVersioned {
const value = isHex(_value)
? hexToU8a(_value)
: _value;
try {
return new MetadataVersioned(registry, value);
} catch (error) {
if (error.message.indexOf('MagicNumber mismatch') === -1) {
throw error;
}
}
return new MetadataVersioned(
registry,
u8aConcat(
bnToU8a(MAGIC_NUMBER), // manually add the magic number
Uint8Array.from([0]), // add the version for the original
value // the actual data as retrieved
)
);
super(registry, decodeMetadata(registry, value));
}
}
@@ -5,7 +5,7 @@
import { MetadataLatest } from '@polkadot/types/interfaces/metadata';
import { AnyJsonObject, Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toCallsOnly (registry: Registry, { extrinsic, modules }: MetadataLatest): AnyJsonObject | string {
@@ -776,7 +776,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -793,7 +793,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "free",
@@ -1118,7 +1118,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": []
@@ -1840,7 +1840,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -1893,7 +1893,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -1931,7 +1931,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2526,7 +2526,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2714,7 +2714,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -2796,7 +2796,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": []
@@ -473,7 +473,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -489,7 +489,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "free",
@@ -1002,7 +1002,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1091,7 +1091,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1829,7 +1829,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -1879,7 +1879,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -1915,7 +1915,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2491,7 +2491,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2783,7 +2783,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -2918,7 +2918,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": []
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV1, MetadataV2 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toV2 (registry: Registry, metadataV1: MetadataV1): MetadataV2 {
@@ -695,7 +695,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -735,7 +735,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -767,11 +767,11 @@
"args": [
{
"name": "source",
"type": "Address"
"type": "LookupSource"
},
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -788,7 +788,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1447,7 +1447,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1601,7 +1601,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1662,7 +1662,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4050,7 +4050,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4108,7 +4108,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4692,7 +4692,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -5582,7 +5582,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -6654,7 +6654,7 @@
},
{
"name": "target",
"type": "Address"
"type": "LookupSource"
},
{
"name": "judgement",
@@ -6688,7 +6688,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -1144,7 +1144,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1184,7 +1184,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -1216,11 +1216,11 @@
"args": [
{
"name": "source",
"type": "Address"
"type": "LookupSource"
},
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1237,7 +1237,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1795,7 +1795,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1932,7 +1932,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1993,7 +1993,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3974,7 +3974,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4032,7 +4032,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4669,7 +4669,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -5243,7 +5243,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -5614,7 +5614,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -5634,7 +5634,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "proposal",
@@ -6260,7 +6260,7 @@
},
{
"name": "target",
"type": "Address"
"type": "LookupSource"
},
{
"name": "judgement",
@@ -6294,7 +6294,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -6851,7 +6851,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "approve",
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV10, MetadataV11 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toV11 (registry: Registry, { modules }: MetadataV10): MetadataV11 {
@@ -4,11 +4,13 @@
import { TypeRegistry } from '@polkadot/types';
import polkadotJson from './static-polkadot.json';
import polkadotData from './static.polkadot';
import substrateJson from './static-substrate.json';
import substrateData from './static';
import { decodeLatestSubstrate, defaultValues, toLatest } from '../util/testUtil';
describe('MetadataV10 (substrate)', (): void => {
describe('MetadataV11 (substrate)', (): void => {
const registry = new TypeRegistry();
decodeLatestSubstrate(registry, 11, substrateData, substrateJson);
@@ -17,3 +19,13 @@ describe('MetadataV10 (substrate)', (): void => {
defaultValues(registry, substrateData);
});
describe('MetadataV11 (polkadot)', (): void => {
const registry = new TypeRegistry();
decodeLatestSubstrate(registry, 11, polkadotData, polkadotJson);
toLatest(registry, 11, polkadotData);
defaultValues(registry, polkadotData);
});
File diff suppressed because it is too large Load Diff
@@ -9,19 +9,19 @@
"prefix": "System",
"items": [
{
"name": "AccountNonce",
"name": "Account",
"modifier": "Default",
"type": {
"Map": {
"hasher": "Blake2_256",
"key": "AccountId",
"value": "Index",
"value": "(Index,AccountData)",
"linked": false
}
},
"fallback": "0x00000000",
"fallback": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"documentation": [
" Extrinsics nonce for accounts."
" The full account information for a particular account ID."
]
},
{
@@ -78,7 +78,7 @@
"modifier": "Default",
"type": {
"Map": {
"hasher": "Blake2_256",
"hasher": "Twox64Concat",
"key": "u32",
"value": "Bytes",
"linked": false
@@ -313,6 +313,24 @@
"documentation": [
" `:code` was updated."
]
},
{
"name": "NewAccount",
"args": [
"AccountId"
],
"documentation": [
" A new account was created."
]
},
{
"name": "ReapedAccount",
"args": [
"AccountId"
],
"documentation": [
" An account was reaped."
]
}
],
"constants": [],
@@ -1069,47 +1087,159 @@
"prefix": "Indices",
"items": [
{
"name": "NextEnumSet",
"modifier": "Default",
"type": {
"Plain": "AccountIndex"
},
"fallback": "0x00000000",
"documentation": [
" The next free enumeration set."
]
},
{
"name": "EnumSet",
"modifier": "Default",
"name": "Accounts",
"modifier": "Optional",
"type": {
"Map": {
"hasher": "Blake2_256",
"hasher": "Blake2_128Concat",
"key": "AccountIndex",
"value": "Vec<AccountId>",
"value": "(AccountId,BalanceOf)",
"linked": false
}
},
"fallback": "0x00",
"documentation": [
" The enumeration sets."
" The lookup from index to account."
]
}
]
},
"calls": [],
"calls": [
{
"name": "claim",
"args": [
{
"name": "index",
"type": "AccountIndex"
}
],
"documentation": [
" Assign an previously unassigned index.",
"",
" Payment: `Deposit` is reserved from the sender account.",
"",
" The dispatch origin for this call must be _Signed_.",
"",
" - `index`: the index to be claimed. This must not be in use.",
"",
" Emits `IndexAssigned` if successful.",
"",
" # <weight>",
" - `O(1)`.",
" - One storage mutation (codec `O(1)`).",
" - One reserve operation.",
" - One event.",
" # </weight>"
]
},
{
"name": "transfer",
"args": [
{
"name": "new",
"type": "AccountId"
},
{
"name": "index",
"type": "AccountIndex"
}
],
"documentation": [
" Assign an index already owned by the sender to another account. The balance reservation",
" is effectively transfered to the new account.",
"",
" The dispatch origin for this call must be _Signed_.",
"",
" - `index`: the index to be re-assigned. This must be owned by the sender.",
" - `new`: the new owner of the index. This function is a no-op if it is equal to sender.",
"",
" Emits `IndexAssigned` if successful.",
"",
" # <weight>",
" - `O(1)`.",
" - One storage mutation (codec `O(1)`).",
" - One transfer operation.",
" - One event.",
" # </weight>"
]
},
{
"name": "free",
"args": [
{
"name": "index",
"type": "AccountIndex"
}
],
"documentation": [
" Free up an index owned by the sender.",
"",
" Payment: Any previous deposit placed for the index is unreserved in the sender account.",
"",
" The dispatch origin for this call must be _Signed_ and the sender must own the index.",
"",
" - `index`: the index to be freed. This must be owned by the sender.",
"",
" Emits `IndexFreed` if successful.",
"",
" # <weight>",
" - `O(1)`.",
" - One storage mutation (codec `O(1)`).",
" - One reserve operation.",
" - One event.",
" # </weight>"
]
},
{
"name": "force_transfer",
"args": [
{
"name": "new",
"type": "AccountId"
},
{
"name": "index",
"type": "AccountIndex"
}
],
"documentation": [
" Force an index to an account. This doesn't require a deposit. If the index is already",
" held, then any deposit is reimbursed to its current owner.",
"",
" The dispatch origin for this call must be _Root_.",
"",
" - `index`: the index to be (re-)assigned.",
" - `new`: the new owner of the index. This function is a no-op if it is equal to sender.",
"",
" Emits `IndexAssigned` if successful.",
"",
" # <weight>",
" - `O(1)`.",
" - One storage mutation (codec `O(1)`).",
" - Up to one reserve operation.",
" - One event.",
" # </weight>"
]
}
],
"events": [
{
"name": "NewAccountIndex",
"name": "IndexAssigned",
"args": [
"AccountId",
"AccountIndex"
],
"documentation": [
" A new account index was assigned.",
"",
" This event is not triggered when an existing index is reassigned",
" to another `AccountId`."
" A account index was assigned."
]
},
{
"name": "IndexFreed",
"args": [
"AccountIndex"
],
"documentation": [
" A account index has been freed up (unassigned)."
]
}
],
@@ -1148,7 +1278,9 @@
" The balance of an account.",
"",
" NOTE: THIS MAY NEVER BE IN EXISTENCE AND YET HAVE A `total().is_zero()`. If the total",
" is ever zero, then the entry *MUST* be removed."
" is ever zero, then the entry *MUST* be removed.",
"",
" NOTE: This is only used in the case that this module is used to store balances."
]
},
{
@@ -1189,7 +1321,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1228,7 +1360,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -1260,11 +1392,11 @@
"args": [
{
"name": "source",
"type": "Address"
"type": "LookupSource"
},
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1281,7 +1413,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1300,23 +1432,24 @@
],
"events": [
{
"name": "NewAccount",
"name": "Endowed",
"args": [
"AccountId",
"Balance"
],
"documentation": [
" A new account was created."
" An account was created with some free balance."
]
},
{
"name": "ReapedAccount",
"name": "DustLost",
"args": [
"AccountId",
"Balance"
],
"documentation": [
" An account was reaped."
" An account was removed whose balance was non-zero but below ExistentialDeposit,",
" resulting in an outright loss."
]
},
{
@@ -1324,11 +1457,10 @@
"args": [
"AccountId",
"AccountId",
"Balance",
"Balance"
],
"documentation": [
" Transfer succeeded (from, to, value, fees)."
" Transfer succeeded (from, to, value)."
]
},
{
@@ -1361,14 +1493,6 @@
"documentation": [
" The minimum amount required to keep an account open."
]
},
{
"name": "CreationFee",
"type": "Balance",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee required to create an account."
]
}
],
"errors": [
@@ -1811,17 +1935,6 @@
"documentation": [
" The earliest era for which we have a pending, unapplied slash."
]
},
{
"name": "StorageVersion",
"modifier": "Default",
"type": {
"Plain": "u32"
},
"fallback": "0x00000000",
"documentation": [
" The version of storage for upgrade."
]
}
]
},
@@ -1831,7 +1944,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1968,7 +2081,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -2029,7 +2142,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2589,7 +2702,7 @@
" Get the vote in a given referendum of a particular voter. The result is meaningful only",
" if `voters_for` includes the voter when called with the referendum (you'll get the",
" default `Vote` value otherwise). If you don't want to check `voters_for`, then you can",
" also check for simple existence with `VoteOf::exists` first."
" also check for simple existence with `VoteOf::contains_key` first."
]
},
{
@@ -4058,7 +4171,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4116,7 +4229,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4753,7 +4866,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -5327,7 +5440,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -5564,14 +5677,6 @@
" to removal of a contract."
]
},
{
"name": "CreationFee",
"type": "BalanceOf",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee required to create an account."
]
},
{
"name": "TransactionBaseFee",
"type": "BalanceOf",
@@ -5726,7 +5831,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -5746,7 +5851,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "proposal",
@@ -6377,7 +6482,7 @@
},
{
"name": "target",
"type": "Address"
"type": "LookupSource"
},
{
"name": "judgement",
@@ -6411,7 +6516,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -6974,7 +7079,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "approve",
@@ -8077,7 +8182,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,7 +7,8 @@ import { FunctionMetadataV11, FunctionMetadataLatest, MetadataV11, MetadataLates
import { Registry } from '@polkadot/types/types';
import { getModuleTypes } from '@polkadot/types/known';
import { Type, createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
import { Type } from '@polkadot/types/primitive';
import { stringCamelCase } from '@polkadot/util';
// TODO Handle consts as well
@@ -503,7 +503,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -519,7 +519,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "free",
@@ -1029,7 +1029,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1120,7 +1120,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1163,7 +1163,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -1935,7 +1935,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -1985,7 +1985,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -2021,7 +2021,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2604,7 +2604,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2925,7 +2925,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -3060,7 +3060,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": []
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV2, MetadataV3 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toV3 (registry: Registry, metadataV2: MetadataV2): MetadataV3 {
@@ -548,7 +548,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -571,7 +571,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "free",
@@ -1088,7 +1088,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1179,7 +1179,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1222,7 +1222,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -1994,7 +1994,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -2044,7 +2044,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -2080,7 +2080,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2663,7 +2663,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3029,7 +3029,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -3171,7 +3171,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": []
@@ -597,7 +597,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -620,7 +620,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "free",
@@ -1146,7 +1146,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1241,7 +1241,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1284,7 +1284,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2230,7 +2230,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -2280,7 +2280,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -2316,7 +2316,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2748,7 +2748,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3179,7 +3179,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -3386,7 +3386,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -495,7 +495,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -533,7 +533,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "free",
@@ -981,7 +981,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1118,7 +1118,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1179,7 +1179,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2338,7 +2338,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -2414,7 +2414,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -2455,7 +2455,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2827,7 +2827,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3410,7 +3410,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3600,7 +3600,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -556,7 +556,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -594,7 +594,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -1042,7 +1042,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1179,7 +1179,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1240,7 +1240,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2290,7 +2290,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -2366,7 +2366,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -2407,7 +2407,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2875,7 +2875,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3324,7 +3324,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -3537,7 +3537,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV5, MetadataV6, ModuleMetadataV6 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toV6 (registry: Registry, { modules }: MetadataV5): MetadataV6 {
@@ -548,7 +548,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -586,7 +586,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -977,7 +977,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1114,7 +1114,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1175,7 +1175,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2793,7 +2793,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -2869,7 +2869,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -2910,7 +2910,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3268,7 +3268,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3851,7 +3851,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4042,7 +4042,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -594,7 +594,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -632,7 +632,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -1023,7 +1023,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1160,7 +1160,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1221,7 +1221,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -2871,7 +2871,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -2947,7 +2947,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -2988,7 +2988,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3352,7 +3352,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3624,7 +3624,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -3983,7 +3983,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV6, MetadataV7, ModuleMetadataV7 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toV7 (registry: Registry, { modules }: MetadataV6): MetadataV7 {
@@ -679,7 +679,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -717,7 +717,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -749,11 +749,11 @@
"args": [
{
"name": "source",
"type": "Address"
"type": "LookupSource"
},
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1165,7 +1165,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1302,7 +1302,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1363,7 +1363,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3344,7 +3344,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -3420,7 +3420,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -3462,7 +3462,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3818,7 +3818,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4568,7 +4568,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4762,7 +4762,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4782,7 +4782,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "proposal",
@@ -776,7 +776,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -814,7 +814,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -846,11 +846,11 @@
"args": [
{
"name": "source",
"type": "Address"
"type": "LookupSource"
},
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1205,7 +1205,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1342,7 +1342,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1403,7 +1403,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3055,7 +3055,7 @@
},
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "who_index",
@@ -3131,7 +3131,7 @@
"args": [
{
"name": "candidate",
"type": "Address"
"type": "LookupSource"
},
{
"name": "total",
@@ -3173,7 +3173,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3698,7 +3698,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3972,7 +3972,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -4305,7 +4305,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4325,7 +4325,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "proposal",
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV7, MetadataV8, ModuleMetadataV8 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toV8 (registry: Registry, { modules }: MetadataV7): MetadataV8 {
@@ -779,7 +779,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -819,7 +819,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -851,11 +851,11 @@
"args": [
{
"name": "source",
"type": "Address"
"type": "LookupSource"
},
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -872,7 +872,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1359,7 +1359,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1496,7 +1496,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1557,7 +1557,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3108,7 +3108,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3151,7 +3151,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3597,7 +3597,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3881,7 +3881,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -4215,7 +4215,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4235,7 +4235,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "proposal",
@@ -4583,7 +4583,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4607,7 +4607,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
},
{
"name": "name",
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV8, MetadataV9 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
/** @internal */
export default function toV9 (registry: Registry, { modules }: MetadataV8): MetadataV9 {
@@ -774,7 +774,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -814,7 +814,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "new_free",
@@ -846,11 +846,11 @@
"args": [
{
"name": "source",
"type": "Address"
"type": "LookupSource"
},
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -867,7 +867,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1354,7 +1354,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -1491,7 +1491,7 @@
"args": [
{
"name": "targets",
"type": "Vec<Address>"
"type": "Vec<LookupSource>"
}
],
"documentation": [
@@ -1552,7 +1552,7 @@
"args": [
{
"name": "controller",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3245,7 +3245,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3303,7 +3303,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -3780,7 +3780,7 @@
},
{
"name": "beneficiary",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4064,7 +4064,7 @@
"args": [
{
"name": "dest",
"type": "Address"
"type": "LookupSource"
},
{
"name": "value",
@@ -4398,7 +4398,7 @@
"args": [
{
"name": "new",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4418,7 +4418,7 @@
"args": [
{
"name": "who",
"type": "Address"
"type": "LookupSource"
},
{
"name": "proposal",
@@ -4766,7 +4766,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
}
],
"documentation": [
@@ -4790,7 +4790,7 @@
"args": [
{
"name": "target",
"type": "Address"
"type": "LookupSource"
},
{
"name": "name",
+1 -1
View File
@@ -5,7 +5,7 @@
import { MetadataV9, MetadataV10, ModuleMetadataV9, ModuleMetadataV10, StorageEntryMetadataV9, StorageEntryTypeV9, StorageHasherV9, StorageHasherV10 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types';
import { createType } from '@polkadot/types/codec';
// migrate a storage hasher type
// see https://github.com/paritytech/substrate/pull/4462
+11 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.1.1",
"version": "1.2.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -26,11 +26,16 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/jsonrpc": "^1.1.1",
"@polkadot/rpc-provider": "^1.1.1",
"@polkadot/types": "^1.1.1",
"@polkadot/util": "^2.2.1",
"@babel/runtime": "^7.8.4",
"@polkadot/jsonrpc": "^1.2.1",
"@polkadot/metadata": "^1.2.1",
"@polkadot/rpc-provider": "^1.2.1",
"@polkadot/types": "^1.2.1",
"@polkadot/util": "^2.3.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@polkadot/keyring": "^2.3.1"
}
}
@@ -93,8 +93,8 @@ function formattingTests (version: string, decorated: Metadata, encodedValues: [
it('returns the fallback result on not-found values', (done): void => {
api.state
.getStorage([decorated.query.system.accountNonce, ADDR_ONE])
.subscribe((value): void => {
.getStorage([decorated.query.system.account, ADDR_ONE])
.subscribe(([value]: any): void => {
expect(value.toHex()).toEqual('0x00000000');
done();
});
+2 -2
View File
@@ -267,10 +267,10 @@ export default class Rpc implements RpcInterface {
// Delete from cache
// Reason:
// ```
// const s = api.query.system.accountNonce(addr1).subscribe(); // let's say it's 6
// const s = api.query.system.account(addr1).subscribe(); // let's say it's 6
// s.unsubscribe();
// // wait a bit, for the nonce to increase to 7
// api.query.system.accountNonce(addr1).subscribe(); // will output 6 instead of 7 if we don't clear cache
// api.query.system.account(addr1).subscribe(); // will output 6 instead of 7 if we don't clear cache
// // that's because all our observables are replay(1)
// ```
// eslint-disable-next-line @typescript-eslint/no-use-before-define
+10 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.1.1",
"version": "1.2.1",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -26,17 +26,20 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/metadata": "^1.1.1",
"@polkadot/util": "^2.2.1",
"@polkadot/util-crypto": "^2.2.1",
"@babel/runtime": "^7.8.4",
"@polkadot/jsonrpc": "^1.2.1",
"@polkadot/metadata": "^1.2.1",
"@polkadot/types": "^1.2.1",
"@polkadot/util": "^2.3.1",
"@polkadot/util-crypto": "^2.3.1",
"bn.js": "^5.1.1",
"eventemitter3": "^4.0.0",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
"devDependencies": {
"@polkadot/keyring": "^2.2.1",
"@polkadot/keyring": "^2.3.1",
"mock-socket": "^9.0.3",
"nock": "^11.7.2"
"nock": "^11.8.2"
}
}
+1 -2
View File
@@ -176,8 +176,7 @@ export default class Mock implements ProviderInterface {
// increment the balances and nonce for each account
keyring.getPairs().forEach(({ publicKey }, index): void => {
// this.setStateBn(metadata.query.balances.freeBalance(publicKey), newHead.number.toBn().muln(3).iaddn(index));
this.setStateBn(metadata.query.system.accountNonce(publicKey), newHead.number.toBn().addn(index));
this.setStateBn(metadata.query.system.account(publicKey), newHead.number.toBn().addn(index));
});
// set the timestamp for the current block
+1 -1
View File
@@ -229,7 +229,7 @@ export default class WsProvider implements WSProviderInterface {
* const provider = new WsProvider('ws://127.0.0.1:9944');
* const rpc = new Rpc(provider);
*
* rpc.state.subscribeStorage([[storage.balances.freeBalance, <Address>]], (_, values) => {
* rpc.state.subscribeStorage([[storage.system.account, <Address>]], (_, values) => {
* console.log(values)
* }).then((subscriptionId) => {
* console.log('balance changes subscription id: ', subscriptionId)
+4 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "1.1.1",
"version": "1.2.1",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"publishConfig": {
@@ -26,6 +26,8 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-jsonrpc#readme",
"dependencies": {
"@babel/runtime": "^7.8.3"
"@babel/runtime": "^7.8.4",
"@polkadot/types": "^1.2.1",
"@polkadot/util": "^2.3.1"
}
}
+19
View File
@@ -7,6 +7,23 @@ import { RpcMethodOpt } from './types';
import createMethod from './create/method';
import createParam from './create/param';
const hasKey: RpcMethodOpt = {
description: 'Returns true if the keystore has private keys for the given public key and key type.',
params: [
createParam('publicKey', 'Bytes'),
createParam('keyType', 'Text')
],
type: 'bool'
};
const hasSessionKeys: RpcMethodOpt = {
description: 'Returns true if the keystore has private keys for the given session public keys.',
params: [
createParam('sessionKeys', 'Bytes')
],
type: 'bool'
};
const removeExtrinsic: RpcMethodOpt = {
description: 'Remove given extrinsic from the pool and temporarily ban it to prevent reimporting',
params: [
@@ -71,6 +88,8 @@ export default {
description: 'Authoring of network items',
section,
methods: {
hasKey: createMethod(section, 'hasKey', hasKey),
hasSessionKeys: createMethod(section, 'hasSessionKeys', hasSessionKeys),
insertKey: createMethod(section, 'insertKey', insertKey),
removeExtrinsic: createMethod(section, 'removeExtrinsic', removeExtrinsic),
rotateKeys: createMethod(section, 'rotateKeys', rotateKeys),

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