@acala-network/chopsticks 0.9.6-2 → 0.9.6-3
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/plugins/dry-run/cli.js +1 -1
- package/dist/cjs/plugins/dry-run/dry-run-extrinsic.js +3 -0
- package/dist/cjs/plugins/dry-run/index.d.ts +3 -3
- package/dist/cjs/plugins/dry-run/index.js +1 -1
- package/dist/cjs/plugins/run-block/__snapshots__/index.test.ts.snap +2872 -162
- package/dist/cjs/plugins/run-block/rpc.d.ts +2 -0
- package/dist/cjs/plugins/run-block/rpc.js +15 -3
- package/dist/cjs/schema/index.js +3 -1
- package/dist/cjs/setup-with-server.js +0 -4
- package/dist/esm/plugins/dry-run/cli.js +1 -1
- package/dist/esm/plugins/dry-run/dry-run-extrinsic.js +3 -0
- package/dist/esm/plugins/dry-run/index.d.ts +3 -3
- package/dist/esm/plugins/dry-run/index.js +1 -1
- package/dist/esm/plugins/run-block/__snapshots__/index.test.ts.snap +2872 -162
- package/dist/esm/plugins/run-block/rpc.d.ts +2 -0
- package/dist/esm/plugins/run-block/rpc.js +15 -3
- package/dist/esm/schema/index.js +3 -1
- package/dist/esm/setup-with-server.js +0 -4
- package/package.json +3 -3
|
@@ -114,6 +114,7 @@ export interface RunBlockResponse {
|
|
|
114
114
|
section: string;
|
|
115
115
|
method: string;
|
|
116
116
|
args: any[];
|
|
117
|
+
argObj: Record<string, any>;
|
|
117
118
|
}[];
|
|
118
119
|
/**
|
|
119
120
|
* Parsed extrinsics in this block.
|
|
@@ -122,6 +123,7 @@ export interface RunBlockResponse {
|
|
|
122
123
|
section: string;
|
|
123
124
|
method: string;
|
|
124
125
|
args: any[];
|
|
126
|
+
argObj: Record<string, any>;
|
|
125
127
|
success: boolean;
|
|
126
128
|
signer: string | null;
|
|
127
129
|
}[];
|
|
@@ -128,12 +128,20 @@ export const name = 'runBlock';
|
|
|
128
128
|
const registry = await newBlock.registry;
|
|
129
129
|
const timestamp = await newBlock.read('u64', meta.query.timestamp.now);
|
|
130
130
|
const events = await newBlock.read('Vec<EventRecord>', meta.query.system.events);
|
|
131
|
-
const parsedEvents = events?.map((event)=>
|
|
131
|
+
const parsedEvents = events?.map((event)=>{
|
|
132
|
+
const argObj = {};
|
|
133
|
+
const len = event.event.data.names?.length ?? 0;
|
|
134
|
+
for(let i = 0; i < len; i++){
|
|
135
|
+
argObj[event.event.data.names[i]] = event.event.data[i].toJSON();
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
132
138
|
phase: event.phase.isApplyExtrinsic ? event.phase.asApplyExtrinsic.toNumber() : event.phase.toString(),
|
|
133
139
|
section: event.event.section,
|
|
134
140
|
method: event.event.method,
|
|
135
|
-
args: event.event.data.map((arg)=>arg.toJSON())
|
|
136
|
-
|
|
141
|
+
args: event.event.data.map((arg)=>arg.toJSON()),
|
|
142
|
+
argObj
|
|
143
|
+
};
|
|
144
|
+
});
|
|
137
145
|
const extrinsics = block.extrinsics.map((extrinsic, idx)=>{
|
|
138
146
|
const parsed = registry.createType('GenericExtrinsic', extrinsic);
|
|
139
147
|
const resultEvent = events?.find(({ event, phase })=>event.section === 'system' && (event.method === 'ExtrinsicSuccess' || event.method === 'ExtrinsicFailed') && phase.isApplyExtrinsic && phase.asApplyExtrinsic.eq(idx));
|
|
@@ -142,6 +150,10 @@ export const name = 'runBlock';
|
|
|
142
150
|
section: parsed.method.section,
|
|
143
151
|
method: parsed.method.method,
|
|
144
152
|
args: parsed.method.args.map((arg)=>arg.toJSON()),
|
|
153
|
+
argObj: parsed.method?.argsEntries ? Object.fromEntries(parsed.method.argsEntries.map(([key, value])=>[
|
|
154
|
+
key,
|
|
155
|
+
value.toJSON()
|
|
156
|
+
])) : {},
|
|
145
157
|
success: resultEvent?.event.method === 'ExtrinsicSuccess',
|
|
146
158
|
signer
|
|
147
159
|
};
|
package/dist/esm/schema/index.js
CHANGED
|
@@ -42,7 +42,9 @@ export const configSchema = z.object({
|
|
|
42
42
|
genesis: z.union([
|
|
43
43
|
z.string(),
|
|
44
44
|
genesisSchema
|
|
45
|
-
]
|
|
45
|
+
], {
|
|
46
|
+
description: 'URL to genesis config file. NOTE: Only parachains with AURA consensus are supported!'
|
|
47
|
+
}).optional(),
|
|
46
48
|
timestamp: z.number().optional(),
|
|
47
49
|
'registered-types': z.any().optional(),
|
|
48
50
|
'runtime-log-level': z.number({
|
|
@@ -4,10 +4,6 @@ import { handler } from './rpc/index.js';
|
|
|
4
4
|
import { setupContext } from './context.js';
|
|
5
5
|
export const setupWithServer = async (argv)=>{
|
|
6
6
|
const context = await setupContext(argv);
|
|
7
|
-
if (argv.genesis) {
|
|
8
|
-
// mine 1st block when starting from genesis to set some mock validation data
|
|
9
|
-
await context.chain.newBlock();
|
|
10
|
-
}
|
|
11
7
|
const { close, port: listenPort } = await createServer(handler(context), argv.port);
|
|
12
8
|
defaultLogger.info(`${await context.chain.api.getSystemChain()} RPC listening on port ${listenPort}`);
|
|
13
9
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks",
|
|
3
|
-
"version": "0.9.6-
|
|
3
|
+
"version": "0.9.6-3",
|
|
4
4
|
"author": "Acala Developers <hello@acala.network>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": "./chopsticks.cjs",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"docs:prep": "typedoc"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@acala-network/chopsticks-core": "0.9.6-
|
|
17
|
-
"@acala-network/chopsticks-db": "0.9.6-
|
|
16
|
+
"@acala-network/chopsticks-core": "0.9.6-3",
|
|
17
|
+
"@acala-network/chopsticks-db": "0.9.6-3",
|
|
18
18
|
"@pnpm/npm-conf": "^2.2.2",
|
|
19
19
|
"@polkadot/api-augment": "^10.10.1",
|
|
20
20
|
"@polkadot/types": "^10.10.1",
|