Skip to content

Commit 6ef410e

Browse files
authored
Share TypeSpec between registry instances (#3972)
* Share TypeSpec between registry instances * 6.0.3
1 parent 962c741 commit 6ef410e

File tree

17 files changed

+122
-113
lines changed

17 files changed

+122
-113
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# CHANGELOG
22

3-
## master
3+
## 6.0.3 Sep 19, 2021
4+
5+
Upgrade priority: Low. Recommended for all users on 6.0.2 using `api.query.*.*.at` calls
46

57
Changes:
68

9+
- Fix `api.query.<module>.<method>.at` queries
710
- Adjust typegen formatting for metadata documentation
811

912

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
"@types/jest": "^27.0.1",
3636
"copyfiles": "^2.4.1"
3737
},
38-
"version": "6.0.3-0",
38+
"version": "6.0.3",
3939
"packageManager": "[email protected]"
4040
}

packages/api-contract/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api-contract",
3-
"version": "6.0.3-0",
3+
"version": "6.0.3",
44
"type": "module",
55
"description": "Interfaces for interacting with contracts and contract ABIs",
66
"main": "index.js",
@@ -20,8 +20,8 @@
2020
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
2121
"dependencies": {
2222
"@babel/runtime": "^7.15.4",
23-
"@polkadot/api": "6.0.3-0",
24-
"@polkadot/types": "6.0.3-0",
23+
"@polkadot/api": "6.0.3",
24+
"@polkadot/types": "6.0.3",
2525
"@polkadot/util": "^7.4.1",
2626
"rxjs": "^7.3.0"
2727
}

packages/api-derive/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api-derive",
3-
"version": "6.0.3-0",
3+
"version": "6.0.3",
44
"type": "module",
55
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
66
"main": "index.js",
@@ -20,15 +20,15 @@
2020
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
2121
"dependencies": {
2222
"@babel/runtime": "^7.15.4",
23-
"@polkadot/api": "6.0.3-0",
24-
"@polkadot/rpc-core": "6.0.3-0",
25-
"@polkadot/types": "6.0.3-0",
23+
"@polkadot/api": "6.0.3",
24+
"@polkadot/rpc-core": "6.0.3",
25+
"@polkadot/types": "6.0.3",
2626
"@polkadot/util": "^7.4.1",
2727
"@polkadot/util-crypto": "^7.4.1",
2828
"rxjs": "^7.3.0"
2929
},
3030
"devDependencies": {
3131
"@polkadot/keyring": "^7.4.1",
32-
"@polkadot/rpc-provider": "6.0.3-0"
32+
"@polkadot/rpc-provider": "6.0.3"
3333
}
3434
}

packages/api/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/api",
3-
"version": "6.0.3-0",
3+
"version": "6.0.3",
44
"type": "module",
55
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
66
"main": "index.js",
@@ -20,12 +20,12 @@
2020
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
2121
"dependencies": {
2222
"@babel/runtime": "^7.15.4",
23-
"@polkadot/api-derive": "6.0.3-0",
23+
"@polkadot/api-derive": "6.0.3",
2424
"@polkadot/keyring": "^7.4.1",
25-
"@polkadot/rpc-core": "6.0.3-0",
26-
"@polkadot/rpc-provider": "6.0.3-0",
27-
"@polkadot/types": "6.0.3-0",
28-
"@polkadot/types-known": "6.0.3-0",
25+
"@polkadot/rpc-core": "6.0.3",
26+
"@polkadot/rpc-provider": "6.0.3",
27+
"@polkadot/types": "6.0.3",
28+
"@polkadot/types-known": "6.0.3",
2929
"@polkadot/util": "^7.4.1",
3030
"@polkadot/util-crypto": "^7.4.1",
3131
"eventemitter3": "^4.0.7",

packages/api/src/base/Decorate.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,12 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
358358
(this.hasSubscriptions
359359
? this._rpcCore.state.subscribeStorage
360360
: this._rpcCore.state.queryStorageAt)(
361-
calls.map((arg: QueryableStorageMultiArg<ApiType>) =>
362-
Array.isArray(arg)
363-
? arg[0].creator.meta.type.asMap.hashers.length === 1
364-
? [arg[0].creator, arg.slice(1)]
365-
: [arg[0].creator, ...arg.slice(1)]
366-
: [arg.creator])));
361+
calls.map((args: QueryableStorageMultiArg<ApiType>) =>
362+
Array.isArray(args)
363+
? args[0].creator.meta.type.asMap.hashers.length === 1
364+
? [args[0].creator, args.slice(1)]
365+
: [args[0].creator, ...args.slice(1)]
366+
: [args.creator])));
367367
}
368368

369369
protected _decorateExtrinsics<ApiType extends ApiTypes> ({ tx }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): SubmittableExtrinsics<ApiType> {
@@ -418,7 +418,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
418418

419419
private _decorateStorageEntry<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType> {
420420
// get the storage arguments, with DoubleMap as an array entry, otherwise spread
421-
const getArgs = (args: unknown[]): unknown[] => extractStorageArgs(this.#registry, creator, args);
421+
const getArgs = (args: unknown[]) => extractStorageArgs(this.#registry, creator, args);
422422

423423
// Disable this where it occurs for each field we are decorating
424424
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */

packages/api/src/base/Init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
165165
}
166166

167167
// nothing has been found, construct new
168-
const registry = new TypeRegistry(blockHash);
168+
const registry = new TypeRegistry(blockHash, this.registry.compatSpecs);
169169
const metadata = new Metadata(registry,
170170
await firstValueFrom((this._rpcCore.state.getMetadata as RpcInterfaceMethod).raw(header.parentHash))
171171
);

packages/rpc-core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/rpc-core",
3-
"version": "6.0.3-0",
3+
"version": "6.0.3",
44
"type": "module",
55
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
66
"main": "index.js",
@@ -20,8 +20,8 @@
2020
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
2121
"dependencies": {
2222
"@babel/runtime": "^7.15.4",
23-
"@polkadot/rpc-provider": "6.0.3-0",
24-
"@polkadot/types": "6.0.3-0",
23+
"@polkadot/rpc-provider": "6.0.3",
24+
"@polkadot/types": "6.0.3",
2525
"@polkadot/util": "^7.4.1",
2626
"rxjs": "^7.3.0"
2727
},

packages/rpc-provider/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/rpc-provider",
3-
"version": "6.0.3-0",
3+
"version": "6.0.3",
44
"type": "module",
55
"description": "Transport providers for the API",
66
"main": "index.js",
@@ -20,7 +20,7 @@
2020
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
2121
"dependencies": {
2222
"@babel/runtime": "^7.15.4",
23-
"@polkadot/types": "6.0.3-0",
23+
"@polkadot/types": "6.0.3",
2424
"@polkadot/util": "^7.4.1",
2525
"@polkadot/util-crypto": "^7.4.1",
2626
"@polkadot/x-fetch": "^7.4.1",
@@ -30,7 +30,7 @@
3030
},
3131
"devDependencies": {
3232
"@polkadot/keyring": "^7.4.1",
33-
"@polkadot/types": "6.0.3-0",
33+
"@polkadot/types": "6.0.3",
3434
"mock-socket": "^9.0.3",
3535
"nock": "^13.1.3"
3636
}

packages/typegen/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/typegen",
3-
"version": "6.0.3-0",
3+
"version": "6.0.3",
44
"type": "module",
55
"description": "Type generation scripts",
66
"main": "index.js",
@@ -29,10 +29,10 @@
2929
"@babel/core": "^7.15.5",
3030
"@babel/register": "^7.15.3",
3131
"@babel/runtime": "^7.15.4",
32-
"@polkadot/api": "6.0.3-0",
33-
"@polkadot/rpc-provider": "6.0.3-0",
34-
"@polkadot/types": "6.0.3-0",
35-
"@polkadot/types-support": "6.0.3-0",
32+
"@polkadot/api": "6.0.3",
33+
"@polkadot/rpc-provider": "6.0.3",
34+
"@polkadot/types": "6.0.3",
35+
"@polkadot/types-support": "6.0.3",
3636
"@polkadot/util": "^7.4.1",
3737
"handlebars": "^4.7.7",
3838
"websocket": "^1.0.34",

0 commit comments

Comments
 (0)