MCPcopy Create free account
hub / github.com/subquery/subql / wrapEvents

Function wrapEvents

packages/node/src/utils/substrate.ts:157–171  ·  view source on GitHub ↗
(
  extrinsics: SubstrateExtrinsic[],
  events: EventRecord[],
  block: SubstrateBlock,
)

Source from the content-addressed store, hash-verified

155}
156
157export function wrapEvents(
158 extrinsics: SubstrateExtrinsic[],
159 events: EventRecord[],
160 block: SubstrateBlock,
161): SubstrateEvent[] {
162 return events.reduce((acc, event, idx) => {
163 const { phase } = event;
164 const wrappedEvent: SubstrateEvent = merge(event, { idx, block });
165 if (phase.isApplyExtrinsic) {
166 wrappedEvent.extrinsic = extrinsics[phase.asApplyExtrinsic.toNumber()];
167 }
168 acc.push(wrappedEvent);
169 return acc;
170 }, [] as SubstrateEvent[]);
171}
172
173function checkSpecRange(
174 specVersionRange: SpecVersionRange,

Callers 1

fetchBlocksBatchesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected