Skip to content

Commit

Permalink
Fix: Possible to start a transfer with disabled route (#2387)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuli-ferna authored Aug 19, 2024
1 parent eb6afc6 commit d6e99ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 1 addition & 3 deletions wormhole-connect/src/components/ConnectWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ function ConnectWallet(props: Props) {
(popupState?: any) => {
if (disabled) return;
if (popupState) popupState.close();
if (side === 'destination' && manualAddressTarget) {
dispatch(setManualAddressTarget(false));
}

dispatch(setWalletModal(type));
},
[disabled, manualAddressTarget],
Expand Down
8 changes: 7 additions & 1 deletion wormhole-connect/src/views/WalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ function WalletsModal(props: Props) {
const connect = async (walletInfo: WalletData) => {
const chain = type === TransferWallet.SENDING ? fromChain : toChain;
dispatch(setWalletModal(false));
if (
type === TransferWallet.RECEIVING &&
walletInfo.name !== MANUAL_WALLET_NAME
) {
dispatch(setManualAddressTarget(false));
}
if (props.onClose) props.onClose();
await connectWallet(props.type, chain!, walletInfo, dispatch);
};
Expand Down Expand Up @@ -240,6 +246,7 @@ function WalletsModal(props: Props) {

const handleManualConnect = (address: string) => {
const wallet = new ManualWallet(address);
dispatch(setManualAddressTarget(true));
wallet.on('connect', () => dispatch(setManualAddressTarget(true)));
wallet.on('disconnect', () => dispatch(setManualAddressTarget(false)));
connect({
Expand All @@ -253,7 +260,6 @@ function WalletsModal(props: Props) {

const [isManual, setIsManual] = useState(false);
const toggleManual = () => {
dispatch(setManualAddressTarget(!isManual));
setIsManual(!isManual);
};

Expand Down

0 comments on commit d6e99ae

Please sign in to comment.