Skip to content

Commit 91a4a88

Browse files
committed
fix: handle optional payment crypto object
1 parent 9260274 commit 91a4a88

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ui/hooks/subscription/useAddFundTrigger.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ export const useShieldSubscriptionCryptoSufficientBalanceCheck = () => {
5555
?.find(
5656
(chain) =>
5757
chain.chainId.toLowerCase() ===
58-
cryptoPaymentInfo?.crypto.chainId.toLowerCase(),
58+
cryptoPaymentInfo?.crypto?.chainId.toLowerCase(),
5959
)
6060
?.tokens.find(
6161
(token) =>
6262
token.symbol.toLowerCase() ===
63-
cryptoPaymentInfo?.crypto.tokenSymbol.toLowerCase(),
63+
cryptoPaymentInfo?.crypto?.tokenSymbol.toLowerCase(),
6464
)
6565
: undefined;
6666

6767
const paymentChainIds = useMemo(
68-
() => (cryptoPaymentInfo ? [cryptoPaymentInfo.crypto.chainId] : []),
68+
() => (cryptoPaymentInfo ? [cryptoPaymentInfo.crypto?.chainId] : []),
6969
[cryptoPaymentInfo],
7070
);
7171

@@ -84,7 +84,7 @@ export const useShieldSubscriptionCryptoSufficientBalanceCheck = () => {
8484
}
8585

8686
const params = {
87-
chainId: cryptoPaymentInfo.crypto.chainId,
87+
chainId: cryptoPaymentInfo.crypto?.chainId,
8888
paymentTokenAddress: selectedTokenPrice.address,
8989
productType: PRODUCT_TYPES.SHIELD,
9090
interval: shieldSubscription.interval,
@@ -108,7 +108,7 @@ export const useShieldSubscriptionCryptoSufficientBalanceCheck = () => {
108108

109109
const token = evmBalances.find(
110110
(t) =>
111-
cryptoPaymentInfo.crypto.chainId === t.chainId &&
111+
cryptoPaymentInfo.crypto?.chainId === t.chainId &&
112112
selectedTokenPrice.address.toLowerCase() === t.address.toLowerCase(),
113113
);
114114
if (!token || !token.balance) {

0 commit comments

Comments
 (0)