From 64889009b7e4cce0fc119f726a538b4e72bde8fb Mon Sep 17 00:00:00 2001 From: Jaco Date: Sat, 7 May 2022 09:37:42 +0200 Subject: [PATCH] Remove suspicious toHuman in author extraction (#7542) --- packages/react-query/src/BlockAuthors.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/react-query/src/BlockAuthors.tsx b/packages/react-query/src/BlockAuthors.tsx index ce2f5880a8..99df48f534 100644 --- a/packages/react-query/src/BlockAuthors.tsx +++ b/packages/react-query/src/BlockAuthors.tsx @@ -3,6 +3,7 @@ import type { HeaderExtended } from '@polkadot/api-derive/types'; import type { EraRewardPoints } from '@polkadot/types/interfaces'; +import type { Codec } from '@polkadot/types/types'; import React, { useEffect, useState } from 'react'; @@ -68,10 +69,7 @@ function BlockAuthorsBase ({ children }: Props): React.ReactElement { thisBlockAuthor = lastHeader.author.toString(); } else if (isAuthorMappingWithDeposit && (hasConsensusDigest || hasPreRuntimeDigest)) { // Check for a Digest // Some blockchains such as Moonbeam need to fetch the author accountId from a mapping - thisBlockAuthor = ((await api.query.authorMapping.mappingWithDeposit(hasConsensusDigest ? lastHeader.digest.logs[0].asConsensus[1] : lastHeader.digest.logs[0].asPreRuntime[1])).toHuman() as { - account: string; - deposit: string; - }).account; + thisBlockAuthor = (await api.query.authorMapping.mappingWithDeposit<{ account: Codec } & Codec>(hasConsensusDigest ? lastHeader.digest.logs[0].asConsensus[1] : lastHeader.digest.logs[0].asPreRuntime[1])).account.toString(); lastHeader.authorFromMapping = thisBlockAuthor; }