Compare commits

..
34 Commits
Author SHA1 Message Date
github-actions[bot] 66159955ac [CI Skip] release/stable 8.0.1
skip-checks: true
2022-04-10 10:34:25 +00:00
Jaco 03c725f637 8.0.1 (#4734) 2022-04-10 13:26:19 +03:00
github-actions[bot] e5708a7e7e [CI Skip] release/beta 7.15.2-15
skip-checks: true
2022-04-09 13:13:27 +00:00
Jaco fb5ce83f74 Add support for apiAt.tx(...) (#4696)
* Add support for apiAt.tx(...)

* CHANGELOG
2022-04-09 16:05:36 +03:00
github-actions[bot] 6c3bd2f408 [CI Skip] release/beta 7.15.2-14
skip-checks: true
2022-04-09 10:11:21 +00:00
Jaco 66e01afe26 Bump metadata (#4732) 2022-04-09 13:02:46 +03:00
github-actions[bot] 71f9bdf368 [CI Skip] release/beta 7.15.2-13
skip-checks: true
2022-04-09 09:26:26 +00:00
Jaco 7af9330026 Add bagList expand(bag: Bag) (#4731) 2022-04-09 12:17:58 +03:00
github-actions[bot] d5aff171e4 [CI Skip] release/beta 7.15.2-12
skip-checks: true
2022-04-09 09:15:46 +00:00
Jaco 543de63af8 Re-use bagList types (#4730) 2022-04-09 12:05:33 +03:00
github-actions[bot] cdcdf589dd [CI Skip] release/beta 7.15.2-11
skip-checks: true
2022-04-09 08:49:12 +00:00
Jaco 1330b58afd Align derive.bagsList.all with multi (#4729) 2022-04-09 11:40:48 +03:00
github-actions[bot] 0b2ec65e88 [CI Skip] release/beta 7.15.2-10
skip-checks: true
2022-04-09 08:37:51 +00:00
Jaco 8840e29063 Bump util to 9.0.1 (#4728) 2022-04-09 11:29:42 +03:00
github-actions[bot] b9925b569d [CI Skip] release/beta 7.15.2-9
skip-checks: true
2022-04-09 06:41:34 +00:00
Jaco 2640b65be9 Fix typegen for cjs imports (#4727) 2022-04-09 09:33:05 +03:00
github-actions[bot] d64a0ca295 [CI Skip] release/beta 7.15.2-8
skip-checks: true
2022-04-08 18:54:24 +00:00
Jaco 79eeed3f9a Return sorted names for api.registry.lookup.names (#4726) 2022-04-08 21:46:03 +03:00
github-actions[bot] d154b535e6 [CI Skip] release/beta 7.15.2-7
skip-checks: true
2022-04-08 15:43:31 +00:00
Jaco 87c2690fc2 Bagslist derive sorted (#4725) 2022-04-08 18:35:14 +03:00
github-actions[bot] 8f0ca37c60 [CI Skip] release/beta 7.15.2-6
skip-checks: true
2022-04-08 13:04:36 +00:00
Jaco f7dd4a3552 Add basic derive.bagsList support (#4723) 2022-04-08 15:56:14 +03:00
github-actions[bot] abcad05a91 [CI Skip] release/beta 7.15.2-5
skip-checks: true
2022-04-08 05:59:53 +00:00
Jaco ba188dcc0d JSONRPC request/response handler opts (#4722)
* JSONRPC request/response handler opts

* Fix test

* CHANGELOG
2022-04-08 08:51:44 +03:00
github-actions[bot] ae2422f350 [CI Skip] release/beta 7.15.2-4
skip-checks: true
2022-04-08 05:45:27 +00:00
Zannis KalampoukisandJaco 576efc0239 fix: typegen supports vectors of slices (#4720)
* fix: typegen supports vectors of slices

* fix linting

* Update packages/typegen/src/util/derived.ts

Co-authored-by: Jaco <jacogr@gmail.com>
2022-04-08 08:37:31 +03:00
github-actions[bot] 111540177f [CI Skip] release/beta 7.15.2-3
skip-checks: true
2022-04-06 10:54:35 +00:00
Josep M Sobrepere 43ee566669 docs: improve rpc-provider README (#4719) 2022-04-06 13:44:56 +03:00
github-actions[bot] 39299188b0 [CI Skip] release/beta 7.15.2-2
skip-checks: true
2022-04-06 09:15:26 +00:00
Jaco 5d13bfb925 Bump @polkadot/* (#4718)
* Bump @polkadot/*

* Bump @substrate/connect

* Adjust
2022-04-06 12:06:42 +03:00
github-actions[bot] c759ff0c12 [CI Skip] release/beta 7.15.2-1
skip-checks: true
2022-04-05 12:29:28 +00:00
Jaco 0cc34dff85 Polkadot 9180 block (#4717) 2022-04-05 15:20:36 +03:00
github-actions[bot] 1682a8f096 [CI Skip] release/beta 7.15.2-0
skip-checks: true
2022-04-05 06:22:59 +00:00
Jaco be572aabf0 Bump @polkadot/dev (#4715) 2022-04-05 09:14:32 +03:00
81 changed files with 11801 additions and 11455 deletions
+2
View File
@@ -1,5 +1,7 @@
_book/
build/
build-cjs/
build-esm/
build-docs/
coverage/
docs/.vuepress/dist/
+21
View File
@@ -1,5 +1,26 @@
# CHANGELOG
## 8.0.1 Apr 10, 2022
- **Breaking change** In this major version the commonjs outputs are moved to a sub-folder. Since the export map and main field in package.json does reflect this change, there should be no usage changes. However the packages here will all need to be on the same version for internal linkage.
Contributed:
- Improve `rpc-provider` README (Thanks to https://github.com/josepot)
- Add handling for `Vec<[<Type>;<length>]>` in typegen (Thanks to https://github.com/zannis)
Changes:
- Add support for `apiAt.tx(...)` to construct at a specific point
- Add basic `api.derive.bagsList.*` support
- Return sorted names for `api.registry.lookup.names`
- Optimize JSONRPC requests/response handling
- Output commonjs files under the `cjs/**` root
- Update to latest Substrate, Kusama & Polkadot static metadata
- Add latest Polkadot 9180 upgrade block
- Update to `@polkadot/util` 9.0.1
## 7.15.1 Apr 3, 2022
Contributed:
+3 -2
View File
@@ -1,4 +1,4 @@
2893 Jaco 7.15.1 (#4714)
2908 Jaco 8.0.1 (#4734)
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
37 Keith Ingram Update contract types and rpc (#4541)
35 Stefanie Doll Updated child storage parameters (#1709)
@@ -22,6 +22,7 @@
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 Josep M Sobrepere docs: improve rpc-provider README (#4719)
3 Julien Eluard Fixed typos about module balances (#1402)
3 KarishmaBothara Backward compatibility thing (#3511)
3 Miguel Hervas Adding RT4 Types (#3007)
@@ -33,7 +34,6 @@
2 HackFisher Update maxExtrinsic definition (#4703)
2 Jakub Pánik All heads subscription (#1899)
2 James Lefrère Add `.eq()` usage to docs and fix docs typos (#1405)
2 Josep M Sobrepere fix: export substrate-connect `WellKnownChain` (#4700)
2 Keith Yeung Allow keyPrefix to accept an additional argument for double maps (#2230)
2 MOZGIII Follow-up fix after #4665 (#4666)
2 Nikos Kontakis Add auction in shared types (#4085)
@@ -98,4 +98,5 @@
1 Yaroslav Bolyukin Support BTreeMap/BTreeSet in typegen (#4682)
1 yjh fix MetadataVersioned.asV12 (#2983)
1 Yuri fixes #3693 Fix uniques return types (#3694)
1 Zannis Kalampoukis fix: typegen supports vectors of slices (#4720)
1 Zeke Mostov fix: Allow sudo for polkadot indexed proxy enum (#3286)
+4 -4
View File
@@ -11,7 +11,7 @@
},
"sideEffects": false,
"type": "commonjs",
"version": "7.15.1",
"version": "8.0.1",
"workspaces": [
"packages/*"
],
@@ -31,10 +31,10 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.17.8",
"@babel/core": "^7.17.9",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.17.8",
"@polkadot/dev": "^0.65.103",
"@babel/runtime": "^7.17.9",
"@polkadot/dev": "^0.66.1",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.4.1",
"copyfiles": "^2.4.1"
+9 -9
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api-base": "7.15.1",
"@polkadot/rpc-augment": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-augment": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/util": "^8.7.1"
"@babel/runtime": "^7.17.9",
"@polkadot/api-base": "8.0.1",
"@polkadot/rpc-augment": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-augment": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/util": "^9.0.1"
},
"devDependencies": {
"@polkadot/types-support": "7.15.1"
"@polkadot/types-support": "8.0.1"
}
}
+4 -4
View File
@@ -841,6 +841,10 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
transactionPayment: {
/**
* The polynomial that is applied in order to derive fee from length.
**/
lengthToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
@@ -865,10 +869,6 @@ declare module '@polkadot/api-base/types/consts' {
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
+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.15.1' };
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.0.1' };
+4 -4
View File
@@ -708,6 +708,10 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
transactionPayment: {
/**
* The polynomial that is applied in order to derive fee from length.
**/
lengthToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
@@ -732,10 +736,6 @@ declare module '@polkadot/api-base/types/consts' {
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
+4 -4
View File
@@ -911,6 +911,10 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
transactionPayment: {
/**
* The polynomial that is applied in order to derive fee from length.
**/
lengthToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
@@ -935,10 +939,6 @@ declare module '@polkadot/api-base/types/consts' {
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/rpc-core": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/util": "^8.7.1",
"@babel/runtime": "^7.17.9",
"@polkadot/rpc-core": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/util": "^9.0.1",
"rxjs": "^7.5.5"
}
}
+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.15.1' };
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.0.1' };
+10 -10
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/types-create": "7.15.1",
"@polkadot/util": "^8.7.1",
"@polkadot/util-crypto": "^8.7.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/types-create": "8.0.1",
"@polkadot/util": "^9.0.1",
"@polkadot/util-crypto": "^9.0.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api-augment": "7.15.1",
"@polkadot/keyring": "^8.7.1"
"@polkadot/api-augment": "8.0.1",
"@polkadot/keyring": "^9.0.1"
}
}
+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.15.1' };
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.0.1' };
+15 -15
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api": "7.15.1",
"@polkadot/api-augment": "7.15.1",
"@polkadot/api-base": "7.15.1",
"@polkadot/rpc-core": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/util": "^8.7.1",
"@polkadot/util-crypto": "^8.7.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api": "8.0.1",
"@polkadot/api-augment": "8.0.1",
"@polkadot/api-base": "8.0.1",
"@polkadot/rpc-core": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/util": "^9.0.1",
"@polkadot/util-crypto": "^9.0.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api": "7.15.1",
"@polkadot/api-augment": "7.15.1",
"@polkadot/rpc-augment": "7.15.1",
"@polkadot/rpc-provider": "7.15.1",
"@polkadot/types-support": "7.15.1"
"@polkadot/api": "8.0.1",
"@polkadot/api-augment": "8.0.1",
"@polkadot/rpc-augment": "8.0.1",
"@polkadot/rpc-provider": "8.0.1",
"@polkadot/types-support": "8.0.1"
}
}
+72
View File
@@ -0,0 +1,72 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { PalletBagsListListBag } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag } from './types';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, bnToBn } from '@polkadot/util';
import { memo } from '../util';
function orderBags (ids: BN[], bags: Option<PalletBagsListListBag>[]): Bag[] {
const sorted = ids
.map((id, index) => ({
bag: bags[index].unwrapOr(null),
id,
key: id.toString()
}))
.sort((a, b) => b.id.cmp(a.id))
.map((base, index): Bag => ({
...base,
bagLower: BN_ZERO,
bagUpper: base.id,
index
}));
const max = sorted.length - 1;
return sorted.map((entry, index) =>
index === max
? entry
// We could probably use a .add(BN_ONE) here
: { ...entry, bagLower: sorted[index + 1].bagUpper }
);
}
export function _getIds (instanceId: string, api: DeriveApi): (ids: (BN | number)[]) => Observable<Bag[]> {
return memo(instanceId, (_ids: (BN | number)[]): Observable<Bag[]> => {
const ids = _ids.map((id) => bnToBn(id));
return ids.length
? api.query.listBags.multi<Option<PalletBagsListListBag>[]>(ids).pipe(
map((bags) => orderBags(ids, bags))
)
: of([]);
});
}
export function all (instanceId: string, api: DeriveApi): () => Observable<Bag[]> {
return memo(instanceId, (): Observable<Bag[]> =>
api.query.bagsList.listBags.keys().pipe(
switchMap((keys) =>
api.derive.bagsList._getIds(keys.map(({ args: [id] }) => id))
),
map((list) =>
list.filter(({ bag }) => bag)
)
)
);
}
export function get (instanceId: string, api: DeriveApi): (id: BN | number) => Observable<Bag> {
return memo(instanceId, (id: BN | number): Observable<Bag> =>
api.derive.bagsList._getIds([bnToBn(id)]).pipe(
map((bags) => bags[0])
)
);
}
@@ -0,0 +1,29 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag, BagExpanded } from './types';
import { map, switchMap } from 'rxjs';
import { memo } from '../util';
export function expand (instanceId: string, api: DeriveApi): (bag: Bag) => Observable<BagExpanded> {
return memo(instanceId, (bag: Bag): Observable<BagExpanded> =>
api.derive.bagsList.listNodes(bag.bag).pipe(
map((nodes) => ({ ...bag, nodes }))
)
);
}
export function getExpanded (instanceId: string, api: DeriveApi): (id: BN | number) => Observable<BagExpanded> {
return memo(instanceId, (id: BN | number): Observable<BagExpanded> =>
api.derive.bagsList.get(id).pipe(
switchMap((bag) =>
api.derive.bagsList.expand(bag)
)
)
);
}
@@ -0,0 +1,6 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './get';
export * from './getExpanded';
export * from './listNodes';
@@ -0,0 +1,41 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { AccountId32 } from '@polkadot/types/interfaces';
import type { PalletBagsListListBag, PalletBagsListListNode } from '@polkadot/types/lookup';
import type { DeriveApi } from '../types';
import { BehaviorSubject, map, of, switchMap, tap, toArray } from 'rxjs';
import { memo } from '../util';
function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<PalletBagsListListNode[]> {
const subject = new BehaviorSubject<AccountId32 | string>(head);
return subject.pipe(
switchMap((account) =>
api.query.bagsList.listNodes(account)
),
tap((node: Option<PalletBagsListListNode>): void => {
setTimeout((): void => {
node.isSome && (node.value as PalletBagsListListNode).next.isSome
? subject.next(node.unwrap().next.unwrap())
: subject.complete();
}, 0);
}),
toArray(), // toArray since we want to startSubject to be completed
map((all: Option<PalletBagsListListNode>[]) =>
all.map((o) => o.unwrap())
)
);
}
export function listNodes (instanceId: string, api: DeriveApi): (bag: PalletBagsListListBag | null) => Observable<PalletBagsListListNode[]> {
return memo(instanceId, (bag: PalletBagsListListBag | null): Observable<PalletBagsListListNode[]> =>
bag && bag.head.isSome
? traverseLinks(api, bag.head.unwrap())
: of([])
);
}
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletBagsListListBag, PalletBagsListListNode } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
export interface Bag {
bag: PalletBagsListListBag | null;
bagUpper: BN;
bagLower: BN;
id: BN;
index: number;
key: string;
}
export interface BagExpanded extends Bag {
nodes: PalletBagsListListNode[];
}
+4
View File
@@ -22,6 +22,10 @@ export { lazyDeriveSection };
// Enable derive only if some of these modules are available
const checks: Record<string, Avail> = {
bagsList: {
instances: ['bagsList'],
methods: []
},
contracts: {
instances: ['contracts'],
methods: []
@@ -60,17 +60,17 @@ function _eventTriggerAll (api: DeriveApi, paraId: string | number | BN): Observ
}
function _getKeysPaged (api: DeriveApi, childKey: string): Observable<StorageKey[]> {
const startSubject = new BehaviorSubject<string | undefined>(undefined);
const subject = new BehaviorSubject<string | undefined>(undefined);
return startSubject.pipe(
return subject.pipe(
switchMap((startKey) =>
api.rpc.childstate.getKeysPaged(childKey, '0x', PAGE_SIZE_K, startKey)
),
tap((keys): void => {
setTimeout((): void => {
keys.length === PAGE_SIZE_K
? startSubject.next(keys[PAGE_SIZE_K - 1].toHex())
: startSubject.complete();
? subject.next(keys[PAGE_SIZE_K - 1].toHex())
: subject.complete();
}, 0);
}),
toArray(), // toArray since we want to startSubject to be completed
+2 -1
View File
@@ -4,6 +4,7 @@
import type { AnyFunction } from '@polkadot/types/types';
import * as accounts from './accounts';
import * as bagsList from './bagsList';
import * as balances from './balances';
import * as bounties from './bounties';
import * as chain from './chain';
@@ -22,7 +23,7 @@ import * as technicalCommittee from './technicalCommittee';
import * as treasury from './treasury';
import * as tx from './tx';
export const derive = { accounts, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
export const derive = { accounts, bagsList, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
type DeriveSection<Section> = {
[M in keyof Section]: Section[M] extends AnyFunction
+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.15.1' };
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.0.1' };
+4 -4
View File
@@ -23,17 +23,17 @@ const ERA_CHUNK_SIZE = 14;
function chunkEras <T> (eras: EraIndex[], fn: (eras: EraIndex[]) => Observable<T[]>): Observable<T[]> {
const chunked = arrayChunk(eras, ERA_CHUNK_SIZE);
let index = 0;
const startSubject = new BehaviorSubject<EraIndex[]>(chunked[index]);
const subject = new BehaviorSubject<EraIndex[]>(chunked[index]);
return startSubject.pipe(
return subject.pipe(
switchMap(fn),
tap((): void => {
setTimeout((): void => {
index++;
index === chunked.length
? startSubject.complete()
: startSubject.next(chunked[index]);
? subject.complete()
: subject.next(chunked[index]);
}, 0);
}),
toArray(),
+1
View File
@@ -10,6 +10,7 @@ import type { ExactDerive } from './derive';
export * from './accounts/types';
export * from './balances/types';
export * from './bagsList/types';
export * from './council/types';
export * from './crowdloan/types';
export * from './democracy/types';
+18 -18
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api-augment": "7.15.1",
"@polkadot/api-base": "7.15.1",
"@polkadot/api-derive": "7.15.1",
"@polkadot/keyring": "^8.7.1",
"@polkadot/rpc-augment": "7.15.1",
"@polkadot/rpc-core": "7.15.1",
"@polkadot/rpc-provider": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-augment": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/types-create": "7.15.1",
"@polkadot/types-known": "7.15.1",
"@polkadot/util": "^8.7.1",
"@polkadot/util-crypto": "^8.7.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api-augment": "8.0.1",
"@polkadot/api-base": "8.0.1",
"@polkadot/api-derive": "8.0.1",
"@polkadot/keyring": "^9.0.1",
"@polkadot/rpc-augment": "8.0.1",
"@polkadot/rpc-core": "8.0.1",
"@polkadot/rpc-provider": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-augment": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/types-create": "8.0.1",
"@polkadot/types-known": "8.0.1",
"@polkadot/util": "^9.0.1",
"@polkadot/util-crypto": "^9.0.1",
"eventemitter3": "^4.0.7",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api-augment": "7.15.1",
"@polkadot/types-support": "7.15.1"
"@polkadot/api-augment": "8.0.1",
"@polkadot/types-support": "8.0.1"
}
}
+16 -20
View File
@@ -199,18 +199,23 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._rpcCore.provider.hasSubscriptions || !!this._rpcCore.state.queryStorageAt;
}
protected _emptyDecorated (registry: Registry, blockHash?: Uint8Array): ApiDecoration<ApiType> {
return {
consts: {},
errors: {},
events: {},
query: {},
registry,
rx: {
query: {}
},
tx: createSubmittable(this._type, this._rx, this._decorateMethod, registry, blockHash)
} as ApiDecoration<ApiType>;
}
protected _createDecorated (registry: VersionedRegistry<ApiType>, fromEmpty: boolean, decoratedApi: ApiDecoration<ApiType> | null, blockHash?: Uint8Array): FullDecoration<ApiType> {
if (!decoratedApi) {
decoratedApi = {
consts: {},
errors: {},
events: {},
query: {},
registry: registry.registry,
rx: {
query: {}
}
} as ApiDecoration<ApiType>;
decoratedApi = this._emptyDecorated(registry.registry, blockHash);
}
if (fromEmpty || !registry.decoratedMeta) {
@@ -243,16 +248,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
protected _injectMetadata (registry: VersionedRegistry<ApiType>, fromEmpty = false): void {
// clear the decoration, we are redoing it here
if (fromEmpty || !registry.decoratedApi) {
registry.decoratedApi = {
consts: {},
errors: {},
events: {},
query: {},
registry: registry.registry,
rx: {
query: {}
}
} as ApiDecoration<ApiType>;
registry.decoratedApi = this._emptyDecorated(registry.registry);
}
const { decoratedApi, decoratedMeta } = this._createDecorated(registry, fromEmpty, registry.decoratedApi);
+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.15.1' };
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.0.1' };
+6 -5
View File
@@ -21,6 +21,7 @@ import { SubmittableResult } from './Result';
interface SubmittableOptions<ApiType extends ApiTypes> {
api: ApiInterfaceRx;
apiType: ApiTypes;
blockHash?: Uint8Array;
decorateMethod: ApiBase<ApiType>['_decorateMethod'];
}
@@ -80,7 +81,7 @@ function optionsOrNonce (partialOptions: Partial<SignerOptions> = {}): Partial<S
: partialOptions;
}
export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorateMethod }: SubmittableOptions<ApiType>): Constructor<SubmittableExtrinsic<ApiType>> {
export function createClass <ApiType extends ApiTypes> ({ api, apiType, blockHash, decorateMethod }: SubmittableOptions<ApiType>): Constructor<SubmittableExtrinsic<ApiType>> {
// an instance of the base extrinsic for us to extend
const ExtrinsicBase = api.registry.createClass('Extrinsic');
@@ -97,10 +98,10 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
// dry run an extrinsic
public dryRun (account: AddressOrPair, optionsOrHash?: Partial<SignerOptions> | Uint8Array | string): SubmittableDryRunResult<ApiType> {
if (isString(optionsOrHash) || isU8a(optionsOrHash)) {
if (blockHash || isString(optionsOrHash) || isU8a(optionsOrHash)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod(
() => api.rpc.system.dryRun(this.toHex(), optionsOrHash)
() => api.rpc.system.dryRun(this.toHex(), blockHash || optionsOrHash as string)
);
}
@@ -115,10 +116,10 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
// calculate the payment info for this transaction (if signed and submitted)
public paymentInfo (account: AddressOrPair, optionsOrHash?: Partial<SignerOptions> | Uint8Array | string): SubmittablePaymentResult<ApiType> {
if (isString(optionsOrHash) || isU8a(optionsOrHash)) {
if (blockHash || isString(optionsOrHash) || isU8a(optionsOrHash)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod(
(): Observable<RuntimeDispatchInfo> => api.rpc.payment.queryInfo(this.toHex(), optionsOrHash)
(): Observable<RuntimeDispatchInfo> => api.rpc.payment.queryInfo(this.toHex(), blockHash || optionsOrHash as string)
);
}
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Call, Extrinsic } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types-codec/types';
import type { ApiInterfaceRx, ApiTypes } from '../types';
import type { SubmittableExtrinsic } from './types';
@@ -10,9 +11,9 @@ import { createClass } from './createClass';
type Creator<ApiType extends ApiTypes> = (extrinsic: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>;
export function createSubmittable<ApiType extends ApiTypes> (apiType: ApiTypes, api: ApiInterfaceRx, decorateMethod: ApiBase<ApiType>['_decorateMethod']): Creator<ApiType> {
const Submittable = createClass<ApiType>({ api, apiType, decorateMethod });
export function createSubmittable<ApiType extends ApiTypes> (apiType: ApiTypes, api: ApiInterfaceRx, decorateMethod: ApiBase<ApiType>['_decorateMethod'], registry?: Registry, blockHash?: Uint8Array): Creator<ApiType> {
const Submittable = createClass<ApiType>({ api, apiType, blockHash, decorateMethod });
return (extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType> =>
new Submittable(api.registry, extrinsic);
new Submittable(registry || api.registry, extrinsic);
}
+4 -2
View File
@@ -9,11 +9,12 @@ import type { DecoratedEvents } from '@polkadot/api-base/types/events';
import type { QueryableStorage } from '@polkadot/api-base/types/storage';
import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { Call, Extrinsic, Hash } from '@polkadot/types/interfaces';
import type { CallFunction, DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, RegistryError, SignatureOptions, Signer } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types';
import type { ApiBase } from '../base';
import type { SubmittableExtrinsic } from '../types/submittable';
import type { AllDerives } from '../util/decorate';
export * from '@polkadot/api-base/types';
@@ -96,7 +97,8 @@ export interface ApiDecoration<ApiType extends ApiTypes> {
registry: Registry;
rx: {
query: QueryableStorage<'rxjs'>;
}
};
tx: (extrinsic: Call | Extrinsic | Uint8Array | string) => SubmittableExtrinsic<ApiType>;
findCall (callIndex: Uint8Array | string): CallFunction;
findError (errorIndex: Uint8Array | string): RegistryError;
+6 -6
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/rpc-core": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/util": "^8.7.1"
"@babel/runtime": "^7.17.9",
"@polkadot/rpc-core": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/util": "^9.0.1"
}
}
+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.15.1' };
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.0.1' };
+8 -8
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/rpc-augment": "7.15.1",
"@polkadot/rpc-provider": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/util": "^8.7.1",
"@babel/runtime": "^7.17.9",
"@polkadot/rpc-augment": "8.0.1",
"@polkadot/rpc-provider": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/util": "^9.0.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^8.7.1",
"@polkadot/rpc-augment": "7.15.1"
"@polkadot/keyring": "^9.0.1",
"@polkadot/rpc-augment": "8.0.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.15.1' };
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.0.1' };
+5 -5
View File
@@ -44,18 +44,18 @@ console.log('latest block Hash', hash);
Instantiating a Provider for the Polkadot Relay Chain:
```javascript
import { ScProvider } from '@polkadot/rpc-provider';
import { ScProvider, WellKnownChain } from '@polkadot/rpc-provider/substrate-connect';
const provider = new ScProvider(SupportedChains.polkadot);
const provider = new ScProvider(WellKnownChain.polkadot);
await provider.connect();
const version = await provider.send('chain_getBlockHash', []);
```
Instantiating a Provider for a Polkadot parachain:
Instantiating a Provider for a Polkadot parachain:
```javascript
import { ScProvider } from '@polkadot/rpc-provider';
import { ScProvider, WellKnownChain } from '@polkadot/rpc-provider/substrate-connect';
const polkadotProvider = new ScProvider(SupportedChains.polkadot);
const polkadotProvider = new ScProvider(WellKnownChain.polkadot);
const parachainProvider = new ScProvider(parachainSpec, polkadotProvider);
await parachainProvider.connect();
const version = await parachainProvider.send('chain_getBlockHash', []);
+11 -11
View File
@@ -20,19 +20,19 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/keyring": "^8.7.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-support": "7.15.1",
"@polkadot/util": "^8.7.1",
"@polkadot/util-crypto": "^8.7.1",
"@polkadot/x-fetch": "^8.7.1",
"@polkadot/x-global": "^8.7.1",
"@polkadot/x-ws": "^8.7.1",
"@substrate/connect": "0.7.0-alpha.0",
"@babel/runtime": "^7.17.9",
"@polkadot/keyring": "^9.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-support": "8.0.1",
"@polkadot/util": "^9.0.1",
"@polkadot/util-crypto": "^9.0.1",
"@polkadot/x-fetch": "^9.0.1",
"@polkadot/x-global": "^9.0.1",
"@polkadot/x-ws": "^9.0.1",
"@substrate/connect": "0.7.2",
"eventemitter3": "^4.0.7",
"mock-socket": "^9.1.2",
"nock": "^13.2.4"
@@ -15,7 +15,7 @@ describe('decodeResponse', (): void => {
it('expects a non-empty input object', (): void => {
expect(
() => coder.decodeResponse(undefined as unknown as JsonRpcResponse)
).toThrow(/Empty response/);
).toThrow(/Invalid jsonrpc/);
});
it('expects a valid jsonrpc field', (): void => {
@@ -13,6 +13,6 @@ describe('encodeJson', (): void => {
it('encodes a valid JsonRPC JSON string', (): void => {
expect(
coder.encodeJson('method', ['params'])
).toEqual('{"id":1,"jsonrpc":"2.0","method":"method","params":["params"]}');
).toEqual([1, '{"id":1,"jsonrpc":"2.0","method":"method","params":["params"]}']);
});
});
@@ -10,19 +10,14 @@ describe('encodeObject', (): void => {
coder = new RpcCoder();
});
it('starts with id === 0 (nothing sent)', (): void => {
expect(coder.getId()).toEqual(0);
});
it('encodes a valid JsonRPC object', (): void => {
expect(
coder.encodeObject('method', ['a', 'b'])
).toEqual({
).toEqual([1, {
id: 1,
jsonrpc: '2.0',
method: 'method',
params: ['a', 'b']
});
expect(coder.getId()).toEqual(1);
}]);
});
});
+24 -28
View File
@@ -20,27 +20,34 @@ function formatErrorData (data?: string | number): string {
// very nested, pick a number and trim the result display to it
return formatted.length <= 256
? formatted
: `${formatted.substr(0, 255)}…`;
: `${formatted.substring(0, 255)}…`;
}
function checkError (error?: JsonRpcResponseBaseError): void {
if (error) {
const { code, data, message } = error;
throw new RpcError(`${code}: ${message}${formatErrorData(data)}`, code, data);
}
}
/** @internal */
export class RpcCoder {
#id = 0;
public decodeResponse (response: JsonRpcResponse): unknown {
assert(response, 'Empty response object received');
assert(response.jsonrpc === '2.0', 'Invalid jsonrpc field in decoded object');
public decodeResponse (response?: JsonRpcResponse): unknown {
assert(response && response.jsonrpc === '2.0', 'Invalid jsonrpc field in decoded object');
const isSubscription = !isUndefined(response.params) && !isUndefined(response.method);
assert(isNumber(response.id) || (isSubscription && (isNumber(response.params.subscription) || isString(response.params.subscription))), 'Invalid id field in decoded object');
this._checkError(response.error);
checkError(response.error);
assert(!isUndefined(response.result) || isSubscription, 'No result found in JsonRpc response');
assert(!isUndefined(response.result) || isSubscription, 'No result found in jsonrpc response');
if (isSubscription) {
this._checkError(response.params.error);
checkError(response.params.error);
return response.params.result;
}
@@ -48,31 +55,20 @@ export class RpcCoder {
return response.result;
}
public encodeJson (method: string, params: unknown[]): string {
return stringify(
this.encodeObject(method, params)
);
public encodeJson (method: string, params: unknown[]): [number, string] {
const [id, data] = this.encodeObject(method, params);
return [id, stringify(data)];
}
public encodeObject (method: string, params: unknown[]): JsonRpcRequest {
return {
id: ++this.#id,
public encodeObject (method: string, params: unknown[]): [number, JsonRpcRequest] {
const id = ++this.#id;
return [id, {
id,
jsonrpc: '2.0',
method,
params
};
}
public getId (): number {
return this.#id;
}
private _checkError (error?: JsonRpcResponseBaseError): void {
if (error) {
const { code, data, message } = error;
const fmtMessage = `${code}: ${message}${formatErrorData(data)}`;
throw new RpcError(fmtMessage, code, data);
}
}];
}
}
+1 -1
View File
@@ -122,7 +122,7 @@ export class HttpProvider implements ProviderInterface {
public async send <T> (method: string, params: unknown[], isCacheable?: boolean): Promise<T> {
this.#stats.total.requests++;
const body = this.#coder.encodeJson(method, params);
const [, body] = this.#coder.encodeJson(method, params);
let resultPromise: Promise<T> | null = isCacheable
? this.#callCache.get(body) as Promise<T>
: null;
+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.15.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.0.1' };
@@ -151,14 +151,19 @@ export class ScProvider implements ProviderInterface {
return;
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { id, unsubscribeMethod } = staleSubscriptions.pop()!;
const stale = staleSubscriptions.pop();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Promise.race([
this.send(unsubscribeMethod, [id]).catch(Function.prototype as () => void),
new Promise((resolve) => setTimeout(resolve, 500))
]).then(killStaleSubscriptions);
assert(stale, 'Unable to get stale subscription');
const { id, unsubscribeMethod } = stale;
Promise
.race([
this.send(unsubscribeMethod, [id]).catch(() => undefined),
new Promise((resolve) => setTimeout(resolve, 500))
])
.then(killStaleSubscriptions)
.catch(() => undefined);
};
hc.start((health) => {
@@ -256,12 +261,10 @@ export class ScProvider implements ProviderInterface {
}
public async send<T = any> (method: string, params: unknown[]): Promise<T> {
assert(this.isConnected, 'Provider is not connected');
assert(this.isConnected && this.#chain, 'Provider is not connected');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const chain = await this.#chain!;
const json = this.#coder.encodeJson(method, params);
const id = this.#coder.getId();
const chain = await this.#chain;
const [id, json] = this.#coder.encodeJson(method, params);
const result = new Promise<T>((resolve, reject): void => {
this.#requests.set(id, (response) => {
@@ -312,8 +315,9 @@ export class ScProvider implements ProviderInterface {
}
};
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const unsubscribeMethod = subscriptionUnsubscriptionMethods.get(method)!;
const unsubscribeMethod = subscriptionUnsubscriptionMethods.get(method);
assert(unsubscribeMethod, 'Invalid unsubscribe method found');
this.#subscriptions.set(subscriptionId, [cb, { id, unsubscribeMethod }]);
+6 -8
View File
@@ -295,13 +295,13 @@ export class WsProvider implements ProviderInterface {
public send <T = any> (method: string, params: unknown[], isCacheable?: boolean, subscription?: SubscriptionHandler): Promise<T> {
this.#stats.total.requests++;
const body = this.#coder.encodeJson(method, params);
const [id, body] = this.#coder.encodeJson(method, params);
let resultPromise: Promise<T> | null = isCacheable
? this.#callCache.get(body) as Promise<T>
: null;
if (!resultPromise) {
resultPromise = this.#send(body, method, params, subscription);
resultPromise = this.#send(id, body, method, params, subscription);
if (isCacheable) {
this.#callCache.set(body, resultPromise);
@@ -313,20 +313,18 @@ export class WsProvider implements ProviderInterface {
return resultPromise;
}
async #send <T> (json: string, method: string, params: unknown[], subscription?: SubscriptionHandler): Promise<T> {
async #send <T> (id: number, body: string, method: string, params: unknown[], subscription?: SubscriptionHandler): Promise<T> {
return new Promise<T>((resolve, reject): void => {
try {
assert(this.isConnected && !isNull(this.#websocket), 'WebSocket is not connected');
const id = this.#coder.getId();
const callback = (error?: Error | null, result?: T): void => {
error
? reject(error)
: resolve(result as T);
};
l.debug(() => ['calling', method, json]);
l.debug(() => ['calling', method, body]);
this.#handlers[id] = {
callback,
@@ -335,8 +333,8 @@ export class WsProvider implements ProviderInterface {
start: Date.now(),
subscription
};
this.#stats.total.bytesSent += json.length;
this.#websocket.send(json);
this.#stats.total.bytesSent += body.length;
this.#websocket.send(body);
} catch (error) {
reject(error);
}
+14 -14
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -30,20 +30,20 @@
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
},
"dependencies": {
"@babel/core": "^7.17.8",
"@babel/core": "^7.17.9",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.17.8",
"@polkadot/api": "7.15.1",
"@polkadot/api-augment": "7.15.1",
"@polkadot/rpc-augment": "7.15.1",
"@polkadot/rpc-provider": "7.15.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-augment": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/types-create": "7.15.1",
"@polkadot/types-support": "7.15.1",
"@polkadot/util": "^8.7.1",
"@polkadot/x-ws": "^8.7.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api": "8.0.1",
"@polkadot/api-augment": "8.0.1",
"@polkadot/rpc-augment": "8.0.1",
"@polkadot/rpc-provider": "8.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-augment": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/types-create": "8.0.1",
"@polkadot/types-support": "8.0.1",
"@polkadot/util": "^9.0.1",
"@polkadot/x-ws": "^9.0.1",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.4.0"
+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = function (file) {
let main;
try {
main = require(`../${file}.cjs`).main;
main = require(`../cjs/${file}.js`).main;
} catch (error) {
// required for dev-only setups
process.env.JEST_WORKER_ID = '123';
+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.15.1' };
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.0.1' };
+24 -13
View File
@@ -8,26 +8,37 @@ import { getSimilarTypes } from './derived';
describe('getSimilarTypes', (): void => {
let registry: TypeRegistry;
const mockImports = {
codecTypes: {},
definitions: {},
extrinsicTypes: {},
genericTypes: {},
ignoredTypes: [],
localTypes: {},
lookupTypes: {},
metadataTypes: {},
primitiveTypes: {},
typeToModule: {},
typesTypes: {}
};
beforeAll((): void => {
registry = new TypeRegistry();
});
it('handles nested Tuples', (): void => {
expect(getSimilarTypes(registry, {}, '(AccountId, (Balance, u32), u64)', {
codecTypes: {},
definitions: {},
extrinsicTypes: {},
genericTypes: {},
ignoredTypes: [],
localTypes: {},
lookupTypes: {},
metadataTypes: {},
primitiveTypes: {},
typeToModule: {},
typesTypes: {}
})).toEqual([
expect(getSimilarTypes(registry, {}, '(AccountId, (Balance, u32), u64)', mockImports)).toEqual([
'ITuple<[AccountId, ITuple<[Balance, u32]>, u64]>',
'[AccountId | string | Uint8Array, ITuple<[Balance, u32]> | [Balance | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], u64 | AnyNumber | Uint8Array]'
]);
});
it('handles vectors of slices', (): void => {
expect(getSimilarTypes(registry, {}, 'Vec<[u8;4]>', mockImports)).toEqual([
'Vec<U8aFixed>'
]);
expect(getSimilarTypes(registry, {}, 'Vec<[Balance;8]>', mockImports)).toEqual([
'Vec<Vec<Balance>>'
]);
});
});
+2
View File
@@ -58,6 +58,8 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
);
possibleTypes.push(`([${subs.join(', ')}])[]`);
} else if (subDef.info === TypeDefInfo.VecFixed) {
// TODO: Add possibleTypes so imports work
} else {
throw new Error(`Unhandled subtype in Vec, ${stringify(subDef)}`);
}
+5 -5
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/types": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/util": "^8.7.1"
"@babel/runtime": "^7.17.9",
"@polkadot/types": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/util": "^9.0.1"
}
}
+5 -5
View File
@@ -5,13 +5,13 @@
export default {
/**
* Lookup75: kusama_runtime::ProxyType
* Lookup76: kusama_runtime::ProxyType
**/
KusamaRuntimeProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy', 'Auction', 'Society']
},
/**
* Lookup252: kusama_runtime::SessionKeys
* Lookup253: kusama_runtime::SessionKeys
**/
KusamaRuntimeSessionKeys: {
grandpa: 'SpFinalityGrandpaAppPublic',
@@ -22,7 +22,7 @@ export default {
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
},
/**
* Lookup326: kusama_runtime::OriginCaller
* Lookup327: kusama_runtime::OriginCaller
**/
KusamaRuntimeOriginCaller: {
_enum: {
@@ -129,7 +129,7 @@ export default {
}
},
/**
* Lookup392: kusama_runtime::NposCompactSolution24
* Lookup393: kusama_runtime::NposCompactSolution24
**/
KusamaRuntimeNposCompactSolution24: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
@@ -158,7 +158,7 @@ export default {
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
},
/**
* Lookup747: kusama_runtime::Runtime
* Lookup748: kusama_runtime::Runtime
**/
KusamaRuntimeRuntime: 'Null'
};
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -6,7 +6,7 @@ declare module '@polkadot/types/lookup' {
import type { ITuple } from '@polkadot/types-codec/types';
import type { PerU16 } from '@polkadot/types/interfaces/runtime';
/** @name KusamaRuntimeProxyType (75) */
/** @name KusamaRuntimeProxyType (76) */
export interface KusamaRuntimeProxyType extends Enum {
readonly isAny: boolean;
readonly isNonTransfer: boolean;
@@ -19,7 +19,7 @@ declare module '@polkadot/types/lookup' {
readonly type: 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | 'IdentityJudgement' | 'CancelProxy' | 'Auction' | 'Society';
}
/** @name KusamaRuntimeSessionKeys (252) */
/** @name KusamaRuntimeSessionKeys (253) */
export interface KusamaRuntimeSessionKeys extends Struct {
readonly grandpa: SpFinalityGrandpaAppPublic;
readonly babe: SpConsensusBabeAppPublic;
@@ -29,7 +29,7 @@ declare module '@polkadot/types/lookup' {
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
}
/** @name KusamaRuntimeOriginCaller (326) */
/** @name KusamaRuntimeOriginCaller (327) */
export interface KusamaRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSupportDispatchRawOrigin;
@@ -45,7 +45,7 @@ declare module '@polkadot/types/lookup' {
readonly type: 'System' | 'Void' | 'Council' | 'TechnicalCommittee' | 'ParachainsOrigin' | 'XcmPallet';
}
/** @name KusamaRuntimeNposCompactSolution24 (392) */
/** @name KusamaRuntimeNposCompactSolution24 (393) */
export interface KusamaRuntimeNposCompactSolution24 extends Struct {
readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>;
readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>;
@@ -73,7 +73,7 @@ declare module '@polkadot/types/lookup' {
readonly votes24: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>;
}
/** @name KusamaRuntimeRuntime (747) */
/** @name KusamaRuntimeRuntime (748) */
export type KusamaRuntimeRuntime = Null;
} // declare module
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+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.15.1' };
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '8.0.1' };
File diff suppressed because one or more lines are too long
+7 -7
View File
@@ -20,16 +20,16 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/util": "^8.7.1"
"@babel/runtime": "^7.17.9",
"@polkadot/util": "^9.0.1"
},
"devDependencies": {
"@polkadot/types": "7.15.1",
"@polkadot/types-augment": "7.15.1",
"@polkadot/types-support": "7.15.1",
"@polkadot/util-crypto": "^8.7.1"
"@polkadot/types": "8.0.1",
"@polkadot/types-augment": "8.0.1",
"@polkadot/types-support": "8.0.1",
"@polkadot/util-crypto": "^9.0.1"
}
}
+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.15.1' };
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '8.0.1' };
+5 -5
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/types-codec": "7.15.1",
"@polkadot/util": "^8.7.1"
"@babel/runtime": "^7.17.9",
"@polkadot/types-codec": "8.0.1",
"@polkadot/util": "^9.0.1"
},
"devDependencies": {
"@polkadot/types": "7.15.1"
"@polkadot/types": "8.0.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.15.1' };
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '8.0.1' };
+7 -7
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/networks": "^8.7.1",
"@polkadot/types": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/types-create": "7.15.1",
"@polkadot/util": "^8.7.1"
"@babel/runtime": "^7.17.9",
"@polkadot/networks": "^9.0.1",
"@polkadot/types": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/types-create": "8.0.1",
"@polkadot/util": "^9.0.1"
}
}
+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.15.1' };
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '8.0.1' };
@@ -10,7 +10,7 @@ const upgrades: ChainUpgradesRaw = [
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050],
[6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110], [7560558, 9122],
[8115869, 9140], [8638103, 9151], [9280179, 9170]
[8115869, 9140], [8638103, 9151], [9280179, 9170], [9738717, 9180]
];
export default upgrades;
+3 -3
View File
@@ -20,10 +20,10 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/util": "^8.7.1"
"@babel/runtime": "^7.17.9",
"@polkadot/util": "^9.0.1"
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+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.15.1' };
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '8.0.1' };
+10 -10
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.15.1",
"version": "8.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/keyring": "^8.7.1",
"@polkadot/types-augment": "7.15.1",
"@polkadot/types-codec": "7.15.1",
"@polkadot/types-create": "7.15.1",
"@polkadot/util": "^8.7.1",
"@polkadot/util-crypto": "^8.7.1",
"@babel/runtime": "^7.17.9",
"@polkadot/keyring": "^9.0.1",
"@polkadot/types-augment": "8.0.1",
"@polkadot/types-codec": "8.0.1",
"@polkadot/types-create": "8.0.1",
"@polkadot/util": "^9.0.1",
"@polkadot/util-crypto": "^9.0.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^8.7.1",
"@polkadot/types-support": "7.15.1"
"@polkadot/keyring": "^9.0.1",
"@polkadot/types-support": "8.0.1"
}
}
@@ -373,7 +373,7 @@ export class PortableRegistry extends Struct implements ILookup {
}
public get names (): string[] {
return Object.values(this.#names);
return Object.values(this.#names).sort();
}
/**
+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.15.1' };
export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '8.0.1' };
+414 -413
View File
File diff suppressed because it is too large Load Diff