diff --git a/examples/_deprecated/checkout-widget/basic-react/package.json b/examples/_deprecated/checkout-widget/basic-react/package.json index 33ab9e2085..4dd133249e 100644 --- a/examples/_deprecated/checkout-widget/basic-react/package.json +++ b/examples/_deprecated/checkout-widget/basic-react/package.json @@ -23,7 +23,7 @@ "@typescript-eslint/parser": "^7.11.0", "@vitejs/plugin-react": "^4.3.0", "eslint": "^8.57.0", - "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.7", "typescript": "^5.2.2", "vite": "^5.2.14", diff --git a/examples/_deprecated/checkout-widget/passport-integration-react/package.json b/examples/_deprecated/checkout-widget/passport-integration-react/package.json index 1f2d5455bd..5645d27221 100644 --- a/examples/_deprecated/checkout-widget/passport-integration-react/package.json +++ b/examples/_deprecated/checkout-widget/passport-integration-react/package.json @@ -22,7 +22,7 @@ "@vitejs/plugin-react": "^4.3.0", "eslint": "^8.57.0", "eslint-plugin-react": "^7.34.1", - "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.7", "vite": "^5.2.14", "vite-plugin-node-polyfills": "^0.22.0" diff --git a/examples/_deprecated/free-mint-with-minting-backend/frontend/package.json b/examples/_deprecated/free-mint-with-minting-backend/frontend/package.json index 38aa81bec4..3f53dc9dcf 100644 --- a/examples/_deprecated/free-mint-with-minting-backend/frontend/package.json +++ b/examples/_deprecated/free-mint-with-minting-backend/frontend/package.json @@ -34,7 +34,7 @@ "@typescript-eslint/parser": "^7.1.1", "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.57.0", - "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.7", "typescript": "^5.2.2", "vite": "^5.2.14", diff --git a/packages/checkout/widgets-lib/.eslintrc.cjs b/packages/checkout/widgets-lib/.eslintrc.cjs index a47461fa66..ba81e7bbd4 100644 --- a/packages/checkout/widgets-lib/.eslintrc.cjs +++ b/packages/checkout/widgets-lib/.eslintrc.cjs @@ -1,5 +1,8 @@ module.exports = { - "extends": ["../../../.eslintrc"], + "extends": [ + "../../../.eslintrc", + "plugin:react-hooks/recommended-legacy" + ], "ignorePatterns": ["jest.config.*", "rollup.config.*"], "parser": "@typescript-eslint/parser", "parserOptions": { diff --git a/packages/checkout/widgets-lib/package.json b/packages/checkout/widgets-lib/package.json index 4724fdf6bf..648716e75f 100644 --- a/packages/checkout/widgets-lib/package.json +++ b/packages/checkout/widgets-lib/package.json @@ -65,6 +65,7 @@ "@types/react-dom": "^18.3.0", "@types/uuid": "^8.3.4", "eslint": "^8.40.0", + "eslint-plugin-react-hooks": "^5.2.0", "jest": "^29.4.3", "jest-environment-jsdom": "^29.4.3", "react-scripts": "5.0.1", diff --git a/packages/checkout/widgets-lib/src/components/CoinSelector/CoinSelector.tsx b/packages/checkout/widgets-lib/src/components/CoinSelector/CoinSelector.tsx index a57fe60540..6ea5e31784 100644 --- a/packages/checkout/widgets-lib/src/components/CoinSelector/CoinSelector.tsx +++ b/packages/checkout/widgets-lib/src/components/CoinSelector/CoinSelector.tsx @@ -43,6 +43,7 @@ export function CoinSelector({ return options; } return filterOptions(searchValue, options); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [options, searchValue, filterOptions]); const handleCloseDrawer = () => { diff --git a/packages/checkout/widgets-lib/src/components/ConnectLoader/ConnectLoader.tsx b/packages/checkout/widgets-lib/src/components/ConnectLoader/ConnectLoader.tsx index ed63e46e43..27529489b6 100644 --- a/packages/checkout/widgets-lib/src/components/ConnectLoader/ConnectLoader.tsx +++ b/packages/checkout/widgets-lib/src/components/ConnectLoader/ConnectLoader.tsx @@ -239,6 +239,7 @@ export function ConnectLoader({ }); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, walletProviderName, browserProvider]); return ( diff --git a/packages/checkout/widgets-lib/src/components/FormComponents/SelectForm/SelectForm.tsx b/packages/checkout/widgets-lib/src/components/FormComponents/SelectForm/SelectForm.tsx index d04cb46bda..5ec7ae9987 100644 --- a/packages/checkout/widgets-lib/src/components/FormComponents/SelectForm/SelectForm.tsx +++ b/packages/checkout/widgets-lib/src/components/FormComponents/SelectForm/SelectForm.tsx @@ -56,6 +56,7 @@ export function SelectForm({ onSelectChange(option.id); setCoinSelectorOpen(false); }, + // eslint-disable-next-line react-hooks/exhaustive-deps })), [options, onSelectChange, setCoinSelectorOpen]); const getSelectedOption = () => { @@ -76,6 +77,7 @@ export function SelectForm({ controlType: 'Select', action: 'Opened', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [setCoinSelectorOpen, track]); return ( diff --git a/packages/checkout/widgets-lib/src/components/NetworkSwitchDrawer/NetworkSwitchDrawer.tsx b/packages/checkout/widgets-lib/src/components/NetworkSwitchDrawer/NetworkSwitchDrawer.tsx index 696eb7dd0d..c9eceb1535 100644 --- a/packages/checkout/widgets-lib/src/components/NetworkSwitchDrawer/NetworkSwitchDrawer.tsx +++ b/packages/checkout/widgets-lib/src/components/NetworkSwitchDrawer/NetworkSwitchDrawer.tsx @@ -91,6 +91,7 @@ export function NetworkSwitchDrawer({ switchNetworkEthImage.src = ethImageUrl; const switchNetworkzkEVMImage = new Image(); switchNetworkzkEVMImage.src = zkevmImageUrl; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/components/RouteFees/RouteFees.tsx b/packages/checkout/widgets-lib/src/components/RouteFees/RouteFees.tsx index e1368b96c6..8619c6ecbc 100644 --- a/packages/checkout/widgets-lib/src/components/RouteFees/RouteFees.tsx +++ b/packages/checkout/widgets-lib/src/components/RouteFees/RouteFees.tsx @@ -37,6 +37,7 @@ export function RouteFees({ }, prefix: '', })) ?? [], + // eslint-disable-next-line react-hooks/exhaustive-deps [routeData], ); @@ -54,6 +55,7 @@ export function RouteFees({ }, prefix: '', })) ?? [], + // eslint-disable-next-line react-hooks/exhaustive-deps [routeData], ); diff --git a/packages/checkout/widgets-lib/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx b/packages/checkout/widgets-lib/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx index 9dca7db538..ea77bdbf8a 100644 --- a/packages/checkout/widgets-lib/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx +++ b/packages/checkout/widgets-lib/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx @@ -78,6 +78,7 @@ export function RouteOptionsDrawer({ routesAvailable: routes?.length ?? 0, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [visible]); return ( diff --git a/packages/checkout/widgets-lib/src/components/SelectedRouteOption/SelectedRouteOption.tsx b/packages/checkout/widgets-lib/src/components/SelectedRouteOption/SelectedRouteOption.tsx index fcbfa38593..e17e15ac41 100644 --- a/packages/checkout/widgets-lib/src/components/SelectedRouteOption/SelectedRouteOption.tsx +++ b/packages/checkout/widgets-lib/src/components/SelectedRouteOption/SelectedRouteOption.tsx @@ -90,6 +90,7 @@ export function SelectedRouteOption({ onClick?.(event); return true; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [onClick, loading, routeData], ); diff --git a/packages/checkout/widgets-lib/src/components/Status/StatusView.tsx b/packages/checkout/widgets-lib/src/components/Status/StatusView.tsx index ef034254cd..058859a945 100644 --- a/packages/checkout/widgets-lib/src/components/Status/StatusView.tsx +++ b/packages/checkout/widgets-lib/src/components/Status/StatusView.tsx @@ -40,6 +40,7 @@ export function StatusView({ firstRender.current = false; onRenderEvent(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [firstRender.current, onRenderEvent]); const onStatusActionClick = () => { diff --git a/packages/checkout/widgets-lib/src/components/TokenImage/TokenImage.tsx b/packages/checkout/widgets-lib/src/components/TokenImage/TokenImage.tsx index a3a472d6d0..7d002fa067 100644 --- a/packages/checkout/widgets-lib/src/components/TokenImage/TokenImage.tsx +++ b/packages/checkout/widgets-lib/src/components/TokenImage/TokenImage.tsx @@ -29,6 +29,7 @@ export function TokenImage({ || (theme && getDefaultTokenImage(environment, theme)) || '' : src), + // eslint-disable-next-line react-hooks/exhaustive-deps [src, error], ); diff --git a/packages/checkout/widgets-lib/src/components/Transactions/ChangeWallet.tsx b/packages/checkout/widgets-lib/src/components/Transactions/ChangeWallet.tsx index fd6e23ff0d..853cbbba0d 100644 --- a/packages/checkout/widgets-lib/src/components/Transactions/ChangeWallet.tsx +++ b/packages/checkout/widgets-lib/src/components/Transactions/ChangeWallet.tsx @@ -54,6 +54,7 @@ export function ChangeWallet({ onChangeWalletClick }: ChangeWalletProps) { })(); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isWalletConnectEnabled, from]); return ( diff --git a/packages/checkout/widgets-lib/src/components/Transactions/ClaimWithdrawalInProgress.tsx b/packages/checkout/widgets-lib/src/components/Transactions/ClaimWithdrawalInProgress.tsx index d7ac21e3df..3f80380172 100644 --- a/packages/checkout/widgets-lib/src/components/Transactions/ClaimWithdrawalInProgress.tsx +++ b/packages/checkout/widgets-lib/src/components/Transactions/ClaimWithdrawalInProgress.tsx @@ -21,6 +21,7 @@ export function ClaimWithdrawalInProgress({ transactionResponse }: ClaimWithdraw userJourney: UserJourney.BRIDGE, screen: 'ClaimWithdrawalInProgress', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -68,6 +69,7 @@ export function ClaimWithdrawalInProgress({ transactionResponse }: ClaimWithdraw }); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [transactionResponse]); return ; diff --git a/packages/checkout/widgets-lib/src/components/Transactions/NoTransactions.tsx b/packages/checkout/widgets-lib/src/components/Transactions/NoTransactions.tsx index 2cdd865a06..fbf85f9984 100644 --- a/packages/checkout/widgets-lib/src/components/Transactions/NoTransactions.tsx +++ b/packages/checkout/widgets-lib/src/components/Transactions/NoTransactions.tsx @@ -38,6 +38,7 @@ export function NoTransactions( userJourney: UserJourney.BRIDGE, screen: 'NoTransactions', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/components/Transactions/TransactionItemWithdrawPending.tsx b/packages/checkout/widgets-lib/src/components/Transactions/TransactionItemWithdrawPending.tsx index 7139d9d6fb..db987778e3 100644 --- a/packages/checkout/widgets-lib/src/components/Transactions/TransactionItemWithdrawPending.tsx +++ b/packages/checkout/widgets-lib/src/components/Transactions/TransactionItemWithdrawPending.tsx @@ -68,6 +68,7 @@ export function TransactionItemWithdrawPending({ } const timeDiffDays = timeDiffHours / 24; // days return relativeTimeFormat.format(Math.ceil(timeDiffDays), 'day'); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [dateNowUnixMs, translation[1].language]); const withdrawalReadyToClaim = withdrawalReadyDate ? withdrawalReadyDate.getTime() < dateNowUnixMs : false; @@ -75,6 +76,7 @@ export function TransactionItemWithdrawPending({ () => (withdrawalReadyToClaim === true ? translation.t('views.TRANSACTIONS.status.withdrawalPending.withdrawalReadyText') : `${translation.t('views.TRANSACTIONS.status.withdrawalPending.withdrawalDelayText')} ${delayTimeString}`), + // eslint-disable-next-line react-hooks/exhaustive-deps [delayTimeString, translation[1].language], ); diff --git a/packages/checkout/widgets-lib/src/components/Transactions/Transactions.tsx b/packages/checkout/widgets-lib/src/components/Transactions/Transactions.tsx index 16422a0abc..c3519a1d13 100644 --- a/packages/checkout/widgets-lib/src/components/Transactions/Transactions.tsx +++ b/packages/checkout/widgets-lib/src/components/Transactions/Transactions.tsx @@ -284,6 +284,7 @@ export function Transactions({ setShowWalletDrawer(false); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [checkout], ); @@ -330,6 +331,7 @@ export function Transactions({ tokens: await getTokensDetails(tokensWithChainSlug), transactions: localTxs.result, }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [from, getTransactionsDetails]); const { providers } = useInjectedProviders({ checkout }); @@ -360,6 +362,7 @@ export function Transactions({ setLoading(false); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [from, checkout]); useEffect(() => { @@ -367,6 +370,7 @@ export function Transactions({ userJourney: UserJourney.BRIDGE, screen: 'Transactions', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/components/Transak/useTransakEvents.ts b/packages/checkout/widgets-lib/src/components/Transak/useTransakEvents.ts index c97044dc52..ea89832042 100644 --- a/packages/checkout/widgets-lib/src/components/Transak/useTransakEvents.ts +++ b/packages/checkout/widgets-lib/src/components/Transak/useTransakEvents.ts @@ -114,6 +114,7 @@ export const useTransakEvents = (props: UseTransakEventsProps) => { }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleEvents = useCallback((event: TransakEvent) => { @@ -141,6 +142,7 @@ export const useTransakEvents = (props: UseTransakEventsProps) => { default: break; } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleMessageEvent = useCallback( @@ -156,6 +158,7 @@ export const useTransakEvents = (props: UseTransakEventsProps) => { console.log('@@@ Transak event', event); // eslint-disable-line no-console }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ref], ); @@ -165,6 +168,7 @@ export const useTransakEvents = (props: UseTransakEventsProps) => { clearTimeout(timeout.current); window.removeEventListener('message', handleMessageEvent); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return { diff --git a/packages/checkout/widgets-lib/src/components/Transak/useTransakIframe.ts b/packages/checkout/widgets-lib/src/components/Transak/useTransakIframe.ts index 84a43c0421..1e5f1773bf 100644 --- a/packages/checkout/widgets-lib/src/components/Transak/useTransakIframe.ts +++ b/packages/checkout/widgets-lib/src/components/Transak/useTransakIframe.ts @@ -131,6 +131,7 @@ export const useTransakIframe = (props: UseTransakIframeProps) => { const checkoutUrl = await getNFTCheckoutURL(); setIframeSrc(checkoutUrl); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return { iframeSrc }; diff --git a/packages/checkout/widgets-lib/src/components/WalletDrawer/PayWithWalletDrawer.tsx b/packages/checkout/widgets-lib/src/components/WalletDrawer/PayWithWalletDrawer.tsx index 56786954ff..ffc8cf2c41 100644 --- a/packages/checkout/widgets-lib/src/components/WalletDrawer/PayWithWalletDrawer.tsx +++ b/packages/checkout/widgets-lib/src/components/WalletDrawer/PayWithWalletDrawer.tsx @@ -62,6 +62,7 @@ export function PayWithWalletDrawer({ {t('drawers.wallet.payWithCard')} ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [onClose, onPayWithCard]); return ( diff --git a/packages/checkout/widgets-lib/src/context/analytics-provider/SetupAnalytics.tsx b/packages/checkout/widgets-lib/src/context/analytics-provider/SetupAnalytics.tsx index 09e74e56e2..c1eea484da 100644 --- a/packages/checkout/widgets-lib/src/context/analytics-provider/SetupAnalytics.tsx +++ b/packages/checkout/widgets-lib/src/context/analytics-provider/SetupAnalytics.tsx @@ -28,6 +28,7 @@ export function SetupAnalytics( if (!config) return; updateWriteKey(config.segmentPublishableKey); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [telemetry]); // eslint-disable-next-line react/jsx-no-useless-fragment diff --git a/packages/checkout/widgets-lib/src/context/crypto-fiat-context/CryptoFiatProvider.tsx b/packages/checkout/widgets-lib/src/context/crypto-fiat-context/CryptoFiatProvider.tsx index ee9dfeb97e..16ff1e251e 100644 --- a/packages/checkout/widgets-lib/src/context/crypto-fiat-context/CryptoFiatProvider.tsx +++ b/packages/checkout/widgets-lib/src/context/crypto-fiat-context/CryptoFiatProvider.tsx @@ -35,6 +35,7 @@ export function CryptoFiatProvider({ environment, children }: CryptoFiatProvider })), }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { diff --git a/packages/checkout/widgets-lib/src/context/crypto-fiat-context/test-components/CryptoFiatTestComponent.tsx b/packages/checkout/widgets-lib/src/context/crypto-fiat-context/test-components/CryptoFiatTestComponent.tsx index 6f8f5920c5..e9ea3d5446 100644 --- a/packages/checkout/widgets-lib/src/context/crypto-fiat-context/test-components/CryptoFiatTestComponent.tsx +++ b/packages/checkout/widgets-lib/src/context/crypto-fiat-context/test-components/CryptoFiatTestComponent.tsx @@ -17,6 +17,7 @@ export function CryptoFiatTestComponent({ tokenSymbols }: CryptoFiatTestComponen }, }); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [cryptoFiatDispatch]); return ( diff --git a/packages/checkout/widgets-lib/src/context/handover-context/HandoverProvider.tsx b/packages/checkout/widgets-lib/src/context/handover-context/HandoverProvider.tsx index 42df3f4202..7121e32f52 100644 --- a/packages/checkout/widgets-lib/src/context/handover-context/HandoverProvider.tsx +++ b/packages/checkout/widgets-lib/src/context/handover-context/HandoverProvider.tsx @@ -104,6 +104,7 @@ export function HandoverProvider({ children }: HandoverProviderProps) { [handoverQueue, handoverBusy, handovers, closeHandover], ); + // eslint-disable-next-line react-hooks/exhaustive-deps const addHandover = ( handoverContent: HandoverContent, handoverId: HandoverTarget = HandoverTarget.GLOBAL, diff --git a/packages/checkout/widgets-lib/src/context/providers-context/ProvidersContext.tsx b/packages/checkout/widgets-lib/src/context/providers-context/ProvidersContext.tsx index 332ec001d1..22e98c5c18 100644 --- a/packages/checkout/widgets-lib/src/context/providers-context/ProvidersContext.tsx +++ b/packages/checkout/widgets-lib/src/context/providers-context/ProvidersContext.tsx @@ -194,6 +194,7 @@ export function ProvidersContextProvider({ /** TODO: handle error */ } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [toProvider, providersState.lockedToProvider]); return ( diff --git a/packages/checkout/widgets-lib/src/hooks/useMount.ts b/packages/checkout/widgets-lib/src/hooks/useMount.ts index 496909ab36..b9c3494c84 100644 --- a/packages/checkout/widgets-lib/src/hooks/useMount.ts +++ b/packages/checkout/widgets-lib/src/hooks/useMount.ts @@ -29,5 +29,6 @@ export const useMount = ( fn(); isMounted.current = true; + // eslint-disable-next-line react-hooks/exhaustive-deps }, deps || []); }; diff --git a/packages/checkout/widgets-lib/src/lib/hooks/useAsyncMemo.ts b/packages/checkout/widgets-lib/src/lib/hooks/useAsyncMemo.ts index 2bae383ba8..91240e2ea9 100644 --- a/packages/checkout/widgets-lib/src/lib/hooks/useAsyncMemo.ts +++ b/packages/checkout/widgets-lib/src/lib/hooks/useAsyncMemo.ts @@ -20,6 +20,7 @@ export const useAsyncMemo = ( return () => { isMounted = false; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, dependencies); return value as T; diff --git a/packages/checkout/widgets-lib/src/lib/hooks/useBalance.ts b/packages/checkout/widgets-lib/src/lib/hooks/useBalance.ts index 614fff51eb..27a70c3018 100644 --- a/packages/checkout/widgets-lib/src/lib/hooks/useBalance.ts +++ b/packages/checkout/widgets-lib/src/lib/hooks/useBalance.ts @@ -56,6 +56,7 @@ export const useBalance = ({ setBalancesLoading(false); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); useInterval(() => refreshBalances(true), REFRESH_BALANCE_INTERVAL_MS); diff --git a/packages/checkout/widgets-lib/src/lib/hooks/useInjectedProviders.ts b/packages/checkout/widgets-lib/src/lib/hooks/useInjectedProviders.ts index 6ede1e9f99..7c3c9febf4 100644 --- a/packages/checkout/widgets-lib/src/lib/hooks/useInjectedProviders.ts +++ b/packages/checkout/widgets-lib/src/lib/hooks/useInjectedProviders.ts @@ -102,6 +102,7 @@ export const useInjectedProviders = ({ checkout }: UseInjectedProvidersParams) = filterAndProcessProviders(injectedProviders); return () => cancelSubscription(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout]); return { diff --git a/packages/checkout/widgets-lib/src/lib/hooks/useQuoteOrder.ts b/packages/checkout/widgets-lib/src/lib/hooks/useQuoteOrder.ts index 48d3793d22..2927ed8b81 100644 --- a/packages/checkout/widgets-lib/src/lib/hooks/useQuoteOrder.ts +++ b/packages/checkout/widgets-lib/src/lib/hooks/useQuoteOrder.ts @@ -143,6 +143,7 @@ export const useQuoteOrder = ({ fetching.current = false; } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [environment, environmentId, preferredCurrency, fetching], ); diff --git a/packages/checkout/widgets-lib/src/lib/hooks/useSignOrder.ts b/packages/checkout/widgets-lib/src/lib/hooks/useSignOrder.ts index 32e695dc95..cbc0846479 100644 --- a/packages/checkout/widgets-lib/src/lib/hooks/useSignOrder.ts +++ b/packages/checkout/widgets-lib/src/lib/hooks/useSignOrder.ts @@ -290,6 +290,7 @@ export const useSignOrder = (input: SignOrderInput) => { } return undefined; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [items, environmentId, environment, provider], ); @@ -393,6 +394,7 @@ export const useSignOrder = (input: SignOrderInput) => { } return undefined; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [items, environmentId, environment, provider, getPostHooks], ); @@ -473,6 +475,7 @@ export const useSignOrder = (input: SignOrderInput) => { return executeResponse.transactions; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ provider, executeTransaction, @@ -517,6 +520,7 @@ export const useSignOrder = (input: SignOrderInput) => { return success; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [currentTransactionIndex, provider, filteredTransactions], ); diff --git a/packages/checkout/widgets-lib/src/lib/hooks/useWalletConnect.ts b/packages/checkout/widgets-lib/src/lib/hooks/useWalletConnect.ts index 89391098b6..1b95d07e1f 100644 --- a/packages/checkout/widgets-lib/src/lib/hooks/useWalletConnect.ts +++ b/packages/checkout/widgets-lib/src/lib/hooks/useWalletConnect.ts @@ -145,6 +145,7 @@ export const useWalletConnect = () => { openModal(ethereumProvider, resolve, reject); } }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ethereumProvider, walletConnectModal, isWalletConnectEnabled]); const getWalletLogoUrl = useCallback(async () => await WalletConnectManager.getInstance().getWalletLogoUrl(), []); diff --git a/packages/checkout/widgets-lib/src/lib/squid/hooks/useRouteCalculation.ts b/packages/checkout/widgets-lib/src/lib/squid/hooks/useRouteCalculation.ts index ab5def2d65..bdbf5761b3 100644 --- a/packages/checkout/widgets-lib/src/lib/squid/hooks/useRouteCalculation.ts +++ b/packages/checkout/widgets-lib/src/lib/squid/hooks/useRouteCalculation.ts @@ -56,5 +56,6 @@ export const useRouteCalculation = () => { calculateFromAmount, calculateFromAmountFromRoute, convertToFormattedFromAmount, + // eslint-disable-next-line react-hooks/exhaustive-deps }), []); }; diff --git a/packages/checkout/widgets-lib/src/lib/squid/hooks/useSlippage.ts b/packages/checkout/widgets-lib/src/lib/squid/hooks/useSlippage.ts index 5bf8296043..536913e8db 100644 --- a/packages/checkout/widgets-lib/src/lib/squid/hooks/useSlippage.ts +++ b/packages/checkout/widgets-lib/src/lib/squid/hooks/useSlippage.ts @@ -41,5 +41,6 @@ export const useSlippage = () => { return useMemo(() => ({ getSlippageTier, calculateAdjustedAmount, + // eslint-disable-next-line react-hooks/exhaustive-deps }), []); }; diff --git a/packages/checkout/widgets-lib/src/lib/squid/hooks/useSquid.ts b/packages/checkout/widgets-lib/src/lib/squid/hooks/useSquid.ts index 009965ff52..2d95a2a98a 100644 --- a/packages/checkout/widgets-lib/src/lib/squid/hooks/useSquid.ts +++ b/packages/checkout/widgets-lib/src/lib/squid/hooks/useSquid.ts @@ -39,6 +39,7 @@ export const useSquid = (checkout: Checkout) => { }; initialiseSquid(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [squidConfig]); return squid; diff --git a/packages/checkout/widgets-lib/src/lib/squid/hooks/useTokens.ts b/packages/checkout/widgets-lib/src/lib/squid/hooks/useTokens.ts index 196338514f..939665fc14 100644 --- a/packages/checkout/widgets-lib/src/lib/squid/hooks/useTokens.ts +++ b/packages/checkout/widgets-lib/src/lib/squid/hooks/useTokens.ts @@ -36,6 +36,7 @@ export const useTokens = (checkout: Checkout) => { } }; getTokens(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [squidConfig]); return tokens; diff --git a/packages/checkout/widgets-lib/src/views/top-up/TopUpView.tsx b/packages/checkout/widgets-lib/src/views/top-up/TopUpView.tsx index d2ba1d72c2..5d390f39a9 100644 --- a/packages/checkout/widgets-lib/src/views/top-up/TopUpView.tsx +++ b/packages/checkout/widgets-lib/src/views/top-up/TopUpView.tsx @@ -150,6 +150,7 @@ export function TopUpView({ ); setBridgeFeesInFiat(est); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout !== undefined]); // Onramp fees estimation @@ -160,6 +161,7 @@ export function TopUpView({ const onRampFees = getOnRampFeeEstimation(onRampFeesEstimate); setOnRampFeesPercentage(onRampFees); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout !== undefined]); const localTrack = ( @@ -348,6 +350,7 @@ export function TopUpView({ isEnabled: showBridgeOption, }, ], + // eslint-disable-next-line react-hooks/exhaustive-deps [showBridgeOption, showOnrampOption, showSwapOption], ); diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/AddTokensWidget.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/AddTokensWidget.tsx index 9d70e77abc..bec05f73cc 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/AddTokensWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/AddTokensWidget.tsx @@ -72,7 +72,7 @@ export default function AddTokensWidget({ viewState, viewDispatch, }), - [viewState, viewReducer], + [viewState, viewDispatch], ); const [addTokensState, addTokensDispatch] = useReducer( @@ -114,6 +114,7 @@ export default function AddTokensWidget({ }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const toTokenAddress = useMemo(() => { @@ -132,6 +133,7 @@ export default function AddTokensWidget({ if (config.environment !== Environment.PRODUCTION) { showErrorHandover(AddTokensErrorTypes.ENVIRONMENT_ERROR, { contextId: id }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [config, id]); useEffect(() => { @@ -153,6 +155,7 @@ export default function AddTokensWidget({ if (isInvalidToTokenAddress || isInvalidToAmount) { showErrorHandover(AddTokensErrorTypes.INVALID_PARAMETERS, { contextId: id }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [toTokenAddress, toAmount, id]); useEffect(() => { diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/components/OnboardingDrawer.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/components/OnboardingDrawer.tsx index 884a3f4c02..299937a778 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/components/OnboardingDrawer.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/components/OnboardingDrawer.tsx @@ -63,6 +63,7 @@ export function OnboardingDrawer({ environment }: OnboardingDrawerProps) { const src = useMemo( () => getRemoteImage(environment, HERO_IMAGES[screenIndex - 1]), + // eslint-disable-next-line react-hooks/exhaustive-deps [screenIndex], ); diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/components/TokenDrawerMenu.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/components/TokenDrawerMenu.tsx index d95b076ef1..3ff51b826a 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/components/TokenDrawerMenu.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/components/TokenDrawerMenu.tsx @@ -92,6 +92,7 @@ export function TokenDrawerMenu({ setVisible(false); setSearchValue(''); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [addTokensState.id], ); @@ -105,6 +106,7 @@ export function TokenDrawerMenu({ if (!searchValue) return true; return token.symbol.toLowerCase().startsWith(searchValue.toLowerCase()); }), + // eslint-disable-next-line react-hooks/exhaustive-deps [ addTokensState.allowedTokens, addTokensState.tokens, @@ -192,6 +194,7 @@ export function TokenDrawerMenu({ showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN, { contextId: addTokensState.id, error }); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [addTokensState.tokens, checkout, toTokenAddress]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/hooks/useHandoverConfig.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/hooks/useHandoverConfig.tsx index 82380342d7..bc295510af 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/hooks/useHandoverConfig.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/hooks/useHandoverConfig.tsx @@ -257,6 +257,7 @@ export const useHandoverConfig = (environment: Environment) => { ), }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [environment, handoverConfigs], ); diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx index 3a712e3629..e5cd182528 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx @@ -288,6 +288,7 @@ export function AddTokens({ await identifyUser(identify, toProvider!, { anonymousId }); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [toProvider, lockedToProvider]); const toChain = useMemo( @@ -310,6 +311,7 @@ export function AddTokens({ }).then((ctx) => { trackFlow('commerce', `addTokensLoaded_${ctx.event.messageId}`); }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [id, isSwapAvailable]); useEffect(() => { @@ -321,6 +323,7 @@ export function AddTokens({ resetRoutes(); setInsufficientBalance(false); setSelectedRouteData(undefined); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fromAddress]); useEffect(() => { @@ -395,12 +398,14 @@ export function AddTokens({ setFetchingRoutes(false); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [balances, squid, selectedToken, selectedAmount]); useEffect(() => { if (!selectedRouteData && routes.length > 0) { setSelectedRouteData(routes[0]); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [routes]); useEffect(() => { @@ -421,6 +426,7 @@ export function AddTokens({ } }; fetchOnRampTokens(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, id]); const sendRequestOnRampEvent = async () => { @@ -478,6 +484,7 @@ export function AddTokens({ if (toProvider && payWithCardClicked) { sendRequestOnRampEvent(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [toProvider, payWithCardClicked]); const handleRouteClick = (route: RouteData) => { @@ -634,6 +641,7 @@ export function AddTokens({ preselectedToken: experiments[AddTokensExperiments.PRESELECTED_TOKEN] || 'none', }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [id, experiments]); useEffect(() => { diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx index 950485b006..d75b738a1b 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx @@ -136,6 +136,7 @@ export function Review({ toTokenAddress: data.toTokenAddress, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [id]); const getFromAmountAndRoute = async () => { @@ -188,6 +189,7 @@ export function Review({ const getRouteIntervalIdRef = useInterval(getFromAmountAndRoute, 20000); useEffect(() => { getFromAmountAndRoute(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const { totalFees, totalFeesUsd } = useMemo( @@ -250,6 +252,7 @@ export function Review({ {t('views.ADD_TOKENS.fees.zeroFees')} ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [totalFeesUsd]); const formattedDuration = route @@ -387,6 +390,7 @@ export function Review({ showHandover(AddTokensHandoverStep.FAIL, { axelarscanUrl }); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ route, squid, diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx index 510e7e10f4..0fc08f1ff1 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeForm.tsx @@ -138,6 +138,7 @@ export function BridgeForm(props: BridgeFormProps) { ); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ tokenBalances, cryptoFiatState.conversions, @@ -168,12 +169,14 @@ export function BridgeForm(props: BridgeFormProps) { amount: '', }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [amount, token, tokenBalances]); const selectedOption = useMemo( () => (formToken && formToken.token ? formatTokenOptionsId(formToken.token.symbol, formToken.token.address) : undefined), + // eslint-disable-next-line react-hooks/exhaustive-deps [formToken, tokenBalances, cryptoFiatState.conversions, formatTokenOptionsId], ); @@ -196,6 +199,7 @@ export function BridgeForm(props: BridgeFormProps) { }, }); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, from, to]); const canFetchEstimates = (silently: boolean): boolean => { @@ -255,6 +259,7 @@ export function BridgeForm(props: BridgeFormProps) { formToken.token.symbol, cryptoFiatState.conversions, )); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [formAmount, formToken]); const bridgeFormValidator = useCallback((): boolean => { @@ -297,6 +302,7 @@ export function BridgeForm(props: BridgeFormProps) { }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ checkout, from?.browserProvider, diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeReviewSummary.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeReviewSummary.tsx index 9e43c867b0..c99f2ed99b 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeReviewSummary.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/components/BridgeReviewSummary.tsx @@ -120,7 +120,7 @@ export function BridgeReviewSummary() { const isTransfer = useMemo(() => from?.network === to?.network, [from, to]); const isDeposit = useMemo( () => (getL2ChainId(checkout.config) === to?.network), - [from, to, checkout], + [to, checkout], ); const insufficientFundsForGas = useMemo(() => { if (!estimates) return false; @@ -150,6 +150,7 @@ export function BridgeReviewSummary() { token.symbol, cryptoFiatState.conversions, ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [token, amount]); const fromAddress = useMemo(() => { if (!from) return '-'; @@ -202,6 +203,7 @@ export function BridgeReviewSummary() { // eslint-disable-next-line no-console console.error('Unable to fetch gas estimate', e); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, from, to, token, amount]); const fetchBridgeGasEstimate = useCallback(async () => { @@ -279,6 +281,7 @@ export function BridgeReviewSummary() { cryptoFiatState.conversions, ), ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, tokenBridge]); useInterval(() => { if (isTransfer) { @@ -290,6 +293,7 @@ export function BridgeReviewSummary() { const formatFeeBreakdown = useCallback( () => formatBridgeFees(estimates, isDeposit, cryptoFiatState, t), + // eslint-disable-next-line react-hooks/exhaustive-deps [estimates, isDeposit], ); @@ -303,6 +307,7 @@ export function BridgeReviewSummary() { } setLoading(false); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleNetworkSwitch = useCallback((provider: WrappedBrowserProvider) => { @@ -323,6 +328,7 @@ export function BridgeReviewSummary() { }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [from?.browserProvider, from?.network, to?.browserProvider, to?.network]); useEffect(() => { @@ -338,6 +344,7 @@ export function BridgeReviewSummary() { return () => { removeChainChangedListener(from.browserProvider, handleChainChanged); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [from?.browserProvider]); useEffect(() => { @@ -355,6 +362,7 @@ export function BridgeReviewSummary() { } })(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isWalletConnectEnabled, from?.browserProvider, to?.browserProvider]); useEffect(() => { @@ -439,6 +447,7 @@ export function BridgeReviewSummary() { }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ viewDispatch, approveTransaction, diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletAndNetworkSelector.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletAndNetworkSelector.tsx index 05dd75540d..572fbe2ff9 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletAndNetworkSelector.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletAndNetworkSelector.tsx @@ -131,6 +131,7 @@ export function WalletAndNetworkSelector() { || (providerDetail.info.rdns === WalletProviderRdns.PASSPORT && fromWallet?.providerDetail?.info?.rdns !== WalletProviderRdns.PASSPORT) )) + // eslint-disable-next-line react-hooks/exhaustive-deps ), [providers, fromNetwork, fromWallet]); useEffect(() => { @@ -143,6 +144,7 @@ export function WalletAndNetworkSelector() { to: null, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [from, to]); function clearToWalletSelections() { @@ -215,6 +217,7 @@ export function WalletAndNetworkSelector() { await handleFromWalletConnectionSuccess(connectedProvider); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [checkout], ); @@ -236,6 +239,7 @@ export function WalletAndNetworkSelector() { }, }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [checkout, fromWalletBrowserProvider], ); @@ -255,6 +259,7 @@ export function WalletAndNetworkSelector() { }, }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [checkout, toWalletBrowserProvider], ); @@ -276,6 +281,7 @@ export function WalletAndNetworkSelector() { chainId: theToNetwork, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fromWalletAddress, fromNetwork]); const handleWalletConnectToWalletConnection = useCallback( @@ -299,6 +305,7 @@ export function WalletAndNetworkSelector() { }); }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [handleSettingToNetwork], ); @@ -353,6 +360,7 @@ export function WalletAndNetworkSelector() { console.error(error); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ fromWalletProviderName, fromWalletBrowserProvider, @@ -435,6 +443,7 @@ export function WalletAndNetworkSelector() { view: { type: BridgeWidgetViews.BRIDGE_FORM }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ fromWallet, fromWalletBrowserProvider, diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletNetworkButton.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletNetworkButton.tsx index 58fbf94021..aa4fe27d02 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletNetworkButton.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/components/WalletNetworkButton.tsx @@ -61,6 +61,7 @@ export function WalletNetworkButton({ } return walletProviderDetail?.info.name; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [walletProviderDetail, walletConnectPeerName, walletProvider]); useEffect(() => { diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/views/ApproveTransaction.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/views/ApproveTransaction.tsx index a665b7e9f8..ec1a697bb5 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/views/ApproveTransaction.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/views/ApproveTransaction.tsx @@ -60,6 +60,7 @@ export function ApproveTransaction({ bridgeTransaction }: ApproveTransactionProp moveType: bridgeTransaction ? 'bridge' : 'transfer', }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // Local state @@ -182,6 +183,7 @@ export function ApproveTransaction({ bridgeTransaction }: ApproveTransactionProp } finally { setActionDisabled(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ checkout, from, @@ -276,6 +278,7 @@ export function ApproveTransaction({ bridgeTransaction }: ApproveTransactionProp setTxProcessing(false); setActionDisabled(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ checkout, from, diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/views/Bridge.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/views/Bridge.tsx index 64edb4cfca..fb5ca935a4 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/views/Bridge.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/views/Bridge.tsx @@ -52,6 +52,7 @@ export function Bridge({ }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // This is used to refresh the balances after the Bridge widget @@ -94,6 +95,7 @@ export function Bridge({ // eslint-disable-next-line no-console console.debug(e); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, from?.browserProvider, from?.network]); useInterval(refreshBalances, REFRESH_TOKENS_INTERVAL_MS); @@ -101,6 +103,7 @@ export function Bridge({ if (!checkout || !from?.browserProvider) return; setIsTokenBalancesLoading(true); refreshBalances().finally(() => setIsTokenBalancesLoading(false)); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, from?.browserProvider]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/views/BridgeReview.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/views/BridgeReview.tsx index 9bfb96b605..2eb36a3f10 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/views/BridgeReview.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/views/BridgeReview.tsx @@ -19,6 +19,7 @@ export function BridgeReview() { userJourney: UserJourney.BRIDGE, screen: 'Review', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/views/ClaimWithdrawal.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/views/ClaimWithdrawal.tsx index 03f389de78..7acac1ba8e 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/views/ClaimWithdrawal.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/views/ClaimWithdrawal.tsx @@ -43,6 +43,7 @@ export function ClaimWithdrawal({ transaction }: ClaimWithdrawalProps) { userJourney: UserJourney.BRIDGE, screen: 'ClaimWithdrawal', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const [txProcessing, setTxProcessing] = useState(false); @@ -213,6 +214,7 @@ export function ClaimWithdrawal({ transaction }: ClaimWithdrawalProps) { } finally { setTxProcessing(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [tokenBridge, from, withdrawalResponse]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx index e9316e7d0b..fb9f255144 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/views/MoveInProgress.tsx @@ -57,6 +57,7 @@ export function MoveInProgress({ transactionHash, isTransfer }: MoveInProgressPr moveType: isTransfer ? 'transfer' : 'bridge', }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/bridge/views/WalletNetworkSelectionView.tsx b/packages/checkout/widgets-lib/src/widgets/bridge/views/WalletNetworkSelectionView.tsx index 1494ff44dd..b133cc2aab 100644 --- a/packages/checkout/widgets-lib/src/widgets/bridge/views/WalletNetworkSelectionView.tsx +++ b/packages/checkout/widgets-lib/src/widgets/bridge/views/WalletNetworkSelectionView.tsx @@ -32,6 +32,7 @@ export function WalletNetworkSelectionView({ userJourney: UserJourney.BRIDGE, screen: 'WalletNetworkSelection', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx b/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx index 9b4838268d..bbc96df55a 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx @@ -162,11 +162,13 @@ export default function ConnectWidget({ } as ConnectWidgetView, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [deepLink, sendCloseEventOverride, environment]); useEffect(() => { if (viewState.view.type !== SharedViews.ERROR_VIEW) return; sendConnectFailedEvent(eventTarget, viewState.view.error.message); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [viewState]); useEffect(() => { @@ -177,6 +179,7 @@ export default function ConnectWidget({ WalletConnectManager.getInstance() as unknown as IWalletConnectManager, ); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isWalletConnectEnabled, ethereumProvider]); const handleConnectSuccess = useCallback(async () => { @@ -210,6 +213,7 @@ export default function ConnectWidget({ return; } sendConnectSuccessEvent(eventTarget, provider, walletProviderName ?? undefined, walletProviderInfo); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [provider, identify]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/connect/components/WalletList.tsx b/packages/checkout/widgets-lib/src/widgets/connect/components/WalletList.tsx index f7f70853d0..7a9b8d15ff 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/components/WalletList.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/components/WalletList.tsx @@ -91,6 +91,7 @@ export function WalletList(props: WalletListProps) { .filter( (provider) => !blocklistWalletRdns.includes(provider.info.rdns), ), + // eslint-disable-next-line react-hooks/exhaustive-deps [providers], ); @@ -100,6 +101,7 @@ export function WalletList(props: WalletListProps) { && providers .filter((provider) => !blocklistWalletRdns.includes(provider.info.rdns)) .find((provider) => provider.info.rdns === WalletProviderRdns.PASSPORT), + // eslint-disable-next-line react-hooks/exhaustive-deps [providers, checkout], ); @@ -118,6 +120,7 @@ export function WalletList(props: WalletListProps) { }, }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [], ); @@ -210,6 +213,7 @@ export function WalletList(props: WalletListProps) { setShowUnableToConnectDrawer(true); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [checkout], ); @@ -303,12 +307,14 @@ export function WalletList(props: WalletListProps) { }); await selectProviderDetail(providerDetail); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [track, checkout], ); const onChosenProviderDetailChange = useCallback(() => { if (!chosenProviderDetail) return; handleWalletItemClick(chosenProviderDetail!); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [chosenProviderDetail]); const onBrowserWalletsClick = useCallback(() => { @@ -343,6 +349,7 @@ export function WalletList(props: WalletListProps) { } } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [filteredProviders, targetWalletRdns]); const handleNonPassportWarningDrawerButtonClick = async () => { diff --git a/packages/checkout/widgets-lib/src/widgets/connect/views/ConnectWallet.tsx b/packages/checkout/widgets-lib/src/widgets/connect/views/ConnectWallet.tsx index 388c910893..6d45b6a9dc 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/views/ConnectWallet.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/views/ConnectWallet.tsx @@ -40,6 +40,7 @@ export function ConnectWallet({ userJourney: UserJourney.CONNECT, screen: 'ConnectWallet', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/connect/views/ReadyToConnect.tsx b/packages/checkout/widgets-lib/src/widgets/connect/views/ReadyToConnect.tsx index 1609b5f1f3..f0b7f3cb25 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/views/ReadyToConnect.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/views/ReadyToConnect.tsx @@ -45,6 +45,7 @@ export function ReadyToConnect({ targetChainId, allowedChains }: ReadyToConnectP userJourney: UserJourney.CONNECT, screen: 'ReadyToConnect', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // make sure wallet provider name is set if coming directly to this screen @@ -66,6 +67,7 @@ export function ReadyToConnect({ targetChainId, allowedChains }: ReadyToConnectP }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isPassport, isMetaMask]); const textView = () => `views.READY_TO_CONNECT.${isPassport ? 'passport' : 'metamask'}`; @@ -164,6 +166,7 @@ export function ReadyToConnect({ targetChainId, allowedChains }: ReadyToConnectP setLoading(false); setFooterButtonTextKey(`${textView()}.footer.buttonText2`); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider, connectDispatch, viewDispatch, identify]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkEth.tsx b/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkEth.tsx index 063fe02358..c571937eb7 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkEth.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkEth.tsx @@ -31,6 +31,7 @@ export function SwitchNetworkEth() { userJourney: UserJourney.CONNECT, screen: 'SwitchNetworkEth', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const switchNetwork = useCallback(async () => { @@ -66,6 +67,7 @@ export function SwitchNetworkEth() { } catch (err: any) { setButtonTextKey(t('views.SWITCH_NETWORK.eth.button.retryText')); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [provider, checkout, track]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkZkEVM.tsx b/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkZkEVM.tsx index b954d7b699..48eb5caa06 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/views/SwitchNetworkZkEVM.tsx @@ -27,6 +27,7 @@ export function SwitchNetworkZkEVM() { userJourney: UserJourney.CONNECT, screen: 'SwitchNetworkZkEVM', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -61,6 +62,7 @@ export function SwitchNetworkZkEVM() { return () => { removeChainChangedListener(provider, checkCorrectNetwork); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); const switchNetwork = useCallback(async () => { @@ -154,6 +156,7 @@ export function SwitchNetworkZkEVM() { } catch (err: any) { setButtonTextKey(t('views.SWITCH_NETWORK.zkEVM.button.retryText')); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [provider, checkout]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/immutable-commerce/CommerceWidget.tsx b/packages/checkout/widgets-lib/src/widgets/immutable-commerce/CommerceWidget.tsx index 43c359dc8c..e16bad8a1b 100644 --- a/packages/checkout/widgets-lib/src/widgets/immutable-commerce/CommerceWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/immutable-commerce/CommerceWidget.tsx @@ -111,6 +111,7 @@ export default function CommerceWidget(props: CommerceWidgetInputs) { }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [history]); const handleProviderUpdated = useMemo( @@ -162,6 +163,7 @@ export default function CommerceWidget(props: CommerceWidgetInputs) { }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [flowParams]); /** @@ -182,6 +184,7 @@ export default function CommerceWidget(props: CommerceWidgetInputs) { }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [flowParams.flow]); /** diff --git a/packages/checkout/widgets-lib/src/widgets/immutable-commerce/hooks/useWidgetEvents.ts b/packages/checkout/widgets-lib/src/widgets/immutable-commerce/hooks/useWidgetEvents.ts index 29117b47e0..1f1937f809 100644 --- a/packages/checkout/widgets-lib/src/widgets/immutable-commerce/hooks/useWidgetEvents.ts +++ b/packages/checkout/widgets-lib/src/widgets/immutable-commerce/hooks/useWidgetEvents.ts @@ -94,6 +94,7 @@ export function useWidgetEvents( const eventDetail = getCommerceWidgetEvent(customEvent); sendCheckoutEvent(eventTarget, eventDetail); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [eventTarget]); useEffect(() => { diff --git a/packages/checkout/widgets-lib/src/widgets/on-ramp/OnRampWidget.tsx b/packages/checkout/widgets-lib/src/widgets/on-ramp/OnRampWidget.tsx index ded8730416..72c8c0220a 100644 --- a/packages/checkout/widgets-lib/src/widgets/on-ramp/OnRampWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/on-ramp/OnRampWidget.tsx @@ -40,7 +40,7 @@ export default function OnRampWidget({ ...initialViewState, history: [], }); - const viewReducerValues = useMemo(() => ({ viewState, viewDispatch }), [viewState, viewReducer]); + const viewReducerValues = useMemo(() => ({ viewState, viewDispatch }), [viewState, viewDispatch]); const { connectLoaderState } = useContext(ConnectLoaderContext); const { checkout, provider } = connectLoaderState; @@ -72,6 +72,7 @@ export default function OnRampWidget({ setTknAddr(address); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider, viewDispatch]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/on-ramp/views/OnRampMain.tsx b/packages/checkout/widgets-lib/src/widgets/on-ramp/views/OnRampMain.tsx index 7d30a41dee..e51df17a01 100644 --- a/packages/checkout/widgets-lib/src/widgets/on-ramp/views/OnRampMain.tsx +++ b/packages/checkout/widgets-lib/src/widgets/on-ramp/views/OnRampMain.tsx @@ -279,6 +279,7 @@ export function OnRampMain({ } }; window.addEventListener('message', handleTransakEvents); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider, tokenAmount, tokenAddress, passport]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/purchase/PurchaseWidget.tsx b/packages/checkout/widgets-lib/src/widgets/purchase/PurchaseWidget.tsx index 79137d97d4..6e006087a5 100644 --- a/packages/checkout/widgets-lib/src/widgets/purchase/PurchaseWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/purchase/PurchaseWidget.tsx @@ -56,7 +56,7 @@ export default function PurchaseWidget({ viewState, viewDispatch, }), - [viewState, viewReducer], + [viewState, viewDispatch], ); const [purchaseState, purchaseDispatch] = useReducer( @@ -69,7 +69,7 @@ export default function PurchaseWidget({ purchaseState, purchaseDispatch, }), - [purchaseState, purchaseReducer], + [purchaseState, purchaseDispatch], ); const { @@ -161,6 +161,7 @@ export default function PurchaseWidget({ console.error('Error fetching order quote', error); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [items, toAddress]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx b/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx index 715c44ffe2..7a7961ec33 100644 --- a/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx +++ b/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx @@ -62,6 +62,7 @@ export function PurchasePayWithWalletDrawer({ {t('drawers.wallet.payWithCard')} ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [onClose, onPayWithCard]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx b/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx index 6cd4ba9bbd..e329253f5d 100644 --- a/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx +++ b/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx @@ -103,6 +103,7 @@ export function RouteOptionsDrawer({ routesAvailable: routes?.length ?? 0, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [visible]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseSelectedRouteOption.tsx b/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseSelectedRouteOption.tsx index 5e17a0d84d..fdf05a3e78 100644 --- a/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseSelectedRouteOption.tsx +++ b/packages/checkout/widgets-lib/src/widgets/purchase/components/PurchaseSelectedRouteOption.tsx @@ -57,6 +57,7 @@ export function PurchaseSelectedRouteOption({ } return { routeBalanceUsd: '0', fromAmount: '0', fromAmountUsd: '0' }; } + // eslint-disable-next-line react-hooks/exhaustive-deps chainNativeCurrencySymbol = routeData.route.route.estimate.gasCosts[0].token.symbol; return getRouteAndTokenBalances(routeData); }, @@ -74,6 +75,7 @@ export function PurchaseSelectedRouteOption({ onClick?.(event); return true; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [onClick, loading, routeData], ); diff --git a/packages/checkout/widgets-lib/src/widgets/purchase/components/WithCard.tsx b/packages/checkout/widgets-lib/src/widgets/purchase/components/WithCard.tsx index ddeedd7c8c..e2d9de8a8c 100644 --- a/packages/checkout/widgets-lib/src/widgets/purchase/components/WithCard.tsx +++ b/packages/checkout/widgets-lib/src/widgets/purchase/components/WithCard.tsx @@ -49,12 +49,8 @@ export function WithCard(props: WithCardProps) { const { environment } = checkout.config; const executeTxn = signResponse?.transactions.find((txn) => txn.methodCall.startsWith('execute')); - if (!signResponse || !executeTxn) { - return null; - } - const nftData: TransakNFTData[] = useMemo( - () => signResponse.order.products.map((product) => ({ + () => (signResponse?.order.products ?? []).map((product) => ({ collectionAddress: product.collectionAddress, imageURL: product.image, nftName: product.name, @@ -66,6 +62,10 @@ export function WithCard(props: WithCardProps) { [signResponse], ); + if (!signResponse || !executeTxn) { + return null; + } + return ( { ), }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [environment, handoverConfigs], ); diff --git a/packages/checkout/widgets-lib/src/widgets/purchase/views/Purchase.tsx b/packages/checkout/widgets-lib/src/widgets/purchase/views/Purchase.tsx index f88c9deb83..5721185d9c 100644 --- a/packages/checkout/widgets-lib/src/widgets/purchase/views/Purchase.tsx +++ b/packages/checkout/widgets-lib/src/widgets/purchase/views/Purchase.tsx @@ -241,6 +241,7 @@ export function Purchase({ } } )(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [quote, balances, squid]); useEffect(() => { @@ -265,6 +266,7 @@ export function Purchase({ tokenSymbols, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [quote]); const shouldShowBackButton = showBackButton && onBackButtonClick; @@ -509,6 +511,7 @@ export function Purchase({ } else { handleDirectCryptoPayment(fromProvider, fromAddress, toAddress, quote.currency.address); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ squid, tokens, diff --git a/packages/checkout/widgets-lib/src/widgets/sale/SaleWidget.tsx b/packages/checkout/widgets-lib/src/widgets/sale/SaleWidget.tsx index e56271234e..8d20f75654 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/SaleWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/SaleWidget.tsx @@ -119,6 +119,7 @@ export default function SaleWidget(props: SaleWidgetProps) { if (!checkout || !provider) return; onMount(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/sale/components/FundingRouteExecute/FundingRouteExecute.tsx b/packages/checkout/widgets-lib/src/widgets/sale/components/FundingRouteExecute/FundingRouteExecute.tsx index b29a5f83e8..2f7b76ab14 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/components/FundingRouteExecute/FundingRouteExecute.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/components/FundingRouteExecute/FundingRouteExecute.tsx @@ -174,6 +174,7 @@ export function FundingRouteExecute({ setView(FundingRouteExecuteViews.EXECUTE_ON_RAMP); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [provider, checkout], ); @@ -186,6 +187,7 @@ export function FundingRouteExecute({ } catch (err) { sendFailEvent(err); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fundingRouteStep]); const onCloseWidget = () => { @@ -296,6 +298,7 @@ export function FundingRouteExecute({ handleCustomEvent, ); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -305,6 +308,7 @@ export function FundingRouteExecute({ eventTarget, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx b/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx index 6106eabbe1..2a6c334e84 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/components/OrderReview.tsx @@ -101,7 +101,7 @@ export function OrderReview({ const fundingBalance = useMemo( () => fundingBalances[selectedCurrencyIndex], - [fundingBalances, selectedCurrencyIndex, provider], + [fundingBalances, selectedCurrencyIndex], ); useEffect(() => { @@ -142,6 +142,7 @@ export function OrderReview({ t, ), }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fundingBalance, conversions, provider]); useEffect(() => { @@ -173,6 +174,7 @@ export function OrderReview({ }, ], }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [gasFees, fundingBalance, conversions]); // Trigger page loaded event diff --git a/packages/checkout/widgets-lib/src/widgets/sale/components/WithCard.tsx b/packages/checkout/widgets-lib/src/widgets/sale/components/WithCard.tsx index 7c15d9caf0..c47e5d479b 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/components/WithCard.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/components/WithCard.tsx @@ -36,12 +36,8 @@ export function WithCard(props: WithCardProps) { } = useSaleContext(); const executeTxn = signResponse?.transactions.find((txn) => txn.methodCall.startsWith('execute')); - if (!signResponse || !executeTxn) { - return null; - } - const nftData: TransakNFTData[] = useMemo( - () => signResponse.order.products.map((product) => ({ + () => (signResponse?.order.products ?? []).map((product) => ({ collectionAddress: product.collectionAddress, imageURL: product.image, nftName: product.name, @@ -53,6 +49,10 @@ export function WithCard(props: WithCardProps) { [signResponse], ); + if (!signResponse || !executeTxn) { + return null; + } + const onFailedToLoad = () => { goToErrorView(SaleErrorTypes.TRANSAK_FAILED); }; diff --git a/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx b/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx index 0e934136f6..5ff86829ff 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/context/SaleContextProvider.tsx @@ -230,6 +230,7 @@ export function SaleContextProvider(props: { }, }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [], ); @@ -243,6 +244,7 @@ export function SaleContextProvider(props: { }; getUserInfo(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [provider]); useEffect(() => { @@ -260,6 +262,7 @@ export function SaleContextProvider(props: { const assessment = await fetchRiskAssessment([address], checkout.config); setRiskAssessment(assessment); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); const { @@ -329,6 +332,7 @@ export function SaleContextProvider(props: { }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [paymentMethod, setPaymentMethod, executeResponse], ); @@ -349,17 +353,20 @@ export function SaleContextProvider(props: { }, }); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [[paymentMethod, executeResponse, tokenIds]], ); useEffect(() => { if (!signError) return; goToErrorView(signError.type, signError.data); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [signError]); useEffect(() => { if (!orderQuoteError) return; goToErrorView(orderQuoteError.type, orderQuoteError.data); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [orderQuoteError]); useEffect(() => { @@ -415,6 +422,7 @@ export function SaleContextProvider(props: { hideExcludedPaymentTypes, riskAssessment, }), + // eslint-disable-next-line react-hooks/exhaustive-deps [ config, environment, diff --git a/packages/checkout/widgets-lib/src/widgets/sale/hooks/useQuoteOrder.ts b/packages/checkout/widgets-lib/src/widgets/sale/hooks/useQuoteOrder.ts index 86cb0ef0f0..69f7611175 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/hooks/useQuoteOrder.ts +++ b/packages/checkout/widgets-lib/src/widgets/sale/hooks/useQuoteOrder.ts @@ -107,6 +107,7 @@ export const useQuoteOrder = ({ fetching.current = false; } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [environment, environmentId, queryParams]); useEffect(() => { @@ -122,6 +123,7 @@ export const useQuoteOrder = ({ || orderQuote.currencies?.[0]; setSelectedCurrency(defaultSelectedCurrency); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [orderQuote]); return { diff --git a/packages/checkout/widgets-lib/src/widgets/sale/hooks/useSignOrder.ts b/packages/checkout/widgets-lib/src/widgets/sale/hooks/useSignOrder.ts index f6fad0fad0..e616e8a303 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/hooks/useSignOrder.ts +++ b/packages/checkout/widgets-lib/src/widgets/sale/hooks/useSignOrder.ts @@ -339,6 +339,7 @@ export const useSignOrder = (input: SignOrderInput) => { } return undefined; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [items, environmentId, environment, provider], ); @@ -419,6 +420,7 @@ export const useSignOrder = (input: SignOrderInput) => { return executeResponse.transactions; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ provider, executeTransaction, @@ -463,6 +465,7 @@ export const useSignOrder = (input: SignOrderInput) => { return success; }, + // eslint-disable-next-line react-hooks/exhaustive-deps [currentTransactionIndex, provider, filteredTransactions], ); diff --git a/packages/checkout/widgets-lib/src/widgets/sale/views/OrderSummary.tsx b/packages/checkout/widgets-lib/src/widgets/sale/views/OrderSummary.tsx index a0aee7779f..996d9f73f4 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/views/OrderSummary.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/views/OrderSummary.tsx @@ -153,6 +153,7 @@ export function OrderSummary({ subView }: OrderSummaryProps) { useEffect(() => { if (subView !== OrderSummarySubViews.INIT || !fromTokenAddress) return; queryFundingBalances(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [subView, fromTokenAddress]); // If one or more balances found, go to Order Review @@ -169,6 +170,7 @@ export function OrderSummary({ subView }: OrderSummaryProps) { }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fundingBalances]); // If no balances, Go to Top Up View @@ -205,6 +207,7 @@ export function OrderSummary({ subView }: OrderSummaryProps) { } catch (error: any) { goToErrorView(SaleErrorTypes.SERVICE_BREAKDOWN, error); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fundingBalances, loadingBalances, fundingBalancesResult]); // Refresh conversion rates, once all balances are loaded diff --git a/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCard.tsx b/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCard.tsx index 9c0dedde4c..4071fa15ba 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCard.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCard.tsx @@ -105,6 +105,7 @@ export function PayWithCard() { }); // checkoutPrimarySalePayWithCard_OrderCreatedEvent }; + // eslint-disable-next-line react-hooks/exhaustive-deps useEffect(() => sendPageView(SaleWidgetViews.PAY_WITH_CARD), []); // checkoutPrimarySalePayWithCardViewed return ( diff --git a/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCoins.tsx b/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCoins.tsx index cb6204c1eb..f5b0c57d80 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCoins.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/views/PayWithCoins.tsx @@ -94,6 +94,7 @@ export function PayWithCoins() { }, onTxnStepExecuteAll, ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [signResponse, environment]); const executeUserInitiatedTransaction = useCallback(() => { @@ -135,6 +136,7 @@ export function PayWithCoins() { /> ), }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ filteredTransactions, currentTransactionIndex, @@ -142,6 +144,7 @@ export function PayWithCoins() { environment, ]); + // eslint-disable-next-line react-hooks/exhaustive-deps useEffect(() => sendPageView(SaleWidgetViews.PAY_WITH_COINS), []); // checkoutPrimarySalePayWithCoinsViewed useEffect(() => { @@ -154,6 +157,7 @@ export function PayWithCoins() { prevTransactionIndexRef.current = currentTransactionIndex; executeUserInitiatedTransaction(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [filteredTransactions, currentTransactionIndex, provider]); useEffect(() => { @@ -163,6 +167,7 @@ export function PayWithCoins() { processing.current = true; executeAllTransactions(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [signResponse, provider]); useEffect(() => { @@ -192,6 +197,7 @@ export function PayWithCoins() { }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [executeResponse]); return null; diff --git a/packages/checkout/widgets-lib/src/widgets/sale/views/PaymentMethods.tsx b/packages/checkout/widgets-lib/src/widgets/sale/views/PaymentMethods.tsx index 4b9d7a02bd..d63d82d038 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/views/PaymentMethods.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/views/PaymentMethods.tsx @@ -103,12 +103,15 @@ export function PaymentMethods() { }, }); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [paymentMethod]); + // eslint-disable-next-line react-hooks/exhaustive-deps useEffect(() => sendPageView(SaleWidgetViews.PAYMENT_METHODS), []); // checkoutPrimarySalePaymentMethodsViewed useEffect(() => { if (!invalidParameters) return; goToErrorView(SaleErrorTypes.INVALID_PARAMETERS); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [invalidParameters]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/sale/views/SaleErrorView.tsx b/packages/checkout/widgets-lib/src/widgets/sale/views/SaleErrorView.tsx index 08cf53f0fa..6910fc22ef 100644 --- a/packages/checkout/widgets-lib/src/widgets/sale/views/SaleErrorView.tsx +++ b/packages/checkout/widgets-lib/src/widgets/sale/views/SaleErrorView.tsx @@ -247,6 +247,7 @@ export function SaleErrorView({ inputValue: StateMachineInput.ERROR, children: , }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentErrorType, environment]); return null; diff --git a/packages/checkout/widgets-lib/src/widgets/swap/GeoblockLoader.tsx b/packages/checkout/widgets-lib/src/widgets/swap/GeoblockLoader.tsx index a751f5dd27..b468bfa759 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/GeoblockLoader.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/GeoblockLoader.tsx @@ -36,6 +36,7 @@ export function GeoblockLoader({ setAvailable(false); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/swap/SwapWidget.tsx b/packages/checkout/widgets-lib/src/widgets/swap/SwapWidget.tsx index 460c5ded46..50a3a4f109 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/SwapWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/SwapWidget.tsx @@ -168,6 +168,7 @@ export default function SwapWidget({ } return true; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); useEffect(() => { @@ -193,6 +194,7 @@ export default function SwapWidget({ showSwapView(); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); useEffect(() => { @@ -215,6 +217,7 @@ export default function SwapWidget({ }, }); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); useEffect(() => { @@ -261,6 +264,7 @@ export default function SwapWidget({ } return optionsArray; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/swap/components/SwapForm.tsx b/packages/checkout/widgets-lib/src/widgets/swap/components/SwapForm.tsx index 078bc5c9c4..9ebc4fa9fa 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/components/SwapForm.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/components/SwapForm.tsx @@ -207,6 +207,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { } setLoadedToAndFromTokens(true); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ tokenBalances, allowedTokens, @@ -247,6 +248,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { symbol: token.symbol, icon: token.icon, } as CoinSelectorOptionProps), + // eslint-disable-next-line react-hooks/exhaustive-deps ), [allowedTokens, fromToken]); useEffect(() => { @@ -496,6 +498,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { (async () => await fetchQuote())(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [debouncedFromAmount, fromToken, toToken, fromMaxTrigger]); useEffect(() => { @@ -508,6 +511,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { (async () => await fetchQuote())(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [debouncedToAmount, toToken, fromToken]); // during swaps, having enough IMX to cover the gas fee means (only relevant for non-Passport wallets) @@ -567,6 +571,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { fromAmount, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [toToken]); const onFromTextInputFocus = () => { @@ -650,6 +655,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { toAmount, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fromToken]); const onToTextInputFocus = () => { @@ -803,6 +809,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { } return true; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isFormValidForAutoProceed]); const sendTransaction = async () => { @@ -898,6 +905,7 @@ export function SwapForm({ data, theme, cancelAutoProceed }: SwapFromProps) { useEffect(() => { if (shouldSendTransaction === undefined) return; sendTransaction(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [shouldSendTransaction]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/swap/views/ApproveERC20Onboarding.tsx b/packages/checkout/widgets-lib/src/widgets/swap/views/ApproveERC20Onboarding.tsx index 256c67d41d..74e9da0069 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/views/ApproveERC20Onboarding.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/views/ApproveERC20Onboarding.tsx @@ -61,6 +61,7 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) { swapFormInfo: data.swapFormInfo, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // Get symbol from swap info for approve amount text @@ -94,6 +95,7 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) { }, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [viewDispatch]); const handleExceptions = (err, swapFormData:PrefilledSwapForm) => { @@ -203,6 +205,7 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) { } finally { setLoading(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ checkout, provider, @@ -234,6 +237,7 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) { )} ), + // eslint-disable-next-line react-hooks/exhaustive-deps [data.swapFormInfo, fromToken, isPassport], ); @@ -245,6 +249,7 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) { : 'views.APPROVE_ERC20.approveSpending.footer.buttonText')} onActionClick={handleApproveSpendingClick} /> + // eslint-disable-next-line react-hooks/exhaustive-deps ), [rejectedSpending, handleApproveSpendingClick, loading]); /* ----------------- */ @@ -305,6 +310,7 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) { } finally { setLoading(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ checkout, provider, @@ -331,6 +337,7 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) { : 'views.APPROVE_ERC20.approveSwap.footer.buttonText')} onActionClick={handleApproveSwapClick} /> + // eslint-disable-next-line react-hooks/exhaustive-deps ), [rejectedSwap, handleApproveSwapClick, loading]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/swap/views/SwapCoins.tsx b/packages/checkout/widgets-lib/src/widgets/swap/views/SwapCoins.tsx index e85dc770ac..7e496f76cc 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/views/SwapCoins.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/views/SwapCoins.tsx @@ -76,12 +76,14 @@ export function SwapCoins({ toTokenAddress, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { if (hasZeroBalance(tokenBalances, IMX_TOKEN_SYMBOL) && !isPassportProvider(provider)) { setShowNotEnoughImxDrawer(true); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [tokenBalances]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/swap/views/SwapInProgress.tsx b/packages/checkout/widgets-lib/src/widgets/swap/views/SwapInProgress.tsx index 931c4d99f3..abe939eed2 100644 --- a/packages/checkout/widgets-lib/src/widgets/swap/views/SwapInProgress.tsx +++ b/packages/checkout/widgets-lib/src/widgets/swap/views/SwapInProgress.tsx @@ -34,6 +34,7 @@ export function SwapInProgress({ swapFormInfo: swapForm, }, }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -83,6 +84,7 @@ export function SwapInProgress({ }); } })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [transactionResponse]); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/transfer/TransferForm.tsx b/packages/checkout/widgets-lib/src/widgets/transfer/TransferForm.tsx index 2ee490bce4..3b0d0c0203 100644 --- a/packages/checkout/widgets-lib/src/widgets/transfer/TransferForm.tsx +++ b/packages/checkout/widgets-lib/src/widgets/transfer/TransferForm.tsx @@ -92,7 +92,7 @@ export function TransferForm({ if (typeof optionKey !== 'string') throw new Error('Invalid token address'); setViewState((s) => ({ ...s, tokenAddress: optionKey, amountError: '' })); }, - [tokenOptions, token], + [track, setViewState], ); const handleMaxButtonClick = useCallback(() => { @@ -111,22 +111,22 @@ export function TransferForm({ if (!token.balance) throw new Error('Token balance not found'); return { ...s, amount: token.balance.fullBalance }; }); - }, [tokenOptions, token]); + }, [token, track, setViewState]); const handleRecipientAddressChange = useCallback((value: string) => { setViewState((s) => ({ ...s, toAddress: value, toAddressError: '' })); - }, []); + }, [setViewState]); const handleAmountChange = useCallback((value: string) => { setViewState((s) => ({ ...s, amount: value, amountError: '' })); - }, []); + }, [setViewState]); const selectSubtext = useMemo(() => { if (!token) return ''; return `${t('views.TRANSFER.content.availableBalancePrefix')} ${ token.balance?.formattedAmount }`; - }, [token]); + }, [t, token]); const isButtonDisabled = useMemo( () => !viewState.amount || !viewState.toAddress || !token, diff --git a/packages/checkout/widgets-lib/src/widgets/transfer/TransferWidget.tsx b/packages/checkout/widgets-lib/src/widgets/transfer/TransferWidget.tsx index aa3e6d1f87..5312245075 100644 --- a/packages/checkout/widgets-lib/src/widgets/transfer/TransferWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/transfer/TransferWidget.tsx @@ -192,7 +192,7 @@ function TransferWidgetInner(props: TransferWidgetInputs) { setViewState({ ...viewState, type: 'FORM' }); // TODO: We should be showing a failed view here } } - }, [viewState, eventTarget]); + }, [viewState, track, eventTarget]); switch (viewState.type) { case 'INITIALISING': diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx index a4557f4d80..5246b891bf 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/WalletWidget.tsx @@ -133,6 +133,7 @@ export default function WalletWidget(props: WalletWidgetInputs) { }, }); })(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isBridgeEnabled, isSwapEnabled, isOnRampEnabled, environment]); const initialiseWallet = async () => { @@ -183,6 +184,7 @@ export default function WalletWidget(props: WalletWidgetInputs) { useEffect(() => { if (!checkout || !provider) return; initialiseWallet(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [checkout, provider]); const errorAction = async () => { diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx index cdd59b127f..d72f6056da 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx @@ -119,6 +119,7 @@ export function BalanceItem({ ); return canBuy || canAdd; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ isOnRampEnabled, onRampAllowedTokens, diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx index 540112a4c5..68d4efcddb 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx @@ -81,6 +81,7 @@ export function NetworkMenu() { } } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [checkout, provider, network, walletDispatch, viewDispatch], ); diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/views/CoinInfo.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/views/CoinInfo.tsx index c53861bef3..e1bd38e050 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/views/CoinInfo.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/views/CoinInfo.tsx @@ -23,6 +23,7 @@ export function CoinInfo() { userJourney: UserJourney.WALLET, screen: 'CoinInfo', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/views/Settings.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/views/Settings.tsx index 447b54e6ea..4e426525ca 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/views/Settings.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/views/Settings.tsx @@ -46,6 +46,7 @@ export function Settings({ showDisconnectButton }: SettingsProps) { userJourney: UserJourney.WALLET, screen: 'Settings', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // disconnect all Wallet Connect pairings and disconnect the provider diff --git a/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx b/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx index 7db5bd8230..0ec068e326 100644 --- a/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx +++ b/packages/checkout/widgets-lib/src/widgets/wallet/views/WalletBalances.tsx @@ -78,6 +78,7 @@ export function WalletBalances({ userJourney: UserJourney.WALLET, screen: 'WalletBalances', }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -86,7 +87,7 @@ export function WalletBalances({ if (!cryptoFiatDispatch) return; if (!network) return; - const tokenSymbols = await fetchTokenSymbols(checkout, Number(network.chainId)); + const tokenSymbols = await fetchTokenSymbols(checkout, network.chainId); cryptoFiatDispatch({ payload: { @@ -95,7 +96,7 @@ export function WalletBalances({ }, }); })(); - }, [checkout, cryptoFiatDispatch, network?.chainId]); + }, [checkout, cryptoFiatDispatch, network]); useEffect(() => { let totalAmount = 0.0; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 448f5bfc7f..e409e05771 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,7 +59,7 @@ importers: version: 8.57.0 eslint-config-airbnb: specifier: ^19.0.4 - version: 19.0.4(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.9.0(eslint@8.57.0))(eslint-plugin-react-hooks@5.0.0(eslint@8.57.0))(eslint-plugin-react@7.35.0(eslint@8.57.0))(eslint@8.57.0) + version: 19.0.4(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.9.0(eslint@8.57.0))(eslint-plugin-react-hooks@5.2.0(eslint@8.57.0))(eslint-plugin-react@7.35.0(eslint@8.57.0))(eslint@8.57.0) eslint-config-airbnb-typescript: specifier: ^17.0.0 version: 17.1.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0)(typescript@5.6.2))(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint@8.57.0) @@ -132,7 +132,7 @@ importers: version: 0.25.21(@emotion/react@11.11.3(@types/react@18.3.12)(react@18.3.1))(@rive-app/react-canvas-lite@4.9.0(react@18.3.1))(embla-carousel-react@8.1.5(react@18.3.1))(framer-motion@11.18.2(@emotion/is-prop-valid@0.8.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@imtbl/sdk': specifier: latest - version: 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + version: 2.1.9 next: specifier: 14.2.25 version: 14.2.25(@babel/core@7.24.9)(@playwright/test@1.45.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1354,6 +1354,9 @@ importers: eslint: specifier: ^8.40.0 version: 8.57.0 + eslint-plugin-react-hooks: + specifier: ^5.2.0 + version: 5.2.0(eslint@8.57.0) jest: specifier: ^29.4.3 version: 29.7.0(@types/node@18.15.13)(babel-plugin-macros@3.1.0)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.13))(@types/node@18.15.13)(typescript@5.6.2)) @@ -10599,18 +10602,18 @@ packages: peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 - eslint-plugin-react-hooks@5.0.0: - resolution: {integrity: sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==} - engines: {node: '>=10'} - peerDependencies: - eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 - eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705: resolution: {integrity: sha512-AZYbMo/NW9chdL7vk6HQzQhT+PvTAEVqWk9ziruUoW2kAOcN5qNyelv70e0F1VNQAbvutOC9oc+xfWycI9FxDw==} engines: {node: '>=10'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 + eslint-plugin-react-hooks@5.2.0: + resolution: {integrity: sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==} + engines: {node: '>=10'} + peerDependencies: + eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 + eslint-plugin-react-refresh@0.4.19: resolution: {integrity: sha512-eyy8pcr/YxSYjBoqIFSrlbn9i/xvxUFa8CjzAYo9cFjgGXqq1hyjihcpZvxRLalpaWmueWR81xn7vuKmAFijDQ==} peerDependencies: @@ -21501,7 +21504,7 @@ snapshots: transitivePeerDependencies: - debug - '@imtbl/bridge-sdk@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/bridge-sdk@2.1.9': dependencies: '@imtbl/config': 2.1.9 '@jest/globals': 29.7.0 @@ -21513,16 +21516,16 @@ snapshots: - supports-color - utf-8-validate - '@imtbl/checkout-sdk@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/checkout-sdk@2.1.9': dependencies: '@imtbl/blockchain-data': 2.1.9 - '@imtbl/bridge-sdk': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/bridge-sdk': 2.1.9 '@imtbl/config': 2.1.9 - '@imtbl/dex-sdk': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/dex-sdk': 2.1.9 '@imtbl/generated-clients': 2.1.9 '@imtbl/metrics': 2.1.9 - '@imtbl/orderbook': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@imtbl/passport': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/orderbook': 2.1.9 + '@imtbl/passport': 2.1.9 '@metamask/detect-provider': 2.0.0 axios: 1.7.7 ethers: 6.13.5(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -21584,7 +21587,7 @@ snapshots: - typescript - utf-8-validate - '@imtbl/dex-sdk@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/dex-sdk@2.1.9': dependencies: '@imtbl/config': 2.1.9 '@uniswap/sdk-core': 3.2.3 @@ -21630,7 +21633,7 @@ snapshots: - debug - pg-native - '@imtbl/orderbook@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/orderbook@2.1.9': dependencies: '@imtbl/config': 2.1.9 '@imtbl/metrics': 2.1.9 @@ -21644,16 +21647,16 @@ snapshots: - debug - utf-8-validate - '@imtbl/passport@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/passport@2.1.9': dependencies: '@0xsequence/abi': 2.2.13 '@0xsequence/core': 2.2.13(ethers@6.13.5(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@imtbl/config': 2.1.9 '@imtbl/generated-clients': 2.1.9 '@imtbl/metrics': 2.1.9 - '@imtbl/toolkit': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@imtbl/x-client': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@imtbl/x-provider': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/toolkit': 2.1.9 + '@imtbl/x-client': 2.1.9 + '@imtbl/x-provider': 2.1.9 '@magic-ext/oidc': 12.0.0 '@magic-sdk/provider': 29.0.2(localforage@1.10.0) '@metamask/detect-provider': 2.0.0 @@ -21679,17 +21682,17 @@ snapshots: - encoding - supports-color - '@imtbl/sdk@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/sdk@2.1.9': dependencies: '@imtbl/blockchain-data': 2.1.9 - '@imtbl/checkout-sdk': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/checkout-sdk': 2.1.9 '@imtbl/config': 2.1.9 '@imtbl/minting-backend': 2.1.9 - '@imtbl/orderbook': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@imtbl/passport': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/orderbook': 2.1.9 + '@imtbl/passport': 2.1.9 '@imtbl/webhook': 2.1.9 - '@imtbl/x-client': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@imtbl/x-provider': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/x-client': 2.1.9 + '@imtbl/x-provider': 2.1.9 transitivePeerDependencies: - bufferutil - debug @@ -21698,9 +21701,9 @@ snapshots: - supports-color - utf-8-validate - '@imtbl/toolkit@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/toolkit@2.1.9': dependencies: - '@imtbl/x-client': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/x-client': 2.1.9 '@magic-ext/oidc': 12.0.0 '@metamask/detect-provider': 2.0.0 axios: 1.7.7 @@ -21723,7 +21726,7 @@ snapshots: transitivePeerDependencies: - debug - '@imtbl/x-client@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/x-client@2.1.9': dependencies: '@ethereumjs/wallet': 2.0.4 '@imtbl/config': 2.1.9 @@ -21739,12 +21742,12 @@ snapshots: - debug - utf-8-validate - '@imtbl/x-provider@2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@imtbl/x-provider@2.1.9': dependencies: '@imtbl/config': 2.1.9 '@imtbl/generated-clients': 2.1.9 - '@imtbl/toolkit': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@imtbl/x-client': 2.1.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@imtbl/toolkit': 2.1.9 + '@imtbl/x-client': 2.1.9 '@magic-ext/oidc': 12.0.0 '@metamask/detect-provider': 2.0.0 axios: 1.7.7 @@ -29496,14 +29499,14 @@ snapshots: eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint@8.57.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) - eslint-config-airbnb@19.0.4(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.9.0(eslint@8.57.0))(eslint-plugin-react-hooks@5.0.0(eslint@8.57.0))(eslint-plugin-react@7.35.0(eslint@8.57.0))(eslint@8.57.0): + eslint-config-airbnb@19.0.4(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.9.0(eslint@8.57.0))(eslint-plugin-react-hooks@5.2.0(eslint@8.57.0))(eslint-plugin-react@7.35.0(eslint@8.57.0))(eslint@8.57.0): dependencies: eslint: 8.57.0 eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint@8.57.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.6.2))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.9.0(eslint@8.57.0) eslint-plugin-react: 7.35.0(eslint@8.57.0) - eslint-plugin-react-hooks: 5.0.0(eslint@8.57.0) + eslint-plugin-react-hooks: 5.2.0(eslint@8.57.0) object.assign: 4.1.5 object.entries: 1.1.8 @@ -29959,11 +29962,11 @@ snapshots: dependencies: eslint: 9.16.0(jiti@1.21.0) - eslint-plugin-react-hooks@5.0.0(eslint@8.57.0): + eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705(eslint@8.57.0): dependencies: eslint: 8.57.0 - eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705(eslint@8.57.0): + eslint-plugin-react-hooks@5.2.0(eslint@8.57.0): dependencies: eslint: 8.57.0