Skip to content

Commit 421594b

Browse files
authored
Fix .at check, disable (release 1.6.2) (#2034)
* Fix .at check, disable (release 1.6.2) * Remove isAt (keep at revert only) * Grrr.... * yarn installl (really need to add this to version bump script)
1 parent 2e79c25 commit 421594b

File tree

14 files changed

+113
-102
lines changed

14 files changed

+113
-102
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# 1.6.2 Feb 27, 2020
2+
3+
- Revert checks for arg, not working on `.at()` queries (proper fix in next version)
4+
15
# 1.6.1 Mar 12, 2020
26

3-
- **Breaking change** `api.rpc.state.queryStorage(...)` now full decodes the `Vec<StorageChangeSet>` and returns a decoded `[Hash, Codec[]][]` when using this RPC.
7+
- **Breaking change** `api.rpc.state.queryStorage(...)` now fully decodes the `Vec<StorageChangeSet>` and returns a decoded `[Hash, Codec[]][]` when using this RPC.
48
- `StorageKey` now has an `.args` property, decoded from meta where `twox64_concat` or `blake128_concat` are used on maps
59
- Fix `api.query.*.*.entries` type conversions to return exact types (not `Option` in some cases)
610
- Add `api.query.*.*.keys` to retrieve only the storage keys, similar to `.entries`

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": "1.6.1"
12+
"version": "1.6.2"
1313
}

packages/api-contract/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-contract",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Interfaces for interacting with contracts and contract ABIs",
55
"main": "index.js",
66
"keywords": [
@@ -27,9 +27,9 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.4",
30-
"@polkadot/api": "1.6.1",
31-
"@polkadot/rpc-core": "1.6.1",
32-
"@polkadot/types": "1.6.1",
30+
"@polkadot/api": "1.6.2",
31+
"@polkadot/rpc-core": "1.6.2",
32+
"@polkadot/types": "1.6.2",
3333
"@polkadot/util": "^2.6.2",
3434
"bn.js": "^5.1.1",
3535
"rxjs": "^6.5.4"

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": "1.6.1",
3+
"version": "1.6.2",
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.8.4",
31-
"@polkadot/api": "1.6.1",
32-
"@polkadot/rpc-core": "1.6.1",
33-
"@polkadot/rpc-provider": "1.6.1",
34-
"@polkadot/types": "1.6.1",
31+
"@polkadot/api": "1.6.2",
32+
"@polkadot/rpc-core": "1.6.2",
33+
"@polkadot/rpc-provider": "1.6.2",
34+
"@polkadot/types": "1.6.2",
3535
"@polkadot/util": "^2.6.2",
3636
"@polkadot/util-crypto": "^2.6.2",
3737
"bn.js": "^5.1.1",

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": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
55
"main": "index.js",
66
"keywords": [
@@ -27,12 +27,12 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.4",
30-
"@polkadot/api-derive": "1.6.1",
30+
"@polkadot/api-derive": "1.6.2",
3131
"@polkadot/keyring": "^2.6.2",
32-
"@polkadot/metadata": "1.6.1",
33-
"@polkadot/rpc-core": "1.6.1",
34-
"@polkadot/rpc-provider": "1.6.1",
35-
"@polkadot/types": "1.6.1",
32+
"@polkadot/metadata": "1.6.2",
33+
"@polkadot/rpc-core": "1.6.2",
34+
"@polkadot/rpc-provider": "1.6.2",
35+
"@polkadot/types": "1.6.2",
3636
"@polkadot/util": "^2.6.2",
3737
"@polkadot/util-crypto": "^2.6.2",
3838
"bn.js": "^5.1.1",

packages/api/src/util/validate.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { TypeRegistry } from '@polkadot/types';
1111

1212
import { extractStorageArgs } from './validate';
1313

14-
describe('extractStorageArgs', (): void => {
14+
describe.skip('extractStorageArgs', (): void => {
1515
const registry = new TypeRegistry();
1616
let storage: Storage;
1717

packages/api/src/util/validate.ts

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,53 @@
33
// of the Apache-2.0 license. See the LICENSE file for details.
44

55
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
6-
import { Type } from '@polkadot/types';
7-
import { assert } from '@polkadot/util';
86

9-
function sig ({ method, section }: StorageEntry, ...args: Type[]): string {
10-
return `${section}.${method}(${args.join(', ')})`;
11-
}
7+
// FIXME This breaks with .at(hash, ...)
128

13-
function doDoubleMap (creator: StorageEntry, args: any[]): [StorageEntry, [any, any]] {
14-
const { key1, key2 } = creator.meta.type.asDoubleMap;
9+
// import { Type } from '@polkadot/types';
10+
// import { assert } from '@polkadot/util';
1511

16-
assert(args.length === 2, `${sig(creator, key1, key2)} is a doublemap, requiring 2 arguments, ${args.length} found`);
12+
// function sig ({ method, section }: StorageEntry, ...args: Type[]): string {
13+
// return `${section}.${method}(${args.join(', ')})`;
14+
// }
1715

18-
// pass as tuple
19-
return [creator, args as [any, any]];
20-
}
16+
// function doDoubleMap (creator: StorageEntry, args: any[]): [StorageEntry, [any, any]] {
17+
// const { key1, key2 } = creator.meta.type.asDoubleMap;
2118

22-
function doMap (creator: StorageEntry, args: any[]): [StorageEntry] | [StorageEntry, any] {
23-
const { key, linked } = creator.meta.type.asMap;
19+
// assert(args.length === 2, `${sig(creator, key1, key2)} is a doublemap, requiring 2 arguments, ${args.length} found`);
2420

25-
linked.isTrue
26-
? assert(args.length <= 1, `${sig(creator, key)} is a linked map, requiring either 0 arguments (retrieving all) or 1 argument, ${args.length} found`)
27-
: assert(args.length === 1, `${sig(creator, key)} is a map, requiring 1 argument, ${args.length} found`);
21+
// // pass as tuple
22+
// return [creator, args as [any, any]];
23+
// }
2824

29-
// expand
30-
return args.length
31-
? [creator, args[0]]
32-
: [creator];
33-
}
25+
// function doMap (creator: StorageEntry, args: any[]): [StorageEntry] | [StorageEntry, any] {
26+
// const { key, linked } = creator.meta.type.asMap;
27+
28+
// linked.isTrue
29+
// ? assert(args.length <= 1, `${sig(creator, key)} is a linked map, requiring either 0 arguments (retrieving all) or 1 argument, ${args.length} found`)
30+
// : assert(args.length === 1, `${sig(creator, key)} is a map, requiring 1 argument, ${args.length} found`);
31+
32+
// // expand
33+
// return args.length
34+
// ? [creator, args[0]]
35+
// : [creator];
36+
// }
3437

3538
// sets up the arguments in the form of [creator, args] ready to be used in a storage
3639
// call. Additionally, it verifies that the correct number of arguments have been passed
3740
export function extractStorageArgs (creator: StorageEntry, args: any[]): any[] {
38-
if (creator.meta.type.isDoubleMap) {
39-
return doDoubleMap(creator, args);
40-
} else if (creator.meta.type.isMap) {
41-
return doMap(creator, args);
42-
}
41+
return creator.meta.type.isDoubleMap
42+
? [creator, args]
43+
: [creator, ...args];
44+
45+
// if (creator.meta.type.isDoubleMap) {
46+
// return doDoubleMap(creator, args);
47+
// } else if (creator.meta.type.isMap) {
48+
// return doMap(creator, args);
49+
// }
4350

44-
assert(args.length === 0, `${sig(creator)} does not take any arguments, ${args.length} found`);
51+
// assert(args.length === 0, `${sig(creator)} does not take any arguments, ${args.length} found`);
4552

46-
// no args
47-
return [creator];
53+
// // no args
54+
// return [creator, ...args];
4855
}

packages/jsonrpc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/jsonrpc",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Method definitions for the Polkadot RPC layer",
55
"main": "index.js",
66
"publishConfig": {
@@ -27,7 +27,7 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/jsonrpc#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.4",
30-
"@polkadot/types": "1.6.1",
30+
"@polkadot/types": "1.6.2",
3131
"@polkadot/util": "^2.6.2"
3232
}
3333
}

packages/metadata/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/metadata",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Helpers to extract information from runtime metadata",
55
"main": "index.js",
66
"publishConfig": {
@@ -27,7 +27,7 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.4",
30-
"@polkadot/types": "1.6.1",
30+
"@polkadot/types": "1.6.2",
3131
"@polkadot/util": "^2.6.2",
3232
"@polkadot/util-crypto": "^2.6.2",
3333
"bn.js": "^5.1.1"

packages/rpc-core/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@polkadot/rpc-core",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
55
"main": "index.js",
66
"keywords": [
@@ -27,10 +27,10 @@
2727
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
2828
"dependencies": {
2929
"@babel/runtime": "^7.8.4",
30-
"@polkadot/jsonrpc": "1.6.1",
31-
"@polkadot/metadata": "1.6.1",
32-
"@polkadot/rpc-provider": "1.6.1",
33-
"@polkadot/types": "1.6.1",
30+
"@polkadot/jsonrpc": "1.6.2",
31+
"@polkadot/metadata": "1.6.2",
32+
"@polkadot/rpc-provider": "1.6.2",
33+
"@polkadot/types": "1.6.2",
3434
"@polkadot/util": "^2.6.2",
3535
"memoizee": "^0.4.14",
3636
"rxjs": "^6.5.4"

0 commit comments

Comments
 (0)