diff --git a/apps/core/src/components/icon/index.ts b/apps/core/src/components/icon/index.ts
new file mode 100644
index 00000000000..3fda2c89887
--- /dev/null
+++ b/apps/core/src/components/icon/index.ts
@@ -0,0 +1,4 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+export * from './ImageIcon';
diff --git a/apps/core/src/components/index.ts b/apps/core/src/components/index.ts
index 67d6dc1fbc3..fe43fbae4ac 100644
--- a/apps/core/src/components/index.ts
+++ b/apps/core/src/components/index.ts
@@ -2,3 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
export * from './KioskClientProvider';
+
+export * from './coin';
+export * from './icon';
diff --git a/apps/wallet-dashboard/components/Dialogs/SendAndReviewDialog.tsx b/apps/wallet-dashboard/components/Dialogs/SendAndReviewDialog.tsx
new file mode 100644
index 00000000000..4156acae6d3
--- /dev/null
+++ b/apps/wallet-dashboard/components/Dialogs/SendAndReviewDialog.tsx
@@ -0,0 +1,131 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+import { GAS_SYMBOL } from '@/lib/constants';
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogBody,
+ Header,
+ Card,
+ CardType,
+ CardImage,
+ ImageType,
+ CardBody,
+ CardAction,
+ CardActionType,
+ KeyValueInfo,
+ Divider,
+ ButtonType,
+ DialogPosition,
+} from '@iota/apps-ui-kit';
+import { CoinIcon, ImageIconSize, parseAmount, useCoinMetadata, useFormatCoin } from '@iota/core';
+import { formatAddress } from '@iota/iota-sdk/utils';
+import { Loader } from '@iota/ui-icons';
+
+export type SendAndReviewDialogProps = {
+ coinType: string;
+ to: string;
+ amount: string;
+ approximation?: boolean;
+ gasBudget?: string;
+ open: boolean;
+ setOpen?: (open: boolean) => void;
+ onSend: () => void;
+ isPending?: boolean;
+ senderAddress: string;
+ onClose: () => void;
+ onBack: () => void;
+};
+
+export function SendAndReviewDialog({
+ coinType,
+ senderAddress,
+ to,
+ amount,
+ approximation,
+ gasBudget,
+ open,
+ setOpen,
+ onSend,
+ isPending,
+ onClose,
+ onBack,
+}: SendAndReviewDialogProps): React.JSX.Element {
+ const { data: metadata } = useCoinMetadata(coinType);
+ const amountWithoutDecimals = parseAmount(amount, metadata?.decimals ?? 0);
+ const [formatAmount, symbol] = useFormatCoin(Math.abs(Number(amountWithoutDecimals)), coinType);
+
+ return (
+
+ );
+}
diff --git a/apps/wallet-dashboard/components/Dialogs/index.ts b/apps/wallet-dashboard/components/Dialogs/index.ts
new file mode 100644
index 00000000000..8b7f60796b2
--- /dev/null
+++ b/apps/wallet-dashboard/components/Dialogs/index.ts
@@ -0,0 +1,4 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+export * from './SendAndReviewDialog';
diff --git a/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/SendCoinPopup.tsx b/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/SendCoinPopup.tsx
index c3f917df955..1e99fcd3ac5 100644
--- a/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/SendCoinPopup.tsx
+++ b/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/SendCoinPopup.tsx
@@ -120,6 +120,8 @@ function SendCoinPopup({
gasBudget={sendCoinData?.gasBudget?.toString() || '--'}
error={error?.message}
isPending={isPending}
+ coinType={selectedCoin.coinType}
+ onClose={onClose}
/>
)}
>
diff --git a/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/views/ReviewValuesFormView.tsx b/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/views/ReviewValuesFormView.tsx
index 0732b263cfc..cd59277f542 100644
--- a/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/views/ReviewValuesFormView.tsx
+++ b/apps/wallet-dashboard/components/Popup/Popups/SendCoinPopup/views/ReviewValuesFormView.tsx
@@ -1,8 +1,9 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
+import { SendAndReviewDialog } from '@/components/Dialogs';
import { FormDataValues } from '../SendCoinPopup';
-import { Button } from '@/components';
+import { useState } from 'react';
interface ReviewValuesFormProps {
formData: FormDataValues;
@@ -12,36 +13,38 @@ interface ReviewValuesFormProps {
isPending: boolean;
executeTransfer: () => void;
onBack: () => void;
+ coinType: string;
+ onClose: () => void;
}
function ReviewValuesFormView({
formData: { amount, recipientAddress },
senderAddress,
gasBudget,
- error,
isPending,
executeTransfer,
onBack,
+ coinType,
+ onClose,
}: ReviewValuesFormProps): JSX.Element {
+ const [open, setOpen] = useState(true);
return (
-
-
Review & Send
-
-
Sending: {amount}
-
From: {senderAddress}
-
To: {recipientAddress}
-
Gas fee: {gasBudget}
-
- {error ?
{error} : null}
-
-
- {isPending ? (
-
- ) : (
-
- )}
-
-
+
{
+ setOpen(false);
+ onClose();
+ }}
+ onBack={onBack}
+ />
);
}
export default ReviewValuesFormView;
diff --git a/apps/wallet-dashboard/lib/constants/gas.constants.ts b/apps/wallet-dashboard/lib/constants/gas.constants.ts
new file mode 100644
index 00000000000..5b45d7e3c8e
--- /dev/null
+++ b/apps/wallet-dashboard/lib/constants/gas.constants.ts
@@ -0,0 +1,4 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+export const GAS_SYMBOL = 'IOTA';
diff --git a/apps/wallet-dashboard/lib/constants/index.ts b/apps/wallet-dashboard/lib/constants/index.ts
index a7c8637513f..46a4dcdb069 100644
--- a/apps/wallet-dashboard/lib/constants/index.ts
+++ b/apps/wallet-dashboard/lib/constants/index.ts
@@ -3,3 +3,4 @@
export * from './time.constants';
export * from './vesting.constants';
+export * from './gas.constants';
diff --git a/apps/wallet-dashboard/tailwind.config.ts b/apps/wallet-dashboard/tailwind.config.ts
index e8c9079ca3a..2ca1f1c0824 100644
--- a/apps/wallet-dashboard/tailwind.config.ts
+++ b/apps/wallet-dashboard/tailwind.config.ts
@@ -12,6 +12,7 @@ export default {
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./../ui-kit/src/lib/**/*.{js,jsx,ts,tsx}',
+ './../core/src/components/**/*.{js,jsx,ts,tsx}',
],
darkMode: 'class',
theme: {
diff --git a/apps/wallet/src/ui/app/components/DAppInfoCard.tsx b/apps/wallet/src/ui/app/components/DAppInfoCard.tsx
index 87cea050c73..6824f2978c5 100644
--- a/apps/wallet/src/ui/app/components/DAppInfoCard.tsx
+++ b/apps/wallet/src/ui/app/components/DAppInfoCard.tsx
@@ -12,7 +12,7 @@ import { useUnlockAccount } from './accounts/UnlockAccountContext';
import { DAppPermissionList } from './DAppPermissionList';
import { SummaryCard } from './SummaryCard';
import { Link } from 'react-router-dom';
-import { ImageIcon } from '../shared/image-icon';
+import { ImageIcon } from '@iota/core';
export interface DAppInfoCardProps {
name: string;
diff --git a/apps/wallet/src/ui/app/components/active-coins-card/CoinItem.tsx b/apps/wallet/src/ui/app/components/active-coins-card/CoinItem.tsx
index 5e7dce765f5..324d553f997 100644
--- a/apps/wallet/src/ui/app/components/active-coins-card/CoinItem.tsx
+++ b/apps/wallet/src/ui/app/components/active-coins-card/CoinItem.tsx
@@ -2,8 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import { CoinIcon } from '_components';
-import { useFormatCoin } from '@iota/core';
+import { useFormatCoin, ImageIconSize, CoinIcon } from '@iota/core';
import { type ReactNode } from 'react';
import {
Card,
@@ -15,7 +14,6 @@ import {
ImageType,
} from '@iota/apps-ui-kit';
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
-import { ImageIconSize } from '../../shared/image-icon';
interface CoinItemProps {
coinType: string;
diff --git a/apps/wallet/src/ui/app/components/index.ts b/apps/wallet/src/ui/app/components/index.ts
index f162a483b93..dbab474d008 100644
--- a/apps/wallet/src/ui/app/components/index.ts
+++ b/apps/wallet/src/ui/app/components/index.ts
@@ -15,7 +15,6 @@ export * from './accounts';
export * from './active-coins-card';
export * from './active-coins-card/CoinItem';
export * from './address-input';
-export * from './coin-icon';
export * from './error-boundary';
export * from './explorer-link';
export * from './explorer-link/Explorer';
diff --git a/apps/wallet/src/ui/app/components/iota-apps/IotaApp.tsx b/apps/wallet/src/ui/app/components/iota-apps/IotaApp.tsx
index ee69a96a670..aa4c2dc7e4b 100644
--- a/apps/wallet/src/ui/app/components/iota-apps/IotaApp.tsx
+++ b/apps/wallet/src/ui/app/components/iota-apps/IotaApp.tsx
@@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import { ImageIcon, ImageIconSize } from '_app/shared/image-icon';
+import { ImageIcon, ImageIconSize } from '@iota/core';
import { ExternalLink } from '_components';
import { ampli } from '_src/shared/analytics/ampli';
import { getDAppUrl } from '_src/shared/utils';
diff --git a/apps/wallet/src/ui/app/components/receipt-card/TxnAmount.tsx b/apps/wallet/src/ui/app/components/receipt-card/TxnAmount.tsx
index 623ed671b9a..a993b4657ca 100644
--- a/apps/wallet/src/ui/app/components/receipt-card/TxnAmount.tsx
+++ b/apps/wallet/src/ui/app/components/receipt-card/TxnAmount.tsx
@@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import { useFormatCoin } from '@iota/core';
+import { useFormatCoin, ImageIconSize, CoinIcon } from '@iota/core';
import {
Card,
CardAction,
@@ -12,8 +12,6 @@ import {
CardType,
ImageType,
} from '@iota/apps-ui-kit';
-import { CoinIcon } from '../coin-icon';
-import { ImageIconSize } from '../../shared/image-icon';
interface TxnAmountProps {
amount: string | number | bigint;
diff --git a/apps/wallet/src/ui/app/pages/home/transfer-coin/index.tsx b/apps/wallet/src/ui/app/pages/home/transfer-coin/index.tsx
index 111017d0bb0..84224ad3ae4 100644
--- a/apps/wallet/src/ui/app/pages/home/transfer-coin/index.tsx
+++ b/apps/wallet/src/ui/app/pages/home/transfer-coin/index.tsx
@@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import { CoinIcon, Loading, Overlay } from '_components';
+import { Loading, Overlay } from '_components';
import { ampli } from '_src/shared/analytics/ampli';
import { getSignerOperationErrorMessage } from '_src/ui/app/helpers/errorMessages';
import { useActiveAccount } from '_src/ui/app/hooks/useActiveAccount';
@@ -13,6 +13,8 @@ import {
filterAndSortTokenBalances,
useCoinMetadata,
useFormatCoin,
+ ImageIconSize,
+ CoinIcon,
} from '@iota/core';
// import * as Sentry from '@sentry/react';
import { useMutation, useQueryClient } from '@tanstack/react-query';
@@ -26,7 +28,6 @@ import { Select, Button, type SelectOption, ButtonType } from '@iota/apps-ui-kit
import { useActiveAddress, useCoinsReFetchingConfig } from '_src/ui/app/hooks';
import { useIotaClientQuery } from '@iota/dapp-kit';
import type { CoinBalance } from '@iota/iota-sdk/client';
-import { ImageIconSize } from '_src/ui/app/shared/image-icon';
import { Loader } from '@iota/ui-icons';
function TransferCoinPage() {
diff --git a/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx b/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx
index 5289019a18d..ce6bfd0acea 100644
--- a/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx
+++ b/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx
@@ -3,10 +3,9 @@
// SPDX-License-Identifier: Apache-2.0
import { ExplorerLink, ExplorerLinkType } from '_components';
-import { type IotaObjectChangeWithDisplay } from '@iota/core';
+import { type IotaObjectChangeWithDisplay, ImageIcon } from '@iota/core';
import { Card, CardAction, CardActionType, CardBody, CardImage, CardType } from '@iota/apps-ui-kit';
-import { ImageIcon } from '../../../image-icon';
import { ArrowTopRight } from '@iota/ui-icons';
export function ObjectChangeDisplay({ change }: { change: IotaObjectChangeWithDisplay }) {
diff --git a/apps/wallet/src/ui/app/staking/home/StakedCard.tsx b/apps/wallet/src/ui/app/staking/home/StakedCard.tsx
index 9ed1c130455..b945fbe025b 100644
--- a/apps/wallet/src/ui/app/staking/home/StakedCard.tsx
+++ b/apps/wallet/src/ui/app/staking/home/StakedCard.tsx
@@ -10,12 +10,12 @@ import {
useFormatCoin,
useGetTimeBeforeEpochNumber,
useTimeAgo,
+ ImageIcon,
} from '@iota/core';
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
import { Card, CardImage, CardType, CardBody, CardAction, CardActionType } from '@iota/apps-ui-kit';
import { useMemo } from 'react';
import { Link } from 'react-router-dom';
-import { ImageIcon } from '../../shared/image-icon';
import { useIotaClientQuery } from '@iota/dapp-kit';
diff --git a/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx b/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx
index 961cadc895b..dcb8954a274 100644
--- a/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx
+++ b/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx
@@ -1,7 +1,6 @@
// Copyright (c) Mysten Labs, Inc.
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import { ImageIcon, ImageIconSize } from '_app/shared/image-icon';
import {
Badge,
BadgeType,
@@ -15,7 +14,7 @@ import {
import { useIotaClientQuery } from '@iota/dapp-kit';
import { formatAddress } from '@iota/iota-sdk/utils';
import { useMemo } from 'react';
-import { formatPercentageDisplay, useGetValidatorsApy } from '@iota/core';
+import { formatPercentageDisplay, useGetValidatorsApy, ImageIcon, ImageIconSize } from '@iota/core';
interface ValidatorLogoProps {
validatorAddress: string;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 92e2c8a9a2f..460c79809ef 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -179,7 +179,7 @@ importers:
version: 5.2.1(@types/eslint@8.56.12)(eslint-config-prettier@9.1.0(eslint@8.57.1))(eslint@8.57.1)(prettier@3.3.3)
jest:
specifier: ^29.5.0
- version: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ version: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
prettier:
specifier: ^3.3.1
version: 3.3.3
@@ -191,7 +191,7 @@ importers:
version: 6.3.4
ts-jest:
specifier: ^29.1.0
- version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2)))(typescript@5.6.2)
+ version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2)))(typescript@5.6.2)
ts-loader:
specifier: ^9.4.4
version: 9.5.1(typescript@5.6.2)(webpack@5.95.0(@swc/core@1.7.28))
@@ -231,6 +231,9 @@ importers:
'@iota/kiosk':
specifier: workspace:*
version: link:../../sdk/kiosk
+ '@iota/ui-icons':
+ specifier: workspace:*
+ version: link:../ui-icons
'@sentry/react':
specifier: ^7.59.2
version: 7.119.0(react@18.3.1)
@@ -240,6 +243,9 @@ importers:
bignumber.js:
specifier: ^9.1.1
version: 9.1.2
+ clsx:
+ specifier: ^2.1.1
+ version: 2.1.1
react:
specifier: ^18.3.1
version: 18.3.1
@@ -1045,7 +1051,7 @@ importers:
version: 14.2.3(eslint@8.57.1)(typescript@5.6.2)
jest:
specifier: ^29.5.0
- version: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ version: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
postcss:
specifier: ^8.4.31
version: 8.4.47
@@ -1054,7 +1060,7 @@ importers:
version: 3.4.13(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
ts-jest:
specifier: ^29.1.0
- version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2)))(typescript@5.6.2)
+ version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2)))(typescript@5.6.2)
typescript:
specifier: ^5.5.3
version: 5.6.2
@@ -20540,7 +20546,7 @@ snapshots:
jest-util: 29.7.0
slash: 3.0.0
- '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))':
+ '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))':
dependencies:
'@jest/console': 29.7.0
'@jest/reporters': 29.7.0(node-notifier@10.0.0)
@@ -20554,7 +20560,7 @@ snapshots:
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 29.7.0
- jest-config: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ jest-config: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
jest-haste-map: 29.7.0
jest-message-util: 29.7.0
jest-regex-util: 29.6.3
@@ -26471,13 +26477,13 @@ snapshots:
crc-32@1.2.2: {}
- create-jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2)):
+ create-jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2)):
dependencies:
'@jest/types': 29.6.3
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
- jest-config: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ jest-config: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -29686,16 +29692,16 @@ snapshots:
- babel-plugin-macros
- supports-color
- jest-cli@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2)):
+ jest-cli@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2)):
dependencies:
- '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
- create-jest: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ create-jest: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
exit: 0.1.2
import-local: 3.2.0
- jest-config: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ jest-config: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@@ -29707,7 +29713,7 @@ snapshots:
- supports-color
- ts-node
- jest-config@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2)):
+ jest-config@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2)):
dependencies:
'@babel/core': 7.25.2
'@jest/test-sequencer': 29.7.0
@@ -29964,12 +29970,12 @@ snapshots:
merge-stream: 2.0.0
supports-color: 8.1.1
- jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2)):
+ jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2)):
dependencies:
- '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
'@jest/types': 29.6.3
import-local: 3.2.0
- jest-cli: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ jest-cli: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
optionalDependencies:
node-notifier: 10.0.0
transitivePeerDependencies:
@@ -34556,12 +34562,12 @@ snapshots:
ts-interface-checker@0.1.13: {}
- ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2)))(typescript@5.6.2):
+ ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2)))(typescript@5.6.2):
dependencies:
bs-logger: 0.2.6
ejs: 3.1.10
fast-json-stable-stringify: 2.1.0
- jest: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@swc/core@1.7.28)(@types/node@20.16.9)(typescript@5.6.2))
+ jest: 29.7.0(@types/node@20.16.9)(babel-plugin-macros@3.1.0)(node-notifier@10.0.0)(ts-node@10.9.2(@types/node@20.16.9)(typescript@5.6.2))
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
From cc2a855362c75322e9f9f4dfef7ca2fd79e730b1 Mon Sep 17 00:00:00 2001
From: JCNoguera <88061365+VmMad@users.noreply.github.com>
Date: Wed, 30 Oct 2024 17:23:58 +0100
Subject: [PATCH 02/87] fix: move CoinIcon to core
---
.../{ => Send}/SendAndReviewDialog.tsx | 0
.../components/Dialogs/Send/index.ts | 4 ++
.../components/Dialogs/index.ts | 2 +-
.../components/coins/CoinIcon.tsx | 45 -------------------
.../components/coins/CoinItem.tsx | 10 +++--
.../components/coins/index.ts | 1 -
6 files changed, 12 insertions(+), 50 deletions(-)
rename apps/wallet-dashboard/components/Dialogs/{ => Send}/SendAndReviewDialog.tsx (100%)
create mode 100644 apps/wallet-dashboard/components/Dialogs/Send/index.ts
delete mode 100644 apps/wallet-dashboard/components/coins/CoinIcon.tsx
diff --git a/apps/wallet-dashboard/components/Dialogs/SendAndReviewDialog.tsx b/apps/wallet-dashboard/components/Dialogs/Send/SendAndReviewDialog.tsx
similarity index 100%
rename from apps/wallet-dashboard/components/Dialogs/SendAndReviewDialog.tsx
rename to apps/wallet-dashboard/components/Dialogs/Send/SendAndReviewDialog.tsx
diff --git a/apps/wallet-dashboard/components/Dialogs/Send/index.ts b/apps/wallet-dashboard/components/Dialogs/Send/index.ts
new file mode 100644
index 00000000000..8b7f60796b2
--- /dev/null
+++ b/apps/wallet-dashboard/components/Dialogs/Send/index.ts
@@ -0,0 +1,4 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+export * from './SendAndReviewDialog';
diff --git a/apps/wallet-dashboard/components/Dialogs/index.ts b/apps/wallet-dashboard/components/Dialogs/index.ts
index 74898078827..f691a041c8f 100644
--- a/apps/wallet-dashboard/components/Dialogs/index.ts
+++ b/apps/wallet-dashboard/components/Dialogs/index.ts
@@ -1,5 +1,5 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-export * from './SendAndReviewDialog';
+export * from './Send';
export * from './Staking';
diff --git a/apps/wallet-dashboard/components/coins/CoinIcon.tsx b/apps/wallet-dashboard/components/coins/CoinIcon.tsx
deleted file mode 100644
index a5c24107baa..00000000000
--- a/apps/wallet-dashboard/components/coins/CoinIcon.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2024 IOTA Stiftung
-// SPDX-License-Identifier: Apache-2.0
-
-import { useCoinMetadata } from '@iota/core';
-import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
-import { IotaLogoMark } from '@iota/ui-icons';
-import cx from 'clsx';
-import { ImageIcon, ImageIconSize } from '../ImageIcon';
-
-interface NonIotaCoinProps {
- coinType: string;
- size?: ImageIconSize;
- rounded?: boolean;
-}
-
-function NonIotaCoin({ coinType, size = ImageIconSize.Full, rounded }: NonIotaCoinProps) {
- const { data: coinMeta } = useCoinMetadata(coinType);
- return (
-
-
-
- );
-}
-
-export interface CoinIconProps {
- coinType: string;
- size?: ImageIconSize;
- rounded?: boolean;
-}
-
-export function CoinIcon({ coinType, size = ImageIconSize.Full, rounded }: CoinIconProps) {
- return coinType === IOTA_TYPE_ARG ? (
-
-
-
- ) : (
-
- );
-}
diff --git a/apps/wallet-dashboard/components/coins/CoinItem.tsx b/apps/wallet-dashboard/components/coins/CoinItem.tsx
index 29e8be5aa35..26d6ba35f01 100644
--- a/apps/wallet-dashboard/components/coins/CoinItem.tsx
+++ b/apps/wallet-dashboard/components/coins/CoinItem.tsx
@@ -10,11 +10,10 @@ import {
CardType,
ImageType,
} from '@iota/apps-ui-kit';
-import { useFormatCoin } from '@iota/core';
+import { useFormatCoin, CoinIcon } from '@iota/core';
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
import { type ReactNode } from 'react';
import { ImageIconSize } from '../ImageIcon';
-import { CoinIcon } from './CoinIcon';
interface CoinItemProps {
coinType: string;
@@ -40,7 +39,12 @@ function CoinItem({
-
+
Date: Wed, 30 Oct 2024 18:43:20 +0100
Subject: [PATCH 03/87] feat(wallet-dashboard): style send entry screen WIP
---
.../components/Coins/MyCoins.tsx | 30 +--
.../components/Dialogs/SendTokenDialog.tsx | 216 ++++++++++++++++++
.../components/Dialogs/index.ts | 4 +
apps/wallet-dashboard/components/index.ts | 1 +
apps/wallet-dashboard/package.json | 1 +
pnpm-lock.yaml | 39 ++--
6 files changed, 258 insertions(+), 33 deletions(-)
create mode 100644 apps/wallet-dashboard/components/Dialogs/SendTokenDialog.tsx
create mode 100644 apps/wallet-dashboard/components/Dialogs/index.ts
diff --git a/apps/wallet-dashboard/components/Coins/MyCoins.tsx b/apps/wallet-dashboard/components/Coins/MyCoins.tsx
index 6fb6e8eed49..c89a2bc39c6 100644
--- a/apps/wallet-dashboard/components/Coins/MyCoins.tsx
+++ b/apps/wallet-dashboard/components/Coins/MyCoins.tsx
@@ -1,10 +1,9 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-import React from 'react';
+import React, { useState } from 'react';
import { useCurrentAccount, useIotaClientQuery } from '@iota/dapp-kit';
-import { CoinItem, SendCoinPopup } from '@/components';
-import { usePopups } from '@/hooks';
+import { CoinItem, SendTokenDialog } from '@/components';
import { CoinBalance } from '@iota/iota-sdk/client';
import {
COINS_QUERY_REFETCH_INTERVAL,
@@ -14,9 +13,10 @@ import {
} from '@iota/core';
function MyCoins(): React.JSX.Element {
- const { openPopup, closePopup } = usePopups();
const account = useCurrentAccount();
const activeAccountAddress = account?.address;
+ const [isSendTokenDialogOpen, setIsSendTokenDialogOpen] = useState(false);
+ const [selectedCoinType, setSelectedCoinType] = useState('');
const { data: coinBalances } = useIotaClientQuery(
'getAllBalances',
@@ -30,16 +30,10 @@ function MyCoins(): React.JSX.Element {
);
const { recognized, unrecognized } = useSortedCoinsByCategories(coinBalances ?? []);
- function openSendTokenPopup(coin: CoinBalance, address: string): void {
+ function openSendTokenPopup(coin: CoinBalance): void {
if (coinBalances) {
- openPopup(
- ,
- );
+ setIsSendTokenDialogOpen(true);
+ setSelectedCoinType(coin.coinType);
}
}
@@ -52,7 +46,7 @@ function MyCoins(): React.JSX.Element {
key={index}
coinType={coin.coinType}
balance={BigInt(coin.totalBalance)}
- onClick={() => openSendTokenPopup(coin, account?.address ?? '')}
+ onClick={() => openSendTokenPopup(coin)}
/>
);
})}
@@ -63,10 +57,16 @@ function MyCoins(): React.JSX.Element {
key={index}
coinType={coin.coinType}
balance={BigInt(coin.totalBalance)}
- onClick={() => openSendTokenPopup(coin, account?.address ?? '')}
+ onClick={() => openSendTokenPopup(coin)}
/>
);
})}
+
);
}
diff --git a/apps/wallet-dashboard/components/Dialogs/SendTokenDialog.tsx b/apps/wallet-dashboard/components/Dialogs/SendTokenDialog.tsx
new file mode 100644
index 00000000000..73773f480a3
--- /dev/null
+++ b/apps/wallet-dashboard/components/Dialogs/SendTokenDialog.tsx
@@ -0,0 +1,216 @@
+// Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+import {
+ InfoBox,
+ InfoBoxStyle,
+ InfoBoxType,
+ ButtonType,
+ ButtonHtmlType,
+ Button,
+ Dialog,
+ DialogContent,
+ DialogBody,
+ Header,
+ DialogPosition,
+} from '@iota/apps-ui-kit';
+import { parseAmount, useCoinMetadata, useGetAllCoins, useIotaAddressValidation } from '@iota/core';
+import { CoinStruct } from '@iota/iota-sdk/client';
+import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
+import { Exclamation } from '@iota/ui-icons';
+import { Field, Form, Formik, useFormikContext } from 'formik';
+import Input from '../Input';
+import { ChangeEventHandler, useCallback } from 'react';
+
+const INITIAL_VALUES = {
+ to: '',
+ amount: '',
+ isPayAllIota: false,
+ gasBudgetEst: '',
+};
+
+export type FormValues = typeof INITIAL_VALUES;
+
+export type SubmitProps = {
+ to: string;
+ amount: string;
+ isPayAllIota: boolean;
+ coinIds: string[];
+ coins: CoinStruct[];
+ gasBudgetEst: string;
+};
+
+export type SendTokenFormProps = {
+ coinType: string;
+ activeAddress: string;
+ setOpen: (bool: boolean) => void;
+ open: boolean;
+};
+
+function totalBalance(coins: CoinStruct[]): bigint {
+ return coins.reduce((partialSum, c) => partialSum + getBalanceFromCoinStruct(c), BigInt(0));
+}
+function getBalanceFromCoinStruct(coin: CoinStruct): bigint {
+ return BigInt(coin.balance);
+}
+
+export function SendTokenDialog({
+ coinType,
+ activeAddress,
+ setOpen,
+ open,
+}: SendTokenFormProps): React.JSX.Element {
+ const { data: coinsData } = useGetAllCoins(coinType, activeAddress!);
+ const { setFieldValue, validateField } = useFormikContext();
+ const iotaAddressValidation = useIotaAddressValidation();
+
+ const { data: iotaCoinsData } = useGetAllCoins(IOTA_TYPE_ARG, activeAddress!);
+
+ const iotaCoins = iotaCoinsData;
+ const coins = coinsData;
+ const coinBalance = totalBalance(coins || []);
+ const iotaBalance = totalBalance(iotaCoins || []);
+
+ const coinMetadata = useCoinMetadata(coinType);
+ const coinDecimals = coinMetadata.data?.decimals ?? 0;
+
+ // const validationSchemaStepOne = useMemo(
+ // () => createValidationSchemaStepOne(coinBalance, symbol, coinDecimals),
+ // [client, coinBalance, symbol, coinDecimals],
+ // );
+
+ // remove the comma from the token balance
+ const initAmountBig = parseAmount('0', coinDecimals);
+ // const initAmountBig = parseAmount(initialAmount, coinDecimals);
+
+ const handleAddressChange = useCallback