@acala-network/chopsticks-core 1.2.4 → 1.2.7
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/blockchain/block-builder.js +6 -2
- package/dist/cjs/blockchain/storage-layer.js +3 -1
- package/dist/cjs/chopsticks-provider.js +17 -9
- package/dist/cjs/logger.d.ts +1 -2
- package/dist/cjs/rpc/shared.d.ts +1 -1
- package/dist/cjs/xcm/index.d.ts +1 -1
- package/dist/esm/blockchain/block-builder.js +6 -2
- package/dist/esm/blockchain/storage-layer.js +3 -1
- package/dist/esm/chopsticks-provider.js +17 -9
- package/dist/esm/logger.d.ts +1 -2
- package/dist/esm/rpc/shared.d.ts +1 -1
- package/dist/esm/xcm/index.d.ts +1 -1
- package/package.json +6 -6
|
@@ -196,7 +196,9 @@ const initNewBlock = async (head, header, inherentProviders, params, storageLaye
|
|
|
196
196
|
inherents.push(...extrinsics);
|
|
197
197
|
callback?.onPhaseApplied?.(layers.length - 1, resp);
|
|
198
198
|
} catch (e) {
|
|
199
|
-
logger.warn(
|
|
199
|
+
logger.warn({
|
|
200
|
+
err: e
|
|
201
|
+
}, 'Failed to apply inherents');
|
|
200
202
|
throw new Error('Failed to apply inherents');
|
|
201
203
|
}
|
|
202
204
|
}
|
|
@@ -322,7 +324,9 @@ const buildBlock = async (head, inherentProviders, params, callbacks)=>{
|
|
|
322
324
|
includedExtrinsic.push(extrinsic);
|
|
323
325
|
callbacks?.onPhaseApplied?.(includedExtrinsic.length - 1, resp);
|
|
324
326
|
} catch (e) {
|
|
325
|
-
logger.info(
|
|
327
|
+
logger.info({
|
|
328
|
+
err: e
|
|
329
|
+
}, 'Failed to apply extrinsic');
|
|
326
330
|
pendingExtrinsics.push(extrinsic);
|
|
327
331
|
}
|
|
328
332
|
}
|
|
@@ -144,7 +144,9 @@ class RemoteStorageLayer {
|
|
|
144
144
|
blockHash: _class_private_field_get(this, _at)
|
|
145
145
|
})));
|
|
146
146
|
} else if (_class_private_field_get(this, _db)) {
|
|
147
|
-
data.forEach(([key, value])=>
|
|
147
|
+
data.forEach(([key, value])=>{
|
|
148
|
+
_class_private_field_get(this, _db)?.saveStorage(_class_private_field_get(this, _at), key, value);
|
|
149
|
+
});
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
return result;
|
|
@@ -156,7 +156,11 @@ class ChopsticksProvider {
|
|
|
156
156
|
sub.onCancel = onCancel;
|
|
157
157
|
}
|
|
158
158
|
return (data)=>{
|
|
159
|
-
logger.debug(
|
|
159
|
+
logger.debug({
|
|
160
|
+
method,
|
|
161
|
+
subid,
|
|
162
|
+
data
|
|
163
|
+
}, 'subscribe-callback');
|
|
160
164
|
const sub = _class_private_field_get(this, _subscriptions)[subid];
|
|
161
165
|
if (sub) {
|
|
162
166
|
sub.callback(null, data);
|
|
@@ -166,7 +170,9 @@ class ChopsticksProvider {
|
|
|
166
170
|
};
|
|
167
171
|
},
|
|
168
172
|
unsubscribe: (subid)=>{
|
|
169
|
-
logger.debug(
|
|
173
|
+
logger.debug({
|
|
174
|
+
subid
|
|
175
|
+
}, 'unsubscribe-callback');
|
|
170
176
|
const sub = _class_private_field_get(this, _subscriptions)[subid];
|
|
171
177
|
if (sub) {
|
|
172
178
|
sub.onCancel?.();
|
|
@@ -178,20 +184,20 @@ class ChopsticksProvider {
|
|
|
178
184
|
};
|
|
179
185
|
this.send = async (method, params, _isCacheable, subscription)=>{
|
|
180
186
|
try {
|
|
181
|
-
logger.debug(
|
|
187
|
+
logger.debug({
|
|
182
188
|
method,
|
|
183
189
|
params
|
|
184
|
-
});
|
|
190
|
+
}, 'send');
|
|
185
191
|
const rpcHandler = providerHandlers[method];
|
|
186
192
|
if (!rpcHandler) {
|
|
187
193
|
logger.error(`Unable to find rpc handler=${method}`);
|
|
188
194
|
throw new Error(`Unable to find rpc handler=${method}`);
|
|
189
195
|
}
|
|
190
196
|
if (subscription) {
|
|
191
|
-
logger.debug(
|
|
197
|
+
logger.debug({
|
|
192
198
|
method,
|
|
193
199
|
params
|
|
194
|
-
});
|
|
200
|
+
}, 'subscribe');
|
|
195
201
|
const subid = await rpcHandler({
|
|
196
202
|
chain: this.chain
|
|
197
203
|
}, params, this.subscriptionManager);
|
|
@@ -206,15 +212,17 @@ class ChopsticksProvider {
|
|
|
206
212
|
};
|
|
207
213
|
return subid;
|
|
208
214
|
}
|
|
209
|
-
logger.debug(
|
|
215
|
+
logger.debug({
|
|
210
216
|
method,
|
|
211
217
|
params
|
|
212
|
-
});
|
|
218
|
+
}, 'call');
|
|
213
219
|
return rpcHandler({
|
|
214
220
|
chain: this.chain
|
|
215
221
|
}, params, this.subscriptionManager);
|
|
216
222
|
} catch (e) {
|
|
217
|
-
logger.error(
|
|
223
|
+
logger.error({
|
|
224
|
+
err: e
|
|
225
|
+
}, 'send error');
|
|
218
226
|
throw e;
|
|
219
227
|
}
|
|
220
228
|
};
|
package/dist/cjs/logger.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { pino } from 'pino';
|
|
2
1
|
export declare const pinoLogger: import("pino").Logger<never, boolean>;
|
|
3
|
-
export declare const defaultLogger: pino.Logger<never, boolean>;
|
|
2
|
+
export declare const defaultLogger: import("pino").Logger<never, boolean>;
|
|
4
3
|
export declare const truncate: (val: any) => any;
|
package/dist/cjs/rpc/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Blockchain } from '../blockchain/index.js';
|
|
3
|
-
export declare const logger: import("pino").
|
|
3
|
+
export declare const logger: import("pino").Logger<never, boolean>;
|
|
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 class ResponseError extends Error {
|
package/dist/cjs/xcm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Blockchain } from '../blockchain/index.js';
|
|
2
|
-
export declare const xcmLogger: import("pino").
|
|
2
|
+
export declare const xcmLogger: import("pino").Logger<never, boolean>;
|
|
3
3
|
export declare const connectVertical: (relaychain: Blockchain, parachain: Blockchain) => Promise<void>;
|
|
4
4
|
export declare const connectParachains: (parachains: Blockchain[], disableAutoHrmp?: boolean) => Promise<void>;
|
|
@@ -172,7 +172,9 @@ const initNewBlock = async (head, header, inherentProviders, params, storageLaye
|
|
|
172
172
|
inherents.push(...extrinsics);
|
|
173
173
|
callback?.onPhaseApplied?.(layers.length - 1, resp);
|
|
174
174
|
} catch (e) {
|
|
175
|
-
logger.warn(
|
|
175
|
+
logger.warn({
|
|
176
|
+
err: e
|
|
177
|
+
}, 'Failed to apply inherents');
|
|
176
178
|
throw new Error('Failed to apply inherents');
|
|
177
179
|
}
|
|
178
180
|
}
|
|
@@ -298,7 +300,9 @@ export const buildBlock = async (head, inherentProviders, params, callbacks)=>{
|
|
|
298
300
|
includedExtrinsic.push(extrinsic);
|
|
299
301
|
callbacks?.onPhaseApplied?.(includedExtrinsic.length - 1, resp);
|
|
300
302
|
} catch (e) {
|
|
301
|
-
logger.info(
|
|
303
|
+
logger.info({
|
|
304
|
+
err: e
|
|
305
|
+
}, 'Failed to apply extrinsic');
|
|
302
306
|
pendingExtrinsics.push(extrinsic);
|
|
303
307
|
}
|
|
304
308
|
}
|
|
@@ -77,7 +77,9 @@ export class RemoteStorageLayer {
|
|
|
77
77
|
blockHash: this.#at
|
|
78
78
|
})));
|
|
79
79
|
} else if (this.#db) {
|
|
80
|
-
data.forEach(([key, value])=>
|
|
80
|
+
data.forEach(([key, value])=>{
|
|
81
|
+
this.#db?.saveStorage(this.#at, key, value);
|
|
82
|
+
});
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
return result;
|
|
@@ -68,7 +68,11 @@ const logger = defaultLogger.child({
|
|
|
68
68
|
sub.onCancel = onCancel;
|
|
69
69
|
}
|
|
70
70
|
return (data)=>{
|
|
71
|
-
logger.debug(
|
|
71
|
+
logger.debug({
|
|
72
|
+
method,
|
|
73
|
+
subid,
|
|
74
|
+
data
|
|
75
|
+
}, 'subscribe-callback');
|
|
72
76
|
const sub = this.#subscriptions[subid];
|
|
73
77
|
if (sub) {
|
|
74
78
|
sub.callback(null, data);
|
|
@@ -78,7 +82,9 @@ const logger = defaultLogger.child({
|
|
|
78
82
|
};
|
|
79
83
|
},
|
|
80
84
|
unsubscribe: (subid)=>{
|
|
81
|
-
logger.debug(
|
|
85
|
+
logger.debug({
|
|
86
|
+
subid
|
|
87
|
+
}, 'unsubscribe-callback');
|
|
82
88
|
const sub = this.#subscriptions[subid];
|
|
83
89
|
if (sub) {
|
|
84
90
|
sub.onCancel?.();
|
|
@@ -90,20 +96,20 @@ const logger = defaultLogger.child({
|
|
|
90
96
|
};
|
|
91
97
|
send = async (method, params, _isCacheable, subscription)=>{
|
|
92
98
|
try {
|
|
93
|
-
logger.debug(
|
|
99
|
+
logger.debug({
|
|
94
100
|
method,
|
|
95
101
|
params
|
|
96
|
-
});
|
|
102
|
+
}, 'send');
|
|
97
103
|
const rpcHandler = providerHandlers[method];
|
|
98
104
|
if (!rpcHandler) {
|
|
99
105
|
logger.error(`Unable to find rpc handler=${method}`);
|
|
100
106
|
throw new Error(`Unable to find rpc handler=${method}`);
|
|
101
107
|
}
|
|
102
108
|
if (subscription) {
|
|
103
|
-
logger.debug(
|
|
109
|
+
logger.debug({
|
|
104
110
|
method,
|
|
105
111
|
params
|
|
106
|
-
});
|
|
112
|
+
}, 'subscribe');
|
|
107
113
|
const subid = await rpcHandler({
|
|
108
114
|
chain: this.chain
|
|
109
115
|
}, params, this.subscriptionManager);
|
|
@@ -118,15 +124,17 @@ const logger = defaultLogger.child({
|
|
|
118
124
|
};
|
|
119
125
|
return subid;
|
|
120
126
|
}
|
|
121
|
-
logger.debug(
|
|
127
|
+
logger.debug({
|
|
122
128
|
method,
|
|
123
129
|
params
|
|
124
|
-
});
|
|
130
|
+
}, 'call');
|
|
125
131
|
return rpcHandler({
|
|
126
132
|
chain: this.chain
|
|
127
133
|
}, params, this.subscriptionManager);
|
|
128
134
|
} catch (e) {
|
|
129
|
-
logger.error(
|
|
135
|
+
logger.error({
|
|
136
|
+
err: e
|
|
137
|
+
}, 'send error');
|
|
130
138
|
throw e;
|
|
131
139
|
}
|
|
132
140
|
};
|
package/dist/esm/logger.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { pino } from 'pino';
|
|
2
1
|
export declare const pinoLogger: import("pino").Logger<never, boolean>;
|
|
3
|
-
export declare const defaultLogger: pino.Logger<never, boolean>;
|
|
2
|
+
export declare const defaultLogger: import("pino").Logger<never, boolean>;
|
|
4
3
|
export declare const truncate: (val: any) => any;
|
package/dist/esm/rpc/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Blockchain } from '../blockchain/index.js';
|
|
3
|
-
export declare const logger: import("pino").
|
|
3
|
+
export declare const logger: import("pino").Logger<never, boolean>;
|
|
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 class ResponseError extends Error {
|
package/dist/esm/xcm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Blockchain } from '../blockchain/index.js';
|
|
2
|
-
export declare const xcmLogger: import("pino").
|
|
2
|
+
export declare const xcmLogger: import("pino").Logger<never, boolean>;
|
|
3
3
|
export declare const connectVertical: (relaychain: Blockchain, parachain: Blockchain) => Promise<void>;
|
|
4
4
|
export declare const connectParachains: (parachains: Blockchain[], disableAutoHrmp?: boolean) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"author": "Acala Developers <hello@acala.network>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"depcheck": "npx depcheck"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@acala-network/chopsticks-executor": "1.2.
|
|
17
|
+
"@acala-network/chopsticks-executor": "1.2.7",
|
|
18
18
|
"@polkadot/rpc-provider": "^16.4.1",
|
|
19
19
|
"@polkadot/types": "^16.4.1",
|
|
20
20
|
"@polkadot/types-codec": "^16.4.1",
|
|
21
21
|
"@polkadot/types-known": "^16.4.1",
|
|
22
|
-
"@polkadot/util": "^
|
|
23
|
-
"@polkadot/util-crypto": "^
|
|
22
|
+
"@polkadot/util": "^14.0.1",
|
|
23
|
+
"@polkadot/util-crypto": "^14.0.1",
|
|
24
24
|
"comlink": "^4.4.2",
|
|
25
25
|
"eventemitter3": "^5.0.1",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"zod": "^3.25.76"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@swc/cli": "0.7.
|
|
34
|
+
"@swc/cli": "0.7.10",
|
|
35
35
|
"@swc/core": "^1.12.14",
|
|
36
36
|
"@types/lodash": "^4.17.20",
|
|
37
37
|
"typescript": "^5.8.3",
|
|
38
|
-
"vitest": "^
|
|
38
|
+
"vitest": "^4.0.18"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist/esm/**",
|