@acala-network/chopsticks 0.12.1 ā 0.13.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/context.d.ts +3 -3
- package/dist/cjs/logger.d.ts +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/plugins/fetch-storage/cli.js +1 -0
- package/dist/cjs/plugins/trace-transaction/utils.d.ts +0 -1
- package/dist/cjs/plugins/try-runtime/README.md +21 -0
- package/dist/cjs/plugins/try-runtime/index.js +61 -29
- package/dist/cjs/schema/index.d.ts +2 -6
- package/dist/cjs/setup-with-server.d.ts +3 -3
- package/dist/cjs/utils/fetch-storages.js +0 -1
- package/dist/esm/context.d.ts +3 -3
- package/dist/esm/logger.d.ts +1 -1
- package/dist/esm/plugins/fetch-storage/cli.js +2 -1
- package/dist/esm/plugins/trace-transaction/utils.d.ts +0 -1
- package/dist/esm/plugins/try-runtime/README.md +21 -0
- package/dist/esm/plugins/try-runtime/index.js +61 -29
- package/dist/esm/schema/index.d.ts +2 -6
- package/dist/esm/setup-with-server.d.ts +3 -3
- package/dist/esm/utils/fetch-storages.js +0 -1
- package/package.json +17 -17
package/dist/cjs/context.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export declare const setupContext: (argv: Config, overrideParent?: boolean) => P
|
|
|
7
7
|
fetchStorageWorker: {
|
|
8
8
|
worker: import("comlink").Remote<{
|
|
9
9
|
startFetch: (options: {
|
|
10
|
-
block?:
|
|
11
|
-
endpoint?: string | string[]
|
|
12
|
-
dbPath?: string
|
|
10
|
+
block?: number | string | null;
|
|
11
|
+
endpoint?: string | string[];
|
|
12
|
+
dbPath?: string;
|
|
13
13
|
config: import("./utils/fetch-storages.js").FetchStorageConfig;
|
|
14
14
|
}) => Promise<void>;
|
|
15
15
|
}>;
|
package/dist/cjs/logger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
export { defaultLogger, truncate } from '@acala-network/chopsticks-core';
|
|
3
3
|
export declare const spinnerFrames: string[];
|
|
4
|
-
export declare const apiFetching: _.
|
|
4
|
+
export declare const apiFetching: _.DebouncedFuncLeading<() => void>;
|
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type": "commonjs"}
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Try-Runtime CLI
|
|
2
|
+
|
|
3
|
+
š§ EXPERIMENTAL FEATURE š§
|
|
4
|
+
|
|
5
|
+
You can use Chopsticks to perform runtime migration checks. It doesn't support PoV measure yet, only weight check is support.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# try-runtime print help
|
|
9
|
+
npx @acala-network/chopsticks try-runtime --help
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Basic example:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @acala-network/chopsticks try-runtime \
|
|
16
|
+
--endpoint <wss://remote.endpoint> \
|
|
17
|
+
--runtime <wasm_runtime_path> \
|
|
18
|
+
--checks PreAndPost
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
__NOTE__: You can also use `--config` to pass arguments
|
|
@@ -8,61 +8,93 @@ Object.defineProperty(exports, "cli", {
|
|
|
8
8
|
return cli;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
11
12
|
const _nodefs = require("node:fs");
|
|
12
13
|
const _zod = require("zod");
|
|
13
14
|
const _index = require("../../schema/index.js");
|
|
14
|
-
const
|
|
15
|
-
const _openhtml = require("../../utils/open-html.js");
|
|
15
|
+
const _override = require("../../utils/override.js");
|
|
16
16
|
const _context = require("../../context.js");
|
|
17
17
|
const schema = _zod.z.object({
|
|
18
18
|
endpoint: _index.configSchema.shape.endpoint,
|
|
19
|
-
port: _index.configSchema.shape.port,
|
|
20
|
-
['build-block-mode']: _index.configSchema.shape['build-block-mode'],
|
|
21
19
|
block: _index.configSchema.shape.block,
|
|
22
20
|
db: _index.configSchema.shape.db,
|
|
23
|
-
['runtime-log-level']: _index.configSchema.shape['runtime-log-level'],
|
|
24
|
-
['
|
|
21
|
+
['runtime-log-level']: _index.configSchema.shape['runtime-log-level'].default(5),
|
|
22
|
+
['runtime']: _zod.z.string({
|
|
25
23
|
description: 'Path to WASM built with feature `try-runtime` enabled'
|
|
26
24
|
}),
|
|
25
|
+
'import-storage': _index.configSchema.shape['import-storage'],
|
|
26
|
+
checks: _zod.z.enum([
|
|
27
|
+
'None',
|
|
28
|
+
'All',
|
|
29
|
+
'PreAndPost',
|
|
30
|
+
'TryState'
|
|
31
|
+
]),
|
|
32
|
+
'disable-spec-check': _zod.z.boolean({
|
|
33
|
+
description: 'Disable spec name/version check'
|
|
34
|
+
}).optional(),
|
|
27
35
|
['output-path']: _zod.z.string({
|
|
28
36
|
description: 'File path to print output'
|
|
29
|
-
}).optional(),
|
|
30
|
-
html: _zod.z.boolean({
|
|
31
|
-
description: 'Generate html with storage diff'
|
|
32
|
-
}).optional(),
|
|
33
|
-
open: _zod.z.boolean({
|
|
34
|
-
description: 'Open generated html'
|
|
35
37
|
}).optional()
|
|
36
38
|
});
|
|
37
39
|
const cli = (y)=>{
|
|
38
|
-
y.command('try-runtime', '
|
|
39
|
-
|
|
40
|
+
y.command('try-runtime', 'š§ EXPERIMENTAL: Check upgrade migrations š§', (yargs)=>yargs.options((0, _index.getYargsOptions)(schema.shape)), async (argv)=>{
|
|
41
|
+
console.log('š§ EXPERIMENTAL FEATURE š§');
|
|
42
|
+
const config = schema.parse(argv);
|
|
43
|
+
if (!config.db) {
|
|
44
|
+
console.log('ā ļø Make sure to provide db, it will speed up the process');
|
|
45
|
+
}
|
|
46
|
+
const context = await (0, _context.setupContext)({
|
|
47
|
+
...config,
|
|
48
|
+
port: 8000,
|
|
49
|
+
'build-block-mode': _chopstickscore.BuildBlockMode.Manual
|
|
50
|
+
});
|
|
40
51
|
const block = context.chain.head;
|
|
41
52
|
const registry = await block.registry;
|
|
42
53
|
registry.register({
|
|
43
54
|
UpgradeCheckSelect: {
|
|
44
55
|
_enum: {
|
|
45
|
-
None: null
|
|
56
|
+
None: null,
|
|
57
|
+
All: null,
|
|
58
|
+
PreAndPost: null,
|
|
59
|
+
TryState: null
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
});
|
|
49
|
-
const
|
|
50
|
-
|
|
63
|
+
const oldVersion = await block.runtimeVersion;
|
|
64
|
+
// set new runtime
|
|
65
|
+
await (0, _override.overrideWasm)(block.chain, config.runtime);
|
|
66
|
+
const newVersion = await block.runtimeVersion;
|
|
67
|
+
console.log('\n');
|
|
68
|
+
console.log(new Array(80).fill('-').join(''));
|
|
69
|
+
console.log(`\tCurrent runtime spec_name: ${oldVersion.specName}, spec_version: ${oldVersion.specVersion}`);
|
|
70
|
+
console.log(`\tNew runtime spec_name: ${newVersion.specName}, spec_version: ${newVersion.specVersion}`);
|
|
71
|
+
console.log(new Array(80).fill('-').join(''));
|
|
72
|
+
console.log('\n');
|
|
73
|
+
if (!config['disable-spec-check'] && oldVersion.specName !== newVersion.specName) {
|
|
74
|
+
console.log('ā Spec name does not match. Use --disable-spec-check to disable this check');
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
if (!config['disable-spec-check'] && oldVersion.specVersion >= newVersion.specVersion) {
|
|
78
|
+
console.log('ā Spec version must increase. Use --disable-spec-check to disable this check');
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
const select_none = registry.createType('UpgradeCheckSelect', config.checks);
|
|
82
|
+
const response = await block.call('TryRuntime_on_runtime_upgrade', [
|
|
51
83
|
select_none.toHex()
|
|
52
84
|
]);
|
|
53
|
-
if (argv.
|
|
54
|
-
|
|
55
|
-
console.log(`Generated preview ${filePath}`);
|
|
56
|
-
if (argv.open) {
|
|
57
|
-
(0, _openhtml.openHtml)(filePath);
|
|
58
|
-
}
|
|
59
|
-
} else if (argv.outputPath) {
|
|
60
|
-
(0, _nodefs.writeFileSync)(argv.outputPath, JSON.stringify(result, null, 2));
|
|
85
|
+
if (argv.outputPath) {
|
|
86
|
+
(0, _nodefs.writeFileSync)(argv.outputPath, JSON.stringify(response, null, 2));
|
|
61
87
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
88
|
+
const [actual, max] = registry.createType('(Weight, Weight)', response.result);
|
|
89
|
+
const consumedWeight = actual.refTime.toBn();
|
|
90
|
+
const maxWeight = max.refTime.toBn();
|
|
91
|
+
console.log('\nš§ EXPERIMENTAL FEATURE š§');
|
|
92
|
+
console.log('ā ļø PoV measure is not supported, consider using https://crates.io/crates/try-runtime-cli');
|
|
93
|
+
console.log(`\nConsumed weight: ${consumedWeight.toNumber()} of max: ${maxWeight.toNumber()} ( ${(consumedWeight.toNumber() / maxWeight.toNumber() * 100).toFixed(2)}% )`);
|
|
94
|
+
if (consumedWeight.gt(maxWeight)) {
|
|
95
|
+
console.log('ā Weight limit is exceeded ā');
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
66
98
|
}
|
|
67
99
|
process.exit(0);
|
|
68
100
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuildBlockMode } from '@acala-network/chopsticks-core';
|
|
2
|
+
import { Options } from 'yargs';
|
|
2
3
|
import { ZodNativeEnum, ZodRawShape, ZodTypeAny, z } from 'zod';
|
|
3
4
|
export declare const zHex: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
4
5
|
export declare const zHash: z.ZodIntersection<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
@@ -147,11 +148,6 @@ export declare const configSchema: z.ZodObject<{
|
|
|
147
148
|
}>;
|
|
148
149
|
export type Config = z.infer<typeof configSchema>;
|
|
149
150
|
export declare const getYargsOptions: (zodShape: ZodRawShape) => {
|
|
150
|
-
[x: string]:
|
|
151
|
-
demandOption: boolean;
|
|
152
|
-
description: any;
|
|
153
|
-
type: any;
|
|
154
|
-
choices: any;
|
|
155
|
-
};
|
|
151
|
+
[x: string]: Options;
|
|
156
152
|
};
|
|
157
153
|
export declare const fetchConfig: (path: string) => Promise<Config>;
|
|
@@ -6,9 +6,9 @@ export declare const setupWithServer: (argv: Config) => Promise<{
|
|
|
6
6
|
fetchStorageWorker: {
|
|
7
7
|
worker: import("comlink").Remote<{
|
|
8
8
|
startFetch: (options: {
|
|
9
|
-
block?:
|
|
10
|
-
endpoint?: string | string[]
|
|
11
|
-
dbPath?: string
|
|
9
|
+
block?: number | string | null;
|
|
10
|
+
endpoint?: string | string[];
|
|
11
|
+
dbPath?: string;
|
|
12
12
|
config: import("./utils/fetch-storages.js").FetchStorageConfig;
|
|
13
13
|
}) => Promise<void>;
|
|
14
14
|
}>;
|
|
@@ -118,7 +118,6 @@ const getPrefixesFromConfig = async (config, api)=>{
|
|
|
118
118
|
};
|
|
119
119
|
const fetchStorages = async ({ block, endpoint, dbPath, config })=>{
|
|
120
120
|
if (!endpoint) throw new Error('endpoint is required');
|
|
121
|
-
if (!block) throw new Error('block is required');
|
|
122
121
|
const provider = new _rpcprovider.WsProvider(endpoint, 3_000);
|
|
123
122
|
const apiPromise = new _api.ApiPromise({
|
|
124
123
|
provider
|
package/dist/esm/context.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export declare const setupContext: (argv: Config, overrideParent?: boolean) => P
|
|
|
7
7
|
fetchStorageWorker: {
|
|
8
8
|
worker: import("comlink").Remote<{
|
|
9
9
|
startFetch: (options: {
|
|
10
|
-
block?:
|
|
11
|
-
endpoint?: string | string[]
|
|
12
|
-
dbPath?: string
|
|
10
|
+
block?: number | string | null;
|
|
11
|
+
endpoint?: string | string[];
|
|
12
|
+
dbPath?: string;
|
|
13
13
|
config: import("./utils/fetch-storages.js").FetchStorageConfig;
|
|
14
14
|
}) => Promise<void>;
|
|
15
15
|
}>;
|
package/dist/esm/logger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
export { defaultLogger, truncate } from '@acala-network/chopsticks-core';
|
|
3
3
|
export declare const spinnerFrames: string[];
|
|
4
|
-
export declare const apiFetching: _.
|
|
4
|
+
export declare const apiFetching: _.DebouncedFuncLeading<() => void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import { configSchema, getYargsOptions } from '../../schema/index.js';
|
|
4
|
-
import { fetchStorages } from '../../utils/fetch-storages.js';
|
|
4
|
+
import { fetchStorages, logger } from '../../utils/fetch-storages.js';
|
|
5
5
|
const schema = z.object(_.pick(configSchema.shape, [
|
|
6
6
|
'endpoint',
|
|
7
7
|
'block',
|
|
@@ -27,6 +27,7 @@ export const cli = (y)=>{
|
|
|
27
27
|
});
|
|
28
28
|
process.exit(0);
|
|
29
29
|
} catch (e) {
|
|
30
|
+
logger.error(e);
|
|
30
31
|
process.exit(1);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Try-Runtime CLI
|
|
2
|
+
|
|
3
|
+
š§ EXPERIMENTAL FEATURE š§
|
|
4
|
+
|
|
5
|
+
You can use Chopsticks to perform runtime migration checks. It doesn't support PoV measure yet, only weight check is support.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# try-runtime print help
|
|
9
|
+
npx @acala-network/chopsticks try-runtime --help
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Basic example:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @acala-network/chopsticks try-runtime \
|
|
16
|
+
--endpoint <wss://remote.endpoint> \
|
|
17
|
+
--runtime <wasm_runtime_path> \
|
|
18
|
+
--checks PreAndPost
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
__NOTE__: You can also use `--config` to pass arguments
|
|
@@ -1,58 +1,90 @@
|
|
|
1
|
+
import { BuildBlockMode } from '@acala-network/chopsticks-core';
|
|
1
2
|
import { writeFileSync } from 'node:fs';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { configSchema, getYargsOptions } from '../../schema/index.js';
|
|
4
|
-
import {
|
|
5
|
-
import { openHtml } from '../../utils/open-html.js';
|
|
5
|
+
import { overrideWasm } from '../../utils/override.js';
|
|
6
6
|
import { setupContext } from '../../context.js';
|
|
7
7
|
const schema = z.object({
|
|
8
8
|
endpoint: configSchema.shape.endpoint,
|
|
9
|
-
port: configSchema.shape.port,
|
|
10
|
-
['build-block-mode']: configSchema.shape['build-block-mode'],
|
|
11
9
|
block: configSchema.shape.block,
|
|
12
10
|
db: configSchema.shape.db,
|
|
13
|
-
['runtime-log-level']: configSchema.shape['runtime-log-level'],
|
|
14
|
-
['
|
|
11
|
+
['runtime-log-level']: configSchema.shape['runtime-log-level'].default(5),
|
|
12
|
+
['runtime']: z.string({
|
|
15
13
|
description: 'Path to WASM built with feature `try-runtime` enabled'
|
|
16
14
|
}),
|
|
15
|
+
'import-storage': configSchema.shape['import-storage'],
|
|
16
|
+
checks: z.enum([
|
|
17
|
+
'None',
|
|
18
|
+
'All',
|
|
19
|
+
'PreAndPost',
|
|
20
|
+
'TryState'
|
|
21
|
+
]),
|
|
22
|
+
'disable-spec-check': z.boolean({
|
|
23
|
+
description: 'Disable spec name/version check'
|
|
24
|
+
}).optional(),
|
|
17
25
|
['output-path']: z.string({
|
|
18
26
|
description: 'File path to print output'
|
|
19
|
-
}).optional(),
|
|
20
|
-
html: z.boolean({
|
|
21
|
-
description: 'Generate html with storage diff'
|
|
22
|
-
}).optional(),
|
|
23
|
-
open: z.boolean({
|
|
24
|
-
description: 'Open generated html'
|
|
25
27
|
}).optional()
|
|
26
28
|
});
|
|
27
29
|
export const cli = (y)=>{
|
|
28
|
-
y.command('try-runtime', '
|
|
29
|
-
|
|
30
|
+
y.command('try-runtime', 'š§ EXPERIMENTAL: Check upgrade migrations š§', (yargs)=>yargs.options(getYargsOptions(schema.shape)), async (argv)=>{
|
|
31
|
+
console.log('š§ EXPERIMENTAL FEATURE š§');
|
|
32
|
+
const config = schema.parse(argv);
|
|
33
|
+
if (!config.db) {
|
|
34
|
+
console.log('ā ļø Make sure to provide db, it will speed up the process');
|
|
35
|
+
}
|
|
36
|
+
const context = await setupContext({
|
|
37
|
+
...config,
|
|
38
|
+
port: 8000,
|
|
39
|
+
'build-block-mode': BuildBlockMode.Manual
|
|
40
|
+
});
|
|
30
41
|
const block = context.chain.head;
|
|
31
42
|
const registry = await block.registry;
|
|
32
43
|
registry.register({
|
|
33
44
|
UpgradeCheckSelect: {
|
|
34
45
|
_enum: {
|
|
35
|
-
None: null
|
|
46
|
+
None: null,
|
|
47
|
+
All: null,
|
|
48
|
+
PreAndPost: null,
|
|
49
|
+
TryState: null
|
|
36
50
|
}
|
|
37
51
|
}
|
|
38
52
|
});
|
|
39
|
-
const
|
|
40
|
-
|
|
53
|
+
const oldVersion = await block.runtimeVersion;
|
|
54
|
+
// set new runtime
|
|
55
|
+
await overrideWasm(block.chain, config.runtime);
|
|
56
|
+
const newVersion = await block.runtimeVersion;
|
|
57
|
+
console.log('\n');
|
|
58
|
+
console.log(new Array(80).fill('-').join(''));
|
|
59
|
+
console.log(`\tCurrent runtime spec_name: ${oldVersion.specName}, spec_version: ${oldVersion.specVersion}`);
|
|
60
|
+
console.log(`\tNew runtime spec_name: ${newVersion.specName}, spec_version: ${newVersion.specVersion}`);
|
|
61
|
+
console.log(new Array(80).fill('-').join(''));
|
|
62
|
+
console.log('\n');
|
|
63
|
+
if (!config['disable-spec-check'] && oldVersion.specName !== newVersion.specName) {
|
|
64
|
+
console.log('ā Spec name does not match. Use --disable-spec-check to disable this check');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
if (!config['disable-spec-check'] && oldVersion.specVersion >= newVersion.specVersion) {
|
|
68
|
+
console.log('ā Spec version must increase. Use --disable-spec-check to disable this check');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
const select_none = registry.createType('UpgradeCheckSelect', config.checks);
|
|
72
|
+
const response = await block.call('TryRuntime_on_runtime_upgrade', [
|
|
41
73
|
select_none.toHex()
|
|
42
74
|
]);
|
|
43
|
-
if (argv.
|
|
44
|
-
|
|
45
|
-
console.log(`Generated preview ${filePath}`);
|
|
46
|
-
if (argv.open) {
|
|
47
|
-
openHtml(filePath);
|
|
48
|
-
}
|
|
49
|
-
} else if (argv.outputPath) {
|
|
50
|
-
writeFileSync(argv.outputPath, JSON.stringify(result, null, 2));
|
|
75
|
+
if (argv.outputPath) {
|
|
76
|
+
writeFileSync(argv.outputPath, JSON.stringify(response, null, 2));
|
|
51
77
|
} else {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
78
|
+
const [actual, max] = registry.createType('(Weight, Weight)', response.result);
|
|
79
|
+
const consumedWeight = actual.refTime.toBn();
|
|
80
|
+
const maxWeight = max.refTime.toBn();
|
|
81
|
+
console.log('\nš§ EXPERIMENTAL FEATURE š§');
|
|
82
|
+
console.log('ā ļø PoV measure is not supported, consider using https://crates.io/crates/try-runtime-cli');
|
|
83
|
+
console.log(`\nConsumed weight: ${consumedWeight.toNumber()} of max: ${maxWeight.toNumber()} ( ${(consumedWeight.toNumber() / maxWeight.toNumber() * 100).toFixed(2)}% )`);
|
|
84
|
+
if (consumedWeight.gt(maxWeight)) {
|
|
85
|
+
console.log('ā Weight limit is exceeded ā');
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
56
88
|
}
|
|
57
89
|
process.exit(0);
|
|
58
90
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuildBlockMode } from '@acala-network/chopsticks-core';
|
|
2
|
+
import { Options } from 'yargs';
|
|
2
3
|
import { ZodNativeEnum, ZodRawShape, ZodTypeAny, z } from 'zod';
|
|
3
4
|
export declare const zHex: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
4
5
|
export declare const zHash: z.ZodIntersection<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
@@ -147,11 +148,6 @@ export declare const configSchema: z.ZodObject<{
|
|
|
147
148
|
}>;
|
|
148
149
|
export type Config = z.infer<typeof configSchema>;
|
|
149
150
|
export declare const getYargsOptions: (zodShape: ZodRawShape) => {
|
|
150
|
-
[x: string]:
|
|
151
|
-
demandOption: boolean;
|
|
152
|
-
description: any;
|
|
153
|
-
type: any;
|
|
154
|
-
choices: any;
|
|
155
|
-
};
|
|
151
|
+
[x: string]: Options;
|
|
156
152
|
};
|
|
157
153
|
export declare const fetchConfig: (path: string) => Promise<Config>;
|
|
@@ -6,9 +6,9 @@ export declare const setupWithServer: (argv: Config) => Promise<{
|
|
|
6
6
|
fetchStorageWorker: {
|
|
7
7
|
worker: import("comlink").Remote<{
|
|
8
8
|
startFetch: (options: {
|
|
9
|
-
block?:
|
|
10
|
-
endpoint?: string | string[]
|
|
11
|
-
dbPath?: string
|
|
9
|
+
block?: number | string | null;
|
|
10
|
+
endpoint?: string | string[];
|
|
11
|
+
dbPath?: string;
|
|
12
12
|
config: import("./utils/fetch-storages.js").FetchStorageConfig;
|
|
13
13
|
}) => Promise<void>;
|
|
14
14
|
}>;
|
|
@@ -93,7 +93,6 @@ const checkPalletStorageByName = (meta, palletName, storageName)=>{
|
|
|
93
93
|
* Fetch storages and save in a local db
|
|
94
94
|
*/ export const fetchStorages = async ({ block, endpoint, dbPath, config })=>{
|
|
95
95
|
if (!endpoint) throw new Error('endpoint is required');
|
|
96
|
-
if (!block) throw new Error('block is required');
|
|
97
96
|
const provider = new WsProvider(endpoint, 3_000);
|
|
98
97
|
const apiPromise = new ApiPromise({
|
|
99
98
|
provider
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0-1",
|
|
4
4
|
"author": "Acala Developers <hello@acala.network>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": "./chopsticks.cjs",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
10
|
-
"build": "yarn clean &&
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"docs:prep": "typedoc"
|
|
10
|
+
"build": "yarn clean && ../../package-build.sh",
|
|
11
|
+
"docs:prep": "typedoc",
|
|
12
|
+
"depcheck": "npx depcheck --ignore-patterns='*.test.ts'"
|
|
14
13
|
},
|
|
15
14
|
"dependencies": {
|
|
16
|
-
"@acala-network/chopsticks-core": "0.
|
|
17
|
-
"@acala-network/chopsticks-db": "0.
|
|
15
|
+
"@acala-network/chopsticks-core": "0.13.0-1",
|
|
16
|
+
"@acala-network/chopsticks-db": "0.13.0-1",
|
|
18
17
|
"@pnpm/npm-conf": "^2.2.2",
|
|
19
|
-
"@polkadot/api": "^
|
|
20
|
-
"@polkadot/api-augment": "^
|
|
21
|
-
"@polkadot/
|
|
18
|
+
"@polkadot/api": "^12.1.1",
|
|
19
|
+
"@polkadot/api-augment": "^12.1.1",
|
|
20
|
+
"@polkadot/rpc-provider": "^12.1.1",
|
|
21
|
+
"@polkadot/types": "^12.1.1",
|
|
22
22
|
"@polkadot/util": "^12.6.2",
|
|
23
23
|
"@polkadot/util-crypto": "^12.6.2",
|
|
24
24
|
"axios": "^1.6.8",
|
|
25
|
+
"comlink": "^4.4.1",
|
|
25
26
|
"dotenv": "^16.4.5",
|
|
26
27
|
"global-agent": "^3.0.0",
|
|
27
28
|
"js-yaml": "^4.1.0",
|
|
28
29
|
"jsondiffpatch": "^0.5.0",
|
|
29
30
|
"lodash": "^4.17.21",
|
|
30
|
-
"ws": "^8.
|
|
31
|
+
"ws": "^8.17.1",
|
|
31
32
|
"yargs": "^17.7.2",
|
|
32
33
|
"zod": "^3.22.4"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@swc/cli": "0.
|
|
36
|
-
"@swc/core": "^1.
|
|
36
|
+
"@swc/cli": "0.4.0",
|
|
37
|
+
"@swc/core": "^1.6.7",
|
|
37
38
|
"@types/global-agent": "^2.1.3",
|
|
38
39
|
"@types/js-yaml": "^4.0.9",
|
|
39
|
-
"@types/lodash": "^4.17.
|
|
40
|
-
"@types/node": "^20.
|
|
40
|
+
"@types/lodash": "^4.17.6",
|
|
41
|
+
"@types/node": "^20.14.9",
|
|
41
42
|
"@types/ws": "^8.5.10",
|
|
42
43
|
"@types/yargs": "^17.0.32",
|
|
43
|
-
"typescript": "^5.
|
|
44
|
-
"vitest": "^1.4.0"
|
|
44
|
+
"typescript": "^5.5.3"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"dist/esm/**",
|