diff --git a/src/pages/Explorer/Detail/BlockDetail.tsx b/src/pages/Explorer/Detail/BlockDetail.tsx index 8e1a1e8..408b659 100644 --- a/src/pages/Explorer/Detail/BlockDetail.tsx +++ b/src/pages/Explorer/Detail/BlockDetail.tsx @@ -27,6 +27,22 @@ import { blockInfoState$, blocksByHeight$, BlockState } from "../block.state" import { BlockStatusIcon, statusText } from "./BlockState" import { createExtrinsicCodec, DecodedExtrinsic } from "./extrinsicDecoder" import { CopyText } from "@/components/Copy" +import { Enum, HexString, SS58String } from "polkadot-api" + +const Sender: React.FC<{ + sender: Enum<{ Id: SS58String }> | SS58String | HexString +}> = ({ sender }) => { + const value: string | null = + typeof sender === "string" ? sender : "Id" in sender ? sender.value : null + return ( + value && ( +
+ Signer: + +
+ ) + ) +} const blockExtrinsics$ = state((hash: string) => { const decoder$ = runtimeCtx$.pipe( @@ -311,12 +327,7 @@ const Extrinsic: FC<{
{extrinsic.signed && (
- {"type" in extrinsic.sender && extrinsic.sender.type === "Id" && ( -
- Signer: - -
- )} +
)} diff --git a/src/pages/Explorer/Detail/extrinsicDecoder.ts b/src/pages/Explorer/Detail/extrinsicDecoder.ts index 7c70138..b1eb754 100644 --- a/src/pages/Explorer/Detail/extrinsicDecoder.ts +++ b/src/pages/Explorer/Detail/extrinsicDecoder.ts @@ -9,6 +9,7 @@ import { compact, enhanceDecoder, Enum, + HexString, SS58String, Struct, u8, @@ -31,9 +32,11 @@ export const createExtrinsicCodec = ( lookup.metadata.extrinsic.address, ) as Codec< // TODO Assume MultiAddress, but can be anything really :/ - Enum<{ - Id: SS58String - }> + | Enum<{ + Id: SS58String + }> + | SS58String + | HexString >) : AccountId() const v14Signature = Variant({