Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Display account bech32 address instead of account Id #1393

Merged
merged 4 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/app/components/nova/ContextInputView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ContextInputView: React.FC<IContextInputViewProps> = ({ contextInput }) =>
<div className="section--data">
<div className="label">Account</div>
<div className="value code highlight">
<TruncatedId id={input.accountId} link={`/${network}/account/${bech32Address}`} showCopyButton />
<TruncatedId id={bech32Address} link={`/${network}/account/${bech32Address}`} showCopyButton />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ const TransactionMetadataSection: React.FC<TransactionMetadataSectionProps> = ({
return (
<div className="allotment-item" key={`allotment-${idx}`}>
<div className="allotment-item__address value truncate highlight">
<TruncatedId
id={allotment.accountId}
link={`/${network}/addr/${accountBech32}`}
/>
<TruncatedId id={accountBech32} link={`/${network}/addr/${accountBech32}`} />
</div>
<div className="allotment-item__amount value">
<span
Expand Down
12 changes: 7 additions & 5 deletions client/src/app/routes/nova/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ const Block: React.FC<RouteComponentProps<BlockProps>> = ({
<div className="label">Latest Finalized Slot</div>
<div className="value code">{block.header.latestFinalizedSlot}</div>
</div>
<div className="section--data">
<div className="label">Issuer</div>
<div className="value code highlight">
<TruncatedId id={block.header.issuerId} link={`/${network}/addr/${issuerAddress}`} showCopyButton={true} />
{issuerAddress && (
<div className="section--data">
<div className="label">Issuer</div>
<div className="value code highlight">
<TruncatedId id={issuerAddress} link={`/${network}/addr/${issuerAddress}`} showCopyButton={true} />
</div>
</div>
</div>
)}
<div className="section--data row row--tablet-responsive">
{blockBody?.strongParents && (
<div className="truncate margin-b-s margin-r-m">
Expand Down
13 changes: 7 additions & 6 deletions client/src/app/routes/nova/FoundryPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
AccountAddress,
FeatureType,
FoundryOutput,
MetadataFeature,
Expand Down Expand Up @@ -59,7 +58,6 @@ const FoundryPage: React.FC<RouteComponentProps<FoundryPageProps>> = ({
const [isFormattedBalance, setIsFormattedBalance] = useState<boolean>(true);
const [foundryDetails, isFoundryDetailsLoading, foundryError] = useFoundryDetails(network, foundryId);
const [foundryOutput, setFoundryOutput] = useState<FoundryOutput>();
const [controllerAccountId, setControllerAccountId] = useState<string>();
const [controllerAccountBech32, setControllerAccountBech32] = useState<Bech32Address>();
const [tokenMetadata, setTokenMetadata] = useState<ITokenMetadata | null>();
const [tokensCount, setTokensCount] = useState<number>(0);
Expand All @@ -68,7 +66,6 @@ const FoundryPage: React.FC<RouteComponentProps<FoundryPageProps>> = ({
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;
Expand All @@ -81,9 +78,9 @@ const FoundryPage: React.FC<RouteComponentProps<FoundryPageProps>> = ({
);
setTokenMetadata(parsedMetadata);
}

if (isMounted) {
setFoundryOutput(output);
setControllerAccountId(accountId);
setControllerAccountBech32(bech32);
}
}
Expand All @@ -109,11 +106,15 @@ const FoundryPage: React.FC<RouteComponentProps<FoundryPageProps>> = ({
<span className="margin-r-t">{serialNumber}</span>
</div>
</div>
{controllerAccountId && controllerAccountBech32 && (
{controllerAccountBech32 && (
<div className="section--data">
<div className="label">Controller Account</div>
<div className="value code highlight">
<TruncatedId id={controllerAccountId} link={`/${network}/addr/${controllerAccountBech32}`} showCopyButton />
<TruncatedId
id={controllerAccountBech32}
link={`/${network}/addr/${controllerAccountBech32}`}
showCopyButton
/>
</div>
</div>
)}
Expand Down
18 changes: 9 additions & 9 deletions client/src/app/routes/nova/TransactionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ const TransactionPage: React.FC<RouteComponentProps<TransactionPageProps>> = ({
);
}

const issuerAddress = block?.header.issuerId ? Utils.addressToBech32(new AccountAddress(block.header.issuerId), bech32Hrp) : null;

const transactionContent = block ? (
<React.Fragment>
<div className="section--header row row--tablet-responsive middle space-between">
Expand Down Expand Up @@ -126,16 +128,14 @@ const TransactionPage: React.FC<RouteComponentProps<TransactionPageProps>> = ({
<TruncatedId id={block.header.slotCommitmentId} />
</div>
</div>
<div className="section--data">
<div className="label">Issuer</div>
<div className="value code highlight">
<TruncatedId
id={block.header.issuerId}
link={`/${network}/addr/${Utils.addressToBech32(new AccountAddress(block.header.issuerId), bech32Hrp)}`}
showCopyButton={true}
/>
{issuerAddress && (
<div className="section--data">
<div className="label">Issuer</div>
<div className="value code highlight">
<TruncatedId id={issuerAddress} link={`/${network}/addr/${issuerAddress}`} showCopyButton={true} />
</div>
</div>
</div>
)}
{transferTotal !== null && (
<div className="section--data">
<div className="label">Amount Transacted</div>
Expand Down
Loading