Compare commits

..
76 Commits
Author SHA1 Message Date
Github Actions dd6e6ddfc1 [CI Skip] 1.11.1
skip-checks: true
2020-04-21 07:47:25 +00:00
Jaco Greeff 9975f58cfb 1.11 (#2198)
* 1.11

* isOptional is custom RPC sample

* Names is one-liner for custom RPCs
2020-04-21 09:38:09 +02:00
Github Actions 536369261f [CI Skip] 1.11.0-beta.35
skip-checks: true
2020-04-21 07:10:16 +00:00
Jaco Greeff 33165e93dc Add state_getReadProof (#2196) 2020-04-21 09:00:03 +02:00
Github Actions 39a38a6c44 [CI Skip] 1.11.0-beta.34
skip-checks: true
2020-04-21 05:41:16 +00:00
Keith Ingram b18bdc37f9 Add api.derive.accounts.flags (#2195)
* account flags in new call

* Fix
2020-04-21 07:31:00 +02:00
Github Actions 79847aabf7 [CI Skip] 1.11.0-beta.33
skip-checks: true
2020-04-20 09:22:55 +00:00
Jaco Greeff ab75863d94 Fix derive.democracy.preimage signature (#2194) 2020-04-20 11:12:03 +02:00
Github Actions c908a27b7d [CI Skip] 1.11.0-beta.32
skip-checks: true
2020-04-18 07:31:19 +00:00
Jaco Greeff 98c7e5d5ea Optimize entries retrieval (#2193) 2020-04-18 09:21:06 +02:00
Github Actions fd4587a0bc [CI Skip] 1.11.0-beta.31
skip-checks: true
2020-04-17 13:41:21 +00:00
Jaco Greeff e211ae1667 Added types for DoubleVoteReport (parachains) (#2192) 2020-04-17 15:32:51 +02:00
Github Actions af735176fe [CI Skip] 1.11.0-beta.30
skip-checks: true
2020-04-17 10:34:48 +00:00
Jaco Greeff 9eb44d6e89 console warnings on the use of node-template (#2191)
* console warnings on the use of node-template

* Message formatting
2020-04-17 12:23:44 +02:00
Github Actions 379e841808 [CI Skip] 1.11.0-beta.29
skip-checks: true
2020-04-17 06:07:08 +00:00
Jaco Greeff 5c16b8e8a1 Adjust spec types (starting versions) (#2189) 2020-04-17 07:55:53 +02:00
Github Actions 96d7d9ff5a [CI Skip] 1.11.0-beta.28
skip-checks: true
2020-04-16 19:55:16 +00:00
Jaco Greeff e9fbbbbd42 Typos 2020-04-16 21:44:04 +02:00
Github Actions 73750ddb7d [CI Skip] 1.11.0-beta.27
skip-checks: true
2020-04-16 19:39:17 +00:00
Jaco Greeff 4e1145c66f FAQ entry for Weight adjustment (#2188)
* FAQ entry for Weight adjustment

* CHANGELOG entry for rxjs Observable exposure

* Event decoding
2020-04-16 21:29:22 +02:00
Github Actions 7f35fa22d5 [CI Skip] 1.11.0-beta.26
skip-checks: true
2020-04-16 17:14:23 +00:00
Jeremías Díaz da1daf5bd9 fix: ensure consistent Observable version (#2187) 2020-04-16 19:03:00 +02:00
Github Actions 5afc87ce47 [CI Skip] 1.11.0-beta.25
skip-checks: true
2020-04-16 16:21:36 +00:00
Jaco Greeff a2269cd999 Explain where args come from and their types (#2186)
* Explain where args come from and their types

* Update api.query.other.md
2020-04-16 18:11:12 +02:00
Github Actions 201308c259 [CI Skip] 1.11.0-beta.24
skip-checks: true
2020-04-16 14:32:15 +00:00
Jaco Greeff 00490116dd Add system_{localPeerId, localListenAddresses} RPCs (#2185)
* Add system_{localPeerId, localListenAddresses} RPCs

* CHANGELOG
2020-04-16 16:21:40 +02:00
Github Actions 1968c878f5 [CI Skip] 1.11.0-beta.23
skip-checks: true
2020-04-16 13:52:16 +00:00
Jaco Greeff 52ccb9fbbf Linkage fixes (#2184)
* Fix linkage decoding

* Actually fix linkage

* CHANGELOG
2020-04-16 15:41:42 +02:00
Github Actions 03e21ea64b [CI Skip] 1.11.0-beta.22
skip-checks: true
2020-04-16 13:39:19 +00:00
Jaco Greeff 8c949bb3df StorageKey toHuman returns decoded key (#2183) 2020-04-16 15:28:15 +02:00
Github Actions e484e7cf35 [CI Skip] 1.11.0-beta.21
skip-checks: true
2020-04-16 11:32:18 +00:00
Jaco Greeff 7aac4c7936 Add missing cookbook .keys 2020-04-16 13:21:04 +02:00
Github Actions 933c8d48e2 [CI Skip] 1.11.0-beta.20
skip-checks: true
2020-04-16 11:18:25 +00:00
Jaco Greeff d3d3bb9b5a Adjust Weight to u64 (#2181)
* Adjust Weight to u64

* Adjust copy (really should be reading folders...)

* build:interfaces

* EventRecord test expectation update
2020-04-16 13:08:46 +02:00
Github Actions f4d976c337 [CI Skip] 1.11.0-beta.19
skip-checks: true
2020-04-16 10:17:47 +00:00
Jaco Greeff 07c4037fcf On subscriptions, ensure rx.runtimeVersion is set (#2180) 2020-04-16 12:05:35 +02:00
Github Actions 52d73d8698 [CI Skip] 1.11.0-beta.18
skip-checks: true
2020-04-16 09:02:05 +00:00
Jeremías Díaz ccfab75f41 fix: use camelCase for storage module names (#2176) 2020-04-16 10:51:19 +02:00
Github Actions b8204b138d [CI Skip] 1.11.0-beta.17
skip-checks: true
2020-04-16 08:46:32 +00:00
Jaco Greeff a97cb6e25d Return all identity hashes (not just as subset) (#2179) 2020-04-16 10:36:37 +02:00
Github Actions 11534a1153 [CI Skip] 1.11.0-beta.16
skip-checks: true
2020-04-16 07:21:00 +00:00
Jaco Greeff dd1fab5366 Adjust set bitfileds to LE (#2178) 2020-04-16 09:09:17 +02:00
Github Actions dbb3a5ccc2 [CI Skip] 1.11.0-beta.15
skip-checks: true
2020-04-15 16:26:29 +00:00
Jaco Greeff fb08215e0d Add Fixed128 type (#2175) 2020-04-15 18:15:11 +02:00
Github Actions d7d7ab2f89 [CI Skip] 1.11.0-beta.14
skip-checks: true
2020-04-15 08:54:43 +00:00
Jaco Greeff 25393cd982 Add note on field ordering (#2173)
* Add note on field ordering

* Field ordering additional links
2020-04-15 10:43:15 +02:00
Github Actions d6a6089e2d [CI Skip] 1.11.0-beta.13
skip-checks: true
2020-04-15 06:55:53 +00:00
Jaco Greeff a3eaca0270 Small doc cleanups (#2172) 2020-04-15 08:44:15 +02:00
Github Actions f9d1b4d653 [CI Skip] 1.11.0-beta.12
skip-checks: true
2020-04-14 20:22:21 +00:00
Jaco Greeff f81712343a Transaction batching (#2171) 2020-04-14 22:10:25 +02:00
Github Actions 33e414be12 [CI Skip] 1.11.0-beta.11
skip-checks: true
2020-04-14 16:27:55 +00:00
Jaco Greeff 9387103558 cookbook link 2020-04-14 18:15:28 +02:00
Github Actions 3b7c1afa95 [CI Skip] 1.11.0-beta.10
skip-checks: true
2020-04-14 15:28:01 +00:00
Jaco Greeff 7e1fa8954b Extend storage cookbook (#2169)
* Extend storage cookbook

* Update storage.md

* Update storage.md
2020-04-14 17:16:46 +02:00
Github Actions 53c62f1542 [CI Skip] 1.11.0-beta.9
skip-checks: true
2020-04-14 14:56:23 +00:00
Jaco Greeff 5ed94a50e1 Update .123trigger 2020-04-14 16:45:30 +02:00
Github Actions b1c047149b [CI Skip] 1.11.0-beta.8
skip-checks: true
2020-04-14 14:35:37 +00:00
Jaco Greeff 7a0efaf58c Kusama 1057 known types (#2168) 2020-04-14 16:24:19 +02:00
Github Actions 5acce98346 [CI Skip] 1.11.0-beta.7
skip-checks: true
2020-04-14 11:52:00 +00:00
Jaco Greeff 165179ebf2 Remove flags on derive.accounts.info (#2167)
* Remove flags from derive.account.info

* adjust types
2020-04-14 13:40:12 +02:00
Github Actions def60dce9e [CI Skip] 1.11.0-beta.6
skip-checks: true
2020-04-14 10:49:12 +00:00
Jaco Greeff c8f91fcf7a Parameterize DoNotConstruct (#2165)
* Parameterize DoNotConstruct

* Update DoNotConstruct list

* typo fix
2020-04-14 12:37:30 +02:00
Github Actions 70a160cca0 [CI Skip] 1.11.0-beta.5
skip-checks: true
2020-04-14 10:31:23 +00:00
Jaco Greeff 9691fd5ba7 don't subscribe to runtime updates with no subs (#2166) 2020-04-14 12:20:07 +02:00
Jaco Greeff 475cb4fa69 Move Digest to interfaces (#2164)
* Move Digest to interfaces

* Unconstructable typos
2020-04-14 12:09:36 +02:00
Github Actions 5c54b3cc92 [CI Skip] 1.11.0-beta.4
skip-checks: true
2020-04-14 10:05:31 +00:00
Jaco Greeff 55d8c58d95 Add transactionVerions to RuntimeVersion struct (#2163) 2020-04-14 11:54:42 +02:00
Github Actions edf8adaa88 [CI Skip] 1.11.0-beta.3
skip-checks: true
2020-04-14 08:49:43 +00:00
Jaco Greeff 1f8f6e54bd Add unsigned sending to cookbook (#2162)
* Add unsigned sending to cookbook

* Block author extraction example
2020-04-14 10:36:15 +02:00
Github Actions f6ca7b9a9d [CI Skip] 1.11.0-beta.2
skip-checks: true
2020-04-14 07:52:33 +00:00
Jaco Greeff 7732339fc0 Line lengths 2020-04-14 09:41:04 +02:00
Jaco Greeff 5a8a8c7ecb Fix cookbook links 2020-04-14 09:34:39 +02:00
Github Actions 05df087e73 [CI Skip] 1.11.0-beta.1
skip-checks: true
2020-04-14 06:58:37 +00:00
Jaco Greeff 5b71abfe80 Make a start at a cookbook... still loads to go (#2160) 2020-04-14 08:48:14 +02:00
Github Actions 1d6c33060a [CI Skip] 1.11.0-beta.0
skip-checks: true
2020-04-13 10:45:21 +00:00
Jaco Greeff eae573e6a2 Simplify entries() decoding (#2159) 2020-04-13 12:33:24 +02:00
91 changed files with 1078 additions and 550 deletions
+2 -2
View File
@@ -1,3 +1,3 @@
21
1.4.2
22
1.4.2
1.6.2
+19
View File
@@ -1,3 +1,22 @@
# 1.11.1 Apr 21, 2020
- **Important** Substrate master has an updated `Weight` (to `u64`), on older chains apply `Weight: 'u32'` (This does affect event decoding if wrongly set)
- Allow user type augmentation to work with different versions of rxjs (Thanks to https://github.com/monitz87)
- Align augmented generation with camelCase (Thanks to https://github.com/monitz87)
- Fix bitfield endian encoding (Thanks to investigation by https://github.com/xlc)
- Add account flag derives via `accounts.flags(accountId)` (Thanks to https://github.com/kwingram25)
- Fix entries decoding for `Option<Number>` (& simplify, decoding correctly on rpc layer)
- Add `system.{localPeerId, localListenAddresses}` & `state.getReadProof` RPCs
- Ensure proper propagation of `api.runtimeVersion` (used for signing) after upgrade
- Field ordering fix for deprecated `Linkage` (used in linked maps)
- `derive.account.info` now returns all field enum types decoded (not only raw)
- Add banner with FAQ entries for node-template to aid with common issues
- `Digest` has been moved to definitions, removal of `GenericDigest` type
- Support `Fixed128` type
- Add `transactionVersion` to `RuntimeVersion` struct
- Enhance API support for non-subscription providers (skip subscription to runtimeVersion)
- Adjust types for Kusama 1057 (notably the new `StakingLedger`)
# 1.10.1 Apr 13, 2020
- **Important** Substrate master has updated staking, on older chains apply `StakingLedger: 'StakingLedgerTo240'`
+1
View File
@@ -19,4 +19,5 @@ copy_folder "metadata"
copy_folder "rpc-core"
copy_folder "rpc-provider"
copy_folder "types"
copy_folder "types-known"
copy_folder "typegen"
+11
View File
@@ -50,6 +50,17 @@ module.exports = {
['start/FAQ.md', 'FAQ']
]
},
{
title: 'Cookbook',
path: '/cookbook/',
collapsable: false,
sidebarDepth: 0,
children: [
['cookbook/blocks.md', 'Blocks'],
['cookbook/storage.md', 'Storage'],
['cookbook/tx.md', 'Transactions']
]
},
{
title: 'Examples (Promise API)',
path: '/examples/promise/',
+2 -9
View File
@@ -13,7 +13,7 @@ features:
- title: Types
details: Various type interfaces to make using returned values from API calls transparent in your code.
footer: Apache-2 Licensed | Copyright © 2017-2019 polkadot-js authors and contributors
footer: Apache-2 Licensed | Copyright © 2017-2020 polkadot-js authors and contributors
---
## Welcome
@@ -21,16 +21,9 @@ footer: Apache-2 Licensed | Copyright © 2017-2019 polkadot-js authors and contr
The API provides application developers the ability to query a node and interact with the Polkadot or Substrate chains using Javascript. Here you will find documentation and examples to get you started.
::: tip Getting started & Examples
[Jump right in](/start/) and get an overview on using the API in your projects, from installation all the way through to making it do magic. Already understand how things work and just want the examples? [The ApiPromise examples](/examples/promise/) provide some basic recipies.
[Jump right in](/start/) and get an overview on using the API in your projects, from installation all the way through to making it do magic. Have things working and want tips? The [cookbook](/cookbook/) provides some tips and tricks. Getting started and want some full examples? [The ApiPromise examples](/examples/promise/) provide some basic examples.
:::
## Available packages
This repository split up into a number of internal packages, namely -
- [api](api/README.md) Promise and RxJS-based APIs
- [types](types/README.md) Type encoding and decoding wrappers
## The Polkadot Project
You can read more about the Polkadot Network at [https://polkadot.network/](https://polkadot.network/) and more about the polkadot-js projects at [https://polkadot.js.org](https://polkadot.js.org)
+19
View File
@@ -0,0 +1,19 @@
# Cookbook
The cookbook hosts small code snippets in a question-answer format. It does not walk you through the whole setup, like the [basic examples](../examples/), but rather aims to answer some questions around specific uses. It also does not replace the [getting started FAQ](../start/FAQ.md), rather this is focussed explicitly on code samples, instead of general trouble-shooting for common mishaps.
These questions are added as they do come up and the hope is that the snippets here is will be useful to others, instead of just the original person who asked on a specific use-case. As of today, it is only making a start and not fully comprehensive yet - check back early, check back often.
## Sections
The following cookbook sections are available -
- [Blocks](blocks.md) - Snippets around working with blocks and headers
- [Storage](storage.md) - Snippets for working with storage
- [Transactions](tx.md) - Snippets for working with transactions
... more to come.
## Contribute
And as always, if you have an addition to make, or a question to ask any [any PRs](https://github.com/polkadot-js/api/tree/master/docs) or [issues](https://github.com/polkadot-js/api/issues) are appreciated. The initial content was generate from exactly such questions, either in Riot chat or as submitted as issues.
+44
View File
@@ -0,0 +1,44 @@
# Blocks
The building blocks for each blockchain. As such there are a number of examples for working with blocks and headers, that could be useful.
## How do I retrieve the header/extrinsic hash from blocks?
A block hash refers to the hash over the header, the extrinsic hash refers to the hash of the encoded extrinsic. Since all objects returned by the API implements the `.hash => Hash` getter, we can simply use this to view the actual hash.
```js
// returns Hash
const blockHash = await this.api.rpc.chain.getBlockHash(blockNumber);
// returns SignedBlock
const signedBlock = await this.api.rpc.chain.getBlock(blockHash);
// the hash for the block, always via header (Hash -> toHex()) - will be
// the same as blockHash above (also available on any header retrieved,
// subscription or once-off)
console.log(signedBlock.header.hash.toHex());
// the hash for each extrinsic in the block
signedBlock.block.extrinsics.forEach((ex, index) => {
console.log(index, ex.hash.toHex());
});
```
## How do I extract the block author?
Th block author is encoded inside the consensus logs for the block. To extract, you need to decode the log (which the API does do) and then map the index of the validator to the list of session validators. This extraction is however available on the api derive for new head subscriptions, which returns an extended header with the author populated (assuming that the digest logs are known).
```js
// subscribe to all new headers (with extended info)
api.derive.chain.subscribeNewHeads((header) => {
console.log(`#${header.number}: ${header.author}`);
});
```
For a single header only, the derives also contain a `getHeader`, which once again returns a header extended with the author -
```js
// retrieve the last header (hash optional)
const header = await api.derive.chain.getHeader();
console.log(`#${header.number}: ${header.author}`);
```
+55
View File
@@ -0,0 +1,55 @@
# Storage
Here you will find snippets for working with storage.
## How do I check for storage existence?
In the metadata, for each storage item a fallback is provided. This means that when an entry does not exist, the fallback (which is the default value for the type) will be provided. This means, that querying for a non-existent key (unless an option), will yield a value -
```js
// retrieve Option<StakingLedger>
const ledger = await api.query.staking.ledger('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
// retrieve ValidatorPrefs (will yield the default value)
const prefs = await api.query.staking.validators('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
console.log(ledger.isNone, ledger.isSome); // true, false
console.log(JSON.stringify(prefs.toHuman())); // {"commission":"0"}
```
In the second case, the non-existent prefs returns the default/fallback value for the storage item. So in this case we don't know if the value is set to 0 or unset. Existence can be checked by using the storage size, which would be zero if nothing is stored.
```js
// exists
const sizeY = await api.query.staking.validators.size('DB2mp5nNhbFN86J9hxoAog8JALMhDXgwvWMxrRMLNUFMEY4');
// non existent
const sizeN = await api.query.staking.validators.size('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
console.log(sizeY.isZero(), sizeY.toNumber()); // false 4
console.log(sizeN.isZero(), sizeY.toNumber()); // true 0
```
## How do I use .entries()/.keys() on double maps?
As [explained elsewhere](../start/api.query.other.md#map-keys-entries) each map-type storage entry exposes the entries/keys helpers to retrieve the whole list. In the case of double maps, with the addition of a single argument, you can retrieve either all entries or a subset based on the first map key.
In both these cases, entries/keys operate the same way, `.entries()` retrieving `(StorageKey, Codec)[]` and `.keys()` retrieving `StorageKey[]`
```js
// Retrieves the entries for all slashes, in all eras (no arg)
const allEntries = await api.query.staking.nominatorSlashInEra.entries();
// nominatorSlashInEra(EraIndex, AccountId) for the types of the key args
allEntries.forEach(([{ args: [era, nominatorId] }, value]) => {
console.log(`${era}: ${nominatorId} slashed ${value.toHuman()}`);
});
```
While we can retrieve only the keys for a specific era, using a argument for the first part of the doublemap (as defined here, an `EraIndex`) -
```js
// Retrieves the keys for the slashed validators in era 652
const slashedKeys = await api.query.staking.nominatorSlashInEra.keys(652);
// key args still contains [EraIndex, AccountId] decoded
console.log(`slashed: ${slashedKeys.map(({ args: [era, nominatorId] }) => nominatorId)`);
```
+112
View File
@@ -0,0 +1,112 @@
# Transactions
A blockchain is no fun if you are not submitting transactions. Or at least if somebody is not submitting any. Here you will find some snippets for dealing with some common issues.
## How do I estimate the transaction fees?
In addition to the `signAndSend` helper on transactions, `.paymentInfo` (with the exact same parameters) are also exposed. Using the same sender, it applies a dummy signature to the transaction and then gets the fee estimation via RPC.
```js
// estimate the fees as RuntimeDispatchInfo, using the signer (either
// address or locked/unlocked keypair) (When overrides are applied, e.g
// nonce, the format would be `paymentInfo(sender, { nonce })`)
const info = await api.tx.balances
.transfer(recipient, 123)
.paymentInfo(sender);
// log relevant info, partialFee is Balance, estimated for current
console.log(`
class=${class.toString()},
weight=${weight.toString()},
partialFee=${partialFee.toHuman()}
`);
```
## How do I get the decoded enum for an ExtrinsicFailed event?
Assuming you are sending a tx via `.signAndSend`, the callback yields information around the tx pool status as well as any events when `isInBlock` or `isFinalized`. If an extrinsic fails via `system.ExtrinsicFailed` event, you can retrieve the error, if defined as an enum on a module.
```js
api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, ({ status, events }) => {
if (status.isInBlock || status.isFinalized) {
events
// find/filter for failed events
.filter(({ section, method }) =>
section === 'system' &&
method === 'ExtrinsicFailed'
)
// we know that data for system.ExtrinsicFailed is
// (DispatchError, DispatchInfo)
.forEach(({ data: [error, info] }) => {
if (error.isModule) {
// for module errors, we have the section indexed, lookup
const decoded = api.registry.findMetaError(error.asModule);
const { documentation, method, section } = decoded;
console.log(`${section}.${method}: ${documentation.join(' ')}`);
} else {
// Other, CannotLookup, BadOrigin, no extra info
console.log(error.toString());
}
});
}
});
```
## How do I send an unsigned extrinsic?
For most runtime modules, transactions need to be signed and validation for this happens node-side. There are however modules that accepts unsigned extrinsics, an example would be the Polkadot/Kusama token claims (which is here used as an example).
```js
// construct the transaction, exactly as per normal
const utx = api.tx.claims.claim(beneficiary, ethSignature);
// send it without calling sign, pass callback with status/events
tx.send(({ status }) => {
if (status.isInBlock) {
console.log(`included in ${status.asInBlock}`);
}
});
```
The signing is indicated by the first byte in the transaction, so in this case we have called `.send` on it (no `.sign` or `.signAndSend`), so it will be sent using the unsigned state, without signature attached.
## How can I batch transactions?
Polkadot/Substrate provides a `utility.batch` method that can be used to send a number of transactions at once. These are then executed from a single sender (single nonce specified) in sequence. This is very useful in a number of cases, for instance if you wish to create a payout for a validator for multiple eras, you can use this method. Likewise, you can send a number of transfers at once. Or even batch different types of transactions.
```js
// construct a list of transactions we want to batch
const txs = [
api.tx.balances.transfer(addrBob, 12345),
api.tx.balances.transfer(addrEve, 12345),
api.tx.staking.unbond(12345)
];
// construct the batch and send the transactions
api.tx.utility
.batch(txs)
.signAndSend(sender, ({ status }) => {
if (status.isInBlock) {
console.log(`included in ${status.asInBlock}`);
}
});
```
## How do I take the pending tx pool into account in my nonce?
The `system.account` query will always contain the current state, i.e. it will reflect the nonce for the last known block. As such when sending multiple transactions in quick succession (see batching above), there may be transactions in the pool that has the same nonce that `signAndSend` would apply - this call doesn't do any magic, it simply reads the state for the nonce. Since we can specify options to the `signandSend` operation, we can override the nonce, either by manually incrementing it o querying it via `nextNonce`.
```js
for (let i = 0; i < 10; i++) {
// retrieve the nextNonce, taking txs in the pool into account
const nonce = await api.rpc.account.nextNonce(sender);
// send, just retrieving the hash, not waiting on status
const txhash = await api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, { nonce });
}
```
+6
View File
@@ -57,3 +57,9 @@ The API always injects the default type definitions as specified by the Substrat
The Substrate node-template has added customizations for some types in the default template, specifically around the `Address` and `Lookup` types, removing any lookups based on indices. This means that the transaction payload saves 2 bytes for a transfer and is an approach followed by other chains as well, notably Polkadot & Kusama.
Due to these customizations and differences that bleed through to the transaction formats, out-of-the-box chains based on the node-template will have issues when sending transactions. To fix this, you would need to add [the customized Address types into your API](types.extend.md#impact-on-extrinsics) instances (or UIs), allowing the API to have the information required to adjust the encoding.
## Using a non-current-master node, I have issues parsing events
Recently Substrate master updated the `Weight` type from `u32` -> `u64`. This type is used in the `DispatchInfo` struct in the `system.ExtrinsicSuccess` events, to return the applied call weights as well as the resulting fees. Since the API master branch tracks Substrate master, this means the change has been applied by default, with the default set to `u64`.
If you are on a chain that has not been upgraded yet, you need to add `Weight: 'u32'` to your types to allow for successful parsing of all events. Without this override, parsing will fail. As soon as one event in the `Vec<EventRecord>` structure from `system.events` fails to parse, all subsequent events are affected and the decoding will return an error.
+1 -1
View File
@@ -23,7 +23,7 @@ A couple of items to note in the example above: we don't call `account` directly
...
// Retrieve a snapshot of the validators
const validators = await api.query.session.validators();
const validatorKeys = await api.query.session.validators.keys();
// Subscribe to the balances for these accounts
const unsub = await api.query.balances.account.multi(validators, (balances) => {
+10 -5
View File
@@ -71,18 +71,23 @@ exposures.forEach(([key, exposure]) => {
});
```
Here we are querying a double-map, so we supply 1 argument. No arguments on double-maps will be very costly, retrieving all the eras and associated entries. Additionally when `twox64_concat` & `blake2_concat` is used, the key `.args` will contain decoded values of the params, in this case it will contain the actual `AccountId` of the staker. (Since that was not supplied)
To understand the usage of the `key.args`, you need to understand that map/doublemap keys are stored alongside their lookups. This means that the raw key has hashed parts as well as the raw data. The API will decode the keys and provide the raw key arguments in args. This would mean -
In the same way as above we can simply do `.keys(activeEra.index): StorageKey[]` to retrieve all the keys here, including the individual keys args (available on maps with decodable hashing functions) -
- if we are querying `api.query.staking.validators(validatorId: AccountId)` via `entries`, the `key.args` would be `[AccountId]`
- if we are querying `api.query.staking.erasStakers(era: EraIndex, validatorId: AccountId)` via `entries`, the `key.args` would be `[EraIndex, AccountId]`
the same applies to `.keys()` - here the list of keys also have the decoded args, as specified. You can think of `.args` as a tuple with the same types as the types required to retrieve a single entry in the map.
In the first example we are querying a double-map, so we supply 1 argument. No arguments on double-maps will be very costly, retrieving all the eras and associated entries. In the same way as above we can simply do `.keys(activeEra.index): StorageKey[]` to retrieve all the keys here, including the individual keys args (available on maps with decodable hashing functions) -
```js
// retrieve all the nominator keys
const keys = await api.query.staking.nominators.keys();
// extract the first key argument (AccountId) as string
const nominatorIds = keys.map((key) => key.args[0].toString());
// extract the first key argument [AccountId] as string
const nominatorIds = keys.map(({ args: [nominatorId] }) => nominatorId);
console.log('all nominators:', nminatorIds.join(', '));
console.log('all nominators:', nominatorIds.join(', '));
```
## State entries
+8 -1
View File
@@ -17,6 +17,11 @@ const api = await ApiPromise.create({
{
name: 'index',
type: 'u64'
},
{
name: 'at',
type: 'Hash',
isOptional: true
}
],
type: 'Balance'
@@ -26,7 +31,9 @@ const api = await ApiPromise.create({
});
```
In the above example we have defined a new method, which is now available on the RPCs as `api.rpc.firstModule.testMethod(u64) => Promise<Balance>`. Do be aware that while defined, the method will only appear if it is in the list as returned by `api.rpc.rpc.methods()`, which is the list of known RPCs the node exposes. When making changes to the node, always ensure that it does expose the RPC method correctly, otherwise it will not be decorated.
In the above example we have defined a new method, which is now available on the RPCs as `api.rpc.firstModule.testMethod(index: u64, at?: Hash) => Promise<Balance>`. In the case of optional params, we have added the `isOptional: true` flag alongside the `name` & `type` in the param definition.
Be aware that while defined, the method will only appear on the API if it is in the list as returned by `api.rpc.rpc.methods()`, which is the list of known RPCs the node exposes. When making changes to the node, always ensure that it does expose the RPC method correctly, otherwise it will not be decorated.
## Definition breakdown
+9
View File
@@ -26,6 +26,15 @@ const api = await ApiPromise.create({
The above introduces the `types` registry, effectively allowing overrides and the definition of new types. The override above would mean that immediately the API will treat all occurrences of `Balance` not as the default, but rather as the defined size.
## Field ordering
When defining any custom structures or types, it is critical that the following rules are applied -
- Map exactly to what is defined in the Rust code, i.e. defining a `SaleType` cannot be `u16` on the one end and `u32` on the other end. If mismatches occur, the serialization will fail.
- Ensure that the field order is maintained in all definitions. The SCALE serialization is binary and contains no field names in the serialization, only the encoded values. Any decoding is therefore done based on the size of the type and the order thereof in the definitions.
These rules apply everywhere. Always ensure that the types match exactly between the environments and that the ordering is maintained, be it for structs, tuples or enums.
## User-defined structs
Registration also applies to any type that can be found on a specific chain, i.e. we can add any types that is available on a specific node -
+1 -1
View File
@@ -4,7 +4,7 @@ In the previous section we looked at the TypeScript definitions that are availab
## Definitions
A large part of the type definitions are defined not as classes, but rather as structures from which type definitions are extracted and that can be used as-is to let the API know how to decode a type. By now you should be familiar with [type extensions](types.extend.md), but effectively the [types library does exactly the same](https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces).
A large part of the type definitions are defined not as classes, but rather as structures from which type definitions are extracted and that can be used as-is to let the API know how to decode a type. By now you should be familiar with [type extensions](types.extend.md) and the [rules around fields](types.extend.md#field-ordering), but effectively the [types library does exactly the same](https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces).
To create TypeScript-aware definitions and keep your files in a single place, you can follow the same approach. Assuming you have a package named `@MeInc/stuff` where you have the definitions in an `stuff/interfaces` folder. Each sub-folder would indicate a runtime module, e.g.
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.10.1"
"version": "1.11.1"
}
+1 -1
View File
@@ -27,7 +27,7 @@
"@babel/core": "^7.9.0",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@polkadot/dev": "^0.52.9",
"@polkadot/dev": "^0.52.11",
"@polkadot/ts": "^0.3.18",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^25.2.1",
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.10.1",
"version": "1.11.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/api": "1.10.1",
"@polkadot/rpc-core": "1.10.1",
"@polkadot/types": "1.10.1",
"@polkadot/api": "1.11.1",
"@polkadot/rpc-core": "1.11.1",
"@polkadot/types": "1.11.1",
"@polkadot/util": "^2.8.1",
"bn.js": "^5.1.1",
"rxjs": "^6.5.5"
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.10.1",
"version": "1.11.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -28,10 +28,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/api": "1.10.1",
"@polkadot/rpc-core": "1.10.1",
"@polkadot/rpc-provider": "1.10.1",
"@polkadot/types": "1.10.1",
"@polkadot/api": "1.11.1",
"@polkadot/rpc-core": "1.11.1",
"@polkadot/rpc-provider": "1.11.1",
"@polkadot/types": "1.11.1",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1",
+69
View File
@@ -0,0 +1,69 @@
// 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 { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveAccountFlags } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { Vec } from '@polkadot/types';
import { memo } from '../util';
type FlagsIntermediate = [
Vec<ITuple<[AccountId, Balance]>> | undefined,
AccountId[],
AccountId[],
AccountId[],
AccountId | undefined
];
function isIncludedFn (accountId: AccountId | Address | string): (_: AccountId | Address |string) => boolean {
return function (id: AccountId | Address | string): boolean {
return id.toString() === accountId.toString();
};
}
/**
* @name info
* @description Returns account membership flags
*/
export function flags (api: ApiInterfaceRx): (address?: AccountId | Address | string | null) => Observable<DeriveAccountFlags> {
return memo((address?: AccountId | Address | string | null): Observable<DeriveAccountFlags> => {
const councilSection = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections';
return (
combineLatest([
address && api.query[councilSection]?.members
? api.query[councilSection].members()
: of(undefined),
address && api.query.council.members
? api.query.council.members()
: of([]),
address && api.query.technicalCommittee?.members
? api.query.technicalCommittee.members()
: of([]),
address && api.query.society?.members
? api.query.society.members()
: of([]),
address && api.query.sudo?.key
? api.query.sudo.key()
: of(undefined)
]) as Observable<FlagsIntermediate>
).pipe(
map(([electionsMembers, councilMembers, technicalCommitteeMembers, societyMembers, sudoKey]): DeriveAccountFlags => {
const isIncluded = address ? isIncludedFn(address) : (): boolean => false;
return {
isCouncil: (electionsMembers?.map(([id]: ITuple<[AccountId, Balance]>) => id) || councilMembers || []).some(isIncluded),
isSociety: (societyMembers || []).some(isIncluded),
isSudo: sudoKey?.toString() === address?.toString(),
isTechCommittee: (technicalCommitteeMembers || []).some(isIncluded)
};
})
);
});
}
@@ -3,6 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import { AccountIdAndIndex } from '../types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
@@ -12,8 +13,6 @@ import { decodeAddress } from '@polkadot/util-crypto';
import { memo } from '../util';
export type AccountIdAndIndex = [AccountId?, AccountIndex?];
function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIndex | string | null | undefined): Observable<AccountIdAndIndex> {
try {
// yes, this can fail, don't care too much, catch will catch it
@@ -2,6 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
export * from './flags';
export * from './idAndIndex';
export * from './idToIndex';
export * from './indexToId';
+8 -48
View File
@@ -5,11 +5,11 @@
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, AccountIndex, Address, Balance, Registration } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveAccountFlags, DeriveAccountInfo, DeriveAccountRegistration } from '../types';
import { DeriveAccountInfo, DeriveAccountRegistration } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Bytes, Data, Option, u32, Vec } from '@polkadot/types';
import { Bytes, Data, Option, u32 } from '@polkadot/types';
import { u8aToString } from '@polkadot/util';
import { memo } from '../util';
@@ -17,15 +17,9 @@ import { memo } from '../util';
function dataAsString (data: Data): string | undefined {
return data.isRaw
? u8aToString(data.asRaw.toU8a(true))
: data.isSha256
? data.asSha256.toHex()
: undefined;
}
function includedWrapper (accountId?: AccountId): (_: AccountId) => boolean {
return function (id: AccountId): boolean {
return id.eq(accountId);
};
: data.isNone
? undefined
: data.toHex();
}
function retrieveNick (api: ApiInterfaceRx, accountId?: AccountId): Observable<string | undefined> {
@@ -115,39 +109,6 @@ function retrieveIdentity (api: ApiInterfaceRx, accountId?: AccountId): Observab
);
}
function retrieveFlags (api: ApiInterfaceRx, accountId?: AccountId): Observable<DeriveAccountFlags> {
const councilSection = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections';
return combineLatest([
api.query[councilSection]?.members
? api.query[councilSection].members<Vec<ITuple<[AccountId, Balance]>>>()
: of(undefined),
api.query.council?.members
? api.query.council.members()
: of([]),
api.query.technicalCommittee?.members
? api.query.technicalCommittee.members()
: of([]),
api.query.society?.members
? api.query.society.members()
: of([]),
api.query.sudo?.key
? api.query.sudo.key()
: of(undefined)
]).pipe(
map(([electionsMembers, councilMembers, technicalCommitteeMembers, societyMembers, sudoKey]): DeriveAccountFlags => {
const checkIncluded = includedWrapper(accountId);
return {
isCouncil: (electionsMembers?.map(([id]) => id) || councilMembers || []).some(checkIncluded),
isSociety: societyMembers.some(checkIncluded),
isSudo: !!sudoKey && sudoKey.eq(accountId),
isTechCommittee: technicalCommitteeMembers.some(checkIncluded)
};
})
);
}
/**
* @name info
* @description Returns aux. info with regards to an account, current that includes the accountId, accountIndex and nickname
@@ -155,16 +116,15 @@ function retrieveFlags (api: ApiInterfaceRx, accountId?: AccountId): Observable<
export function info (api: ApiInterfaceRx): (address?: AccountIndex | AccountId | Address | string | null) => Observable<DeriveAccountInfo> {
return memo((address?: AccountIndex | AccountId | Address | string | null): Observable<DeriveAccountInfo> =>
api.derive.accounts.idAndIndex(address).pipe(
switchMap(([accountId, accountIndex]): Observable<[Partial<DeriveAccountInfo>, DeriveAccountFlags, DeriveAccountRegistration, string?]> =>
switchMap(([accountId, accountIndex]): Observable<[Partial<DeriveAccountInfo>, DeriveAccountRegistration, string?]> =>
combineLatest([
of({ accountId, accountIndex }),
retrieveFlags(api, accountId),
retrieveIdentity(api, accountId),
retrieveNick(api, accountId)
])
),
map(([{ accountId, accountIndex }, flags, identity, nickname]): DeriveAccountInfo => ({
accountId, accountIndex, ...flags, identity, nickname
map(([{ accountId, accountIndex }, identity, nickname]): DeriveAccountInfo => ({
accountId, accountIndex, identity, nickname
}))
));
}
+38
View File
@@ -0,0 +1,38 @@
// 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 { AccountId, AccountIndex, RegistrationJudgement } from '@polkadot/types/interfaces';
export type AccountIdAndIndex = [AccountId?, AccountIndex?];
export type AccountIndexes = Record<string, AccountIndex>;
export interface DeriveAccountRegistration {
display?: string;
displayParent?: string;
email?: string;
image?: string;
legal?: string;
other?: Record<string, string>;
parent?: AccountId;
pgp?: string;
riot?: string;
twitter?: string;
web?: string;
judgements: RegistrationJudgement[];
}
export interface DeriveAccountFlags {
isCouncil: boolean;
isSociety: boolean;
isSudo: boolean;
isTechCommittee: boolean;
}
export interface DeriveAccountInfo {
accountId?: AccountId;
accountIndex?: AccountIndex;
identity: DeriveAccountRegistration;
nickname?: string;
}
@@ -17,8 +17,8 @@ import { parseImage } from './util';
type PreImage = Option<ITuple<[Bytes, AccountId, Balance, BlockNumber]>>;
export function preimage (api: ApiInterfaceRx): (hash: Hash) => Observable<DeriveProposalImage | undefined> {
return memo((hashes: Hash[]): Observable<DeriveProposalImage | undefined> =>
api.query.democracy.preimages<PreImage>(hashes).pipe(
return memo((hash: Hash): Observable<DeriveProposalImage | undefined> =>
api.query.democracy.preimages<PreImage>(hash).pipe(
map((imageOpt) => parseImage(api, imageOpt))
)
);
@@ -20,9 +20,7 @@ export function preimages (api: ApiInterfaceRx): (hashes: Hash[]) => Observable<
return memo((hashes: Hash[]): Observable<(DeriveProposalImage | undefined)[]> =>
api.query.democracy.preimages.multi<PreImage>(hashes).pipe(
map((images): (DeriveProposalImage | undefined)[] =>
images.map((imageOpt) =>
parseImage(api, imageOpt)
)
images.map((imageOpt) => parseImage(api, imageOpt))
)
)
);
@@ -26,7 +26,7 @@ export default class HeaderExtended extends _Header {
}
private _extractAuthor (sessionValidators: AccountId[] = []): AccountId | undefined {
const [pitem] = this.digest.logsWith('PreRuntime');
const [pitem] = this.digest.logs.filter(({ type }) => type === 'PreRuntime');
// extract from the substrate 2.0 PreRuntime digest
if (pitem) {
@@ -34,7 +34,7 @@ export default class HeaderExtended extends _Header {
return engine.extractAuthor(data, sessionValidators);
} else {
const [citem] = this.digest.logsWith('Consensus');
const [citem] = this.digest.logs.filter(({ type }) => type === 'Consensus');
// extract author from the consensus (substrate 1.0, digest)
if (citem) {
+2 -32
View File
@@ -2,48 +2,18 @@
// 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, Hash, Index, Proposal, ProposalIndex, RegistrationJudgement, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import { u32 } from '@polkadot/types';
export * from './accounts/types';
export * from './council/types';
export * from './democracy/types';
export * from './parachains/types';
export * from './session/types';
export * from './staking/types';
export type AccountIndexes = Record<string, AccountIndex>;
export interface DeriveAccountRegistration {
display?: string;
displayParent?: string;
email?: string;
image?: string;
legal?: string;
other?: Record<string, string>;
parent?: AccountId;
pgp?: string;
riot?: string;
twitter?: string;
web?: string;
judgements: RegistrationJudgement[];
}
export interface DeriveAccountFlags {
isCouncil: boolean;
isSociety: boolean;
isSudo: boolean;
isTechCommittee: boolean;
}
export interface DeriveAccountInfo extends DeriveAccountFlags {
accountId?: AccountId;
accountIndex?: AccountIndex;
identity: DeriveAccountRegistration;
nickname?: string;
}
export interface DeriveBalancesAccount {
accountId: AccountId;
accountNonce: Index;
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.10.1",
"version": "1.11.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -27,13 +27,13 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/api-derive": "1.10.1",
"@polkadot/api-derive": "1.11.1",
"@polkadot/keyring": "^2.8.1",
"@polkadot/metadata": "1.10.1",
"@polkadot/rpc-core": "1.10.1",
"@polkadot/rpc-provider": "1.10.1",
"@polkadot/types": "1.10.1",
"@polkadot/types-known": "1.10.1",
"@polkadot/metadata": "1.11.1",
"@polkadot/rpc-core": "1.11.1",
"@polkadot/rpc-provider": "1.11.1",
"@polkadot/types": "1.11.1",
"@polkadot/types-known": "1.11.1",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1",
+1 -2
View File
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
import { Option, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types/primitive';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
@@ -27,7 +27,6 @@ import { OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
import { Observable } from 'rxjs';
import { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/api/types/storage' {
+15 -4
View File
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import { AnyNumber, Codec, IExtrinsic } from '@polkadot/types/types';
import { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';
import { HashMap, Option, Vec } from '@polkadot/types/codec';
import { Bytes, Null, StorageKey, Text, bool, u32, u64 } from '@polkadot/types/primitive';
import { Metadata } from '@polkadot/types';
@@ -17,9 +17,8 @@ import { StorageKind } from '@polkadot/types/interfaces/offchain';
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, BlockNumber, H256, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
import { RuntimeVersion } from '@polkadot/types/interfaces/state';
import { ReadProof, RuntimeVersion } from '@polkadot/types/interfaces/state';
import { ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo } from '@polkadot/types/interfaces/system';
import { Observable } from 'rxjs';
declare module '@polkadot/rpc-core/types.jsonrpc' {
export interface RpcInterface {
@@ -197,9 +196,13 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
**/
getMetadata: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<Metadata>>;
/**
* Returns the keys with prefix, leave empty to get all the keys
* Returns the keys with prefix, leave empty to get all the keys (deprecated: Use getKeysPaged)
**/
getPairs: AugmentedRpc<(prefix: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<KeyValue>>>;
/**
* Returns proof of storage entries at a specific block state
**/
getReadProof: AugmentedRpc<(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: BlockHash | string | Uint8Array) => Observable<ReadProof>>;
/**
* Get the runtime version
**/
@@ -250,6 +253,14 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
* Return health status of the node
**/
health: AugmentedRpc<() => Observable<Health>>;
/**
* The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example
**/
localListenAddresses: AugmentedRpc<() => Observable<Vec<Text>>>;
/**
* Returns the base58-encoded PeerId of the node
**/
localPeerId: AugmentedRpc<() => Observable<Text>>;
/**
* Retrieves the node name
**/
+18 -29
View File
@@ -10,8 +10,8 @@ import { SubmittableExtrinsic } from '../submittable/types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecorateMethod, DecoratedRpc, DecoratedRpcSection, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import BN from 'bn.js';
import { BehaviorSubject, Observable, combineLatest, from, of } from 'rxjs';
import { concatMap, map, switchMap, take, tap, toArray } from 'rxjs/operators';
import { BehaviorSubject, Observable, combineLatest, of } from 'rxjs';
import { map, switchMap, take, tap, toArray } from 'rxjs/operators';
import decorateDerive, { ExactDerive } from '@polkadot/api-derive';
import { memo } from '@polkadot/api-derive/util';
import DecoratedMeta from '@polkadot/metadata/Decorated';
@@ -235,7 +235,7 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
const unknown = exposed.filter((key) => !allKeys.includes(key));
if (unknown.length) {
l.warn(`RPC methods not decorated: ${unknown.join(', ')}}`);
l.warn(`RPC methods not decorated: ${unknown.join(', ')}`);
}
// loop through all entries we have (populated in decorate) and filter as required
@@ -477,7 +477,7 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
? startSubject.pipe(
switchMap((startKey) =>
this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_KEYS, startKey).pipe(
map((keys) => keys.map((key) => key.decodeArgsFromMeta(meta)))
map((keys) => keys.map((key) => key.setMeta(meta)))
)
),
tap((keys): void => {
@@ -489,42 +489,31 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
map((keysArr: StorageKey[][]) => keysArr.reduce((result: StorageKey[], keys) => result.concat(keys), []))
)
: this._rpcCore.state.getKeys(headKey).pipe(
map((keys) => keys.map((key) => key.decodeArgsFromMeta(meta)))
map((keys) => keys.map((key) => key.setMeta(meta)))
);
}
private _retrieveMapEntries (entry: StorageEntry, arg?: Arg): Observable<[StorageKey, Codec][]> {
const outputType = unwrapStorageType(entry.meta.type, entry.meta.modifier.isOptional);
return this._retrieveMapKeys(entry, arg).pipe(
switchMap((keys): Observable<[StorageKey[], Option<Raw>[][]]> =>
combineLatest([
switchMap((keys) =>
combineLatest<[StorageKey[], ...Codec[][]]>([
of(keys),
from(Array(Math.ceil(keys.length / PAGE_SIZE_VALS)).fill(0)).pipe(
concatMap((_, index): Observable<Option<Raw>[]> => {
...Array(Math.ceil(keys.length / PAGE_SIZE_VALS))
.fill(0)
.map((_, index): Observable<Codec[]> => {
const keyset = keys.slice(index * PAGE_SIZE_VALS, (index * PAGE_SIZE_VALS) + PAGE_SIZE_VALS);
return this._rpcCore.state.queryStorageAt
? this._rpcCore.state.queryStorageAt<Option<Raw>[]>(keyset)
: this._rpcCore.state.subscribeStorage<Option<Raw>[]>(keyset).pipe(take(1));
}),
toArray()
)
? this._rpcCore.state.queryStorageAt<Codec[]>(keyset)
: this._rpcCore.state.subscribeStorage<Codec[]>(keyset).pipe(take(1));
})
])
),
map(([keys, valsArr]): [StorageKey, Codec][] => {
const vals = valsArr.reduce((result: Option<Raw>[], vals) => result.concat(vals), []);
return keys.map((key, index): [StorageKey, Codec] => [
key,
this.createType(
outputType,
vals[index].isSome
? vals[index].unwrap().toHex()
: undefined
)
]);
})
map(([keys, ...valsArr]): [StorageKey, Codec][] =>
valsArr
.reduce((result: Codec[], vals) => result.concat(vals), [])
.map((value, index) => [keys[index], value])
)
);
}
+2 -1
View File
@@ -119,7 +119,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
// subscribe to metadata updates, inject the types on changes
private _subscribeUpdates (): void {
if (this.#updateSub) {
if (this.#updateSub || !this.hasSubscriptions) {
return;
}
@@ -139,6 +139,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
this._runtimeMetadata = metadata;
this._runtimeVersion = version;
this._rx.runtimeVersion = version;
this.registerTypes(getSpecTypes(this.registry, this._runtimeChain as Text, version.specName, version.specVersion));
this.injectMetadata(metadata, false);
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.10.1",
"version": "1.11.1",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/types": "1.10.1",
"@polkadot/types-known": "1.10.1",
"@polkadot/types": "1.11.1",
"@polkadot/types-known": "1.11.1",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1"
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.10.1",
"version": "1.11.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/metadata": "1.10.1",
"@polkadot/rpc-provider": "1.10.1",
"@polkadot/types": "1.10.1",
"@polkadot/metadata": "1.11.1",
"@polkadot/rpc-provider": "1.11.1",
"@polkadot/types": "1.11.1",
"@polkadot/util": "^2.8.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.10.1",
"version": "1.11.1",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/metadata": "1.10.1",
"@polkadot/types": "1.10.1",
"@polkadot/metadata": "1.11.1",
"@polkadot/types": "1.11.1",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.10.1",
"version": "1.11.1",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
@@ -36,10 +36,10 @@
"@babel/core": "^7.9.0",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@polkadot/api": "1.10.1",
"@polkadot/metadata": "1.10.1",
"@polkadot/rpc-provider": "1.10.1",
"@polkadot/types": "1.10.1",
"@polkadot/api": "1.11.1",
"@polkadot/metadata": "1.11.1",
"@polkadot/rpc-provider": "1.11.1",
"@polkadot/types": "1.11.1",
"@polkadot/util": "^2.8.1",
"websocket": "^1.0.31",
"yargs": "^15.3.1"
+6 -7
View File
@@ -10,7 +10,7 @@ import Metadata from '@polkadot/metadata/Metadata';
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { TypeRegistry } from '@polkadot/types/create';
import { stringLowerFirst } from '@polkadot/util';
import { stringCamelCase } from '@polkadot/util';
import { FOOTER, HEADER, TypeImports, createDocComments, createImportCode, createImports, formatType, getSimilarTypes, indent, registerDefinitions, setImports, writeFile } from '../util';
@@ -67,7 +67,7 @@ function generateModule (allDefs: object, registry: Registry, { name, storage }:
return [];
}
return [indent(4)(`${stringLowerFirst(name.toString())}: {`)]
return [indent(4)(`${stringCamelCase(name.toString())}: {`)]
.concat(isStrict ? '' : indent(6)('[index: string]: QueryableStorageEntry<ApiType>;'))
.concat(storage.unwrap().items.sort((a, b) => a.name.localeCompare(b.name.toString())).map((storageEntry): string => {
const [args, returnType] = entrySignature(allDefs, registry, storageEntry, imports);
@@ -78,7 +78,7 @@ function generateModule (allDefs: object, registry: Registry, { name, storage }:
}
return createDocComments(6, storageEntry.documentation) +
indent(6)(`${stringLowerFirst(storageEntry.name.toString())}: ${entryType}<ApiType, (${args}) => Observable<${returnType}>>${isStrict ? '' : ' & QueryableStorageEntry<ApiType>'};`);
indent(6)(`${stringCamelCase(storageEntry.name.toString())}: ${entryType}<ApiType, (${args}) => Observable<${returnType}>>${isStrict ? '' : ' & QueryableStorageEntry<ApiType>'};`);
}))
.concat([indent(4)('};')]);
}
@@ -94,15 +94,14 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
const body = meta.asLatest.modules.sort((a, b) => a.name.localeCompare(b.name.toString())).reduce((acc: string[], mod): string[] => {
return acc.concat(generateModule(allDefs, registry, mod, imports, isStrict));
}, []);
imports.typesTypes.Observable = true;
const header = createImportCode(HEADER('chain'), imports, [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: 'rxjs',
types: ['Observable']
},
{
file: '@polkadot/api/types',
types: ['ApiTypes']
+3 -5
View File
@@ -63,15 +63,13 @@ export default function generateRpcTypes (dest = 'packages/api/src/augment/rpc.t
);
}, []).join('\n');
imports.typesTypes.Observable = true;
const header = createImportCode(HEADER('chain'), imports, [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: 'rxjs',
types: ['Observable']
}
}))
]);
const interfaceStart = "declare module '@polkadot/rpc-core/types.jsonrpc' {\n export interface RpcInterface {\n";
const interfaceEnd = '\n }\n}';
+2
View File
@@ -37,6 +37,7 @@ function tsExport (definitions: object, def: TypeDef, imports: TypeImports): str
const tsBTreeMap = tsExport;
const tsBTreeSet = tsExport;
const tsCompact = tsExport;
const tsDoNotConstruct = tsExport;
const tsHashMap = tsExport;
const tsOption = tsExport;
const tsPlain = tsExport;
@@ -156,6 +157,7 @@ function generateInterfaces (definitions: object, { types }: { types: Record<str
[TypeDefInfo.BTreeMap]: tsBTreeMap,
[TypeDefInfo.BTreeSet]: tsBTreeSet,
[TypeDefInfo.Compact]: tsCompact,
[TypeDefInfo.DoNotConstruct]: tsDoNotConstruct,
[TypeDefInfo.Enum]: tsEnum,
[TypeDefInfo.HashMap]: tsHashMap,
[TypeDefInfo.Int]: tsInt,
+14
View File
@@ -97,6 +97,14 @@ function formatCompact (inner: string): string {
return paramsNotation('Compact', inner);
}
/**
* Simple return
*/
/** @internal */
function formatDoNoConstruct (): string {
return 'DoNotConstruct';
}
/**
* Given the inner `K` & `V`, return a `BTreeMap<K, V>` string
*/
@@ -174,6 +182,12 @@ export function formatType (definitions: object, type: string | TypeDef, imports
return formatCompact(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
}
case TypeDefInfo.DoNotConstruct: {
setImports(definitions, imports, ['DoNotConstruct']);
return formatDoNoConstruct();
}
case TypeDefInfo.Option: {
setImports(definitions, imports, ['Option']);
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.10.1",
"version": "1.11.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,7 +27,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/types": "1.10.1",
"@polkadot/types": "1.11.1",
"@polkadot/util": "^2.8.1",
"bn.js": "^5.1.1"
},
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+10 -7
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -12,14 +12,15 @@ import typesChain from './chain';
import typesMeta from './metadata';
import typesModules from './modules';
import typesSpec from './spec';
import warnings from './warnings';
// flatten a VersionedType[] into a Record<string, string>
/** @internal */
function filterVersions (versions: OverrideVersionedType[] = [], version: number): RegistryTypes {
function filterVersions (versions: OverrideVersionedType[] = [], specVersion: number): RegistryTypes {
return versions
.filter(({ minmax: [min, max] }): boolean =>
(isUndefined(min) || version >= min) &&
(isUndefined(max) || version <= max)
.filter(({ minmax: [min, max] }) =>
(isUndefined(min) || specVersion >= min) &&
(isUndefined(max) || specVersion <= max)
)
.reduce((result: RegistryTypes, { types }): RegistryTypes => ({
...result,
@@ -30,8 +31,8 @@ function filterVersions (versions: OverrideVersionedType[] = [], version: number
/**
* @description Based on the metadata version, return the registry types
*/
export function getMetadataTypes (_registry: Registry, version: number): RegistryTypes {
return filterVersions(typesMeta, version);
export function getMetadataTypes (_registry: Registry, specVersion: number): RegistryTypes {
return filterVersions(typesMeta, specVersion);
}
/**
@@ -52,6 +53,8 @@ export function getSpecTypes ({ knownTypes }: Registry, chainName: Text | string
const _specName = specName.toString();
const _specVersion = bnToBn(specVersion).toNumber();
(warnings[_specName] || []).forEach((warning) => console.warn(`*** ${warning}`));
return {
...filterVersions(typesSpec[_specName], _specVersion),
...filterVersions(typesChain[_chainName], _specVersion),
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -11,7 +11,8 @@ const versioned: OverrideVersionedType[] = [
Address: 'AccountId',
LookupSource: 'AccountId',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240'
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
}
];
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+21 -7
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -17,7 +17,8 @@ const versioned: OverrideVersionedType[] = [
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230'
Votes: 'VotesTo230',
Weight: 'u32'
}
},
{
@@ -30,7 +31,8 @@ const versioned: OverrideVersionedType[] = [
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230'
Votes: 'VotesTo230',
Weight: 'u32'
}
},
{
@@ -43,7 +45,8 @@ const versioned: OverrideVersionedType[] = [
LookupSource: 'Address',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230'
Votes: 'VotesTo230',
Weight: 'u32'
}
},
{
@@ -55,16 +58,27 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240'
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
},
{
minmax: [1055, undefined],
minmax: [1055, 1056],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
StakingLedger: 'StakingLedgerTo240'
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
},
{
// actual upgrade at 1058
minmax: [1057, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
}
}
];
+25 -5
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -17,7 +17,8 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'Address',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230'
Votes: 'VotesTo230',
Weight: 'u32'
}
},
{
@@ -28,16 +29,35 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240'
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
},
{
minmax: [1005, undefined],
minmax: [1005, 1005],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
StakingLedger: 'StakingLedgerTo240'
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
},
{
minmax: [1006, 1006],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Weight: 'u32'
}
},
{
minmax: [1007, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
}
}
];
+11 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -6,7 +6,16 @@ import { OverrideVersionedType } from '@polkadot/types/types';
const versioned: OverrideVersionedType[] = [
{
minmax: [1, undefined],
minmax: [1, 2],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Weight: 'u32'
}
},
{
minmax: [3, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Type overrides for specific spec types & versions as given in runtimeVersion
const warnings: Record<string, string[]> = {
'node-template': [
'',
'You are using the node-template, depending on your config and age of the template, you may',
'have some unexpected results without applying the correct config for your node type:',
'',
'- If you have trouble sending txs, apply https://polkadot.js.org/api/start/FAQ.html#i-cannot-send-transactions-from-my-node-template-based-chain',
'- If you have trouble parsing events, apply https://polkadot.js.org/api/start/FAQ.html#using-a-non-current-master-node-i-have-issues-parsing-events',
''
]
};
export default warnings;
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.10.1",
"version": "1.11.1",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -27,7 +27,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/metadata": "1.10.1",
"@polkadot/metadata": "1.11.1",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"@types/bn.js": "^4.11.6",
+31 -7
View File
@@ -2,7 +2,7 @@
/* eslint-disable */
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
import { BitVec, Bytes, Data, Null, StorageKey, Text, Type, U256, Unconstructable, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
import { BitVec, Bytes, Data, DoNotConstruct, Null, StorageKey, Text, Type, U256, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
import { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
@@ -27,16 +27,16 @@ import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetwor
import { CallMetadataV0, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapTypeLatest, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataLatest, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import { StorageKind } from '@polkadot/types/interfaces/offchain';
import { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
import { AttestedCandidate, AuctionIndex, Bidder, CandidateReceipt, CollatorId, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SlotRange, SubId, UpwardMessage, ValidityAttestation, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { AttestedCandidate, AuctionIndex, Bidder, CandidateReceipt, CollatorId, CollatorSignature, DoubleVoteReport, DoubleVoteReportProof, DoubleVoteReportStatement, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SigningContext, SlotRange, Statement, SubId, UpwardMessage, ValidatorSignature, ValidityAttestation, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ApiId, KeyValueOption, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { AccountInfo, ChainProperties, ChainType, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
@@ -57,6 +57,9 @@ declare module '@polkadot/types/types/registry' {
Data: Data;
'Option<Data>': Option<Data>;
'Vec<Data>': Vec<Data>;
DoNotConstruct: DoNotConstruct;
'Option<DoNotConstruct>': Option<DoNotConstruct>;
'Vec<DoNotConstruct>': Vec<DoNotConstruct>;
i8: i8;
'Option<i8>': Option<i8>;
'Vec<i8>': Vec<i8>;
@@ -115,9 +118,6 @@ declare module '@polkadot/types/types/registry' {
'Compact<U256>': Compact<U256>;
'Option<U256>': Option<U256>;
'Vec<U256>': Vec<U256>;
Unconstructable: Unconstructable;
'Option<Unconstructable>': Option<Unconstructable>;
'Vec<Unconstructable>': Vec<Unconstructable>;
usize: usize;
'Compact<usize>': Compact<usize>;
'Option<usize>': Option<usize>;
@@ -182,6 +182,9 @@ declare module '@polkadot/types/types/registry' {
Fixed64: Fixed64;
'Option<Fixed64>': Option<Fixed64>;
'Vec<Fixed64>': Vec<Fixed64>;
Fixed128: Fixed128;
'Option<Fixed128>': Option<Fixed128>;
'Vec<Fixed128>': Vec<Fixed128>;
H160: H160;
'Option<H160>': Option<H160>;
'Vec<H160>': Vec<H160>;
@@ -1037,6 +1040,15 @@ declare module '@polkadot/types/types/registry' {
CollatorSignature: CollatorSignature;
'Option<CollatorSignature>': Option<CollatorSignature>;
'Vec<CollatorSignature>': Vec<CollatorSignature>;
DoubleVoteReport: DoubleVoteReport;
'Option<DoubleVoteReport>': Option<DoubleVoteReport>;
'Vec<DoubleVoteReport>': Vec<DoubleVoteReport>;
DoubleVoteReportProof: DoubleVoteReportProof;
'Option<DoubleVoteReportProof>': Option<DoubleVoteReportProof>;
'Vec<DoubleVoteReportProof>': Vec<DoubleVoteReportProof>;
DoubleVoteReportStatement: DoubleVoteReportStatement;
'Option<DoubleVoteReportStatement>': Option<DoubleVoteReportStatement>;
'Vec<DoubleVoteReportStatement>': Vec<DoubleVoteReportStatement>;
EgressQueueRoot: EgressQueueRoot;
'Option<EgressQueueRoot>': Option<EgressQueueRoot>;
'Vec<EgressQueueRoot>': Vec<EgressQueueRoot>;
@@ -1080,9 +1092,15 @@ declare module '@polkadot/types/types/registry' {
Retriable: Retriable;
'Option<Retriable>': Option<Retriable>;
'Vec<Retriable>': Vec<Retriable>;
SigningContext: SigningContext;
'Option<SigningContext>': Option<SigningContext>;
'Vec<SigningContext>': Vec<SigningContext>;
SlotRange: SlotRange;
'Option<SlotRange>': Option<SlotRange>;
'Vec<SlotRange>': Vec<SlotRange>;
Statement: Statement;
'Option<Statement>': Option<Statement>;
'Vec<Statement>': Vec<Statement>;
SubId: SubId;
'Compact<SubId>': Compact<SubId>;
'Option<SubId>': Option<SubId>;
@@ -1093,6 +1111,9 @@ declare module '@polkadot/types/types/registry' {
ValidityAttestation: ValidityAttestation;
'Option<ValidityAttestation>': Option<ValidityAttestation>;
'Vec<ValidityAttestation>': Vec<ValidityAttestation>;
ValidatorSignature: ValidatorSignature;
'Option<ValidatorSignature>': Option<ValidatorSignature>;
'Vec<ValidatorSignature>': Vec<ValidatorSignature>;
WinningDataEntry: WinningDataEntry;
'Option<WinningDataEntry>': Option<WinningDataEntry>;
'Vec<WinningDataEntry>': Vec<WinningDataEntry>;
@@ -1651,6 +1672,9 @@ declare module '@polkadot/types/types/registry' {
KeyValueOption: KeyValueOption;
'Option<KeyValueOption>': Option<KeyValueOption>;
'Vec<KeyValueOption>': Vec<KeyValueOption>;
ReadProof: ReadProof;
'Option<ReadProof>': Option<ReadProof>;
'Vec<ReadProof>': Vec<ReadProof>;
RuntimeVersionApi: RuntimeVersionApi;
'Option<RuntimeVersionApi>': Option<RuntimeVersionApi>;
'Vec<RuntimeVersionApi>': Vec<RuntimeVersionApi>;
+42
View File
@@ -0,0 +1,42 @@
// Copyright 2017-2020 @polkadot/types 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 '../create/registry';
import Linkage from './Linkage';
const registry = new TypeRegistry();
describe('Linkage', (): void => {
it('decodes with ValidatorPrefs', (): void => {
const LINKA = { next: '5GznmRvdi5htUJKnMSWJgJUzSJJXSvWuHRSEdyUbHJZDNcwU', previous: null };
const PREFS = { commission: '100,000,000' };
// prefs sanity check
expect(
registry.createType(
'ValidatorPrefs',
'0x0284d717'
).toHuman()
).toEqual(PREFS);
// linkage sanity checks
expect(
new Linkage(registry, 'AccountId', '0x0001da30b68f54f686f586ddb29de12b682dd8bd1404566fb8a8db5dec20aa5b6b36').toHuman()
).toEqual(LINKA);
expect(
registry.createType(
'Linkage<AccountId>' as any,
'0x0001da30b68f54f686f586ddb29de12b682dd8bd1404566fb8a8db5dec20aa5b6b36'
).toHuman()
).toEqual(LINKA);
// actual check
expect(
registry.createType(
'(ValidatorPrefs, Linkage<AccountId>)' as any,
'0x0284d7170001da30b68f54f686f586ddb29de12b682dd8bd1404566fb8a8db5dec20aa5b6b36'
).toHuman()
).toEqual([PREFS, LINKA]);
});
});
+2
View File
@@ -24,6 +24,8 @@ export default class Linkage<T extends Codec> extends Struct {
// eslint-disable-next-line sort-keys
next: Option.with(Type)
}, value);
console.error([...this.entries()]);
}
public static withKey<O extends Codec> (Type: Constructor | keyof InterfaceTypes): Constructor<Linkage<O>> {
+2 -2
View File
@@ -60,7 +60,7 @@ function decodeSet (setValues: SetValues, value: string[] | Set<string> | Uint8A
} else if (isU8a(value)) {
return value.length === 0
? []
: decodeSetNumber(setValues, u8aToBn(value.subarray(0, byteLength), { isLe: false }));
: decodeSetNumber(setValues, u8aToBn(value.subarray(0, byteLength), { isLe: true }));
} else if (value instanceof Set || Array.isArray(value)) {
const input = Array.isArray(value)
? value
@@ -230,7 +230,7 @@ export default class CodecSet extends Set<string> implements Codec {
public toU8a (isBare?: boolean): Uint8Array {
return bnToU8a(this.valueEncoded, {
bitLength: this.#byteLength * 8,
isLe: false
isLe: true
});
}
}
@@ -43,6 +43,10 @@ function encodeWithParams (typeDef: Pick<TypeDef, any>, outer = typeDef.displayN
}
}
function encodeDoNotConstruct ({ displayName }: TypeDef): string {
return `DoNotEncode<${displayName}>`;
}
function encodeSubTypes (sub: TypeDef[], asEnum?: boolean): string {
const inner = sub.reduce(
(result: Record<string, string>, type: TypeDef): Record<string, string> => {
@@ -122,6 +126,7 @@ const encoders: Record<TypeDefInfo, (typeDef: TypeDef) => string> = {
[TypeDefInfo.BTreeMap]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'BTreeMap'),
[TypeDefInfo.BTreeSet]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'BTreeSet'),
[TypeDefInfo.Compact]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'Compact'),
[TypeDefInfo.DoNotConstruct]: (typeDef: TypeDef): string => encodeDoNotConstruct(typeDef),
[TypeDefInfo.Enum]: (typeDef: TypeDef): string => encodeEnum(typeDef),
[TypeDefInfo.HashMap]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'HashMap'),
[TypeDefInfo.Int]: (typeDef: TypeDef): string => encodeUInt(typeDef, 'Int'),
@@ -33,6 +33,6 @@ describe('getTypeClass', (): void => {
getTypeClass(registry, typeDef);
expect(spy).toHaveBeenCalledWith('Unable to resolve type ABC, it will fail on constrution');
expect(spy).toHaveBeenCalledWith('Unable to resolve type ABC, it will fail on construction');
});
});
+6 -1
View File
@@ -23,6 +23,8 @@ import U8aFixed, { BitLength as U8aFixedBitLength } from '../codec/U8aFixed';
import UInt from '../codec/UInt';
import Vec from '../codec/Vec';
import VecFixed from '../codec/VecFixed';
import DoNotConstruct from '../primitive/DoNotConstruct';
import { getTypeDef } from './getTypeDef';
export function createClass<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K): Constructor<FromReg<T, K>> {
@@ -97,6 +99,8 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
[TypeDefInfo.Compact]: (registry: Registry, value: TypeDef): Constructor => Compact.with(getSubType(value)),
[TypeDefInfo.DoNotConstruct]: (registry: Registry, value: TypeDef): Constructor => DoNotConstruct.with(value.displayName),
[TypeDefInfo.Enum]: (registry: Registry, value: TypeDef): Constructor => Enum.with(getTypeClassMap(value)),
[TypeDefInfo.HashMap]: (registry: Registry, value: TypeDef): Constructor => createHashMap(value, HashMap),
@@ -106,7 +110,8 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
// We have circular deps between Linkage & Struct
[TypeDefInfo.Linkage]: (registry: Registry, value: TypeDef): Constructor => {
const type = `Option<${getSubType(value)}>`;
const Clazz = Struct.with({ next: type, previous: type } as any);
// eslint-disable-next-line sort-keys
const Clazz = Struct.with({ previous: type, next: type } as any);
ClassOf.prototype.toRawType = function (): string {
return `Linkage<${this.next.toRawType(true)}>`;
@@ -95,6 +95,14 @@ describe('createType', (): void => {
).toThrow('UInt<20>: Only support for UInt<bitLength>, where length <= 8192 and a power of 8');
});
it('fails on creation of DoNotConstruct', (): void => {
const Clazz = createClass(registry, 'DoNotConstruct<UnknownSomething>');
expect(
() => new Clazz(registry)
).toThrow('Cannot construct unknown type UnknownSomething');
});
it('allows creation of a [u8; 8]', (): void => {
expect(
createTypeUnsafe(registry, '[u8; 8]', [[0x12, 0x00, 0x23, 0x00, 0x45, 0x00, 0x67, 0x00]]).toHex()
+3 -3
View File
@@ -54,13 +54,13 @@ function initType<T extends Codec = Codec, K extends string = string> (registry:
}
// An unsafe version of the `createType` below. It's unsafe because the `type`
// argument here can be any string, which, if not parseable, will yield a
// argument here can be any string, which, when it cannot parse, will yield a
// runtime error.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function createTypeUnsafe<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K, params: any[] = [], isPedantic?: boolean): T {
try {
// Circle back to isPedenatic when it handles all cases 100% - as of now,
// it provides false wraning which is more hinderance than help
// Circle back to isPedantic when it handles all cases 100% - as of now,
// it provides false warning which is more hinderance than help
return initType(registry, createClass<T, K>(registry, type), params); // , isPedantic);
} catch (error) {
throw new Error(`createType(${type}):: ${error.message}`);
+11 -1
View File
@@ -119,6 +119,15 @@ function _decodeUInt (value: TypeDef, type: string, subType: string): TypeDef {
return _decodeInt(value, type, subType, 'UInt');
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function _decodeDoNotConstruct (value: TypeDef, type: string, _: string): TypeDef {
const NAME_LENGTH = 'DoNotConstruct'.length;
value.displayName = type.substr(NAME_LENGTH + 1, type.length - NAME_LENGTH - 1 - 1);
return value;
}
function hasWrapper (type: string, [start, end]: [string, string, TypeDefInfo, any?]): boolean {
if (type.substr(0, start.length) !== start) {
return false;
@@ -138,7 +147,8 @@ const nestedExtraction: [string, string, TypeDefInfo, (value: TypeDef, type: str
['HashMap<', '>', TypeDefInfo.HashMap, _decodeTuple],
['Int<', '>', TypeDefInfo.Int, _decodeInt],
['Result<', '>', TypeDefInfo.Result, _decodeTuple],
['UInt<', '>', TypeDefInfo.UInt, _decodeUInt]
['UInt<', '>', TypeDefInfo.UInt, _decodeUInt],
['DoNotConstruct<', '>', TypeDefInfo.DoNotConstruct, _decodeDoNotConstruct]
];
const wrappedExtraction: [string, string, TypeDefInfo][] = [
+2 -2
View File
@@ -7,9 +7,9 @@ import { Codec, Constructor } from '../types';
import { isChildClass } from '@polkadot/util';
import Struct from '../codec/Struct';
import DoNotConstruct from '../primitive/DoNotConstruct';
import Text from '../primitive/Text';
import U32 from '../primitive/U32';
import Unconstructable from '../primitive/Unconstructable';
import { TypeRegistry } from './registry';
describe('TypeRegistry', (): void => {
@@ -29,7 +29,7 @@ describe('TypeRegistry', (): void => {
expect(Type).toBeDefined();
// eslint-disable-next-line no-prototype-builtins
expect(isChildClass(Unconstructable, Type));
expect(isChildClass(DoNotConstruct, Type));
});
it('can register single type', (): void => {
+3 -3
View File
@@ -13,7 +13,7 @@ import { assert, formatBalance, isFunction, isString, isU8a, isUndefined, string
import Raw from '../codec/Raw';
import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../extrinsic/signedExtensions';
import { EventData } from '../generic/Event';
import Unconstructable from '../primitive/Unconstructable';
import DoNotConstruct from '../primitive/DoNotConstruct';
import { createClass, getTypeClass } from './createClass';
import { createType } from './createType';
import { getTypeDef } from './getTypeDef';
@@ -194,10 +194,10 @@ export class TypeRegistry implements Registry {
if (definition) {
BaseType = createClass(this, definition);
} else if (withUnknown) {
console.warn(`Unable to resolve type ${name}, it will fail on constrution`);
console.warn(`Unable to resolve type ${name}, it will fail on construction`);
this.#unknownTypes.set(name, true);
BaseType = Unconstructable.with(name);
BaseType = DoNotConstruct.with(name);
}
if (BaseType) {
+1 -1
View File
@@ -9,7 +9,7 @@ interface SanitizeOptions {
allowNamespaces?: boolean;
}
const ALLOWED_BOXES = ['BTreeMap', 'BTreeSet', 'Compact', 'HashMap', 'Int', 'Linkage', 'Result', 'Option', 'UInt', 'Vec'];
const ALLOWED_BOXES = ['BTreeMap', 'BTreeSet', 'Compact', 'DoNotConstruct', 'HashMap', 'Int', 'Linkage', 'Result', 'Option', 'UInt', 'Vec'];
const BOX_PRECEDING = ['<', '(', '[', '"', ',', ' ']; // start of vec, tuple, fixed array, part of struct def or in tuple
const mappings: Mapper[] = [
+1
View File
@@ -26,6 +26,7 @@ export enum TypeDefInfo {
HashMap,
Int,
UInt,
DoNotConstruct,
// anything not fully supported (keep this as the last entry)
Null
}
@@ -16,5 +16,9 @@ export default {
RestrictFunctionality: {
extra: {},
types: {}
},
ValidateDoubleVoteReports: {
extra: {},
types: {}
}
} as ExtDef;
-46
View File
@@ -1,46 +0,0 @@
// Copyright 2017-2020 @polkadot/types 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 '../create';
import json3 from '../json/Header.003.json';
import block1 from '../json/SignedBlock.003.00.json';
import Digest from './Digest';
describe('Digest', (): void => {
const registry = new TypeRegistry();
it('has the correct JSON representation', (): void => {
const digest = new Digest(registry, json3.result.digest);
expect(digest.toJSON()).toEqual(json3.result.digest);
});
it('decodes logs with consensus', (): void => {
const digest = new Digest(registry, json3.result.digest);
expect(digest.logs.length).toEqual(1);
const log = digest.logs[0];
expect(log.type).toBe('Consensus');
expect(log.value.toJSON()).toEqual([
1634891105,
'0x69c97e0f00000000479c09f7ace12ed3e1af2dba6cca6831e257e80feef56c7474d6c69bae6f4e8a6e0045a87afe14296992c38b7d55abcbe617c441cd35e8667abbcb1678f31802'
]);
});
it('filters logs, excluding items', (): void => {
const logs = new Digest(registry, block1.result.block.header.digest).logsWith('PreRuntime');
expect(logs.length).toEqual(1);
expect(logs[0].type).toEqual('PreRuntime');
});
it('filters logs, including items', (): void => {
const logs = new Digest(registry, block1.result.block.header.digest).logsWithout('PreRuntime');
expect(logs.length).toEqual(1);
expect(logs[0].type).toEqual('Seal');
});
});
-52
View File
@@ -1,52 +0,0 @@
// Copyright 2017-2020 @polkadot/types 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 { DigestItem } from '../interfaces/runtime';
import { AnyJson, Registry } from '../types';
import Struct from '../codec/Struct';
import Vec from '../codec/Vec';
/**
* @name Digest
* @description
* A [[Header]] Digest
*/
export default class Digest extends Struct {
constructor (registry: Registry, value: any) {
super(registry, {
logs: 'Vec<DigestItem>'
}, value);
}
/**
* @description The [[DigestItem]] logs
*/
public get logs (): Vec<DigestItem> {
return this.get('logs') as Vec<DigestItem>;
}
/**
* @description The [[DigestItem]] logs, filtered, filter items included. This is useful for derive functionality where only a certain type of log is to be returned.
*/
public logsWith (...include: string[]): Vec<DigestItem> {
return this.logs.filter(({ type }): boolean => include.includes(type)) as Vec<DigestItem>;
}
/**
* @description The [[DigestItem]] logs, filtered, filter items exluded. This is useful for stripping headers for eg. WASM runtime execution.
*/
public logsWithout (...exclude: string[]): Vec<DigestItem> {
return this.logs.filter(({ type }): boolean => !exclude.includes(type)) as Vec<DigestItem>;
}
/**
* @desrcript The JSON representation as it goes over RPC
*/
public toJSON (): AnyJson {
return {
logs: this.logs.map((log): string => log.toHex())
};
}
}
-16
View File
@@ -1,16 +0,0 @@
// Copyright 2017-2020 @polkadot/types 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 '../create';
import Origin from './Origin';
describe('Origin', (): void => {
const registry = new TypeRegistry();
it('does not allow construction', (): void => {
expect(
(): Origin => new Origin(registry)
).toThrow(/placeholder/);
});
});
-21
View File
@@ -1,21 +0,0 @@
// Copyright 2017-2020 @polkadot/types 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 { Registry } from '../types';
import Null from '../primitive/Null';
/**
* @name Origin
* @description
* Where Origin occurs, it should be ignored as an internal-only value, so it should
* never actually be constructed
*/
export default class Origin extends Null {
constructor (registry: Registry) {
super(registry);
throw new Error('Origin should not be constructed, it is only a placeholder for compatibility');
}
}
-2
View File
@@ -8,7 +8,5 @@ export { default as GenericAddress } from './Address';
export { default as GenericBlock } from './Block';
export { default as GenericCall } from './Call';
export { default as GenericConsensusEngineId } from './ConsensusEngineId';
export { default as GenericDigest } from './Digest';
export { default as GenericEvent } from './Event';
export { default as GenericOrigin } from './Origin';
export { default as GenericVote } from './Vote';
+2 -2
View File
@@ -17,8 +17,8 @@ import * as definitions from './interfaces/definitions';
const UNCONSTRUCTABLE = [
'ExtrinsicPayloadUnknown', 'GenericExtrinsicPayloadUnknown',
'ExtrinsicUnknown', 'GenericExtrinsicUnknown',
'GenericOrigin', 'Origin',
'Unconstructable',
'DoNotConstruct',
'Origin',
'usize'
].map((v): string => v.toLowerCase());
@@ -22,12 +22,12 @@ describe('IdentityFields', (): void => {
it('encodes to a valid u8a value', (): void => {
expect(
registry.createType('IdentityFields', ['Display', 'Legal']).toU8a()
).toEqual(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 3]));
).toEqual(new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0]));
});
it('decodes from a u8a', (): void => {
expect(
registry.createType('IdentityFields', new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1 + 2 + 64])).toHuman()
registry.createType('IdentityFields', new Uint8Array([1 + 2 + 64, 0, 0, 0, 0, 0, 0, 0])).toHuman()
).toEqual(['Display', 'Legal', 'Image']);
});
});
@@ -35,6 +35,19 @@ export default {
},
CollatorId: 'H256',
CollatorSignature: 'Signature',
DoubleVoteReport: {
identity: 'ValidatorId',
first: 'DoubleVoteReportStatement',
second: 'DoubleVoteReportStatement',
proof: 'DoubleVoteReportProof',
signingContext: 'SigningContext'
},
// session::historical::Proof
DoubleVoteReportProof: {
session: 'SessionIndex',
trieNodes: 'Vec<Bytes>'
},
DoubleVoteReportStatement: '(Statement, ValidatorSignature)',
EgressQueueRoot: '(ParaId, Hash)',
HeadData: 'Bytes',
IncomingParachainDeploy: {
@@ -75,6 +88,10 @@ export default {
WithRetries: 'u32'
}
},
SigningContext: {
sessionIndex: 'SessionIndex',
parentHash: 'Hash'
},
SlotRange: {
_enum: [
'ZeroZero', // 0
@@ -89,6 +106,15 @@ export default {
'ThreeThree' // 9
]
},
Statement: {
_enum: {
// This Null is not in the original, however indexes start at 1
Never: 'Null',
Candidate: 'Hash',
Valid: 'Hash',
Invalid: 'Hash'
}
},
SubId: 'u32',
UpwardMessage: {
origin: 'ParachainDispatchOrigin',
@@ -96,13 +122,13 @@ export default {
},
ValidityAttestation: {
_enum: {
// This Null is not in the original, however indexes start at 1, so add a
// placeholder in the first position (which is basically non-valid)
None: 'Null',
Implicit: 'CollatorSignature', // 1
Explicit: 'CollatorSignature' // 2
// This Null is not in the original, however indexes start at 1
Never: 'Null',
Implicit: 'ValidatorSignature', // 1
Explicit: 'ValidatorSignature' // 2
}
},
ValidatorSignature: 'Signature',
WinningDataEntry: '(AccountId, ParaIdOf, BalanceOf)',
WinningData: '[WinningDataEntry; 10]'
}
@@ -5,7 +5,8 @@ import { ITuple } from '@polkadot/types/types';
import { Enum, Struct, Vec } from '@polkadot/types/codec';
import { BitVec, Bytes, u32 } from '@polkadot/types/primitive';
import { Signature } from '@polkadot/types/interfaces/extrinsics';
import { AccountId, Balance, BalanceOf, BlockNumber, H256, Hash } from '@polkadot/types/interfaces/runtime';
import { AccountId, Balance, BalanceOf, BlockNumber, H256, Hash, ValidatorId } from '@polkadot/types/interfaces/runtime';
import { SessionIndex } from '@polkadot/types/interfaces/session';
/** @name AttestedCandidate */
export interface AttestedCandidate extends Struct {
@@ -44,6 +45,24 @@ export interface CollatorId extends H256 {}
/** @name CollatorSignature */
export interface CollatorSignature extends Signature {}
/** @name DoubleVoteReport */
export interface DoubleVoteReport extends Struct {
readonly identity: ValidatorId;
readonly first: DoubleVoteReportStatement;
readonly second: DoubleVoteReportStatement;
readonly proof: DoubleVoteReportProof;
readonly signingContext: SigningContext;
}
/** @name DoubleVoteReportProof */
export interface DoubleVoteReportProof extends Struct {
readonly session: SessionIndex;
readonly trieNodes: Vec<Bytes>;
}
/** @name DoubleVoteReportStatement */
export interface DoubleVoteReportStatement extends ITuple<[Statement, ValidatorSignature]> {}
/** @name EgressQueueRoot */
export interface EgressQueueRoot extends ITuple<[ParaId, Hash]> {}
@@ -114,6 +133,12 @@ export interface Retriable extends Enum {
readonly asWithRetries: u32;
}
/** @name SigningContext */
export interface SigningContext extends Struct {
readonly sessionIndex: SessionIndex;
readonly parentHash: Hash;
}
/** @name SlotRange */
export interface SlotRange extends Enum {
readonly isZeroZero: boolean;
@@ -128,6 +153,17 @@ export interface SlotRange extends Enum {
readonly isThreeThree: boolean;
}
/** @name Statement */
export interface Statement extends Enum {
readonly isNever: boolean;
readonly isCandidate: boolean;
readonly asCandidate: Hash;
readonly isValid: boolean;
readonly asValid: Hash;
readonly isInvalid: boolean;
readonly asInvalid: Hash;
}
/** @name SubId */
export interface SubId extends u32 {}
@@ -137,13 +173,16 @@ export interface UpwardMessage extends Struct {
readonly data: Bytes;
}
/** @name ValidatorSignature */
export interface ValidatorSignature extends Signature {}
/** @name ValidityAttestation */
export interface ValidityAttestation extends Enum {
readonly isNone: boolean;
readonly isNever: boolean;
readonly isImplicit: boolean;
readonly asImplicit: CollatorSignature;
readonly asImplicit: ValidatorSignature;
readonly isExplicit: boolean;
readonly asExplicit: CollatorSignature;
readonly asExplicit: ValidatorSignature;
}
/** @name WinningData */
@@ -0,0 +1,30 @@
// Copyright 2017-2020 @polkadot/types 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 '../../create';
import json3 from '../../json/Header.003.json';
describe('Digest', (): void => {
const registry = new TypeRegistry();
it('has the correct JSON representation', (): void => {
const digest = registry.createType('Digest', json3.result.digest);
expect(digest.logs.map((l) => l.toHex())).toEqual(json3.result.digest.logs);
});
it('decodes logs with consensus', (): void => {
const digest = registry.createType('Digest', json3.result.digest);
expect(digest.logs.length).toEqual(1);
const log = digest.logs[0];
expect(log.type).toBe('Consensus');
expect(log.value.toJSON()).toEqual([
1634891105,
'0x69c97e0f00000000479c09f7ace12ed3e1af2dba6cca6831e257e80feef56c7474d6c69bae6f4e8a6e0045a87afe14296992c38b7d55abcbe617c441cd35e8667abbcb1678f31802'
]);
});
});
@@ -25,7 +25,9 @@ export default {
digestLevels: 'u32'
},
ConsensusEngineId: 'GenericConsensusEngineId',
Digest: 'GenericDigest',
Digest: {
logs: 'Vec<DigestItem>'
},
DigestItem: {
_enum: {
Other: 'Bytes', // 0
@@ -50,6 +52,7 @@ export default {
class: 'DispatchClass'
},
Fixed64: 'Int<64, Fixed64>',
Fixed128: 'Int<128, Fixed128>',
H160: '[u8; 20; H160]',
H256: '[u8; 32; H256]',
H512: '[u8; 64; H512]',
@@ -69,7 +72,7 @@ export default {
LookupSource: 'Address',
LookupTarget: 'AccountId',
Moment: 'u64',
Origin: 'GenericOrigin',
Origin: 'DoNotConstruct<Origin>',
Perbill: 'u32',
Percent: 'u8',
Permill: 'u32',
@@ -82,7 +85,7 @@ export default {
},
StorageData: 'Bytes',
ValidatorId: 'AccountId',
Weight: 'u32',
Weight: 'u64',
WeightMultiplier: 'Fixed64',
// digest
+10 -5
View File
@@ -3,8 +3,8 @@
import { ITuple } from '@polkadot/types/types';
import { Compact, Enum, Int, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId, GenericDigest, GenericOrigin } from '@polkadot/types/generic';
import { Bytes, Null, StorageKey, bool, u128, u32, u64, u8 } from '@polkadot/types/primitive';
import { GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId } from '@polkadot/types/generic';
import { Bytes, DoNotConstruct, Null, StorageKey, bool, u128, u32, u64, u8 } from '@polkadot/types/primitive';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { Signature } from '@polkadot/types/interfaces/extrinsics';
@@ -51,7 +51,9 @@ export interface Consensus extends ITuple<[ConsensusEngineId, Bytes]> {}
export interface ConsensusEngineId extends GenericConsensusEngineId {}
/** @name Digest */
export interface Digest extends GenericDigest {}
export interface Digest extends Struct {
readonly logs: Vec<DigestItem>;
}
/** @name DigestItem */
export interface DigestItem extends Enum {
@@ -91,6 +93,9 @@ export interface DispatchInfoTo190 extends Struct {
readonly class: DispatchClass;
}
/** @name Fixed128 */
export interface Fixed128 extends Int {}
/** @name Fixed64 */
export interface Fixed64 extends Int {}
@@ -140,7 +145,7 @@ export interface LookupTarget extends AccountId {}
export interface Moment extends u64 {}
/** @name Origin */
export interface Origin extends GenericOrigin {}
export interface Origin extends DoNotConstruct {}
/** @name Perbill */
export interface Perbill extends u32 {}
@@ -182,7 +187,7 @@ export interface StorageData extends Bytes {}
export interface ValidatorId extends AccountId {}
/** @name Weight */
export interface Weight extends u32 {}
export interface Weight extends u64 {}
/** @name WeightMultiplier */
export interface WeightMultiplier extends Fixed64 {}
@@ -45,7 +45,7 @@ export default {
type: 'Vec<StorageKey>'
},
getPairs: {
description: 'Returns the keys with prefix, leave empty to get all the keys',
description: 'Returns the keys with prefix, leave empty to get all the keys (deprecated: Use getKeysPaged)',
params: [
{
name: 'prefix',
@@ -297,6 +297,21 @@ export default {
],
type: 'Vec<StorageChangeSet>'
},
getReadProof: {
description: 'Returns proof of storage entries at a specific block state',
params: [
{
name: 'keys',
type: 'Vec<StorageKey>'
},
{
name: 'at',
type: 'BlockHash',
isOptional: true
}
],
type: 'ReadProof'
},
subscribeRuntimeVersion: {
alias: ['chain_subscribeRuntimeVersion', 'chain_unsubscribeRuntimeVersion'],
description: 'Retrieves the runtime version via subscription',
@@ -327,6 +342,10 @@ export default {
types: {
ApiId: '[u8; 8]',
KeyValueOption: '(StorageKey, Option<StorageData>)',
ReadProof: {
at: 'Hash',
proof: 'Vec<Bytes>'
},
RuntimeVersionApi: '(ApiId, u32)',
RuntimeVersion: {
specName: 'Text',
@@ -334,7 +353,8 @@ export default {
authoringVersion: 'u32',
specVersion: 'u32',
implVersion: 'u32',
apis: 'Vec<RuntimeVersionApi>'
apis: 'Vec<RuntimeVersionApi>',
transactionVersion: 'u32'
},
StorageChangeSet: {
block: 'Hash',
+8 -1
View File
@@ -3,7 +3,7 @@
import { ITuple } from '@polkadot/types/types';
import { Option, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { StorageKey, Text, u32 } from '@polkadot/types/primitive';
import { Bytes, StorageKey, Text, u32 } from '@polkadot/types/primitive';
import { Hash, StorageData } from '@polkadot/types/interfaces/runtime';
/** @name ApiId */
@@ -12,6 +12,12 @@ export interface ApiId extends U8aFixed {}
/** @name KeyValueOption */
export interface KeyValueOption extends ITuple<[StorageKey, Option<StorageData>]> {}
/** @name ReadProof */
export interface ReadProof extends Struct {
readonly at: Hash;
readonly proof: Vec<Bytes>;
}
/** @name RuntimeVersion */
export interface RuntimeVersion extends Struct {
readonly specName: Text;
@@ -20,6 +26,7 @@ export interface RuntimeVersion extends Struct {
readonly specVersion: u32;
readonly implVersion: u32;
readonly apis: Vec<RuntimeVersionApi>;
readonly transactionVersion: u32;
}
/** @name RuntimeVersionApi */
@@ -46,8 +46,8 @@ describe('EventRecord', (): void => {
const er = records[0];
expect(er.phase.type).toEqual('ApplyExtrinsic');
// additional payment info
expect(records.toHex()).toEqual(`${hex}000000000000`);
// additional payment info, weight u64 (vs u32)
expect(records.toHex()).toEqual(hex + '000000000000' + '00000000');
});
});
});
@@ -39,6 +39,16 @@ export default {
params: [],
type: 'Health'
},
localPeerId: {
description: 'Returns the base58-encoded PeerId of the node',
params: [],
type: 'Text'
},
localListenAddresses: {
description: 'The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example',
params: [],
type: 'Vec<Text>'
},
peers: {
description: 'Returns the currently connected peers',
params: [],
@@ -7,19 +7,19 @@ import { Constructor, Registry } from '../types';
import Null from './Null';
/**
* @name Unconstructable
* @name DoNotConstruct
* @description
* An unknown type theat fails on constrction with the type info
* An unknown type that fails on construction with the type info
*/
export default class Unconstructable extends Null {
export default class DoNotConstruct extends Null {
constructor (registry: Registry, typeName: string) {
super(registry);
throw new Error(`Cannot construct unknown type ${typeName}`);
}
public static with (typeName: string): Constructor {
return class extends Unconstructable {
public static with (typeName = 'DoNotConstruct'): Constructor {
return class extends DoNotConstruct {
constructor (registry: Registry) {
super(registry, typeName);
}
@@ -240,9 +240,7 @@ describe('StorageKey', (): void => {
key.setMeta(metadata.query.staking.erasStakers.meta);
expect(
key.args.map((arg) => arg.toHuman())
).toEqual([
expect(key.toHuman()).toEqual([
'16',
'5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY'
]);
@@ -253,9 +251,7 @@ describe('StorageKey', (): void => {
key.setMeta(metadata.query.society.defenderVotes.meta);
expect(
key.args.map((arg) => arg.toHuman())
).toEqual([
expect(key.toHuman()).toEqual([
'5D4yQHKfqCQYThhHmTfN1JEDi47uyDJc1xg9eZfAG1R7FC7J'
]);
});
+25 -13
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { StorageEntryMetadataLatest, StorageEntryTypeLatest, StorageHasher } from '../interfaces/metadata';
import { AnyU8a, Codec, InterfaceTypes, Registry } from '../types';
import { AnyJson, AnyU8a, Codec, InterfaceTypes, Registry } from '../types';
import { assert, isFunction, isString, isU8a } from '@polkadot/util';
@@ -158,9 +158,9 @@ export default class StorageKey extends Bytes {
private _meta?: StorageEntryMetadataLatest;
private readonly _method?: string;
private _outputType: string;
private readonly _outputType: string;
private readonly _method?: string;
private readonly _section?: string;
@@ -169,13 +169,12 @@ export default class StorageKey extends Bytes {
super(registry, key);
this._meta = StorageKey.getMeta(value as StorageKey);
this._method = override.method || method;
this._outputType = StorageKey.getType(value as StorageKey);
this._section = override.section || section;
this._outputType = StorageKey.getType(value as StorageKey);
// decode the args (as applicable based on the key and the hashers, after all init)
this.decodeArgsFromMeta();
this.setMeta(StorageKey.getMeta(value as StorageKey));
}
public static getMeta (value: StorageKey | StorageEntry | [StorageEntry, any]): StorageEntryMetadataLatest | undefined {
@@ -250,19 +249,32 @@ export default class StorageKey extends Bytes {
public setMeta (meta?: StorageEntryMetadataLatest): this {
this._meta = meta;
return this.decodeArgsFromMeta();
}
if (meta) {
this._outputType = unwrapStorageType(meta.type);
}
/**
* @description Decode the args embedded in the key (assuming we have decodable hashers)
*/
public decodeArgsFromMeta (meta?: StorageEntryMetadataLatest): this {
try {
this._args = decodeArgsFromMeta(this.registry, this.toU8a(true), meta || this.meta);
this._args = decodeArgsFromMeta(this.registry, this.toU8a(true), this.meta);
} catch (error) {
// ignore...
}
return this;
}
/**
* @description Returns the Human representation for this type
*/
public toHuman (): AnyJson {
return this._args.length
? this._args.map((arg) => arg.toHuman())
: super.toHuman();
}
/**
* @description Returns the raw type for this
*/
public toRawType (): string {
return 'StorageKey';
}
}
+1 -1
View File
@@ -12,6 +12,7 @@ export { default as BitVec } from './BitVec';
export { default as bool } from './Bool';
export { default as Bytes } from './Bytes';
export { default as Data } from './Data';
export { default as DoNotConstruct } from './DoNotConstruct';
export { default as i8 } from './I8';
export { default as i16 } from './I16';
export { default as i32 } from './I32';
@@ -28,5 +29,4 @@ export { default as u32 } from './U32';
export { default as u64 } from './U64';
export { default as u128 } from './U128';
export { default as u256, default as U256 } from './U256';
export { default as Unconstructable } from './Unconstructable';
export { default as usize } from './USize';
+2
View File
@@ -13,3 +13,5 @@ export * from './extrinsic';
export * from './helpers';
export * from './interfaces';
export * from './registry';
export type { Observable } from 'rxjs';
+140 -120
View File
@@ -2607,25 +2607,25 @@ __metadata:
resolution: "@polkadot/api-contract@workspace:packages/api-contract"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api": 1.10.1
"@polkadot/rpc-core": 1.10.1
"@polkadot/types": 1.10.1
"@polkadot/api": 1.11.1
"@polkadot/rpc-core": 1.11.1
"@polkadot/types": 1.11.1
"@polkadot/util": ^2.8.1
bn.js: ^5.1.1
rxjs: ^6.5.5
languageName: unknown
linkType: soft
"@polkadot/api-derive@1.10.1, @polkadot/api-derive@workspace:packages/api-derive":
"@polkadot/api-derive@1.11.1, @polkadot/api-derive@workspace:packages/api-derive":
version: 0.0.0-use.local
resolution: "@polkadot/api-derive@workspace:packages/api-derive"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api": 1.10.1
"@polkadot/api": 1.11.1
"@polkadot/keyring": ^2.8.1
"@polkadot/rpc-core": 1.10.1
"@polkadot/rpc-provider": 1.10.1
"@polkadot/types": 1.10.1
"@polkadot/rpc-core": 1.11.1
"@polkadot/rpc-provider": 1.11.1
"@polkadot/types": 1.11.1
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
@@ -2634,18 +2634,18 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/api@1.10.1, @polkadot/api@workspace:packages/api":
"@polkadot/api@1.11.1, @polkadot/api@workspace:packages/api":
version: 0.0.0-use.local
resolution: "@polkadot/api@workspace:packages/api"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api-derive": 1.10.1
"@polkadot/api-derive": 1.11.1
"@polkadot/keyring": ^2.8.1
"@polkadot/metadata": 1.10.1
"@polkadot/rpc-core": 1.10.1
"@polkadot/rpc-provider": 1.10.1
"@polkadot/types": 1.10.1
"@polkadot/types-known": 1.10.1
"@polkadot/metadata": 1.11.1
"@polkadot/rpc-core": 1.11.1
"@polkadot/rpc-provider": 1.11.1
"@polkadot/types": 1.11.1
"@polkadot/types-known": 1.11.1
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
@@ -2654,9 +2654,9 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/dev@npm:^0.52.9":
version: 0.52.9
resolution: "@polkadot/dev@npm:0.52.9"
"@polkadot/dev@npm:^0.52.11":
version: 0.52.11
resolution: "@polkadot/dev@npm:0.52.11"
dependencies:
"@babel/cli": ^7.8.4
"@babel/core": ^7.9.0
@@ -2678,8 +2678,8 @@ __metadata:
"@babel/preset-typescript": ^7.9.0
"@babel/register": ^7.9.0
"@babel/runtime": ^7.9.2
"@typescript-eslint/eslint-plugin": 2.27.0
"@typescript-eslint/parser": 2.27.0
"@typescript-eslint/eslint-plugin": 2.28.0
"@typescript-eslint/parser": 2.28.0
"@vue/component-compiler-utils": ^3.1.2
babel-core: ^7.0.0-bridge.0
babel-jest: ^25.3.0
@@ -2697,7 +2697,7 @@ __metadata:
eslint-plugin-promise: ^4.2.1
eslint-plugin-react: ^7.19.0
eslint-plugin-react-hooks: ^3.0.0
eslint-plugin-sort-destructure-keys: ^1.3.3
eslint-plugin-sort-destructure-keys: ^1.3.4
eslint-plugin-standard: ^4.0.1
fs-extra: ^9.0.0
gh-pages: ^2.2.0
@@ -2714,7 +2714,7 @@ __metadata:
typedoc-plugin-markdown: ^2.2.17
typedoc-plugin-no-inherit: ^1.1.10
typescript: ^3.8.3
vuepress: ^1.4.0
vuepress: ^1.4.1
webpack: ^4.42.1
webpack-cli: ^3.3.11
yargs: ^15.3.1
@@ -2737,7 +2737,7 @@ __metadata:
polkadot-exec-typedoc: scripts/polkadot-exec-typedoc.js
polkadot-exec-vuepress: scripts/polkadot-exec-vuepress.js
polkadot-exec-webpack: scripts/polkadot-exec-webpack.js
checksum: 2/62815caa0239449f8dd2c61b37713cb0d1563d22a1b089020fcf240c17786dd94aa797d44f864f93848c497a8359e3b7045711572adc7eaf0da6e604f6ecc442
checksum: 2/7fdcbb750b365029aba087bb9cc37b3cb612cf4797f0c0bffab0a8ad21cbc50d6590e96377a068a3365e49ef8d8dbe65bf573b9d419a9f77e62a58b48f58ad0f
languageName: node
linkType: hard
@@ -2752,43 +2752,43 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/metadata@1.10.1, @polkadot/metadata@workspace:packages/metadata":
"@polkadot/metadata@1.11.1, @polkadot/metadata@workspace:packages/metadata":
version: 0.0.0-use.local
resolution: "@polkadot/metadata@workspace:packages/metadata"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1
"@polkadot/types": 1.10.1
"@polkadot/types-known": 1.10.1
"@polkadot/types": 1.11.1
"@polkadot/types-known": 1.11.1
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
languageName: unknown
linkType: soft
"@polkadot/rpc-core@1.10.1, @polkadot/rpc-core@workspace:packages/rpc-core":
"@polkadot/rpc-core@1.11.1, @polkadot/rpc-core@workspace:packages/rpc-core":
version: 0.0.0-use.local
resolution: "@polkadot/rpc-core@workspace:packages/rpc-core"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1
"@polkadot/metadata": 1.10.1
"@polkadot/rpc-provider": 1.10.1
"@polkadot/types": 1.10.1
"@polkadot/metadata": 1.11.1
"@polkadot/rpc-provider": 1.11.1
"@polkadot/types": 1.11.1
"@polkadot/util": ^2.8.1
memoizee: ^0.4.14
rxjs: ^6.5.5
languageName: unknown
linkType: soft
"@polkadot/rpc-provider@1.10.1, @polkadot/rpc-provider@workspace:packages/rpc-provider":
"@polkadot/rpc-provider@1.11.1, @polkadot/rpc-provider@workspace:packages/rpc-provider":
version: 0.0.0-use.local
resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1
"@polkadot/metadata": 1.10.1
"@polkadot/types": 1.10.1
"@polkadot/metadata": 1.11.1
"@polkadot/types": 1.11.1
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
@@ -2816,10 +2816,10 @@ __metadata:
"@babel/core": ^7.9.0
"@babel/register": ^7.9.0
"@babel/runtime": ^7.9.2
"@polkadot/api": 1.10.1
"@polkadot/metadata": 1.10.1
"@polkadot/rpc-provider": 1.10.1
"@polkadot/types": 1.10.1
"@polkadot/api": 1.11.1
"@polkadot/metadata": 1.11.1
"@polkadot/rpc-provider": 1.11.1
"@polkadot/types": 1.11.1
"@polkadot/util": ^2.8.1
"@types/websocket": ^1.0.0
"@types/yargs": ^15.0.4
@@ -2834,25 +2834,25 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/types-known@1.10.1, @polkadot/types-known@workspace:packages/types-known":
"@polkadot/types-known@1.11.1, @polkadot/types-known@workspace:packages/types-known":
version: 0.0.0-use.local
resolution: "@polkadot/types-known@workspace:packages/types-known"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/types": 1.10.1
"@polkadot/types": 1.11.1
"@polkadot/util": ^2.8.1
"@types/bn.js": ^4.11.6
bn.js: ^5.1.1
languageName: unknown
linkType: soft
"@polkadot/types@1.10.1, @polkadot/types@workspace:packages/types":
"@polkadot/types@1.11.1, @polkadot/types@workspace:packages/types":
version: 0.0.0-use.local
resolution: "@polkadot/types@workspace:packages/types"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1
"@polkadot/metadata": 1.10.1
"@polkadot/metadata": 1.11.1
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
"@types/bn.js": ^4.11.6
@@ -3164,11 +3164,11 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/eslint-plugin@npm:2.27.0":
version: 2.27.0
resolution: "@typescript-eslint/eslint-plugin@npm:2.27.0"
"@typescript-eslint/eslint-plugin@npm:2.28.0":
version: 2.28.0
resolution: "@typescript-eslint/eslint-plugin@npm:2.28.0"
dependencies:
"@typescript-eslint/experimental-utils": 2.27.0
"@typescript-eslint/experimental-utils": 2.28.0
functional-red-black-tree: ^1.0.1
regexpp: ^3.0.0
tsutils: ^3.17.1
@@ -3179,31 +3179,31 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 2/4373cddd9062a4640ab00f3553c839689109f26ed347523924053109bce6ed3adb7c6c89945076480bade28db91530a02911dd549aa252a805ceebf0f285280b
checksum: 2/b46266768e67112b13ec0b61be2f461f5122fbc1793155ec18821052fb7b7bd9e416d14f9245b51b91703157e5f511ba6dd2f49a28e9d4c88f4974c6c245f2dd
languageName: node
linkType: hard
"@typescript-eslint/experimental-utils@npm:2.27.0":
version: 2.27.0
resolution: "@typescript-eslint/experimental-utils@npm:2.27.0"
"@typescript-eslint/experimental-utils@npm:2.28.0":
version: 2.28.0
resolution: "@typescript-eslint/experimental-utils@npm:2.28.0"
dependencies:
"@types/json-schema": ^7.0.3
"@typescript-eslint/typescript-estree": 2.27.0
"@typescript-eslint/typescript-estree": 2.28.0
eslint-scope: ^5.0.0
eslint-utils: ^2.0.0
peerDependencies:
eslint: "*"
checksum: 2/3bca6016b3a05d34fd5dfff77876d6b137876fb29747119de4accce5a93ffc59bfad6e9c9c7b85c44a5e372f599b94293748e9e9c60c922cdb7b61e4b176a7ec
checksum: 2/74bcb0ca1c6e30b94b3e97153c744b52e7530cac35dac21c0780d27480c880e9381e9042627f7b480c4ed909fb24e88e730c7c1f8f86d1861e956da56a7982f0
languageName: node
linkType: hard
"@typescript-eslint/parser@npm:2.27.0":
version: 2.27.0
resolution: "@typescript-eslint/parser@npm:2.27.0"
"@typescript-eslint/parser@npm:2.28.0":
version: 2.28.0
resolution: "@typescript-eslint/parser@npm:2.28.0"
dependencies:
"@types/eslint-visitor-keys": ^1.0.0
"@typescript-eslint/experimental-utils": 2.27.0
"@typescript-eslint/typescript-estree": 2.27.0
"@typescript-eslint/experimental-utils": 2.28.0
"@typescript-eslint/typescript-estree": 2.28.0
eslint-visitor-keys: ^1.1.0
peerDependencies:
eslint: ^5.0.0 || ^6.0.0
@@ -3211,11 +3211,31 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 2/e9b28622d498ec62467263ca95d2679b9f093ee37e5b7ccaf6930597a3f0f5bfd934d1b85aa8b6b43e48bfa126dac2fba7f094706ac4e261eb7eea8d868255f9
checksum: 2/8a04747bc190432f7e568ee17fc36c481638a80fdf4fd7937e44e2d2b2c188d5e362b0706b52579d3d33579ea21e261473a26de74101f4fe870b17dae3a52e23
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:2.27.0, @typescript-eslint/typescript-estree@npm:^2.4.0":
"@typescript-eslint/typescript-estree@npm:2.28.0":
version: 2.28.0
resolution: "@typescript-eslint/typescript-estree@npm:2.28.0"
dependencies:
debug: ^4.1.1
eslint-visitor-keys: ^1.1.0
glob: ^7.1.6
is-glob: ^4.0.1
lodash: ^4.17.15
semver: ^6.3.0
tsutils: ^3.17.1
peerDependencies:
typescript: "*"
peerDependenciesMeta:
typescript:
optional: true
checksum: 2/9dc2389b89f30536f69a2baa83dd523dbf13f9ddccdf5994a54f3ba8de213b37202e3e159722ba101d5369a68546fbe90a0cc25d77a74e075311e229c304a23e
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:^2.4.0":
version: 2.27.0
resolution: "@typescript-eslint/typescript-estree@npm:2.27.0"
dependencies:
@@ -3369,17 +3389,17 @@ __metadata:
languageName: node
linkType: hard
"@vuepress/core@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/core@npm:1.4.0"
"@vuepress/core@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/core@npm:1.4.1"
dependencies:
"@babel/core": ^7.8.4
"@vue/babel-preset-app": ^4.1.2
"@vuepress/markdown": ^1.4.0
"@vuepress/markdown-loader": ^1.4.0
"@vuepress/plugin-last-updated": ^1.4.0
"@vuepress/plugin-register-components": ^1.4.0
"@vuepress/shared-utils": ^1.4.0
"@vuepress/markdown": 1.4.1
"@vuepress/markdown-loader": 1.4.1
"@vuepress/plugin-last-updated": 1.4.1
"@vuepress/plugin-register-components": 1.4.1
"@vuepress/shared-utils": 1.4.1
autoprefixer: ^9.5.1
babel-loader: ^8.0.4
cache-loader: ^3.0.0
@@ -3411,82 +3431,82 @@ __metadata:
webpack-dev-server: ^3.5.1
webpack-merge: ^4.1.2
webpackbar: 3.2.0
checksum: 2/e22c86fb366dee018449e2ab6f36748310c15588a8300420c7dd0921a1d3731e93f3d9d2a78c8d9c95135cc5a9e40e78e2671e733f718d929e10b329f33f8edc
checksum: 2/c85da23f77deb4b78634cba217e7f379a194d30466f58853c4f3cbdf44f9c1eb8f5c0fe0da6c1c0cce53d51da043055cd1edc9889b1e0527f02a4a3b4d72c222
languageName: node
linkType: hard
"@vuepress/markdown-loader@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/markdown-loader@npm:1.4.0"
"@vuepress/markdown-loader@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/markdown-loader@npm:1.4.1"
dependencies:
"@vuepress/markdown": ^1.4.0
"@vuepress/markdown": 1.4.1
loader-utils: ^1.1.0
lru-cache: ^5.1.1
checksum: 2/09ff0fb3cda0abf17ebb6b55cf96abe5568637510a472f9fd59f4ff38628a29a66e801d537c3177722c9ff71f62bd92c08e7b349d309e383c59f6504a2a84af0
checksum: 2/6b0d4b44650ce71830cbb08fbbb0e614cce5515e3f13b6e60a1144f19f245351ecd6a6f366728f0d8a45d89e896bed0f2fa9c8462c78681ae8c849c427835d9a
languageName: node
linkType: hard
"@vuepress/markdown@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/markdown@npm:1.4.0"
"@vuepress/markdown@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/markdown@npm:1.4.1"
dependencies:
"@vuepress/shared-utils": ^1.4.0
"@vuepress/shared-utils": 1.4.1
markdown-it: ^8.4.1
markdown-it-anchor: ^5.0.2
markdown-it-chain: ^1.3.0
markdown-it-emoji: ^1.4.0
markdown-it-table-of-contents: ^0.4.0
prismjs: ^1.13.0
checksum: 2/ccbce282bc37ed2db73bd2a5bce27326852bec968ed9216682710770d069381803e731cd3b1d5757629cf3963922bdb52bf18547cdbebb6d6df19b43984402b5
checksum: 2/c1091fd0da3c5545f401d1c2e81a3b62874f255b10f9f06bd5f0f5353d4882d648bc18d7db8f351f669a05ff93be6f2df94a22c07202de530858907731bf9826
languageName: node
linkType: hard
"@vuepress/plugin-active-header-links@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/plugin-active-header-links@npm:1.4.0"
"@vuepress/plugin-active-header-links@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/plugin-active-header-links@npm:1.4.1"
dependencies:
lodash.debounce: ^4.0.8
checksum: 2/3b48c27332ef457cfce7539c330364540603ebbfdbcfc8641ce05e969df214db041acb4e947b99ed8bf0ae7063e2d58319aef2cc2f23d3eb8ba9a4f26a7113f4
checksum: 2/f78844aad9cf3368185dafa579de7351aab235f944907b3f7276413c0ff8bbb7c3a6d5fc6a72fb3c9837fcb0afffe87b03b07d3829bfee75a699860a33133aeb
languageName: node
linkType: hard
"@vuepress/plugin-last-updated@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/plugin-last-updated@npm:1.4.0"
"@vuepress/plugin-last-updated@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/plugin-last-updated@npm:1.4.1"
dependencies:
cross-spawn: ^6.0.5
checksum: 2/f27ec4be38d50b574c43b19837297e0c563d23ba7a6728f8309fca7417fefc5bb1b6dfec1b03771d26e58b3819ec57cc313017183ec600c38b722f60a1c96bee
checksum: 2/295edd8a21a4fd01c899f11f68420bf7b233c96552b95c9a9230c384cd6c227967b22b0c4e3c7e360f479976e3d7d06a3776c7355f207d00f1829170a7d3ee98
languageName: node
linkType: hard
"@vuepress/plugin-nprogress@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/plugin-nprogress@npm:1.4.0"
"@vuepress/plugin-nprogress@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/plugin-nprogress@npm:1.4.1"
dependencies:
nprogress: ^0.2.0
checksum: 2/d3a4dad28767a794ce6e90ad274614c378d1ee3e6c7c80887f0fffd5db397dfdb0b985212afa228a5c7f900132ac2dc5026f4f69d50204eddda249c6c50f80d7
checksum: 2/fad6ca53b742d68875ef8e0ce330a853f75df92508cc0d89591925d48e55a5a7c7437631c9c77ab45be39beb56290cdc00eebae634ea6cec166581a69e622bb3
languageName: node
linkType: hard
"@vuepress/plugin-register-components@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/plugin-register-components@npm:1.4.0"
"@vuepress/plugin-register-components@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/plugin-register-components@npm:1.4.1"
dependencies:
"@vuepress/shared-utils": ^1.4.0
checksum: 2/1125bf672a6c2613e60a5f3da0d2d35e49c0105575a7f61c4142a8c10732ecf752038e5393d766b64859e8f8e6abfb331a01c5c018f79d9f25d1719553fc155e
"@vuepress/shared-utils": 1.4.1
checksum: 2/6648f4c33632665b25dad88e791a71c4b113da9ca837e746e4bcfbb11fc912f2c8bfb65dbe22140d203805cbcbdf9f91c2ed960ed689110eb9233e55390ea55a
languageName: node
linkType: hard
"@vuepress/plugin-search@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/plugin-search@npm:1.4.0"
checksum: 2/cacad83fd50a6f33cb2cbd5f1eb67ca1bd5b98f1843f0a6e9f671d770b33010eaf19a630ff951c4d0ceef1ff7207593aa652178dc5195471ce2d23f55a7f17ff
"@vuepress/plugin-search@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/plugin-search@npm:1.4.1"
checksum: 2/4131f5e8d5ee33bcfb6d6460bbed566c1a2d7ef4c995cfd5842766a69cd037a8938371d1c3a863d6fbf5ef8e4768f9b90bd413047467fde1b0ba15e10884bbc9
languageName: node
linkType: hard
"@vuepress/shared-utils@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/shared-utils@npm:1.4.0"
"@vuepress/shared-utils@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/shared-utils@npm:1.4.1"
dependencies:
chalk: ^2.3.2
diacritics: ^1.3.0
@@ -3497,24 +3517,24 @@ __metadata:
hash-sum: ^1.0.2
semver: ^6.0.0
upath: ^1.1.0
checksum: 2/c0f5f8c75e74257ce3b618e3213029d8403507b17f3bad725167cc047d58862de12ec49fabc232fe0118901efb03efe02d73f8e83151bf0f5b08a0ee08af884f
checksum: 2/e3cda7660f90bc91cf59f9a7bc21bd84625ff440bda92352a0bc3084893323e4d53bb5bf776a1bf3d4c53c8e7f6b794253d8da86d1c44a0fee906786305d0a1d
languageName: node
linkType: hard
"@vuepress/theme-default@npm:^1.4.0":
version: 1.4.0
resolution: "@vuepress/theme-default@npm:1.4.0"
"@vuepress/theme-default@npm:1.4.1":
version: 1.4.1
resolution: "@vuepress/theme-default@npm:1.4.1"
dependencies:
"@vuepress/plugin-active-header-links": ^1.4.0
"@vuepress/plugin-nprogress": ^1.4.0
"@vuepress/plugin-search": ^1.4.0
"@vuepress/plugin-active-header-links": 1.4.1
"@vuepress/plugin-nprogress": 1.4.1
"@vuepress/plugin-search": 1.4.1
docsearch.js: ^2.5.2
lodash: ^4.17.15
stylus: ^0.54.5
stylus-loader: ^3.0.2
vuepress-plugin-container: ^2.0.2
vuepress-plugin-smooth-scroll: ^0.0.3
checksum: 2/b3587098b4a265244cc1ffe1817ae99dce4f5f496cc5394a850693440bc1a0eff501ff14a65198ac03585fe589c5dad3dafd771c30d603bc21cf6c1000679263
checksum: 2/fd3acfce0e5018e865d4ad5ed54ea64bb2ff21b481ad8836b1f27df14534e1e7916980b9d5a787078b7e89679b576c548b78df000bd3cc73b6aa57cd0f42ffc5
languageName: node
linkType: hard
@@ -7529,14 +7549,14 @@ __metadata:
languageName: node
linkType: hard
"eslint-plugin-sort-destructure-keys@npm:^1.3.3":
version: 1.3.3
resolution: "eslint-plugin-sort-destructure-keys@npm:1.3.3"
"eslint-plugin-sort-destructure-keys@npm:^1.3.4":
version: 1.3.4
resolution: "eslint-plugin-sort-destructure-keys@npm:1.3.4"
dependencies:
natural-compare-lite: ^1.4.0
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0
checksum: 2/bcf1e4c8d9ebd692269cfbec29fbd321eec86f13273b313c46d5cff6c9434873941db4dfa117f7b71a60e247c3be5df2cdc324d4216b824ac19e3fad259370fd
checksum: 2/3f31a9ac26d034e1d23bf01bfe61ddcd5d9788528945a42c12a181db4dcd70fdad0670e51bfd6cdf32bd41b39d271f9d6427686cc01cba4e4cc70bbd823c3bf2
languageName: node
linkType: hard
@@ -15402,7 +15422,7 @@ __metadata:
"@babel/core": ^7.9.0
"@babel/register": ^7.9.0
"@babel/runtime": ^7.9.2
"@polkadot/dev": ^0.52.9
"@polkadot/dev": ^0.52.11
"@polkadot/ts": ^0.3.18
"@polkadot/typegen": "workspace:packages/typegen"
"@types/jest": ^25.2.1
@@ -17821,19 +17841,19 @@ __metadata:
languageName: node
linkType: hard
"vuepress@npm:^1.4.0":
version: 1.4.0
resolution: "vuepress@npm:1.4.0"
"vuepress@npm:^1.4.1":
version: 1.4.1
resolution: "vuepress@npm:1.4.1"
dependencies:
"@vuepress/core": ^1.4.0
"@vuepress/theme-default": ^1.4.0
"@vuepress/core": 1.4.1
"@vuepress/theme-default": 1.4.1
cac: ^6.5.6
envinfo: ^7.2.0
opencollective-postinstall: ^2.0.2
update-notifier: ^4.0.0
bin:
vuepress: cli.js
checksum: 2/9d1085d0ec7504b4fcfac8e64a0ee2290b824e1f7f04e1aa311c4523dcde7a96f4c7ff028d0f596aab61511b82f15807930ac355b6fd30444290768491ceeddf
checksum: 2/afa4299ae4952f46202e3281938a0432203853609d16ce53c47b231747d27d4735e3f9eb668098211ad342836ec2e2c13e40ee37cb378bcd1a280c19a8f986d0
languageName: node
linkType: hard