diff --git a/components/Send/SendForm.tsx b/components/Send/SendForm.tsx index 87df25a23..3c6b4e33a 100644 --- a/components/Send/SendForm.tsx +++ b/components/Send/SendForm.tsx @@ -11,6 +11,7 @@ import Max from '@/components/Max'; import RenderTokenIcon from '@/components/RenderTokenIcon'; import { Button } from '@/components/ui/button'; import { Text } from '@/components/ui/text'; +import { CHAIN_NAMES } from '@/constants/chains'; import { SEND_MODAL } from '@/constants/modals'; import { TRACKING_EVENTS } from '@/constants/tracking-events'; import { useWalletTokens } from '@/hooks/useWalletTokens'; @@ -233,9 +234,18 @@ const SendForm: React.FC = ({ onNext }) => { })} size={28} /> - - {selectedToken.contractTickerSymbol} - + + + {selectedToken.contractTickerSymbol} + + {/* The send executes on this chain; USDC on Base and USDC on + Fuse otherwise look identical here. */} + {CHAIN_NAMES[selectedToken.chainId] ? ( + + on {CHAIN_NAMES[selectedToken.chainId]} + + ) : null} + ) : ( diff --git a/components/Send/SendReview.tsx b/components/Send/SendReview.tsx index 19b8a7069..f2d991b37 100644 --- a/components/Send/SendReview.tsx +++ b/components/Send/SendReview.tsx @@ -1,8 +1,9 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Control } from 'react-hook-form'; -import { ActivityIndicator, View } from 'react-native'; +import { ActivityIndicator, Pressable, View } from 'react-native'; import Toast from 'react-native-toast-message'; import { Image } from 'expo-image'; +import { useQuery } from '@tanstack/react-query'; import { Address } from 'viem'; import { useShallow } from 'zustand/react/shallow'; @@ -11,8 +12,10 @@ import Wallet from '@/assets/images/wallet'; import NeedHelp from '@/components/NeedHelp'; import RenderTokenIcon from '@/components/RenderTokenIcon'; import { Button } from '@/components/ui/button'; +import { Checkbox } from '@/components/ui/checkbox'; import { Text } from '@/components/ui/text'; import { getBridgeChain } from '@/constants/bridge'; +import { CHAIN_NAMES } from '@/constants/chains'; import { SEND_MODAL } from '@/constants/modals'; import { TRACKING_EVENTS } from '@/constants/tracking-events'; import { useActivity } from '@/hooks/useActivity'; @@ -21,33 +24,76 @@ import { useIsContract } from '@/hooks/useIsContract'; import useSend from '@/hooks/useSend'; import { useTotp } from '@/hooks/useTotp'; import { track } from '@/lib/analytics'; +import { fetchAddressBook } from '@/lib/api'; import { sanitizeTechnicalMessage, showFailureSheet } from '@/lib/errors'; import getTokenIcon from '@/lib/getTokenIcon'; -import { - BRIDGE_PAYMASTER_RECIPIENT_ERROR, - isBridgePaymasterAddress, -} from '@/lib/protocolAddresses'; +import { isProtocolAddress, PROTOCOL_ADDRESS_RECIPIENT_ERROR } from '@/lib/protocolAddresses'; +import { getExpectedRecipientChainId } from '@/lib/sendRecipients'; import { Status, TokenType } from '@/lib/types'; -import { cn, eclipseAddress, formatNumber } from '@/lib/utils'; +import { cn, eclipseAddress, formatNumber, withRefreshToken } from '@/lib/utils'; import { getChain } from '@/lib/wagmi'; import { useSendStore } from '@/store/useSendStore'; import ContractAddressWarning from './ContractAddressWarning'; import SaveContact from './SaveContact'; +const chainName = (chainId: number) => + CHAIN_NAMES[chainId] ?? getChain(chainId)?.name ?? `chain ${chainId}`; + const SendReview: React.FC = () => { - const { selectedToken, amount, address, name, setTransaction, setModal, setName } = useSendStore( + const { + selectedToken, + amount, + address, + name, + recipientChainId, + setTransaction, + setModal, + setName, + } = useSendStore( useShallow(state => ({ selectedToken: state.selectedToken, amount: state.amount, address: state.address, name: state.name, + recipientChainId: state.recipientChainId, setTransaction: state.setTransaction, setModal: state.setModal, setName: state.setName, })), ); - const { refetchAll } = useActivity(); + const { activities, refetchAll } = useActivity(); + const { + data: addressBook, + isError: isAddressBookError, + isFetching: isAddressBookFetching, + refetch: refetchAddressBook, + } = useQuery({ + queryKey: ['address-book'], + queryFn: () => withRefreshToken(() => fetchAddressBook()), + staleTime: 5 * 60 * 1000, + gcTime: 10 * 60 * 1000, + }); + // A regular send always executes on the token's chain. When this recipient is + // known on another network (picked in the bridge flow, a saved contact's, or + // the last send's), say so and make the user confirm before sending. + const expectedChainId = getExpectedRecipientChainId( + address, + activities, + addressBook ?? [], + recipientChainId, + ); + const isNetworkMismatch = + !!selectedToken && !!expectedChainId && expectedChainId !== selectedToken.chainId; + // Without the address book a saved contact's network is unknown, and an empty + // list would read as "no expected network" and skip the check. A picked + // network doesn't need it. Hold Send while it loads; if it fails, offer a + // retry and make the user confirm the network themselves. + const isAddressBookMissing = !recipientChainId && !addressBook; + const isCheckingRecipient = isAddressBookMissing && !isAddressBookError; + const isRecipientCheckFailed = isAddressBookMissing && isAddressBookError; + const needsNetworkConfirmation = isNetworkMismatch || isRecipientCheckFailed; + const [networkConfirmed, setNetworkConfirmed] = useState(false); const { send, sendStatus, totpModal } = useSend({ tokenAddress: selectedToken?.contractAddress as any, @@ -81,17 +127,20 @@ const SendReview: React.FC = () => { const { isVerified: isTotpVerified } = useTotp(); const isSendLoading = sendStatus === Status.PENDING; - const isBridgePaymasterRecipient = isBridgePaymasterAddress(address); + const isProtocolRecipient = isProtocolAddress(address); const showSkip2fa = isTotpVerified && !hasSkipped2fa; const isContact = !name || showSkip2fa; const getButtonText = () => { if (isSendLoading) return 'Sending'; + if (isCheckingRecipient) return 'Checking recipient'; return 'Send'; }; const handleSend = async () => { if (!selectedToken || !amount || !address) return; + if (isCheckingRecipient) return; + if (needsNetworkConfirmation && !networkConfirmed) return; const nameValue = watchName('name'); const skip2fa = watchName('skip2fa'); @@ -112,6 +161,7 @@ const SendReview: React.FC = () => { amount: amount.toString(), to_address: address, source: 'send_modal', + ...(isNetworkMismatch ? { expected_chain_id: expectedChainId } : {}), }); const transaction = await send(amount.toString(), address as Address); @@ -243,9 +293,9 @@ const SendReview: React.FC = () => { - {isBridgePaymasterRecipient ? ( + {isProtocolRecipient ? ( - {BRIDGE_PAYMASTER_RECIPIENT_ERROR} + {PROTOCOL_ADDRESS_RECIPIENT_ERROR} ) : ( isContract && ( @@ -253,6 +303,73 @@ const SendReview: React.FC = () => { ) )} + {isNetworkMismatch && expectedChainId ? ( + + + Check the network: this sends on {chainName(selectedToken.chainId)} + + + {recipientChainId + ? `You chose ${chainName(expectedChainId)} for this recipient` + : `Your last send to this address was on ${chainName(expectedChainId)}`} + , but this sends {selectedToken.contractTickerSymbol} on{' '} + {chainName(selectedToken.chainId)}. If the recipient can't receive on{' '} + {chainName(selectedToken.chainId)} (exchange deposit addresses often can't), the + funds can be lost. + + setNetworkConfirmed(value => !value)} + className="flex-row items-center gap-3" + > + + + The recipient can receive {selectedToken.contractTickerSymbol} on{' '} + {chainName(selectedToken.chainId)} + + + + ) : null} + + {isRecipientCheckFailed ? ( + + + Couldn't check this recipient's network + + + Your contacts didn't load, so we can't tell which network this address was + saved on. This sends {selectedToken.contractTickerSymbol} on{' '} + {chainName(selectedToken.chainId)}. + + void refetchAddressBook()} + disabled={isAddressBookFetching} + className="flex-row items-center gap-2 self-start" + > + + {isAddressBookFetching ? 'Retrying' : 'Retry'} + + {isAddressBookFetching && } + + {!isNetworkMismatch && ( + setNetworkConfirmed(value => !value)} + className="flex-row items-center gap-3" + > + + + The recipient can receive {selectedToken.contractTickerSymbol} on{' '} + {chainName(selectedToken.chainId)} + + + )} + + ) : null} + {isContact && ( } @@ -282,11 +399,16 @@ const SendReview: React.FC = () => { variant="brand" className="h-12 rounded-xl" onPress={handleSend} - disabled={isSendLoading || isBridgePaymasterRecipient} + disabled={ + isSendLoading || + isCheckingRecipient || + isProtocolRecipient || + (needsNetworkConfirmation && !networkConfirmed) + } > {getButtonText()} - {isSendLoading && } + {(isSendLoading || isCheckingRecipient) && } diff --git a/components/Send/TokenSelector.tsx b/components/Send/TokenSelector.tsx index 2c5f34d6c..9231aca0a 100644 --- a/components/Send/TokenSelector.tsx +++ b/components/Send/TokenSelector.tsx @@ -32,6 +32,7 @@ const TokenSelector: React.FC = () => { setDestinationChainId, setCrossChainQuote, setCrossChainEntry, + setRecipientChainId, } = useSendStore( useShallow(state => ({ selectedToken: state.selectedToken, @@ -43,6 +44,7 @@ const TokenSelector: React.FC = () => { setDestinationChainId: state.setDestinationChainId, setCrossChainQuote: state.setCrossChainQuote, setCrossChainEntry: state.setCrossChainEntry, + setRecipientChainId: state.setRecipientChainId, })), ); // Opened from the cross-chain amount step, only the two bridgeable Fuse @@ -122,6 +124,9 @@ const TokenSelector: React.FC = () => { if (!isCrossChainSendToken(token)) { // Not on Fuse, so no bridge: hand over to the regular send on the // token's own chain, keeping the recipient address already entered. + // The network picked for that recipient is kept so Review can warn + // that this send lands on the token's chain instead. + if (destinationChainId) setRecipientChainId(destinationChainId); setIsCrossChain(false); setDestinationChainId(null); setCrossChainQuote(null); @@ -143,6 +148,7 @@ const TokenSelector: React.FC = () => { setDestinationChainId, setCrossChainQuote, setCrossChainEntry, + setRecipientChainId, config?.enabled, ], ); diff --git a/hooks/useAddressBook.ts b/hooks/useAddressBook.ts index 80a9de192..69725aa71 100644 --- a/hooks/useAddressBook.ts +++ b/hooks/useAddressBook.ts @@ -9,10 +9,7 @@ import { useShallow } from 'zustand/react/shallow'; import { addToAddressBook, fetchAddressBook } from '@/lib/api'; import { showErrorToast } from '@/lib/errors'; -import { - BRIDGE_PAYMASTER_RECIPIENT_ERROR, - isBridgePaymasterAddress, -} from '@/lib/protocolAddresses'; +import { isProtocolAddress, PROTOCOL_ADDRESS_RECIPIENT_ERROR } from '@/lib/protocolAddresses'; import { AddressBookRequest } from '@/lib/types'; import { withRefreshToken } from '@/lib/utils'; import { recipientNextModal, useSendStore } from '@/store/useSendStore'; @@ -30,8 +27,8 @@ const walletAddressField = z .string() .refine(val => val.trim().length > 0, { error: 'Address is required' }) .refine(val => isAddress(val.trim()), { error: 'Please enter a valid Ethereum address' }) - .refine(val => !isBridgePaymasterAddress(val.trim()), { - error: BRIDGE_PAYMASTER_RECIPIENT_ERROR, + .refine(val => !isProtocolAddress(val.trim()), { + error: PROTOCOL_ADDRESS_RECIPIENT_ERROR, }) .transform(val => val.trim()); diff --git a/hooks/useCrossChainSend.ts b/hooks/useCrossChainSend.ts index fbcc7e0aa..9423d41f4 100644 --- a/hooks/useCrossChainSend.ts +++ b/hooks/useCrossChainSend.ts @@ -12,10 +12,7 @@ import { getTotpStatus, verifyTotp } from '@/lib/api'; import { authoriseCrossChainSend } from '@/lib/api/cross-chain-send'; import { getUserErrorMessage, sanitizeTechnicalMessage, showFailureSheet } from '@/lib/errors'; import { executeTransactions, USER_CANCELLED_TRANSACTION } from '@/lib/execute'; -import { - BRIDGE_PAYMASTER_RECIPIENT_ERROR, - isBridgePaymasterAddress, -} from '@/lib/protocolAddresses'; +import { isProtocolAddress, PROTOCOL_ADDRESS_RECIPIENT_ERROR } from '@/lib/protocolAddresses'; import { Status, TransactionType } from '@/lib/types'; import { CrossChainSendAuthorised, @@ -115,8 +112,8 @@ const useCrossChainSend = () => { // Nothing is deployed at our bridge contract's address on the // destination chains: a voucher to it delivers the funds to no one. - if (isBridgePaymasterAddress(params.recipient)) { - throw new Error(BRIDGE_PAYMASTER_RECIPIENT_ERROR); + if (isProtocolAddress(params.recipient)) { + throw new Error(PROTOCOL_ADDRESS_RECIPIENT_ERROR); } setSendStatus(Status.PENDING); diff --git a/hooks/useSend.ts b/hooks/useSend.ts index 23e58c94b..ef13c1112 100644 --- a/hooks/useSend.ts +++ b/hooks/useSend.ts @@ -10,10 +10,7 @@ import { useActivityActions } from '@/hooks/useActivityActions'; import { track } from '@/lib/analytics'; import { getTotpStatus, verifyTotp } from '@/lib/api'; import { executeTransactions, USER_CANCELLED_TRANSACTION } from '@/lib/execute'; -import { - BRIDGE_PAYMASTER_RECIPIENT_ERROR, - isBridgePaymasterAddress, -} from '@/lib/protocolAddresses'; +import { isProtocolAddress, PROTOCOL_ADDRESS_RECIPIENT_ERROR } from '@/lib/protocolAddresses'; import { Status, TokenType, TransactionType } from '@/lib/types'; import { getChain } from '@/lib/wagmi'; @@ -82,8 +79,8 @@ const useSend = ({ // Last line of defence: no screen may hand a transfer to our bridge // contract's address — it credits no one, on any chain. - if (isBridgePaymasterAddress(to)) { - throw new Error(BRIDGE_PAYMASTER_RECIPIENT_ERROR); + if (isProtocolAddress(to)) { + throw new Error(PROTOCOL_ADDRESS_RECIPIENT_ERROR); } track(TRACKING_EVENTS.SEND_TRANSACTION_INITIATED, { diff --git a/lib/__tests__/sendRecipients.test.ts b/lib/__tests__/sendRecipients.test.ts index 415f6a4c7..864426fc1 100644 --- a/lib/__tests__/sendRecipients.test.ts +++ b/lib/__tests__/sendRecipients.test.ts @@ -1,5 +1,9 @@ import { ADDRESSES } from '@/lib/config'; -import { getRecentSendRecipients, isRecentSendActivity } from '@/lib/sendRecipients'; +import { + getExpectedRecipientChainId, + getRecentSendRecipients, + isRecentSendActivity, +} from '@/lib/sendRecipients'; import { ActivityEvent, TransactionStatus, TransactionType } from '@/lib/types'; function send( @@ -77,6 +81,20 @@ describe('recent send recipients', () => { ); expect(recipients.map(recipient => recipient.walletAddress)).toEqual(['0xabc']); }); + + it('never offers a backend smart account as a recipient', () => { + // Deposit pulls from a Safe are indexed as sends to these accounts; two + // users then sent their soUSD to the Connect-Wallet account (Nov 2026). + const recipients = getRecentSendRecipients( + [ + send('0x9e852a0d1bd9738d52b90a5e907138575822d69e', '300', { chainId: 56 }), + send('0x54C11A6185907bC464fa6aCA0901Aea9DbDD08Fe', '250', { chainId: 8453 }), + send('0xabc', '100'), + ], + [], + ); + expect(recipients.map(recipient => recipient.walletAddress)).toEqual(['0xabc']); + }); }); describe('isRecentSendActivity', () => { @@ -85,3 +103,38 @@ describe('isRecentSendActivity', () => { expect(isRecentSendActivity(send(ADDRESSES.fuse.bridgePaymasterAddress, '1'))).toBe(false); }); }); + +describe('getExpectedRecipientChainId', () => { + // sdelkin23, Oct 29 2026: 102 USDC bridged to Arbitrum for 0x0900…, then a + // regular send of USDC on Base to the same address 41 seconds later. + const arbitrumBridge = send('0x0900f6fccaac6193e40625e310099d1956b311d7', '200', { + type: TransactionType.CROSS_CHAIN_SEND, + chainId: 122, + metadata: { dstChainId: 42161 }, + }); + + it('expects the receiving network of the last send, whatever the casing', () => { + expect( + getExpectedRecipientChainId( + '0x0900F6FccAac6193e40625E310099D1956B311d7', + [ + send('0x0900f6fccaac6193e40625e310099d1956b311d7', '100', { chainId: 122 }), + arbitrumBridge, + ], + [], + ), + ).toBe(42161); + }); + + it('prefers the network picked in the bridge flow, then a saved contact', () => { + expect(getExpectedRecipientChainId('0xabc', [send('0xabc', '1')], [], 8453)).toBe(8453); + expect( + getExpectedRecipientChainId('0xabc', [], [{ walletAddress: '0xABC', chainId: 56 }]), + ).toBe(56); + }); + + it('knows nothing about a new address', () => { + expect(getExpectedRecipientChainId('0xnew', [arbitrumBridge], [])).toBeUndefined(); + expect(getExpectedRecipientChainId('', [arbitrumBridge], [])).toBeUndefined(); + }); +}); diff --git a/lib/protocolAddresses.ts b/lib/protocolAddresses.ts index 1e7077ed5..42e3d20a7 100644 --- a/lib/protocolAddresses.ts +++ b/lib/protocolAddresses.ts @@ -1,20 +1,34 @@ import { ADDRESSES } from '@/lib/config'; /** - * Our own BridgePaymasters. A transfer to one is the source leg of a bridge, - * never a payment to a person: a plain transfer to the paymaster credits no - * one, and on every other chain nothing is deployed at these addresses. They - * must never become a send recipient — a Base send to the Fuse paymaster's - * address lost a user 23.88 USDC (Nov 2026). + * Backend smart accounts. Each is a SimpleAccount at the same address on every + * chain; they pull and bridge deposits and hold the backend's float. A deposit + * pull from a user's Safe is indexed as a plain send to one, so they used to + * show up as recent recipients — users then sent soUSD to the Connect-Wallet + * account, where nothing credits it back (Nov 2026). */ -const BRIDGE_PAYMASTERS = new Set( - [ADDRESSES.fuse.bridgePaymasterAddress, ADDRESSES.ethereum.bridgePaymasterAddress].map(address => - address.toLowerCase(), - ), +const CONNECT_WALLET_ACCOUNT = '0x9e852a0D1Bd9738d52b90a5E907138575822D69e'; +const DIRECT_DEPOSIT_ACCOUNT = '0x54C11A6185907bC464fa6aCA0901Aea9DbDD08Fe'; + +/** + * Solid's own contracts and accounts, never a person's wallet. They must never + * become a send recipient: + * - BridgePaymasters: a transfer to one is the source leg of a bridge and + * credits no one, and on other chains nothing is deployed at the address. A + * Base send to the Fuse paymaster's address lost a user 23.88 USDC (Nov 2026). + * - The backend smart accounts above. + */ +const PROTOCOL_ADDRESSES = new Set( + [ + ADDRESSES.fuse.bridgePaymasterAddress, + ADDRESSES.ethereum.bridgePaymasterAddress, + CONNECT_WALLET_ACCOUNT, + DIRECT_DEPOSIT_ACCOUNT, + ].map(address => address.toLowerCase()), ); -export const isBridgePaymasterAddress = (address?: string | null): boolean => - !!address && BRIDGE_PAYMASTERS.has(address.toLowerCase()); +export const isProtocolAddress = (address?: string | null): boolean => + !!address && PROTOCOL_ADDRESSES.has(address.toLowerCase()); -export const BRIDGE_PAYMASTER_RECIPIENT_ERROR = - 'This is Solid’s bridge contract, not a wallet. Anything sent to it is lost. Check the address.'; +export const PROTOCOL_ADDRESS_RECIPIENT_ERROR = + 'This address belongs to Solid’s own system, not a wallet. Anything sent to it doesn’t reach anyone. Check the address.'; diff --git a/lib/sendRecipients.ts b/lib/sendRecipients.ts index 357b5c356..099e942ce 100644 --- a/lib/sendRecipients.ts +++ b/lib/sendRecipients.ts @@ -1,4 +1,4 @@ -import { isBridgePaymasterAddress } from '@/lib/protocolAddresses'; +import { isProtocolAddress } from '@/lib/protocolAddresses'; import { ActivityEvent, AddressBookResponse, @@ -15,8 +15,9 @@ export interface SendRecipient { /** * A successful send to someone, as a recent recipient. A bridge's source leg - * is indexed as a plain send to our BridgePaymaster; offering that address as - * a recipient sent a user's funds to it, so it never counts. + * and a deposit pull are indexed as plain sends to our own contracts (the + * BridgePaymaster, the backend smart accounts); offering those as recipients + * sent users' funds to them, so they never count. */ export function isRecentSendActivity( activity: ActivityEvent, @@ -25,7 +26,7 @@ export function isRecentSendActivity( [TransactionType.SEND, TransactionType.CROSS_CHAIN_SEND].includes(activity.type) && activity.status === TransactionStatus.SUCCESS && !!activity.toAddress && - !isBridgePaymasterAddress(activity.toAddress) + !isProtocolAddress(activity.toAddress) ); } @@ -60,3 +61,29 @@ export function getRecentSendRecipients( }; }); } + +/** + * The network a send to this address is expected to land on, or undefined for + * an address with no history: the network the user picked for it in the bridge + * flow, else the network shown on its recipient row (the saved contact's, else + * the last send's — the receiving network for a cross-chain send). + * + * The regular send always executes on the picked token's chain, so a recipient + * last paid on Arbitrum (often an exchange deposit address) could be sent USDC + * on Base without a word; Review compares the two with this. + */ +export function getExpectedRecipientChainId( + walletAddress: string | undefined, + activities: ActivityEvent[], + addressBook: AddressBookResponse[], + pickedChainId?: number | null, +): number | undefined { + if (pickedChainId) return pickedChainId; + if (!walletAddress) return undefined; + const key = walletAddress.toLowerCase(); + return ( + getRecentSendRecipients(activities, addressBook).find( + recipient => recipient.walletAddress.toLowerCase() === key, + )?.chainId ?? addressBook.find(entry => entry.walletAddress.toLowerCase() === key)?.chainId + ); +} diff --git a/store/useSendStore.ts b/store/useSendStore.ts index 3126a7aae..bd1887e22 100644 --- a/store/useSendStore.ts +++ b/store/useSendStore.ts @@ -31,6 +31,13 @@ interface SendState { crossChainEntry: 'recipient' | 'token'; /** Cross-chain send: the network the recipient receives on. */ destinationChainId: number | null; + /** + * The network the user picked for this recipient in the bridge flow, kept + * when they then switch to a token on another chain (a regular send on that + * token's chain). Review warns when the send would land elsewhere. Cleared + * whenever the recipient changes. + */ + recipientChainId: number | null; /** Cross-chain send: the quote the Review step shows and the voucher is priced against. */ crossChainQuote: CrossChainSendQuote | null; /** Cross-chain send: the authorised send, tracked on the "On its way" screen. */ @@ -47,6 +54,7 @@ interface SendState { setIsCrossChain: (isCrossChain: boolean) => void; setCrossChainEntry: (entry: 'recipient' | 'token') => void; setDestinationChainId: (chainId: number | null) => void; + setRecipientChainId: (chainId: number | null) => void; setCrossChainQuote: (quote: CrossChainSendQuote | null) => void; setCrossChainSend: (send: CrossChainSendRecord | null) => void; clearForm: () => void; @@ -66,6 +74,7 @@ const EMPTY_FORM = { isCrossChain: false, crossChainEntry: 'recipient' as 'recipient' | 'token', destinationChainId: null, + recipientChainId: null, crossChainQuote: null, crossChainSend: null, }; @@ -88,12 +97,18 @@ export const useSendStore = create()((set, get) => ({ setCurrentTokenAddress: address => set({ currentTokenAddress: address }), setSelectedToken: token => set({ selectedToken: token }), setAmount: amount => set({ amount }), - setAddress: address => set({ address }), + setAddress: address => + set(state => + state.address.toLowerCase() === address.toLowerCase() + ? { address } + : { address, recipientChainId: null }, + ), setName: name => set({ name }), setSearchQuery: query => set({ searchQuery: query }), setIsCrossChain: isCrossChain => set({ isCrossChain }), setCrossChainEntry: crossChainEntry => set({ crossChainEntry }), setDestinationChainId: chainId => set({ destinationChainId: chainId }), + setRecipientChainId: chainId => set({ recipientChainId: chainId }), setCrossChainQuote: quote => set({ crossChainQuote: quote }), setCrossChainSend: send => set({ crossChainSend: send }), clearForm: () => set({ ...EMPTY_FORM }),