Skip to content
Merged
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 @@ -81,7 +81,9 @@ export const PayWithCryptoTab = ({ skipOnCloseCallback, isSwitchingChainRef }: P
chainId: chain
}

// Check if the target currency (what the item is priced in) is native
const isNativeToken = compareAddress(currencyAddress, zeroAddress)
// Check if the selected currency (what the user is paying with) is native
const isNativeTokenSelectedCurrency = compareAddress(selectedCurrency.address, zeroAddress)

const { data: tokenBalancesData, isLoading: tokenBalancesIsLoading } = useGetTokenBalancesSummary({
Expand Down Expand Up @@ -163,14 +165,14 @@ export const PayWithCryptoTab = ({ skipOnCloseCallback, isSwitchingChainRef }: P
address: currencyAddress as Hex,
args: [userAddress, approvedSpenderAddress || targetContractAddress],
query: {
enabled: !!userAddress && !isNativeTokenSelectedCurrency
enabled: !!userAddress && !isNativeToken
}
})

const isLoading =
isLoadingCoinPrice ||
isLoadingCurrencyInfo ||
(allowanceIsLoading && !isNativeTokenSelectedCurrency) ||
(allowanceIsLoading && !isNativeToken) ||
isLoadingSwapQuote ||
tokenBalancesIsLoading ||
isLoadingSelectedCurrencyInfo
Expand Down Expand Up @@ -352,7 +354,7 @@ export const PayWithCryptoTab = ({ skipOnCloseCallback, isSwitchingChainRef }: P
: {})
},
// Actual transaction optional approve step
...(isApproved || isNativeTokenSelectedCurrency
...(isApproved || isNativeToken
? []
: [
{
Expand Down