1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.filterEvents = filterEvents;
|
7 |
|
8 | var _logging = require("./logging");
|
9 |
|
10 |
|
11 |
|
12 | function filterEvents(txHash, _ref, allEvents, status) {
|
13 | let {
|
14 | block: {
|
15 | extrinsics,
|
16 | header
|
17 | }
|
18 | } = _ref;
|
19 |
|
20 |
|
21 | for (const [txIndex, x] of extrinsics.entries()) {
|
22 | if (x.hash.eq(txHash)) {
|
23 | return {
|
24 | events: allEvents.filter(_ref2 => {
|
25 | let {
|
26 | phase
|
27 | } = _ref2;
|
28 | return phase.isApplyExtrinsic && phase.asApplyExtrinsic.eqn(txIndex);
|
29 | }),
|
30 | txIndex
|
31 | };
|
32 | }
|
33 | }
|
34 |
|
35 |
|
36 |
|
37 | if (status.isInBlock) {
|
38 | const allHashes = extrinsics.map(x => x.hash.toHex());
|
39 |
|
40 | _logging.l.warn(`block ${header.hash.toHex()}: Unable to find extrinsic ${txHash.toHex()} inside ${allHashes.join(', ')}`);
|
41 | }
|
42 |
|
43 | return {};
|
44 | } |
\ | No newline at end of file |