diff --git a/components/brave_wallet_ui/page/screens/fund-wallet/components/create_account/create_account.tsx b/components/brave_wallet_ui/page/screens/fund-wallet/components/create_account/create_account.tsx index 4f944cdb5936..1f6d38cc1759 100644 --- a/components/brave_wallet_ui/page/screens/fund-wallet/components/create_account/create_account.tsx +++ b/components/brave_wallet_ui/page/screens/fund-wallet/components/create_account/create_account.tsx @@ -47,7 +47,10 @@ import { Column, Row, Text } from '../../../../../components/shared/style' interface Props extends DialogProps { isOpen: boolean token?: MeldCryptoCurrency - onSelectToken: (asset: MeldCryptoCurrency) => void + onSelectToken: ( + asset: MeldCryptoCurrency, + account?: BraveWallet.AccountInfo + ) => void onClose: () => void } @@ -92,7 +95,7 @@ export const CreateAccount = (props: Props) => { }).unwrap() if (account) { - onSelectToken(token) + onSelectToken(token, account) } } catch (error) { console.log(error) diff --git a/components/brave_wallet_ui/page/screens/fund-wallet/hooks/useBuy.ts b/components/brave_wallet_ui/page/screens/fund-wallet/hooks/useBuy.ts index 7214b8033dc0..38b988f60cbf 100644 --- a/components/brave_wallet_ui/page/screens/fund-wallet/hooks/useBuy.ts +++ b/components/brave_wallet_ui/page/screens/fund-wallet/hooks/useBuy.ts @@ -395,10 +395,12 @@ export const useBuy = () => { ) const onSelectToken = useCallback( - async (asset: MeldCryptoCurrency) => { + async (asset: MeldCryptoCurrency, account?: BraveWallet.AccountInfo) => { const incomingAssetsCoinType = getMeldTokensCoinType(asset) const accountToUse = - selectedAccount.accountId.coin !== incomingAssetsCoinType + account !== undefined + ? account + : selectedAccount.accountId.coin !== incomingAssetsCoinType ? getFirstAccountByCoinType(incomingAssetsCoinType, accounts) : selectedAccount if (!accountToUse) {