From 77cf1703bd97b5ae89fde8e41c652404e5dadbfc Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Tue, 16 Apr 2024 12:35:30 +0200 Subject: [PATCH 1/2] feat: Display account bech32 address instead of account Id in Block/Transaction page and Transaction metadata section --- .../app/components/nova/ContextInputView.tsx | 2 +- .../section/TransactionMetadataSection.tsx | 5 +---- client/src/app/routes/nova/Block.tsx | 12 +++++++----- client/src/app/routes/nova/TransactionPage.tsx | 18 +++++++++--------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/client/src/app/components/nova/ContextInputView.tsx b/client/src/app/components/nova/ContextInputView.tsx index e9e5f1022..c4e94c553 100644 --- a/client/src/app/components/nova/ContextInputView.tsx +++ b/client/src/app/components/nova/ContextInputView.tsx @@ -35,7 +35,7 @@ const ContextInputView: React.FC = ({ contextInput }) =>
Account
- +
); diff --git a/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx b/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx index 790401523..46628bd3f 100644 --- a/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx +++ b/client/src/app/components/nova/block/section/TransactionMetadataSection.tsx @@ -84,10 +84,7 @@ const TransactionMetadataSection: React.FC = ({ return (
- +
> = ({
Latest Finalized Slot
{block.header.latestFinalizedSlot}
-
-
Issuer
-
- + {issuerAddress && ( +
+
Issuer
+
+ +
-
+ )}
{blockBody?.strongParents && (
diff --git a/client/src/app/routes/nova/TransactionPage.tsx b/client/src/app/routes/nova/TransactionPage.tsx index 2742e54f3..ea742eb53 100644 --- a/client/src/app/routes/nova/TransactionPage.tsx +++ b/client/src/app/routes/nova/TransactionPage.tsx @@ -95,6 +95,8 @@ const TransactionPage: React.FC> = ({ ); } + const issuerAddress = block?.header.issuerId ? Utils.addressToBech32(new AccountAddress(block.header.issuerId), bech32Hrp) : null; + const transactionContent = block ? (
@@ -126,16 +128,14 @@ const TransactionPage: React.FC> = ({
-
-
Issuer
-
- + {issuerAddress && ( +
+
Issuer
+
+ +
-
+ )} {transferTotal !== null && (
Amount Transacted
From faaea95870f9374be31a0ba63cd3d90632de4f14 Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Fri, 19 Apr 2024 14:19:43 +0200 Subject: [PATCH 2/2] feat: Switch from accountId to account address also on FoundryPage --- client/src/app/routes/nova/FoundryPage.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/app/routes/nova/FoundryPage.tsx b/client/src/app/routes/nova/FoundryPage.tsx index 2d2d412a4..5d60232dc 100644 --- a/client/src/app/routes/nova/FoundryPage.tsx +++ b/client/src/app/routes/nova/FoundryPage.tsx @@ -1,5 +1,4 @@ import { - AccountAddress, FeatureType, FoundryOutput, MetadataFeature, @@ -59,7 +58,6 @@ const FoundryPage: React.FC> = ({ const [isFormattedBalance, setIsFormattedBalance] = useState(true); const [foundryDetails, isFoundryDetailsLoading, foundryError] = useFoundryDetails(network, foundryId); const [foundryOutput, setFoundryOutput] = useState(); - const [controllerAccountId, setControllerAccountId] = useState(); const [controllerAccountBech32, setControllerAccountBech32] = useState(); const [tokenMetadata, setTokenMetadata] = useState(); const [tokensCount, setTokensCount] = useState(0); @@ -68,7 +66,6 @@ const FoundryPage: React.FC> = ({ if (foundryDetails) { const output = foundryDetails?.output as FoundryOutput; const immutableAccountUnlockCondition = output.unlockConditions[0] as ImmutableAccountAddressUnlockCondition; - const accountId = (immutableAccountUnlockCondition.address as AccountAddress).accountId; const bech32 = Utils.addressToBech32(immutableAccountUnlockCondition.address, bech32Hrp); const immutableFeatures = (foundryDetails?.output as FoundryOutput).immutableFeatures; @@ -81,9 +78,9 @@ const FoundryPage: React.FC> = ({ ); setTokenMetadata(parsedMetadata); } + if (isMounted) { setFoundryOutput(output); - setControllerAccountId(accountId); setControllerAccountBech32(bech32); } } @@ -109,11 +106,15 @@ const FoundryPage: React.FC> = ({ {serialNumber}
- {controllerAccountId && controllerAccountBech32 && ( + {controllerAccountBech32 && (
Controller Account
- +
)}