Extract failed DispatchInfo correctly (#5146)

This commit is contained in:
Jaco 2021-04-26 12:59:46 +03:00 committed by GitHub
parent 6b6803f149
commit 5e314f85a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,12 +40,14 @@ function filterEvents (index: number, events: KeyedEvent[] = [], maxBlockWeight?
phase.isApplyExtrinsic &&
phase.asApplyExtrinsic.eq(index)
);
const withInfo = filtered.filter(({ record: { event: { method, section } } }) =>
const infoRecord = filtered.find(({ record: { event: { method, section } } }) =>
section === 'system' &&
['ExtrinsicFailed', 'ExtrinsicSuccess'].includes(method)
);
const dispatchInfo = withInfo.length
? withInfo[0].record.event.data[0] as DispatchInfo
const dispatchInfo = infoRecord
? infoRecord.record.event.method === 'ExtrinsicSuccess'
? infoRecord.record.event.data[0] as DispatchInfo
: infoRecord.record.event.data[1] as DispatchInfo
: undefined;
return [