From 5e314f85a9d73b92b078778c42efc802f9c4341f Mon Sep 17 00:00:00 2001 From: Jaco Date: Mon, 26 Apr 2021 12:59:46 +0300 Subject: [PATCH] Extract failed DispatchInfo correctly (#5146) --- packages/page-explorer/src/BlockInfo/Extrinsic.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/page-explorer/src/BlockInfo/Extrinsic.tsx b/packages/page-explorer/src/BlockInfo/Extrinsic.tsx index cb20845e1e..6e3eecb70f 100644 --- a/packages/page-explorer/src/BlockInfo/Extrinsic.tsx +++ b/packages/page-explorer/src/BlockInfo/Extrinsic.tsx @@ -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 [