Compare commits

...
22 Commits
Author SHA1 Message Date
github-actions[bot] 80399fefcd [CI Skip] release/stable 7.4.1
skip-checks: true
2022-01-15 19:08:46 +00:00
Jaco ff9a0b3d44 7.4.1 (#4454)
* 7.4.1

* CHANGELOG
2022-01-15 21:00:41 +02:00
github-actions[bot] 8df82af638 [CI Skip] release/beta 7.3.2-9
skip-checks: true
2022-01-14 15:38:40 +00:00
Jaco ddfcc5624c Add Kusama 9150 upgrade block (#4449) 2022-01-14 17:29:01 +02:00
github-actions[bot] 7b08fbb695 [CI Skip] release/beta 7.3.2-8
skip-checks: true
2022-01-14 10:29:41 +00:00
Jaco 07d85783d8 Manual format of tsconfig.build.json (#4447) 2022-01-14 12:18:57 +02:00
github-actions[bot] f0d6fc0167 [CI Skip] release/beta 7.3.2-7
skip-checks: true
2022-01-13 08:17:43 +00:00
Jaco 7b085307f8 Update .mailmap 2022-01-13 10:07:16 +02:00
github-actions[bot] e22a38dd9c [CI Skip] release/beta 7.3.2-6
skip-checks: true
2022-01-12 08:53:34 +00:00
Jaco 2ceb727ee6 Update to tsconfig.build.json inside packages (#4444)
* Update to tsconfig.build.json inside packages

* Update refs
2022-01-12 10:44:56 +02:00
github-actions[bot] bc4e656745 [CI Skip] release/beta 7.3.2-5
skip-checks: true
2022-01-12 05:41:50 +00:00
Jaco 6d2b3b8463 Bump dev (w/ contrib update) (#4442) 2022-01-12 07:33:39 +02:00
github-actions[bot] 5369b6cb10 [CI Skip] release/beta 7.3.2-4
skip-checks: true
2022-01-11 14:22:33 +00:00
Jaco 53fd71b732 Mini-extracted test for Range values (#4441) 2022-01-11 16:14:26 +02:00
github-actions[bot] 63e38b3d1c [CI Skip] release/beta 7.3.2-3
skip-checks: true
2022-01-11 07:00:04 +00:00
Jaco cd98ac65f3 Add tsconfig.build.json (#4440) 2022-01-11 08:51:54 +02:00
github-actions[bot] 7bd0819cbb [CI Skip] release/beta 7.3.2-2
skip-checks: true
2022-01-11 05:44:03 +00:00
Jaco e84c2a5180 Asserts for number formats (#4439)
* Asserts for number formats

* Test for Compact (used base format asserts)

* Lint fixes
2022-01-11 07:33:25 +02:00
github-actions[bot] aabf4b3e45 [CI Skip] release/beta 7.3.2-1
skip-checks: true
2022-01-10 16:27:00 +00:00
Jaco 0f67d3e54d Ensure Range/RangeInclusive variant check does not fail on encoding (#4437) 2022-01-10 18:19:23 +02:00
github-actions[bot] 8cbc36550b [CI Skip] release/beta 7.3.2-0
skip-checks: true
2022-01-10 08:30:42 +00:00
Jaco 25c46f2a0d Ensure non-option calls in api-contract are marked as @deprecated (#4433) 2022-01-10 10:21:06 +02:00
78 changed files with 999 additions and 853 deletions
+2
View File
@@ -1 +1,3 @@
Jaco <jacogr@gmail.com>
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> <action@github.com>
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Github Actions <action@github.com>
+13
View File
@@ -1,5 +1,18 @@
# CHANGELOG
## 7.4.1 Jan 15, 2022
Upgrade priority: Medium. Required for all chains using `Range` and `RangeInclusive` types. Also includes better error handling for number conversions.
Changes:
- Asserts for invalid number format inputs (MAX_SAFE_INTEGER, float)
- Ensure `Range/RangeInclusive` variant check does not fail on encoding
- Ensure non-option calls in api-contract are marked as `@deprecated`
- Added Kusama 9150 upgrade block (known types)
- Update `@polkadot/util` to 8.3.2
## 7.3.1 Jan 9, 2022
Upgrade priority: Low. Maintenance upgrade, tracking the latest `@polkadot` libraries.
+91 -91
View File
@@ -1,91 +1,91 @@
2752 Jaco
83 Amaury Martiny
36 Keith Ingram
35 Stefanie Doll
20 Luke Schoen
15 Jeremías Díaz
15 Xiliang Chen
11 Ian He
10 Axel Chalon
5 Chevdor
5 Jake Naviasky
4 Alex Wang
4 Alexander Popiak
4 Joshy Orndorff
4 Nantian
4 Thibaut Sardan
3 Alex D
3 André Silva
3 Antoine Estienne
3 Arjan Zijderveld
3 Ewa Kowalska
3 hamidra
3 Hamza Tokuchi
3 Julien Eluard
3 KarishmaBothara
3 Miguel Hervas
3 Shawn Tabrizi
3 YJ
2 Alexander Krupenkin
2 Branan Riley
2 Caio
2 Jakub Pánik
2 James Lefrère
2 Keith Yeung
2 Nikos Kontakis
2 Paweł Nguyen
2 sung wu
2 Veliko
2 Wei Tang
2 扩散性百万甜面包
1 Andreea Eftene
1 Brad Larson
1 chriswmercer
1 codingsh
1 Dan Forbes
1 Daniel Maricic
1 Daniel Savu
1 David
1 Denis Tsai
1 djuanito.eth
1 Drew Stone
1 Dylan Galea
1 flex
1 Furqan A
1 Gerben van de Wiel
1 HackFisher
1 Hoani Bryson
1 Hyungsuk Kang
1 icodezjb
1 iiiiiiii
1 JesseAbram
1 Joey
1 Jordan
1 JQQQ
1 Kian Paimani
1 Krzysztof Jelski
1 Lae
1 Lezek123
1 Lovesh Harchandani
1 Mario Neises
1 Mario Pino
1 Mark Robert Henderson
1 Matej Nemček
1 Mokhtar Naamani
1 Nazar Mokrynskyi
1 Nikhil Ranjan
1 Nikolay Volf
1 Paul M Fox
1 philipstanislaus
1 qiuhao
1 Rocco Musolino
1 satellitex
1 satellitex
1 Satyam Agrawal
1 Sean Young
1 Sergei Pepyakin
1 WoeOm
1 Xat_MassacrE
1 yjh
1 Yuri
1 Zeke Mostov
2763 Jaco 7.4.1 (#4454)
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
36 Keith Ingram Storage deposit limit changes (#4370)
35 Stefanie Doll Updated child storage parameters (#1709)
20 Luke Schoen fix: Fixes TypeError: Cannot read property 'vesting' of undefined (#1970)
15 Jeremías Díaz feat(types): add correct tuple type to storage key (#3054)
15 Xiliang Chen add Authority origin (#3645)
11 Ian He HttpProvider support clone() (#3949)
10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954)
5 Chevdor Fix metadata package link (#3458)
5 Jake Naviasky Fixing approvalFlagsToBools. (#1250)
4 Alex Wang fix issue that creates duplicate providers (#983)
4 Alexander Popiak Add asset id in signing (#4009)
4 Joshy Orndorff spelling; efect -> effect (#2295)
4 Nantian fix bigint type (#3869)
4 Thibaut Sardan no subscription for http (#3127)
3 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
3 André Silva add support for ValidationCodeHash (#3640)
3 Antoine Estienne Adapted to display moonbeam author (#3108)
3 Arjan Zijderveld Added `Emergency` to `ElectionPhase` (#3707)
3 Ewa Kowalska Handle no council for bounties proposals (#3062)
3 hamidra add support for n key entries for NMaps (#3886)
3 Hamza Tokuchi more typos (#2532)
3 Julien Eluard Fixed typos about module balances (#1402)
3 KarishmaBothara Backward compatibility thing (#3511)
3 Miguel Hervas Adding RT4 Types (#3007)
3 Shawn Tabrizi Add `isReadyOrError` when connecting to API (#2577)
3 YJ feat: Vote interface as U8a (#1061)
2 Alexander Krupenkin Add [u8; 33] type width for U8aFixed type (#2391)
2 Branan Riley Add proxy type for Centrifuge (#3940)
2 Caio Add `Range` and `RangeInclusive` types (#3791)
2 Jakub Pánik All heads subscription (#1899)
2 James Lefrère Add `.eq()` usage to docs and fix docs typos (#1405)
2 Keith Yeung Allow keyPrefix to accept an additional argument for double maps (#2230)
2 Nikos Kontakis Add auction in shared types (#4085)
2 Paweł Nguyen Fix a minor typo in cookbook blocks docs (#2294)
2 sung wu Update tx.md (#2485)
2 Veliko Abi constructor takes different parameters (#3347)
2 Wei Tang Use /usr/bin/env bash instead of /bin/bash (#2053)
2 扩散性百万甜面包 Typo, deocrateMethod -> decorateMethod (#1594)
1 Andreea Eftene Add storage deposit support (#4304)
1 Brad Larson [NEW] Support for custom headers with providers (#2423)
1 chriswmercer little readme tweak (#279)
1 codingsh #2182 - add: search for docs (#2232)
1 Dan Forbes Add WeightToFeeCoefficient type (#2296)
1 Daniel Maricic Fixed typo in README (#2402)
1 Daniel Savu fix: Generate custom type definitions (#4224)
1 David Don't log full error (#2952)
1 Denis Tsai realign AccountKey20Junction to polkadot xcm's Junction enum (#3770)
1 djuanito.eth Update fees to current constants (#2320)
1 Drew Stone Update evm definitions to include vicinity (#2279)
1 Dylan Galea Updated users of the polkadot-js/api (#2027)
1 flex Change BeefySignedCommitment signatures type to EcdsaSignature (#4204)
1 Furqan A fix: fixed 404 to the docs from the api readme (#3985)
1 Gerben van de Wiel Adding some extra notes on changes in the specname (#2329)
1 HackFisher fix OutboundLaneData types (#3992)
1 Hoani Bryson Multiple Endpoint support for WsProvider (#2234)
1 Hyungsuk Kang Update fees.ts (#1014)
1 icodezjb Update SessionKeys (#3035)
1 iiiiiiii Make unknownTypes externally accessible (#3263)
1 JesseAbram added 07 Example showing how to make a transfer with allowed block permissions folder in docs (#1062)
1 Joey don't throw error at `onSocketClose` (#4363)
1 Jordan Allow typegen for custom RPCs (#2876)
1 JQQQ Allow rpc expose definition/ metadata (#3488)
1 Kian Paimani Update definitions.ts (#2514)
1 Krzysztof Jelski Derive for bounties and descriptions (#2925)
1 Lae Make sure awaiting on an api object won't stuck forever on error (#1763)
1 Lezek123 BTreeSet and BTreeMap - encoding and serialization fixes (#3789)
1 Lovesh Harchandani Fix name of "getBlock" in package "api-derive" and export it in "index.ts" (#2857)
1 Mario Neises fix usage with typescript (#405)
1 Mario Pino Add PolkaStats to API users (#1593)
1 Mark Robert Henderson Update warnings.ts to have the latest URLs (#2720)
1 Matej Nemček added Kodadot to @polkadot/api users section (#2220)
1 Mokhtar Naamani Disable websocket outgoing message fragmentation for w3cwebsocket (#2738)
1 Nazar Mokrynskyi Performance tweaks (#4143)
1 Nikhil Ranjan add vestingPerBlock and vestingEndBlock in DeriveBalancesAll when doing calcBalances (#2563)
1 Nikolay Volf Fix typo (#1730)
1 Paul M Fox Basic BTreeMaps codec support (#1474)
1 philipstanislaus Update types for centrifuge chain v1.2.0 (#2424)
1 qiuhao update DeriveCustom type (#2581)
1 Rocco Musolino remove broken link (#2671)
1 satellitex Add BTreeSet<V> Codec (#1639)
1 satellitex Add traits replace rules. for invalid cases `::<type>` and `<type>::`. (#885)
1 Satyam Agrawal update as per the 0.97.0-beta.38 release (#1617)
1 Sean Young Solang requires u256 and i256 types (#2752)
1 Sergei Pepyakin INK! -> ink! (#1347)
1 WoeOm adapt Darwinia, Crab Network types (#3498)
1 Xat_MassacrE Fix packages/types/src/codec/utils/encodeTypes.ts encodeSubTypes bug (#1544)
1 yjh fix MetadataVersioned.asV12 (#2983)
1 Yuri fixes #3693 Fix uniques return types (#3694)
1 Zeke Mostov fix: Allow sudo for polkadot indexed proxy enum (#3286)
+3 -3
View File
@@ -11,7 +11,7 @@
},
"sideEffects": false,
"type": "commonjs",
"version": "7.3.1",
"version": "7.4.1",
"workspaces": [
"packages/*"
],
@@ -32,9 +32,9 @@
},
"devDependencies": {
"@babel/core": "^7.16.7",
"@babel/register": "^7.16.7",
"@babel/register": "^7.16.9",
"@babel/runtime": "^7.16.7",
"@polkadot/dev": "^0.65.23",
"@polkadot/dev": "^0.65.37",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.4.0",
"copyfiles": "^2.4.1"
+7 -7
View File
@@ -20,15 +20,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/api-base": "7.3.1",
"@polkadot/rpc-augment": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-augment": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/util": "^8.3.1"
"@polkadot/api-base": "7.4.1",
"@polkadot/rpc-augment": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/types-augment": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/util": "^8.3.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '7.4.1' };
+19
View File
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/kusama/*.ts",
"**/polkadot/*.ts"
],
"references": [
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" }
]
}
-19
View File
@@ -1,19 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/kusama/*.ts",
"**/polkadot/*.ts"
],
"references": [
{ "path": "../api-base" },
{ "path": "../rpc-augment" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-augment" }
]
}
+5 -5
View File
@@ -10,10 +10,10 @@
"**/kusama/*.ts"
],
"references": [
{ "path": "../api-base" },
{ "path": "../rpc-augment" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-augment" }
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" }
]
}
+5 -5
View File
@@ -10,10 +10,10 @@
"**/polkadot/*.ts"
],
"references": [
{ "path": "../api-base" },
{ "path": "../rpc-augment" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-augment" }
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" }
]
}
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/rpc-core": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/util": "^8.3.1",
"rxjs": "^7.5.1"
"@polkadot/rpc-core": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/util": "^8.3.2",
"rxjs": "^7.5.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -6,7 +6,7 @@
"rootDir": "./src"
},
"references": [
{ "path": "../types" },
{ "path": "../types-codec" }
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" }
]
}
+10 -10
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/api": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/types-create": "7.3.1",
"@polkadot/util": "^8.3.1",
"@polkadot/util-crypto": "^8.3.1",
"rxjs": "^7.5.1"
"@polkadot/api": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/types-create": "7.4.1",
"@polkadot/util": "^8.3.2",
"@polkadot/util-crypto": "^8.3.2",
"rxjs": "^7.5.2"
},
"devDependencies": {
"@polkadot/api-augment": "7.3.1",
"@polkadot/keyring": "^8.3.1"
"@polkadot/api-augment": "7.4.1",
"@polkadot/keyring": "^8.3.2"
}
}
+4
View File
@@ -10,21 +10,25 @@ import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions
export interface BlueprintDeploy<ApiType extends ApiTypes> {
(options: BlueprintOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
// @deprecated Use options form (to be dropped in a major update)
(value: bigint | string | number | BN, gasLimit: bigint | string | number | BN, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
}
export interface ContractQuery<ApiType extends ApiTypes> {
(origin: AccountId | string | Uint8Array, options: ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
// @deprecated Use options form (to be dropped in a major update)
(origin: AccountId | string | Uint8Array, value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
}
export interface ContractTx<ApiType extends ApiTypes> {
(options: ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
// @deprecated Use options form (to be dropped in a major update)
(value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
}
export interface ContractGeneric<O, T> {
(messageOrId: AbiMessage | string | number, options: O, ...params: unknown[]): T;
// @deprecated Use options form (to be dropped in a major update)
(messageOrId: AbiMessage | string | number, value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): T;
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -14,9 +14,9 @@
"mock.ts"
],
"references": [
{ "path": "../api" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-create" }
{ "path": "../api/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-create/tsconfig.build.json" }
]
}
+4 -4
View File
@@ -17,9 +17,9 @@
"mock.ts"
],
"references": [
{ "path": "../api" },
{ "path": "../api-augment" },
{ "path": "../api-contract" },
{ "path": "../types" }
{ "path": "../api/tsconfig.build.json" },
{ "path": "../api-augment/tsconfig.build.json" },
{ "path": "../api-contract/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" }
]
}
+15 -15
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/api": "7.3.1",
"@polkadot/api-augment": "7.3.1",
"@polkadot/api-base": "7.3.1",
"@polkadot/rpc-core": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/util": "^8.3.1",
"@polkadot/util-crypto": "^8.3.1",
"rxjs": "^7.5.1"
"@polkadot/api": "7.4.1",
"@polkadot/api-augment": "7.4.1",
"@polkadot/api-base": "7.4.1",
"@polkadot/rpc-core": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/util": "^8.3.2",
"@polkadot/util-crypto": "^8.3.2",
"rxjs": "^7.5.2"
},
"devDependencies": {
"@polkadot/api": "7.3.1",
"@polkadot/api-augment": "7.3.1",
"@polkadot/rpc-augment": "7.3.1",
"@polkadot/rpc-provider": "7.3.1",
"@polkadot/types-support": "7.3.1"
"@polkadot/api": "7.4.1",
"@polkadot/api-augment": "7.4.1",
"@polkadot/rpc-augment": "7.4.1",
"@polkadot/rpc-provider": "7.4.1",
"@polkadot/types-support": "7.4.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '7.4.1' };
+20
View File
@@ -0,0 +1,20 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/test/*",
"**/checkTypes.manual.ts",
"**/*.spec.ts"
],
"references": [
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../api-augment/tsconfig.build.json" },
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" }
]
}
-20
View File
@@ -1,20 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/test/*",
"**/checkTypes.manual.ts",
"**/*.spec.ts"
],
"references": [
{ "path": "../api-base" },
{ "path": "../api-augment" },
{ "path": "../rpc-core" },
{ "path": "../types" },
{ "path": "../types-codec" }
]
}
+10 -10
View File
@@ -13,15 +13,15 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../api" },
{ "path": "../api-augment" },
{ "path": "../api-base" },
{ "path": "../api-derive" },
{ "path": "../rpc-augment" },
{ "path": "../rpc-provider" },
{ "path": "../types" },
{ "path": "../types-augment" },
{ "path": "../types-codec" },
{ "path": "../types-support" }
{ "path": "../api/tsconfig.build.json" },
{ "path": "../api-augment/tsconfig.build.json" },
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../api-derive/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../rpc-provider/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-support/tsconfig.build.json" }
]
}
+18 -18
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/api-augment": "7.3.1",
"@polkadot/api-base": "7.3.1",
"@polkadot/api-derive": "7.3.1",
"@polkadot/keyring": "^8.3.1",
"@polkadot/rpc-augment": "7.3.1",
"@polkadot/rpc-core": "7.3.1",
"@polkadot/rpc-provider": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-augment": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/types-create": "7.3.1",
"@polkadot/types-known": "7.3.1",
"@polkadot/util": "^8.3.1",
"@polkadot/util-crypto": "^8.3.1",
"@polkadot/api-augment": "7.4.1",
"@polkadot/api-base": "7.4.1",
"@polkadot/api-derive": "7.4.1",
"@polkadot/keyring": "^8.3.2",
"@polkadot/rpc-augment": "7.4.1",
"@polkadot/rpc-core": "7.4.1",
"@polkadot/rpc-provider": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/types-augment": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/types-create": "7.4.1",
"@polkadot/types-known": "7.4.1",
"@polkadot/util": "^8.3.2",
"@polkadot/util-crypto": "^8.3.2",
"eventemitter3": "^4.0.7",
"rxjs": "^7.5.1"
"rxjs": "^7.5.2"
},
"devDependencies": {
"@polkadot/api-augment": "7.3.1",
"@polkadot/types-support": "7.3.1"
"@polkadot/api-augment": "7.4.1",
"@polkadot/types-support": "7.4.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '7.4.1' };
+23
View File
@@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/checkTypes.manual.ts",
"**/*.spec.ts",
"**/test/**/*"
],
"references": [
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../api-derive/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../rpc-provider/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-known/tsconfig.build.json" }
]
}
-23
View File
@@ -1,23 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/checkTypes.manual.ts",
"**/*.spec.ts",
"**/test/**/*"
],
"references": [
{ "path": "../api-base" },
{ "path": "../api-derive" },
{ "path": "../rpc-augment" },
{ "path": "../rpc-core" },
{ "path": "../rpc-provider" },
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-known" }
]
}
+9 -9
View File
@@ -13,14 +13,14 @@
"**/test/**/*"
],
"references": [
{ "path": "../api" },
{ "path": "../api-augment" },
{ "path": "../api-base" },
{ "path": "../api-derive" },
{ "path": "../rpc-core" },
{ "path": "../rpc-provider" },
{ "path": "../types" },
{ "path": "../types-known" },
{ "path": "../types-support" }
{ "path": "../api/tsconfig.build.json" },
{ "path": "../api-augment/tsconfig.build.json" },
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../api-derive/tsconfig.build.json" },
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../rpc-provider/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-known/tsconfig.build.json" },
{ "path": "../types-support/tsconfig.build.json" }
]
}
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/rpc-core": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/util": "^8.3.1"
"@polkadot/rpc-core": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/util": "^8.3.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -6,8 +6,8 @@
"rootDir": "./src"
},
"references": [
{ "path": "../rpc-core" },
{ "path": "../types" },
{ "path": "../types-codec" }
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" }
]
}
+8 -8
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/rpc-augment": "7.3.1",
"@polkadot/rpc-provider": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/util": "^8.3.1",
"rxjs": "^7.5.1"
"@polkadot/rpc-augment": "7.4.1",
"@polkadot/rpc-provider": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/util": "^8.3.2",
"rxjs": "^7.5.2"
},
"devDependencies": {
"@polkadot/keyring": "^8.3.1",
"@polkadot/rpc-augment": "7.3.1"
"@polkadot/keyring": "^8.3.2",
"@polkadot/rpc-augment": "7.4.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -10,7 +10,7 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../rpc-provider" },
{ "path": "../types" }
{ "path": "../rpc-provider/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" }
]
}
+4 -4
View File
@@ -12,9 +12,9 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../rpc-core" },
{ "path": "../rpc-augment" },
{ "path": "../rpc-provider" },
{ "path": "../types" }
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../rpc-provider/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" }
]
}
+10 -10
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/keyring": "^8.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-support": "7.3.1",
"@polkadot/util": "^8.3.1",
"@polkadot/util-crypto": "^8.3.1",
"@polkadot/x-fetch": "^8.3.1",
"@polkadot/x-global": "^8.3.1",
"@polkadot/x-ws": "^8.3.1",
"@polkadot/keyring": "^8.3.2",
"@polkadot/types": "7.4.1",
"@polkadot/types-support": "7.4.1",
"@polkadot/util": "^8.3.2",
"@polkadot/util-crypto": "^8.3.2",
"@polkadot/x-fetch": "^8.3.2",
"@polkadot/x-global": "^8.3.2",
"@polkadot/x-ws": "^8.3.2",
"eventemitter3": "^4.0.7",
"mock-socket": "^9.0.8",
"nock": "^13.2.1"
"nock": "^13.2.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -10,7 +10,7 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../types" },
{ "path": "../types-support" }
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-support/tsconfig.build.json" }
]
}
+2 -2
View File
@@ -12,7 +12,7 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../rpc-provider" },
{ "path": "../types" }
{ "path": "../rpc-provider/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" }
]
}
+13 -13
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -31,19 +31,19 @@
},
"dependencies": {
"@babel/core": "^7.16.7",
"@babel/register": "^7.16.7",
"@babel/register": "^7.16.9",
"@babel/runtime": "^7.16.7",
"@polkadot/api": "7.3.1",
"@polkadot/api-augment": "7.3.1",
"@polkadot/rpc-augment": "7.3.1",
"@polkadot/rpc-provider": "7.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-augment": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/types-create": "7.3.1",
"@polkadot/types-support": "7.3.1",
"@polkadot/util": "^8.3.1",
"@polkadot/x-ws": "^8.3.1",
"@polkadot/api": "7.4.1",
"@polkadot/api-augment": "7.4.1",
"@polkadot/rpc-augment": "7.4.1",
"@polkadot/rpc-provider": "7.4.1",
"@polkadot/types": "7.4.1",
"@polkadot/types-augment": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/types-create": "7.4.1",
"@polkadot/types-support": "7.4.1",
"@polkadot/util": "^8.3.2",
"@polkadot/x-ws": "^8.3.2",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.3.1"
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '7.4.1' };
+19
View File
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
{ "path": "../api/tsconfig.build.json" },
{ "path": "../api-augment/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../rpc-provider/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-create/tsconfig.build.json" },
{ "path": "../types-support/tsconfig.build.json" }
]
}
-19
View File
@@ -1,19 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
{ "path": "../api" },
{ "path": "../api-augment" },
{ "path": "../rpc-augment" },
{ "path": "../rpc-provider" },
{ "path": "../types" },
{ "path": "../types-augment" },
{ "path": "../types-codec" },
{ "path": "../types-create" },
{ "path": "../types-support" }
]
}
+4 -4
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/types": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/util": "^8.3.1"
"@polkadot/types": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/util": "^8.3.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -6,7 +6,7 @@
"rootDir": "./src"
},
"references": [
{ "path": "../rpc-core" },
{ "path": "../types" }
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" }
]
}
+6 -6
View File
@@ -20,16 +20,16 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/util": "^8.3.1"
"@polkadot/util": "^8.3.2"
},
"devDependencies": {
"@polkadot/types": "7.3.1",
"@polkadot/types-augment": "7.3.1",
"@polkadot/types-support": "7.3.1",
"@polkadot/util-crypto": "^8.3.1"
"@polkadot/types": "7.4.1",
"@polkadot/types-augment": "7.4.1",
"@polkadot/types-support": "7.4.1",
"@polkadot/util-crypto": "^8.3.2"
}
}
@@ -4,7 +4,7 @@
import type { HexString } from '@polkadot/util/types';
import type { AnyNumber, CodecRegistry, INumber, IU8a, UIntBitLength } from '../types';
import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBn, isHex, isU8a, u8aToBn } from '@polkadot/util';
import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBn, isHex, isNumber, isString, isU8a, u8aToBn } from '@polkadot/util';
export const DEFAULT_UINT_BITS = 64;
@@ -32,6 +32,10 @@ function decodeAbstractInt (value: AnyNumber, bitLength: UIntBitLength, isNegati
return value.toString();
} else if (isHex(value, -1, true)) {
return hexToBn(value, { isLe: false, isNegative }).toString();
} else if (isNumber(value)) {
assert(value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER && Math.floor(value) === value, 'Number needs to be an integer <= Number.MAX_SAFE_INTEGER, i.e. 2 ^ 53 - 1');
} else if (isString(value)) {
assert(!(value.includes('.') || value.includes(',') || value.includes('e')), 'String should not contain decimal points or scientific notation');
}
return bnToBn(value).toString();
@@ -9,6 +9,11 @@ describe('Compact', (): void => {
const registry = new TypeRegistry();
describe('constructor', (): void => {
it('fails on > MAX_SAFE_INTEGER', (): void => {
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
expect(() => new Compact(registry, 'u128', 9007199254740999)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
});
it('has support for BigInt', (): void => {
expect(
new Compact(registry, 'u128', 123456789000123456789n).toHuman()
@@ -8,6 +8,19 @@ import { BN, BN_TWO, isBn } from '@polkadot/util';
describe('UInt', (): void => {
const registry = new TypeRegistry();
it('fails on > MAX_SAFE_INTEGER and float', (): void => {
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
expect(() => new UInt(registry, 9007199254740999)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
expect(() => new UInt(registry, -9007199254740999)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
expect(() => new UInt(registry, 9.123)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
});
it('fails on strings with decimal points & scientific notation', (): void => {
expect(() => new UInt(registry, '123.4')).toThrow(/not contain decimal points/);
expect(() => new UInt(registry, '9e10')).toThrow(/not contain decimal points/);
});
it('decodes an empty Uint8array correctly', (): void => {
expect(
new UInt(registry, new Uint8Array()).toNumber()
+8 -5
View File
@@ -16,7 +16,10 @@ export class Range<T extends INumber> extends Tuple {
#rangeName: RangeType;
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, value?: AnyTuple, rangeName: RangeType = 'Range') {
super(registry, { end: Type, start: Type }, value);
super(registry, {
end: Type,
start: Type
}, value);
this.#rangeName = rangeName;
}
@@ -52,14 +55,14 @@ export class Range<T extends INumber> extends Tuple {
}
export class RangeInclusive<T extends INumber = INumber> extends Range<T> {
constructor (registry: CodecRegistry, type: CodecClass<T> | string, value?: AnyTuple) {
super(registry, type, value, 'RangeInclusive');
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, value?: AnyTuple) {
super(registry, Type, value, 'RangeInclusive');
}
public static override with <T extends INumber> (Types: CodecClass<T> | string): CodecClass<RangeInclusive<T>> {
public static override with <T extends INumber> (Type: CodecClass<T> | string): CodecClass<RangeInclusive<T>> {
return class extends RangeInclusive<T> {
constructor (registry: CodecRegistry, value?: AnyTuple) {
super(registry, Types, value);
super(registry, Type, value);
}
};
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '7.4.1' };
+3 -3
View File
@@ -14,8 +14,8 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../types" },
{ "path": "../types-augment" },
{ "path": "../types-support" }
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" },
{ "path": "../types-support/tsconfig.build.json" }
]
}
+4 -4
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/types-codec": "7.3.1",
"@polkadot/util": "^8.3.1"
"@polkadot/types-codec": "7.4.1",
"@polkadot/util": "^8.3.2"
},
"devDependencies": {
"@polkadot/types": "7.3.1"
"@polkadot/types": "7.4.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '7.4.1' };
+51 -48
View File
@@ -20,7 +20,7 @@ export function paramsNotation <T> (outer: string, inner?: T | T[], transform: (
}`;
}
function encodeWithParams (CodecRegistry: CodecRegistry, typeDef: TypeDef, outer: string): string {
function encodeWithParams (registry: CodecRegistry, typeDef: TypeDef, outer: string): string {
const { info, sub } = typeDef;
switch (info) {
@@ -30,17 +30,18 @@ function encodeWithParams (CodecRegistry: CodecRegistry, typeDef: TypeDef, outer
case TypeDefInfo.HashMap:
case TypeDefInfo.Linkage:
case TypeDefInfo.Option:
case TypeDefInfo.Range:
case TypeDefInfo.Result:
case TypeDefInfo.Vec:
case TypeDefInfo.WrapperKeepOpaque:
case TypeDefInfo.WrapperOpaque:
return paramsNotation(outer, sub, (p) => encodeTypeDef(CodecRegistry, p));
return paramsNotation(outer, sub, (p) => encodeTypeDef(registry, p));
}
throw new Error(`Unable to encode ${stringify(typeDef)} with params`);
}
function encodeSubTypes (CodecRegistry: CodecRegistry, sub: TypeDef[], asEnum?: boolean, extra?: Record<string, unknown>): string {
function encodeSubTypes (registry: CodecRegistry, sub: TypeDef[], asEnum?: boolean, extra?: Record<string, unknown>): string {
const names = sub.map(({ name }) => name);
assert(names.every((n) => !!n), () => `Subtypes does not have consistent names, ${names.join(', ')}`);
@@ -50,7 +51,7 @@ function encodeSubTypes (CodecRegistry: CodecRegistry, sub: TypeDef[], asEnum?:
for (let i = 0; i < sub.length; i++) {
const def = sub[i];
inner[def.name as string] = encodeTypeDef(CodecRegistry, def);
inner[def.name as string] = encodeTypeDef(registry, def);
}
return stringify(
@@ -62,44 +63,44 @@ function encodeSubTypes (CodecRegistry: CodecRegistry, sub: TypeDef[], asEnum?:
// We setup a record here to ensure we have comprehensive coverage (any item not covered will result
// in a compile-time error with the missing index)
const encoders: Record<TypeDefInfo, (CodecRegistry: CodecRegistry, typeDef: TypeDef) => string> = {
[TypeDefInfo.BTreeMap]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'BTreeMap'),
[TypeDefInfo.BTreeSet]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'BTreeSet'),
[TypeDefInfo.Compact]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'Compact'),
[TypeDefInfo.DoNotConstruct]: (CodecRegistry: CodecRegistry, { displayName, lookupIndex, lookupName }: TypeDef) =>
`DoNotConstruct<${lookupName || displayName || (isUndefined(lookupIndex) ? 'Unknown' : CodecRegistry.createLookupType(lookupIndex))}>`,
[TypeDefInfo.Enum]: (CodecRegistry: CodecRegistry, { sub }: TypeDef): string => {
const encoders: Record<TypeDefInfo, (registry: CodecRegistry, typeDef: TypeDef) => string> = {
[TypeDefInfo.BTreeMap]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'BTreeMap'),
[TypeDefInfo.BTreeSet]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'BTreeSet'),
[TypeDefInfo.Compact]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Compact'),
[TypeDefInfo.DoNotConstruct]: (registry: CodecRegistry, { displayName, lookupIndex, lookupName }: TypeDef) =>
`DoNotConstruct<${lookupName || displayName || (isUndefined(lookupIndex) ? 'Unknown' : registry.createLookupType(lookupIndex))}>`,
[TypeDefInfo.Enum]: (registry: CodecRegistry, { sub }: TypeDef): string => {
assert(sub && Array.isArray(sub), 'Unable to encode Enum type');
// c-like enums have all Null entries
// TODO We need to take the disciminant into account and auto-add empty entries
return sub.every(({ type }) => type === 'Null')
? stringify({ _enum: sub.map(({ name }, index) => `${name || `Empty${index}`}`) })
: encodeSubTypes(CodecRegistry, sub, true);
: encodeSubTypes(registry, sub, true);
},
[TypeDefInfo.HashMap]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'HashMap'),
[TypeDefInfo.Int]: (CodecRegistry: CodecRegistry, { length = 32 }: TypeDef) =>
[TypeDefInfo.HashMap]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'HashMap'),
[TypeDefInfo.Int]: (registry: CodecRegistry, { length = 32 }: TypeDef) =>
`Int<${length}>`,
[TypeDefInfo.Linkage]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'Linkage'),
[TypeDefInfo.Linkage]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Linkage'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Null]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
[TypeDefInfo.Null]: (registry: CodecRegistry, typeDef: TypeDef) =>
'Null',
[TypeDefInfo.Option]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'Option'),
[TypeDefInfo.Option]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Option'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Plain]: (CodecRegistry: CodecRegistry, { displayName, type }: TypeDef) =>
[TypeDefInfo.Plain]: (registry: CodecRegistry, { displayName, type }: TypeDef) =>
displayName || type,
[TypeDefInfo.Range]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, typeDef.type.includes('RangeInclusive') ? 'RangeInclusive' : 'Range'),
[TypeDefInfo.Result]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'Result'),
[TypeDefInfo.Range]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, typeDef.type.includes('RangeInclusive') ? 'RangeInclusive' : 'Range'),
[TypeDefInfo.Result]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Result'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Set]: (CodecRegistry: CodecRegistry, { length = 8, sub }: TypeDef): string => {
[TypeDefInfo.Set]: (registry: CodecRegistry, { length = 8, sub }: TypeDef): string => {
assert(sub && Array.isArray(sub), 'Unable to encode Set type');
return stringify({
@@ -109,12 +110,12 @@ const encoders: Record<TypeDefInfo, (CodecRegistry: CodecRegistry, typeDef: Type
});
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Si]: (CodecRegistry: CodecRegistry, { lookupName, type }: TypeDef) =>
[TypeDefInfo.Si]: (registry: CodecRegistry, { lookupName, type }: TypeDef) =>
lookupName || type,
[TypeDefInfo.Struct]: (CodecRegistry: CodecRegistry, { alias, sub }: TypeDef): string => {
[TypeDefInfo.Struct]: (registry: CodecRegistry, { alias, sub }: TypeDef): string => {
assert(sub && Array.isArray(sub), 'Unable to encode Struct type');
return encodeSubTypes(CodecRegistry, sub, false,
return encodeSubTypes(registry, sub, false,
alias
? {
_alias: [...alias.entries()].reduce<Record<string, string>>((all, [k, v]) =>
@@ -124,41 +125,43 @@ const encoders: Record<TypeDefInfo, (CodecRegistry: CodecRegistry, typeDef: Type
: {}
);
},
[TypeDefInfo.Tuple]: (CodecRegistry: CodecRegistry, { sub }: TypeDef): string => {
[TypeDefInfo.Tuple]: (registry: CodecRegistry, { sub }: TypeDef): string => {
assert(sub && Array.isArray(sub), 'Unable to encode Tuple type');
return `(${sub.map((type) => encodeTypeDef(CodecRegistry, type)).join(',')})`;
return `(${sub.map((type) => encodeTypeDef(registry, type)).join(',')})`;
},
[TypeDefInfo.UInt]: (CodecRegistry: CodecRegistry, { length = 32 }: TypeDef) =>
[TypeDefInfo.UInt]: (registry: CodecRegistry, { length = 32 }: TypeDef) =>
`UInt<${length}>`,
[TypeDefInfo.Vec]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'Vec'),
[TypeDefInfo.VecFixed]: (CodecRegistry: CodecRegistry, { length, sub }: TypeDef): string => {
[TypeDefInfo.Vec]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Vec'),
[TypeDefInfo.VecFixed]: (registry: CodecRegistry, { length, sub }: TypeDef): string => {
assert(isNumber(length) && !isUndefined(sub) && !Array.isArray(sub), 'Unable to encode VecFixed type');
return `[${sub.type};${length}]`;
},
[TypeDefInfo.WrapperKeepOpaque]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'WrapperKeepOpaque'),
[TypeDefInfo.WrapperOpaque]: (CodecRegistry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(CodecRegistry, typeDef, 'WrapperOpaque')
[TypeDefInfo.WrapperKeepOpaque]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'WrapperKeepOpaque'),
[TypeDefInfo.WrapperOpaque]: (registry: CodecRegistry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'WrapperOpaque')
};
function encodeType (CodecRegistry: CodecRegistry, typeDef: TypeDef, withLookup = true): string {
function encodeType (registry: CodecRegistry, typeDef: TypeDef, withLookup = true): string {
return withLookup && typeDef.lookupName
? typeDef.lookupName
: encoders[typeDef.info](CodecRegistry, typeDef);
: encoders[typeDef.info](registry, typeDef);
}
export function encodeTypeDef (CodecRegistry: CodecRegistry, typeDef: TypeDef): string {
export function encodeTypeDef (registry: CodecRegistry, typeDef: TypeDef): string {
// In the case of contracts we do have the unfortunate situation where the displayName would
// refer to "Option" when it is an option. For these, string it out, only using when actually
// not a top-level element to be used
return (typeDef.displayName && !INFO_WRAP.some((i) => typeDef.displayName === i))
? typeDef.displayName
: encodeType(CodecRegistry, typeDef);
: encodeType(registry, typeDef);
}
export function withTypeString (CodecRegistry: CodecRegistry, typeDef: Omit<TypeDef, 'type'>): TypeDef {
return objectSpread({}, typeDef, { type: encodeType(CodecRegistry, typeDef as TypeDef, false) });
export function withTypeString (registry: CodecRegistry, typeDef: Omit<TypeDef, 'type'> & { type?: string }): TypeDef {
return objectSpread({}, typeDef, {
type: encodeType(registry, typeDef as TypeDef, false)
});
}
@@ -10,6 +10,6 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../types-codec" }
{ "path": "../types-codec/tsconfig.build.json" }
]
}
+2 -2
View File
@@ -12,7 +12,7 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../types" },
{ "path": "../types-codec" }
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" }
]
}
+6 -6
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/networks": "^8.3.1",
"@polkadot/types": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/types-create": "7.3.1",
"@polkadot/util": "^8.3.1"
"@polkadot/networks": "^8.3.2",
"@polkadot/types": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/types-create": "7.4.1",
"@polkadot/util": "^8.3.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '7.4.1' };
+1 -1
View File
@@ -14,7 +14,7 @@ const upgrades: ChainUpgradesRaw = [
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090],
[9611377, 9100], [9625129, 9111], [9866422, 9122], [10403784, 9130]
[9611377, 9100], [9625129, 9111], [9866422, 9122], [10403784, 9130], [10960765, 9150]
];
export default upgrades;
+13
View File
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-create/tsconfig.build.json" }
]
}
-13
View File
@@ -1,13 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
{ "path": "../types" },
{ "path": "../types-codec" },
{ "path": "../types-create" }
]
}
+2 -2
View File
@@ -20,10 +20,10 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/util": "^8.3.1"
"@polkadot/util": "^8.3.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -6,6 +6,9 @@
"rootDir": "./src",
"resolveJsonModule": true
},
"include": ["src/**/*.json", "src/**/*.ts"],
"include": [
"src/**/*.json",
"src/**/*.ts"
],
"references": []
}
+10 -10
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.3.1",
"version": "7.4.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/keyring": "^8.3.1",
"@polkadot/types-augment": "7.3.1",
"@polkadot/types-codec": "7.3.1",
"@polkadot/types-create": "7.3.1",
"@polkadot/util": "^8.3.1",
"@polkadot/util-crypto": "^8.3.1",
"rxjs": "^7.5.1"
"@polkadot/keyring": "^8.3.2",
"@polkadot/types-augment": "7.4.1",
"@polkadot/types-codec": "7.4.1",
"@polkadot/types-create": "7.4.1",
"@polkadot/util": "^8.3.2",
"@polkadot/util-crypto": "^8.3.2",
"rxjs": "^7.5.2"
},
"devDependencies": {
"@polkadot/keyring": "^8.3.1",
"@polkadot/types-support": "7.3.1"
"@polkadot/keyring": "^8.3.2",
"@polkadot/types-support": "7.4.1"
}
}
@@ -0,0 +1,56 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TypeRegistry } from '../../create';
import { PortableRegistry } from '.';
const registry = new TypeRegistry();
const types = [
{
id: 0,
type: {
def: {
composite: {
fields: [
{
name: 'start',
type: 1,
typeName: 'Idx'
},
{
name: 'end',
type: 1,
typeName: 'Idx'
}
]
}
},
params: [
{
name: 'Idx',
type: 1
}
],
path: ['Range']
}
},
{
id: 1,
type: {
def: {
primitive: 'U32'
}
}
}
];
describe('PortableRegistry/Range', (): void => {
it('decodes a Range type', (): void => {
expect(
// override here is fine, Structs will decode correctly
new PortableRegistry(registry, { types } as unknown as Uint8Array)
.getTypeDef(0)
.type
).toEqual('Range<u32>');
});
});
@@ -509,40 +509,28 @@ export class PortableRegistry extends Struct implements ILookup {
}
#extractComposite (lookupIndex: number, { params, path }: SiType, { fields }: SiTypeDefComposite): TypeDef {
const specialVariant = path[0].toString();
const pathFirst = path[0].toString();
const pathLast = path[path.length - 1].toString();
if (path.length === 1 && specialVariant === 'BTreeMap') {
if (path.length === 1 && pathFirst === 'BTreeMap') {
return withTypeString(this.registry, {
info: TypeDefInfo.BTreeMap,
sub: params.map(({ type }) => this.#createSiDef(type.unwrap()))
});
} else if (['Range', 'RangeInclusive'].includes(specialVariant)) {
} else if (['Range', 'RangeInclusive'].includes(pathFirst)) {
return withTypeString(this.registry, {
info: TypeDefInfo.Range,
sub: fields.map(({ name, type, typeName }, index) =>
objectSpread(
{
name: name.isSome
? name.unwrap().toString()
: ['start', 'end'][index]
},
this.#createSiDef(type),
typeName.isSome
? { typeName: sanitize(typeName.unwrap()) }
: null
))
sub: this.#createSiDef(params[0].type.unwrap()),
type: pathFirst
});
} else if (['WrapperKeepOpaque', 'WrapperOpaque'].includes(pathLast)) {
return withTypeString(this.registry, {
info: pathLast === 'WrapperKeepOpaque'
? TypeDefInfo.WrapperKeepOpaque
: TypeDefInfo.WrapperOpaque,
sub: this.#createSiDef(params[0].type.unwrap()),
type: pathLast
});
} else if (path.length) {
const last = path[path.length - 1].toString();
if (['WrapperKeepOpaque', 'WrapperOpaque'].includes(last)) {
return withTypeString(this.registry, {
info: last === 'WrapperKeepOpaque'
? TypeDefInfo.WrapperKeepOpaque
: TypeDefInfo.WrapperOpaque,
sub: this.#createSiDef(params[0].type.unwrap())
});
}
}
return PATHS_SET.some((p) => matchParts(p, path))
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '7.3.1' };
export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '7.4.1' };
@@ -11,7 +11,7 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../types-codec" },
{ "path": "../types-create" }
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-create/tsconfig.build.json" }
]
}
+5 -5
View File
@@ -13,10 +13,10 @@
"**/*.spec.ts"
],
"references": [
{ "path": "../types" },
{ "path": "../types-augment" },
{ "path": "../types-codec" },
{ "path": "../types-create" },
{ "path": "../types-support" }
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-create/tsconfig.build.json" },
{ "path": "../types-support/tsconfig.build.json" }
]
}
-12
View File
@@ -1,12 +0,0 @@
{
"extends": "./tsconfig.base.json",
"exclude": [
"build/**/*",
"**/build/**/*"
],
"compilerOptions": {
"composite": false,
"baseUrl": "./packages",
"outDir": "./build"
}
}
+83
View File
@@ -0,0 +1,83 @@
{
"compilerOptions": {
"composite": true
},
"files": [],
"references": [
{
"path": "./packages/api/tsconfig.build.json"
},
{
"path": "./packages/api/tsconfig.spec.json"
},
{
"path": "./packages/api-augment/tsconfig.build.json"
},
{
"path": "./packages/api-augment/tsconfig.kusama.json"
},
{
"path": "./packages/api-augment/tsconfig.polkadot.json"
},
{
"path": "./packages/api-base/tsconfig.build.json"
},
{
"path": "./packages/api-contract/tsconfig.build.json"
},
{
"path": "./packages/api-contract/tsconfig.spec.json"
},
{
"path": "./packages/api-derive/tsconfig.build.json"
},
{
"path": "./packages/api-derive/tsconfig.spec.json"
},
{
"path": "./packages/rpc-augment/tsconfig.build.json"
},
{
"path": "./packages/rpc-core/tsconfig.build.json"
},
{
"path": "./packages/rpc-core/tsconfig.spec.json"
},
{
"path": "./packages/rpc-provider/tsconfig.build.json"
},
{
"path": "./packages/rpc-provider/tsconfig.spec.json"
},
{
"path": "./packages/typegen/tsconfig.build.json"
},
{
"path": "./packages/types/tsconfig.build.json"
},
{
"path": "./packages/types/tsconfig.spec.json"
},
{
"path": "./packages/types-augment/tsconfig.build.json"
},
{
"path": "./packages/types-codec/tsconfig.build.json"
},
{
"path": "./packages/types-codec/tsconfig.spec.json"
},
{
"path": "./packages/types-create/tsconfig.build.json"
},
{
"path": "./packages/types-create/tsconfig.spec.json"
},
{
"path": "./packages/types-known/tsconfig.build.json"
},
{
"path": "./packages/types-support/tsconfig.build.json"
}
]
}
+2 -1
View File
@@ -1,7 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./packages"
"baseUrl": "./packages",
"composite": false
},
"include": [
"packages/**/src/**/*",
+8 -28
View File
@@ -1,33 +1,13 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"composite": true
"baseUrl": "./packages",
"composite": false
},
"files": [],
"references": [
{ "path": "./packages/api" },
{ "path": "./packages/api/tsconfig.spec.json" },
{ "path": "./packages/api-augment" },
{ "path": "./packages/api-augment/tsconfig.kusama.json" },
{ "path": "./packages/api-augment/tsconfig.polkadot.json" },
{ "path": "./packages/api-base" },
{ "path": "./packages/api-contract" },
{ "path": "./packages/api-contract/tsconfig.spec.json" },
{ "path": "./packages/api-derive" },
{ "path": "./packages/api-derive/tsconfig.spec.json" },
{ "path": "./packages/rpc-augment" },
{ "path": "./packages/rpc-core" },
{ "path": "./packages/rpc-core/tsconfig.spec.json" },
{ "path": "./packages/rpc-provider" },
{ "path": "./packages/rpc-provider/tsconfig.spec.json" },
{ "path": "./packages/typegen" },
{ "path": "./packages/types" },
{ "path": "./packages/types/tsconfig.spec.json" },
{ "path": "./packages/types-augment" },
{ "path": "./packages/types-codec" },
{ "path": "./packages/types-codec/tsconfig.spec.json" },
{ "path": "./packages/types-create" },
{ "path": "./packages/types-create/tsconfig.spec.json" },
{ "path": "./packages/types-known" },
{ "path": "./packages/types-support" }
"include": [
"packages/**/src/**/*"
],
"exclude": [
"**/node_modules/**/*"
]
}
+337 -337
View File
File diff suppressed because it is too large Load Diff