Skip to content

Commit

Permalink
Uplift of #26954 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-builds committed Dec 12, 2024
1 parent af054fc commit a53e611
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -92,7 +95,7 @@ export const CreateAccount = (props: Props) => {
}).unwrap()

if (account) {
onSelectToken(token)
onSelectToken(token, account)
}
} catch (error) {
console.log(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a53e611

Please sign in to comment.