Skip to content

Commit

Permalink
network switching tweaks part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Dec 10, 2024
1 parent aac4b00 commit df23201
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion frontend/src/hooks/useBalanceDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function useBalanceDisplay() {
title: 'Switching Network',
message: `Please confirm the network switch in your wallet...`,
txHash: tempTxId,
stage: 'initiated',
autoHide: false,
});

Expand All @@ -95,6 +96,7 @@ export function useBalanceDisplay() {
title: 'Network Switched',
message: `Successfully switched to ${chainNames[chainId] || `Chain ${chainId}`}`,
txHash: tempTxId,
stage: 'confirmed',
autoHide: true,
});
} catch (switchError) {
Expand All @@ -104,6 +106,7 @@ export function useBalanceDisplay() {
title: 'Network Not Found',
message: 'Please add this network to your wallet first.',
txHash: tempTxId,
stage: 'confirmed',
autoHide: true,
});
} else {
Expand All @@ -116,6 +119,7 @@ export function useBalanceDisplay() {
? switchError.message
: 'Failed to switch network. Please switch manually.',
txHash: tempTxId,
stage: 'confirmed',
autoHide: true,
});
}
Expand Down Expand Up @@ -150,7 +154,6 @@ export function useBalanceDisplay() {
);

const handleInitiateWithdrawal = useCallback((lockId: string) => {
// Remove manual network switching since wagmi will handle it
setSelectedLockId(lockId);
setIsWithdrawalDialogOpen(true);
}, []);
Expand All @@ -173,6 +176,7 @@ export function useBalanceDisplay() {
title: 'Switching Network',
message: `Please confirm the network switch in your wallet...`,
txHash: tempTxId,
stage: 'initiated',
autoHide: false,
});

Expand All @@ -193,6 +197,7 @@ export function useBalanceDisplay() {
title: 'Network Switched',
message: `Successfully switched to ${chainNames[chainId] || `Chain ${chainId}`}`,
txHash: tempTxId,
stage: 'confirmed',
autoHide: true,
});
} catch (switchError) {
Expand All @@ -202,6 +207,7 @@ export function useBalanceDisplay() {
title: 'Network Not Found',
message: 'Please add this network to your wallet first.',
txHash: tempTxId,
stage: 'confirmed',
autoHide: true,
});
} else {
Expand All @@ -214,6 +220,7 @@ export function useBalanceDisplay() {
? switchError.message
: 'Failed to switch network. Please switch manually.',
txHash: tempTxId,
stage: 'confirmed',
autoHide: true,
});
}
Expand Down

0 comments on commit df23201

Please sign in to comment.