Skip to content

Commit

Permalink
fix: update logic to consider asset chain
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo committed Feb 28, 2024
1 parent 6a8bea2 commit 59ea959
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,19 @@ export const BuyWithCryptoModal = (props: Props) => {
])

const renderBuyNowButton = useCallback(() => {
let onClick =
selectedToken?.symbol === 'MANA' &&
selectedChain === ChainId.MATIC_MAINNET
? onBuyNatively
: handleCrossChainBuy
// if L1 and paying with ETH MANA => native buy
let onClick: () => Promise<void> | unknown = handleCrossChainBuy
if (selectedToken?.symbol === 'MANA') {
if (
(asset.chainId === ChainId.ETHEREUM_MAINNET &&
selectedChain === ChainId.ETHEREUM_MAINNET) ||
(asset.chainId === ChainId.MATIC_MAINNET &&
selectedChain === ChainId.MATIC_MAINNET)
) {
onClick = onBuyNatively
}
}
// if L2 and paying with MATIC MANA => native buy

return (
<>
Expand Down

0 comments on commit 59ea959

Please sign in to comment.