@@ -149,8 +149,8 @@ function EnterTimelockedAmountView({
-
-
+
+
-
-
+
+
);
}
diff --git a/apps/wallet-dashboard/components/Dialogs/Staking/views/SelectValidatorView.tsx b/apps/wallet-dashboard/components/Dialogs/Staking/views/SelectValidatorView.tsx
index f04641ee1df..626cbf05990 100644
--- a/apps/wallet-dashboard/components/Dialogs/Staking/views/SelectValidatorView.tsx
+++ b/apps/wallet-dashboard/components/Dialogs/Staking/views/SelectValidatorView.tsx
@@ -5,7 +5,7 @@ import React from 'react';
import { Button, Header } from '@iota/apps-ui-kit';
import { Validator } from './Validator';
-import { Layout, LayoutBody, LayoutFooter } from './Layout';
+import { DialogLayout, DialogLayoutBody, DialogLayoutFooter } from '../../layout';
interface SelectValidatorViewProps {
validators: string[];
@@ -23,9 +23,9 @@ function SelectValidatorView({
handleClose,
}: SelectValidatorViewProps): JSX.Element {
return (
-
+
-
+
{validators.map((validator) => (
@@ -38,18 +38,18 @@ function SelectValidatorView({
))}
-
+
{!!selectedValidator && (
-
+
-
+
)}
-
+
);
}
diff --git a/apps/wallet-dashboard/components/Dialogs/Staking/views/UnstakeView.tsx b/apps/wallet-dashboard/components/Dialogs/Staking/views/UnstakeView.tsx
index bb7913a3ecd..671184c9cea 100644
--- a/apps/wallet-dashboard/components/Dialogs/Staking/views/UnstakeView.tsx
+++ b/apps/wallet-dashboard/components/Dialogs/Staking/views/UnstakeView.tsx
@@ -30,7 +30,7 @@ import { useCurrentAccount, useSignAndExecuteTransaction } from '@iota/dapp-kit'
import { Loader, Warning } from '@iota/ui-icons';
import { useUnstakeTransaction } from '@/hooks';
import { ValidatorStakingData } from '@/components';
-import { Layout, LayoutFooter, LayoutBody } from './Layout';
+import { DialogLayout, DialogLayoutFooter, DialogLayoutBody } from '../../layout';
interface UnstakeDialogProps {
extendedStake: ExtendedDelegatedStake;
@@ -129,9 +129,9 @@ export function UnstakeView({
}
return (
-
+
-
+
-
+
-
+
-
-
+
+
);
}
diff --git a/apps/wallet-dashboard/components/Dialogs/Staking/views/Validator.tsx b/apps/wallet-dashboard/components/Dialogs/Staking/views/Validator.tsx
index cad60fda4c9..a76ed05db57 100644
--- a/apps/wallet-dashboard/components/Dialogs/Staking/views/Validator.tsx
+++ b/apps/wallet-dashboard/components/Dialogs/Staking/views/Validator.tsx
@@ -19,6 +19,7 @@ interface ValidatorProps {
showActiveStatus?: boolean;
onClick?: (address: string) => void;
showAction?: boolean;
+ activeEpoch?: string;
}
export function Validator({
@@ -27,11 +28,26 @@ export function Validator({
onClick,
isSelected,
showAction = true,
+ activeEpoch,
}: ValidatorProps) {
- const { name, newValidator, isAtRisk, apy, isApyApproxZero, validatorSummary } =
- useValidatorInfo({
- validatorAddress: address,
- });
+ const {
+ name: validatorName,
+ newValidator,
+ isAtRisk,
+ apy,
+ isApyApproxZero,
+ validatorSummary,
+ system,
+ } = useValidatorInfo({
+ validatorAddress: address,
+ });
+
+ // for inactive validators, show the epoch number
+ const fallBackText = activeEpoch
+ ? `Staked ${Number(system?.epoch) - Number(activeEpoch)} epochs ago`
+ : '';
+
+ const validatorDisplayName = validatorName || fallBackText;
const subtitle = showActiveStatus ? (
@@ -50,12 +66,12 @@ export function Validator({
-
+
{showAction && (
void;
+ onBack?: () => void;
+}
+
+export function TransactionDialogView({
+ txDigest,
+ onClose,
+ onBack,
+}: TransactionViewProps): React.JSX.Element | null {
+ const activeAddress = useCurrentAccount()?.address ?? '';
+ const { data: transaction, summary } = useGetTransactionWithSummary(
+ txDigest ?? '',
+ activeAddress,
+ );
+
+ return (
+
+
+
+ {transaction && summary ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+ );
+}
diff --git a/apps/wallet-dashboard/components/Dialogs/Staking/views/Layout.tsx b/apps/wallet-dashboard/components/Dialogs/layout/DialogLayout.tsx
similarity index 76%
rename from apps/wallet-dashboard/components/Dialogs/Staking/views/Layout.tsx
rename to apps/wallet-dashboard/components/Dialogs/layout/DialogLayout.tsx
index 7986ce592d0..9405c120097 100644
--- a/apps/wallet-dashboard/components/Dialogs/Staking/views/Layout.tsx
+++ b/apps/wallet-dashboard/components/Dialogs/layout/DialogLayout.tsx
@@ -3,7 +3,7 @@
import { PropsWithChildren } from 'react';
import { DialogBody, DialogContent, DialogPosition } from '@iota/apps-ui-kit';
-export function Layout({ children }: PropsWithChildren) {
+export function DialogLayout({ children }: PropsWithChildren) {
return (
{children}
@@ -11,7 +11,7 @@ export function Layout({ children }: PropsWithChildren) {
);
}
-export function LayoutBody({ children }: PropsWithChildren) {
+export function DialogLayoutBody({ children }: PropsWithChildren) {
return (
{children}
@@ -19,6 +19,6 @@ export function LayoutBody({ children }: PropsWithChildren) {
);
}
-export function LayoutFooter({ children }: PropsWithChildren) {
+export function DialogLayoutFooter({ children }: PropsWithChildren) {
return
{children}
;
}
diff --git a/apps/wallet-dashboard/components/Dialogs/layout/index.ts b/apps/wallet-dashboard/components/Dialogs/layout/index.ts
new file mode 100644
index 00000000000..23dcbf8ce3d
--- /dev/null
+++ b/apps/wallet-dashboard/components/Dialogs/layout/index.ts
@@ -0,0 +1,4 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+export * from './DialogLayout';
diff --git a/apps/wallet-dashboard/components/Popup/Popups/TransactionDetailsPopup.tsx b/apps/wallet-dashboard/components/Popup/Popups/TransactionDetailsPopup.tsx
deleted file mode 100644
index bb622c166dd..00000000000
--- a/apps/wallet-dashboard/components/Popup/Popups/TransactionDetailsPopup.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import React, { PropsWithChildren } from 'react';
-import { ExtendedTransaction } from '@/lib/interfaces';
-import {
- formatDate,
- useExtendedTransactionSummary,
- STAKING_REQUEST_EVENT,
- UNSTAKING_REQUEST_EVENT,
-} from '@iota/core';
-import {
- StakeTransactionCard,
- TransactionSummary,
- UnstakeTransactionCard,
-} from '@/components/transactions';
-
-interface TransactionDetailsPopupProps {
- transaction: ExtendedTransaction;
- onClose: () => void;
-}
-
-function LabeledValue({ label, children }: PropsWithChildren<{ label: string }>): JSX.Element {
- return (
-
-
- {label} :
-
-
{children}
-
- );
-}
-
-export default function TransactionDetailsPopup({
- transaction,
- onClose,
-}: TransactionDetailsPopupProps): JSX.Element {
- const { raw: rawTransaction } = transaction;
- const { events } = rawTransaction;
-
- const transactionSummary = useExtendedTransactionSummary(rawTransaction.digest);
-
- const txDate = !Number.isNaN(rawTransaction.timestampMs)
- ? formatDate(Number(rawTransaction.timestampMs), ['month', 'day', 'hour', 'minute'])
- : undefined;
-
- const stakedTxn = events?.find(({ type }) => type === STAKING_REQUEST_EVENT);
- const unstakeTxn = events?.find(({ type }) => type === UNSTAKING_REQUEST_EVENT);
-
- return (
-
-
-
Transaction Details
-
-
-
- {transaction.state}
- {transaction.action}
- {txDate}
-
-
-
-
Transaction Summary
-
-
-
- {(stakedTxn || unstakeTxn) && (
-
- {stakedTxn && }
- {unstakeTxn && }
-
- )}
-
- );
-}
diff --git a/apps/wallet-dashboard/components/Popup/Popups/index.ts b/apps/wallet-dashboard/components/Popup/Popups/index.ts
index e0e4a17db69..ebdfc7f7391 100644
--- a/apps/wallet-dashboard/components/Popup/Popups/index.ts
+++ b/apps/wallet-dashboard/components/Popup/Popups/index.ts
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-export { default as TransactionDetailsPopup } from './TransactionDetailsPopup';
export { default as UnstakePopup } from './UnstakePopup';
export { default as SendAssetPopup } from './SendAssetPopup';
diff --git a/apps/wallet-dashboard/components/transactions/GasSummary.tsx b/apps/wallet-dashboard/components/transactions/GasSummary.tsx
deleted file mode 100644
index 3b522432a40..00000000000
--- a/apps/wallet-dashboard/components/transactions/GasSummary.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) Mysten Labs, Inc.
-// Modifications Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { useFormatCoin, type GasSummaryType } from '@iota/core';
-import { useCurrentAccount } from '@iota/dapp-kit';
-import { formatAddress, IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
-
-export default function GasSummary({ gasSummary }: { gasSummary: GasSummaryType }) {
- const [gas, symbol] = useFormatCoin(gasSummary?.totalGas, IOTA_TYPE_ARG);
- const address = useCurrentAccount();
-
- return (
-
-
Gas Fees
-
-
- {address?.address === gasSummary?.owner && (
-
You Paid
- )}
-
- {gasSummary?.isSponsored ? '0' : gas} {symbol}
-
-
- {gasSummary?.isSponsored && gasSummary.owner && (
- <>
-
- Paid by Sponsor
- {gas} {symbol}
-
-
- Sponsor:
- {formatAddress(gasSummary.owner)}
-
- >
- )}
-
-
- );
-}
diff --git a/apps/wallet-dashboard/components/transactions/TransactionSummary.tsx b/apps/wallet-dashboard/components/transactions/TransactionSummary.tsx
index 94a8db43b57..6cca89942ca 100644
--- a/apps/wallet-dashboard/components/transactions/TransactionSummary.tsx
+++ b/apps/wallet-dashboard/components/transactions/TransactionSummary.tsx
@@ -1,20 +1,25 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import { type TransactionSummary as TransactionSummaryType } from '@iota/core';
-import { BalanceChanges, ObjectChanges, GasSummary } from './';
+import { type TransactionSummaryType, GasSummary } from '@iota/core';
+import { BalanceChanges, ObjectChanges } from '@iota/core';
+import { ExplorerLink } from '../ExplorerLink';
+
+interface TransactionSummaryProps {
+ summary: TransactionSummaryType;
+ activeAddress: string | null | undefined;
+ isLoading?: boolean;
+ isError?: boolean;
+ showGasSummary?: boolean;
+}
export default function TransactionSummary({
summary,
isLoading,
isError,
showGasSummary = false,
-}: {
- summary: TransactionSummaryType;
- isLoading?: boolean;
- isError?: boolean;
- showGasSummary?: boolean;
-}) {
+ activeAddress,
+}: TransactionSummaryProps) {
if (isError) return null;
if (isLoading) return
Loading...
;
if (!summary || (!summary.balanceChanges && !summary.objectSummary && !summary.gas))
@@ -25,16 +30,28 @@ export default function TransactionSummary({
{summary.balanceChanges && (
Balance Changes
-
+
)}
{summary.objectSummary && (
Changes
-
+
)}
- {showGasSummary && summary.gas &&
}
+ {showGasSummary && summary.gas && (
+
+ )}
);
}
diff --git a/apps/wallet-dashboard/components/transactions/TransactionTile.tsx b/apps/wallet-dashboard/components/transactions/TransactionTile.tsx
index cb029808b3c..405a02e76c6 100644
--- a/apps/wallet-dashboard/components/transactions/TransactionTile.tsx
+++ b/apps/wallet-dashboard/components/transactions/TransactionTile.tsx
@@ -3,11 +3,10 @@
'use client';
-import React from 'react';
+import React, { useState } from 'react';
import TransactionIcon from './TransactionIcon';
import formatTimestamp from '@/lib/utils/time';
-import { usePopups } from '@/hooks';
-import { TransactionDetailsPopup } from '@/components';
+import { ExplorerLink } from '@/components';
import { ExtendedTransaction, TransactionState } from '@/lib/interfaces';
import {
Card,
@@ -18,57 +17,121 @@ import {
CardBody,
CardAction,
CardActionType,
+ Dialog,
+ Header,
+ LoadingIndicator,
} from '@iota/apps-ui-kit';
-import { useFormatCoin, useExtendedTransactionSummary, getLabel } from '@iota/core';
+import {
+ useFormatCoin,
+ getLabel,
+ useTransactionSummary,
+ ViewTxnOnExplorerButton,
+ ExplorerLinkType,
+ TransactionReceipt,
+} from '@iota/core';
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
import { useCurrentAccount } from '@iota/dapp-kit';
+import { DialogLayout, DialogLayoutBody, DialogLayoutFooter } from '../Dialogs/layout';
+import { Validator } from '../Dialogs/Staking/views/Validator';
interface TransactionTileProps {
transaction: ExtendedTransaction;
}
-function TransactionTile({ transaction }: TransactionTileProps): JSX.Element {
+export function TransactionTile({ transaction }: TransactionTileProps): JSX.Element {
const account = useCurrentAccount();
const address = account?.address;
- const { openPopup, closePopup } = usePopups();
+ const [open, setOpen] = useState(false);
- const transactionSummary = useExtendedTransactionSummary(transaction.raw.digest);
+ const transactionSummary = useTransactionSummary({
+ transaction: transaction.raw,
+ currentAddress: account?.address,
+ recognizedPackagesList: [],
+ });
const [formatAmount, symbol] = useFormatCoin(
Math.abs(Number(address ? transactionSummary?.balanceChanges?.[address]?.[0]?.amount : 0)),
IOTA_TYPE_ARG,
);
- const handleDetailsClick = () => {
- openPopup( );
- };
+ function openDetailsDialog() {
+ setOpen(true);
+ }
const transactionDate = transaction?.timestamp && formatTimestamp(transaction.timestamp);
+
return (
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+ >
);
}
-export default TransactionTile;
+interface ActivityDetailsDialogProps {
+ transaction: ExtendedTransaction;
+ open: boolean;
+ setOpen: (open: boolean) => void;
+}
+function ActivityDetailsDialog({
+ transaction,
+ open,
+ setOpen,
+}: ActivityDetailsDialogProps): React.JSX.Element {
+ const address = useCurrentAccount()?.address ?? '';
+
+ const summary = useTransactionSummary({
+ transaction: transaction.raw,
+ currentAddress: address,
+ recognizedPackagesList: [],
+ });
+
+ if (!summary) return ;
+
+ return (
+
+
+ setOpen(false)} />
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChangeEntries.tsx b/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChangeEntries.tsx
deleted file mode 100644
index 14cc9ad7891..00000000000
--- a/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChangeEntries.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { BalanceChange } from '@iota/core';
-import { useMemo } from 'react';
-import { BalanceChangeEntry } from '.';
-import { getRecognizedUnRecognizedTokenChanges } from '@iota/core';
-
-interface BalanceChangeEntriesProps {
- balanceChanges: BalanceChange[];
-}
-
-export default function BalanceChangeEntries({
- balanceChanges: changes,
-}: BalanceChangeEntriesProps) {
- const { recognizedTokenChanges, unRecognizedTokenChanges } = useMemo(
- () => getRecognizedUnRecognizedTokenChanges(changes),
- [changes],
- );
-
- return (
-
- {[...recognizedTokenChanges, ...unRecognizedTokenChanges].map(
- (balanceChange, index) => (
-
- ),
- )}
-
- );
-}
diff --git a/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChangeEntry.tsx b/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChangeEntry.tsx
deleted file mode 100644
index c4b9f85279f..00000000000
--- a/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChangeEntry.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { BalanceChange, CoinFormat, useFormatCoin, useCoinMetadata } from '@iota/core';
-import { formatAddress } from '@iota/iota-sdk/utils';
-
-interface BalanceChangeEntryProps {
- balanceChange: BalanceChange;
-}
-
-export default function BalanceChangeEntry({
- balanceChange: { amount, coinType, unRecognizedToken, owner },
-}: BalanceChangeEntryProps) {
- const [formatted, symbol] = useFormatCoin(amount, coinType, CoinFormat.FULL);
- const { data: coinMetaData } = useCoinMetadata(coinType);
-
- const isPositive = BigInt(amount) > 0n;
-
- return (
-
-
-
-
{coinMetaData?.name || symbol}
- {unRecognizedToken &&
Unrecognized
}
-
-
- {isPositive && <>+>}
- {formatted} {symbol}
-
-
- {owner && (
-
- Owner
- {formatAddress(owner)}
-
- )}
-
- );
-}
diff --git a/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChanges.tsx b/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChanges.tsx
deleted file mode 100644
index 34c507c62d7..00000000000
--- a/apps/wallet-dashboard/components/transactions/balance-changes/BalanceChanges.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { BalanceChange } from '@iota/core';
-import { BalanceChangeEntries } from '.';
-
-interface BalanceChangesProps {
- balanceChanges: Record;
-}
-
-export default function BalanceChanges({ balanceChanges }: BalanceChangesProps) {
- return (
- <>
- {Object.entries(balanceChanges).map(([owner, balanceChanges], index) => (
-
- ))}
- >
- );
-}
diff --git a/apps/wallet-dashboard/components/transactions/balance-changes/index.ts b/apps/wallet-dashboard/components/transactions/balance-changes/index.ts
deleted file mode 100644
index 6c5ea510eb1..00000000000
--- a/apps/wallet-dashboard/components/transactions/balance-changes/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-export { default as BalanceChangeEntry } from './BalanceChangeEntry';
-export { default as BalanceChangeEntries } from './BalanceChangeEntries';
-export { default as BalanceChanges } from './BalanceChanges';
diff --git a/apps/wallet-dashboard/components/transactions/index.ts b/apps/wallet-dashboard/components/transactions/index.ts
index 7602efd1395..509933e7c10 100644
--- a/apps/wallet-dashboard/components/transactions/index.ts
+++ b/apps/wallet-dashboard/components/transactions/index.ts
@@ -1,15 +1,11 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-export { default as GasSummary } from './GasSummary';
export { default as TransactionAmount } from './TransactionAmount';
export { default as StakeTransactionCard } from './StakeTransactionCard';
export { default as UnstakeTransactionCard } from './UnstakeTransactionCard';
export { default as TransactionSummary } from './TransactionSummary';
-export { default as TransactionTile } from './TransactionTile';
+export * from './TransactionTile';
export { default as TransactionIcon } from './TransactionIcon';
export { default as TransactionsList } from './TransactionsList';
export { default as TransactionsOverview } from './TransactionsOverview';
-
-export * from './balance-changes';
-export * from './object-changes';
diff --git a/apps/wallet-dashboard/components/transactions/object-changes/ObjectChangeEntry.tsx b/apps/wallet-dashboard/components/transactions/object-changes/ObjectChangeEntry.tsx
deleted file mode 100644
index 9d386d6e6d3..00000000000
--- a/apps/wallet-dashboard/components/transactions/object-changes/ObjectChangeEntry.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { ObjectChangesByOwner, IotaObjectChangeTypes } from '@iota/core';
-import { IotaObjectChange } from '@iota/iota-sdk/client';
-import { ObjectDetail } from '.';
-import React from 'react';
-
-interface ObjectChangeEntryProps {
- changes: ObjectChangesByOwner;
- type: IotaObjectChangeTypes;
-}
-
-export default function ObjectChangeEntry({ changes, type }: ObjectChangeEntryProps) {
- return (
- <>
- {Object.entries(changes).map(([owner, changes]) => (
-
- {changes.changes.map((change) => (
-
- ))}
- {changes.changesWithDisplay.map((change) => (
-
- ))}
-
- ))}
- >
- );
-}
-
-function getChangeKey(change: IotaObjectChange) {
- return change.type !== 'deleted' && change.type !== 'wrapped' ? change.digest : change.objectId;
-}
diff --git a/apps/wallet-dashboard/components/transactions/object-changes/ObjectChanges.tsx b/apps/wallet-dashboard/components/transactions/object-changes/ObjectChanges.tsx
deleted file mode 100644
index b3b246e6f0e..00000000000
--- a/apps/wallet-dashboard/components/transactions/object-changes/ObjectChanges.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { ObjectChangeSummary, IotaObjectChangeTypes } from '@iota/core';
-import { ObjectChangeEntry } from '.';
-
-interface ObjectChangesProps {
- objectSummary: ObjectChangeSummary;
-}
-
-export default function ObjectChanges({ objectSummary }: ObjectChangesProps) {
- return (
- <>
- {Object.entries(objectSummary).map(([type, changes]) => (
-
- ))}
- >
- );
-}
diff --git a/apps/wallet-dashboard/components/transactions/object-changes/ObjectDetail.tsx b/apps/wallet-dashboard/components/transactions/object-changes/ObjectDetail.tsx
deleted file mode 100644
index 2a4204d5acf..00000000000
--- a/apps/wallet-dashboard/components/transactions/object-changes/ObjectDetail.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import {
- IotaObjectChangeWithDisplay,
- getObjectChangeLabel,
- getOwnerDisplay,
- parseObjectChangeDetails,
-} from '@iota/core';
-import { useCurrentAccount } from '@iota/dapp-kit';
-import { DisplayFieldsResponse, IotaObjectChange } from '@iota/iota-sdk/client';
-import { formatAddress, isValidIotaAddress } from '@iota/iota-sdk/utils';
-
-enum ObjectDetailLabel {
- Package = 'Package',
- Module = 'Module',
- Type = 'Type',
-}
-
-interface ObjectDetailProps {
- change: IotaObjectChange | IotaObjectChangeWithDisplay;
- owner: string;
- ownerType: string;
- displayData?: DisplayFieldsResponse;
-}
-
-export default function ObjectDetail({ change, owner, ownerType, displayData }: ObjectDetailProps) {
- const address = useCurrentAccount()?.address;
- if (!address) return null;
-
- const { ownerDisplay } = getOwnerDisplay(owner, ownerType, address);
-
- if (change.type === 'transferred' || change.type === 'published') {
- return null;
- }
-
- const [packageId, moduleName, typeName] = parseObjectChangeDetails(change);
-
- const objectDetails: {
- label: ObjectDetailLabel;
- value: string;
- }[] = [
- {
- label: ObjectDetailLabel.Package,
- value: packageId,
- },
- {
- label: ObjectDetailLabel.Module,
- value: moduleName,
- },
- {
- label: ObjectDetailLabel.Type,
- value: typeName,
- },
- ];
-
- return (
-
-
{getObjectChangeLabel(change.type)}
-
-
-
- {change.objectId && (
-
-
Object
-
{formatAddress(change.objectId)}
-
- )}
-
- {objectDetails.map((item) => {
- const shouldFormatValue = isValidIotaAddress(item.value);
- return (
-
-
{item.label}
-
- {shouldFormatValue ? formatAddress(item.value) : item.value}
-
-
- );
- })}
-
-
- {displayData && displayData.data && (
- // eslint-disable-next-line @next/next/no-img-element
-
- )}
-
-
- {ownerDisplay && (
-
- Owner
- {ownerDisplay}
-
- )}
-
- );
-}
diff --git a/apps/wallet-dashboard/components/transactions/object-changes/index.ts b/apps/wallet-dashboard/components/transactions/object-changes/index.ts
deleted file mode 100644
index 0e88da93730..00000000000
--- a/apps/wallet-dashboard/components/transactions/object-changes/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-export { default as ObjectChangeEntry } from './ObjectChangeEntry';
-export { default as ObjectChanges } from './ObjectChanges';
-export { default as ObjectDetail } from './ObjectDetail';
diff --git a/apps/wallet/src/ui/app/components/ExplorerLinkHelper.tsx b/apps/wallet/src/ui/app/components/ExplorerLinkHelper.tsx
new file mode 100644
index 00000000000..bbc381a0e44
--- /dev/null
+++ b/apps/wallet/src/ui/app/components/ExplorerLinkHelper.tsx
@@ -0,0 +1,9 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+import type { RenderExplorerLinkProps } from '@iota/core';
+import ExplorerLink from './explorer-link';
+
+export function ExplorerLinkHelper({ children, ...linkProps }: RenderExplorerLinkProps) {
+ return {children} ;
+}
diff --git a/apps/wallet/src/ui/app/components/index.ts b/apps/wallet/src/ui/app/components/index.ts
index 5dd1c520da6..978c70b11b4 100644
--- a/apps/wallet/src/ui/app/components/index.ts
+++ b/apps/wallet/src/ui/app/components/index.ts
@@ -11,6 +11,7 @@ export * from './PasswordInputDialog';
export * from './SectionHeader';
export * from './SummaryCard';
export * from './WalletListSelect';
+export * from './ExplorerLinkHelper';
export * from './accounts';
export * from './active-coins-card';
export * from './error-boundary';
diff --git a/apps/wallet/src/ui/app/components/receipt-card/StakeTxn.tsx b/apps/wallet/src/ui/app/components/receipt-card/StakeTxn.tsx
deleted file mode 100644
index 94aa3c6285b..00000000000
--- a/apps/wallet/src/ui/app/components/receipt-card/StakeTxn.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) Mysten Labs, Inc.
-// Modifications Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { ValidatorLogo } from '_app/staking/validators/ValidatorLogo';
-import { TxnAmount } from '_components';
-
-import { formatPercentageDisplay, type GasSummaryType, useGetValidatorsApy } from '@iota/core';
-import type { IotaEvent } from '@iota/iota-sdk/client';
-import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
-
-import { CardType } from '@iota/apps-ui-kit';
-import { StakeTxnInfo } from './StakeTxnInfo';
-
-interface StakeTxnProps {
- event: IotaEvent;
- gasSummary?: GasSummaryType;
-}
-
-// For Staked Transaction use moveEvent Field to get the validator address, delegation amount, epoch
-export function StakeTxn({ event, gasSummary }: StakeTxnProps) {
- const json = event.parsedJson as {
- amount: string;
- validator_address: string;
- epoch: string;
- };
- const validatorAddress = json?.validator_address;
- const stakedAmount = json?.amount;
- const stakedEpoch = Number(json?.epoch || '0');
-
- const { data: rollingAverageApys } = useGetValidatorsApy();
-
- const { apy, isApyApproxZero } = rollingAverageApys?.[validatorAddress] ?? {
- apy: null,
- };
-
- return (
-
- {validatorAddress && (
-
- )}
- {stakedAmount && (
-
- )}
-
-
- );
-}
diff --git a/apps/wallet/src/ui/app/components/receipt-card/index.tsx b/apps/wallet/src/ui/app/components/receipt-card/index.tsx
index 9f75dc287f8..3bba1a45a7f 100644
--- a/apps/wallet/src/ui/app/components/receipt-card/index.tsx
+++ b/apps/wallet/src/ui/app/components/receipt-card/index.tsx
@@ -5,44 +5,16 @@
import { useRecognizedPackages } from '_src/ui/app/hooks/useRecognizedPackages';
import {
useTransactionSummary,
- STAKING_REQUEST_EVENT,
- UNSTAKING_REQUEST_EVENT,
- formatDate,
+ TransactionReceipt,
+ ExplorerLinkType,
+ ViewTxnOnExplorerButton,
} from '@iota/core';
import { type IotaTransactionBlockResponse } from '@iota/iota-sdk/client';
-import { TransactionSummary } from '../../shared/transaction-summary';
-import { StakeTxn } from './StakeTxn';
-import { UnStakeTxn } from './UnstakeTxn';
-import {
- Button,
- ButtonType,
- InfoBox,
- InfoBoxStyle,
- InfoBoxType,
- LoadingIndicator,
-} from '@iota/apps-ui-kit';
-import { ArrowTopRight, CheckmarkFilled } from '@iota/ui-icons';
-import { GasFees } from '../../pages/approval-request/transaction-request/GasFees';
-import ExplorerLink, { ExplorerLinkType } from '../explorer-link';
-
-interface TransactionStatusProps {
- success: boolean;
- timestamp?: string;
-}
-
-function TransactionStatus({ success, timestamp }: TransactionStatusProps) {
- const txnDate = timestamp ? formatDate(Number(timestamp)) : '';
- return (
- }
- >
- );
-}
+import { CardType } from '@iota/apps-ui-kit';
+import { ValidatorLogo } from '../../staking/validators/ValidatorLogo';
+import { ExplorerLinkHelper } from '../ExplorerLinkHelper';
+import ExplorerLink from '../explorer-link';
interface ReceiptCardProps {
txn: IotaTransactionBlockResponse;
@@ -50,60 +22,36 @@ interface ReceiptCardProps {
}
export function ReceiptCard({ txn, activeAddress }: ReceiptCardProps) {
- const { events } = txn;
const recognizedPackagesList = useRecognizedPackages();
const summary = useTransactionSummary({
transaction: txn,
currentAddress: activeAddress,
recognizedPackagesList,
});
- const isSender = txn.transaction?.data.sender === activeAddress;
if (!summary) return null;
const { digest } = summary;
- const stakedTxn = events?.find(({ type }) => type === STAKING_REQUEST_EVENT);
- const unstakeTxn = events?.find(({ type }) => type === UNSTAKING_REQUEST_EVENT);
return (
-
-
- {stakedTxn || unstakeTxn ? (
- <>
- {stakedTxn ? (
-
- ) : null}
- {unstakeTxn ? (
-
- ) : null}
- >
- ) : (
- <>
-
- {isSender && }
- >
+ (
+
)}
-
+ />
-
- ) : (
-
- )
- }
- iconAfterText
- disabled={!digest}
- />
+
diff --git a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx
index d618abe0265..e3cf45db226 100644
--- a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx
+++ b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx
@@ -2,8 +2,8 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import { UserApproveContainer } from '_components';
-import { useAppDispatch, useTransactionData, useTransactionDryRun } from '_hooks';
+import { ExplorerLinkHelper, UserApproveContainer } from '_components';
+import { useActiveAddress, useAppDispatch, useTransactionData, useTransactionDryRun } from '_hooks';
import { type TransactionApprovalRequest } from '_payloads/transactions/ApprovalRequest';
import { respondToTransactionRequest } from '_redux/slices/transaction-requests';
import { ampli } from '_src/shared/analytics/ampli';
@@ -11,13 +11,11 @@ import { useAccountByAddress } from '_src/ui/app/hooks/useAccountByAddress';
import { useRecognizedPackages } from '_src/ui/app/hooks/useRecognizedPackages';
import { useSigner } from '_src/ui/app/hooks/useSigner';
import { PageMainLayoutTitle } from '_src/ui/app/shared/page-main-layout/PageMainLayoutTitle';
-import { TransactionSummary } from '_src/ui/app/shared/transaction-summary';
-import { useTransactionSummary } from '@iota/core';
+import { useTransactionSummary, TransactionSummary, GasFees } from '@iota/core';
import { Transaction } from '@iota/iota-sdk/transactions';
import { useMemo, useState } from 'react';
import { ConfirmationModal } from '../../../shared/ConfirmationModal';
-import { GasFees } from './GasFees';
import { TransactionDetails } from './TransactionDetails';
export interface TransactionRequestProps {
@@ -32,6 +30,7 @@ const APP_ORIGINS_TO_EXCLUDE_FROM_ANALYTICS = ['https://iota8192.ethoswallet.xyz
export function TransactionRequest({ txRequest }: TransactionRequestProps) {
const addressForTransaction = txRequest.tx.account;
+ const activeAddress = useActiveAddress();
const { data: accountForTransaction } = useAccountByAddress(addressForTransaction);
const signer = useSigner(accountForTransaction);
const dispatch = useAppDispatch();
@@ -99,6 +98,7 @@ export function TransactionRequest({ txRequest }: TransactionRequestProps) {
isLoading={isDryRunLoading}
isError={isDryRunError}
summary={summary}
+ renderExplorerLink={ExplorerLinkHelper}
/>
diff --git a/apps/wallet/src/ui/app/pages/home/receipt/index.tsx b/apps/wallet/src/ui/app/pages/home/receipt/index.tsx
index 44749f6c186..6afd778f2a9 100644
--- a/apps/wallet/src/ui/app/pages/home/receipt/index.tsx
+++ b/apps/wallet/src/ui/app/pages/home/receipt/index.tsx
@@ -5,13 +5,12 @@
import { Loading, Overlay, ReceiptCard } from '_components';
import { useActiveAddress } from '_src/ui/app/hooks/useActiveAddress';
import { useUnlockedGuard } from '_src/ui/app/hooks/useUnlockedGuard';
-import { useIotaClient } from '@iota/dapp-kit';
-import { type IotaTransactionBlockResponse } from '@iota/iota-sdk/client';
-import { useQuery } from '@tanstack/react-query';
import { useCallback, useMemo, useState } from 'react';
import { Navigate, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
import { Checkmark, Warning } from '@iota/ui-icons';
import { InfoBox, InfoBoxType, InfoBoxStyle } from '@iota/apps-ui-kit';
+import type { IotaTransactionBlockResponse } from '@iota/iota-sdk/client';
+import { useGetTransaction } from '@iota/core';
function ReceiptPage() {
const location = useLocation();
@@ -22,25 +21,14 @@ function ReceiptPage() {
// get tx results from url params
const transactionId = searchParams.get('txdigest');
const fromParam = searchParams.get('from');
- const client = useIotaClient();
- const { data, isPending, isError, error } = useQuery
({
- queryKey: ['transactions-by-id', transactionId],
- queryFn: async () => {
- return client.getTransactionBlock({
- digest: transactionId!,
- options: {
- showBalanceChanges: true,
- showObjectChanges: true,
- showInput: true,
- showEffects: true,
- showEvents: true,
- },
- });
- },
- enabled: !!transactionId,
+ const initialDataFromState = location.state?.response as
+ | IotaTransactionBlockResponse
+ | undefined;
+
+ const { data, isPending, isError, error } = useGetTransaction(transactionId ?? '', {
retry: 8,
- initialData: location.state?.response,
+ initialData: initialDataFromState,
});
const navigate = useNavigate();
@@ -67,6 +55,7 @@ function ReceiptPage() {
if (!transactionId || !activeAddress) {
return ;
}
+
return (
- {isLoading ? (
-
-
-
- ) : (
-
- {isDryRun && (
-
-
- Do you approve these actions?
-
-
- )}
-
-
-
- )}
- >
- );
-}
diff --git a/apps/wallet/src/ui/app/staking/stake/StakeForm.tsx b/apps/wallet/src/ui/app/staking/stake/StakeForm.tsx
index 83a70ef19a8..093991e6f33 100644
--- a/apps/wallet/src/ui/app/staking/stake/StakeForm.tsx
+++ b/apps/wallet/src/ui/app/staking/stake/StakeForm.tsx
@@ -7,6 +7,7 @@ import {
createStakeTransaction,
getGasSummary,
parseAmount,
+ StakeTransactionInfo,
useCoinMetadata,
useFormatCoin,
useStakingGasBudgetEstimation,
@@ -16,9 +17,9 @@ import { memo, useEffect, useMemo } from 'react';
import { useActiveAddress, useTransactionDryRun } from '../../hooks';
import { type FormValues } from './StakingCard';
import { InfoBox, InfoBoxStyle, InfoBoxType, Input, InputType } from '@iota/apps-ui-kit';
-import { StakeTxnInfo } from '../../components/receipt-card/StakeTxnInfo';
import { Transaction } from '@iota/iota-sdk/transactions';
import { Exclamation } from '@iota/ui-icons';
+import { ExplorerLinkHelper } from '../../components';
export interface StakeFromProps {
validatorAddress: string;
@@ -106,7 +107,12 @@ function StakeForm({ validatorAddress, coinBalance, coinType, epoch }: StakeFrom
icon={ }
/>
) : null}
-
+
);
}
diff --git a/apps/wallet/tailwind.config.ts b/apps/wallet/tailwind.config.ts
index 1a42a522c18..088b09b22c6 100644
--- a/apps/wallet/tailwind.config.ts
+++ b/apps/wallet/tailwind.config.ts
@@ -9,7 +9,11 @@ import uiKitStaticPreset from '../../apps/ui-kit/src/lib/tailwind/static.preset'
export default {
presets: [uiKitStaticPreset],
- content: ['./src/**/*.{js,jsx,ts,tsx}', './../ui-kit/src/lib/**/*.{js,jsx,ts,tsx}'],
+ content: [
+ './src/**/*.{js,jsx,ts,tsx}',
+ './../ui-kit/src/lib/**/*.{js,jsx,ts,tsx}',
+ './../core/src/components/**/*.{js,jsx,ts,tsx}',
+ ],
theme: {
extend: {
colors: {
diff --git a/apps/wallet/tests/balanceChanges.spec.ts b/apps/wallet/tests/balanceChanges.spec.ts
index c83d58499e0..c6f9d010817 100644
--- a/apps/wallet/tests/balanceChanges.spec.ts
+++ b/apps/wallet/tests/balanceChanges.spec.ts
@@ -89,5 +89,5 @@ test('check balance changes in Activity', async ({ page, extensionUrl }) => {
await page.getByTestId('nav-activity').click();
await expect(page.getByTestId('link-to-txn').first()).toBeVisible({ timeout });
await page.getByTestId('link-to-txn').first().click();
- await expect(page.getByText(`Successfully sent`, { exact: false })).toBeVisible();
+ await expect(page.getByText(`Successfully received`, { exact: false })).toBeVisible();
});