diff --git a/src/pages/Explorer/Detail/Extrinsic.tsx b/src/pages/Explorer/Detail/Extrinsic.tsx index 7ac1ba5..8263a99 100644 --- a/src/pages/Explorer/Detail/Extrinsic.tsx +++ b/src/pages/Explorer/Detail/Extrinsic.tsx @@ -1,7 +1,6 @@ import { CopyBinary } from "@/codec-components/ViewCodec/CopyBinary" import { AccountIdDisplay } from "@/components/AccountIdDisplay" import { CopyText } from "@/components/Copy" -import { EthAccountDisplay } from "@/components/EthAccountDisplay" import { ExpandBtn } from "@/components/Expand" import { JsonDisplay } from "@/components/JsonDisplay" import { Link } from "@/hashParams" @@ -43,11 +42,12 @@ export const Extrinsic: FC<{ extrinsic.extra.ChargeTxPayment) : undefined - let sender = null - if (extrinsic.type === "signed") sender = extrinsic.address - else if (extrinsic.type === "general") { - if (extrinsic.extra?.VerifyMultiSignature?.type === "Signed") - sender = extrinsic.extra.VerifyMultiSignature.value.account + let sender = extrinsic.type === "signed" ? extrinsic.address : null + if ( + extrinsic.type === "general" && + extrinsic.extra.VerifyMultiSignature?.type === "Signed" + ) { + sender = extrinsic.extra.VerifyMultiSignature.value.account } return ( @@ -73,11 +73,9 @@ export const Extrinsic: FC<{ {expanded ? (
- {extrinsic.type === "signed" ? ( - - - - ) : null} + + +
@@ -162,7 +160,7 @@ export const EventDisplay: FC<{ ) } -export const senderToAddress = ( +const senderToAddress = ( sender: Enum<{ Id: SS58String }> | SS58String | HexString, ) => typeof sender === "string" @@ -171,26 +169,12 @@ export const senderToAddress = ( ? sender.value : null -const Sender: React.FC<{ +export const Sender: React.FC<{ sender: Enum<{ Id: SS58String }> | SS58String | HexString - compact?: boolean -}> = ({ sender, compact }) => { +}> = ({ sender }) => { const value = senderToAddress(sender) - return ( - value && ( -
- {value.startsWith("0x") ? ( - - ) : ( - - )} -
- ) - ) + if (!value) return null + return } const CompactSection: FC<{ title: string; children: ReactNode }> = ({ diff --git a/src/pages/Extrinsics/Analyzer/ExtrinsicDecoder.tsx b/src/pages/Extrinsics/Analyzer/ExtrinsicDecoder.tsx index f818534..a0744dd 100644 --- a/src/pages/Extrinsics/Analyzer/ExtrinsicDecoder.tsx +++ b/src/pages/Extrinsics/Analyzer/ExtrinsicDecoder.tsx @@ -1,5 +1,4 @@ import { CopyBinary } from "@/codec-components/ViewCodec/CopyBinary" -import { AccountIdDisplay } from "@/components/AccountIdDisplay" import { CopyText } from "@/components/Copy" import { JsonDisplay } from "@/components/JsonDisplay" import { blockInfoState$ } from "@/pages/Explorer/block.state" @@ -12,8 +11,8 @@ import { useStateObservable, withDefault } from "@react-rxjs/core" import { HexString, TxCallData } from "polkadot-api" import { fromHex, toHex } from "polkadot-api/utils" import { FC, ReactNode, useMemo } from "react" -import { map, merge, switchMap } from "rxjs" -import { senderToAddress } from "../../Explorer/Detail/Extrinsic" +import { map, switchMap } from "rxjs" +import { Sender } from "../../Explorer/Detail/Extrinsic" import { AnalyzePriority } from "./Priority" import { selectedBlock$, selectedBlockHex$ } from "./selectedBlock" @@ -70,13 +69,19 @@ export const ExtrinsicDecoder: FC<{ } const decoded = decodeResult.value - const signerAddress = - decoded.type === "signed" ? senderToAddress(decoded.address) : null const txPayment = "extra" in decoded ? (decoded.extra.ChargeAssetTxPayment ?? decoded.extra.ChargeTxPayment) : null + let sender = decoded.type === "signed" ? decoded.address : null + if ( + decoded.type === "general" && + decoded.extra.VerifyMultiSignature?.type === "Signed" + ) { + sender = decoded.extra.VerifyMultiSignature.value.account + } + return (
@@ -100,34 +105,23 @@ export const ExtrinsicDecoder: FC<{
- {signerAddress ? ( + {sender ? (
Signer
-
- -
+
) : null}
- + - {decoded.type === "signed" ? ( + {"extra" in decoded ? ( - ) : decoded.type === "general" ? ( - -
- General transaction analysis is not implemented yet. -
-
) : null} diff --git a/src/pages/Extrinsics/Analyzer/Priority.tsx b/src/pages/Extrinsics/Analyzer/Priority.tsx index f3750b7..333131f 100644 --- a/src/pages/Extrinsics/Analyzer/Priority.tsx +++ b/src/pages/Extrinsics/Analyzer/Priority.tsx @@ -49,7 +49,7 @@ export const AnalyzePriority: FC<{