Skip to content

Commit 250fd85

Browse files
committed
Indexer fix toJson
1 parent db81cba commit 250fd85

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

packages/indexer/src/tasks/IndexBlockTaskParameters.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,33 @@ export class IndexBlockTaskParametersSerializer {
2424

2525
public toJSON(parameters: IndexBlockTaskParameters): string {
2626
return JSON.stringify({
27-
block: this.blockMapper.mapOut(parameters.block),
28-
transactions: parameters.block.transactions.map((tx) =>
29-
this.transactionResultMapper.mapOut(tx)
30-
),
31-
result: this.blockResultMapper.mapOut(parameters.result),
27+
block: {
28+
...this.blockMapper.mapOut(parameters.block),
29+
beforeBlockStateTransitions:
30+
parameters.block.beforeBlockStateTransitions.map((st) =>
31+
this.stateTransitionMapper.mapOut(st)
32+
),
33+
},
34+
transactions: parameters.block.transactions.map((tx) => {
35+
const txMap = this.transactionResultMapper.mapOut(tx);
36+
const stBatches = this.stateTransitionBatchMapper.mapOut(
37+
tx.stateTransitions
38+
);
39+
return {
40+
...txMap,
41+
stateTransitionBatch: stBatches.map(([batch, sts]) => ({
42+
applied: batch.applied,
43+
stateTransitions: sts,
44+
})),
45+
};
46+
}),
47+
result: {
48+
...this.blockResultMapper.mapOut(parameters.result),
49+
afterBlockStateTransitions:
50+
parameters.result.afterBlockStateTransitions.map((st) =>
51+
this.stateTransitionMapper.mapOut(st)
52+
),
53+
},
3254
});
3355
}
3456

0 commit comments

Comments
 (0)