From 37eb991ef2d15f08cf58354ca7d16e1c68153f80 Mon Sep 17 00:00:00 2001 From: chaojun Date: Tue, 27 Aug 2024 19:19:42 +0800 Subject: [PATCH] fix, #947 --- .../graphql-server/src/schema/chain/resolvers/event.js | 7 +++++-- .../schema/chain/resolvers/extractExtrinsicInfo/index.js | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/packages/graphql-server/src/schema/chain/resolvers/event.js b/backend/packages/graphql-server/src/schema/chain/resolvers/event.js index 2549aae7..9aa8e53c 100644 --- a/backend/packages/graphql-server/src/schema/chain/resolvers/event.js +++ b/backend/packages/graphql-server/src/schema/chain/resolvers/event.js @@ -4,10 +4,13 @@ const { extractEvent } = require("./extractEventInfo"); async function event(_, _args) { const { blockHeight, eventIndex } = _args; - const extrinsicData = await chainCall((api) => + const eventData = await chainCall((api) => getEventData(api, blockHeight, eventIndex), ); - return extractEvent(extrinsicData); + if (!eventData) { + return; + } + return extractEvent(eventData); } module.exports = { diff --git a/backend/packages/graphql-server/src/schema/chain/resolvers/extractExtrinsicInfo/index.js b/backend/packages/graphql-server/src/schema/chain/resolvers/extractExtrinsicInfo/index.js index 2286acc4..73542339 100644 --- a/backend/packages/graphql-server/src/schema/chain/resolvers/extractExtrinsicInfo/index.js +++ b/backend/packages/graphql-server/src/schema/chain/resolvers/extractExtrinsicInfo/index.js @@ -21,6 +21,9 @@ function extractExtrinsicEventInfos(allBlockEvents, extrinsicIndexer) { } async function extractExtrinsicInfo(api, extrinsicData) { + if (!extrinsicData) { + return null; + } const { extrinsic, allBlockEvents, indexer } = extrinsicData; const events = extractExtrinsicEvents(allBlockEvents, indexer.extrinsicIndex); const calls = await extractCallsFromExtrinsic(