1 |
|
2 |
|
3 | import { l } from "./logging.js";
|
4 | export function filterEvents(txHash, {
|
5 | block: {
|
6 | extrinsics,
|
7 | header
|
8 | }
|
9 | }, allEvents, status) {
|
10 |
|
11 | for (const [txIndex, x] of extrinsics.entries()) {
|
12 | if (x.hash.eq(txHash)) {
|
13 | return {
|
14 | events: allEvents.filter(({
|
15 | phase
|
16 | }) => phase.isApplyExtrinsic && phase.asApplyExtrinsic.eqn(txIndex)),
|
17 | txIndex
|
18 | };
|
19 | }
|
20 | }
|
21 |
|
22 |
|
23 |
|
24 | if (status.isInBlock) {
|
25 | const allHashes = extrinsics.map(x => x.hash.toHex());
|
26 | l.warn(`block ${header.hash.toHex()}: Unable to find extrinsic ${txHash.toHex()} inside ${allHashes.join(', ')}`);
|
27 | }
|
28 |
|
29 | return {};
|
30 | } |
\ | No newline at end of file |