From 75ae180945ddf1d4c7ab537f4ffc40863e582487 Mon Sep 17 00:00:00 2001 From: Javad Khalilian Date: Fri, 8 Nov 2024 14:43:30 +0100 Subject: [PATCH] Feat/dw transaction account (#2653) * fix(dx): tx list * fix(dw): transactions --- .../dev-wallet/src/pages/account/account.tsx | 154 ++++++++++-------- .../backup-recovery-phrase.tsx | 5 +- .../transaction/components/CommandView.tsx | 23 ++- .../src/pages/transactions/style.css.ts | 4 + .../src/pages/transactions/transactions.tsx | 66 +++++--- .../dev-wallet/src/utils/parsedCodeToPact.ts | 56 +++++++ 6 files changed, 207 insertions(+), 101 deletions(-) create mode 100644 packages/apps/dev-wallet/src/utils/parsedCodeToPact.ts diff --git a/packages/apps/dev-wallet/src/pages/account/account.tsx b/packages/apps/dev-wallet/src/pages/account/account.tsx index 3447648fa1..3c574cec09 100644 --- a/packages/apps/dev-wallet/src/pages/account/account.tsx +++ b/packages/apps/dev-wallet/src/pages/account/account.tsx @@ -7,6 +7,7 @@ import { ConfirmDeletion } from '@/Components/ConfirmDeletion/ConfirmDeletion'; import { FundOnTestnetButton } from '@/Components/FundOnTestnet/FundOnTestnet'; import { usePrompt } from '@/Components/PromptProvider/Prompt'; import { QRCode } from '@/Components/QRCode/QRCode'; +import { SideBarBreadcrumbs } from '@/Components/SideBarBreadcrumbs/SideBarBreadcrumbs'; import { accountRepository, isWatchedAccount, @@ -19,9 +20,10 @@ import { MonoCreate, MonoKey, MonoRemoveRedEye, + MonoWallet, } from '@kadena/kode-icons/system'; import { Button, Heading, Stack, TabItem, Tabs, Text } from '@kadena/kode-ui'; -import { useLayout } from '@kadena/kode-ui/patterns'; +import { SideBarBreadcrumbsItem, useLayout } from '@kadena/kode-ui/patterns'; import { useMemo, useState } from 'react'; import { Link, useNavigate, useParams } from 'react-router-dom'; import { noStyleLinkClass, panelClass } from '../home/style.css'; @@ -99,20 +101,16 @@ export function AccountPage() { return ( + }> + Dashboard + + Account ({account.alias || account.address}) + + {account.alias || '{ No Alias }'} - {account.profileId === profile?.uuid && ( - - - - Delete Account - - You don't want to use this account anymore? You can delete - it from your wallet. This will be deleted locally not from - the blockchain. - - + + { + (isOwnedAccount && ( + <> + - Delete - - - - - )) as any - } + Migrate Account + + You can use account migration to transfer all balances to + a newly created account with a new keyset, even though the + keyset guard for this account cannot be changed. + + + + + Delete Account + + You don't want to use this account anymore? You can delete + it from your wallet. This will be deleted locally not from + the blockchain. + + + + + )) as any + } + + ); diff --git a/packages/apps/dev-wallet/src/pages/backup-recovery-phrase/backup-recovery-phrase.tsx b/packages/apps/dev-wallet/src/pages/backup-recovery-phrase/backup-recovery-phrase.tsx index 9b0af35bda..ef8af22daf 100644 --- a/packages/apps/dev-wallet/src/pages/backup-recovery-phrase/backup-recovery-phrase.tsx +++ b/packages/apps/dev-wallet/src/pages/backup-recovery-phrase/backup-recovery-phrase.tsx @@ -4,10 +4,7 @@ import { MonoDashboardCustomize } from '@kadena/kode-icons/system'; import { Box, Button, Heading, Stack, Text } from '@kadena/kode-ui'; import { SideBarBreadcrumbsItem } from '@kadena/kode-ui/patterns'; import { Link } from 'react-router-dom'; -}> - Dashboard - Dev Console -; + export function BackupRecoveryPhrase() { return ( <> diff --git a/packages/apps/dev-wallet/src/pages/transaction/components/CommandView.tsx b/packages/apps/dev-wallet/src/pages/transaction/components/CommandView.tsx index 02228e5c92..94a9ba4761 100644 --- a/packages/apps/dev-wallet/src/pages/transaction/components/CommandView.tsx +++ b/packages/apps/dev-wallet/src/pages/transaction/components/CommandView.tsx @@ -1,9 +1,11 @@ import { CopyButton } from '@/Components/CopyButton/CopyButton'; import { ITransaction } from '@/modules/transaction/transaction.repository'; +import { shortenPactCode } from '@/utils/parsedCodeToPact'; import { IPactCommand } from '@kadena/client'; -import { Heading, Stack, Text } from '@kadena/kode-ui'; +import { MonoTextSnippet } from '@kadena/kode-icons/system'; +import { Button, Heading, Stack, Text } from '@kadena/kode-ui'; import classNames from 'classnames'; -import { useMemo } from 'react'; +import { useMemo, useState } from 'react'; import { Label, Value } from './helpers'; import { Signers } from './Signers'; import { cardClass, codeClass, textEllipsis } from './style.css'; @@ -19,6 +21,7 @@ export function CommandView({ () => JSON.parse(transaction.cmd), [transaction.cmd], ); + const [showShortenCode, setShowShortenCode] = useState(true); return ( @@ -29,8 +32,20 @@ export function CommandView({ {'exec' in command.payload && ( <> - Code - {command.payload.exec.code} + + Code +