@acala-network/chopsticks-core 0.9.5-3 → 0.9.5

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.
@@ -1,4 +1,11 @@
1
- export declare const defaultLogger: import("pino").Logger<{
1
+ import { pino } from 'pino';
2
+ export declare const pinoLogger: import("pino").Logger<{
3
+ level: string;
4
+ transport: {
5
+ target: string;
6
+ };
7
+ }>;
8
+ export declare const defaultLogger: pino.Logger<{
2
9
  level: string;
3
10
  transport: {
4
11
  target: string;
@@ -12,17 +12,23 @@ _export(exports, {
12
12
  defaultLogger: function() {
13
13
  return defaultLogger;
14
14
  },
15
+ pinoLogger: function() {
16
+ return pinoLogger;
17
+ },
15
18
  truncate: function() {
16
19
  return truncate;
17
20
  }
18
21
  });
19
22
  const _pino = require("pino");
20
- const defaultLogger = (0, _pino.pino)({
23
+ const pinoLogger = (0, _pino.pino)({
21
24
  level: typeof process === 'object' && process.env.LOG_LEVEL || 'info',
22
25
  transport: {
23
26
  target: 'pino-pretty'
24
27
  }
25
28
  });
29
+ const defaultLogger = pinoLogger.child({
30
+ app: 'chopsticks'
31
+ });
26
32
  const innerTruncate = (level = 0)=>(val)=>{
27
33
  const verboseLog = typeof process === 'object' ? !!process.env.VERBOSE_LOG : false;
28
34
  const levelLimit = verboseLog ? 10 : 5;
package/dist/cjs/setup.js CHANGED
@@ -15,6 +15,7 @@ const _index = require("./blockchain/index.js");
15
15
  const _index1 = require("./blockchain/inherent/index.js");
16
16
  const _logger = require("./logger.js");
17
17
  const setup = async (options)=>{
18
+ _logger.defaultLogger.debug(options, 'Setup options');
18
19
  let provider;
19
20
  if (options.genesis) {
20
21
  provider = options.genesis;
@@ -38,22 +38,34 @@ function objectToStorageItems(meta, storage) {
38
38
  const key = new _types.StorageKey(meta.registry, [
39
39
  storageEntry
40
40
  ]);
41
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
42
- storageItems.push([
43
- key.toHex(),
44
- storage ? meta.registry.createType(type, storage).toHex() : null
45
- ]);
41
+ if (storageEntry.meta.modifier.isOptional && storage === '0x') {
42
+ storageItems.push([
43
+ key.toHex(),
44
+ '0x'
45
+ ]);
46
+ } else {
47
+ storageItems.push([
48
+ key.toHex(),
49
+ storage ? (0, _util.u8aToHex)(meta.registry.createType(key.outputType, storage).toU8a()) : null
50
+ ]);
51
+ }
46
52
  } else {
47
53
  for (const [keys, value] of storage){
48
54
  const key = new _types.StorageKey(meta.registry, [
49
55
  storageEntry,
50
56
  keys
51
57
  ]);
52
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
53
- storageItems.push([
54
- key.toHex(),
55
- value ? meta.registry.createType(type, value).toHex() : null
56
- ]);
58
+ if (storageEntry.meta.modifier.isOptional && value === '0x') {
59
+ storageItems.push([
60
+ key.toHex(),
61
+ '0x'
62
+ ]);
63
+ } else {
64
+ storageItems.push([
65
+ key.toHex(),
66
+ value ? (0, _util.u8aToHex)(meta.registry.createType(key.outputType, value).toU8a()) : null
67
+ ]);
68
+ }
57
69
  }
58
70
  }
59
71
  }
@@ -1,4 +1,11 @@
1
- export declare const defaultLogger: import("pino").Logger<{
1
+ import { pino } from 'pino';
2
+ export declare const pinoLogger: import("pino").Logger<{
3
+ level: string;
4
+ transport: {
5
+ target: string;
6
+ };
7
+ }>;
8
+ export declare const defaultLogger: pino.Logger<{
2
9
  level: string;
3
10
  transport: {
4
11
  target: string;
@@ -1,10 +1,13 @@
1
1
  import { pino } from 'pino';
2
- export const defaultLogger = pino({
2
+ export const pinoLogger = pino({
3
3
  level: typeof process === 'object' && process.env.LOG_LEVEL || 'info',
4
4
  transport: {
5
5
  target: 'pino-pretty'
6
6
  }
7
7
  });
8
+ export const defaultLogger = pinoLogger.child({
9
+ app: 'chopsticks'
10
+ });
8
11
  const innerTruncate = (level = 0)=>(val)=>{
9
12
  const verboseLog = typeof process === 'object' ? !!process.env.VERBOSE_LOG : false;
10
13
  const levelLimit = verboseLog ? 10 : 5;
package/dist/esm/setup.js CHANGED
@@ -5,6 +5,7 @@ import { Blockchain } from './blockchain/index.js';
5
5
  import { InherentProviders, ParaInherentEnter, SetBabeRandomness, SetNimbusAuthorInherent, SetTimestamp, SetValidationData } from './blockchain/inherent/index.js';
6
6
  import { defaultLogger } from './logger.js';
7
7
  export const setup = async (options)=>{
8
+ defaultLogger.debug(options, 'Setup options');
8
9
  let provider;
9
10
  if (options.genesis) {
10
11
  provider = options.genesis;
@@ -28,22 +28,34 @@ function objectToStorageItems(meta, storage) {
28
28
  const key = new StorageKey(meta.registry, [
29
29
  storageEntry
30
30
  ]);
31
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
32
- storageItems.push([
33
- key.toHex(),
34
- storage ? meta.registry.createType(type, storage).toHex() : null
35
- ]);
31
+ if (storageEntry.meta.modifier.isOptional && storage === '0x') {
32
+ storageItems.push([
33
+ key.toHex(),
34
+ '0x'
35
+ ]);
36
+ } else {
37
+ storageItems.push([
38
+ key.toHex(),
39
+ storage ? u8aToHex(meta.registry.createType(key.outputType, storage).toU8a()) : null
40
+ ]);
41
+ }
36
42
  } else {
37
43
  for (const [keys, value] of storage){
38
44
  const key = new StorageKey(meta.registry, [
39
45
  storageEntry,
40
46
  keys
41
47
  ]);
42
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
43
- storageItems.push([
44
- key.toHex(),
45
- value ? meta.registry.createType(type, value).toHex() : null
46
- ]);
48
+ if (storageEntry.meta.modifier.isOptional && value === '0x') {
49
+ storageItems.push([
50
+ key.toHex(),
51
+ '0x'
52
+ ]);
53
+ } else {
54
+ storageItems.push([
55
+ key.toHex(),
56
+ value ? u8aToHex(meta.registry.createType(key.outputType, value).toU8a()) : null
57
+ ]);
58
+ }
47
59
  }
48
60
  }
49
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks-core",
3
- "version": "0.9.5-3",
3
+ "version": "0.9.5",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "docs:prep": "typedoc"
13
13
  },
14
14
  "dependencies": {
15
- "@acala-network/chopsticks-executor": "0.9.5-3",
15
+ "@acala-network/chopsticks-executor": "0.9.5",
16
16
  "@polkadot/rpc-provider": "^10.10.1",
17
17
  "@polkadot/types": "^10.10.1",
18
18
  "@polkadot/types-codec": "^10.10.1",