Compare commits

...
10 Commits
Author SHA1 Message Date
github-actions[bot] d0e0008399 [CI Skip] release/stable 10.7.2
skip-checks: true
2023-05-21 10:24:18 +00:00
Jaco a6eeba83c1 10.7.2 (#5652) 2023-05-21 13:13:34 +03:00
github-actions[bot] 541eceae82 [CI Skip] bump/beta 10.7.2-3-x
skip-checks: true
2023-05-21 09:48:40 +00:00
Jaco 3d0a1701fa Bump dev & adjust duplicated exports (#5651) 2023-05-21 12:40:07 +03:00
github-actions[bot] 0e46592f4d [CI Skip] bump/beta 10.7.2-2-x
skip-checks: true
2023-05-20 07:55:15 +00:00
polymath-eric a561253de9 Allow unset external signer (#5649) 2023-05-20 10:46:06 +03:00
github-actions[bot] 0c6a4754f0 [CI Skip] bump/beta 10.7.2-1-x
skip-checks: true
2023-05-18 09:08:21 +00:00
Jaco 60dd4e9699 Adjust tsconfig usage (w/ latest dev) (#5648) 2023-05-18 11:59:11 +03:00
github-actions[bot] f10f79c0ac [CI Skip] bump/beta 10.7.2-0-x
skip-checks: true
2023-05-18 05:51:41 +00:00
Jaco 8394c71cfa Bump dev deps (#5647)
* Bump dev deps

* Adjust

* Actual bump, fix tsconfig for typegen
2023-05-18 08:42:41 +03:00
104 changed files with 1142 additions and 551 deletions
-25
View File
@@ -1,25 +0,0 @@
// Copyright 2017-2023 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/eslint.cjs');
module.exports = {
...base,
ignorePatterns: [
...base.ignorePatterns,
'/scripts'
],
parserOptions: {
...base.parserOptions,
project: [
'./tsconfig.eslint.json'
]
},
rules: {
...base.rules,
// add override for any (a metric ton of them, initial conversion)
'@typescript-eslint/no-explicit-any': 'off',
// this seems very broken atm, false positives
'@typescript-eslint/unbound-method': 'off'
}
};
+1 -1
View File
@@ -21,5 +21,5 @@ jobs:
- name: ${{ matrix.step }}
if: always()
run: |
yarn install --immutable | grep -v 'YN0013'
yarn install --immutable
yarn ${{ matrix.step }}
+1 -1
View File
@@ -27,5 +27,5 @@ jobs:
node-version: 'lts/*'
- name: ${{ matrix.step }}
run: |
yarn install --immutable | grep -v 'YN0013'
yarn install --immutable
yarn ${{ matrix.step }}
+5
View File
@@ -2,6 +2,11 @@ enableImmutableInstalls: false
enableProgressBars: false
logFilters:
# Discard any "cannot be found in cache" messages
- code: YN0013
level: discard
nodeLinker: node-modules
plugins:
+11
View File
@@ -1,5 +1,16 @@
# CHANGELOG
## 10.7.2 May 21, 2023
Contributed:
- Allow `api.setSigner(...)` to clear existing (Thanks to https://github.com/polymath-eric)
Changes:
- Adjust `@polkadot/types-create` exports with no duplicates
## 10.7.1 May 13, 2023
Changes:
+2 -1
View File
@@ -1,4 +1,4 @@
3460 Jaco 10.7.1 (#5645)
3464 Jaco 10.7.2 (#5652)
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)
@@ -98,6 +98,7 @@
1 Paul M Fox Basic BTreeMaps codec support (#1474)
1 philipstanislaus Update types for centrifuge chain v1.2.0 (#2424)
1 Pierre Krieger Update substrate/connect to 0.7.6 (#4940)
1 polymath-eric Allow unset external signer (#5649)
1 Qinxuan Chen Add fp_account::AccountId20 mapping (#5551)
1 qiuhao update DeriveCustom type (#2581)
1 r0t0r-r0t0r Fix memory leak on raw rpc call (#4505)
+16
View File
@@ -0,0 +1,16 @@
// Copyright 2017-2023 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
import baseConfig from '@polkadot/dev/config/eslint';
export default [
...baseConfig,
{
rules: {
// add override for any (a metric ton of them, initial conversion)
'@typescript-eslint/no-explicit-any': 'off',
// we generally use this in isFunction, not via calling
'@typescript-eslint/unbound-method': 'off'
}
}
];
+5 -5
View File
@@ -14,10 +14,10 @@
},
"sideEffects": false,
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"versions": {
"git": "10.7.1",
"npm": "10.7.1"
"git": "10.7.2",
"npm": "10.7.2"
},
"workspaces": [
"packages/*"
@@ -40,9 +40,9 @@
"test:one": "polkadot-dev-run-test --env node"
},
"devDependencies": {
"@polkadot/dev": "^0.73.17",
"@polkadot/dev": "^0.75.4",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/node": "^20.1.3"
"@types/node": "^20.2.1"
},
"resolutions": {
"typescript": "^5.0.4"
+7 -7
View File
@@ -18,15 +18,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/api-base": "10.7.1",
"@polkadot/rpc-augment": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-augment": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/api-base": "10.7.2",
"@polkadot/rpc-augment": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/types-augment": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/util": "^12.2.1",
"tslib": "^2.5.0"
"tslib": "^2.5.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: '10.7.1' };
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '10.7.2' };
+1
View File
@@ -7,6 +7,7 @@
},
"exclude": [
"**/*.spec.ts",
"**/mod.ts",
"**/kusama/*.ts",
"**/polkadot/*.ts"
],
@@ -1,22 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"emitDeclarationOnly": false,
"noEmit": true
},
"include": [
"**/kusama/*.spec.ts"
],
"references": [
{ "path": "../api-augment/tsconfig.build.json" },
{ "path": "../api-augment/tsconfig.kusama.json" },
{ "path": "../api-base/tsconfig.build.json" },
{ "path": "../rpc-augment/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-augment/tsconfig.build.json" },
{ "path": "../types-support/tsconfig.build.json" }
]
}
+4 -4
View File
@@ -18,13 +18,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/rpc-core": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/rpc-core": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/util": "^12.2.1",
"rxjs": "^7.8.1",
"tslib": "^2.5.0"
"tslib": "^2.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: '10.7.1' };
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '10.7.2' };
+3
View File
@@ -5,6 +5,9 @@
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/mod.ts"
],
"references": [
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" }
+7 -7
View File
@@ -18,20 +18,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/api": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/types-create": "10.7.1",
"@polkadot/api": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/types-create": "10.7.2",
"@polkadot/util": "^12.2.1",
"@polkadot/util-crypto": "^12.2.1",
"rxjs": "^7.8.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/api-augment": "10.7.1",
"@polkadot/api-augment": "10.7.2",
"@polkadot/keyring": "^12.2.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: '10.7.1' };
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '10.7.2' };
+3 -4
View File
@@ -6,11 +6,10 @@
"rootDir": "./src"
},
"exclude": [
"**/test/**/*.json",
"**/test/**/*.ts",
"**/test/**/*.wasm",
"**/checkTypes.manual.ts",
"**/test/**/*",
"**/*.spec.ts",
"**/checkTypes.manual.ts",
"**/mod.ts",
"mock.ts"
],
"references": [
+13 -13
View File
@@ -18,25 +18,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/api": "10.7.1",
"@polkadot/api-augment": "10.7.1",
"@polkadot/api-base": "10.7.1",
"@polkadot/rpc-core": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/api": "10.7.2",
"@polkadot/api-augment": "10.7.2",
"@polkadot/api-base": "10.7.2",
"@polkadot/rpc-core": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/util": "^12.2.1",
"@polkadot/util-crypto": "^12.2.1",
"rxjs": "^7.8.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/api": "10.7.1",
"@polkadot/api-augment": "10.7.1",
"@polkadot/rpc-augment": "10.7.1",
"@polkadot/rpc-provider": "10.7.1",
"@polkadot/types-support": "10.7.1"
"@polkadot/api": "10.7.2",
"@polkadot/api-augment": "10.7.2",
"@polkadot/rpc-augment": "10.7.2",
"@polkadot/rpc-provider": "10.7.2",
"@polkadot/types-support": "10.7.2"
}
}
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '10.7.2' };
+1
View File
@@ -8,6 +8,7 @@
"exclude": [
"**/test/*",
"**/checkTypes.manual.ts",
"**/mod.ts",
"**/*.spec.ts"
],
"references": [
+15 -15
View File
@@ -18,29 +18,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/api-augment": "10.7.1",
"@polkadot/api-base": "10.7.1",
"@polkadot/api-derive": "10.7.1",
"@polkadot/api-augment": "10.7.2",
"@polkadot/api-base": "10.7.2",
"@polkadot/api-derive": "10.7.2",
"@polkadot/keyring": "^12.2.1",
"@polkadot/rpc-augment": "10.7.1",
"@polkadot/rpc-core": "10.7.1",
"@polkadot/rpc-provider": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-augment": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/types-create": "10.7.1",
"@polkadot/types-known": "10.7.1",
"@polkadot/rpc-augment": "10.7.2",
"@polkadot/rpc-core": "10.7.2",
"@polkadot/rpc-provider": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/types-augment": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/types-create": "10.7.2",
"@polkadot/types-known": "10.7.2",
"@polkadot/util": "^12.2.1",
"@polkadot/util-crypto": "^12.2.1",
"eventemitter3": "^5.0.1",
"rxjs": "^7.8.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/api-augment": "10.7.1",
"@polkadot/types-support": "10.7.1"
"@polkadot/api-augment": "10.7.2",
"@polkadot/types-support": "10.7.2"
}
}
+1 -1
View File
@@ -58,7 +58,7 @@ export abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType>
/**
* @description Set an external signer which will be used to sign extrinsic when account passed in is not KeyringPair
*/
public setSigner (signer: Signer): void {
public setSigner (signer: Signer | undefined): void {
this._rx.signer = signer;
}
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '10.7.2' };
+2 -1
View File
@@ -21,7 +21,7 @@ describe('Combinator', (): void => {
fns = [];
});
it('it triggers on all values', async (): Promise<void> => {
it('triggers on all values', async (): Promise<void> => {
await new Promise<boolean>((resolve) => {
let count = 0;
const combinator = new Combinator(
@@ -90,6 +90,7 @@ describe('Combinator', (): void => {
});
});
// eslint-disable-next-line jest/expect-expect
it('unsubscribes as required', async (): Promise<void> => {
await new Promise<void>((resolve) => {
// eslint-disable-next-line @typescript-eslint/require-await
+1
View File
@@ -87,6 +87,7 @@ describe('ApiPromise', (): void => {
await api.disconnect();
});
// eslint-disable-next-line jest/expect-expect
it('Create API instance will error on failure to await ready', async (): Promise<void> => {
class ErrorApiPromise extends ApiPromise {
constructor () {
+7
View File
@@ -25,12 +25,19 @@ export type { Signer, SignerResult } from '@polkadot/types/types';
export { ApiBase } from '../base/index.js';
// all starred
// eslint-disable-next-line import/export
export * from '@polkadot/api/types/calls';
// eslint-disable-next-line import/export
export * from '@polkadot/api/types/consts';
// eslint-disable-next-line import/export
export * from '@polkadot/api/types/errors';
// eslint-disable-next-line import/export
export * from '@polkadot/api/types/events';
// eslint-disable-next-line import/export
export * from '@polkadot/api/types/storage';
// eslint-disable-next-line import/export
export * from '@polkadot/api/types/submittable';
// eslint-disable-next-line import/export
export * from '@polkadot/api-base/types';
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
+1 -1
View File
@@ -46,7 +46,7 @@ describe('extractStorageArgs', (): void => {
).toThrow('staking.payee(AccountId32) is a map, requiring 1 arguments, 0 found');
});
it('validates map, 1 arg (failing with no args)', (): void => {
it('validates map, 1 arg (failing with more args)', (): void => {
expect(
() => extractStorageArgs(registry, storage.staking.payee, ['abc', 'def'])
).toThrow('staking.payee(AccountId32) is a map, requiring 1 arguments, 2 found');
+1
View File
@@ -7,6 +7,7 @@
},
"exclude": [
"**/checkTypes.manual.ts",
"**/mod.ts",
"**/*.spec.ts",
"**/test/**/*"
],
+5 -5
View File
@@ -18,13 +18,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/rpc-core": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/rpc-core": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/util": "^12.2.1",
"tslib": "^2.5.0"
"tslib": "^2.5.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: '10.7.1' };
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '10.7.2' };
+3
View File
@@ -5,6 +5,9 @@
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/mod.ts"
],
"references": [
{ "path": "../rpc-core/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
+6 -6
View File
@@ -18,18 +18,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/rpc-augment": "10.7.1",
"@polkadot/rpc-provider": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/rpc-augment": "10.7.2",
"@polkadot/rpc-provider": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/util": "^12.2.1",
"rxjs": "^7.8.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/keyring": "^12.2.1",
"@polkadot/rpc-augment": "10.7.1"
"@polkadot/rpc-augment": "10.7.2"
}
}
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '10.7.2' };
+1 -1
View File
@@ -28,7 +28,7 @@ describe('replay', (): void => {
await new Promise<boolean>((resolve) => {
rpc.system.chain().subscribe((value: any): void => {
if (value) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access, jest/no-conditional-expect
expect(value.toString()).toEqual('mockChain'); // Defined in MockProvider
resolve(true);
}
+1
View File
@@ -7,6 +7,7 @@
},
"exclude": [
"**/checkTypes.manual.ts",
"**/mod.ts",
"**/*.spec.ts"
],
"references": [
+4 -4
View File
@@ -18,12 +18,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/keyring": "^12.2.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-support": "10.7.1",
"@polkadot/types": "10.7.2",
"@polkadot/types-support": "10.7.2",
"@polkadot/util": "^12.2.1",
"@polkadot/util-crypto": "^12.2.1",
"@polkadot/x-fetch": "^12.2.1",
@@ -32,7 +32,7 @@
"eventemitter3": "^5.0.1",
"mock-socket": "^9.2.1",
"nock": "^13.3.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@substrate/connect": "0.7.26"
@@ -45,14 +45,17 @@ describe('Http', (): void => {
it('does not (yet) support subscribe', async (): Promise<void> => {
await http.subscribe('', '', [], (cb): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect(cb).toEqual(expect.anything());
}).catch((error): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/does not have subscriptions/);
});
});
it('does not (yet) support unsubscribe', async (): Promise<void> => {
await http.unsubscribe('', '', 0).catch((error): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/does not have subscriptions/);
});
});
@@ -10,6 +10,7 @@ import { HttpProvider } from './index.js';
// Does not work with Node 18 (native fetch)
// See https://github.com/nock/nock/issues/2397
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('send', (): void => {
let http: HttpProvider;
let mock: Mock;
@@ -53,6 +54,7 @@ describe.skip('send', (): void => {
return http
.send('test_error', [])
.catch((error): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/\[500\]/);
});
});
+2 -1
View File
@@ -21,7 +21,8 @@ describe('on', (): void => {
await mock.disconnect();
});
it('it emits both connected and disconnected events', async (): Promise<void> => {
// eslint-disable-next-line jest/expect-expect
it('emits both connected and disconnected events', async (): Promise<void> => {
const events: Record<string, boolean> = { connected: false, disconnected: false };
await new Promise<boolean>((resolve) => {
@@ -23,6 +23,7 @@ describe('send', (): void => {
return mock
.send('something_invalid', [])
.catch((error): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/Invalid method/);
});
});
@@ -23,6 +23,7 @@ describe('subscribe', (): void => {
await mock
.subscribe('test', 'test_notFound')
.catch((error): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/Invalid method 'test_notFound'/);
});
});
@@ -41,12 +42,14 @@ describe('subscribe', (): void => {
await new Promise<boolean>((resolve) => {
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, value: string): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect(value).toEqual('testValue');
resolve(true);
}).catch(console.error);
});
});
// eslint-disable-next-line jest/expect-expect
it('calls back with new headers', async (): Promise<void> => {
await new Promise<boolean>((resolve) => {
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
@@ -57,6 +60,7 @@ describe('subscribe', (): void => {
});
});
// eslint-disable-next-line jest/expect-expect
it('handles errors within callbacks gracefully', async (): Promise<void> => {
let hasThrown = false;
@@ -30,12 +30,14 @@ describe('unsubscribe', (): void => {
await mock
.unsubscribe('chain_newHead', 'chain_subscribeNewHead', 5)
.catch((error): boolean => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/Unable to find/);
return false;
});
});
// eslint-disable-next-line jest/expect-expect
it('unsubscribes successfully', async (): Promise<void> => {
await mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id);
});
@@ -46,6 +48,7 @@ describe('unsubscribe', (): void => {
mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
)
.catch((error): boolean => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/Unable to find/);
return false;
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '10.7.2' };
@@ -321,6 +321,7 @@ describe('ScProvider', () => {
expect(chain._isTerminated()).toBe(true);
});
// eslint-disable-next-line jest/expect-expect
it('does not throw when disconnecting on an already disconnected Provider', async () => {
const provider = new ScProvider(mockSc, '');
@@ -39,10 +39,12 @@ describe('Ws', (): void => {
).toEqual(false);
});
// eslint-disable-next-line jest/expect-expect
it('allows you to initialize the provider with custom headers', () => {
createWs([], 100, { foo: 'bar' });
});
// eslint-disable-next-line jest/expect-expect
it('allows you to set custom timeout value for handlers', () => {
const CUSTOM_TIMEOUT_S = 90;
const CUSTOM_TIMEOUT_MS = CUSTOM_TIMEOUT_S * 1000;
@@ -52,6 +54,7 @@ describe('Ws', (): void => {
});
describe('Endpoint Parsing', (): void => {
// eslint-disable-next-line jest/expect-expect
it('Succeeds when WsProvider endpoint is a valid string', () => {
/* eslint-disable no-new */
new WsProvider(TEST_WS_URL, 0);
@@ -63,6 +66,7 @@ describe('Endpoint Parsing', (): void => {
).toThrow(/^Endpoint should start with /);
});
// eslint-disable-next-line jest/expect-expect
it('Succeeds when WsProvider endpoint is a valid array', () => {
const endpoints: string[] = ['ws://127.0.0.1:9955', 'wss://testnet.io:9944', 'ws://mychain.com:9933'];
@@ -59,6 +59,7 @@ describe('send', (): void => {
ws
.send('test_encoding', [{ error: 'send error' }])
.catch((error): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toEqual('send error');
})
);
@@ -99,6 +100,7 @@ describe('send', (): void => {
ws
.send('test_error', [])
.catch((error): void => {
// eslint-disable-next-line jest/no-conditional-expect
expect((error as Error).message).toMatch(/666: error/);
})
);
+2 -1
View File
@@ -7,7 +7,8 @@
"resolveJsonModule": true
},
"exclude": [
"**/*.spec.ts"
"**/*.spec.ts",
"**/mod.ts"
],
"references": [
{ "path": "../types/tsconfig.build.json" },
+1 -1
View File
@@ -4,8 +4,8 @@
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"resolveJsonModule": true,
"emitDeclarationOnly": false,
"resolveJsonModule": true,
"noEmit": true
},
"include": [
+11 -11
View File
@@ -18,7 +18,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.mjs",
@@ -28,20 +28,20 @@
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.mjs"
},
"dependencies": {
"@polkadot/api": "10.7.1",
"@polkadot/api-augment": "10.7.1",
"@polkadot/rpc-augment": "10.7.1",
"@polkadot/rpc-provider": "10.7.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-augment": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/types-create": "10.7.1",
"@polkadot/types-support": "10.7.1",
"@polkadot/api": "10.7.2",
"@polkadot/api-augment": "10.7.2",
"@polkadot/rpc-augment": "10.7.2",
"@polkadot/rpc-provider": "10.7.2",
"@polkadot/types": "10.7.2",
"@polkadot/types-augment": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/types-create": "10.7.2",
"@polkadot/types-support": "10.7.2",
"@polkadot/util": "^12.2.1",
"@polkadot/util-crypto": "^12.2.1",
"@polkadot/x-ws": "^12.2.1",
"handlebars": "^4.7.7",
"tslib": "^2.5.0",
"tslib": "^2.5.2",
"yargs": "^17.7.2"
},
"devDependencies": {
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '10.7.2' };
+3
View File
@@ -8,3 +8,6 @@ import { readTemplate } from './file.js';
Handlebars.registerPartial({
docs: Handlebars.compile(readTemplate('docs'))
});
// empty export
export const __TYPEGEN_DUMMY_DOCS = 'DUMMY_DOCS';
+8
View File
@@ -5,6 +5,14 @@
"outDir": "./build",
"rootDir": "./src"
},
"include": [
"src/**/*"
],
"exclude": [
"scripts/**/*",
"**/*.spec.ts",
"**/mod.ts"
],
"references": [
{ "path": "../api/tsconfig.build.json" },
{ "path": "../api-augment/tsconfig.build.json" },
+19
View File
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./scripts",
"emitDeclarationOnly": false,
"noEmit": true
},
"include": [
"scripts/**/*"
],
"exclude": [
"src/**/*"
],
"references": [
{ "path": "../typegen/tsconfig.build.json" }
]
}
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"emitDeclarationOnly": false,
"noEmit": true
},
"include": [
"**/*.spec.ts"
],
"references": [
{ "path": "../typegen/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" }
]
}
+4 -4
View File
@@ -18,12 +18,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/types": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/types": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/util": "^12.2.1",
"tslib": "^2.5.0"
"tslib": "^2.5.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: '10.7.1' };
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '10.7.2' };
@@ -5,6 +5,9 @@
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/mod.ts"
],
"references": [
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" }
+5 -5
View File
@@ -18,17 +18,17 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/util": "^12.2.1",
"@polkadot/x-bigint": "^12.2.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/types": "10.7.1",
"@polkadot/types-augment": "10.7.1",
"@polkadot/types-support": "10.7.1",
"@polkadot/types": "10.7.2",
"@polkadot/types-augment": "10.7.2",
"@polkadot/types-support": "10.7.2",
"@polkadot/util-crypto": "^12.2.1"
}
}
@@ -16,7 +16,7 @@ describe('Compact', (): void => {
describe('constructor', (): void => {
it('fails on > MAX_SAFE_INTEGER', (): void => {
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, no-loss-of-precision
expect(() => new Compact(registry, 'u128', 9007199254740999)).toThrow(/integer <= Number.MAX_SAFE_INTEGER/);
});
+2 -2
View File
@@ -18,7 +18,7 @@ describe('Result', (): void => {
it('decodes from a u8a (success)', (): void => {
const result = new Type(registry, new Uint8Array([0, 1, 2, 3, 4]));
expect(result.isOk);
expect(result.isOk).toBe(true);
expect(result.asOk.toU8a()).toEqual(new Uint8Array([1, 2, 3, 4]));
expect(result.toHex()).toEqual('0x0001020304');
expect(result.toJSON()).toEqual({
@@ -29,7 +29,7 @@ describe('Result', (): void => {
it('decodes from a u8a (error)', (): void => {
const result = new Type(registry, new Uint8Array([1, 4 << 2, 100, 101, 102, 103]));
expect(result.isErr);
expect(result.isErr).toBe(true);
expect(result.asErr.toU8a()).toEqual(new Uint8Array([4 << 2, 100, 101, 102, 103]));
expect(result.toHex()).toEqual('0x011064656667');
expect(result.toJSON()).toEqual({
+2 -2
View File
@@ -13,9 +13,9 @@ 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
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, 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
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, 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/);
});
+2 -2
View File
@@ -39,7 +39,7 @@ describe('Vec', (): void => {
expect(new Vec(registry, Text, null)).toHaveLength(0);
});
it('decodes a complex type via construction', (): void => {
it('decodes a complex type via construction (1)', (): void => {
const test = createTypeUnsafe<Vec<ITuple<[PropIndex, AccountId]>>>(registry, 'Vec<(PropIndex, AccountId)>', [new Uint8Array([
4, 10, 0, 0, 0, 209, 114, 167, 76, 218, 76, 134, 89, 18, 195, 43, 160, 168, 10, 87, 174, 105, 171, 174, 65, 14, 92, 203, 89, 222, 232, 78, 47, 68, 50, 219, 79
])]);
@@ -48,7 +48,7 @@ describe('Vec', (): void => {
expect(test[0][1].toString()).toEqual('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua');
});
it('decodes a complex type via construction', (): void => {
it('decodes a complex type via construction (2)', (): void => {
const INPUT = '0x08cc0200000000ce0200000001';
const test = createTypeUnsafe<Vec<Codec>>(registry, 'Vec<(u32, [u32; 0], u16)>', [INPUT]);
@@ -141,7 +141,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
* @description Returns a breakdown of the hex encoding for this Codec
*/
public inspect (): Inspect {
const inner = new Array<Inspect>();
const inner: Inspect[] = [];
for (const v of this.values()) {
inner.push(v.inspect());
@@ -218,7 +218,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
public toU8a (isBare?: boolean): Uint8Array {
const encoded = new Array<Uint8Array>();
const encoded: Uint8Array[] = [];
if (!isBare) {
encoded.push(compactToU8a(this.size));
@@ -15,7 +15,7 @@ const registry = new TypeRegistry();
describe('BitVec', (): void => {
describe('decoding known', (): void => {
TESTS.forEach((test): void => {
describe(test, (): void => {
describe(`${test}`, (): void => {
const input = hexToU8a(test);
const bitvec = new BitVec(registry, input);
+2 -2
View File
@@ -154,7 +154,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
* @description Returns a breakdown of the hex encoding for this Codec
*/
public inspect (): Inspect {
const inner = new Array<Inspect>();
const inner: Inspect[] = [];
for (const [k, v] of this.entries()) {
inner.push(k.inspect());
@@ -240,7 +240,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
public toU8a (isBare?: boolean): Uint8Array {
const encoded = new Array<Uint8Array>();
const encoded: Uint8Array[] = [];
if (!isBare) {
encoded.push(compactToU8a(this.size));
+1 -1
View File
@@ -233,7 +233,7 @@ export class Struct<
* @description Returns a breakdown of the hex encoding for this Codec
*/
public inspect (isBare?: BareOpts): Inspect {
const inner = new Array<Inspect>();
const inner: Inspect[] = [];
for (const [k, v] of this.entries()) {
inner.push({
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '10.7.2' };
@@ -1,6 +1,8 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* global it */
// Shamelessly copied from @polkadot/util/test
import { formatDecimal, formatNumber } from '@polkadot/util';
+2 -2
View File
@@ -3,12 +3,12 @@
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"resolveJsonModule": true
"rootDir": "./src"
},
"exclude": [
"**/*.data.ts",
"**/checkTypes.manual.ts",
"**/mod.ts",
"**/*.spec.ts",
"**/test/*"
],
-1
View File
@@ -5,7 +5,6 @@
"outDir": "./build",
"rootDir": "./src",
"emitDeclarationOnly": false,
"resolveJsonModule": true,
"noEmit": true
},
"include": [
+4 -4
View File
@@ -18,14 +18,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/types-codec": "10.7.1",
"@polkadot/types-codec": "10.7.2",
"@polkadot/util": "^12.2.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/types": "10.7.1"
"@polkadot/types": "10.7.2"
}
}
+1 -2
View File
@@ -6,5 +6,4 @@ export { packageInfo } from './packageInfo.js';
export { TypeDefInfo } from './types/index.js';
// all starred
export * from './create/index.js';
export * from './util/index.js';
export * from './exports.js';
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
// all starred
export * from './create/index.js';
export * from './util/index.js';
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '10.7.2' };
+3 -3
View File
@@ -3,11 +3,11 @@
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"resolveJsonModule": true
"rootDir": "./src"
},
"exclude": [
"**/*.spec.ts"
"**/*.spec.ts",
"**/mod.ts"
],
"references": [
{ "path": "../types-codec/tsconfig.build.json" }
-1
View File
@@ -5,7 +5,6 @@
"outDir": "./build",
"rootDir": "./src",
"emitDeclarationOnly": false,
"resolveJsonModule": true,
"noEmit": true
},
"include": [
+6 -6
View File
@@ -18,17 +18,17 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/networks": "^12.2.1",
"@polkadot/types": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/types-create": "10.7.1",
"@polkadot/types": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/types-create": "10.7.2",
"@polkadot/util": "^12.2.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/api": "10.7.1"
"@polkadot/api": "10.7.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: '10.7.1' };
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '10.7.2' };
@@ -45,6 +45,7 @@ for (const chain of keys) {
});
for (const [blockNumber, specVersion] of allMan[chain]) {
// eslint-disable-next-line jest/expect-expect
it(`blockNumber=${blockNumber}, specVersion=${specVersion}`, async (): Promise<void> => {
const found = avail.find(([n, s]) => n === blockNumber && s === specVersion);
@@ -64,7 +64,8 @@ describe('generated', (): void => {
});
for (const chain of Object.keys(allMan)) {
describe(chain, (): void => {
describe(`${chain}`, (): void => {
// eslint-disable-next-line jest/expect-expect
it('should have all generated', (): void => {
const missing = allMan[chain as keyof typeof allMan].filter(([na, sa]) =>
!allGen[chain as keyof typeof allGen].some(([nb, sb]) =>
@@ -78,10 +79,12 @@ describe('generated', (): void => {
}
});
// eslint-disable-next-line jest/expect-expect
it('manual should be correctly ordered', (): void => {
checkOrder(chain, (allGen as Record<string, ChainUpgradesExpanded>)[chain]);
});
// eslint-disable-next-line jest/expect-expect
it('generated should be correctly ordered', (): void => {
checkOrder(chain, (allMan as Record<string, ChainUpgradesRaw>)[chain]);
});
@@ -91,7 +94,7 @@ describe('generated', (): void => {
describe('upgrades', (): void => {
TESTS.forEach(({ genesisHash, network, versions }): void => {
describe(network, (): void => {
describe(`${network}`, (): void => {
const chain = upgrades.find((n) => n.network === network);
if (!chain) {
+2 -1
View File
@@ -6,7 +6,8 @@
"rootDir": "./src"
},
"exclude": [
"**/*.spec.ts"
"**/*.spec.ts",
"**/mod.ts"
],
"references": [
{ "path": "../types/tsconfig.build.json" },
-1
View File
@@ -5,7 +5,6 @@
"outDir": "./build",
"rootDir": "./src",
"emitDeclarationOnly": false,
"resolveJsonModule": true,
"noEmit": true
},
"include": [
+2 -2
View File
@@ -18,10 +18,10 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/util": "^12.2.1",
"tslib": "^2.5.0"
"tslib": "^2.5.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: '10.7.1' };
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '10.7.2' };
@@ -10,5 +10,8 @@
"src/**/*.json",
"src/**/*.ts"
],
"exclude": [
"**/mod.ts"
],
"references": []
}
+6 -6
View File
@@ -18,20 +18,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "10.7.1",
"version": "10.7.2",
"main": "index.js",
"dependencies": {
"@polkadot/keyring": "^12.2.1",
"@polkadot/types-augment": "10.7.1",
"@polkadot/types-codec": "10.7.1",
"@polkadot/types-create": "10.7.1",
"@polkadot/types-augment": "10.7.2",
"@polkadot/types-codec": "10.7.2",
"@polkadot/types-create": "10.7.2",
"@polkadot/util": "^12.2.1",
"@polkadot/util-crypto": "^12.2.1",
"rxjs": "^7.8.1",
"tslib": "^2.5.0"
"tslib": "^2.5.2"
},
"devDependencies": {
"@polkadot/keyring": "^12.2.1",
"@polkadot/types-support": "10.7.1"
"@polkadot/types-support": "10.7.2"
}
}
+2 -2
View File
@@ -198,14 +198,14 @@ describe('createType', (): void => {
it('allows for re-registration of a type', (): void => {
const balDef = registry.createType('Balance');
expect(balDef instanceof registry.createClass('Balance'));
expect(balDef instanceof registry.createClass('Balance')).toBe(true);
expect(balDef.bitLength()).toEqual(128);
registry.register({ Balance: 'u32' });
const balu32 = registry.createType('Balance');
expect(balu32 instanceof registry.createClass('Balance'));
expect(balu32 instanceof registry.createClass('Balance')).toBe(true);
expect(balu32.bitLength()).toEqual(32);
});
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// all external
export * from '@polkadot/types-create';
export * from '@polkadot/types-create/exports';
// all local
export * from './createClass.js';
+1 -1
View File
@@ -31,7 +31,7 @@ describe('TypeRegistry', (): void => {
expect(Type).toBeDefined();
// eslint-disable-next-line no-prototype-builtins
expect(isChildClass(DoNotConstruct, Type));
expect(isChildClass(DoNotConstruct, Type)).toBe(true);
});
it('can register single type', (): void => {
@@ -1,6 +1,8 @@
// Copyright 2017-2023 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable jest/expect-expect */
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { BN } from '@polkadot/util';
@@ -55,7 +55,7 @@ describe('ChainProperties', (): void => {
expect(tokenSymbol.unwrap().eq(['KSM'])).toBe(true);
});
it('has a sane toHuman', (): void => {
it('has a sane toHuman (single tokenDecimals)', (): void => {
expect(
registry.createType('ChainProperties', {
ss58Format: 42,
@@ -69,7 +69,7 @@ describe('ChainProperties', (): void => {
});
});
it('has a sane toHuman', (): void => {
it('has a sane toHuman (multiple tokenDecimals)', (): void => {
expect(
registry.createType('ChainProperties', {
ss58Format: 2,
+5 -1
View File
@@ -30,7 +30,7 @@ const metadata = new Metadata(registry, metadataStatic);
registry.setMetadata(metadata);
function testTypes (type: string, typeNames: string[]): void {
describe(type, (): void => {
describe(`${type}`, (): void => {
describe(`${type}:: default creation`, (): void => {
typeNames.forEach((name): void => {
it(`creates an empty ${name}`, (): void => {
@@ -38,8 +38,10 @@ function testTypes (type: string, typeNames: string[]): void {
registry.createType(name);
if (UNCONSTRUCTABLE.includes(name.toLowerCase())) {
// eslint-disable-next-line jest/no-conditional-expect
expect(constructFn).toThrow();
} else {
// eslint-disable-next-line jest/no-conditional-expect
expect(constructFn).not.toThrow();
}
});
@@ -53,8 +55,10 @@ function testTypes (type: string, typeNames: string[]): void {
registry.createType(name, registry.createType('Bytes'));
if (UNCONSTRUCTABLE.includes(name.toLowerCase())) {
// eslint-disable-next-line jest/no-conditional-expect
expect(constructFn).toThrow();
} else {
// eslint-disable-next-line jest/no-conditional-expect
expect(constructFn).not.toThrow();
}
});
@@ -53,7 +53,7 @@ describe('type definitions', (): void => {
);
for (const [key, { types }] of allTypes) {
describe(key, (): void => {
describe(`${key}`, (): void => {
const typesKeys = Object.keys(types).filter((type) =>
// meant to fail
type !== 'ExtrinsicUnknown' &&
@@ -80,11 +80,11 @@ describe('rpc definitions', (): void => {
);
for (const [section, { rpc }] of rpcs) {
describe(section, (): void => {
describe(`${section}`, (): void => {
const methodsEntries = Object.entries<DefinitionRpc>(rpc);
for (const [method, { params, type }] of methodsEntries) {
describe(method, (): void => {
describe(`${method}`, (): void => {
// We cannot constuct V0, so just ignore
if (section !== 'state' || method !== 'getMetadata') {
it(`output ${type} is known`, (): void => {
@@ -114,17 +114,17 @@ describe('runtime definitions', (): void => {
);
for (const [key, { runtime }] of runtimes) {
describe(key, (): void => {
describe(`${key}`, (): void => {
const versionsEntries = Object.entries<DefinitionsCallEntry[]>(runtime);
for (const [key, versions] of versionsEntries) {
describe(key, (): void => {
describe(`${key}`, (): void => {
for (const { methods, version } of versions) {
describe(`version ${version}`, (): void => {
const methodsEntries = Object.entries<DefinitionCall>(methods);
for (const [key, { params, type }] of methodsEntries) {
describe(key, (): void => {
describe(`${key}`, (): void => {
// Applied from runtime, used in Funglibles
if (type !== 'Result<Vec<XcmV3MultiAsset>, FungiblesAccessError>') {
it(`output ${type} is known`, (): void => {
@@ -3,6 +3,8 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
/* global describe, it, expect */
import type { Registry } from '@polkadot/types-codec/types';
import type { Check } from './types.js';
+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: '10.7.1' };
export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '10.7.2' };
+2 -2
View File
@@ -3,11 +3,11 @@
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"resolveJsonModule": true
"rootDir": "./src"
},
"exclude": [
"**/checkTypes.manual.ts",
"**/mod.ts",
"**/*.spec.ts"
],
"references": [
+3 -2
View File
@@ -30,11 +30,12 @@ const entries = [
...all,
[`@polkadot/${p}`]: path.resolve(process.cwd(), `packages/${p}/build/bundle.js`)
}), {
// re-exported in @polkadot/util-crypto, map directly
'@polkadot/networks': '@polkadot/util-crypto',
// we point to a specific file for these (default augmentations)
'@polkadot/rpc-core/types/jsonrpc': path.resolve(process.cwd(), 'packages/rpc-core/build/types/jsonrpc.js'),
'@polkadot/types-codec/types/registry': path.resolve(process.cwd(), 'packages/types-codec/build/types/registry.js'),
// re-exported in @polkadot/util-crypto, map directly
'@polkadot/networks': '@polkadot/util-crypto'
'@polkadot/types-create/exports': path.resolve(process.cwd(), 'packages/types-create/build/exports.js')
});
const overrides = {};
+12 -6
View File
@@ -5,16 +5,20 @@ import fs from 'node:fs';
import { fetch } from '@polkadot/x-fetch';
const META = 14;
const PREAMBLE = `// Copyright 2017-2023 @polkadot/types-support authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable */\n\n`;
const PREAMBLE = '// Copyright 2017-2023 @polkadot/types-support authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable */\n\n';
const CMD = {
kusama: `${PREAMBLE}// cargo run --release -- purge-chain -y --chain kusama-dev && cargo run --release -- --chain kusama-dev --alice --force-authoring\n\nexport default`,
polkadot: `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`,
substrate: `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`
}
};
let requestId = 0;
/**
*
* @param {'rpc_methods' | 'state_getMetadata' | 'state_getRuntimeVersion'} method
* @returns {Promise<any>}
*/
async function get (method) {
const res = await fetch('http://127.0.0.1:9944', {
body: JSON.stringify({
@@ -24,7 +28,7 @@ async function get (method) {
params: []
}),
headers: {
'Accept': 'application/json',
Accept: 'application/json',
'Content-Type': 'application/json'
},
method: 'post'
@@ -34,6 +38,7 @@ async function get (method) {
return body.result;
}
/** @type {[string[], string, { specName: 'polkadot' | 'kusama' | 'node'; specVersion: string; }]} */
const [methods, metadata, version] = await Promise.all([
get('rpc_methods'),
get('state_getMetadata'),
@@ -42,10 +47,11 @@ const [methods, metadata, version] = await Promise.all([
const chain = version.specName === 'node'
? 'substrate'
: version.specName;
const path = `packages/types-support/src/metadata/v${META}/${chain}`;
const metaVer = parseInt(metadata.substring(10, 12), 16);
const path = `packages/types-support/src/metadata/v${metaVer}/${chain}`;
fs.writeFileSync(`${path}-hex.ts`, `${CMD[chain]} '${metadata}';\n`);
fs.writeFileSync(`${path}-rpc.ts`, `${CMD[chain]} ${JSON.stringify(methods, null, 2)};\n`);
fs.writeFileSync(`${path}-ver.ts`, `${CMD[chain]} ${JSON.stringify(version, null, 2)};\n`);
console.log(`Done. ${chain}/${version.specVersion}`);
console.log(`Retrieved ${chain}/${version.specVersion}, metadata v${metaVer}`);
+1
View File
@@ -60,6 +60,7 @@
"@polkadot/types-codec/types": ["types-codec/src/types/index.ts"],
"@polkadot/types-codec/types/*": ["types-codec/src/types/*.ts"],
"@polkadot/types-create": ["types-create/src/index.ts"],
"@polkadot/types-create/exports": ["types-create/src/exports.ts"],
"@polkadot/types-create/packageInfo": ["types-create/src/packageInfo.ts"],
"@polkadot/types-create/types": ["types-create/src/types/index.ts"],
"@polkadot/types-create/types/*": ["types-create/src/types/*.ts"],

Some files were not shown because too many files have changed in this diff Show More