@acala-network/chopsticks 1.5.2 → 1.6.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/bridge.js +1 -0
- package/dist/cjs/context.js +8 -19
- package/dist/cjs/plugins/dry-run/cli.js +7 -21
- package/dist/cjs/plugins/dry-run/index.d.ts +21 -227
- package/dist/cjs/plugins/dry-run/index.js +7 -21
- package/dist/cjs/plugins/dry-run/rpc.d.ts +12 -64
- package/dist/cjs/plugins/index.js +8 -19
- package/dist/cjs/plugins/run-block/cli.js +3 -9
- package/dist/cjs/plugins/run-block/rpc.d.ts +4 -28
- package/dist/cjs/plugins/trace-transaction/index.js +5 -15
- package/dist/cjs/plugins/try-runtime/index.js +3 -9
- package/dist/cjs/schema/index.d.ts +25 -217
- package/dist/cjs/schema/index.js +80 -72
- package/dist/cjs/types.js +8 -19
- package/dist/cjs/utils/fetch-storages-worker.js +8 -19
- package/dist/cjs/utils/override.js +32 -2
- package/dist/esm/bridge.js +1 -0
- package/dist/esm/plugins/dry-run/cli.js +7 -21
- package/dist/esm/plugins/dry-run/index.d.ts +21 -227
- package/dist/esm/plugins/dry-run/index.js +7 -21
- package/dist/esm/plugins/dry-run/rpc.d.ts +12 -64
- package/dist/esm/plugins/run-block/cli.js +3 -9
- package/dist/esm/plugins/run-block/rpc.d.ts +4 -28
- package/dist/esm/plugins/trace-transaction/index.js +5 -15
- package/dist/esm/plugins/try-runtime/index.js +3 -9
- package/dist/esm/schema/index.d.ts +25 -217
- package/dist/esm/schema/index.js +50 -72
- package/dist/esm/utils/override.js +1 -1
- package/package.json +82 -78
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { BuildBlockMode } from '@acala-network/chopsticks-core';
|
|
2
2
|
import type { Options } from 'yargs';
|
|
3
|
-
import {
|
|
4
|
-
export declare const zHex: z.
|
|
5
|
-
export declare const zHash: z.ZodIntersection<z.ZodString, z.
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare const zHex: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
5
|
+
export declare const zHash: z.ZodIntersection<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
6
6
|
export declare const configSchema: z.ZodObject<{
|
|
7
|
-
addr: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"localhost">, z.
|
|
8
|
-
host: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"localhost">, z.
|
|
7
|
+
addr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"localhost">, z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6]>]>>;
|
|
8
|
+
host: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"localhost">, z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6]>]>>;
|
|
9
9
|
port: z.ZodDefault<z.ZodNumber>;
|
|
10
|
-
endpoint: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString
|
|
11
|
-
block: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
12
|
-
'build-block-mode': z.ZodDefault<
|
|
10
|
+
endpoint: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
11
|
+
block: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
12
|
+
'build-block-mode': z.ZodDefault<z.ZodEnum<typeof BuildBlockMode>>;
|
|
13
13
|
'import-storage': z.ZodOptional<z.ZodAny>;
|
|
14
14
|
'allow-unresolved-imports': z.ZodOptional<z.ZodBoolean>;
|
|
15
15
|
'mock-signature-host': z.ZodOptional<z.ZodBoolean>;
|
|
@@ -17,237 +17,45 @@ export declare const configSchema: z.ZodObject<{
|
|
|
17
17
|
db: z.ZodOptional<z.ZodString>;
|
|
18
18
|
'save-blocks': z.ZodOptional<z.ZodBoolean>;
|
|
19
19
|
'wasm-override': z.ZodOptional<z.ZodString>;
|
|
20
|
-
genesis: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
20
|
+
genesis: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
21
21
|
id: z.ZodString;
|
|
22
22
|
name: z.ZodString;
|
|
23
23
|
properties: z.ZodObject<{
|
|
24
24
|
ss58Format: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
tokenDecimals: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber
|
|
26
|
-
tokenSymbol: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString
|
|
27
|
-
},
|
|
28
|
-
ss58Format?: number | undefined;
|
|
29
|
-
tokenDecimals?: number | number[] | undefined;
|
|
30
|
-
tokenSymbol?: string | string[] | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
ss58Format?: number | undefined;
|
|
33
|
-
tokenDecimals?: number | number[] | undefined;
|
|
34
|
-
tokenSymbol?: string | string[] | undefined;
|
|
35
|
-
}>;
|
|
25
|
+
tokenDecimals: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
|
|
26
|
+
tokenSymbol: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
36
28
|
genesis: z.ZodObject<{
|
|
37
29
|
raw: z.ZodObject<{
|
|
38
30
|
top: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}>;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
raw: {
|
|
46
|
-
top: Record<string, string>;
|
|
47
|
-
};
|
|
48
|
-
}, {
|
|
49
|
-
raw: {
|
|
50
|
-
top: Record<string, string>;
|
|
51
|
-
};
|
|
52
|
-
}>;
|
|
53
|
-
}, "strip", ZodTypeAny, {
|
|
54
|
-
name: string;
|
|
55
|
-
id: string;
|
|
56
|
-
properties: {
|
|
57
|
-
ss58Format?: number | undefined;
|
|
58
|
-
tokenDecimals?: number | number[] | undefined;
|
|
59
|
-
tokenSymbol?: string | string[] | undefined;
|
|
60
|
-
};
|
|
61
|
-
genesis: {
|
|
62
|
-
raw: {
|
|
63
|
-
top: Record<string, string>;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
}, {
|
|
67
|
-
name: string;
|
|
68
|
-
id: string;
|
|
69
|
-
properties: {
|
|
70
|
-
ss58Format?: number | undefined;
|
|
71
|
-
tokenDecimals?: number | number[] | undefined;
|
|
72
|
-
tokenSymbol?: string | string[] | undefined;
|
|
73
|
-
};
|
|
74
|
-
genesis: {
|
|
75
|
-
raw: {
|
|
76
|
-
top: Record<string, string>;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
}>]>>;
|
|
80
|
-
'chain-spec': z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
}, z.core.$strip>]>>;
|
|
34
|
+
'chain-spec': z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
81
35
|
id: z.ZodString;
|
|
82
36
|
name: z.ZodString;
|
|
83
37
|
properties: z.ZodObject<{
|
|
84
38
|
ss58Format: z.ZodOptional<z.ZodNumber>;
|
|
85
|
-
tokenDecimals: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber
|
|
86
|
-
tokenSymbol: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString
|
|
87
|
-
},
|
|
88
|
-
ss58Format?: number | undefined;
|
|
89
|
-
tokenDecimals?: number | number[] | undefined;
|
|
90
|
-
tokenSymbol?: string | string[] | undefined;
|
|
91
|
-
}, {
|
|
92
|
-
ss58Format?: number | undefined;
|
|
93
|
-
tokenDecimals?: number | number[] | undefined;
|
|
94
|
-
tokenSymbol?: string | string[] | undefined;
|
|
95
|
-
}>;
|
|
39
|
+
tokenDecimals: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
|
|
40
|
+
tokenSymbol: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
96
42
|
genesis: z.ZodObject<{
|
|
97
43
|
raw: z.ZodObject<{
|
|
98
44
|
top: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
top: Record<string, string>;
|
|
103
|
-
}>;
|
|
104
|
-
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
raw: {
|
|
106
|
-
top: Record<string, string>;
|
|
107
|
-
};
|
|
108
|
-
}, {
|
|
109
|
-
raw: {
|
|
110
|
-
top: Record<string, string>;
|
|
111
|
-
};
|
|
112
|
-
}>;
|
|
113
|
-
}, "strip", ZodTypeAny, {
|
|
114
|
-
name: string;
|
|
115
|
-
id: string;
|
|
116
|
-
properties: {
|
|
117
|
-
ss58Format?: number | undefined;
|
|
118
|
-
tokenDecimals?: number | number[] | undefined;
|
|
119
|
-
tokenSymbol?: string | string[] | undefined;
|
|
120
|
-
};
|
|
121
|
-
genesis: {
|
|
122
|
-
raw: {
|
|
123
|
-
top: Record<string, string>;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
}, {
|
|
127
|
-
name: string;
|
|
128
|
-
id: string;
|
|
129
|
-
properties: {
|
|
130
|
-
ss58Format?: number | undefined;
|
|
131
|
-
tokenDecimals?: number | number[] | undefined;
|
|
132
|
-
tokenSymbol?: string | string[] | undefined;
|
|
133
|
-
};
|
|
134
|
-
genesis: {
|
|
135
|
-
raw: {
|
|
136
|
-
top: Record<string, string>;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
}>]>>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
}, z.core.$strip>]>>;
|
|
140
48
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
141
49
|
'registered-types': z.ZodOptional<z.ZodAny>;
|
|
142
50
|
'runtime-log-level': z.ZodOptional<z.ZodNumber>;
|
|
143
51
|
'offchain-worker': z.ZodOptional<z.ZodBoolean>;
|
|
144
|
-
resume: z.ZodOptional<z.ZodUnion<[z.ZodIntersection<z.ZodString, z.
|
|
52
|
+
resume: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber, z.ZodBoolean]>>;
|
|
145
53
|
'process-queued-messages': z.ZodOptional<z.ZodBoolean>;
|
|
146
54
|
'prefetch-storages': z.ZodOptional<z.ZodAny>;
|
|
147
55
|
'rpc-timeout': z.ZodOptional<z.ZodNumber>;
|
|
148
|
-
},
|
|
149
|
-
port: number;
|
|
150
|
-
'build-block-mode': BuildBlockMode;
|
|
151
|
-
addr?: string | undefined;
|
|
152
|
-
host?: string | undefined;
|
|
153
|
-
endpoint?: string | string[] | undefined;
|
|
154
|
-
block?: string | number | null | undefined;
|
|
155
|
-
'import-storage'?: any;
|
|
156
|
-
'allow-unresolved-imports'?: boolean | undefined;
|
|
157
|
-
'mock-signature-host'?: boolean | undefined;
|
|
158
|
-
'max-memory-block-count'?: number | undefined;
|
|
159
|
-
db?: string | undefined;
|
|
160
|
-
'save-blocks'?: boolean | undefined;
|
|
161
|
-
'wasm-override'?: string | undefined;
|
|
162
|
-
genesis?: string | {
|
|
163
|
-
name: string;
|
|
164
|
-
id: string;
|
|
165
|
-
properties: {
|
|
166
|
-
ss58Format?: number | undefined;
|
|
167
|
-
tokenDecimals?: number | number[] | undefined;
|
|
168
|
-
tokenSymbol?: string | string[] | undefined;
|
|
169
|
-
};
|
|
170
|
-
genesis: {
|
|
171
|
-
raw: {
|
|
172
|
-
top: Record<string, string>;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
} | undefined;
|
|
176
|
-
'chain-spec'?: string | {
|
|
177
|
-
name: string;
|
|
178
|
-
id: string;
|
|
179
|
-
properties: {
|
|
180
|
-
ss58Format?: number | undefined;
|
|
181
|
-
tokenDecimals?: number | number[] | undefined;
|
|
182
|
-
tokenSymbol?: string | string[] | undefined;
|
|
183
|
-
};
|
|
184
|
-
genesis: {
|
|
185
|
-
raw: {
|
|
186
|
-
top: Record<string, string>;
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
} | undefined;
|
|
190
|
-
timestamp?: number | undefined;
|
|
191
|
-
'registered-types'?: any;
|
|
192
|
-
'runtime-log-level'?: number | undefined;
|
|
193
|
-
'offchain-worker'?: boolean | undefined;
|
|
194
|
-
resume?: number | boolean | `0x${string}` | undefined;
|
|
195
|
-
'process-queued-messages'?: boolean | undefined;
|
|
196
|
-
'prefetch-storages'?: any;
|
|
197
|
-
'rpc-timeout'?: number | undefined;
|
|
198
|
-
}, {
|
|
199
|
-
addr?: string | undefined;
|
|
200
|
-
host?: string | undefined;
|
|
201
|
-
port?: number | undefined;
|
|
202
|
-
endpoint?: string | string[] | undefined;
|
|
203
|
-
block?: string | number | null | undefined;
|
|
204
|
-
'build-block-mode'?: BuildBlockMode | undefined;
|
|
205
|
-
'import-storage'?: any;
|
|
206
|
-
'allow-unresolved-imports'?: boolean | undefined;
|
|
207
|
-
'mock-signature-host'?: boolean | undefined;
|
|
208
|
-
'max-memory-block-count'?: number | undefined;
|
|
209
|
-
db?: string | undefined;
|
|
210
|
-
'save-blocks'?: boolean | undefined;
|
|
211
|
-
'wasm-override'?: string | undefined;
|
|
212
|
-
genesis?: string | {
|
|
213
|
-
name: string;
|
|
214
|
-
id: string;
|
|
215
|
-
properties: {
|
|
216
|
-
ss58Format?: number | undefined;
|
|
217
|
-
tokenDecimals?: number | number[] | undefined;
|
|
218
|
-
tokenSymbol?: string | string[] | undefined;
|
|
219
|
-
};
|
|
220
|
-
genesis: {
|
|
221
|
-
raw: {
|
|
222
|
-
top: Record<string, string>;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
} | undefined;
|
|
226
|
-
'chain-spec'?: string | {
|
|
227
|
-
name: string;
|
|
228
|
-
id: string;
|
|
229
|
-
properties: {
|
|
230
|
-
ss58Format?: number | undefined;
|
|
231
|
-
tokenDecimals?: number | number[] | undefined;
|
|
232
|
-
tokenSymbol?: string | string[] | undefined;
|
|
233
|
-
};
|
|
234
|
-
genesis: {
|
|
235
|
-
raw: {
|
|
236
|
-
top: Record<string, string>;
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
} | undefined;
|
|
240
|
-
timestamp?: number | undefined;
|
|
241
|
-
'registered-types'?: any;
|
|
242
|
-
'runtime-log-level'?: number | undefined;
|
|
243
|
-
'offchain-worker'?: boolean | undefined;
|
|
244
|
-
resume?: number | boolean | `0x${string}` | undefined;
|
|
245
|
-
'process-queued-messages'?: boolean | undefined;
|
|
246
|
-
'prefetch-storages'?: any;
|
|
247
|
-
'rpc-timeout'?: number | undefined;
|
|
248
|
-
}>;
|
|
56
|
+
}, z.core.$strip>;
|
|
249
57
|
export type Config = z.infer<typeof configSchema>;
|
|
250
|
-
export declare const getYargsOptions: (zodShape:
|
|
58
|
+
export declare const getYargsOptions: (zodShape: Record<string, any>) => {
|
|
251
59
|
[x: string]: Options;
|
|
252
60
|
};
|
|
253
61
|
export declare const fetchConfig: (path: string) => Promise<Config>;
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -29,7 +29,7 @@ const _nodefs = require("node:fs");
|
|
|
29
29
|
const _nodepath = require("node:path");
|
|
30
30
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
31
31
|
const _axios = /*#__PURE__*/ _interop_require_default(require("axios"));
|
|
32
|
-
const _jsyaml = /*#__PURE__*/
|
|
32
|
+
const _jsyaml = /*#__PURE__*/ _interop_require_wildcard(require("js-yaml"));
|
|
33
33
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
34
34
|
const _zod = require("zod");
|
|
35
35
|
function _interop_require_default(obj) {
|
|
@@ -37,132 +37,140 @@ function _interop_require_default(obj) {
|
|
|
37
37
|
default: obj
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
41
|
+
if (typeof WeakMap !== "function") return null;
|
|
42
|
+
var cacheBabelInterop = new WeakMap();
|
|
43
|
+
var cacheNodeInterop = new WeakMap();
|
|
44
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
45
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
46
|
+
})(nodeInterop);
|
|
47
|
+
}
|
|
48
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
49
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
50
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
|
|
51
|
+
default: obj
|
|
52
|
+
};
|
|
53
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
54
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
55
|
+
var newObj = {
|
|
56
|
+
__proto__: null
|
|
57
|
+
};
|
|
58
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
59
|
+
for(var key in obj){
|
|
60
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
61
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
62
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
63
|
+
else newObj[key] = obj[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
newObj.default = obj;
|
|
67
|
+
if (cache) cache.set(obj, newObj);
|
|
68
|
+
return newObj;
|
|
69
|
+
}
|
|
40
70
|
const zHex = _zod.z.custom((val)=>/^0x\w+$/.test(val));
|
|
41
71
|
const zHash = _zod.z.string().length(66).and(zHex);
|
|
72
|
+
const ipAddress = _zod.z.union([
|
|
73
|
+
_zod.z.ipv4(),
|
|
74
|
+
_zod.z.ipv6()
|
|
75
|
+
]);
|
|
42
76
|
const configSchema = _zod.z.object({
|
|
43
77
|
addr: _zod.z.union([
|
|
44
78
|
_zod.z.literal('localhost'),
|
|
45
|
-
|
|
79
|
+
ipAddress
|
|
46
80
|
]).optional(),
|
|
47
81
|
host: _zod.z.union([
|
|
48
82
|
_zod.z.literal('localhost'),
|
|
49
|
-
|
|
50
|
-
],
|
|
51
|
-
|
|
52
|
-
}).optional(),
|
|
53
|
-
port: _zod.z.number({
|
|
54
|
-
description: 'Server listening port'
|
|
55
|
-
}).default(8000),
|
|
83
|
+
ipAddress
|
|
84
|
+
]).describe('Server listening interface').optional(),
|
|
85
|
+
port: _zod.z.number().describe('Server listening port').default(8000),
|
|
56
86
|
endpoint: _zod.z.union([
|
|
57
87
|
_zod.z.string(),
|
|
58
88
|
_zod.z.array(_zod.z.string())
|
|
59
|
-
],
|
|
60
|
-
description: 'Endpoint to connect to'
|
|
61
|
-
}).optional(),
|
|
89
|
+
]).describe('Endpoint to connect to').optional(),
|
|
62
90
|
block: _zod.z.union([
|
|
63
91
|
_zod.z.string(),
|
|
64
92
|
_zod.z.number().max(Number.MAX_SAFE_INTEGER, 'Number is too big, please make it a string if you are using a hex string'),
|
|
65
93
|
_zod.z.null()
|
|
66
|
-
],
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
'build-block-mode': _zod.z.nativeEnum(_chopstickscore.BuildBlockMode).default(_chopstickscore.BuildBlockMode.Batch),
|
|
70
|
-
'import-storage': _zod.z.any({
|
|
71
|
-
description: 'Pre-defined JSON/YAML storage file path'
|
|
72
|
-
}).optional(),
|
|
94
|
+
]).describe('Block hash or block number. Default to latest block').optional(),
|
|
95
|
+
'build-block-mode': _zod.z.enum(_chopstickscore.BuildBlockMode).default(_chopstickscore.BuildBlockMode.Batch),
|
|
96
|
+
'import-storage': _zod.z.any().describe('Pre-defined JSON/YAML storage file path').optional(),
|
|
73
97
|
'allow-unresolved-imports': _zod.z.boolean().optional(),
|
|
74
|
-
'mock-signature-host': _zod.z.boolean(
|
|
75
|
-
description: 'Mock signature host so any signature starts with 0xdeadbeef and filled by 0xcd is considered valid'
|
|
76
|
-
}).optional(),
|
|
98
|
+
'mock-signature-host': _zod.z.boolean().describe('Mock signature host so any signature starts with 0xdeadbeef and filled by 0xcd is considered valid').optional(),
|
|
77
99
|
'max-memory-block-count': _zod.z.number().optional(),
|
|
78
|
-
db: _zod.z.string(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
'save-blocks': _zod.z.boolean({
|
|
82
|
-
description: 'Save blocks to database. Default to true.'
|
|
83
|
-
}).optional(),
|
|
84
|
-
'wasm-override': _zod.z.string({
|
|
85
|
-
description: 'Path to wasm override'
|
|
86
|
-
}).optional(),
|
|
100
|
+
db: _zod.z.string().describe('Path to database').optional(),
|
|
101
|
+
'save-blocks': _zod.z.boolean().describe('Save blocks to database. Default to true.').optional(),
|
|
102
|
+
'wasm-override': _zod.z.string().describe('Path to wasm override').optional(),
|
|
87
103
|
genesis: _zod.z.union([
|
|
88
104
|
_zod.z.string(),
|
|
89
105
|
_chopstickscore.genesisSchema
|
|
90
|
-
],
|
|
91
|
-
description: 'Alias to `chain-spec`. URL to chain spec file. NOTE: Only parachains with AURA consensus are supported!'
|
|
92
|
-
}).optional(),
|
|
106
|
+
]).describe('Alias to `chain-spec`. URL to chain spec file. NOTE: Only parachains with AURA consensus are supported!').optional(),
|
|
93
107
|
'chain-spec': _zod.z.union([
|
|
94
108
|
_zod.z.string(),
|
|
95
109
|
_chopstickscore.genesisSchema
|
|
96
|
-
],
|
|
97
|
-
description: 'URL to chain spec file. NOTE: Only parachains with AURA consensus are supported!'
|
|
98
|
-
}).optional(),
|
|
110
|
+
]).describe('URL to chain spec file. NOTE: Only parachains with AURA consensus are supported!').optional(),
|
|
99
111
|
timestamp: _zod.z.number().optional(),
|
|
100
112
|
'registered-types': _zod.z.any().optional(),
|
|
101
|
-
'runtime-log-level': _zod.z.number(
|
|
102
|
-
|
|
103
|
-
}).min(0).max(5).optional(),
|
|
104
|
-
'offchain-worker': _zod.z.boolean({
|
|
105
|
-
description: 'Enable offchain worker'
|
|
106
|
-
}).optional(),
|
|
113
|
+
'runtime-log-level': _zod.z.number().describe('Runtime maximum log level [off = 0; error = 1; warn = 2; info = 3; debug = 4; trace = 5]').min(0).max(5).optional(),
|
|
114
|
+
'offchain-worker': _zod.z.boolean().describe('Enable offchain worker').optional(),
|
|
107
115
|
resume: _zod.z.union([
|
|
108
116
|
zHash,
|
|
109
117
|
_zod.z.number(),
|
|
110
118
|
_zod.z.boolean()
|
|
111
|
-
],
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
'
|
|
115
|
-
description: 'Produce extra block when queued messages are detected. Default to true. Set to false to disable it.'
|
|
116
|
-
}).optional(),
|
|
117
|
-
'prefetch-storages': _zod.z.any({
|
|
118
|
-
description: 'Storage key prefixes config for fetching storage, useful for testing big migrations, see README for examples'
|
|
119
|
-
}).optional(),
|
|
120
|
-
'rpc-timeout': _zod.z.number({
|
|
121
|
-
description: 'RPC timeout in milliseconds'
|
|
122
|
-
}).optional()
|
|
119
|
+
]).describe('Resume from the specified block hash or block number in db. If true, it will resume from the latest block in db. Note this will override the block option').optional(),
|
|
120
|
+
'process-queued-messages': _zod.z.boolean().describe('Produce extra block when queued messages are detected. Default to true. Set to false to disable it.').optional(),
|
|
121
|
+
'prefetch-storages': _zod.z.any().describe('Storage key prefixes config for fetching storage, useful for testing big migrations, see README for examples').optional(),
|
|
122
|
+
'rpc-timeout': _zod.z.number().describe('RPC timeout in milliseconds').optional()
|
|
123
123
|
});
|
|
124
|
+
const unwrapOption = (option)=>{
|
|
125
|
+
if ([
|
|
126
|
+
'optional',
|
|
127
|
+
'nullable',
|
|
128
|
+
'default'
|
|
129
|
+
].includes(option.def.type)) return unwrapOption(option.def.innerType);
|
|
130
|
+
return option;
|
|
131
|
+
};
|
|
124
132
|
const getZodType = (option)=>{
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
option = unwrapOption(option);
|
|
134
|
+
switch(option.def.type){
|
|
135
|
+
case 'string':
|
|
127
136
|
return 'string';
|
|
128
|
-
case '
|
|
137
|
+
case 'number':
|
|
129
138
|
return 'number';
|
|
130
|
-
case '
|
|
139
|
+
case 'boolean':
|
|
131
140
|
return 'boolean';
|
|
132
141
|
default:
|
|
133
142
|
break;
|
|
134
143
|
}
|
|
135
|
-
if (option.
|
|
136
|
-
return
|
|
144
|
+
if (option.def.type === 'union') {
|
|
145
|
+
return getZodFirstOption(option);
|
|
146
|
+
}
|
|
147
|
+
if (option.def.type === 'intersection') {
|
|
148
|
+
return getZodType(option.def.left);
|
|
137
149
|
}
|
|
138
150
|
return undefined;
|
|
139
151
|
};
|
|
140
152
|
const getZodChoices = (option)=>{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (option._def.innerType) {
|
|
145
|
-
return getZodChoices(option._def.innerType);
|
|
153
|
+
option = unwrapOption(option);
|
|
154
|
+
if (option.def.type === 'enum') {
|
|
155
|
+
return Object.values(option.def.entries).filter((x)=>typeof x === 'string');
|
|
146
156
|
}
|
|
147
157
|
return undefined;
|
|
148
158
|
};
|
|
149
159
|
const getZodFirstOption = (option)=>{
|
|
150
|
-
|
|
160
|
+
option = unwrapOption(option);
|
|
161
|
+
const options = option.def.type === 'union' ? option.def.options : undefined;
|
|
151
162
|
if (options) {
|
|
152
163
|
for (const option of options){
|
|
153
164
|
const type = getZodType(option);
|
|
154
165
|
if (type) return type;
|
|
155
166
|
}
|
|
156
167
|
}
|
|
157
|
-
if (option._def.innerType) {
|
|
158
|
-
return getZodFirstOption(option._def.innerType);
|
|
159
|
-
}
|
|
160
168
|
return undefined;
|
|
161
169
|
};
|
|
162
170
|
const getYargsOptions = (zodShape)=>{
|
|
163
171
|
return _lodash.default.mapValues(zodShape, (option)=>({
|
|
164
172
|
demandOption: !option.isOptional(),
|
|
165
|
-
description: option.
|
|
173
|
+
description: unwrapOption(option).description,
|
|
166
174
|
type: getZodType(option) || getZodFirstOption(option),
|
|
167
175
|
choices: getZodChoices(option)
|
|
168
176
|
}));
|
|
@@ -193,7 +201,7 @@ const fetchConfig = async (path)=>{
|
|
|
193
201
|
}
|
|
194
202
|
}
|
|
195
203
|
}
|
|
196
|
-
const config = _jsyaml.
|
|
204
|
+
const config = _jsyaml.load(_lodash.default.template(file, {
|
|
197
205
|
variable: 'env'
|
|
198
206
|
})(process.env));
|
|
199
207
|
return configSchema.strict().parse(config);
|
package/dist/cjs/types.js
CHANGED
|
@@ -44,18 +44,12 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
44
44
|
})(nodeInterop);
|
|
45
45
|
}
|
|
46
46
|
function _interop_require_wildcard(obj, nodeInterop) {
|
|
47
|
-
if (!nodeInterop && obj && obj.__esModule)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
default: obj
|
|
53
|
-
};
|
|
54
|
-
}
|
|
47
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
48
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
|
|
49
|
+
default: obj
|
|
50
|
+
};
|
|
55
51
|
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
-
if (cache && cache.has(obj))
|
|
57
|
-
return cache.get(obj);
|
|
58
|
-
}
|
|
52
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
59
53
|
var newObj = {
|
|
60
54
|
__proto__: null
|
|
61
55
|
};
|
|
@@ -63,16 +57,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
63
57
|
for(var key in obj){
|
|
64
58
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
59
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
-
if (desc && (desc.get || desc.set))
|
|
67
|
-
|
|
68
|
-
} else {
|
|
69
|
-
newObj[key] = obj[key];
|
|
70
|
-
}
|
|
60
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
61
|
+
else newObj[key] = obj[key];
|
|
71
62
|
}
|
|
72
63
|
}
|
|
73
64
|
newObj.default = obj;
|
|
74
|
-
if (cache)
|
|
75
|
-
cache.set(obj, newObj);
|
|
76
|
-
}
|
|
65
|
+
if (cache) cache.set(obj, newObj);
|
|
77
66
|
return newObj;
|
|
78
67
|
}
|
|
@@ -20,18 +20,12 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
20
20
|
})(nodeInterop);
|
|
21
21
|
}
|
|
22
22
|
function _interop_require_wildcard(obj, nodeInterop) {
|
|
23
|
-
if (!nodeInterop && obj && obj.__esModule)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
default: obj
|
|
29
|
-
};
|
|
30
|
-
}
|
|
23
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
24
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
|
|
25
|
+
default: obj
|
|
26
|
+
};
|
|
31
27
|
var cache = _getRequireWildcardCache(nodeInterop);
|
|
32
|
-
if (cache && cache.has(obj))
|
|
33
|
-
return cache.get(obj);
|
|
34
|
-
}
|
|
28
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
35
29
|
var newObj = {
|
|
36
30
|
__proto__: null
|
|
37
31
|
};
|
|
@@ -39,17 +33,12 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
39
33
|
for(var key in obj){
|
|
40
34
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
41
35
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
42
|
-
if (desc && (desc.get || desc.set))
|
|
43
|
-
|
|
44
|
-
} else {
|
|
45
|
-
newObj[key] = obj[key];
|
|
46
|
-
}
|
|
36
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
37
|
+
else newObj[key] = obj[key];
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
newObj.default = obj;
|
|
50
|
-
if (cache)
|
|
51
|
-
cache.set(obj, newObj);
|
|
52
|
-
}
|
|
41
|
+
if (cache) cache.set(obj, newObj);
|
|
53
42
|
return newObj;
|
|
54
43
|
}
|
|
55
44
|
const api = {
|
|
@@ -19,13 +19,43 @@ _export(exports, {
|
|
|
19
19
|
const _nodefs = require("node:fs");
|
|
20
20
|
const _chopstickscore = require("@acala-network/chopsticks-core");
|
|
21
21
|
const _axios = /*#__PURE__*/ _interop_require_default(require("axios"));
|
|
22
|
-
const _jsyaml = /*#__PURE__*/
|
|
22
|
+
const _jsyaml = /*#__PURE__*/ _interop_require_wildcard(require("js-yaml"));
|
|
23
23
|
const _logger = require("../logger.js");
|
|
24
24
|
function _interop_require_default(obj) {
|
|
25
25
|
return obj && obj.__esModule ? obj : {
|
|
26
26
|
default: obj
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
30
|
+
if (typeof WeakMap !== "function") return null;
|
|
31
|
+
var cacheBabelInterop = new WeakMap();
|
|
32
|
+
var cacheNodeInterop = new WeakMap();
|
|
33
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
34
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
35
|
+
})(nodeInterop);
|
|
36
|
+
}
|
|
37
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
38
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
39
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
|
|
40
|
+
default: obj
|
|
41
|
+
};
|
|
42
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
43
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
44
|
+
var newObj = {
|
|
45
|
+
__proto__: null
|
|
46
|
+
};
|
|
47
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
48
|
+
for(var key in obj){
|
|
49
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
50
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
51
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
52
|
+
else newObj[key] = obj[key];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
newObj.default = obj;
|
|
56
|
+
if (cache) cache.set(obj, newObj);
|
|
57
|
+
return newObj;
|
|
58
|
+
}
|
|
29
59
|
const overrideStorage = async (chain, storage, at)=>{
|
|
30
60
|
if (storage == null) {
|
|
31
61
|
return;
|
|
@@ -33,7 +63,7 @@ const overrideStorage = async (chain, storage, at)=>{
|
|
|
33
63
|
let storageValue;
|
|
34
64
|
if (typeof storage === 'string') {
|
|
35
65
|
if (!(0, _nodefs.existsSync)(storage)) throw Error(`File ${storage} does not exist`);
|
|
36
|
-
storageValue = _jsyaml.
|
|
66
|
+
storageValue = _jsyaml.load(String((0, _nodefs.readFileSync)(storage)));
|
|
37
67
|
} else {
|
|
38
68
|
storageValue = storage;
|
|
39
69
|
}
|
package/dist/esm/bridge.js
CHANGED
|
@@ -196,6 +196,7 @@ const importParaHead = (api, pallet, paraId, headHashHex, blockNumber, stateRoot
|
|
|
196
196
|
if (generatedNonce <= delivered) return; // nothing new to deliver
|
|
197
197
|
const from = delivered + 1n;
|
|
198
198
|
const lastInChunk = from + MAX_MESSAGES_PER_PROOF - 1n;
|
|
199
|
+
// biome-ignore lint/complexity/useMathMinMax: Math.min does not accept bigint values.
|
|
199
200
|
const to = lastInChunk < generatedNonce ? lastInChunk : generatedNonce;
|
|
200
201
|
await deliverRange(laneHex, from, to, sourceHash, sourceNumber);
|
|
201
202
|
inFlight.set(laneHex, to);
|