@acala-network/chopsticks 0.9.1-3 → 0.9.1-4

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.
Files changed (63) hide show
  1. package/dist/cjs/cli.js +9 -9
  2. package/dist/cjs/context.js +2 -2
  3. package/dist/cjs/index.js +3 -3
  4. package/dist/cjs/plugins/decode-key/index.js +2 -2
  5. package/dist/cjs/plugins/dry-run/cli.js +3 -3
  6. package/dist/cjs/plugins/dry-run/dry-run-extrinsic.js +4 -4
  7. package/dist/cjs/plugins/dry-run/dry-run-preimage.js +5 -5
  8. package/dist/cjs/plugins/dry-run/index.js +2 -2
  9. package/dist/cjs/plugins/dry-run/rpc.js +2 -2
  10. package/dist/cjs/plugins/follow-chain/index.js +5 -5
  11. package/dist/cjs/plugins/index.js +1 -1
  12. package/dist/cjs/plugins/new-block/index.js +1 -1
  13. package/dist/cjs/plugins/run-block/__snapshots__/index.test.ts.snap +16745 -0
  14. package/dist/cjs/plugins/run-block/index.js +4 -4
  15. package/dist/cjs/plugins/set-block-build-mode/index.js +1 -1
  16. package/dist/cjs/plugins/set-runtime-log-level/index.js +1 -1
  17. package/dist/cjs/plugins/set-storage/index.js +1 -1
  18. package/dist/cjs/plugins/try-runtime/index.js +4 -4
  19. package/dist/cjs/plugins/types.js +16 -16
  20. package/dist/cjs/rpc/index.js +3 -3
  21. package/dist/cjs/server.js +1 -1
  22. package/dist/cjs/setup-with-server.js +4 -4
  23. package/dist/cjs/types.js +2 -2
  24. package/dist/cjs/utils/generate-html-diff.js +1 -1
  25. package/dist/cjs/utils/index.js +4 -4
  26. package/dist/cjs/utils/override.js +1 -1
  27. package/dist/esm/cli.js +4 -4
  28. package/dist/esm/context.js +2 -2
  29. package/dist/esm/index.js +2 -2
  30. package/dist/esm/plugins/decode-key/index.js +2 -2
  31. package/dist/esm/plugins/dry-run/cli.js +3 -3
  32. package/dist/esm/plugins/dry-run/dry-run-extrinsic.js +4 -4
  33. package/dist/esm/plugins/dry-run/dry-run-preimage.js +5 -5
  34. package/dist/esm/plugins/dry-run/index.js +2 -2
  35. package/dist/esm/plugins/dry-run/rpc.js +2 -2
  36. package/dist/esm/plugins/follow-chain/index.js +4 -4
  37. package/dist/esm/plugins/index.js +1 -1
  38. package/dist/esm/plugins/new-block/index.js +1 -1
  39. package/dist/esm/plugins/run-block/__snapshots__/index.test.ts.snap +16745 -0
  40. package/dist/esm/plugins/run-block/index.js +4 -4
  41. package/dist/esm/plugins/set-block-build-mode/index.js +1 -1
  42. package/dist/esm/plugins/set-runtime-log-level/index.js +1 -1
  43. package/dist/esm/plugins/set-storage/index.js +1 -1
  44. package/dist/esm/plugins/try-runtime/index.js +4 -4
  45. package/dist/esm/plugins/types.js +8 -8
  46. package/dist/esm/rpc/index.js +1 -1
  47. package/dist/esm/server.js +1 -1
  48. package/dist/esm/setup-with-server.js +3 -3
  49. package/dist/esm/types.js +2 -2
  50. package/dist/esm/utils/generate-html-diff.js +1 -1
  51. package/dist/esm/utils/index.js +4 -4
  52. package/dist/esm/utils/override.js +1 -1
  53. package/dist/types/context.d.ts +2 -2
  54. package/dist/types/index.d.ts +2 -2
  55. package/dist/types/plugins/dry-run/dry-run-extrinsic.d.ts +1 -1
  56. package/dist/types/plugins/dry-run/dry-run-preimage.d.ts +1 -1
  57. package/dist/types/plugins/dry-run/index.d.ts +2 -2
  58. package/dist/types/plugins/run-block/index.d.ts +1 -1
  59. package/dist/types/plugins/types.d.ts +11 -11
  60. package/dist/types/setup-with-server.d.ts +1 -1
  61. package/dist/types/types.d.ts +2 -2
  62. package/dist/types/utils/index.d.ts +4 -4
  63. package/package.json +7 -7
@@ -23,10 +23,10 @@ const _util = require("@polkadot/util");
23
23
  const _nodefs = require("node:fs");
24
24
  const _zod = require("zod");
25
25
  const _chopstickscore = require("@acala-network/chopsticks-core");
26
- const _clioptions = require("../../cli-options");
27
- const _generatehtmldiff = require("../../utils/generate-html-diff");
28
- const _openhtml = require("../../utils/open-html");
29
- const _context = require("../../context");
26
+ const _clioptions = require("../../cli-options.js");
27
+ const _generatehtmldiff = require("../../utils/generate-html-diff.js");
28
+ const _openhtml = require("../../utils/open-html.js");
29
+ const _context = require("../../context.js");
30
30
  const cli = (y)=>{
31
31
  y.command('run-block', 'Replay a block', (yargs)=>yargs.options({
32
32
  ..._clioptions.defaultOptions,
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "rpc", {
9
9
  }
10
10
  });
11
11
  const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _logger = require("../../logger");
12
+ const _logger = require("../../logger.js");
13
13
  const rpc = async (context, [mode])=>{
14
14
  _logger.defaultLogger.debug({
15
15
  mode
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "rpc", {
9
9
  }
10
10
  });
11
11
  const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _logger = require("../../logger");
12
+ const _logger = require("../../logger.js");
13
13
  const rpc = async (context, [runtimeLogLevel])=>{
14
14
  _logger.defaultLogger.debug({
15
15
  runtimeLogLevel
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "rpc", {
9
9
  }
10
10
  });
11
11
  const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _logger = require("../../logger");
12
+ const _logger = require("../../logger.js");
13
13
  const rpc = async (context, params)=>{
14
14
  const [values, blockHash] = params;
15
15
  const hash = await (0, _chopstickscore.setStorage)(context.chain, values, blockHash).catch((error)=>{
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "cli", {
9
9
  }
10
10
  });
11
11
  const _nodefs = require("node:fs");
12
- const _clioptions = require("../../cli-options");
13
- const _generatehtmldiff = require("../../utils/generate-html-diff");
14
- const _openhtml = require("../../utils/open-html");
15
- const _context = require("../../context");
12
+ const _clioptions = require("../../cli-options.js");
13
+ const _generatehtmldiff = require("../../utils/generate-html-diff.js");
14
+ const _openhtml = require("../../utils/open-html.js");
15
+ const _context = require("../../context.js");
16
16
  const cli = (y)=>{
17
17
  y.command('try-runtime', 'Runs runtime upgrade', (yargs)=>yargs.options({
18
18
  ..._clioptions.defaultOptions,
@@ -10,35 +10,35 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  dryRun: function() {
13
- return _dryrun.rpc;
13
+ return _index1.rpc;
14
14
  },
15
15
  newBlock: function() {
16
- return _newblock.rpc;
16
+ return _index.rpc;
17
17
  },
18
18
  runBlock: function() {
19
- return _runblock.rpc;
19
+ return _index7.rpc;
20
20
  },
21
21
  setBlockBuildMode: function() {
22
- return _setblockbuildmode.rpc;
22
+ return _index2.rpc;
23
23
  },
24
24
  setHead: function() {
25
- return _sethead.rpc;
25
+ return _index3.rpc;
26
26
  },
27
27
  setRuntimeLogLevel: function() {
28
- return _setruntimeloglevel.rpc;
28
+ return _index4.rpc;
29
29
  },
30
30
  setStorage: function() {
31
- return _setstorage.rpc;
31
+ return _index5.rpc;
32
32
  },
33
33
  timeTravel: function() {
34
- return _timetravel.rpc;
34
+ return _index6.rpc;
35
35
  }
36
36
  });
37
- const _newblock = require("./new-block");
38
- const _dryrun = require("./dry-run");
39
- const _setblockbuildmode = require("./set-block-build-mode");
40
- const _sethead = require("./set-head");
41
- const _setruntimeloglevel = require("./set-runtime-log-level");
42
- const _setstorage = require("./set-storage");
43
- const _timetravel = require("./time-travel");
44
- const _runblock = require("./run-block");
37
+ const _index = require("./new-block/index.js");
38
+ const _index1 = require("./dry-run/index.js");
39
+ const _index2 = require("./set-block-build-mode/index.js");
40
+ const _index3 = require("./set-head/index.js");
41
+ const _index4 = require("./set-runtime-log-level/index.js");
42
+ const _index5 = require("./set-storage/index.js");
43
+ const _index6 = require("./time-travel/index.js");
44
+ const _index7 = require("./run-block/index.js");
@@ -9,14 +9,14 @@ Object.defineProperty(exports, "handler", {
9
9
  }
10
10
  });
11
11
  const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _plugins = require("../plugins");
12
+ const _index = require("../plugins/index.js");
13
13
  const allHandlers = {
14
14
  ..._chopstickscore.substrate,
15
15
  rpc_methods: async ()=>Promise.resolve({
16
16
  version: 1,
17
17
  methods: [
18
18
  ...Object.keys(allHandlers),
19
- ...Object.keys(_plugins.pluginHandlers)
19
+ ...Object.keys(_index.pluginHandlers)
20
20
  ]
21
21
  })
22
22
  };
@@ -24,7 +24,7 @@ const getHandler = (method)=>{
24
24
  const handler = allHandlers[method];
25
25
  if (!handler) {
26
26
  // no handler for this method, check if it's a plugin
27
- return _plugins.pluginHandlers[method];
27
+ return _index.pluginHandlers[method];
28
28
  }
29
29
  return handler;
30
30
  };
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "createServer", {
11
11
  const _ws = require("ws");
12
12
  const _chopstickscore = require("@acala-network/chopsticks-core");
13
13
  const _zod = require("zod");
14
- const _logger = require("./logger");
14
+ const _logger = require("./logger.js");
15
15
  const logger = _logger.defaultLogger.child({
16
16
  name: 'ws'
17
17
  });
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "setupWithServer", {
8
8
  return setupWithServer;
9
9
  }
10
10
  });
11
- const _server = require("./server");
12
- const _rpc = require("./rpc");
11
+ const _server = require("./server.js");
12
+ const _index = require("./rpc/index.js");
13
13
  const _chopstickscore = require("@acala-network/chopsticks-core");
14
- const _context = require("./context");
14
+ const _context = require("./context.js");
15
15
  const setupWithServer = async (argv)=>{
16
16
  const context = await (0, _context.setupContext)(argv);
17
17
  const port = argv.port ?? 8000;
@@ -19,7 +19,7 @@ const setupWithServer = async (argv)=>{
19
19
  // mine 1st block when starting from genesis to set some mock validation data
20
20
  await context.chain.newBlock();
21
21
  }
22
- const { close, port: listenPort } = await (0, _server.createServer)((0, _rpc.handler)(context), port);
22
+ const { close, port: listenPort } = await (0, _server.createServer)((0, _index.handler)(context), port);
23
23
  _chopstickscore.logger.info(`${await context.chain.api.getSystemChain()} RPC listening on port ${listenPort}`);
24
24
  return {
25
25
  ...context,
package/dist/cjs/types.js CHANGED
@@ -13,8 +13,8 @@
13
13
  Object.defineProperty(exports, "__esModule", {
14
14
  value: true
15
15
  });
16
- _export_star(require("@acala-network/chopsticks-core/src/rpc/substrate"), exports);
17
- _export_star(require("./plugins/types"), exports);
16
+ _export_star(require("@acala-network/chopsticks-core/rpc/substrate/index.js"), exports);
17
+ _export_star(require("./plugins/types.js"), exports);
18
18
  function _export_star(from, to) {
19
19
  Object.keys(from).forEach(function(k) {
20
20
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -16,7 +16,7 @@ _export(exports, {
16
16
  return generateHtmlDiffPreviewFile;
17
17
  }
18
18
  });
19
- const _decoder = require("./decoder");
19
+ const _decoder = require("./decoder.js");
20
20
  const _nodefs = require("node:fs");
21
21
  const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
22
22
  function _interop_require_default(obj) {
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./decoder"), exports);
6
- _export_star(require("./generate-html-diff"), exports);
7
- _export_star(require("./open-html"), exports);
8
- _export_star(require("./override"), exports);
5
+ _export_star(require("./decoder.js"), exports);
6
+ _export_star(require("./generate-html-diff.js"), exports);
7
+ _export_star(require("./open-html.js"), exports);
8
+ _export_star(require("./override.js"), exports);
9
9
  function _export_star(from, to) {
10
10
  Object.keys(from).forEach(function(k) {
11
11
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -19,7 +19,7 @@ _export(exports, {
19
19
  const _chopstickscore = require("@acala-network/chopsticks-core");
20
20
  const _nodefs = require("node:fs");
21
21
  const _jsyaml = /*#__PURE__*/ _interop_require_default(require("js-yaml"));
22
- const _logger = require("../logger");
22
+ const _logger = require("../logger.js");
23
23
  function _interop_require_default(obj) {
24
24
  return obj && obj.__esModule ? obj : {
25
25
  default: obj
package/dist/esm/cli.js CHANGED
@@ -3,10 +3,10 @@ import { hideBin } from 'yargs/helpers';
3
3
  import _ from 'lodash';
4
4
  import yargs from 'yargs';
5
5
  import { BuildBlockMode, connectParachains, connectVertical } from '@acala-network/chopsticks-core';
6
- import { fetchConfig } from './schema';
7
- import { defaultOptions, mockOptions } from './cli-options';
8
- import { pluginExtendCli } from './plugins';
9
- import { setupWithServer } from '.';
6
+ import { fetchConfig } from './schema/index.js';
7
+ import { defaultOptions, mockOptions } from './cli-options.js';
8
+ import { pluginExtendCli } from './plugins/index.js';
9
+ import { setupWithServer } from './index.js';
10
10
  dotenvConfig();
11
11
  const processArgv = async (argv)=>{
12
12
  if (argv.config) {
@@ -1,7 +1,7 @@
1
- import './utils/tunnel';
1
+ import './utils/tunnel.js';
2
2
  import { GenesisProvider, defaultLogger, isUrl, setup, timeTravel } from '@acala-network/chopsticks-core';
3
3
  import { SqliteDatabase } from '@acala-network/chopsticks-db';
4
- import { overrideStorage, overrideWasm } from './utils/override';
4
+ import { overrideStorage, overrideWasm } from './utils/override.js';
5
5
  import axios from 'axios';
6
6
  const logger = defaultLogger.child({
7
7
  name: 'setup-context'
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import '@polkadot/api-augment';
2
2
  export * from '@acala-network/chopsticks-core';
3
- export { setupWithServer } from './setup-with-server';
4
- export { fetchConfig } from './schema';
3
+ export { setupWithServer } from './setup-with-server.js';
4
+ export { fetchConfig } from './schema/index.js';
@@ -1,6 +1,6 @@
1
1
  import { decodeKey } from '@acala-network/chopsticks-core';
2
- import { defaultOptions } from '../../cli-options';
3
- import { setupContext } from '../../context';
2
+ import { defaultOptions } from '../../cli-options.js';
3
+ import { setupContext } from '../../context.js';
4
4
  export const cli = (y)=>{
5
5
  y.command('decode-key <key>', 'Deocde a key', (yargs)=>yargs.positional('key', {
6
6
  desc: 'Key to decode',
@@ -1,6 +1,6 @@
1
- import { defaultOptions, mockOptions } from '../../cli-options';
2
- import { dryRunExtrinsic } from './dry-run-extrinsic';
3
- import { dryRunPreimage } from './dry-run-preimage';
1
+ import { defaultOptions, mockOptions } from '../../cli-options.js';
2
+ import { dryRunExtrinsic } from './dry-run-extrinsic.js';
3
+ import { dryRunPreimage } from './dry-run-preimage.js';
4
4
  export const cli = (y)=>{
5
5
  y.command('dry-run', 'Dry run an extrinsic', (yargs)=>yargs.options({
6
6
  ...defaultOptions,
@@ -1,9 +1,9 @@
1
1
  import { blake2AsHex } from '@polkadot/util-crypto';
2
2
  import { writeFileSync } from 'node:fs';
3
- import { defaultLogger } from '../../logger';
4
- import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff';
5
- import { openHtml } from '../../utils/open-html';
6
- import { setupContext } from '../../context';
3
+ import { defaultLogger } from '../../logger.js';
4
+ import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js';
5
+ import { openHtml } from '../../utils/open-html.js';
6
+ import { setupContext } from '../../context.js';
7
7
  export const dryRunExtrinsic = async (argv)=>{
8
8
  const context = await setupContext(argv);
9
9
  const input = argv['address'] ? {
@@ -1,10 +1,10 @@
1
1
  import { blake2AsHex } from '@polkadot/util-crypto';
2
2
  import { hexToU8a } from '@polkadot/util';
3
- import { defaultLogger } from '../../logger';
4
- import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff';
3
+ import { defaultLogger } from '../../logger.js';
4
+ import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js';
5
5
  import { newHeader, printRuntimeLogs, runTask, setStorage, taskHandler } from '@acala-network/chopsticks-core';
6
- import { openHtml } from '../../utils/open-html';
7
- import { setupContext } from '../../context';
6
+ import { openHtml } from '../../utils/open-html.js';
7
+ import { setupContext } from '../../context.js';
8
8
  export const dryRunPreimage = async (argv)=>{
9
9
  const context = await setupContext(argv);
10
10
  const extrinsic = argv['preimage'];
@@ -118,7 +118,7 @@ export const dryRunPreimage = async (argv)=>{
118
118
  openHtml(filePath);
119
119
  }
120
120
  // if dry-run preimage has extrinsic arguments then dry-run extrinsic
121
- // this is usefull to test something after preimage is applied
121
+ // this is useful to test something after preimage is applied
122
122
  if (argv['extrinsic']) {
123
123
  await context.chain.newBlock();
124
124
  const input = argv['address'] ? {
@@ -1,2 +1,2 @@
1
- export * from './cli';
2
- export * from './rpc';
1
+ export * from './cli.js';
2
+ export * from './rpc.js';
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { ResponseError } from '@acala-network/chopsticks-core';
3
- import { decodeStorageDiff } from '../../utils/decoder';
4
- import { generateHtmlDiff } from '../../utils/generate-html-diff';
3
+ import { decodeStorageDiff } from '../../utils/decoder.js';
4
+ import { generateHtmlDiff } from '../../utils/generate-html-diff.js';
5
5
  const zHex = z.custom((val)=>/^0x\w+$/.test(val));
6
6
  const zHash = z.string().length(66).and(zHex);
7
7
  const zParaId = z.string().regex(/^\d+$/).transform(Number);
@@ -1,9 +1,9 @@
1
1
  import { Block, defaultLogger, printRuntimeLogs, runTask, taskHandler } from '@acala-network/chopsticks-core';
2
2
  import _ from 'lodash';
3
- import { createServer } from '../../server';
4
- import { defaultOptions } from '../../cli-options';
5
- import { handler } from '../../rpc';
6
- import { setupContext } from '../../context';
3
+ import { createServer } from '../../server.js';
4
+ import { defaultOptions } from '../../cli-options.js';
5
+ import { handler } from '../../rpc/index.js';
6
+ import { setupContext } from '../../context.js';
7
7
  const logger = defaultLogger.child({
8
8
  name: 'follow-chain'
9
9
  });
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { defaultLogger } from '../logger';
2
+ import { defaultLogger } from '../logger.js';
3
3
  const logger = defaultLogger.child({
4
4
  name: 'plugin'
5
5
  });
@@ -1,5 +1,5 @@
1
1
  import { ResponseError } from '@acala-network/chopsticks-core';
2
- import { defaultLogger } from '../../logger';
2
+ import { defaultLogger } from '../../logger.js';
3
3
  /**
4
4
  * Build new blocks.
5
5
  *