@acala-network/chopsticks 1.0.2-2 → 1.0.2
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/cli.js +10 -11
- package/dist/cjs/context.d.ts +1 -1
- package/dist/cjs/context.js +4 -3
- package/dist/cjs/logger.js +1 -1
- package/dist/cjs/plugins/decode-key/cli.js +1 -1
- package/dist/cjs/plugins/dry-run/cli.js +2 -2
- package/dist/cjs/plugins/dry-run/dry-run-extrinsic.d.ts +1 -1
- package/dist/cjs/plugins/dry-run/dry-run-extrinsic.js +10 -10
- package/dist/cjs/plugins/dry-run/dry-run-preimage.d.ts +1 -1
- package/dist/cjs/plugins/dry-run/dry-run-preimage.js +11 -11
- package/dist/cjs/plugins/dry-run/index.d.ts +3 -3
- package/dist/cjs/plugins/dry-run/index.js +2 -2
- package/dist/cjs/plugins/dry-run/rpc.d.ts +1 -1
- package/dist/cjs/plugins/dry-run/rpc.js +1 -1
- package/dist/cjs/plugins/fetch-storage/cli.js +1 -1
- package/dist/cjs/plugins/follow-chain/cli.js +7 -7
- package/dist/cjs/plugins/index.d.ts +1 -1
- package/dist/cjs/plugins/index.js +2 -2
- package/dist/cjs/plugins/run-block/cli.js +2 -2
- package/dist/cjs/plugins/run-block/rpc.d.ts +2 -2
- package/dist/cjs/plugins/trace-transaction/index.d.ts +1 -1
- package/dist/cjs/plugins/trace-transaction/index.js +3 -3
- package/dist/cjs/plugins/trace-transaction/types.d.ts +2 -2
- package/dist/cjs/plugins/trace-transaction/utils.d.ts +3 -3
- package/dist/cjs/plugins/trace-transaction/utils.js +4 -4
- package/dist/cjs/plugins/try-runtime/index.js +5 -5
- package/dist/cjs/rpc/index.d.ts +1 -1
- package/dist/cjs/schema/index.d.ts +2 -2
- package/dist/cjs/schema/index.js +4 -4
- package/dist/cjs/server.d.ts +1 -1
- package/dist/cjs/server.js +3 -3
- package/dist/cjs/setup-with-server.d.ts +1 -1
- package/dist/cjs/setup-with-server.js +2 -2
- package/dist/cjs/utils/decoder.d.ts +2 -2
- package/dist/cjs/utils/fetch-storages-worker.js +1 -1
- package/dist/cjs/utils/fetch-storages.d.ts +1 -1
- package/dist/cjs/utils/fetch-storages.js +5 -5
- package/dist/cjs/utils/generate-html-diff.d.ts +2 -2
- package/dist/cjs/utils/generate-html-diff.js +1 -1
- package/dist/cjs/utils/open-html.js +2 -2
- package/dist/cjs/utils/override.d.ts +2 -2
- package/dist/cjs/utils/override.js +2 -2
- package/dist/esm/cli.js +5 -6
- package/dist/esm/context.d.ts +1 -1
- package/dist/esm/context.js +4 -3
- package/dist/esm/logger.js +1 -1
- package/dist/esm/plugins/decode-key/cli.js +1 -1
- package/dist/esm/plugins/dry-run/cli.js +2 -2
- package/dist/esm/plugins/dry-run/dry-run-extrinsic.d.ts +1 -1
- package/dist/esm/plugins/dry-run/dry-run-extrinsic.js +10 -10
- package/dist/esm/plugins/dry-run/dry-run-preimage.d.ts +1 -1
- package/dist/esm/plugins/dry-run/dry-run-preimage.js +11 -11
- package/dist/esm/plugins/dry-run/index.d.ts +3 -3
- package/dist/esm/plugins/dry-run/index.js +2 -2
- package/dist/esm/plugins/dry-run/rpc.d.ts +1 -1
- package/dist/esm/plugins/dry-run/rpc.js +1 -1
- package/dist/esm/plugins/fetch-storage/cli.js +1 -1
- package/dist/esm/plugins/follow-chain/cli.js +3 -3
- package/dist/esm/plugins/index.d.ts +1 -1
- package/dist/esm/plugins/index.js +2 -2
- package/dist/esm/plugins/run-block/cli.js +2 -2
- package/dist/esm/plugins/run-block/rpc.d.ts +2 -2
- package/dist/esm/plugins/trace-transaction/index.d.ts +1 -1
- package/dist/esm/plugins/trace-transaction/index.js +3 -3
- package/dist/esm/plugins/trace-transaction/types.d.ts +2 -2
- package/dist/esm/plugins/trace-transaction/utils.d.ts +3 -3
- package/dist/esm/plugins/trace-transaction/utils.js +4 -4
- package/dist/esm/plugins/try-runtime/index.js +5 -5
- package/dist/esm/rpc/index.d.ts +1 -1
- package/dist/esm/schema/index.d.ts +2 -2
- package/dist/esm/schema/index.js +4 -4
- package/dist/esm/server.d.ts +1 -1
- package/dist/esm/server.js +3 -3
- package/dist/esm/setup-with-server.d.ts +1 -1
- package/dist/esm/setup-with-server.js +2 -2
- package/dist/esm/utils/decoder.d.ts +2 -2
- package/dist/esm/utils/fetch-storages-worker.js +1 -1
- package/dist/esm/utils/fetch-storages.d.ts +1 -1
- package/dist/esm/utils/fetch-storages.js +5 -5
- package/dist/esm/utils/generate-html-diff.d.ts +2 -2
- package/dist/esm/utils/generate-html-diff.js +1 -1
- package/dist/esm/utils/open-html.js +2 -2
- package/dist/esm/utils/override.d.ts +2 -2
- package/dist/esm/utils/override.js +2 -2
- package/package.json +3 -3
package/dist/cjs/cli.js
CHANGED
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _dotenv = require("dotenv");
|
|
6
|
-
const _helpers = require("yargs/helpers");
|
|
7
|
-
const _zod = require("zod");
|
|
8
6
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
9
7
|
const _yargs = /*#__PURE__*/ _interop_require_default(require("yargs"));
|
|
8
|
+
const _helpers = require("yargs/helpers");
|
|
9
|
+
const _zod = require("zod");
|
|
10
10
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
11
|
-
const _index = require("./
|
|
11
|
+
const _index = require("./index.js");
|
|
12
12
|
const _index1 = require("./plugins/index.js");
|
|
13
|
-
const _index2 = require("./index.js");
|
|
13
|
+
const _index2 = require("./schema/index.js");
|
|
14
14
|
function _interop_require_default(obj) {
|
|
15
15
|
return obj && obj.__esModule ? obj : {
|
|
16
16
|
default: obj
|
|
@@ -23,7 +23,7 @@ const processArgv = async (argv)=>{
|
|
|
23
23
|
await (0, _index1.loadRpcMethodsByScripts)(argv.unsafeRpcMethods);
|
|
24
24
|
}
|
|
25
25
|
if (argv.config) {
|
|
26
|
-
Object.assign(argv, _lodash.default.defaults(argv, await (0,
|
|
26
|
+
Object.assign(argv, _lodash.default.defaults(argv, await (0, _index2.fetchConfig)(argv.config)));
|
|
27
27
|
}
|
|
28
28
|
if (_chopstickscore.environment.PORT) {
|
|
29
29
|
argv.port = Number(_chopstickscore.environment.PORT);
|
|
@@ -33,13 +33,12 @@ const processArgv = async (argv)=>{
|
|
|
33
33
|
throw new Error('Bad argv', {
|
|
34
34
|
cause: error.flatten().fieldErrors
|
|
35
35
|
});
|
|
36
|
-
} else {
|
|
37
|
-
throw error;
|
|
38
36
|
}
|
|
37
|
+
throw error;
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
|
-
const commands = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).scriptName('chopsticks').middleware(processArgv, false).command('*', 'Dev mode, fork off a chain', (yargs)=>yargs.config('config', 'Path to config file with default options', ()=>({})).options((0,
|
|
42
|
-
await (0,
|
|
40
|
+
const commands = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).scriptName('chopsticks').middleware(processArgv, false).command('*', 'Dev mode, fork off a chain', (yargs)=>yargs.config('config', 'Path to config file with default options', ()=>({})).options((0, _index2.getYargsOptions)(_index2.configSchema.shape)).deprecateOption('addr', '⚠️ Use --host instead.'), async (argv)=>{
|
|
41
|
+
await (0, _index.setupWithServer)(_index2.configSchema.parse(argv));
|
|
43
42
|
}).command('xcm', 'XCM setup with relaychain and parachains', (yargs)=>yargs.options({
|
|
44
43
|
relaychain: {
|
|
45
44
|
desc: 'Relaychain config file path',
|
|
@@ -54,14 +53,14 @@ const commands = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).script
|
|
|
54
53
|
}).alias('relaychain', 'r').alias('parachain', 'p'), async (argv)=>{
|
|
55
54
|
const parachains = [];
|
|
56
55
|
for (const config of argv.parachain){
|
|
57
|
-
const { chain } = await (0,
|
|
56
|
+
const { chain } = await (0, _index.setupWithServer)(await (0, _index2.fetchConfig)(config));
|
|
58
57
|
parachains.push(chain);
|
|
59
58
|
}
|
|
60
59
|
if (parachains.length > 1) {
|
|
61
60
|
await (0, _chopstickscore.connectParachains)(parachains, _chopstickscore.environment.DISABLE_AUTO_HRMP);
|
|
62
61
|
}
|
|
63
62
|
if (argv.relaychain) {
|
|
64
|
-
const { chain: relaychain } = await (0,
|
|
63
|
+
const { chain: relaychain } = await (0, _index.setupWithServer)(await (0, _index2.fetchConfig)(argv.relaychain));
|
|
65
64
|
for (const parachain of parachains){
|
|
66
65
|
await (0, _chopstickscore.connectVertical)(relaychain, parachain);
|
|
67
66
|
}
|
package/dist/cjs/context.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './utils/tunnel.js';
|
|
2
2
|
import { GenesisProvider } from '@acala-network/chopsticks-core';
|
|
3
|
-
import { Config } from './schema/index.js';
|
|
3
|
+
import type { Config } from './schema/index.js';
|
|
4
4
|
export declare const genesisFromUrl: (url: string) => Promise<GenesisProvider>;
|
|
5
5
|
export declare const setupContext: (argv: Config, overrideParent?: boolean) => Promise<{
|
|
6
6
|
chain: import("@acala-network/chopsticks-core").Blockchain;
|
package/dist/cjs/context.js
CHANGED
|
@@ -19,10 +19,10 @@ _export(exports, {
|
|
|
19
19
|
require("./utils/tunnel.js");
|
|
20
20
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
21
21
|
const _chopsticksdb = require("@acala-network/chopsticks-db");
|
|
22
|
+
const _axios = /*#__PURE__*/ _interop_require_default(require("axios"));
|
|
22
23
|
const _logger = require("./logger.js");
|
|
23
|
-
const _override = require("./utils/override.js");
|
|
24
24
|
const _fetchstorages = require("./utils/fetch-storages.js");
|
|
25
|
-
const
|
|
25
|
+
const _override = require("./utils/override.js");
|
|
26
26
|
function _interop_require_default(obj) {
|
|
27
27
|
return obj && obj.__esModule ? obj : {
|
|
28
28
|
default: obj
|
|
@@ -76,7 +76,8 @@ const genesisFromUrl = async (url)=>{
|
|
|
76
76
|
const getFile = async (url)=>{
|
|
77
77
|
if ((0, _chopstickscore.isUrl)(url)) {
|
|
78
78
|
return _axios.default.get(url).then((x)=>x.data);
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
|
+
if (typeof process === 'object') {
|
|
80
81
|
const { lstatSync, readFileSync } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("node:fs")));
|
|
81
82
|
if (lstatSync(url).isFile()) {
|
|
82
83
|
return JSON.parse(String(readFileSync(url)));
|
package/dist/cjs/logger.js
CHANGED
|
@@ -29,7 +29,7 @@ function _interop_require_default(obj) {
|
|
|
29
29
|
default: obj
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
const showProgress = process.stdout.isTTY && !process.env
|
|
32
|
+
const showProgress = process.stdout.isTTY && !process.env.CI && !process.env.TEST;
|
|
33
33
|
const spinnerFrames = process.platform === 'win32' ? [
|
|
34
34
|
'-',
|
|
35
35
|
'\\',
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "cli", {
|
|
|
8
8
|
return cli;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _index = require("../../schema/index.js");
|
|
12
11
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
13
12
|
const _context = require("../../context.js");
|
|
13
|
+
const _index = require("../../schema/index.js");
|
|
14
14
|
const cli = (y)=>{
|
|
15
15
|
y.command('decode-key <key>', 'Deocde a key', (yargs)=>yargs.options((0, _index.getYargsOptions)(_index.configSchema.shape)).positional('key', {
|
|
16
16
|
desc: 'Key to decode',
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "cli", {
|
|
|
8
8
|
return cli;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _zod = require("zod");
|
|
11
12
|
const _index = require("../../schema/index.js");
|
|
12
13
|
const _dryrunextrinsic = require("./dry-run-extrinsic.js");
|
|
13
14
|
const _dryrunpreimage = require("./dry-run-preimage.js");
|
|
14
|
-
const _zod = require("zod");
|
|
15
15
|
const schema = _zod.z.object({
|
|
16
16
|
..._index.configSchema.shape,
|
|
17
17
|
extrinsic: _zod.z.string({
|
|
@@ -26,7 +26,7 @@ const schema = _zod.z.object({
|
|
|
26
26
|
at: _zod.z.string({
|
|
27
27
|
description: 'Block hash to dry run'
|
|
28
28
|
}).optional(),
|
|
29
|
-
|
|
29
|
+
'output-path': _zod.z.string({
|
|
30
30
|
description: 'File path to print output'
|
|
31
31
|
}).optional(),
|
|
32
32
|
html: _zod.z.boolean({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DryRunSchemaType } from './index.js';
|
|
1
|
+
import type { DryRunSchemaType } from './index.js';
|
|
2
2
|
export declare const dryRunExtrinsic: (argv: DryRunSchemaType) => Promise<never>;
|
|
@@ -8,30 +8,30 @@ Object.defineProperty(exports, "dryRunExtrinsic", {
|
|
|
8
8
|
return dryRunExtrinsic;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _utilcrypto = require("@polkadot/util-crypto");
|
|
12
11
|
const _nodefs = require("node:fs");
|
|
12
|
+
const _utilcrypto = require("@polkadot/util-crypto");
|
|
13
|
+
const _context = require("../../context.js");
|
|
13
14
|
const _logger = require("../../logger.js");
|
|
14
15
|
const _generatehtmldiff = require("../../utils/generate-html-diff.js");
|
|
15
16
|
const _openhtml = require("../../utils/open-html.js");
|
|
16
|
-
const _context = require("../../context.js");
|
|
17
17
|
const dryRunExtrinsic = async (argv)=>{
|
|
18
18
|
const context = await (0, _context.setupContext)(argv);
|
|
19
19
|
if (!argv.extrinsic) {
|
|
20
20
|
throw new Error('Extrinsic is required');
|
|
21
21
|
}
|
|
22
|
-
const input = argv
|
|
23
|
-
call: argv
|
|
24
|
-
address: argv
|
|
25
|
-
} : argv
|
|
26
|
-
const { outcome, storageDiff } = await context.chain.dryRunExtrinsic(input, argv
|
|
22
|
+
const input = argv.address ? {
|
|
23
|
+
call: argv.extrinsic,
|
|
24
|
+
address: argv.address
|
|
25
|
+
} : argv.extrinsic;
|
|
26
|
+
const { outcome, storageDiff } = await context.chain.dryRunExtrinsic(input, argv.at);
|
|
27
27
|
if (outcome.isErr) {
|
|
28
28
|
throw new Error(outcome.asErr.toString());
|
|
29
29
|
}
|
|
30
30
|
_logger.defaultLogger.info(outcome.toHuman(), 'dry_run_outcome');
|
|
31
|
-
if (argv
|
|
32
|
-
const filePath = await (0, _generatehtmldiff.generateHtmlDiffPreviewFile)(context.chain.head, storageDiff, (0, _utilcrypto.blake2AsHex)(argv
|
|
31
|
+
if (argv.html) {
|
|
32
|
+
const filePath = await (0, _generatehtmldiff.generateHtmlDiffPreviewFile)(context.chain.head, storageDiff, (0, _utilcrypto.blake2AsHex)(argv.extrinsic, 256));
|
|
33
33
|
console.log(`Generated preview ${filePath}`);
|
|
34
|
-
if (argv
|
|
34
|
+
if (argv.open) {
|
|
35
35
|
(0, _openhtml.openHtml)(filePath);
|
|
36
36
|
}
|
|
37
37
|
} else if (argv['output-path']) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DryRunSchemaType } from './index.js';
|
|
1
|
+
import type { DryRunSchemaType } from './index.js';
|
|
2
2
|
export declare const dryRunPreimage: (argv: DryRunSchemaType) => Promise<never>;
|
|
@@ -8,16 +8,16 @@ Object.defineProperty(exports, "dryRunPreimage", {
|
|
|
8
8
|
return dryRunPreimage;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _utilcrypto = require("@polkadot/util-crypto");
|
|
12
11
|
const _util = require("@polkadot/util");
|
|
12
|
+
const _utilcrypto = require("@polkadot/util-crypto");
|
|
13
13
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
14
|
+
const _context = require("../../context.js");
|
|
14
15
|
const _logger = require("../../logger.js");
|
|
15
16
|
const _generatehtmldiff = require("../../utils/generate-html-diff.js");
|
|
16
17
|
const _openhtml = require("../../utils/open-html.js");
|
|
17
|
-
const _context = require("../../context.js");
|
|
18
18
|
const dryRunPreimage = async (argv)=>{
|
|
19
19
|
const context = await (0, _context.setupContext)(argv);
|
|
20
|
-
const extrinsic = argv
|
|
20
|
+
const extrinsic = argv.preimage;
|
|
21
21
|
const block = context.chain.head;
|
|
22
22
|
const registry = await block.registry;
|
|
23
23
|
const header = await (0, _chopstickscore.newHeader)(block);
|
|
@@ -134,25 +134,25 @@ const dryRunPreimage = async (argv)=>{
|
|
|
134
134
|
}
|
|
135
135
|
const filePath = await (0, _generatehtmldiff.generateHtmlDiffPreviewFile)(block, result.Call.storageDiff, hash);
|
|
136
136
|
console.log(`Generated preview ${filePath}`);
|
|
137
|
-
if (argv
|
|
137
|
+
if (argv.open) {
|
|
138
138
|
(0, _openhtml.openHtml)(filePath);
|
|
139
139
|
}
|
|
140
140
|
// if dry-run preimage has extrinsic arguments then dry-run extrinsic
|
|
141
141
|
// this is useful to test something after preimage is applied
|
|
142
|
-
if (argv
|
|
142
|
+
if (argv.extrinsic) {
|
|
143
143
|
await context.chain.newBlock();
|
|
144
|
-
const input = argv
|
|
145
|
-
call: argv
|
|
146
|
-
address: argv
|
|
147
|
-
} : argv
|
|
144
|
+
const input = argv.address ? {
|
|
145
|
+
call: argv.extrinsic,
|
|
146
|
+
address: argv.address
|
|
147
|
+
} : argv.extrinsic;
|
|
148
148
|
const { outcome, storageDiff } = await context.chain.dryRunExtrinsic(input);
|
|
149
149
|
if (outcome.isErr) {
|
|
150
150
|
throw new Error(outcome.asErr.toString());
|
|
151
151
|
}
|
|
152
152
|
_logger.defaultLogger.info(outcome.toHuman(), 'dry_run_outcome');
|
|
153
|
-
const filePath = await (0, _generatehtmldiff.generateHtmlDiffPreviewFile)(context.chain.head, storageDiff, (0, _utilcrypto.blake2AsHex)(argv
|
|
153
|
+
const filePath = await (0, _generatehtmldiff.generateHtmlDiffPreviewFile)(context.chain.head, storageDiff, (0, _utilcrypto.blake2AsHex)(argv.extrinsic, 256));
|
|
154
154
|
console.log(`Generated preview ${filePath}`);
|
|
155
|
-
if (argv
|
|
155
|
+
if (argv.open) {
|
|
156
156
|
(0, _openhtml.openHtml)(filePath);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -4,7 +4,7 @@ export declare const dryRunSchema: z.ZodObject<{
|
|
|
4
4
|
address: z.ZodOptional<z.ZodString>;
|
|
5
5
|
preimage: z.ZodOptional<z.ZodString>;
|
|
6
6
|
at: z.ZodOptional<z.ZodString>;
|
|
7
|
-
|
|
7
|
+
'output-path': z.ZodOptional<z.ZodString>;
|
|
8
8
|
html: z.ZodOptional<z.ZodBoolean>;
|
|
9
9
|
open: z.ZodOptional<z.ZodBoolean>;
|
|
10
10
|
addr: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"localhost">, z.ZodString]>>;
|
|
@@ -196,10 +196,10 @@ export declare const dryRunSchema: z.ZodObject<{
|
|
|
196
196
|
'process-queued-messages'?: boolean | undefined;
|
|
197
197
|
'prefetch-storages'?: any;
|
|
198
198
|
open?: boolean | undefined;
|
|
199
|
-
"output-path"?: string | undefined;
|
|
200
199
|
extrinsic?: string | undefined;
|
|
201
200
|
address?: string | undefined;
|
|
202
201
|
preimage?: string | undefined;
|
|
202
|
+
'output-path'?: string | undefined;
|
|
203
203
|
html?: boolean | undefined;
|
|
204
204
|
}, {
|
|
205
205
|
at?: string | undefined;
|
|
@@ -251,10 +251,10 @@ export declare const dryRunSchema: z.ZodObject<{
|
|
|
251
251
|
'process-queued-messages'?: boolean | undefined;
|
|
252
252
|
'prefetch-storages'?: any;
|
|
253
253
|
open?: boolean | undefined;
|
|
254
|
-
"output-path"?: string | undefined;
|
|
255
254
|
extrinsic?: string | undefined;
|
|
256
255
|
address?: string | undefined;
|
|
257
256
|
preimage?: string | undefined;
|
|
257
|
+
'output-path'?: string | undefined;
|
|
258
258
|
html?: boolean | undefined;
|
|
259
259
|
}>;
|
|
260
260
|
export type DryRunSchemaType = z.infer<typeof dryRunSchema>;
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "dryRunSchema", {
|
|
|
8
8
|
return dryRunSchema;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _index = require("../../schema/index.js");
|
|
12
11
|
const _zod = require("zod");
|
|
12
|
+
const _index = require("../../schema/index.js");
|
|
13
13
|
_export_star(require("./cli.js"), exports);
|
|
14
14
|
_export_star(require("./rpc.js"), exports);
|
|
15
15
|
function _export_star(from, to) {
|
|
@@ -39,7 +39,7 @@ const dryRunSchema = _zod.z.object({
|
|
|
39
39
|
at: _zod.z.string({
|
|
40
40
|
description: 'Block hash to dry run'
|
|
41
41
|
}).optional(),
|
|
42
|
-
|
|
42
|
+
'output-path': _zod.z.string({
|
|
43
43
|
description: 'File path to print output'
|
|
44
44
|
}).optional(),
|
|
45
45
|
html: _zod.z.boolean({
|
|
@@ -10,9 +10,9 @@ Object.defineProperty(exports, "rpc", {
|
|
|
10
10
|
});
|
|
11
11
|
const _zod = require("zod");
|
|
12
12
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
13
|
+
const _index = require("../../schema/index.js");
|
|
13
14
|
const _decoder = require("../../utils/decoder.js");
|
|
14
15
|
const _generatehtmldiff = require("../../utils/generate-html-diff.js");
|
|
15
|
-
const _index = require("../../schema/index.js");
|
|
16
16
|
const zParaId = _zod.z.string().regex(/^\d+$/).transform(Number);
|
|
17
17
|
const schema = _zod.z.object({
|
|
18
18
|
raw: _zod.z.boolean().optional(),
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "cli", {
|
|
|
8
8
|
return cli;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _zod = require("zod");
|
|
12
11
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
12
|
+
const _zod = require("zod");
|
|
13
13
|
const _index = require("../../schema/index.js");
|
|
14
14
|
const _fetchstorages = require("../../utils/fetch-storages.js");
|
|
15
15
|
function _interop_require_default(obj) {
|
|
@@ -9,12 +9,12 @@ Object.defineProperty(exports, "cli", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
12
|
-
const _zod = require("zod");
|
|
13
12
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
14
|
-
const
|
|
15
|
-
const _server = require("../../server.js");
|
|
16
|
-
const _index1 = require("../../rpc/index.js");
|
|
13
|
+
const _zod = require("zod");
|
|
17
14
|
const _context = require("../../context.js");
|
|
15
|
+
const _index = require("../../rpc/index.js");
|
|
16
|
+
const _index1 = require("../../schema/index.js");
|
|
17
|
+
const _server = require("../../server.js");
|
|
18
18
|
function _interop_require_default(obj) {
|
|
19
19
|
return obj && obj.__esModule ? obj : {
|
|
20
20
|
default: obj
|
|
@@ -29,7 +29,7 @@ var HeadMode = /*#__PURE__*/ function(HeadMode) {
|
|
|
29
29
|
return HeadMode;
|
|
30
30
|
}(HeadMode || {});
|
|
31
31
|
const schema = _zod.z.object({
|
|
32
|
-
..._lodash.default.pick(
|
|
32
|
+
..._lodash.default.pick(_index1.configSchema.shape, [
|
|
33
33
|
'endpoint',
|
|
34
34
|
'port',
|
|
35
35
|
'wasm-override',
|
|
@@ -39,7 +39,7 @@ const schema = _zod.z.object({
|
|
|
39
39
|
'head-mode': _zod.z.nativeEnum(HeadMode).default("Latest")
|
|
40
40
|
});
|
|
41
41
|
const cli = (y)=>{
|
|
42
|
-
y.command('follow-chain', 'Always follow the latest block on upstream', (yargs)=>yargs.options((0,
|
|
42
|
+
y.command('follow-chain', 'Always follow the latest block on upstream', (yargs)=>yargs.options((0, _index1.getYargsOptions)(schema.shape)), async (argv)=>{
|
|
43
43
|
const config = schema.parse(argv);
|
|
44
44
|
const endpoints = Array.isArray(config.endpoint) ? config.endpoint : [
|
|
45
45
|
config.endpoint ?? ''
|
|
@@ -50,7 +50,7 @@ const cli = (y)=>{
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
const context = await (0, _context.setupContext)(config, true);
|
|
53
|
-
const { close, addr } = await (0, _server.createServer)((0,
|
|
53
|
+
const { close, addr } = await (0, _server.createServer)((0, _index.handler)(context), config.port, config.host);
|
|
54
54
|
logger.info(`${await context.chain.api.getSystemChain()} RPC listening on http://${addr} and ws://${addr}`);
|
|
55
55
|
const chain = context.chain;
|
|
56
56
|
chain.api[config['head-mode'] === "Latest" ? 'subscribeRemoteNewHeads' : 'subscribeRemoteFinalizedHeads'](async (error, data)=>{
|
|
@@ -28,11 +28,11 @@ _export(exports, {
|
|
|
28
28
|
return rpcPluginMethods;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
32
31
|
const _nodefs = require("node:fs");
|
|
32
|
+
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
33
33
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
34
|
-
const _logger = require("../logger.js");
|
|
35
34
|
const _nodepath = require("node:path");
|
|
35
|
+
const _logger = require("../logger.js");
|
|
36
36
|
function _interop_require_default(obj) {
|
|
37
37
|
return obj && obj.__esModule ? obj : {
|
|
38
38
|
default: obj
|
|
@@ -11,13 +11,13 @@ Object.defineProperty(exports, "cli", {
|
|
|
11
11
|
const _nodefs = require("node:fs");
|
|
12
12
|
const _zod = require("zod");
|
|
13
13
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
14
|
+
const _context = require("../../context.js");
|
|
14
15
|
const _index = require("../../schema/index.js");
|
|
15
16
|
const _generatehtmldiff = require("../../utils/generate-html-diff.js");
|
|
16
17
|
const _openhtml = require("../../utils/open-html.js");
|
|
17
|
-
const _context = require("../../context.js");
|
|
18
18
|
const schema = _zod.z.object({
|
|
19
19
|
..._index.configSchema.shape,
|
|
20
|
-
|
|
20
|
+
'output-path': _zod.z.string({
|
|
21
21
|
description: 'File path to print output'
|
|
22
22
|
}).optional(),
|
|
23
23
|
html: _zod.z.boolean({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HexString } from '@polkadot/util/types';
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { Context, RuntimeLog } from '@acala-network/chopsticks-core';
|
|
3
|
+
import { type Context, type RuntimeLog } from '@acala-network/chopsticks-core';
|
|
4
4
|
declare const schema: z.ZodObject<{
|
|
5
5
|
includeRaw: z.ZodOptional<z.ZodBoolean>;
|
|
6
6
|
includeParsed: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Argv } from 'yargs';
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
2
|
export declare const cli: (y: Argv) => void;
|
|
@@ -8,12 +8,12 @@ Object.defineProperty(exports, "cli", {
|
|
|
8
8
|
return cli;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
12
11
|
const _nodefs = require("node:fs");
|
|
12
|
+
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
13
13
|
const _zod = require("zod");
|
|
14
|
+
const _context = require("../../context.js");
|
|
14
15
|
const _index = require("../../schema/index.js");
|
|
15
16
|
const _utils = require("./utils.js");
|
|
16
|
-
const _context = require("../../context.js");
|
|
17
17
|
const schema = _index.configSchema.extend({
|
|
18
18
|
vm: _zod.z.boolean({
|
|
19
19
|
description: 'Trace VM opcode'
|
|
@@ -39,7 +39,7 @@ const cli = (y)=>{
|
|
|
39
39
|
}), async (argv)=>{
|
|
40
40
|
const config = schema.parse(argv);
|
|
41
41
|
const wasmPath = config['wasm-override'];
|
|
42
|
-
|
|
42
|
+
config['wasm-override'] = undefined;
|
|
43
43
|
const context = await (0, _context.setupContext)(config, false);
|
|
44
44
|
const txHash = argv['tx-hash'];
|
|
45
45
|
if (!txHash) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Registry } from '@polkadot/types/types';
|
|
2
|
+
import type { HexString } from '@polkadot/util/types';
|
|
3
3
|
export type CallTrace = {
|
|
4
4
|
type: 'CALL' | 'CALLCODE' | 'STATICCALL' | 'DELEGATECALL' | 'CREATE' | 'SUICIDE';
|
|
5
5
|
from: HexString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Block, Blockchain, RuntimeVersion } from '@acala-network/chopsticks-core';
|
|
2
|
-
import { HexString } from '@polkadot/util/types';
|
|
3
|
-
import { Step } from './types.js';
|
|
1
|
+
import { Block, type Blockchain, type RuntimeVersion } from '@acala-network/chopsticks-core';
|
|
2
|
+
import type { HexString } from '@polkadot/util/types';
|
|
3
|
+
import { type Step } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Fetches the runtime with tracing feature from Github releases.
|
|
6
6
|
* @param runtimeVersion - The version of the runtime.
|
|
@@ -28,9 +28,9 @@ _export(exports, {
|
|
|
28
28
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
29
29
|
const _utilcrypto = require("@polkadot/util-crypto");
|
|
30
30
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
31
|
-
const _types = require("./types.js");
|
|
32
|
-
const _table = require("./table.js");
|
|
33
31
|
const _override = require("../../utils/override.js");
|
|
32
|
+
const _table = require("./table.js");
|
|
33
|
+
const _types = require("./types.js");
|
|
34
34
|
function _interop_require_default(obj) {
|
|
35
35
|
return obj && obj.__esModule ? obj : {
|
|
36
36
|
default: obj
|
|
@@ -135,7 +135,7 @@ const traceVM = async (block, extrinsic, pageSize = 50_000, disableStack = false
|
|
|
135
135
|
}) : null
|
|
136
136
|
})));
|
|
137
137
|
page += 1;
|
|
138
|
-
traceNextPage = outcome.steps.length
|
|
138
|
+
traceNextPage = outcome.steps.length === pageSize;
|
|
139
139
|
}
|
|
140
140
|
return steps;
|
|
141
141
|
};
|
|
@@ -157,7 +157,7 @@ const traceCalls = async (block, extrinsic)=>{
|
|
|
157
157
|
};
|
|
158
158
|
const prepareBlock = async (chain, blockHashNumber, txHash, wasmPath)=>{
|
|
159
159
|
let wasm = wasmPath;
|
|
160
|
-
const block = typeof blockHashNumber
|
|
160
|
+
const block = typeof blockHashNumber === 'number' ? await chain.getBlockAt(blockHashNumber) : await chain.getBlock(blockHashNumber);
|
|
161
161
|
if (!block) {
|
|
162
162
|
throw new Error(`Block not found ${blockHashNumber}`);
|
|
163
163
|
}
|
|
@@ -8,18 +8,18 @@ Object.defineProperty(exports, "cli", {
|
|
|
8
8
|
return cli;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
12
11
|
const _nodefs = require("node:fs");
|
|
12
|
+
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
13
13
|
const _zod = require("zod");
|
|
14
|
+
const _context = require("../../context.js");
|
|
14
15
|
const _index = require("../../schema/index.js");
|
|
15
16
|
const _override = require("../../utils/override.js");
|
|
16
|
-
const _context = require("../../context.js");
|
|
17
17
|
const schema = _zod.z.object({
|
|
18
18
|
endpoint: _index.configSchema.shape.endpoint,
|
|
19
19
|
block: _index.configSchema.shape.block,
|
|
20
20
|
db: _index.configSchema.shape.db,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
'runtime-log-level': _index.configSchema.shape['runtime-log-level'].default(5),
|
|
22
|
+
runtime: _zod.z.string({
|
|
23
23
|
description: 'Path to WASM built with feature `try-runtime` enabled'
|
|
24
24
|
}),
|
|
25
25
|
'import-storage': _index.configSchema.shape['import-storage'],
|
|
@@ -32,7 +32,7 @@ const schema = _zod.z.object({
|
|
|
32
32
|
'disable-spec-check': _zod.z.boolean({
|
|
33
33
|
description: 'Disable spec name/version check'
|
|
34
34
|
}).optional(),
|
|
35
|
-
|
|
35
|
+
'output-path': _zod.z.string({
|
|
36
36
|
description: 'File path to print output'
|
|
37
37
|
}).optional()
|
|
38
38
|
});
|
package/dist/cjs/rpc/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, SubscriptionManager } from '@acala-network/chopsticks-core';
|
|
1
|
+
import { type Context, type SubscriptionManager } from '@acala-network/chopsticks-core';
|
|
2
2
|
export declare const handler: (context: Context) => ({ method, params }: {
|
|
3
3
|
method: string;
|
|
4
4
|
params: any[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuildBlockMode } from '@acala-network/chopsticks-core';
|
|
2
|
-
import { Options } from 'yargs';
|
|
3
|
-
import { ZodNativeEnum, ZodRawShape, ZodTypeAny, z } from 'zod';
|
|
2
|
+
import type { Options } from 'yargs';
|
|
3
|
+
import { ZodNativeEnum, type ZodRawShape, type ZodTypeAny, z } from 'zod';
|
|
4
4
|
export declare const zHex: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
5
5
|
export declare const zHash: z.ZodIntersection<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
6
6
|
export declare const configSchema: z.ZodObject<{
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -25,13 +25,13 @@ _export(exports, {
|
|
|
25
25
|
return zHex;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
29
|
-
const _zod = require("zod");
|
|
30
|
-
const _nodepath = require("node:path");
|
|
31
28
|
const _nodefs = require("node:fs");
|
|
32
|
-
const
|
|
29
|
+
const _nodepath = require("node:path");
|
|
30
|
+
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
33
31
|
const _axios = /*#__PURE__*/ _interop_require_default(require("axios"));
|
|
34
32
|
const _jsyaml = /*#__PURE__*/ _interop_require_default(require("js-yaml"));
|
|
33
|
+
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
34
|
+
const _zod = require("zod");
|
|
35
35
|
function _interop_require_default(obj) {
|
|
36
36
|
return obj && obj.__esModule ? obj : {
|
|
37
37
|
default: obj
|
package/dist/cjs/server.d.ts
CHANGED
package/dist/cjs/server.js
CHANGED
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "createServer", {
|
|
|
8
8
|
return createServer;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const _nodehttp = /*#__PURE__*/ _interop_require_default(require("node:http"));
|
|
12
12
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
13
|
+
const _ws = require("ws");
|
|
13
14
|
const _zod = require("zod");
|
|
14
|
-
const _nodehttp = /*#__PURE__*/ _interop_require_default(require("node:http"));
|
|
15
15
|
const _logger = require("./logger.js");
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
@@ -128,7 +128,7 @@ const createServer = async (handler, port, host)=>{
|
|
|
128
128
|
const parsed = await requestSchema.safeParseAsync(parseRequest(body));
|
|
129
129
|
if (!parsed.success) {
|
|
130
130
|
httpLogger.error('Invalid request: %s', body);
|
|
131
|
-
throw new Error(
|
|
131
|
+
throw new Error(`Invalid request: ${body}`);
|
|
132
132
|
}
|
|
133
133
|
httpLogger.trace({
|
|
134
134
|
req: parsed.data
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "setupWithServer", {
|
|
|
8
8
|
return setupWithServer;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _server = require("./server.js");
|
|
12
11
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
13
|
-
const _index = require("./rpc/index.js");
|
|
14
12
|
const _context = require("./context.js");
|
|
13
|
+
const _index = require("./rpc/index.js");
|
|
14
|
+
const _server = require("./server.js");
|
|
15
15
|
const setupWithServer = async (argv)=>{
|
|
16
16
|
if (argv.addr) {
|
|
17
17
|
_chopstickscore.defaultLogger.warn({}, `⚠️ Option --addr is deprecated, please use --host instead.`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Block } from '@acala-network/chopsticks-core';
|
|
2
|
-
import { HexString } from '@polkadot/util/types';
|
|
1
|
+
import { type Block } from '@acala-network/chopsticks-core';
|
|
2
|
+
import type { HexString } from '@polkadot/util/types';
|
|
3
3
|
export declare const decodeStorageDiff: (block: Block, diff: [HexString, HexString | null][]) => Promise<{
|
|
4
4
|
oldState: {};
|
|
5
5
|
newState: {};
|