Skip to content

Commit 25577bb

Browse files
authored
fix: add currency address to skip native balance check (#417)
* fix: add currency address to skip native balance check * refactor: change property structure
1 parent d6b2d26 commit 25577bb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/checkout/src/contexts/SelectPaymentModal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface SelectPaymentSettings {
4747
customProviderCallback?: (onSuccess: (txHash: string) => void, onError: (error: Error) => void, onClose: () => void) => void
4848
supplementaryAnalyticsInfo?: SupplementaryAnalyticsInfo
4949
skipNativeBalanceCheck?: boolean
50+
nativeTokenAddress?: string
5051
}
5152

5253
type SelectPaymentModalContext = {

packages/checkout/src/views/PaymentSelection/PayWithCrypto/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const PayWithCrypto = ({
2929
const [showMore, setShowMore] = useState(false)
3030
const { enableSwapPayments = true, enableMainCurrencyPayment = true } = settings
3131

32-
const { chain, currencyAddress, price, skipNativeBalanceCheck } = settings
32+
const { chain, currencyAddress, price, skipNativeBalanceCheck, nativeTokenAddress } = settings
3333
const { address: userAddress } = useAccount()
3434
const { clearCachedBalances } = useClearCachedBalances()
3535
const network = findSupportedNetwork(chain)
@@ -47,7 +47,7 @@ export const PayWithCrypto = ({
4747
accountAddresses: userAddress ? [userAddress] : [],
4848
contractStatus: ContractVerificationStatus.ALL,
4949
contractWhitelist: [currencyAddress],
50-
omitNativeBalances: skipNativeBalanceCheck ?? false
50+
omitNativeBalances: skipNativeBalanceCheck ? true : false
5151
},
5252
omitMetadata: true,
5353
page: { pageSize: 40 }
@@ -145,7 +145,7 @@ export const PayWithCrypto = ({
145145
<div className="flex flex-col justify-center items-center gap-2 w-full">
146146
{coins.map(coin => {
147147
if (compareAddress(coin.currencyAddress, currencyAddress)) {
148-
const isNative = compareAddress(coin.currencyAddress, zeroAddress)
148+
const isNative = compareAddress(coin.currencyAddress, nativeTokenAddress || zeroAddress)
149149
const isNativeBalanceCheckSkipped = isNative && skipNativeBalanceCheck
150150

151151
return (

0 commit comments

Comments
 (0)