Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useSelector } from 'react-redux';
import { addTransactionBatch } from '../../../../util/transaction-controller';
import { selectDefaultEndpointByChainId } from '../../../../selectors/networkController';
import { selectSelectedInternalAccountAddress } from '../../../../selectors/accountsController';
import { selectSelectedInternalAccountByScope } from '../../../../selectors/multichainAccounts/accounts';
import { generateTransferData } from '../../../../util/transactions';
import { useConfirmNavigation } from '../../../Views/confirmations/hooks/useConfirmNavigation';
import { ConfirmationLoader } from '../../../Views/confirmations/components/confirm/confirm-component';
Expand Down Expand Up @@ -63,7 +64,14 @@ function isUserRejectedError(error: unknown, fallbackMessage: string): boolean {
* CustomAmount / MetaMask Pay experience.
*/
export function usePerpsWithdrawConfirmation() {
const selectedAccount = useSelector(selectSelectedInternalAccountAddress);
// Perps withdraws settle on Arbitrum, so the batch must originate from the
// selected group's EVM account; the globally selected account can be non-EVM.
const selectedAccount = useSelector((state: RootState) => {
const evmAddress = state.engine?.backgroundState?.AccountTreeController
? selectSelectedInternalAccountByScope(state)('eip155:1')?.address
: undefined;
return evmAddress ?? selectSelectedInternalAccountAddress(state);
});
const { navigateToConfirmation } = useConfirmNavigation();
const navigation = useNavigation();
const { showToast, PerpsToastOptions } = usePerpsToasts();
Expand Down
Loading