Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Iris Wallet",
"homepage_url": "https://iriswallet.io",
"version": "1.2.2",
"version": "1.2.3",
"description": "Iris Wallet - Browser Wallet for Nockchain",
"icons": {
"16": "icons/icon16.png",
Expand Down
1 change: 1 addition & 0 deletions extension/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function Popup() {
await refreshWalletAccounts();
void fetchBalance();
})();
return;
}
};

Expand Down
10 changes: 10 additions & 0 deletions extension/popup/assets/SwapIconAsset-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions extension/popup/assets/swap_icon.svg

This file was deleted.

18 changes: 18 additions & 0 deletions extension/popup/components/icons/SwapIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* SwapIcon — matches home action row; uses currentColor for light/dark themes.
*/

interface IconProps {
className?: string;
}

export function SwapIcon({ className = 'w-5 h-5' }: IconProps) {
return (
<svg className={className} viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M15.7209 2.76018L12.8958 5.58526C12.5718 5.90928 12.7946 6.45607 13.2502 6.45607H15.0627V13.4226C15.0627 14.4351 14.3843 15.3768 13.3819 15.5388C12.1162 15.7515 11.0125 14.7693 11.0125 13.5441V6.6282C11.0125 4.51193 9.46322 2.62855 7.35708 2.42604C6.79466 2.37094 6.22693 2.43414 5.6904 2.61158C5.15387 2.78903 4.66041 3.07678 4.24174 3.45635C3.82308 3.83591 3.48847 4.29889 3.25944 4.81551C3.03041 5.33213 2.91203 5.89096 2.91189 6.45607V13.5441H1.09939C0.643735 13.5441 0.420969 14.0908 0.744992 14.4047L3.57006 17.2298C3.77258 17.4323 4.08647 17.4323 4.28899 17.2298L7.11406 14.4047C7.18403 14.3334 7.23131 14.2429 7.24993 14.1447C7.26855 14.0465 7.25769 13.9449 7.2187 13.8529C7.17972 13.7608 7.11437 13.6824 7.03087 13.6274C6.94738 13.5725 6.84949 13.5435 6.74953 13.5441H4.93703V6.57758C4.93703 5.565 5.61545 4.62331 6.6179 4.4613C7.88361 4.24866 8.98731 5.23086 8.98731 6.45607V13.3719C8.98731 15.4882 10.5365 17.3716 12.6427 17.5741C15.0526 17.807 17.0879 15.9135 17.0879 13.5441V6.45607H18.9004C19.356 6.45607 19.5788 5.90928 19.2548 5.59538L16.4297 2.77031C16.2373 2.5678 15.9133 2.5678 15.7209 2.76018Z"
fill="currentColor"
/>
</svg>
);
}
44 changes: 24 additions & 20 deletions extension/popup/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useState, useLayoutEffect, useEffect, useRef, useMemo } from 'react';
import { useStore } from '../store';
import { useTheme } from '../contexts/ThemeContext';
import { truncateAddress } from '../utils/format';
import { send } from '../utils/messaging';
import { ERROR_CODES, INTERNAL_METHODS, NOCK_TO_NICKS, STORAGE_KEYS } from '../../shared/constants';
Expand Down Expand Up @@ -33,7 +32,8 @@ import { resolveCounterpartyAccount } from '../../shared/account-lock-roots';
import { isMigrationWalletTx } from '../../shared/v0-migration';
import { isBridgeWalletTx } from '../../shared/bridge-config';
import { useLockRootAccountMap } from '../hooks/useLockRootAccountMap';
import SwapIconAsset from '../assets/swap_icon.svg';
import { SwapIcon } from '../components/icons/SwapIcon';
import SwapIconAssetDark from '../assets/SwapIconAsset-dark.svg';
import BaseIconAsset from '../assets/base_icon.svg';
import { SwapSubmittedToast } from '../components/SwapSubmittedToast';

Expand All @@ -60,7 +60,6 @@ export function HomeScreen() {
refreshWalletAccounts,
setSettingsAccountAddress,
} = useStore();
const { theme } = useTheme();
const lockRootToAccount = useLockRootAccountMap(wallet.accounts);

const [balanceHidden, setBalanceHidden] = useState(false);
Expand Down Expand Up @@ -265,25 +264,28 @@ export function HomeScreen() {
}>(INTERNAL_METHODS.SWITCH_ACCOUNT, [accountAddress]);

if (result?.ok && result.account) {
// Get cached balance for the new account (or 0 if not cached)
const cachedBalance = wallet.accountBalances[result.account.address] ?? 0;
const latest = useStore.getState().wallet;
const addr = result.account.address;
const cachedBalance = latest.accountBalances[addr] ?? 0;
const cachedSpendable = latest.accountSpendableBalances?.[addr] ?? cachedBalance;

const updatedWallet = {
...wallet,
...latest,
currentAccount: result.account,
address: result.account.address,
activeSeedSourceId: result.activeSeedSourceId ?? wallet.activeSeedSourceId,
address: addr,
activeSeedSourceId: result.activeSeedSourceId ?? latest.activeSeedSourceId,
balance: cachedBalance,
availableBalance: cachedBalance,
spendableBalance: cachedSpendable,
};
syncWallet(updatedWallet);
setWalletDropdownOpen(false);

// Fetch balance and transactions for the switched account
fetchBalance();
fetchWalletTransactions();
// SYNC_UTXOS (incl. Nockblocks) must finish before tx list is reliable; fetchBalance awaits post-sync tx reload.
await fetchBalance();
} else {
setWalletDropdownOpen(false);
}

setWalletDropdownOpen(false);
}

// Account creation handler
Expand All @@ -307,11 +309,8 @@ export function HomeScreen() {
async function handleRefreshBalance() {
setIsRefreshing(true);
try {
// Fetch balance (which syncs UTXOs from chain)
// Fetch balance (syncs UTXOs + Nockblocks); fetchBalance already reloads transactions.
await fetchBalance();

// Fetch latest wallet transactions
await fetchWalletTransactions();
} finally {
setIsRefreshing(false);
// Connection status is automatically re-checked by useEffect when isBalanceFetching changes
Expand Down Expand Up @@ -874,9 +873,14 @@ export function HomeScreen() {
}}
onClick={() => navigate('swap')}
>
<div className="relative h-5 w-5">
<img src={SwapIconAsset} alt="Swap" className="h-5 w-5" />
</div>
<span className="theme-icon-pair h-5 w-5">
<SwapIcon className="theme-icon-light h-full w-full" />
<img
src={SwapIconAssetDark}
alt=""
className="theme-icon-dark h-full w-full object-contain"
/>
</span>
Swap
</button>
<button
Expand Down
37 changes: 5 additions & 32 deletions extension/popup/screens/SendReviewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export function SendReviewScreen() {

try {
const amountInNicks = nockToNick(lastTransaction.amount);
const feeInNicks = nockToNick(lastTransaction.fee);
const feeInNicks =
lastTransaction.feeNicks !== undefined && lastTransaction.feeNicks !== null
? Math.round(lastTransaction.feeNicks)
: nockToNick(lastTransaction.fee);

// Send transaction using V2 (builds, locks notes, broadcasts atomically)
// If sendMax is true, this is a sweep transaction (all UTXOs to recipient)
Expand Down Expand Up @@ -100,7 +103,7 @@ export function SendReviewScreen() {

return (
<div
className="relative w-[357px] h-[600px] flex flex-col"
className="w-[357px] h-[600px] flex flex-col"
style={{ backgroundColor: 'var(--color-bg)', color: 'var(--color-text-primary)' }}
>
{/* Header */}
Expand Down Expand Up @@ -308,36 +311,6 @@ export function SendReviewScreen() {
</button>
</div>
</div>
{isSending && (
<div
className="absolute inset-0 z-[60] flex items-center justify-center p-5"
style={{ backgroundColor: 'rgba(0,0,0,0.55)' }}
>
<div
className="w-full rounded-[20px] border p-5 flex flex-col items-center gap-3 text-center"
style={{
backgroundColor: 'var(--color-bg)',
borderColor: 'var(--color-surface-700)',
color: 'var(--color-text-primary)',
}}
>
<div
className="w-8 h-8 border-2 rounded-full animate-spin"
style={{
borderColor: 'var(--color-text-muted)',
borderTopColor: 'var(--color-primary)',
}}
/>
<div className="text-[16px] font-medium">Signing and submitting transaction</div>
<div
className="text-[13px] leading-[18px]"
style={{ color: 'var(--color-text-muted)' }}
>
Signing and submitting your transaction. This could take a while.
</div>
</div>
</div>
)}
</div>
);
}
Loading
Loading