(null);
@@ -77,6 +83,12 @@ export default function ConfirmationDialog({
}
}, [response]);
+ useEffect(() => {
+ if (response !== null && isColdWalletUnsignedMode) {
+ setActiveTab('json');
+ }
+ }, [response, isColdWalletUnsignedMode]);
+
const reset = () => {
setPending(false);
setSignature(null);
@@ -512,7 +524,7 @@ export default function ConfirmationDialog({
-
+
- {
- setPending(true);
-
- (async () => {
- let finalSignature: string | null = signature;
-
- if (
- !finalSignature &&
- response !== null &&
- 'coin_spends' in response
- ) {
- if (!(await promptIfEnabled())) return;
+ {isColdWalletUnsignedMode ? (
+
+
+
+
+ Submit
+
+
+
+
+
+ Cold wallets cannot sign transactions. Copy the JSON and sign
+ externally.
+
+
+
+ ) : (
+ {
+ setPending(true);
+
+ (async () => {
+ let finalSignature: string | null = signature;
+
+ if (
+ !finalSignature &&
+ response !== null &&
+ 'coin_spends' in response
+ ) {
+ if (!(await promptIfEnabled())) return;
+
+ const data = await commands
+ .signCoinSpends({
+ coin_spends: response.coin_spends,
+ })
+ .catch(addError);
+
+ if (!data) return reset();
+
+ finalSignature = data.spend_bundle.aggregated_signature;
+ }
const data = await commands
- .signCoinSpends({
- coin_spends: response.coin_spends,
+ .submitTransaction({
+ spend_bundle: {
+ coin_spends:
+ response === null
+ ? []
+ : 'coin_spends' in response
+ ? response.coin_spends
+ : response.spend_bundle.coin_spends,
+ aggregated_signature: finalSignature ?? '',
+ },
})
.catch(addError);
if (!data) return reset();
- finalSignature = data.spend_bundle.aggregated_signature;
- }
-
- const data = await commands
- .submitTransaction({
- spend_bundle: {
- coin_spends:
- response === null
- ? []
- : 'coin_spends' in response
- ? response.coin_spends
- : response.spend_bundle.coin_spends,
- aggregated_signature: finalSignature ?? '',
- },
- })
- .catch(addError);
-
- if (!data) return reset();
-
- toast.success(t`Transaction submitted successfully`);
- onConfirm?.();
- reset();
- })().finally(() => setPending(false));
- }}
- >
- Submit
-
+ toast.success(t`Transaction submitted successfully`);
+ onConfirm?.();
+ reset();
+ })().finally(() => setPending(false));
+ }}
+ >
+ Submit
+
+ )}
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx
index 9298f620f..d80346b81 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -8,13 +8,14 @@ import {
import { useInsets } from '@/contexts/SafeAreaContext';
import { useWallet } from '@/contexts/WalletContext';
import { t } from '@lingui/core/macro';
-import { PanelLeft, PanelLeftClose } from 'lucide-react';
+import { PanelLeft, PanelLeftClose, Snowflake } from 'lucide-react';
import { PropsWithChildren } from 'react';
import { useLocation } from 'react-router-dom';
import { Insets } from 'tauri-plugin-safe-area-insets';
import { useTheme } from 'theme-o-rama';
import { useLocalStorage } from 'usehooks-ts';
import { BottomNav, TopNav } from './Nav';
+import { Banner } from './Banner';
import { WalletSwitcher } from './WalletSwitcher';
function WalletTransitionWrapper({
@@ -22,7 +23,7 @@ function WalletTransitionWrapper({
props,
insets,
}: PropsWithChildren<{ props: LayoutProps; insets: Insets }>) {
- const { isSwitching, wallet } = useWallet();
+ const { isSwitching, wallet, isReadOnly } = useWallet();
// Only show content if we have a wallet or we're not switching
// This prevents old wallet data from showing during transition
@@ -43,7 +44,23 @@ function WalletTransitionWrapper({
: 'env(safe-area-inset-bottom)',
}}
>
- {shouldShow ? children : null}
+ {shouldShow ? (
+ <>
+ {isReadOnly && (
+
+ }
+ />
+ )}
+ {children}
+ >
+ ) : null}
);
}
@@ -99,7 +116,6 @@ export function FullLayout(props: LayoutProps) {
aria-label={
isCollapsed ? t`Expand sidebar` : t`Collapse sidebar`
}
- aria-expanded={!isCollapsed}
>
{isCollapsed ? (
diff --git a/src/components/NftCard.tsx b/src/components/NftCard.tsx
index 44257646d..4a35263f6 100644
--- a/src/components/NftCard.tsx
+++ b/src/components/NftCard.tsx
@@ -11,6 +11,7 @@ import { amount } from '@/lib/formTypes';
import { nftUri } from '@/lib/nftUri';
import { toMojos } from '@/lib/utils';
import { useWalletState } from '@/state';
+import { useWallet } from '@/contexts/WalletContext';
import { zodResolver } from '@hookform/resolvers/zod';
import { t } from '@lingui/core/macro';
import { Trans } from '@lingui/react/macro';
@@ -94,6 +95,7 @@ interface NftCardProps {
export function NftCard({ nft, updateNfts, selectionState }: NftCardProps) {
const walletState = useWalletState();
+ const { isTransactionDisabled } = useWallet();
const [offerState, setOfferState] = useOfferStateWithDefault();
const navigate = useNavigate();
@@ -401,7 +403,7 @@ export function NftCard({ nft, updateNfts, selectionState }: NftCardProps) {
e.stopPropagation();
setTransferOpen(true);
}}
- disabled={!nft.created_height}
+ disabled={isTransactionDisabled || !nft.created_height}
aria-label={t`Transfer ${nftName}`}
>
@@ -416,7 +418,7 @@ export function NftCard({ nft, updateNfts, selectionState }: NftCardProps) {
e.stopPropagation();
setAssignOpen(true);
}}
- disabled={!nft.created_height}
+ disabled={isTransactionDisabled || !nft.created_height}
aria-label={
nft.owner_did === null ? t`Assign profile` : t`Edit profile`
}
@@ -438,7 +440,7 @@ export function NftCard({ nft, updateNfts, selectionState }: NftCardProps) {
addUrlForm.reset();
setAddUrlOpen(true);
}}
- disabled={!nft.created_height}
+ disabled={isTransactionDisabled || !nft.created_height}
aria-label={t`Add URL to ${nftName}`}
>
@@ -453,7 +455,7 @@ export function NftCard({ nft, updateNfts, selectionState }: NftCardProps) {
e.stopPropagation();
setBurnOpen(true);
}}
- disabled={!nft.created_height}
+ disabled={isTransactionDisabled || !nft.created_height}
aria-label={t`Burn ${nftName}`}
>
@@ -484,6 +486,7 @@ export function NftCard({ nft, updateNfts, selectionState }: NftCardProps) {
});
}}
disabled={
+ isTransactionDisabled ||
!nft.created_height ||
offerState.offered.nfts.findIndex(
(nftId) => nftId === nft.launcher_id,
diff --git a/src/components/OwnedCoinsCard.tsx b/src/components/OwnedCoinsCard.tsx
index abebb4237..96f849698 100644
--- a/src/components/OwnedCoinsCard.tsx
+++ b/src/components/OwnedCoinsCard.tsx
@@ -21,6 +21,7 @@ import { Input } from '@/components/ui/input';
import { useErrors } from '@/hooks/useErrors';
import { amount } from '@/lib/formTypes';
import { fromMojos, toMojos } from '@/lib/utils';
+import { useWallet } from '@/contexts/WalletContext';
import { useWalletState } from '@/state';
import { zodResolver } from '@hookform/resolvers/zod';
import { t } from '@lingui/core/macro';
@@ -62,6 +63,7 @@ export function OwnedCoinsCard({
setSelectedCoins,
}: OwnedCoinsCardProps) {
const walletState = useWalletState();
+ const { isTransactionDisabled } = useWallet();
const { addError } = useErrors();
@@ -439,7 +441,7 @@ export function OwnedCoinsCard({
<>