Skip to content

Commit

Permalink
1.10 (#2158)
Browse files Browse the repository at this point in the history
* 1.10

* CHANGELOG

* key extract example
  • Loading branch information
jacogr authored Apr 13, 2020
1 parent e569de5 commit e0bde92
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 73 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 1.10.0-beta.x
# 1.10.1 Apr 13, 2020

- **Important** Substrate master has updated staking, on older chains apply `StakingLedger: 'StakingLedgerTo240'`
- Add `rpc.system.chainType` to retrieve the chain type (Development. Local, Live & Custom)
Expand All @@ -8,7 +8,8 @@
- Cleanups to derives for democracy & staking to be more performant
- Add Centrifuge base types to `@polkadot/types-known`
- Adjust with all the latest substrate master types
- Internally all private/protected methods/variables are now indicated with `_` (Aligning with the `private/protected` indicators in the TS definitions)
- Internally all private/protected methods/variables are now `_` prefixed (Aligning with the `private/protected` indicators in the TS definitions)
- Update metadata/docs-from-metadata to the latest Substrate

# 1.9.1 Apr 1, 2020

Expand Down
14 changes: 12 additions & 2 deletions docs/start/api.query.other.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ When working maps and double-maps, it is possible to retrieve a list of all the
// Retrieve the active era
const activeEra = await api.query.staking.activeEra();

// retrieve all exposures int the active era
// retrieve all exposures for the active era
const exposures = await api.query.staking.erasStakers.entries(activeEra.index);

exposures.forEach(([key, exposure]) => {
Expand All @@ -73,7 +73,17 @@ 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)

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 decoding, as available on maps with decodable hashing functions.
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());

console.log('all nominators:', nminatorIds.join(', '));
```

## State entries

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.10.0-beta.29"
"version": "1.10.0"
}
8 changes: 4 additions & 4 deletions packages/api-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
Expand All @@ -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.0-beta.29",
"@polkadot/rpc-core": "1.10.0-beta.29",
"@polkadot/types": "1.10.0-beta.29",
"@polkadot/api": "1.10.0",
"@polkadot/rpc-core": "1.10.0",
"@polkadot/types": "1.10.0",
"@polkadot/util": "^2.8.1",
"bn.js": "^5.1.1",
"rxjs": "^6.5.5"
Expand Down
10 changes: 5 additions & 5 deletions packages/api-derive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
Expand Down Expand Up @@ -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.0-beta.29",
"@polkadot/rpc-core": "1.10.0-beta.29",
"@polkadot/rpc-provider": "1.10.0-beta.29",
"@polkadot/types": "1.10.0-beta.29",
"@polkadot/api": "1.10.0",
"@polkadot/rpc-core": "1.10.0",
"@polkadot/rpc-provider": "1.10.0",
"@polkadot/types": "1.10.0",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1",
Expand Down
14 changes: 7 additions & 7 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
Expand All @@ -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.0-beta.29",
"@polkadot/api-derive": "1.10.0",
"@polkadot/keyring": "^2.8.1",
"@polkadot/metadata": "1.10.0-beta.29",
"@polkadot/rpc-core": "1.10.0-beta.29",
"@polkadot/rpc-provider": "1.10.0-beta.29",
"@polkadot/types": "1.10.0-beta.29",
"@polkadot/types-known": "1.10.0-beta.29",
"@polkadot/metadata": "1.10.0",
"@polkadot/rpc-core": "1.10.0",
"@polkadot/rpc-provider": "1.10.0",
"@polkadot/types": "1.10.0",
"@polkadot/types-known": "1.10.0",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/metadata/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
Expand All @@ -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.0-beta.29",
"@polkadot/types-known": "1.10.0-beta.29",
"@polkadot/types": "1.10.0",
"@polkadot/types-known": "1.10.0",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1"
Expand Down
8 changes: 4 additions & 4 deletions packages/rpc-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
Expand All @@ -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.0-beta.29",
"@polkadot/rpc-provider": "1.10.0-beta.29",
"@polkadot/types": "1.10.0-beta.29",
"@polkadot/metadata": "1.10.0",
"@polkadot/rpc-provider": "1.10.0",
"@polkadot/types": "1.10.0",
"@polkadot/util": "^2.8.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
Expand Down
6 changes: 3 additions & 3 deletions packages/rpc-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
Expand All @@ -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.0-beta.29",
"@polkadot/types": "1.10.0-beta.29",
"@polkadot/metadata": "1.10.0",
"@polkadot/types": "1.10.0",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"bn.js": "^5.1.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/typegen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
Expand Down Expand Up @@ -36,10 +36,10 @@
"@babel/core": "^7.9.0",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@polkadot/api": "1.10.0-beta.29",
"@polkadot/metadata": "1.10.0-beta.29",
"@polkadot/rpc-provider": "1.10.0-beta.29",
"@polkadot/types": "1.10.0-beta.29",
"@polkadot/api": "1.10.0",
"@polkadot/metadata": "1.10.0",
"@polkadot/rpc-provider": "1.10.0",
"@polkadot/types": "1.10.0",
"@polkadot/util": "^2.8.1",
"websocket": "^1.0.31",
"yargs": "^15.3.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/types-known/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
Expand All @@ -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.0-beta.29",
"@polkadot/types": "1.10.0",
"@polkadot/util": "^2.8.1",
"bn.js": "^5.1.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.10.0-beta.29",
"version": "1.10.0",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
Expand All @@ -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.0-beta.29",
"@polkadot/metadata": "1.10.0",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"@types/bn.js": "^4.11.6",
Expand Down
66 changes: 33 additions & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2607,25 +2607,25 @@ __metadata:
resolution: "@polkadot/api-contract@workspace:packages/api-contract"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api": 1.10.0-beta.29
"@polkadot/rpc-core": 1.10.0-beta.29
"@polkadot/types": 1.10.0-beta.29
"@polkadot/api": 1.10.0
"@polkadot/rpc-core": 1.10.0
"@polkadot/types": 1.10.0
"@polkadot/util": ^2.8.1
bn.js: ^5.1.1
rxjs: ^6.5.5
languageName: unknown
linkType: soft

"@polkadot/[email protected]-beta.29, @polkadot/api-derive@workspace:packages/api-derive":
"@polkadot/[email protected], @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.0-beta.29
"@polkadot/api": 1.10.0
"@polkadot/keyring": ^2.8.1
"@polkadot/rpc-core": 1.10.0-beta.29
"@polkadot/rpc-provider": 1.10.0-beta.29
"@polkadot/types": 1.10.0-beta.29
"@polkadot/rpc-core": 1.10.0
"@polkadot/rpc-provider": 1.10.0
"@polkadot/types": 1.10.0
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
Expand All @@ -2634,18 +2634,18 @@ __metadata:
languageName: unknown
linkType: soft

"@polkadot/[email protected]-beta.29, @polkadot/api@workspace:packages/api":
"@polkadot/[email protected], @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.0-beta.29
"@polkadot/api-derive": 1.10.0
"@polkadot/keyring": ^2.8.1
"@polkadot/metadata": 1.10.0-beta.29
"@polkadot/rpc-core": 1.10.0-beta.29
"@polkadot/rpc-provider": 1.10.0-beta.29
"@polkadot/types": 1.10.0-beta.29
"@polkadot/types-known": 1.10.0-beta.29
"@polkadot/metadata": 1.10.0
"@polkadot/rpc-core": 1.10.0
"@polkadot/rpc-provider": 1.10.0
"@polkadot/types": 1.10.0
"@polkadot/types-known": 1.10.0
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
Expand Down Expand Up @@ -2752,43 +2752,43 @@ __metadata:
languageName: node
linkType: hard

"@polkadot/[email protected]-beta.29, @polkadot/metadata@workspace:packages/metadata":
"@polkadot/[email protected], @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.0-beta.29
"@polkadot/types-known": 1.10.0-beta.29
"@polkadot/types": 1.10.0
"@polkadot/types-known": 1.10.0
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
languageName: unknown
linkType: soft

"@polkadot/[email protected]-beta.29, @polkadot/rpc-core@workspace:packages/rpc-core":
"@polkadot/[email protected], @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.0-beta.29
"@polkadot/rpc-provider": 1.10.0-beta.29
"@polkadot/types": 1.10.0-beta.29
"@polkadot/metadata": 1.10.0
"@polkadot/rpc-provider": 1.10.0
"@polkadot/types": 1.10.0
"@polkadot/util": ^2.8.1
memoizee: ^0.4.14
rxjs: ^6.5.5
languageName: unknown
linkType: soft

"@polkadot/[email protected]-beta.29, @polkadot/rpc-provider@workspace:packages/rpc-provider":
"@polkadot/[email protected], @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.0-beta.29
"@polkadot/types": 1.10.0-beta.29
"@polkadot/metadata": 1.10.0
"@polkadot/types": 1.10.0
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
bn.js: ^5.1.1
Expand Down Expand Up @@ -2816,10 +2816,10 @@ __metadata:
"@babel/core": ^7.9.0
"@babel/register": ^7.9.0
"@babel/runtime": ^7.9.2
"@polkadot/api": 1.10.0-beta.29
"@polkadot/metadata": 1.10.0-beta.29
"@polkadot/rpc-provider": 1.10.0-beta.29
"@polkadot/types": 1.10.0-beta.29
"@polkadot/api": 1.10.0
"@polkadot/metadata": 1.10.0
"@polkadot/rpc-provider": 1.10.0
"@polkadot/types": 1.10.0
"@polkadot/util": ^2.8.1
"@types/websocket": ^1.0.0
"@types/yargs": ^15.0.4
Expand All @@ -2834,25 +2834,25 @@ __metadata:
languageName: unknown
linkType: soft

"@polkadot/[email protected]-beta.29, @polkadot/types-known@workspace:packages/types-known":
"@polkadot/[email protected], @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.0-beta.29
"@polkadot/types": 1.10.0
"@polkadot/util": ^2.8.1
"@types/bn.js": ^4.11.6
bn.js: ^5.1.1
languageName: unknown
linkType: soft

"@polkadot/[email protected]-beta.29, @polkadot/types@workspace:packages/types":
"@polkadot/[email protected], @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.0-beta.29
"@polkadot/metadata": 1.10.0
"@polkadot/util": ^2.8.1
"@polkadot/util-crypto": ^2.8.1
"@types/bn.js": ^4.11.6
Expand Down

0 comments on commit e0bde92

Please sign in to comment.