Skip to content

Commit d1105c8

Browse files
authored
0.92 (#1390)
* Metadata for current Substrate master * 0.92 doc updates * @polkadot/util 1.4.1 * Update static polkadot metadata * Version bump
1 parent df97bc2 commit d1105c8

File tree

26 files changed

+364
-257
lines changed

26 files changed

+364
-257
lines changed

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# 0.92.0-beta.x
1+
# 0.92.1
22

3-
- The API now correctly sets the ss58 prefix as retrieved from the chain properties vis `ss58Format`
4-
- Bump to `@polkadot/util` 1.3.1, removing use of `ExtError`
5-
- the `Keyring` from `@polkadot/keyring` is now exposed on the API as well. You can do `import { Keyring } from '@polkadot/api'` - this alleviates the need for extra dependencies (apart from `@polkadot/api`), and since the keyring is critical for signing operations, aligns everything in one bundle
3+
- The API now correctly sets the ss58 prefix as retrieved from the chain properties via `ss58Format`
4+
- Bump to `@polkadot/util` 1.4.1, removing use of `ExtError`
5+
- The `Keyring` from `@polkadot/keyring` is now exposed on the API as well. You can do `import { Keyring } from '@polkadot/api'` - this alleviates the need for extra dependencies (apart from `@polkadot/api`), and since the keyring is critical for signing operations, aligns everything in one bundle
6+
- Support the latest Polkadot & Substrate master branches (incl. metadata updates)
7+
- Getting started documentation has been made available
68

79
# 0.91.1
810

docs/start/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ These sections should provide you with all the information needed to install the
44

55
## What this is not
66

7-
This is not line-by-line documentation of all the extising function calls available, nor it is tied to a specific chain. (Although the examples do refer to the base Substrate & Polkadot chains). There will be some things in the API that are probably not covered, which brings us to the next point...
7+
This is not line-by-line documentation of all the extising function calls available, nor it is tied to a specific chain. (Although the examples do refer to the base Polkadot & Substrate chains). There will be some things in the API that are probably not covered, which brings us to the next point...
88

99
## Help us help others
1010

docs/start/api.query.other.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const momentPrev = await api.query.timestamp.now.at(lastHdr.parentHash);
3333

3434
The `.at` queries are all single-shot, i.e. there are no subscription option to these, since the state for a previous block should be static. (This is true to a certain extent, i.e. when blocks have been finalized).
3535

36-
An additional point to take care of (briefly mentioned above), is state pruning. By default a Substrate node will only keep state for the last 256 blocks, unless it is explicitly run in archive mode. This means that querying state further back than the pruning period will result in an error returned from the Node. (Generaly most public RPC nodes only run with default settings, which includes agressive state pruning)
36+
An additional point to take care of (briefly mentioned above), is state pruning. By default a Polkadot/Substrate node will only keep state for the last 256 blocks, unless it is explicitly run in archive mode. This means that querying state further back than the pruning period will result in an error returned from the Node. (Generaly most public RPC nodes only run with default settings, which includes agressive state pruning)
3737

3838
## State entries
3939

docs/start/api.tx.wrap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const txHash = await api.tx.staking.validate({
3737
});
3838
```
3939

40-
In the above example, all we need to provide is a the fields for the `ValidatorPrefs` object. (Any fields not defined will be set to the default for that type, i.e. all zero). This object maps through to what is defined on the Substrate side, with the [@polkadot/types version](https://github.com/polkadot-js/api/blob/master/packages/types/src/interfaces/staking/definitions.ts) mapping all fields.
40+
In the above example, all we need to provide is a the fields for the `ValidatorPrefs` object. (Any fields not defined will be set to the default for that type, i.e. all zero). This object maps through to what is defined on the Polkadot/Substrate side, with the [@polkadot/types version](https://github.com/polkadot-js/api/blob/master/packages/types/src/interfaces/staking/definitions.ts) mapping all fields.
4141

4242
## Understanding types
4343

docs/start/keyring.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@ This section will give a quick introduction into the Keyring, including the addi
44

55
## Installation
66

7-
They [@polkadot/keyring](https://github.com/polkadot-js/common/tree/master/packages/keyring) keyring is not included directly with the API as a dependency, so rather it should be installed seperately, you can do so via
7+
They [@polkadot/keyring](https://github.com/polkadot-js/common/tree/master/packages/keyring) keyring is included directly with the API as a dependency, so it is directly importable (since the 0.92 version) alongside the API.
88

9-
`yarn add @polkadot/keyring`
10-
11-
It is best-practice to ensure that the version of `@polkadot/util-crypto` that is included with the API matches with the version of `@polkadot/keyring` installed. So if the API depends on `1.2.1`, it would make sense to include `1.2.1` as the `@polkadot/keyring` version. (This helps in making sure extra versions of the libraries are not included as duplicates, especially in the case where bundles are created.)
9+
If you do opt to install it seperately, ensure that the version of `@polkadot/util-crypto` that is included with the API matches with the version of `@polkadot/keyring` installed. So if the API depends on `util-crypto 1.4.1`, it would make sense to include `keyring 1.4.1` as the installed version. (This helps in making sure extra versions of the libraries are not included as duplicates, especially in the case where bundles are created. Additionally, this makes sure that weird side-effects in the WASM initialization is avoided.)
1210

1311
## Creating a keyring instance
1412

15-
Once installed, you can create an instance by just creating the class -
13+
Once installed, you can create an instance by just creating an instance of the `Keyring` class -
1614

1715
```js
1816
// import the keyring as required
19-
import { Keyring } from '@polkadot/keyring';
17+
import { Keyring } from '@polkadot/api';
2018

2119
// initialize the API as we would normally do
2220
...
@@ -64,7 +62,7 @@ const newDeri = keyring.addFromUri(`${PHRASE}//hard-derived/soft-derived`);
6462
const alice = keyring.addFromUri('//Alice', { name: 'Alice default' });
6563
```
6664

67-
The above additions cater for most of the usecases and aligns with the you would find in the Substrate `subkey`. Be very wary of the last "dev-seed" option, it is explicitly added for `subkey` compatibility and implies using the "known-everywhere" dev seed. It is however useful when running Substrate/Polkadot with a `--dev` flag.
65+
The above additions cater for most of the usecases and aligns with the you would find in the Substrate `subkey`. Be very wary of the last "dev-seed" option, it is explicitly added for `subkey` compatibility and implies using the "known-everywhere" dev seed. It is however useful when running Polkadot/Substrate with a `--dev` flag.
6866

6967
## Working with pairs
7068

@@ -94,7 +92,7 @@ const signature = alice.sign(message);
9492
const isValid = alice.verify(message, signature);
9593

9694
// log info
97-
console.log(`The signature ${u8aToHex(signature)}, is ${isValid ? '' : 'not '}verified`);
95+
console.log(`The signature ${u8aToHex(signature)}, is ${isValid ? '' : 'in'}valid`);
9896
```
9997

10098
This covers the keyring basics, however there are two additional functions here of interest, `keyring.getPairs()` to retrieve a list of all pairs in the keyring and `keyring.getPair(<address or publicKey>)` to retrieve a pair where we have an identifier.

docs/start/types.extend.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Extending types
22

3-
Circling back to metadata, by default the metadata information (at this point in time), only returns the type names as they apply to any section, be it a call, event or query. As an example, this means that transfers are defined as `balances.transfer(AccountId, Balance)` with no details as to the mapping of the `Balance` type to a `u128`. (The underlying Substrate/Polkadot default)
3+
Circling back to metadata, by default the metadata information (at this point in time), only returns the type names as they apply to any section, be it a call, event or query. As an example, this means that transfers are defined as `balances.transfer(AccountId, Balance)` with no details as to the mapping of the `Balance` type to a `u128`. (The underlying Polkadot/Substrate default)
44

5-
Therefore to cater for all types, a mapping in done on the [@polkadot/types library](https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces) to define each of the types and align with their underlying structures as it maps to a default Substrate or Polkadot chain.
5+
Therefore to cater for all types, a mapping in done on the [@polkadot/types library](https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces) to define each of the types and align with their underlying structures as it maps to a default Polkadot or Substrate chain.
66

7-
Additionally, the API contains some logic for chain type detection, for instance in the case of Substrate 1.x based chains, it will define `BlockNumber` & `Index` (nonce) as a `u64`, while for current-generation chains, these will be defined as `u32`. Some of the work in maintaining the API for Substrate/Polkadot is the addition of types as they appear and gets used in the Rust codebases.
7+
Additionally, the API contains some logic for chain type detection, for instance in the case of Substrate 1.x based chains, it will define `BlockNumber` & `Index` (nonce) as a `u64`, while for current-generation chains, these will be defined as `u32`. Some of the work in maintaining the API for Polkadot/Substrate is the addition of types as they appear and gets used in the Rust codebases.
88

9-
There is a the [recommentation](install.md#betas) to use a `@polkadot/api@beta` should you wish to track the master branches of Substrate or Polkadot, since master changes for the addition of new types do not make it into a stable release immediately.
9+
There is a the [recommentation](install.md#betas) to use a `@polkadot/api@beta` should you wish to track the master branches of Polkadot or Substrate, since master changes for the addition of new types do not make it into a stable release immediately.
1010

1111
## Extension
1212

docs/start/typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ In the above example a couple of things are introduced - most of the chain defin
2121

2222
In the subscription example, we explicitly define `lastHead: Header`, although the same definition is missing for `firstHead`. However, in both these cases the definitions for the `api.rpc` sections are such that TypeScript understands that `firstHead` and `lastHead` are of type `Header`. The `: Header` here is rather for our own understanding (and could be needed based on your eslint/tslint config).
2323

24-
As indicated, most of the Substrate/Polkadot default types are available via `types/interfaces`. However, for primitives types where there is an actual implementation, these are made available via `@polkadot/types` directly. For instance, `import { u32 } from '@polkadot/types` is valid in this context.
24+
As indicated, most of the Polkadot/Substrate default types are available via `types/interfaces`. However, for primitives types where there is an actual implementation, these are made available via `@polkadot/types` directly. For instance, `import { u32 } from '@polkadot/types` is valid in this context.
2525

2626
## Metadata injected
2727

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"packages": [
1010
"packages/*"
1111
],
12-
"version": "0.92.0-beta.9"
12+
"version": "0.92.0"
1313
}

packages/api-contract/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api-contract",
3-
"version": "0.92.0-beta.9",
3+
"version": "0.92.0",
44
"description": "Interfaces for interacting with contracts and contract ABIs",
55
"main": "index.js",
66
"keywords": [
@@ -27,6 +27,6 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.6.0",
30-
"@polkadot/types": "^0.92.0-beta.9"
30+
"@polkadot/types": "^0.92.0"
3131
}
3232
}

packages/api-derive/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api-derive",
3-
"version": "0.92.0-beta.9",
3+
"version": "0.92.0",
44
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
55
"main": "index.js",
66
"keywords": [
@@ -28,10 +28,10 @@
2828
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
2929
"dependencies": {
3030
"@babel/runtime": "^7.6.0",
31-
"@polkadot/api": "^0.92.0-beta.9",
32-
"@polkadot/types": "^0.92.0-beta.9"
31+
"@polkadot/api": "^0.92.0",
32+
"@polkadot/types": "^0.92.0"
3333
},
3434
"devDependencies": {
35-
"@polkadot/keyring": "^1.4.0-beta.0"
35+
"@polkadot/keyring": "^1.4.1"
3636
}
3737
}

0 commit comments

Comments
 (0)