@acala-network/chopsticks 0.7.0 → 0.7.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/lib/cli.d.ts CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ import { Config } from './schema';
2
+ export declare const fetchConfig: (path: string) => Promise<Config>;
package/lib/cli.js CHANGED
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchConfig = void 0;
6
7
  const node_path_1 = require("node:path");
7
8
  const dotenv_1 = require("dotenv");
8
9
  const helpers_1 = require("yargs/helpers");
@@ -22,7 +23,7 @@ const run_block_1 = require("./run-block");
22
23
  const try_runtime_1 = require("./try-runtime");
23
24
  (0, dotenv_1.config)();
24
25
  const CONFIGS_BASE_URL = 'https://raw.githubusercontent.com/AcalaNetwork/chopsticks/master/configs/';
25
- const processConfig = async (path) => {
26
+ const fetchConfig = async (path) => {
26
27
  let file;
27
28
  if ((0, utils_1.isUrl)(path)) {
28
29
  file = await axios_1.default.get(path).then((x) => x.data);
@@ -48,9 +49,10 @@ const processConfig = async (path) => {
48
49
  const config = js_yaml_1.default.load(lodash_1.default.template(file, { variable: 'env' })(process.env));
49
50
  return schema_1.configSchema.parse(config);
50
51
  };
52
+ exports.fetchConfig = fetchConfig;
51
53
  const processArgv = async (argv) => {
52
54
  if (argv.config) {
53
- argv = { ...(await processConfig(argv.config)), ...argv };
55
+ argv = { ...(await (0, exports.fetchConfig)(argv.config)), ...argv };
54
56
  }
55
57
  argv.port = argv.port ?? (process.env.PORT ? Number(process.env.PORT) : 8000);
56
58
  return argv;
@@ -223,14 +225,14 @@ const mockOptions = {
223
225
  .alias('parachain', 'p'), async (argv) => {
224
226
  const parachains = [];
225
227
  for (const config of argv.parachain) {
226
- const { chain } = await (0, _1.setupWithServer)(await processConfig(config));
228
+ const { chain } = await (0, _1.setupWithServer)(await (0, exports.fetchConfig)(config));
227
229
  parachains.push(chain);
228
230
  }
229
231
  if (parachains.length > 1) {
230
232
  await (0, _1.connectParachains)(parachains);
231
233
  }
232
234
  if (argv.relaychain) {
233
- const { chain: relaychain } = await (0, _1.setupWithServer)(await processConfig(argv.relaychain));
235
+ const { chain: relaychain } = await (0, _1.setupWithServer)(await (0, exports.fetchConfig)(argv.relaychain));
234
236
  for (const parachain of parachains) {
235
237
  await (0, _1.connectVertical)(relaychain, parachain);
236
238
  }
package/lib/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export { BuildBlockMode } from './blockchain/txpool';
4
4
  export { connectParachains, connectVertical } from './xcm';
5
5
  export { setup } from './setup';
6
6
  export { setupWithServer } from './setup-with-server';
7
+ export { fetchConfig } from './cli';
7
8
  export * from './blockchain/inherent';
package/lib/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.setupWithServer = exports.setup = exports.connectVertical = exports.connectParachains = exports.BuildBlockMode = exports.Blockchain = exports.Api = void 0;
17
+ exports.fetchConfig = exports.setupWithServer = exports.setup = exports.connectVertical = exports.connectParachains = exports.BuildBlockMode = exports.Blockchain = exports.Api = void 0;
18
18
  var api_1 = require("./api");
19
19
  Object.defineProperty(exports, "Api", { enumerable: true, get: function () { return api_1.Api; } });
20
20
  var blockchain_1 = require("./blockchain");
@@ -28,4 +28,6 @@ var setup_1 = require("./setup");
28
28
  Object.defineProperty(exports, "setup", { enumerable: true, get: function () { return setup_1.setup; } });
29
29
  var setup_with_server_1 = require("./setup-with-server");
30
30
  Object.defineProperty(exports, "setupWithServer", { enumerable: true, get: function () { return setup_with_server_1.setupWithServer; } });
31
+ var cli_1 = require("./cli");
32
+ Object.defineProperty(exports, "fetchConfig", { enumerable: true, get: function () { return cli_1.fetchConfig; } });
31
33
  __exportStar(require("./blockchain/inherent"), exports);
package/lib/logger.js CHANGED
@@ -12,15 +12,17 @@ exports.defaultLogger = (0, pino_1.default)({
12
12
  },
13
13
  });
14
14
  const innerTruncate = (level = 0) => (val) => {
15
+ const verboseLog = !!process.env.VERBOSE_LOG;
16
+ const levelLimit = verboseLog ? 10 : 5;
15
17
  if (val == null) {
16
18
  return val;
17
19
  }
18
- if (level > 5) {
20
+ if (level > levelLimit) {
19
21
  return '( Too Deep )';
20
22
  }
21
23
  switch (typeof val) {
22
24
  case 'string':
23
- if (val.length > 66) {
25
+ if (val.length > 66 && !verboseLog) {
24
26
  return val.slice(0, 34) + '…' + val.slice(-32);
25
27
  }
26
28
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "author": "Bryan Chen <xlchen1291@gmail.com>",
5
5
  "license": "Apache-2.0",
6
6
  "bin": "./chopsticks.js",
@@ -16,7 +16,7 @@
16
16
  "dev:moonbeam": "cd ../..; ts-node-dev --transpile-only --inspect --notify=false packages/chopsticks/src/cli.ts -- --config=configs/moonbeam.yml"
17
17
  },
18
18
  "dependencies": {
19
- "@acala-network/chopsticks-executor": "0.7.0",
19
+ "@acala-network/chopsticks-executor": "0.7.1",
20
20
  "@pnpm/npm-conf": "^2.2.2",
21
21
  "@polkadot/api": "^10.9.1",
22
22
  "axios": "^1.4.0",