diff --git a/packages/apps/dev-wallet/index.html b/packages/apps/dev-wallet/index.html
index 2965b8106f..81a5757de9 100644
--- a/packages/apps/dev-wallet/index.html
+++ b/packages/apps/dev-wallet/index.html
@@ -5,9 +5,24 @@
Kadena Dev Wallet
+
-
+
+
+
+
+
+
Welcome to Chainweaver v3
+
Wallet is Loading ...
+
+
+
diff --git a/packages/apps/dev-wallet/public/boot.css b/packages/apps/dev-wallet/public/boot.css
new file mode 100644
index 0000000000..186d3aa206
--- /dev/null
+++ b/packages/apps/dev-wallet/public/boot.css
@@ -0,0 +1,45 @@
+.welcome-wrapper {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+ height: 100vh;
+ background: #050e1b;
+ opacity: 0;
+}
+.welcome-message-content {
+ display: flex;
+ padding: 40px;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+ background: #14202b;
+ color: #ffffffb3;
+ font-family: 'Roboto', sans-serif;
+ font-smooth: antialiased;
+ gap: 10px;
+ line-height: 3rem;
+ text-align: center;
+ -webkit-font-smoothing: antialiased;
+}
+body.boot.boot-theme-light .welcome-wrapper {
+ background: #f5f5f5;
+}
+
+body.boot.boot-theme-light .welcome-wrapper .welcome-message-content {
+ background: #e7e8e9;
+ color: #494949;
+}
+body.boot {
+ margin: 0;
+ background: #050e1b;
+}
+body.boot.boot-theme-light {
+ background: #f5f5f5;
+ color: #050e1b;
+}
diff --git a/packages/apps/dev-wallet/src/App/app.tsx b/packages/apps/dev-wallet/src/App/app.tsx
index 919294f66c..d022771fe5 100644
--- a/packages/apps/dev-wallet/src/App/app.tsx
+++ b/packages/apps/dev-wallet/src/App/app.tsx
@@ -14,18 +14,18 @@ function Providers({ children }: { children: React.ReactNode }) {
}
}, []);
return (
-
-
-
-
- {/* TODO: fixed the issue with prompt and remove this one in favor of the one above */}
-
- {children}
-
-
-
-
-
+
+
+
+
+
+ {/* TODO: fixed the issue with prompt and remove this one in favor of the one above */}
+ {children}
+
+
+
+
+
);
}
diff --git a/packages/apps/dev-wallet/src/Components/Accounts/WatchAccountDialog.tsx b/packages/apps/dev-wallet/src/Components/Accounts/WatchAccountDialog.tsx
index f79c5afed6..94116ea531 100644
--- a/packages/apps/dev-wallet/src/Components/Accounts/WatchAccountDialog.tsx
+++ b/packages/apps/dev-wallet/src/Components/Accounts/WatchAccountDialog.tsx
@@ -50,43 +50,45 @@ export function WatchAccountsDialog({
contract={contract}
/>
-
-
- Watch your contacts
-
- {contacts.map((contact) => (
-
- {
- setSelectedContacts((prev) =>
- prev.find((c) => c.uuid === contact.uuid)
- ? prev.filter((c) => c.uuid !== contact.uuid)
- : [...prev, contact],
- );
- }}
- >
- c.uuid === contact.uuid)
- }
- onChange={(isSelected) => {
+ {contacts.length > 0 && (
+
+
+ Watch your contacts
+
+ {contacts.map((contact) => (
+
+ {
setSelectedContacts((prev) =>
- isSelected
- ? [...prev, contact]
- : prev.filter((c) => c.uuid !== contact.uuid),
+ prev.find((c) => c.uuid === contact.uuid)
+ ? prev.filter((c) => c.uuid !== contact.uuid)
+ : [...prev, contact],
);
}}
>
- {' '}
-
-
-
-
- ))}
-
+ c.uuid === contact.uuid)
+ }
+ onChange={(isSelected) => {
+ setSelectedContacts((prev) =>
+ isSelected
+ ? [...prev, contact]
+ : prev.filter((c) => c.uuid !== contact.uuid),
+ );
+ }}
+ >
+ {' '}
+
+
+
+
+ ))}
+
+ )}
diff --git a/packages/apps/dev-wallet/src/Components/CopyButton/CopyButton.tsx b/packages/apps/dev-wallet/src/Components/CopyButton/CopyButton.tsx
new file mode 100644
index 0000000000..cf52cb3536
--- /dev/null
+++ b/packages/apps/dev-wallet/src/Components/CopyButton/CopyButton.tsx
@@ -0,0 +1,17 @@
+// import { MonoContentCopy } from '@kadena/kode-icons/system';
+import { MonoContentCopy } from '@kadena/kode-icons/system';
+import { Button } from '@kadena/kode-ui';
+
+export const CopyButton = ({ data }: { data: string | object }) => (
+
+);
diff --git a/packages/apps/dev-wallet/src/Components/Keyset/Keyset.tsx b/packages/apps/dev-wallet/src/Components/Keyset/Keyset.tsx
index 156f35e7c0..1712521b64 100644
--- a/packages/apps/dev-wallet/src/Components/Keyset/Keyset.tsx
+++ b/packages/apps/dev-wallet/src/Components/Keyset/Keyset.tsx
@@ -5,7 +5,7 @@ import { Stack, Text } from '@kadena/kode-ui';
export function Keyset({ keySet }: { keySet: IKeySet }) {
return (
-
+
{keySet.alias}
{keySet.principal}
diff --git a/packages/apps/dev-wallet/src/index.ts b/packages/apps/dev-wallet/src/index.ts
index a3fe5cbbac..235362072d 100644
--- a/packages/apps/dev-wallet/src/index.ts
+++ b/packages/apps/dev-wallet/src/index.ts
@@ -1,7 +1,30 @@
+const getTheme = () => localStorage.getItem('theme') || 'dark';
+const addBootTheme = () => {
+ document.body.classList.add(`boot-theme-${getTheme()}`);
+};
+const removeBootTheme = () => {
+ document.body.classList.remove(`boot`);
+ document.body.classList.remove(`boot-theme-${getTheme()}`);
+};
+
// the entry file for the dev wallet app
// TODO: we need to do setup app here like service worker, etc
-function bootstrap() {
- import('./App/main').then(({ renderApp }) => renderApp());
+async function bootstrap() {
+ addBootTheme();
+ import('./App/main').then(async ({ renderApp }) => {
+ renderApp();
+ globalThis.addEventListener('wallet-loaded', function () {
+ document.getElementById('welcome-message')?.remove();
+ removeBootTheme();
+ });
+ });
+ // show welcome message if wallet is not loaded after 200ms
+ setTimeout(() => {
+ const welcomeMessage = document.getElementById('welcome-message');
+ if (welcomeMessage) {
+ welcomeMessage.style.opacity = '1';
+ }
+ }, 200);
}
bootstrap();
diff --git a/packages/apps/dev-wallet/src/modules/account/account.service.ts b/packages/apps/dev-wallet/src/modules/account/account.service.ts
index 924cd538d4..909cec1fbb 100644
--- a/packages/apps/dev-wallet/src/modules/account/account.service.ts
+++ b/packages/apps/dev-wallet/src/modules/account/account.service.ts
@@ -116,14 +116,16 @@ export const accountDiscovery = (
const accounts: IAccount[] = [];
const keysets: IKeySet[] = [];
const usedKeys: IKeyItem[] = [];
+ const saveCallbacks: Array<() => Promise> = [];
for (let i = 0; i < numberOfKeys; i++) {
const key = await keySourceService.getPublicKey(keySource, i);
if (!key) {
return;
}
await emit('key-retrieved')(key);
+ const principal = `k:${key.publicKey}`;
const chainResult = (await discoverAccount(
- `k:${key.publicKey}`,
+ principal,
network.networkId,
undefined,
contract,
@@ -134,10 +136,14 @@ export const accountDiscovery = (
.execute()) as IDiscoveredAccount[];
if (chainResult.filter(({ result }) => Boolean(result)).length > 0) {
+ const availableKeyset = await accountRepository.getKeysetByPrincipal(
+ principal,
+ profileId,
+ );
usedKeys.push(key);
- const keyset: IKeySet = {
+ const keyset: IKeySet = availableKeyset || {
uuid: crypto.randomUUID(),
- principal: `k:${key.publicKey}`,
+ principal,
profileId,
guard: {
keys: [key.publicKey],
@@ -145,13 +151,16 @@ export const accountDiscovery = (
},
alias: '',
};
- keysets.push(keyset);
- accounts.push({
+ if (!availableKeyset) {
+ keysets.push(keyset);
+ }
+ const account: IAccount = {
uuid: crypto.randomUUID(),
profileId,
networkUUID: network.uuid,
contract,
keysetId: keyset.uuid,
+ keyset,
address: `k:${key.publicKey}`,
chains: chainResult
.filter(({ result }) => Boolean(result))
@@ -166,26 +175,26 @@ export const accountDiscovery = (
: acc,
'0',
),
+ };
+ accounts.push(account);
+ saveCallbacks.push(async () => {
+ if (!keySource.keys.find((k) => k.publicKey === key.publicKey)) {
+ await keySourceService.createKey(
+ keySource.uuid,
+ key.index as number,
+ );
+ }
+ if (!availableKeyset) {
+ await accountRepository.addKeyset(keyset);
+ }
+ await accountRepository.addAccount(account);
});
}
}
await emit('query-done')(accounts);
- // store keys; key creation needs to be in sequence so I used a for loop instead of Promise.all
- for (const key of usedKeys) {
- await keySourceService.createKey(keySource.uuid, key.index as number);
- }
-
- // store accounts
- await Promise.all([
- ...accounts.map(async (account) =>
- accountRepository.addAccount(account),
- ),
- ...keysets.map(async (keyset) =>
- accountRepository.addKeyset(keyset).catch(console.log),
- ),
- ]);
+ await Promise.all(saveCallbacks.map((cb) => cb().catch(console.error)));
keySourceService.clearCache();
await emit('accounts-saved')(accounts);
diff --git a/packages/apps/dev-wallet/src/modules/wallet/wallet.provider.tsx b/packages/apps/dev-wallet/src/modules/wallet/wallet.provider.tsx
index 2df31f4b8f..cb3e1e575d 100644
--- a/packages/apps/dev-wallet/src/modules/wallet/wallet.provider.tsx
+++ b/packages/apps/dev-wallet/src/modules/wallet/wallet.provider.tsx
@@ -197,7 +197,7 @@ function usePassword(profile: IProfile | undefined) {
if (unlockOptions.keepOpen === 'never') {
return unlockOptions.password;
}
- setPassword(unlockOptions.password);
+ await setPassword(unlockOptions.password);
if (unlockOptions.keepOpen === 'short-time') {
setTimeout(
() => {
@@ -487,6 +487,7 @@ export const WalletProvider: FC = ({ children }) => {
await setProfile(profile, true);
}
setContextValue((ctx) => ({ ...ctx, loaded: true }));
+ globalThis.dispatchEvent(new CustomEvent('wallet-loaded'));
};
loadSession();
}, [retrieveProfileList, session, setProfile]);
diff --git a/packages/apps/dev-wallet/src/pages/account-discovery/account-dsicovery.tsx b/packages/apps/dev-wallet/src/pages/account-discovery/account-dsicovery.tsx
index 6b9513c864..c5ebc3c129 100644
--- a/packages/apps/dev-wallet/src/pages/account-discovery/account-dsicovery.tsx
+++ b/packages/apps/dev-wallet/src/pages/account-discovery/account-dsicovery.tsx
@@ -1,27 +1,35 @@
import { IKeyItem } from '@/modules/wallet/wallet.repository';
-import { Box, Heading, Text } from '@kadena/kode-ui';
-import { useState } from 'react';
-import { useParams } from 'react-router-dom';
+import { Button, Card, Heading, Stack, Text } from '@kadena/kode-ui';
+import { useRef, useState } from 'react';
+import { useNavigate, useParams } from 'react-router-dom';
+import { ListItem } from '@/Components/ListItem/ListItem';
+import { IAccount } from '@/modules/account/account.repository';
import {
IDiscoveredAccount,
accountDiscovery,
} from '@/modules/account/account.service';
import { keySourceManager } from '@/modules/key-source/key-source-manager';
import { useWallet } from '@/modules/wallet/wallet.hook';
+import { shorten } from '@/utils/helpers';
+import { ChainId } from '@kadena/client';
+import { MonoKey } from '@kadena/kode-icons/system';
const NUMBER_OF_KEYS_TO_DISCOVER = 20;
export function AccountDiscovery() {
+ const navigate = useNavigate();
+ const processRef = useRef>();
const { profile, keySources, unlockKeySource, activeNetwork } = useWallet();
const { keySourceId } = useParams();
const [key, setKey] = useState();
const [discoveryStatus, setDiscoveryStatus] = useState<
'idle' | 'discovering' | 'finished'
>('idle');
- const [accounts, setAccounts] = useState<
+ const [discoveredAccounts, setDiscoveredAccounts] = useState<
Array
>([]);
+ const [accounts, setAccounts] = useState();
async function start() {
const keySource = keySources.find((ks) => ks.uuid === keySourceId);
@@ -34,7 +42,7 @@ export function AccountDiscovery() {
}
setDiscoveryStatus('discovering');
await unlockKeySource(keySource);
- await accountDiscovery(
+ processRef.current = accountDiscovery(
activeNetwork,
keySource,
profile.uuid,
@@ -44,73 +52,152 @@ export function AccountDiscovery() {
setKey(data);
})
.on('chain-result', (data: IDiscoveredAccount) => {
- setAccounts((prev) => [...prev, data]);
- })
- .execute();
- keySourceManager.disconnect();
+ setDiscoveredAccounts((prev) => [...prev, data]);
+ });
+ const accounts = await processRef.current.executeTo('query-done');
+ if (!accounts || !accounts.length) {
+ keySourceManager.disconnect();
+ }
setDiscoveryStatus('finished');
+ setAccounts(accounts);
}
- return (
- <>
-
- Account Discovery
+ console.log('accounts', discoveredAccounts);
+ const filteredDiscoveredAccounts = discoveredAccounts.filter(
+ (data) => data?.result,
+ ) as Array<{
+ chainId: ChainId;
+ result: Exclude;
+ }>;
- network: {activeNetwork?.networkId}
+ return (
+
+
+ Account Discovery
+
+ You can discover the accounts that you have created with the imported
+ mnemonic
+
+
+
+ network:
+
+ {activeNetwork?.networkId}
+
{discoveryStatus === 'idle' && (
-
- )}
-
- {discoveryStatus === 'finished' && (
-
- Discovery finished
-
+
+
+
)}
{discoveryStatus === 'discovering' && (
- <>
+
We are trying for first 20 keys - only K: account
-
-
- checking{' '}
- {key && (
-
- {' '}
- #{key.index} Address: `k:{key.publicKey} `
+
+ checking
+ {key && (
+ <>
+ #{key.index}
+ Address:
+
+ k:{key.publicKey}
- )}
-
-
- >
+ >
+ )}
+
+
)}
- Discoverd Accounts
- {accounts.length === 0 ? (
- no accounts found yet
- ) : (
-
- {accounts.map(
- (data, index) =>
- data?.result && (
- -
-
- account: {data.result.account}
-
keys:[{data.result.guard.keys.join(',')}]
-
chainId: {data.chainId}
-
balance: {data.result.balance}
-
-
- ),
+ {discoveryStatus !== 'idle' && (
+
+ Discoverd Accounts Details
+ {filteredDiscoveredAccounts.length === 0 ? (
+ no accounts found yet
+ ) : (
+
+ {filteredDiscoveredAccounts.map((data, index) => (
+
+
+
+ Chain #{data.chainId}:
+ {data.result.account}
+
+
+ {data.result.guard.pred}:
+ {data.result.guard.keys.map((key) => (
+
+
+
+
+ {shorten(key)}{' '}
+
+ ))}
+ {data.result.balance} KDA
+
+
+
+ ))}
+
)}
-
+
+ )}
+ {accounts && (
+
+ Discoverd Accounts
+ {!accounts.length && no accounts found}
+
+ {accounts.map((account, index) => (
+
+
+
+ {account.address}
+
+
+
+ {account.keyset?.guard.pred}:
+ {account.keyset?.guard.keys.map((key) => (
+
+
+
+
+ {shorten(key)}{' '}
+
+ ))}
+ {account.overallBalance} KDA
+
+
+
+ ))}
+
+
+
+
+
+
)}
-
- >
+
+
);
}
diff --git a/packages/apps/dev-wallet/src/pages/create-account/create-account.tsx b/packages/apps/dev-wallet/src/pages/create-account/create-account.tsx
index 0622061735..a917685dfd 100644
--- a/packages/apps/dev-wallet/src/pages/create-account/create-account.tsx
+++ b/packages/apps/dev-wallet/src/pages/create-account/create-account.tsx
@@ -13,25 +13,38 @@ import { Keyset } from '@/Components/Keyset/Keyset.tsx';
import { MonoAdd } from '@kadena/kode-icons/system';
import {
Button,
+ Card,
+ Divider,
Heading,
+ Radio,
+ RadioGroup,
Select,
SelectItem,
Stack,
- TabItem,
- Tabs,
Text,
TextField,
} from '@kadena/kode-ui';
+import classNames from 'classnames';
import { useState } from 'react';
-import { Link, Navigate, useSearchParams } from 'react-router-dom';
+import { Navigate, useSearchParams } from 'react-router-dom';
import { panelClass } from '../home/style.css.ts';
import { CreateKeySetDialog } from '../keys/Components/CreateKeySetDialog.tsx';
-import { linkClass } from '../transfer/style.css.ts';
import { buttonListClass } from './style.css.ts';
+type AccountType = 'k:account' | 'w:account' | 'r:account';
export function CreateAccount() {
- const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);
+ const [selectedItem, setSelectedItem] = useState<
+ | {
+ item: IKeySet;
+ type: 'keyset';
+ }
+ | {
+ item: IKeyItem;
+ type: 'key';
+ }
+ >();
const [created, setCreated] = useState(null);
+ const [accountType, setAccountType] = useState('k:account');
const [searchParams] = useSearchParams();
const urlContract = searchParams.get('contract');
const [contract, setContract] = useState(urlContract);
@@ -44,7 +57,6 @@ export function CreateAccount() {
fungibles,
keysets,
accounts,
- askForPassword,
} = useWallet();
const filteredAccounts = accounts.filter(
@@ -130,177 +142,151 @@ export function CreateAccount() {
return ;
}
+ const filteredKeySources = keySources.filter(
+ (ks) =>
+ (accountType === 'k:account' && ks.source !== 'web-authn') ||
+ (accountType === 'w:account' && ks.source === 'web-authn'),
+ );
+
+ const filteredKeysets = keysets.filter(
+ (keyset) =>
+ keyset.guard.keys.length >= 2 && !usedKeysets.includes(keyset.uuid),
+ );
+
return (
-
- Create Account
+
-
- setAlias(e.target.value)} />
- {
-
-
- {!showAdvancedOptions && (
-
- )}
-
- }
- {contract && showAdvancedOptions && (
-
-
-
- Create or use a key
-
- }
- >
-
- {keySources.map((keySource) => (
-
-
- {keySource.source}
-
-
-
- Select on of the following keys to create account
-
-
-
- {keySource.keys.map((key) => {
- const disabled = usedKeys.includes(key.publicKey);
- return (
- createAccountByKey(key)}
- disabled={disabled}
- title={disabled ? 'Already used' : 'Use this key'}
- >
-
-
-
-
-
- {disabled ? 'Already used' : 'Use'}
-
-
-
- );
- })}
-
-
- ))}
-
- Key Management
-
-
-
-
- Create or use a keyset
-
- }
- >
- {showCreateKeyset && (
- setShowCreateKeyset(false)}
- onDone={(keyset) => {
- createAccountByKeyset(keyset);
- }}
- />
- )}
+
+ k: account
+
+ This account will be guarded by a single key, this is the most
+ relevant way if you are creating a personal account; Also this
+ type of account supposed widely by kadena ecosystem.
+
+
+ Tip: The account guard is immutable and can't be changed.
+
+
+
+
+ w: account
+
+ This account will be guarded by a keyset or (single key when
+ key type is web-authn). This will offers a way to create
+ shared account or more secure account guarded by several keys.
+
+
+ Tip: The account guard is immutable and can't be changed.
+
+
+
+
+
+ r: account (not supposed yet)
+
-
- Key Sets
- }
- onPress={() => setShowCreateKeyset(true)}
- variant="info"
- >
- Use a new keyset
-
-
-
- Select on of the following keysets to create account
+
+ This account will be guarded by a keyset reference. this is
+ more suitable if you want to change the guard later without
+ creating a new account. Creating this type of account
+ requires namespace generation so its not supported yet with
+ most of the wallets
+
+
+ Tip: Since the guard can be changed, this type of account is
+ more flexible.
-
-
- {keysets
- .filter(({ guard }) => guard.keys.length >= 2)
- .map((keyset) => {
- const disabled = usedKeysets.includes(keyset.uuid);
+
+
+
+
+
+ {contract && (
+
+ {accountType === 'w:account' && (
+
+ {showCreateKeyset && (
+ setShowCreateKeyset(false)}
+ onDone={(keyset) => {
+ setSelectedItem({
+ item: keyset,
+ type: 'keyset',
+ });
+ }}
+ />
+ )}
+ Keysets
+
+
+ Create or use a keyset
+ }
+ onPress={() => setShowCreateKeyset(true)}
+ variant="outlined"
+ >
+ Create a new keyset
+
+
+
+ {filteredKeysets.length === 0
+ ? 'There is not keyset available to select, create a new one'
+ : 'Select on of the following keysets to create account'}
+
+
+
+ {filteredKeysets.map((keyset) => {
return (
createAccountByKeyset(keyset)}
- disabled={disabled}
- title={
- disabled
- ? 'Already used'
- : 'Use this keyset for Account'
+ selected={
+ selectedItem?.type === 'keyset' &&
+ selectedItem?.item.uuid === keyset.uuid
+ }
+ onClick={() =>
+ setSelectedItem({
+ item: keyset,
+ type: 'keyset',
+ })
}
>
);
})}
+
-
-
- Keyset Management
-
-
-
-
-
- )}
+ )}
+ {['k:account', 'w:account'].includes(accountType) &&
+ filteredKeySources.length && (
+
+ Keys
+
+ {filteredKeySources.map((keySource) => {
+ const filteredKeys = keySource.keys.filter(
+ (key) => !usedKeys.includes(key.publicKey),
+ );
+ return (
+
+
+ {keySource.source}
+
+
+
+ {filteredKeys.length === 0
+ ? 'There is not key available to select, create a new one'
+ : 'Select on of the following keys to create account'}
+
+
+
+ {keySource.keys
+ .filter(
+ (key) => !usedKeys.includes(key.publicKey),
+ )
+ .map((key) => {
+ return (
+
+ setSelectedItem({
+ item: key,
+ type: 'key',
+ })
+ }
+ >
+
+
+
+
+
+
+ );
+ })}
+
+
+ );
+ })}
+
+
+ )}
+
+ )}
+
+
+
+
+
-
+
);
}
function ButtonItem({
children,
+ selected = false,
...props
}: React.DetailedHTMLProps<
React.ButtonHTMLAttributes,
HTMLButtonElement
->) {
+> & { selected?: boolean }) {
return (
-
>
);
}
+
+const JsonView = ({ title, data }: { title: string; data: any }) => (
+
+
+
+ {title}
+
+
+
+ {data && typeof data === 'object'
+ ? JSON.stringify(data, null, 2)
+ : data}
+
+
+
+);
diff --git a/packages/apps/dev-wallet/src/pages/transaction/components/Signers.tsx b/packages/apps/dev-wallet/src/pages/transaction/components/Signers.tsx
index 3679d01fac..1cfc233934 100644
--- a/packages/apps/dev-wallet/src/pages/transaction/components/Signers.tsx
+++ b/packages/apps/dev-wallet/src/pages/transaction/components/Signers.tsx
@@ -98,6 +98,7 @@ export function Signers({
{
const signed = (await sign(transaction, [
signer.pubKey,
diff --git a/packages/apps/dev-wallet/src/pages/transaction/components/TxList.tsx b/packages/apps/dev-wallet/src/pages/transaction/components/TxList.tsx
index 9c79471e42..fc386d5b5a 100644
--- a/packages/apps/dev-wallet/src/pages/transaction/components/TxList.tsx
+++ b/packages/apps/dev-wallet/src/pages/transaction/components/TxList.tsx
@@ -28,8 +28,10 @@ export function TxList({
onUpdate,
sendDisabled,
onDone,
+ showExpanded,
}: {
txs: ITransaction[];
+ showExpanded?: boolean;
onUpdate: () => void;
sendDisabled?: boolean;
onDone?: () => void;
@@ -82,6 +84,7 @@ export function TxList({
hash: tx.hash,
} as ICommand)
.then(async (result) => {
+ console.log('preflight', result);
const updatedTx = {
...tx,
status: 'preflight',
@@ -98,6 +101,9 @@ export function TxList({
) {
return updatedTx;
}
+ if (updatedTx.preflight?.result.status === 'failure') {
+ return updatedTx;
+ }
updatedTx = await client
.submitOne({
cmd: tx.cmd,
@@ -105,8 +111,8 @@ export function TxList({
hash: tx.hash,
} as ICommand)
.then(async (request) => {
- const updatedTx = {
- ...tx,
+ updatedTx = {
+ ...updatedTx,
status: 'submitted',
request,
} as ITransaction;
@@ -216,19 +222,46 @@ export function TxList({
const selectedTx =
selectedTxIndex !== undefined ? txs[selectedTxIndex] : undefined;
+
+ const onExpandedSign =
+ (tx: ITransaction) => async (sigs: ITransaction['sigs']) => {
+ const updated = {
+ ...tx,
+ sigs,
+ status: sigs.every((data) => data?.sig)
+ ? steps.indexOf(tx.status) < steps.indexOf('signed')
+ ? 'signed'
+ : tx.status
+ : tx.status,
+ } as ITransaction;
+ await transactionRepository.updateTransaction(updated);
+ onUpdate();
+ };
return (
{txs.length === 0 && No transactions}
- {txs.map((tx, index) => (
- setSelectedTxIndex(index)}
- onSubmit={() => onSubmit(tx)}
- onSign={() => onSign(tx)}
- sendDisabled={sendDisabled}
- />
- ))}
+ {!showExpanded &&
+ txs.map((tx, index) => (
+ setSelectedTxIndex(index)}
+ onSubmit={() => onSubmit(tx)}
+ onSign={() => onSign(tx)}
+ sendDisabled={sendDisabled}
+ />
+ ))}
+ {showExpanded &&
+ txs.map((tx) => (
+
+ onSubmit(tx)}
+ sendDisabled={sendDisabled}
+ />
+
+ ))}
- {!txs.every((tx) => statusPassed(tx.status, 'signed')) && (
-
- You can sign all transactions at once.
-
-
-
-
- Sign All Transactions
-
-
+ {!showExpanded &&
+ !txs.every((tx) => statusPassed(tx.status, 'signed')) && (
+
+ You can sign all transactions at once.
+
+
+
+
+ Sign All Transactions
+
+
+
-
- )}
- {!sendDisabled &&
+ )}
+ {!showExpanded &&
+ !sendDisabled &&
txs.every((tx) => statusPassed(tx.status, 'signed')) &&
txs.find((tx) => tx.status === 'signed') && (
diff --git a/packages/apps/dev-wallet/src/pages/transaction/components/TxPipeLine.tsx b/packages/apps/dev-wallet/src/pages/transaction/components/TxPipeLine.tsx
index 7c728cf010..7abab5b7b9 100644
--- a/packages/apps/dev-wallet/src/pages/transaction/components/TxPipeLine.tsx
+++ b/packages/apps/dev-wallet/src/pages/transaction/components/TxPipeLine.tsx
@@ -10,8 +10,11 @@ import {
MonoCheck,
MonoClose,
MonoLoading,
+ MonoPauseCircle,
+ MonoSignature,
+ MonoViewInAr,
} from '@kadena/kode-icons/system';
-import { Stack, Text } from '@kadena/kode-ui';
+import { Button, Stack, Text } from '@kadena/kode-ui';
import classNames from 'classnames';
import { failureClass, pendingClass, successClass } from './style.css';
@@ -40,10 +43,24 @@ export const getStatusClass = (status: ITransaction['status']) => {
export function TxPipeLine({
tx,
variant,
-}: {
- tx: ITransaction;
- variant: 'tile' | 'expanded';
-}) {
+ signAll,
+ onSubmit,
+ sendDisabled,
+}:
+ | {
+ tx: ITransaction;
+ variant: 'tile';
+ signAll?: () => Promise;
+ onSubmit?: () => Promise;
+ sendDisabled?: boolean;
+ }
+ | {
+ tx: ITransaction;
+ variant: 'expanded';
+ signAll: () => Promise;
+ onSubmit: () => Promise;
+ sendDisabled?: boolean;
+ }) {
const textSize = variant === 'tile' ? 'smallest' : 'base';
const [contTx] = useAsync(
(transaction) =>
@@ -54,9 +71,37 @@ export function TxPipeLine({
: Promise.resolve(null),
[tx],
);
+ const showAfterCont = !contTx || variant === 'expanded';
return (
-
- {!contTx && statusPassed(tx.status, 'signed') && (
+
+
+
+ {tx.continuation?.autoContinue ? 'exec' : 'hash'}:{' '}
+ {shorten(tx.hash, 6)}
+
+
+ {showAfterCont &&
+ variant === 'expanded' &&
+ !statusPassed(tx.status, 'signed') && (
+
+
+
+
+ Waiting for sign
+
+
+
+ signAll()}
+ startVisual={}
+ >
+ Sign all possible signers
+
+
+
+ )}
+ {showAfterCont && statusPassed(tx.status, 'signed') && (
@@ -66,17 +111,50 @@ export function TxPipeLine({
)}
- {!contTx && statusPassed(tx.status, 'preflight') && (
+ {showAfterCont &&
+ variant === 'expanded' &&
+ statusPassed(tx.status, 'signed') &&
+ !statusPassed(tx.status, 'preflight') && (
+
+
+
+
+ {sendDisabled ? 'Send is pending' : 'Ready to send'}
+
+
+
+ }
+ >
+ Send transaction
+
+
+ )}
+ {showAfterCont && statusPassed(tx.status, 'preflight') && (
-
+
-
+ {tx.preflight?.result.status === 'success' ? (
+
+ ) : (
+
+ )}
preflight
)}
- {!contTx && statusPassed(tx.status, 'submitted') && (
+ {showAfterCont && statusPassed(tx.status, 'submitted') && (
@@ -86,7 +164,7 @@ export function TxPipeLine({
)}
- {!contTx &&
+ {showAfterCont &&
statusPassed(tx.status, 'submitted') &&
(!('result' in tx) || !tx.result) && (
diff --git a/packages/apps/dev-wallet/src/pages/transaction/components/TxTile.tsx b/packages/apps/dev-wallet/src/pages/transaction/components/TxTile.tsx
index 66b69507de..6e7757d0b0 100644
--- a/packages/apps/dev-wallet/src/pages/transaction/components/TxTile.tsx
+++ b/packages/apps/dev-wallet/src/pages/transaction/components/TxTile.tsx
@@ -1,21 +1,17 @@
import { ITransaction } from '@/modules/transaction/transaction.repository';
-import { shorten } from '@/utils/helpers';
import {
- MonoBrightness1,
MonoOpenInFull,
MonoSignature,
MonoViewInAr,
} from '@kadena/kode-icons/system';
import { Button, Stack, Text } from '@kadena/kode-ui';
-import classNames from 'classnames';
-
import { IPactCommand } from '@kadena/client';
import { Value } from './helpers';
import { codeClass, txTileClass, txTileContentClass } from './style.css';
-import { getStatusClass, TxPipeLine } from './TxPipeLine';
+import { TxPipeLine } from './TxPipeLine';
export const TxTile = ({
tx,
@@ -39,13 +35,6 @@ export const TxTile = ({
gap={'sm'}
>
-
-
- {tx.continuation?.autoContinue ? 'exec' : 'hash'}:{' '}
- {shorten(tx.hash, 6)}
-
-
-
{tx.status === 'initiated' && (
<>
diff --git a/packages/apps/dev-wallet/src/pages/transaction/components/style.css.ts b/packages/apps/dev-wallet/src/pages/transaction/components/style.css.ts
index 78867f9842..2a031205d8 100644
--- a/packages/apps/dev-wallet/src/pages/transaction/components/style.css.ts
+++ b/packages/apps/dev-wallet/src/pages/transaction/components/style.css.ts
@@ -66,7 +66,7 @@ export const pendingClass = style({
});
export const successClass = style({
- color: vars.colors.$positiveAccent,
+ color: vars.colors.$positiveSurface,
});
export const failureClass = style({
@@ -77,6 +77,14 @@ export const pendingText = style({
opacity: 0.5,
});
+export const textEllipsis = style({
+ overflow: 'hidden',
+ minHeight: '2.2em',
+ // overflowY: 'hidden',
+ whiteSpace: 'nowrap',
+ textOverflow: 'ellipsis',
+});
+
export const tabTextClass = style({
width: '50px',
overflow: 'hidden',
diff --git a/packages/apps/dev-wallet/src/pages/transfer-v2/Steps/TransferForm.tsx b/packages/apps/dev-wallet/src/pages/transfer-v2/Steps/TransferForm.tsx
index 5d00cf4ed1..26aaa6183f 100644
--- a/packages/apps/dev-wallet/src/pages/transfer-v2/Steps/TransferForm.tsx
+++ b/packages/apps/dev-wallet/src/pages/transfer-v2/Steps/TransferForm.tsx
@@ -31,6 +31,7 @@ import { IReceiverAccount } from '../../transfer/utils';
import { AccountItem } from '../Components/AccountItem';
import { Keyset } from '../Components/keyset';
import { CHAINS, IReceiver, discoverReceiver, getTransfers } from '../utils';
+import { labelClass } from './style.css';
export interface Transfer {
fungible: string;
@@ -43,6 +44,7 @@ export interface Transfer {
type: 'safeTransfer' | 'normalTransfer';
ttl: string;
senderAccount?: IAccount;
+ totalAmount: number;
}
export type Redistribution = {
@@ -62,6 +64,12 @@ export interface TrG {
txs: ITransaction[];
}
+const Label = ({ children }: { children: React.ReactNode }) => (
+
+ {children}
+
+);
+
export function TransferForm({
accountId,
onSubmit,
@@ -83,7 +91,6 @@ export function TransferForm({
const urlAccount = allAccounts.find((account) => account.uuid === accountId);
const {
control,
- register,
watch,
setValue,
reset,
@@ -110,6 +117,7 @@ export function TransferForm({
gasLimit: '2500',
type: 'normalTransfer',
ttl: (2 * 60 * 60).toString(),
+ totalAmount: 0,
},
});
@@ -154,6 +162,7 @@ export function TransferForm({
gasLimit: activity.data.transferData.gasLimit,
type: activity.data.transferData.type,
ttl: activity.data.transferData.ttl,
+ totalAmount: 0,
});
evaluateTransactions();
}
@@ -173,13 +182,14 @@ export function TransferForm({
[senderAccount?.chains],
);
- const watchReceivers = watch('receivers');
+ // console.log(watchReceivers);
+ // const watchReceivers = watch('receivers');
- console.log(watchReceivers);
+ // const totalAmount = watchReceivers.reduce((acc, receiver) => {
+ // return acc + +receiver.amount;
+ // }, 0);
- const totalAmount = watchReceivers.reduce((acc, receiver) => {
- return acc + +receiver.amount;
- }, 0);
+ const totalAmount = watch('totalAmount');
const evaluateTransactions = useCallback(() => {
const receivers = getValues('receivers');
@@ -187,6 +197,11 @@ export function TransferForm({
const gasLimit = getValues('gasLimit');
const gasPayer = getValues('gasPayer');
const selectedChain = getValues('chain');
+ const totalAmount = receivers.reduce(
+ (acc, receiver) => acc + +receiver.amount,
+ 0,
+ );
+ setValue('totalAmount', totalAmount);
setRedistribution([]);
setError(null);
try {
@@ -222,7 +237,7 @@ export function TransferForm({
return (...args: T[]) => {
const result = cb(...args);
clearTimeout(timer.current);
- timer.current = setTimeout(evaluateTransactions, 1000);
+ timer.current = setTimeout(evaluateTransactions, 100);
return result;
};
},
@@ -292,7 +307,8 @@ export function TransferForm({
render={({ field }) => (
-
-
- To
-
- {watchReceivers.map((rec, index) => {
- const availableChains = ['', ...CHAINS].filter((ch) => {
- // if the receiver is not the sender, then transfer is allowed from any chain
- if (rec.address !== senderAccount?.address) {
- return true;
- }
- // if the receiver is the sender, then the chains should be selected manually
- if (!ch || !senderChain) return false;
-
- // source and target chain should not be the same
- return ch !== senderChain;
- });
+ {
return (
-
- 1 ? 'row' : 'column'}
- gap="sm"
- justifyContent={'flex-start'}
- >
- (
-
- {
- console.log('value', value);
- field.onChange(value || '');
- setValue(
- `receivers.${index}.discoveredAccounts`,
- [],
- );
- setValue(
- `receivers.${index}.discoveryStatus`,
- 'not-started',
- );
- })}
- onBlur={async () => {
- if (!field.value) return;
- if (
- getValues(
- `receivers.${index}.discoveryStatus`,
- ) === 'done'
- ) {
- return;
- }
- setValue(
- `receivers.${index}.discoveryStatus`,
- 'in-progress',
- );
- const discoveredAccounts = await discoverReceiver(
- rec.address,
- activeNetwork!.networkId,
- getValues('fungible'),
- mapKeys,
- );
+ <>
+ {watchReceivers.map((rec, index) => {
+ const availableChains = ['', ...CHAINS].filter((ch) => {
+ // if the receiver is not the sender, then transfer is allowed from any chain
+ if (rec.address !== senderAccount?.address) {
+ return true;
+ }
+ // if the receiver is the sender, then the chains should be selected manually
+ if (!ch || !senderChain) return false;
- setValue(
- `receivers.${index}.discoveredAccounts`,
- discoveredAccounts,
- );
- setValue(
- `receivers.${index}.discoveryStatus`,
- 'done',
- );
- }}
- placeholder={`Receiver ${watchReceivers.length > 1 ? index + 1 : ''}`}
- size="sm"
- onSelectionChange={(key) => {
- field.onChange(key);
- if (key) {
- const account = filteredAccounts.find(
- (account) => account.address === key,
- );
- if (account?.keyset) {
- setValue(
- `receivers.${index}.discoveredAccounts`,
- [
- {
- ...account,
- keyset: account.keyset,
- },
- ],
- );
- } else {
- setValue(
- `receivers.${index}.discoveredAccounts`,
- [],
- );
- setValue(
- `receivers.${index}.discoveryStatus`,
- 'not-started',
- );
- }
- }
- }}
- allowsCustomValue
+ // source and target chain should not be the same
+ return ch !== senderChain;
+ });
+ return (
+ <>
+
+
- {filteredAccounts
- .filter(
- (account) =>
- account.address !== senderAccount?.address,
- // &&
- // !watchReceivers.some(
- // (receiver, i) =>
- // i !== index &&
- // receiver.address === account.address,
- // ),
- )
- .map((account) => (
-
+ Receiver{' '}
+ {watchReceivers.length > 1 ? `(${index + 1})` : ''}
+
+
+ <>
+ {watchReceivers.length > 1 && (
+ {
+ console.log('deleting', index);
+ const receivers = getValues('receivers');
+ receivers.splice(index, 1);
+ setValue('receivers', [...receivers]);
+ })}
+ >
+
+
+ )}
+ {
+ const list = [...watchReceivers];
+ const newItem = {
+ amount: rec.amount,
+ address: rec.address,
+ chain: '',
+ chunks: [],
+ discoveredAccounts:
+ rec.discoveryStatus === 'done'
+ ? rec.discoveredAccounts
+ : [],
+ discoveryStatus:
+ rec.discoveryStatus === 'done'
+ ? 'done'
+ : 'not-started',
+ } as Transfer['receivers'][number];
+ list.splice(index + 1, 0, newItem);
+ setValue('receivers', list);
+ evaluateTransactions();
+ }}
>
-
-
- ))}
-
-
- {rec.discoveryStatus === 'in-progress' && (
-
-
- Discovering...
-
+
+
+ >
- )}
- {rec.discoveryStatus === 'done' &&
- rec.discoveredAccounts.length === 1 && (
-
- )}
-
- )}
- />
+
-
-
-
- (
- r.target === rec.chain)
- ? `This will trigger balance redistribution`
- : ''
- }
- size="sm"
- placeholder="Chains"
- selectedKey={field.value}
- onSelectionChange={withEvaluate(field.onChange)}
+
+
- {(rec.amount ? availableChains : []).map(
- (chain) => (
-
- {chain ? (
-
- ) : (
-
- `chain ${c.chainId}: ${c.amount}`,
+ {
+ return (
+
+ Address:}
+ onInputChange={(value) => {
+ console.log('value', value);
+ field.onChange(value || '');
+ setValue(
+ `receivers.${index}.discoveredAccounts`,
+ [],
+ );
+ setValue(
+ `receivers.${index}.discoveryStatus`,
+ 'not-started',
+ );
+ }}
+ onBlur={async () => {
+ if (!field.value) return;
+ if (
+ getValues(
+ `receivers.${index}.discoveryStatus`,
+ ) === 'done'
+ ) {
+ return;
+ }
+ setValue(
+ `receivers.${index}.discoveryStatus`,
+ 'in-progress',
+ );
+ const discoveredAccounts =
+ await discoverReceiver(
+ rec.address,
+ activeNetwork!.networkId,
+ getValues('fungible'),
+ mapKeys,
+ );
+
+ setValue(
+ `receivers.${index}.discoveredAccounts`,
+ discoveredAccounts,
+ );
+ setValue(
+ `receivers.${index}.discoveryStatus`,
+ 'done',
+ );
+ }}
+ size="sm"
+ onSelectionChange={(value) => {
+ console.log('value', value);
+ field.onChange(value || '');
+ setValue(
+ `receivers.${index}.discoveredAccounts`,
+ [],
+ );
+ setValue(
+ `receivers.${index}.discoveryStatus`,
+ 'not-started',
+ );
+ }}
+ allowsCustomValue
+ >
+ {filteredAccounts
+ .filter(
+ (account) =>
+ account.address !==
+ senderAccount?.address,
+ // &&
+ // !watchReceivers.some(
+ // (receiver, i) =>
+ // i !== index &&
+ // receiver.address === account.address,
+ // ),
+ )
+ .map((account) => (
+
+
+
+ ))}
+
+
+ {
+ const discoveryStatus = field.value;
+ const discoveredAccounts = getValues(
+ `receivers.${index}.discoveredAccounts`,
+ );
+ return (
+ <>
+ {discoveryStatus ===
+ 'in-progress' && (
+
+
+ Discovering...
+
+
+ )}
+ {discoveryStatus === 'done' &&
+ discoveredAccounts.length ===
+ 1 && (
+
+ )}
+ >
+ );
+ }}
+ />
+
+ );
+ }}
+ />
+ (
+ {
+ const value = e.target.value;
+ field.onChange(value);
+ }}
+ placeholder="Enter the amount"
+ startVisual={}
+ onBlur={evaluateTransactions}
+ value={field.value}
+ size="sm"
+ type="number"
+ step="1"
+ />
+ )}
+ />
+
+
+ (
+ Chain:}
+ // label={index === 0 ? 'Chain' : undefined}
+ placeholder="Select a chain"
+ description={
+ rec.chain &&
+ redistribution.find(
+ (r) => r.target === rec.chain,
)
- .join('\n')}
+ ? `This will trigger balance redistribution`
+ : ''
+ }
+ size="sm"
+ selectedKey={field.value}
+ onSelectionChange={withEvaluate(
+ field.onChange,
+ )}
>
-
- {rec.chunks.length > 0 && (
- c.chainId)
- .join(' , ')}
- />
+ {(rec.amount ? availableChains : []).map(
+ (chain) => (
+
+ {chain ? (
+
+ ) : (
+
+ `chain ${c.chainId}: ${c.amount}`,
+ )
+ .join('\n')}
+ >
+
+ {rec.chunks.length > 0 && (
+ c.chainId)
+ .join(' , ')}
+ />
+ )}
+
+ )}
+
+ ),
)}
-
+
)}
-
- ),
+ />
+
+
+
+ {!availableChains.length && (
+
+ the receiver is the same as sender, therefor you
+ can not use automatic chain selection, please set
+ the both chains manually
+
+ )}
+ {rec.discoveredAccounts.length > 1 && (
+
+
+
+ more than one account found with this address,
+ please resolve the ambiguity{' '}
+ {
+ e.preventDefault();
+ setAccountToResolve({
+ account: rec,
+ index: index,
+ });
+ }}
+ >
+ Select correct
+
+
+
+
+ )}
+ {rec.discoveryStatus === 'done' &&
+ rec.discoveredAccounts.length === 0 && (
+
+
+
+ This account is not found on the blockchain
+ or address book. Please check the address
+ and try again. or add missing guard by
+ clicking on{' '}
+ {
+ e.preventDefault();
+ }}
+ >
+ Add account guard
+
+
+
+
)}
-
+
+
+ {error && (
+
+ Total amount ({totalAmount}) is more than the
+ available balance, please check your input, also you
+ should consider the gas fee
+
)}
- />
-
-
-
- {watchReceivers.length > 1 && (
- <>
- {
- console.log('deleting', index);
- const receivers = getValues('receivers');
- receivers.splice(index, 1);
- setValue('receivers', [...receivers]);
- })}
- >
-
-
- {
- const list = [...watchReceivers];
- const newItem = {
- amount: rec.amount,
- address: rec.address,
- chain: '',
- chunks: [],
- discoveredAccounts:
- rec.discoveryStatus === 'done'
- ? rec.discoveredAccounts
- : [],
- discoveryStatus:
- rec.discoveryStatus === 'done'
- ? 'done'
- : 'not-started',
- } as Transfer['receivers'][number];
- list.splice(index + 1, 0, newItem);
- setValue('receivers', list);
- evaluateTransactions();
- }}
- >
-
-
- >
- )}
-
-
- {!availableChains.length && (
-
- the receiver is the same as sender, therefor you can not use
- automatic chain selection, please set the both chains
- manually
-
- )}
- {rec.discoveredAccounts.length > 1 && (
-
-
-
- more than one account found with this address, please
- resolve the ambiguity{' '}
- {
- e.preventDefault();
- setAccountToResolve({
- account: rec,
- index: index,
- });
- }}
- >
- Select correct
-
-
-
-
- )}
- {rec.discoveryStatus === 'done' &&
- rec.discoveredAccounts.length === 0 && (
-
-
-
- This account is not found on the blockchain or address
- book. Please check the address and try again. or add
- missing guard by clicking on{' '}
+
+ {index === watchReceivers.length - 1 && (
+
{
- e.preventDefault();
+ className={linkClass}
+ onClick={() => {
+ const receivers = getValues('receivers');
+ setValue('receivers', [
+ ...receivers,
+ {
+ amount: '',
+ address: '',
+ chain: '',
+ chunks: [],
+ discoveredAccounts: [],
+ discoveryStatus: 'not-started',
+ },
+ ]);
}}
>
- Add account guard
+ + Add Receiver
-
-
-
- )}
-
+
+ )}
+ >
+ );
+ })}
+ >
);
- })}
-
- {
- const receivers = getValues('receivers');
- setValue('receivers', [
- ...receivers,
- {
- amount: '',
- address: '',
- chain: '',
- chunks: [],
- discoveredAccounts: [],
- discoveryStatus: 'not-started',
- },
- ]);
- }}
- >
- + Add Receiver
-
-
- {error && (
-
- Total amount ({totalAmount}) is more than the available balance,
- please check your input, also you should consider the gas fee
-
- )}
-
+ }}
+ />
+
(
Gas Payer:}
+ placeholder="Select the gas payer"
size="sm"
- placeholder="Gas Payer"
selectedKey={field.value}
onSelectionChange={withEvaluate(field.onChange)}
>
@@ -773,13 +846,14 @@ export function TransferForm({
control={control}
render={({ field }) => (
Gas Price:}
+ placeholder="Enter gas price"
value={field.value}
onChange={(e) => {
field.onChange(e.target.value);
// evaluateTransactions();
}}
onBlur={evaluateTransactions}
- placeholder="Gas Price"
size="sm"
defaultValue="0.00000001"
type="number"
@@ -792,12 +866,13 @@ export function TransferForm({
control={control}
render={({ field }) => (
Gas Limit:}
value={field.value}
onChange={(e) => {
field.onChange(e.target.value);
}}
onBlur={evaluateTransactions}
- placeholder="Gas Limit"
size="sm"
defaultValue="2500"
type="number"
@@ -813,13 +888,15 @@ export function TransferForm({
control={control}
render={({ field }) => (
TTL:}
+ placeholder="Enter TTL (Timer to live)"
value={field.value}
defaultValue={field.value}
onChange={(e) => {
field.onChange(+e.target.value);
}}
- placeholder="TTL (time to live)"
type="number"
+ size="sm"
/>
)}
/>
@@ -853,7 +930,7 @@ export function TransferForm({
{
(
- Normal transfer{' '}
+ Normal transfer
Sign by sender
) as any
@@ -864,7 +941,7 @@ export function TransferForm({
{
(
- Sate transfer{' '}
+ Safe transfer
Sign by both sender and receiver
diff --git a/packages/apps/dev-wallet/src/pages/transfer-v2/Steps/style.css.ts b/packages/apps/dev-wallet/src/pages/transfer-v2/Steps/style.css.ts
new file mode 100644
index 0000000000..e054d238be
--- /dev/null
+++ b/packages/apps/dev-wallet/src/pages/transfer-v2/Steps/style.css.ts
@@ -0,0 +1,10 @@
+import { tokens } from '@kadena/kode-ui/styles';
+import { style } from '@vanilla-extract/css';
+
+export const labelClass = style({
+ minWidth: '90px',
+ display: 'flex',
+ background: tokens.kda.foundation.color.background.surface.default,
+ padding: '8px',
+ marginLeft: '-12px',
+});
diff --git a/packages/apps/dev-wallet/src/pages/transfer-v2/transfer-v2.tsx b/packages/apps/dev-wallet/src/pages/transfer-v2/transfer-v2.tsx
index 2f45311d9e..cba57d1580 100644
--- a/packages/apps/dev-wallet/src/pages/transfer-v2/transfer-v2.tsx
+++ b/packages/apps/dev-wallet/src/pages/transfer-v2/transfer-v2.tsx
@@ -3,18 +3,7 @@ import { useWallet } from '@/modules/wallet/wallet.hook';
import { ISigner } from '@kadena/client';
import { MonoSwapHoriz } from '@kadena/kode-icons/system';
-import {
- Button,
- Dialog,
- DialogFooter,
- DialogHeader,
- Divider,
- Heading,
- Stack,
- Step,
- Stepper,
- Text,
-} from '@kadena/kode-ui';
+import { Divider, Heading, Stack, Step, Stepper, Text } from '@kadena/kode-ui';
import { useCallback, useEffect, useState } from 'react';
import { activityRepository } from '@/modules/activity/activity.repository';
@@ -26,7 +15,6 @@ import { useSearchParams } from 'react-router-dom';
import { ReviewTransaction } from '../transaction/components/ReviewTransaction';
import { TxList } from '../transaction/components/TxList';
import { statusPassed } from '../transaction/components/TxPipeLine';
-import { Result } from './Steps/Result';
import {
Redistribution,
TrG,
@@ -205,9 +193,21 @@ export function TransferV2() {
const reTxs = txGroups.redistribution.txs;
const submitIsDisabled =
reTxs.length > 0 && reTxs.some((tx) => !tx.continuation?.done);
+
+ const onlyOneTx = txGroups.transfer.txs.length === 1 && reTxs.length === 0;
return (
- {reTxs.length > 0 && (
+ {onlyOneTx && (
+ {
+ console.log('update');
+ reloadTxs();
+ }}
+ txs={txGroups.transfer.txs}
+ showExpanded={true}
+ />
+ )}
+ {!onlyOneTx && reTxs.length > 0 && (
<>
@@ -225,7 +225,7 @@ export function TransferV2() {
>
)}
- {txGroups.transfer.txs.length > 0 && (
+ {!onlyOneTx && txGroups.transfer.txs.length > 0 && (
Transfer Transactions
@@ -252,14 +252,6 @@ export function TransferV2() {
return (
- {step === 'result' && (
-
- )}
}
@@ -333,7 +325,6 @@ export function TransferV2() {
)}
{(step === 'sign' || step === 'result') && renderSignStep()}
- {step === 'summary' && }
);
}
diff --git a/packages/apps/dev-wallet/src/pages/transfer/style.css.ts b/packages/apps/dev-wallet/src/pages/transfer/style.css.ts
index cdfd271eca..aa555bf721 100644
--- a/packages/apps/dev-wallet/src/pages/transfer/style.css.ts
+++ b/packages/apps/dev-wallet/src/pages/transfer/style.css.ts
@@ -1,8 +1,8 @@
-import { tokens } from '@kadena/kode-ui/styles';
+import { tokens, vars } from '@kadena/kode-ui/styles';
import { style } from '@vanilla-extract/css';
export const linkClass = style({
- color: tokens.kda.foundation.color.palette.aqua.n50,
+ color: vars.colors.$positiveSurface,
background: 'transparent',
textAlign: 'left',
border: 'none',