Additional typegen asserts (#2448)
* Additional typegen asserts * typo * Revert tuple assert * Free-standing Vec is valid
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 1.26.0-beta.x
|
||||
|
||||
- Update docs for the new `system.accuntNextIndex` (Thanks to https://github.com/shawntabrizi)
|
||||
- Adjust votingBalance to only return `freeBalance` (only council voting is free + reserved)
|
||||
- Additional checks for referenced Vec sub-type deconstruction in typegen
|
||||
- `@polkadot/util` 3.0
|
||||
|
||||
## 1.25.1 Jul 20, 2020
|
||||
|
||||
- **Important** Contract RPC result updated on Substrate, on older chains supply `ContractExecResult: 'ContractExecResultTo255'`
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"@polkadot/api": "1.26.0-beta.1",
|
||||
"@polkadot/rpc-core": "1.26.0-beta.1",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"bn.js": "^5.1.2",
|
||||
"rxjs": "^6.6.0"
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
"@polkadot/rpc-core": "1.26.0-beta.1",
|
||||
"@polkadot/rpc-provider": "1.26.0-beta.1",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util-crypto": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"@polkadot/util-crypto": "^3.0.0-beta.3",
|
||||
"bn.js": "^5.1.2",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.18.1"
|
||||
"@polkadot/keyring": "^3.0.0-beta.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/api-derive": "1.26.0-beta.1",
|
||||
"@polkadot/keyring": "^2.18.1",
|
||||
"@polkadot/keyring": "^3.0.0-beta.3",
|
||||
"@polkadot/metadata": "1.26.0-beta.1",
|
||||
"@polkadot/rpc-core": "1.26.0-beta.1",
|
||||
"@polkadot/rpc-provider": "1.26.0-beta.1",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/types-known": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util-crypto": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"@polkadot/util-crypto": "^3.0.0-beta.3",
|
||||
"bn.js": "^5.1.2",
|
||||
"eventemitter3": "^4.0.4",
|
||||
"rxjs": "^6.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.18.1"
|
||||
"@polkadot/keyring": "^3.0.0-beta.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/types-known": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util-crypto": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"@polkadot/util-crypto": "^3.0.0-beta.3",
|
||||
"bn.js": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.18.1"
|
||||
"@polkadot/keyring": "^3.0.0-beta.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
"@polkadot/metadata": "1.26.0-beta.1",
|
||||
"@polkadot/rpc-provider": "1.26.0-beta.1",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.18.1"
|
||||
"@polkadot/keyring": "^3.0.0-beta.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,15 @@
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/metadata": "1.26.0-beta.1",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util-crypto": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"@polkadot/util-crypto": "^3.0.0-beta.3",
|
||||
"bn.js": "^5.1.2",
|
||||
"eventemitter3": "^4.0.4",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"websocket": "^1.0.31"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.18.1",
|
||||
"@polkadot/keyring": "^3.0.0-beta.3",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.0.2"
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"@polkadot/metadata": "1.26.0-beta.1",
|
||||
"@polkadot/rpc-provider": "1.26.0-beta.1",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"handlebars": "^4.7.6",
|
||||
"websocket": "^1.0.31",
|
||||
"yargs": "^15.4.1"
|
||||
|
||||
@@ -92,18 +92,22 @@ export function getSimilarTypes (definitions: Record<string, ModuleTypes>, regis
|
||||
const Clazz = ClassOfUnsafe(registry, type);
|
||||
|
||||
if (isChildClass(Vec, Clazz)) {
|
||||
const subDef = (getTypeDef(type).sub) as TypeDef;
|
||||
const vecDef = getTypeDef(type);
|
||||
const subDef = (vecDef.sub) as TypeDef;
|
||||
|
||||
if (subDef.info === TypeDefInfo.Plain) {
|
||||
possibleTypes.push(`(${getSimilarTypes(definitions, registry, subDef.type, imports).join(' | ')})[]`);
|
||||
} else if (subDef.info === TypeDefInfo.Tuple) {
|
||||
const subs = (subDef.sub as TypeDef[]).map(({ type }): string =>
|
||||
getSimilarTypes(definitions, registry, type, imports).join(' | ')
|
||||
);
|
||||
// this could be that we define a Vec type and refer to it by name
|
||||
if (subDef) {
|
||||
if (subDef.info === TypeDefInfo.Plain) {
|
||||
possibleTypes.push(`(${getSimilarTypes(definitions, registry, subDef.type, imports).join(' | ')})[]`);
|
||||
} else if (subDef.info === TypeDefInfo.Tuple) {
|
||||
const subs = (subDef.sub as TypeDef[]).map(({ type }): string =>
|
||||
getSimilarTypes(definitions, registry, type, imports).join(' | ')
|
||||
);
|
||||
|
||||
possibleTypes.push(`([${subs.join(', ')}])[]`);
|
||||
} else {
|
||||
throw new Error(`Unhandled subtype in Vec, ${JSON.stringify(subDef)}`);
|
||||
possibleTypes.push(`([${subs.join(', ')}])[]`);
|
||||
} else {
|
||||
throw new Error(`Unhandled subtype in Vec, ${JSON.stringify(subDef)}`);
|
||||
}
|
||||
}
|
||||
} else if (isChildClass(Enum, Clazz)) {
|
||||
const e = new (Clazz as Constructor)(registry) as Enum;
|
||||
@@ -141,8 +145,10 @@ export function getSimilarTypes (definitions: Record<string, ModuleTypes>, regis
|
||||
} else if (isChildClass(String, Clazz)) {
|
||||
possibleTypes.push('string');
|
||||
} else if (isChildClass(Tuple, Clazz)) {
|
||||
const subDef = getTypeDef(type).sub;
|
||||
const tupDef = getTypeDef(type);
|
||||
const subDef = tupDef.sub;
|
||||
|
||||
// this could be that we define a Tuple type and refer to it by name
|
||||
if (Array.isArray(subDef)) {
|
||||
const subs = subDef.map(({ type }) => getSimilarTypes(definitions, registry, type, imports).join(' | '));
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/types": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"bn.js": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/metadata": "1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util-crypto": "^2.18.1",
|
||||
"@polkadot/util": "^3.0.0-beta.3",
|
||||
"@polkadot/util-crypto": "^3.0.0-beta.3",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^5.1.2",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.18.1",
|
||||
"@polkadot/keyring": "^3.0.0-beta.3",
|
||||
"@types/memoizee": "^0.4.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1328,7 +1328,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/runtime@npm:^7.10.4, @babel/runtime@npm:^7.10.5, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.6":
|
||||
"@babel/runtime@npm:^7.10.5, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.6":
|
||||
version: 7.10.5
|
||||
resolution: "@babel/runtime@npm:7.10.5"
|
||||
dependencies:
|
||||
@@ -2660,7 +2660,7 @@ __metadata:
|
||||
"@polkadot/api": 1.26.0-beta.1
|
||||
"@polkadot/rpc-core": 1.26.0-beta.1
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
bn.js: ^5.1.2
|
||||
rxjs: ^6.6.0
|
||||
languageName: unknown
|
||||
@@ -2672,12 +2672,12 @@ __metadata:
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/api": 1.26.0-beta.1
|
||||
"@polkadot/keyring": ^2.18.1
|
||||
"@polkadot/keyring": ^3.0.0-beta.3
|
||||
"@polkadot/rpc-core": 1.26.0-beta.1
|
||||
"@polkadot/rpc-provider": 1.26.0-beta.1
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util-crypto": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
"@polkadot/util-crypto": ^3.0.0-beta.3
|
||||
bn.js: ^5.1.2
|
||||
memoizee: ^0.4.14
|
||||
rxjs: ^6.6.0
|
||||
@@ -2690,14 +2690,14 @@ __metadata:
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/api-derive": 1.26.0-beta.1
|
||||
"@polkadot/keyring": ^2.18.1
|
||||
"@polkadot/keyring": ^3.0.0-beta.3
|
||||
"@polkadot/metadata": 1.26.0-beta.1
|
||||
"@polkadot/rpc-core": 1.26.0-beta.1
|
||||
"@polkadot/rpc-provider": 1.26.0-beta.1
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/types-known": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util-crypto": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
"@polkadot/util-crypto": ^3.0.0-beta.3
|
||||
bn.js: ^5.1.2
|
||||
eventemitter3: ^4.0.4
|
||||
rxjs: ^6.6.0
|
||||
@@ -2793,14 +2793,14 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/keyring@npm:^2.18.1":
|
||||
version: 2.18.1
|
||||
resolution: "@polkadot/keyring@npm:2.18.1"
|
||||
"@polkadot/keyring@npm:^3.0.0-beta.3":
|
||||
version: 3.0.0-beta.3
|
||||
resolution: "@polkadot/keyring@npm:3.0.0-beta.3"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.4
|
||||
"@polkadot/util": 2.18.1
|
||||
"@polkadot/util-crypto": 2.18.1
|
||||
checksum: 3/293c9a25c33234a85710b10a6a253b76930ba0be7b42825af6bfc19d47579c185133d7b793c3e34ac0de9189563f65949cf08bf8dabf04c02661c675ee87e41d
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/util": 3.0.0-beta.3
|
||||
"@polkadot/util-crypto": 3.0.0-beta.3
|
||||
checksum: 3/38e19ebe85db6a03828481b6302e985a49070ebb934c269e5e0962862015f1aa7db5b8d6573dcfd586b08f36ea7dba86c58a0d763896d87c26a501bb82d9f774
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2809,11 +2809,11 @@ __metadata:
|
||||
resolution: "@polkadot/metadata@workspace:packages/metadata"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/keyring": ^2.18.1
|
||||
"@polkadot/keyring": ^3.0.0-beta.3
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/types-known": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util-crypto": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
"@polkadot/util-crypto": ^3.0.0-beta.3
|
||||
bn.js: ^5.1.2
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
@@ -2823,11 +2823,11 @@ __metadata:
|
||||
resolution: "@polkadot/rpc-core@workspace:packages/rpc-core"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/keyring": ^2.18.1
|
||||
"@polkadot/keyring": ^3.0.0-beta.3
|
||||
"@polkadot/metadata": 1.26.0-beta.1
|
||||
"@polkadot/rpc-provider": 1.26.0-beta.1
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
memoizee: ^0.4.14
|
||||
rxjs: ^6.6.0
|
||||
languageName: unknown
|
||||
@@ -2838,11 +2838,11 @@ __metadata:
|
||||
resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/keyring": ^2.18.1
|
||||
"@polkadot/keyring": ^3.0.0-beta.3
|
||||
"@polkadot/metadata": 1.26.0-beta.1
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util-crypto": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
"@polkadot/util-crypto": ^3.0.0-beta.3
|
||||
bn.js: ^5.1.2
|
||||
eventemitter3: ^4.0.4
|
||||
isomorphic-fetch: ^2.2.1
|
||||
@@ -2872,7 +2872,7 @@ __metadata:
|
||||
"@polkadot/metadata": 1.26.0-beta.1
|
||||
"@polkadot/rpc-provider": 1.26.0-beta.1
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
"@types/websocket": ^1.0.1
|
||||
"@types/yargs": ^15.0.5
|
||||
handlebars: ^4.7.6
|
||||
@@ -2893,7 +2893,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/types": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
"@types/bn.js": ^4.11.6
|
||||
bn.js: ^5.1.2
|
||||
languageName: unknown
|
||||
@@ -2904,10 +2904,10 @@ __metadata:
|
||||
resolution: "@polkadot/types@workspace:packages/types"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/keyring": ^2.18.1
|
||||
"@polkadot/keyring": ^3.0.0-beta.3
|
||||
"@polkadot/metadata": 1.26.0-beta.1
|
||||
"@polkadot/util": ^2.18.1
|
||||
"@polkadot/util-crypto": ^2.18.1
|
||||
"@polkadot/util": ^3.0.0-beta.3
|
||||
"@polkadot/util-crypto": ^3.0.0-beta.3
|
||||
"@types/bn.js": ^4.11.6
|
||||
"@types/memoizee": ^0.4.4
|
||||
bn.js: ^5.1.2
|
||||
@@ -2916,12 +2916,12 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/util-crypto@npm:2.18.1, @polkadot/util-crypto@npm:^2.18.1":
|
||||
version: 2.18.1
|
||||
resolution: "@polkadot/util-crypto@npm:2.18.1"
|
||||
"@polkadot/util-crypto@npm:3.0.0-beta.3, @polkadot/util-crypto@npm:^3.0.0-beta.3":
|
||||
version: 3.0.0-beta.3
|
||||
resolution: "@polkadot/util-crypto@npm:3.0.0-beta.3"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.4
|
||||
"@polkadot/util": 2.18.1
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/util": 3.0.0-beta.3
|
||||
"@polkadot/wasm-crypto": ^1.2.1
|
||||
base-x: ^3.0.8
|
||||
bip39: ^3.0.2
|
||||
@@ -2930,23 +2930,24 @@ __metadata:
|
||||
elliptic: ^6.5.3
|
||||
js-sha3: ^0.8.0
|
||||
pbkdf2: ^3.1.1
|
||||
scryptsy: ^2.1.0
|
||||
tweetnacl: ^1.0.3
|
||||
xxhashjs: ^0.2.2
|
||||
checksum: 3/412d3f1c0d0c318130808cdb6d0097fc0be915412e505d86e38ea7f2e131f0a7277b371bd4a9f41608d5220fc04f71de29409781f75f2a40399490827603f6fd
|
||||
checksum: 3/cc39d6fc7c693b0a278f6fa8042d9054fffd49931437bc974ba7f1646b212c48b84966b918e0595c851014dd35466815ac886b65f0fea33a032e559086f0cb03
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/util@npm:2.18.1, @polkadot/util@npm:^2.18.1":
|
||||
version: 2.18.1
|
||||
resolution: "@polkadot/util@npm:2.18.1"
|
||||
"@polkadot/util@npm:3.0.0-beta.3, @polkadot/util@npm:^3.0.0-beta.3":
|
||||
version: 3.0.0-beta.3
|
||||
resolution: "@polkadot/util@npm:3.0.0-beta.3"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.4
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@types/bn.js": ^4.11.6
|
||||
bn.js: ^5.1.2
|
||||
camelcase: ^5.3.1
|
||||
chalk: ^4.1.0
|
||||
ip-regex: ^4.1.0
|
||||
checksum: 3/df6cb63e7d5cff1f0075e7807b76c6ea26c1a52f887dc20558d8717cde81713fa391cfd17dd82792f4c6271be30f143d3a11c816b7c00eaeea1d411fe5208e71
|
||||
checksum: 3/93156add0469b8013a424ea25813c2c4f4ab16c1ab6fb20e85a66963f31a77b4a581bde69e711a7e25d167980fddba11ef5e2bd15a041eb7c592961112659789
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -16228,6 +16229,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"scryptsy@npm:^2.1.0":
|
||||
version: 2.1.0
|
||||
resolution: "scryptsy@npm:2.1.0"
|
||||
checksum: 3/9fd847955caa9d13a6d58a0360ba8fb31f8e7e7da9250b4c09c67db784a0f6dda757bc837313b0860c0e35f84a56ba068394c682dd4fba81c5899d82832aa7d6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"section-matter@npm:^1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "section-matter@npm:1.0.0"
|
||||
|
||||
Reference in New Issue
Block a user