@acala-network/chopsticks 0.9.6-2 → 0.9.6-4

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.
@@ -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,23 @@ 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
+ let argObj = undefined;
133
+ const len = event.event.data.names?.length ?? 0;
134
+ if (len > 0) {
135
+ argObj = {};
136
+ for(let i = 0; i < len; i++){
137
+ argObj[event.event.data.names[i]] = event.event.data[i].toJSON();
138
+ }
139
+ }
140
+ return {
132
141
  phase: event.phase.isApplyExtrinsic ? event.phase.asApplyExtrinsic.toNumber() : event.phase.toString(),
133
142
  section: event.event.section,
134
143
  method: event.event.method,
135
- args: event.event.data.map((arg)=>arg.toJSON())
136
- }));
144
+ args: event.event.data.map((arg)=>arg.toJSON()),
145
+ argObj
146
+ };
147
+ });
137
148
  const extrinsics = block.extrinsics.map((extrinsic, idx)=>{
138
149
  const parsed = registry.createType('GenericExtrinsic', extrinsic);
139
150
  const resultEvent = events?.find(({ event, phase })=>event.section === 'system' && (event.method === 'ExtrinsicSuccess' || event.method === 'ExtrinsicFailed') && phase.isApplyExtrinsic && phase.asApplyExtrinsic.eq(idx));
@@ -142,6 +153,10 @@ export const name = 'runBlock';
142
153
  section: parsed.method.section,
143
154
  method: parsed.method.method,
144
155
  args: parsed.method.args.map((arg)=>arg.toJSON()),
156
+ argObj: parsed.method?.argsEntries ? Object.fromEntries(parsed.method.argsEntries.map(([key, value])=>[
157
+ key,
158
+ value.toJSON()
159
+ ])) : {},
145
160
  success: resultEvent?.event.method === 'ExtrinsicSuccess',
146
161
  signer
147
162
  };
@@ -42,7 +42,9 @@ export const configSchema = z.object({
42
42
  genesis: z.union([
43
43
  z.string(),
44
44
  genesisSchema
45
- ]).optional(),
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-2",
3
+ "version": "0.9.6-4",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "bin": "./chopsticks.cjs",
@@ -13,14 +13,14 @@
13
13
  "docs:prep": "typedoc"
14
14
  },
15
15
  "dependencies": {
16
- "@acala-network/chopsticks-core": "0.9.6-2",
17
- "@acala-network/chopsticks-db": "0.9.6-2",
16
+ "@acala-network/chopsticks-core": "0.9.6-4",
17
+ "@acala-network/chopsticks-db": "0.9.6-4",
18
18
  "@pnpm/npm-conf": "^2.2.2",
19
19
  "@polkadot/api-augment": "^10.10.1",
20
20
  "@polkadot/types": "^10.10.1",
21
21
  "@polkadot/util": "^12.5.1",
22
22
  "@polkadot/util-crypto": "^12.5.1",
23
- "axios": "^1.6.2",
23
+ "axios": "^1.6.3",
24
24
  "dotenv": "^16.3.1",
25
25
  "global-agent": "^3.0.0",
26
26
  "js-yaml": "^4.1.0",