@unifold/ui-react 0.1.48 → 0.1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { AutoSwapResponse, ChainType, DepositEvent, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, VerifyAddressResponse } from '@unifold/core';
2
+ import { AutoSwapResponse, ChainType, DepositEvent, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, SupportedDepositTokensResponse, VerifyAddressResponse } from '@unifold/core';
3
3
  export { ChainType } from '@unifold/core';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
@@ -528,6 +528,18 @@ interface WithdrawModalProps {
528
528
  sourceTokenSymbol?: string;
529
529
  recipientAddress?: string;
530
530
  senderAddress: string;
531
+ /**
532
+ * Pre-select the destination (receive) token/chain in the withdraw view.
533
+ * All four props are optional. To match a specific token, provide `chainType` + `chainId` + (`symbol` OR `tokenAddress`).
534
+ * If omitted or no match is found in `/supported_destination_tokens`, the first available token and chain are used.
535
+ */
536
+ defaultDestinationChainType?: string;
537
+ /** Destination chain ID (e.g. `"mainnet"`, `"137"`). Must be paired with `defaultDestinationChainType` + symbol or token address. */
538
+ defaultDestinationChainId?: string;
539
+ /** Destination token contract address. Must be paired with `defaultDestinationChainType` + `defaultDestinationChainId`. */
540
+ defaultDestinationTokenAddress?: string;
541
+ /** Destination token symbol (e.g. `"USDC"`). Must be paired with `defaultDestinationChainType` + `defaultDestinationChainId`. */
542
+ defaultDestinationSymbol?: string;
531
543
  onWithdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
532
544
  onWithdrawSuccess?: (data: {
533
545
  message: string;
@@ -541,7 +553,7 @@ interface WithdrawModalProps {
541
553
  theme?: "light" | "dark" | "auto";
542
554
  hideOverlay?: boolean;
543
555
  }
544
- declare function WithdrawModal({ open, onOpenChange, publishableKey, modalTitle, externalUserId, sourceChainType, sourceChainId, sourceTokenAddress, sourceTokenSymbol, recipientAddress: recipientAddressProp, senderAddress, onWithdraw, onWithdrawSuccess, onWithdrawError, theme, hideOverlay, }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
556
+ declare function WithdrawModal({ open, onOpenChange, publishableKey, modalTitle, externalUserId, sourceChainType, sourceChainId, sourceTokenAddress, sourceTokenSymbol, recipientAddress: recipientAddressProp, senderAddress, defaultDestinationChainType, defaultDestinationChainId, defaultDestinationTokenAddress, defaultDestinationSymbol, onWithdraw, onWithdrawSuccess, onWithdrawError, theme, hideOverlay, }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
545
557
 
546
558
  interface WithdrawTokenSelectorProps {
547
559
  tokens: DestinationToken[];
@@ -808,7 +820,10 @@ interface UsePaymentIntentParams {
808
820
  * Hook to retrieve and poll a payment intent via react-query.
809
821
  *
810
822
  * Fetches the payment intent on mount and polls at the configured interval
811
- * so `amount_received_usd` and `status` stay up-to-date in the UI.
823
+ * so `amount_received_usd` and `status` stay up-to-date in the UI. Polling
824
+ * automatically stops once the PI reaches a terminal status. Locked-quote
825
+ * states like `awaiting_refund` / `refunding` / `refund_failed` keep polling
826
+ * because they can still flip.
812
827
  */
813
828
  declare function usePaymentIntent(params: UsePaymentIntentParams): _tanstack_react_query.UseQueryResult<PaymentIntent, Error>;
814
829
 
@@ -863,6 +878,22 @@ declare function useWithdrawPolling({ userId, publishableKey, depositWalletId, e
863
878
  */
864
879
  declare function useSupportedDestinationTokens(publishableKey: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<SupportedDestinationTokensResponse, Error>;
865
880
 
881
+ interface UseSupportedDepositTokensOptions {
882
+ destination_token_address?: string;
883
+ destination_chain_id?: string;
884
+ destination_chain_type?: string;
885
+ }
886
+ /**
887
+ * Hook to fetch supported deposit tokens with caching and deduplication via react-query.
888
+ *
889
+ * Replaces manual useEffect + useState fetching with automatic caching (5 min stale),
890
+ * request deduplication across components, and built-in loading/error states.
891
+ *
892
+ * @param publishableKey - Publishable key for API calls
893
+ * @param options - Optional destination filters (all three must be provided to filter)
894
+ */
895
+ declare function useSupportedDepositTokens(publishableKey: string, options?: UseSupportedDepositTokensOptions): _tanstack_react_query.UseQueryResult<SupportedDepositTokensResponse, Error>;
896
+
866
897
  interface UseVerifyRecipientAddressParams {
867
898
  chainType?: string;
868
899
  chainId?: string;
@@ -1175,4 +1206,4 @@ declare function cn(...inputs: ClassValue[]): string;
1175
1206
  */
1176
1207
  declare function truncateAddress(address: string, startChars?: number, endChars?: number): string;
1177
1208
 
1178
- export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, CheckoutModal, type CheckoutModalProps, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, HYPERCORE_CHAIN_ID, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, type UseDepositQuoteParams, type UsePaymentIntentParams, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, isHypercoreChain, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendHypercoreWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useDepositQuote, usePaymentIntent, useSourceTokenValidation, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
1209
+ export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, CheckoutModal, type CheckoutModalProps, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, HYPERCORE_CHAIN_ID, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, type UseDepositQuoteParams, type UsePaymentIntentParams, type UseSupportedDepositTokensOptions, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, isHypercoreChain, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendHypercoreWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useDepositQuote, usePaymentIntent, useSourceTokenValidation, useSupportedDepositTokens, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { AutoSwapResponse, ChainType, DepositEvent, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, VerifyAddressResponse } from '@unifold/core';
2
+ import { AutoSwapResponse, ChainType, DepositEvent, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, SupportedDepositTokensResponse, VerifyAddressResponse } from '@unifold/core';
3
3
  export { ChainType } from '@unifold/core';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
@@ -528,6 +528,18 @@ interface WithdrawModalProps {
528
528
  sourceTokenSymbol?: string;
529
529
  recipientAddress?: string;
530
530
  senderAddress: string;
531
+ /**
532
+ * Pre-select the destination (receive) token/chain in the withdraw view.
533
+ * All four props are optional. To match a specific token, provide `chainType` + `chainId` + (`symbol` OR `tokenAddress`).
534
+ * If omitted or no match is found in `/supported_destination_tokens`, the first available token and chain are used.
535
+ */
536
+ defaultDestinationChainType?: string;
537
+ /** Destination chain ID (e.g. `"mainnet"`, `"137"`). Must be paired with `defaultDestinationChainType` + symbol or token address. */
538
+ defaultDestinationChainId?: string;
539
+ /** Destination token contract address. Must be paired with `defaultDestinationChainType` + `defaultDestinationChainId`. */
540
+ defaultDestinationTokenAddress?: string;
541
+ /** Destination token symbol (e.g. `"USDC"`). Must be paired with `defaultDestinationChainType` + `defaultDestinationChainId`. */
542
+ defaultDestinationSymbol?: string;
531
543
  onWithdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
532
544
  onWithdrawSuccess?: (data: {
533
545
  message: string;
@@ -541,7 +553,7 @@ interface WithdrawModalProps {
541
553
  theme?: "light" | "dark" | "auto";
542
554
  hideOverlay?: boolean;
543
555
  }
544
- declare function WithdrawModal({ open, onOpenChange, publishableKey, modalTitle, externalUserId, sourceChainType, sourceChainId, sourceTokenAddress, sourceTokenSymbol, recipientAddress: recipientAddressProp, senderAddress, onWithdraw, onWithdrawSuccess, onWithdrawError, theme, hideOverlay, }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
556
+ declare function WithdrawModal({ open, onOpenChange, publishableKey, modalTitle, externalUserId, sourceChainType, sourceChainId, sourceTokenAddress, sourceTokenSymbol, recipientAddress: recipientAddressProp, senderAddress, defaultDestinationChainType, defaultDestinationChainId, defaultDestinationTokenAddress, defaultDestinationSymbol, onWithdraw, onWithdrawSuccess, onWithdrawError, theme, hideOverlay, }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
545
557
 
546
558
  interface WithdrawTokenSelectorProps {
547
559
  tokens: DestinationToken[];
@@ -808,7 +820,10 @@ interface UsePaymentIntentParams {
808
820
  * Hook to retrieve and poll a payment intent via react-query.
809
821
  *
810
822
  * Fetches the payment intent on mount and polls at the configured interval
811
- * so `amount_received_usd` and `status` stay up-to-date in the UI.
823
+ * so `amount_received_usd` and `status` stay up-to-date in the UI. Polling
824
+ * automatically stops once the PI reaches a terminal status. Locked-quote
825
+ * states like `awaiting_refund` / `refunding` / `refund_failed` keep polling
826
+ * because they can still flip.
812
827
  */
813
828
  declare function usePaymentIntent(params: UsePaymentIntentParams): _tanstack_react_query.UseQueryResult<PaymentIntent, Error>;
814
829
 
@@ -863,6 +878,22 @@ declare function useWithdrawPolling({ userId, publishableKey, depositWalletId, e
863
878
  */
864
879
  declare function useSupportedDestinationTokens(publishableKey: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<SupportedDestinationTokensResponse, Error>;
865
880
 
881
+ interface UseSupportedDepositTokensOptions {
882
+ destination_token_address?: string;
883
+ destination_chain_id?: string;
884
+ destination_chain_type?: string;
885
+ }
886
+ /**
887
+ * Hook to fetch supported deposit tokens with caching and deduplication via react-query.
888
+ *
889
+ * Replaces manual useEffect + useState fetching with automatic caching (5 min stale),
890
+ * request deduplication across components, and built-in loading/error states.
891
+ *
892
+ * @param publishableKey - Publishable key for API calls
893
+ * @param options - Optional destination filters (all three must be provided to filter)
894
+ */
895
+ declare function useSupportedDepositTokens(publishableKey: string, options?: UseSupportedDepositTokensOptions): _tanstack_react_query.UseQueryResult<SupportedDepositTokensResponse, Error>;
896
+
866
897
  interface UseVerifyRecipientAddressParams {
867
898
  chainType?: string;
868
899
  chainId?: string;
@@ -1175,4 +1206,4 @@ declare function cn(...inputs: ClassValue[]): string;
1175
1206
  */
1176
1207
  declare function truncateAddress(address: string, startChars?: number, endChars?: number): string;
1177
1208
 
1178
- export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, CheckoutModal, type CheckoutModalProps, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, HYPERCORE_CHAIN_ID, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, type UseDepositQuoteParams, type UsePaymentIntentParams, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, isHypercoreChain, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendHypercoreWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useDepositQuote, usePaymentIntent, useSourceTokenValidation, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
1209
+ export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, CheckoutModal, type CheckoutModalProps, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, HYPERCORE_CHAIN_ID, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, type UseDepositQuoteParams, type UsePaymentIntentParams, type UseSupportedDepositTokensOptions, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, isHypercoreChain, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendHypercoreWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useDepositQuote, usePaymentIntent, useSourceTokenValidation, useSupportedDepositTokens, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
package/dist/index.js CHANGED
@@ -101,6 +101,7 @@ __export(index_exports, {
101
101
  useDepositQuote: () => useDepositQuote,
102
102
  usePaymentIntent: () => usePaymentIntent,
103
103
  useSourceTokenValidation: () => useSourceTokenValidation,
104
+ useSupportedDepositTokens: () => useSupportedDepositTokens,
104
105
  useSupportedDestinationTokens: () => useSupportedDestinationTokens,
105
106
  useTheme: () => useTheme,
106
107
  useVerifyRecipientAddress: () => useVerifyRecipientAddress,
@@ -2762,31 +2763,29 @@ function BuyWithCard({
2762
2763
  );
2763
2764
  if (manualProviderStillExists) {
2764
2765
  setSelectedProvider(manualProviderStillExists);
2765
- const bestProvider = response.data.reduce(
2766
- (best, current) => current.destination_amount > best.destination_amount ? current : best
2767
- );
2766
+ const firstProvider = response.data[0];
2768
2767
  if (!autoSelectedProvider) {
2769
- setAutoSelectedProvider(bestProvider.service_provider);
2768
+ setAutoSelectedProvider(firstProvider.service_provider);
2770
2769
  }
2771
2770
  setIsAutoSelected(
2772
2771
  manualProviderStillExists.service_provider === autoSelectedProvider
2773
2772
  );
2774
- } else {
2775
- const bestProvider = response.data.reduce(
2776
- (best, current) => current.destination_amount > best.destination_amount ? current : best
2777
- );
2778
- setSelectedProvider(bestProvider);
2779
- setAutoSelectedProvider(bestProvider.service_provider);
2773
+ } else if (response.data.length > 0) {
2774
+ const firstProvider = response.data[0];
2775
+ setSelectedProvider(firstProvider);
2776
+ setAutoSelectedProvider(firstProvider.service_provider);
2780
2777
  setIsAutoSelected(true);
2781
2778
  setHasManualSelection(false);
2779
+ } else {
2780
+ setSelectedProvider(null);
2781
+ setIsAutoSelected(false);
2782
+ setHasManualSelection(false);
2782
2783
  }
2783
2784
  } else {
2784
2785
  if (response.data.length > 0) {
2785
- const bestProvider = response.data.reduce(
2786
- (best, current) => current.destination_amount > best.destination_amount ? current : best
2787
- );
2788
- setSelectedProvider(bestProvider);
2789
- setAutoSelectedProvider(bestProvider.service_provider);
2786
+ const firstProvider = response.data[0];
2787
+ setSelectedProvider(firstProvider);
2788
+ setAutoSelectedProvider(firstProvider.service_provider);
2790
2789
  setIsAutoSelected(true);
2791
2790
  }
2792
2791
  }
@@ -2882,19 +2881,7 @@ function BuyWithCard({
2882
2881
  window.open(sessionStartUrl, "_blank");
2883
2882
  handleViewChange("onramp");
2884
2883
  };
2885
- const getProviderBadges = (quote, allQuotes) => {
2886
- const badges = [];
2887
- const maxDestination = Math.max(
2888
- ...allQuotes.map((q) => q.destination_amount)
2889
- );
2890
- if (quote.destination_amount === maxDestination) {
2891
- badges.push("Best price");
2892
- }
2893
- return badges;
2894
- };
2895
- const sortedQuotes = [...quotes].sort(
2896
- (a, b) => b.destination_amount - a.destination_amount
2897
- );
2884
+ const sortedQuotes = quotes;
2898
2885
  const currencySymbol = getCurrencySymbol(currency);
2899
2886
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2900
2887
  "div",
@@ -3096,31 +3083,7 @@ function BuyWithCard({
3096
3083
  children: selectedProvider.service_provider_display_name
3097
3084
  }
3098
3085
  ),
3099
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: [
3100
- isAutoSelected && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3101
- "span",
3102
- {
3103
- className: "uf-text-[10px] uf-font-normal",
3104
- style: {
3105
- color: colors2.success,
3106
- fontFamily: fonts.regular
3107
- },
3108
- children: "Best price"
3109
- }
3110
- ),
3111
- isAutoSelected && selectedProvider.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3112
- "span",
3113
- {
3114
- className: "uf-text-[10px]",
3115
- style: {
3116
- color: components.card.labelColor,
3117
- fontFamily: fonts.regular
3118
- },
3119
- children: "\u2022"
3120
- }
3121
- ),
3122
- selectedProvider.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "uf-text-[10px] uf-text-muted-foreground uf-font-normal", children: "No document upload" })
3123
- ] })
3086
+ selectedProvider.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "uf-text-[10px] uf-text-muted-foreground uf-font-normal", children: "No document upload" }) })
3124
3087
  ] }),
3125
3088
  quotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3126
3089
  import_lucide_react6.ChevronRight,
@@ -3184,7 +3147,6 @@ function BuyWithCard({
3184
3147
  {
3185
3148
  className: `uf-transition-all uf-duration-300 uf-min-h-[420px] uf-flex uf-flex-col ${showQuotesView && !showOnrampView ? "uf-opacity-100" : "uf-opacity-0 uf-pointer-events-none uf-absolute uf-inset-0"}`,
3186
3149
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "uf-space-y-2 uf-pt-2 uf-pb-8 uf-overflow-y-auto uf-flex-1 uf-min-h-0", children: sortedQuotes.map((quote, index) => {
3187
- const badges = getProviderBadges(quote, sortedQuotes);
3188
3150
  const displayName = quote.service_provider_display_name;
3189
3151
  const isSelected = selectedProvider?.service_provider === quote.service_provider;
3190
3152
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
@@ -3227,39 +3189,17 @@ function BuyWithCard({
3227
3189
  children: displayName
3228
3190
  }
3229
3191
  ),
3230
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: [
3231
- badges.map((badge, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3232
- "span",
3233
- {
3234
- className: "uf-text-[10px] uf-font-normal",
3235
- style: { color: colors2.success },
3236
- children: [
3237
- badge,
3238
- i < badges.length - 1 && ","
3239
- ]
3192
+ quote.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3193
+ "span",
3194
+ {
3195
+ className: "uf-text-[10px] uf-font-normal",
3196
+ style: {
3197
+ color: components.card.subtextRightColor,
3198
+ fontFamily: fonts.regular
3240
3199
  },
3241
- i
3242
- )),
3243
- quote.low_kyc === false && badges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3244
- "span",
3245
- {
3246
- className: "uf-text-[10px]",
3247
- style: { color: components.card.subtextRightColor },
3248
- children: "\u2022"
3249
- }
3250
- ),
3251
- quote.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3252
- "span",
3253
- {
3254
- className: "uf-text-[10px] uf-font-normal",
3255
- style: {
3256
- color: components.card.subtextRightColor,
3257
- fontFamily: fonts.regular
3258
- },
3259
- children: "No document upload"
3260
- }
3261
- )
3262
- ] })
3200
+ children: "No document upload"
3201
+ }
3202
+ ) })
3263
3203
  ] })
3264
3204
  ] }),
3265
3205
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "uf-text-right", children: [
@@ -7053,14 +6993,23 @@ function useAllowedCountry(publishableKey) {
7053
6993
  let isAllowed = null;
7054
6994
  if (ipData && configData) {
7055
6995
  const blockedCodes = configData.blocked_country_codes || [];
6996
+ const blockedSubdivisions = configData.blocked_country_subdivisions || [];
7056
6997
  const userCountryUpper = ipData.alpha2.toUpperCase();
7057
- isAllowed = !blockedCodes.some(
6998
+ const userSubdivision = ipData.subdivision_code || ipData.state || "";
6999
+ const userSubdivisionUpper = userSubdivision.toUpperCase();
7000
+ const isCountryBlocked = blockedCodes.some(
7058
7001
  (code) => code.toUpperCase() === userCountryUpper
7059
7002
  );
7003
+ const isSubdivisionBlocked = blockedSubdivisions.some((entry) => {
7004
+ if (entry.country_code.toUpperCase() !== userCountryUpper) return false;
7005
+ return entry.subdivision_codes.some(
7006
+ (code) => code.toUpperCase() === userSubdivisionUpper
7007
+ );
7008
+ });
7009
+ isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
7060
7010
  }
7061
7011
  return {
7062
7012
  isAllowed,
7063
- // Return lowercase for consistency with useUserIp hook
7064
7013
  alpha2: ipData?.alpha2?.toLowerCase() ?? null,
7065
7014
  country: ipData?.country ?? null,
7066
7015
  isLoading,
@@ -8032,77 +7981,77 @@ function DepositPollingUi({
8032
7981
  return null;
8033
7982
  }
8034
7983
 
8035
- // src/hooks/use-default-source-token.ts
7984
+ // src/hooks/use-default-token.ts
8036
7985
  var import_react13 = require("react");
8037
7986
  var getChainKey = (chainId, chainType) => {
8038
7987
  return `${chainType}:${chainId}`;
8039
7988
  };
8040
- function resolveSourceToken(supportedTokens, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol) {
8041
- if (!supportedTokens.length) return null;
8042
- let selectedTokenData;
8043
- let selectedChainData;
8044
- const hasChainDefaults = defaultSourceChainType && defaultSourceChainId;
8045
- if (defaultSourceTokenAddress && hasChainDefaults) {
8046
- for (const t11 of supportedTokens) {
7989
+ function resolveToken(tokens, defaultChainType, defaultChainId, defaultTokenAddress, defaultSymbol) {
7990
+ if (!tokens.length) return null;
7991
+ let selectedToken;
7992
+ let selectedChain;
7993
+ const hasChainDefaults = defaultChainType && defaultChainId;
7994
+ if (defaultTokenAddress && hasChainDefaults) {
7995
+ for (const t11 of tokens) {
8047
7996
  const matchingChain = t11.chains.find(
8048
- (c) => c.token_address.toLowerCase() === defaultSourceTokenAddress.toLowerCase() && c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
7997
+ (c) => c.token_address.toLowerCase() === defaultTokenAddress.toLowerCase() && c.chain_type === defaultChainType && c.chain_id === defaultChainId
8049
7998
  );
8050
7999
  if (matchingChain) {
8051
- selectedTokenData = t11;
8052
- selectedChainData = matchingChain;
8000
+ selectedToken = t11;
8001
+ selectedChain = matchingChain;
8053
8002
  break;
8054
8003
  }
8055
8004
  }
8056
8005
  }
8057
- if (!selectedTokenData && defaultSourceSymbol && hasChainDefaults) {
8058
- for (const t11 of supportedTokens) {
8059
- if (t11.symbol !== defaultSourceSymbol) continue;
8006
+ if (!selectedToken && defaultSymbol && hasChainDefaults) {
8007
+ for (const t11 of tokens) {
8008
+ if (t11.symbol !== defaultSymbol) continue;
8060
8009
  const matchedChain = t11.chains.find(
8061
- (c) => c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
8010
+ (c) => c.chain_type === defaultChainType && c.chain_id === defaultChainId
8062
8011
  );
8063
8012
  if (matchedChain) {
8064
- selectedTokenData = t11;
8065
- selectedChainData = matchedChain;
8013
+ selectedToken = t11;
8014
+ selectedChain = matchedChain;
8066
8015
  break;
8067
8016
  }
8068
8017
  }
8069
8018
  }
8070
- if (!selectedTokenData) {
8071
- for (const t11 of supportedTokens) {
8019
+ if (!selectedToken) {
8020
+ for (const t11 of tokens) {
8072
8021
  if (t11.chains.length > 0) {
8073
- selectedTokenData = t11;
8074
- selectedChainData = t11.chains[0];
8022
+ selectedToken = t11;
8023
+ selectedChain = t11.chains[0];
8075
8024
  break;
8076
8025
  }
8077
8026
  }
8078
8027
  }
8079
- if (selectedTokenData && selectedChainData) {
8080
- return { token: selectedTokenData, chain: selectedChainData };
8028
+ if (selectedToken && selectedChain) {
8029
+ return { token: selectedToken, chain: selectedChain };
8081
8030
  }
8082
8031
  return null;
8083
8032
  }
8084
- function useDefaultSourceToken({
8085
- supportedTokens,
8086
- defaultSourceChainType,
8087
- defaultSourceChainId,
8088
- defaultSourceTokenAddress,
8089
- defaultSourceSymbol
8033
+ function useDefaultToken({
8034
+ tokens,
8035
+ defaultChainType,
8036
+ defaultChainId,
8037
+ defaultTokenAddress,
8038
+ defaultSymbol
8090
8039
  }) {
8091
8040
  const [token, setToken] = (0, import_react13.useState)(null);
8092
8041
  const [chain, setChain] = (0, import_react13.useState)(null);
8093
8042
  const [initialSelectionDone, setInitialSelectionDone] = (0, import_react13.useState)(false);
8094
8043
  const appliedDefaultsRef = (0, import_react13.useRef)("");
8095
8044
  (0, import_react13.useEffect)(() => {
8096
- if (!supportedTokens.length) return;
8097
- const defaultsKey = `${defaultSourceTokenAddress ?? ""}|${defaultSourceSymbol ?? ""}|${defaultSourceChainType ?? ""}|${defaultSourceChainId ?? ""}`;
8045
+ if (!tokens.length) return;
8046
+ const defaultsKey = `${defaultTokenAddress ?? ""}|${defaultSymbol ?? ""}|${defaultChainType ?? ""}|${defaultChainId ?? ""}`;
8098
8047
  const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
8099
8048
  if (initialSelectionDone && !defaultsChanged) return;
8100
- const result = resolveSourceToken(
8101
- supportedTokens,
8102
- defaultSourceChainType,
8103
- defaultSourceChainId,
8104
- defaultSourceTokenAddress,
8105
- defaultSourceSymbol
8049
+ const result = resolveToken(
8050
+ tokens,
8051
+ defaultChainType,
8052
+ defaultChainId,
8053
+ defaultTokenAddress,
8054
+ defaultSymbol
8106
8055
  );
8107
8056
  if (result) {
8108
8057
  setToken(result.token.symbol);
@@ -8111,16 +8060,16 @@ function useDefaultSourceToken({
8111
8060
  setInitialSelectionDone(true);
8112
8061
  }
8113
8062
  }, [
8114
- supportedTokens,
8115
- defaultSourceTokenAddress,
8116
- defaultSourceSymbol,
8117
- defaultSourceChainType,
8118
- defaultSourceChainId,
8063
+ tokens,
8064
+ defaultTokenAddress,
8065
+ defaultSymbol,
8066
+ defaultChainType,
8067
+ defaultChainId,
8119
8068
  initialSelectionDone
8120
8069
  ]);
8121
8070
  (0, import_react13.useEffect)(() => {
8122
- if (!supportedTokens.length || !token) return;
8123
- const currentToken = supportedTokens.find((t11) => t11.symbol === token);
8071
+ if (!tokens.length || !token) return;
8072
+ const currentToken = tokens.find((t11) => t11.symbol === token);
8124
8073
  if (!currentToken || currentToken.chains.length === 0) return;
8125
8074
  const isChainAvailable = chain && currentToken.chains.some((c) => {
8126
8075
  return getChainKey(c.chain_id, c.chain_type) === chain;
@@ -8129,10 +8078,27 @@ function useDefaultSourceToken({
8129
8078
  const firstChain = currentToken.chains[0];
8130
8079
  setChain(getChainKey(firstChain.chain_id, firstChain.chain_type));
8131
8080
  }
8132
- }, [token, supportedTokens, chain]);
8081
+ }, [token, tokens, chain]);
8133
8082
  return { token, chain, setToken, setChain, initialSelectionDone };
8134
8083
  }
8135
8084
 
8085
+ // src/hooks/use-default-source-token.ts
8086
+ function useDefaultSourceToken({
8087
+ supportedTokens,
8088
+ defaultSourceChainType,
8089
+ defaultSourceChainId,
8090
+ defaultSourceTokenAddress,
8091
+ defaultSourceSymbol
8092
+ }) {
8093
+ return useDefaultToken({
8094
+ tokens: supportedTokens,
8095
+ defaultChainType: defaultSourceChainType,
8096
+ defaultChainId: defaultSourceChainId,
8097
+ defaultTokenAddress: defaultSourceTokenAddress,
8098
+ defaultSymbol: defaultSourceSymbol
8099
+ });
8100
+ }
8101
+
8136
8102
  // src/components/deposits/shared/DepositFooterLinks.tsx
8137
8103
  var import_jsx_runtime38 = require("react/jsx-runtime");
8138
8104
  function DepositFooterLinks({
@@ -12512,19 +12478,30 @@ var import_lucide_react24 = require("lucide-react");
12512
12478
  // src/hooks/use-payment-intent.ts
12513
12479
  var import_react_query9 = require("@tanstack/react-query");
12514
12480
  var import_core24 = require("@unifold/core");
12481
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
12482
+ "succeeded",
12483
+ "expired",
12484
+ "refunded",
12485
+ "canceled"
12486
+ ]);
12515
12487
  function usePaymentIntent(params) {
12516
12488
  const {
12517
12489
  clientSecret,
12518
12490
  publishableKey,
12519
12491
  enabled = true,
12520
- pollingInterval = 5e3
12492
+ pollingInterval = 3e3
12521
12493
  } = params;
12522
12494
  return (0, import_react_query9.useQuery)({
12523
12495
  queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
12524
12496
  queryFn: () => (0, import_core24.retrievePaymentIntent)(clientSecret, publishableKey),
12525
12497
  enabled: enabled && !!clientSecret && !!publishableKey,
12526
12498
  staleTime: 0,
12527
- refetchInterval: pollingInterval || false,
12499
+ refetchInterval: (query) => {
12500
+ if (!pollingInterval) return false;
12501
+ const status = query.state.data?.status;
12502
+ if (status && TERMINAL_STATUSES.has(status)) return false;
12503
+ return pollingInterval;
12504
+ },
12528
12505
  refetchOnWindowFocus: true,
12529
12506
  retry: 3,
12530
12507
  retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
@@ -12655,7 +12632,7 @@ function CheckoutModal({
12655
12632
  clientSecret,
12656
12633
  publishableKey,
12657
12634
  enabled: open && !!clientSecret,
12658
- pollingInterval: 5e3
12635
+ pollingInterval: 3e3
12659
12636
  });
12660
12637
  const { projectConfig } = useProjectConfig({
12661
12638
  publishableKey,
@@ -13205,6 +13182,23 @@ function useSupportedDestinationTokens(publishableKey, enabled = true) {
13205
13182
  });
13206
13183
  }
13207
13184
 
13185
+ // src/hooks/use-default-destination-token.ts
13186
+ function useDefaultDestinationToken({
13187
+ destinationTokens,
13188
+ defaultDestinationChainType,
13189
+ defaultDestinationChainId,
13190
+ defaultDestinationTokenAddress,
13191
+ defaultDestinationSymbol
13192
+ }) {
13193
+ return useDefaultToken({
13194
+ tokens: destinationTokens,
13195
+ defaultChainType: defaultDestinationChainType,
13196
+ defaultChainId: defaultDestinationChainId,
13197
+ defaultTokenAddress: defaultDestinationTokenAddress,
13198
+ defaultSymbol: defaultDestinationSymbol
13199
+ });
13200
+ }
13201
+
13208
13202
  // src/hooks/use-source-token-validation.ts
13209
13203
  var import_react_query12 = require("@tanstack/react-query");
13210
13204
  var import_core27 = require("@unifold/core");
@@ -14736,6 +14730,10 @@ function WithdrawModal({
14736
14730
  sourceTokenSymbol,
14737
14731
  recipientAddress: recipientAddressProp,
14738
14732
  senderAddress,
14733
+ defaultDestinationChainType,
14734
+ defaultDestinationChainId,
14735
+ defaultDestinationTokenAddress,
14736
+ defaultDestinationSymbol,
14739
14737
  onWithdraw,
14740
14738
  onWithdrawSuccess,
14741
14739
  onWithdrawError,
@@ -14779,8 +14777,21 @@ function WithdrawModal({
14779
14777
  publishableKey,
14780
14778
  enabled: open
14781
14779
  });
14782
- const [selectedToken, setSelectedToken] = (0, import_react23.useState)(null);
14783
- const [selectedChain, setSelectedChain] = (0, import_react23.useState)(null);
14780
+ const {
14781
+ token: selectedTokenSymbol,
14782
+ chain: selectedChainKey,
14783
+ setToken: setSelectedTokenSymbol,
14784
+ setChain: setSelectedChainKey,
14785
+ initialSelectionDone
14786
+ } = useDefaultDestinationToken({
14787
+ destinationTokens,
14788
+ defaultDestinationChainType,
14789
+ defaultDestinationChainId,
14790
+ defaultDestinationTokenAddress,
14791
+ defaultDestinationSymbol
14792
+ });
14793
+ const selectedToken = selectedTokenSymbol ? destinationTokens.find((t11) => t11.symbol === selectedTokenSymbol) ?? null : null;
14794
+ const selectedChain = selectedToken && selectedChainKey ? selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === selectedChainKey) ?? null : null;
14784
14795
  const [view, setView] = (0, import_react23.useState)("form");
14785
14796
  const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react23.useState)();
14786
14797
  const [selectedExecution, setSelectedExecution] = (0, import_react23.useState)(null);
@@ -14822,21 +14833,11 @@ function WithdrawModal({
14822
14833
  setSubmittedTxInfo(txInfo);
14823
14834
  setView("confirming");
14824
14835
  }, []);
14825
- (0, import_react23.useEffect)(() => {
14826
- if (!destinationTokens.length || selectedToken) return;
14827
- const first = destinationTokens[0];
14828
- if (first?.chains.length > 0) {
14829
- setSelectedToken(first);
14830
- setSelectedChain(first.chains[0]);
14831
- }
14832
- }, [destinationTokens, selectedToken]);
14833
14836
  const resetViewTimeoutRef = (0, import_react23.useRef)(null);
14834
14837
  const handleClose = (0, import_react23.useCallback)(() => {
14835
14838
  onOpenChange(false);
14836
14839
  if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
14837
14840
  resetViewTimeoutRef.current = setTimeout(() => {
14838
- setSelectedToken(null);
14839
- setSelectedChain(null);
14840
14841
  setView("form");
14841
14842
  setSelectedExecution(null);
14842
14843
  setSubmittedTxInfo(null);
@@ -14850,8 +14851,6 @@ function WithdrawModal({
14850
14851
  clearTimeout(resetViewTimeoutRef.current);
14851
14852
  resetViewTimeoutRef.current = null;
14852
14853
  }
14853
- setSelectedToken(null);
14854
- setSelectedChain(null);
14855
14854
  setView("form");
14856
14855
  setSelectedExecution(null);
14857
14856
  setSubmittedTxInfo(null);
@@ -14861,19 +14860,13 @@ function WithdrawModal({
14861
14860
  if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
14862
14861
  }, []);
14863
14862
  const handleTokenSymbolChange = (0, import_react23.useCallback)((symbol) => {
14864
- const tok = destinationTokens.find((t11) => t11.symbol === symbol);
14865
- if (tok) {
14866
- setSelectedToken(tok);
14867
- if (tok.chains.length > 0) setSelectedChain(tok.chains[0]);
14868
- }
14869
- }, [destinationTokens]);
14863
+ setSelectedTokenSymbol(symbol);
14864
+ }, [setSelectedTokenSymbol]);
14870
14865
  const handleChainKeyChange = (0, import_react23.useCallback)((chainKey) => {
14871
- if (!selectedToken) return;
14872
- const chain = selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === chainKey);
14873
- if (chain) setSelectedChain(chain);
14874
- }, [selectedToken]);
14866
+ setSelectedChainKey(chainKey);
14867
+ }, [setSelectedChainKey]);
14875
14868
  const isSourceSupported = sourceValidation?.isSupported ?? null;
14876
- const isAnyLoading = tokensLoading || isCheckingSourceToken;
14869
+ const isAnyLoading = tokensLoading || isCheckingSourceToken || destinationTokens.length > 0 && !initialSelectionDone;
14877
14870
  const withdrawPoweredByFooter = /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PoweredByUnifold, { color: colors2.foregroundMuted, className: "uf-flex uf-justify-center uf-shrink-0" }) });
14878
14871
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Dialog, { open: hideOverlay || open, onOpenChange: hideOverlay ? void 0 : handleClose, modal: !hideOverlay, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
14879
14872
  DialogContent,
@@ -15260,6 +15253,7 @@ function WithdrawTokenSelector({
15260
15253
  useDepositQuote,
15261
15254
  usePaymentIntent,
15262
15255
  useSourceTokenValidation,
15256
+ useSupportedDepositTokens,
15263
15257
  useSupportedDestinationTokens,
15264
15258
  useTheme,
15265
15259
  useVerifyRecipientAddress,
package/dist/index.mjs CHANGED
@@ -2686,31 +2686,29 @@ function BuyWithCard({
2686
2686
  );
2687
2687
  if (manualProviderStillExists) {
2688
2688
  setSelectedProvider(manualProviderStillExists);
2689
- const bestProvider = response.data.reduce(
2690
- (best, current) => current.destination_amount > best.destination_amount ? current : best
2691
- );
2689
+ const firstProvider = response.data[0];
2692
2690
  if (!autoSelectedProvider) {
2693
- setAutoSelectedProvider(bestProvider.service_provider);
2691
+ setAutoSelectedProvider(firstProvider.service_provider);
2694
2692
  }
2695
2693
  setIsAutoSelected(
2696
2694
  manualProviderStillExists.service_provider === autoSelectedProvider
2697
2695
  );
2698
- } else {
2699
- const bestProvider = response.data.reduce(
2700
- (best, current) => current.destination_amount > best.destination_amount ? current : best
2701
- );
2702
- setSelectedProvider(bestProvider);
2703
- setAutoSelectedProvider(bestProvider.service_provider);
2696
+ } else if (response.data.length > 0) {
2697
+ const firstProvider = response.data[0];
2698
+ setSelectedProvider(firstProvider);
2699
+ setAutoSelectedProvider(firstProvider.service_provider);
2704
2700
  setIsAutoSelected(true);
2705
2701
  setHasManualSelection(false);
2702
+ } else {
2703
+ setSelectedProvider(null);
2704
+ setIsAutoSelected(false);
2705
+ setHasManualSelection(false);
2706
2706
  }
2707
2707
  } else {
2708
2708
  if (response.data.length > 0) {
2709
- const bestProvider = response.data.reduce(
2710
- (best, current) => current.destination_amount > best.destination_amount ? current : best
2711
- );
2712
- setSelectedProvider(bestProvider);
2713
- setAutoSelectedProvider(bestProvider.service_provider);
2709
+ const firstProvider = response.data[0];
2710
+ setSelectedProvider(firstProvider);
2711
+ setAutoSelectedProvider(firstProvider.service_provider);
2714
2712
  setIsAutoSelected(true);
2715
2713
  }
2716
2714
  }
@@ -2806,19 +2804,7 @@ function BuyWithCard({
2806
2804
  window.open(sessionStartUrl, "_blank");
2807
2805
  handleViewChange("onramp");
2808
2806
  };
2809
- const getProviderBadges = (quote, allQuotes) => {
2810
- const badges = [];
2811
- const maxDestination = Math.max(
2812
- ...allQuotes.map((q) => q.destination_amount)
2813
- );
2814
- if (quote.destination_amount === maxDestination) {
2815
- badges.push("Best price");
2816
- }
2817
- return badges;
2818
- };
2819
- const sortedQuotes = [...quotes].sort(
2820
- (a, b) => b.destination_amount - a.destination_amount
2821
- );
2807
+ const sortedQuotes = quotes;
2822
2808
  const currencySymbol = getCurrencySymbol(currency);
2823
2809
  return /* @__PURE__ */ jsxs8(
2824
2810
  "div",
@@ -3020,31 +3006,7 @@ function BuyWithCard({
3020
3006
  children: selectedProvider.service_provider_display_name
3021
3007
  }
3022
3008
  ),
3023
- /* @__PURE__ */ jsxs8("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: [
3024
- isAutoSelected && /* @__PURE__ */ jsx10(
3025
- "span",
3026
- {
3027
- className: "uf-text-[10px] uf-font-normal",
3028
- style: {
3029
- color: colors2.success,
3030
- fontFamily: fonts.regular
3031
- },
3032
- children: "Best price"
3033
- }
3034
- ),
3035
- isAutoSelected && selectedProvider.low_kyc === false && /* @__PURE__ */ jsx10(
3036
- "span",
3037
- {
3038
- className: "uf-text-[10px]",
3039
- style: {
3040
- color: components.card.labelColor,
3041
- fontFamily: fonts.regular
3042
- },
3043
- children: "\u2022"
3044
- }
3045
- ),
3046
- selectedProvider.low_kyc === false && /* @__PURE__ */ jsx10("span", { className: "uf-text-[10px] uf-text-muted-foreground uf-font-normal", children: "No document upload" })
3047
- ] })
3009
+ selectedProvider.low_kyc === false && /* @__PURE__ */ jsx10("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: /* @__PURE__ */ jsx10("span", { className: "uf-text-[10px] uf-text-muted-foreground uf-font-normal", children: "No document upload" }) })
3048
3010
  ] }),
3049
3011
  quotes.length > 0 && /* @__PURE__ */ jsx10(
3050
3012
  ChevronRight,
@@ -3108,7 +3070,6 @@ function BuyWithCard({
3108
3070
  {
3109
3071
  className: `uf-transition-all uf-duration-300 uf-min-h-[420px] uf-flex uf-flex-col ${showQuotesView && !showOnrampView ? "uf-opacity-100" : "uf-opacity-0 uf-pointer-events-none uf-absolute uf-inset-0"}`,
3110
3072
  children: /* @__PURE__ */ jsx10("div", { className: "uf-space-y-2 uf-pt-2 uf-pb-8 uf-overflow-y-auto uf-flex-1 uf-min-h-0", children: sortedQuotes.map((quote, index) => {
3111
- const badges = getProviderBadges(quote, sortedQuotes);
3112
3073
  const displayName = quote.service_provider_display_name;
3113
3074
  const isSelected = selectedProvider?.service_provider === quote.service_provider;
3114
3075
  return /* @__PURE__ */ jsxs8(
@@ -3151,39 +3112,17 @@ function BuyWithCard({
3151
3112
  children: displayName
3152
3113
  }
3153
3114
  ),
3154
- /* @__PURE__ */ jsxs8("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: [
3155
- badges.map((badge, i) => /* @__PURE__ */ jsxs8(
3156
- "span",
3157
- {
3158
- className: "uf-text-[10px] uf-font-normal",
3159
- style: { color: colors2.success },
3160
- children: [
3161
- badge,
3162
- i < badges.length - 1 && ","
3163
- ]
3115
+ quote.low_kyc === false && /* @__PURE__ */ jsx10("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: /* @__PURE__ */ jsx10(
3116
+ "span",
3117
+ {
3118
+ className: "uf-text-[10px] uf-font-normal",
3119
+ style: {
3120
+ color: components.card.subtextRightColor,
3121
+ fontFamily: fonts.regular
3164
3122
  },
3165
- i
3166
- )),
3167
- quote.low_kyc === false && badges.length > 0 && /* @__PURE__ */ jsx10(
3168
- "span",
3169
- {
3170
- className: "uf-text-[10px]",
3171
- style: { color: components.card.subtextRightColor },
3172
- children: "\u2022"
3173
- }
3174
- ),
3175
- quote.low_kyc === false && /* @__PURE__ */ jsx10(
3176
- "span",
3177
- {
3178
- className: "uf-text-[10px] uf-font-normal",
3179
- style: {
3180
- color: components.card.subtextRightColor,
3181
- fontFamily: fonts.regular
3182
- },
3183
- children: "No document upload"
3184
- }
3185
- )
3186
- ] })
3123
+ children: "No document upload"
3124
+ }
3125
+ ) })
3187
3126
  ] })
3188
3127
  ] }),
3189
3128
  /* @__PURE__ */ jsxs8("div", { className: "uf-text-right", children: [
@@ -6990,14 +6929,23 @@ function useAllowedCountry(publishableKey) {
6990
6929
  let isAllowed = null;
6991
6930
  if (ipData && configData) {
6992
6931
  const blockedCodes = configData.blocked_country_codes || [];
6932
+ const blockedSubdivisions = configData.blocked_country_subdivisions || [];
6993
6933
  const userCountryUpper = ipData.alpha2.toUpperCase();
6994
- isAllowed = !blockedCodes.some(
6934
+ const userSubdivision = ipData.subdivision_code || ipData.state || "";
6935
+ const userSubdivisionUpper = userSubdivision.toUpperCase();
6936
+ const isCountryBlocked = blockedCodes.some(
6995
6937
  (code) => code.toUpperCase() === userCountryUpper
6996
6938
  );
6939
+ const isSubdivisionBlocked = blockedSubdivisions.some((entry) => {
6940
+ if (entry.country_code.toUpperCase() !== userCountryUpper) return false;
6941
+ return entry.subdivision_codes.some(
6942
+ (code) => code.toUpperCase() === userSubdivisionUpper
6943
+ );
6944
+ });
6945
+ isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
6997
6946
  }
6998
6947
  return {
6999
6948
  isAllowed,
7000
- // Return lowercase for consistency with useUserIp hook
7001
6949
  alpha2: ipData?.alpha2?.toLowerCase() ?? null,
7002
6950
  country: ipData?.country ?? null,
7003
6951
  isLoading,
@@ -7984,77 +7932,77 @@ function DepositPollingUi({
7984
7932
  return null;
7985
7933
  }
7986
7934
 
7987
- // src/hooks/use-default-source-token.ts
7935
+ // src/hooks/use-default-token.ts
7988
7936
  import { useState as useState19, useEffect as useEffect16, useRef as useRef5 } from "react";
7989
7937
  var getChainKey = (chainId, chainType) => {
7990
7938
  return `${chainType}:${chainId}`;
7991
7939
  };
7992
- function resolveSourceToken(supportedTokens, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol) {
7993
- if (!supportedTokens.length) return null;
7994
- let selectedTokenData;
7995
- let selectedChainData;
7996
- const hasChainDefaults = defaultSourceChainType && defaultSourceChainId;
7997
- if (defaultSourceTokenAddress && hasChainDefaults) {
7998
- for (const t11 of supportedTokens) {
7940
+ function resolveToken(tokens, defaultChainType, defaultChainId, defaultTokenAddress, defaultSymbol) {
7941
+ if (!tokens.length) return null;
7942
+ let selectedToken;
7943
+ let selectedChain;
7944
+ const hasChainDefaults = defaultChainType && defaultChainId;
7945
+ if (defaultTokenAddress && hasChainDefaults) {
7946
+ for (const t11 of tokens) {
7999
7947
  const matchingChain = t11.chains.find(
8000
- (c) => c.token_address.toLowerCase() === defaultSourceTokenAddress.toLowerCase() && c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
7948
+ (c) => c.token_address.toLowerCase() === defaultTokenAddress.toLowerCase() && c.chain_type === defaultChainType && c.chain_id === defaultChainId
8001
7949
  );
8002
7950
  if (matchingChain) {
8003
- selectedTokenData = t11;
8004
- selectedChainData = matchingChain;
7951
+ selectedToken = t11;
7952
+ selectedChain = matchingChain;
8005
7953
  break;
8006
7954
  }
8007
7955
  }
8008
7956
  }
8009
- if (!selectedTokenData && defaultSourceSymbol && hasChainDefaults) {
8010
- for (const t11 of supportedTokens) {
8011
- if (t11.symbol !== defaultSourceSymbol) continue;
7957
+ if (!selectedToken && defaultSymbol && hasChainDefaults) {
7958
+ for (const t11 of tokens) {
7959
+ if (t11.symbol !== defaultSymbol) continue;
8012
7960
  const matchedChain = t11.chains.find(
8013
- (c) => c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
7961
+ (c) => c.chain_type === defaultChainType && c.chain_id === defaultChainId
8014
7962
  );
8015
7963
  if (matchedChain) {
8016
- selectedTokenData = t11;
8017
- selectedChainData = matchedChain;
7964
+ selectedToken = t11;
7965
+ selectedChain = matchedChain;
8018
7966
  break;
8019
7967
  }
8020
7968
  }
8021
7969
  }
8022
- if (!selectedTokenData) {
8023
- for (const t11 of supportedTokens) {
7970
+ if (!selectedToken) {
7971
+ for (const t11 of tokens) {
8024
7972
  if (t11.chains.length > 0) {
8025
- selectedTokenData = t11;
8026
- selectedChainData = t11.chains[0];
7973
+ selectedToken = t11;
7974
+ selectedChain = t11.chains[0];
8027
7975
  break;
8028
7976
  }
8029
7977
  }
8030
7978
  }
8031
- if (selectedTokenData && selectedChainData) {
8032
- return { token: selectedTokenData, chain: selectedChainData };
7979
+ if (selectedToken && selectedChain) {
7980
+ return { token: selectedToken, chain: selectedChain };
8033
7981
  }
8034
7982
  return null;
8035
7983
  }
8036
- function useDefaultSourceToken({
8037
- supportedTokens,
8038
- defaultSourceChainType,
8039
- defaultSourceChainId,
8040
- defaultSourceTokenAddress,
8041
- defaultSourceSymbol
7984
+ function useDefaultToken({
7985
+ tokens,
7986
+ defaultChainType,
7987
+ defaultChainId,
7988
+ defaultTokenAddress,
7989
+ defaultSymbol
8042
7990
  }) {
8043
7991
  const [token, setToken] = useState19(null);
8044
7992
  const [chain, setChain] = useState19(null);
8045
7993
  const [initialSelectionDone, setInitialSelectionDone] = useState19(false);
8046
7994
  const appliedDefaultsRef = useRef5("");
8047
7995
  useEffect16(() => {
8048
- if (!supportedTokens.length) return;
8049
- const defaultsKey = `${defaultSourceTokenAddress ?? ""}|${defaultSourceSymbol ?? ""}|${defaultSourceChainType ?? ""}|${defaultSourceChainId ?? ""}`;
7996
+ if (!tokens.length) return;
7997
+ const defaultsKey = `${defaultTokenAddress ?? ""}|${defaultSymbol ?? ""}|${defaultChainType ?? ""}|${defaultChainId ?? ""}`;
8050
7998
  const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
8051
7999
  if (initialSelectionDone && !defaultsChanged) return;
8052
- const result = resolveSourceToken(
8053
- supportedTokens,
8054
- defaultSourceChainType,
8055
- defaultSourceChainId,
8056
- defaultSourceTokenAddress,
8057
- defaultSourceSymbol
8000
+ const result = resolveToken(
8001
+ tokens,
8002
+ defaultChainType,
8003
+ defaultChainId,
8004
+ defaultTokenAddress,
8005
+ defaultSymbol
8058
8006
  );
8059
8007
  if (result) {
8060
8008
  setToken(result.token.symbol);
@@ -8063,16 +8011,16 @@ function useDefaultSourceToken({
8063
8011
  setInitialSelectionDone(true);
8064
8012
  }
8065
8013
  }, [
8066
- supportedTokens,
8067
- defaultSourceTokenAddress,
8068
- defaultSourceSymbol,
8069
- defaultSourceChainType,
8070
- defaultSourceChainId,
8014
+ tokens,
8015
+ defaultTokenAddress,
8016
+ defaultSymbol,
8017
+ defaultChainType,
8018
+ defaultChainId,
8071
8019
  initialSelectionDone
8072
8020
  ]);
8073
8021
  useEffect16(() => {
8074
- if (!supportedTokens.length || !token) return;
8075
- const currentToken = supportedTokens.find((t11) => t11.symbol === token);
8022
+ if (!tokens.length || !token) return;
8023
+ const currentToken = tokens.find((t11) => t11.symbol === token);
8076
8024
  if (!currentToken || currentToken.chains.length === 0) return;
8077
8025
  const isChainAvailable = chain && currentToken.chains.some((c) => {
8078
8026
  return getChainKey(c.chain_id, c.chain_type) === chain;
@@ -8081,10 +8029,27 @@ function useDefaultSourceToken({
8081
8029
  const firstChain = currentToken.chains[0];
8082
8030
  setChain(getChainKey(firstChain.chain_id, firstChain.chain_type));
8083
8031
  }
8084
- }, [token, supportedTokens, chain]);
8032
+ }, [token, tokens, chain]);
8085
8033
  return { token, chain, setToken, setChain, initialSelectionDone };
8086
8034
  }
8087
8035
 
8036
+ // src/hooks/use-default-source-token.ts
8037
+ function useDefaultSourceToken({
8038
+ supportedTokens,
8039
+ defaultSourceChainType,
8040
+ defaultSourceChainId,
8041
+ defaultSourceTokenAddress,
8042
+ defaultSourceSymbol
8043
+ }) {
8044
+ return useDefaultToken({
8045
+ tokens: supportedTokens,
8046
+ defaultChainType: defaultSourceChainType,
8047
+ defaultChainId: defaultSourceChainId,
8048
+ defaultTokenAddress: defaultSourceTokenAddress,
8049
+ defaultSymbol: defaultSourceSymbol
8050
+ });
8051
+ }
8052
+
8088
8053
  // src/components/deposits/shared/DepositFooterLinks.tsx
8089
8054
  import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
8090
8055
  function DepositFooterLinks({
@@ -12491,19 +12456,30 @@ import { AlertTriangle as AlertTriangle2, ChevronRight as ChevronRight12 } from
12491
12456
  // src/hooks/use-payment-intent.ts
12492
12457
  import { useQuery as useQuery9 } from "@tanstack/react-query";
12493
12458
  import { retrievePaymentIntent } from "@unifold/core";
12459
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
12460
+ "succeeded",
12461
+ "expired",
12462
+ "refunded",
12463
+ "canceled"
12464
+ ]);
12494
12465
  function usePaymentIntent(params) {
12495
12466
  const {
12496
12467
  clientSecret,
12497
12468
  publishableKey,
12498
12469
  enabled = true,
12499
- pollingInterval = 5e3
12470
+ pollingInterval = 3e3
12500
12471
  } = params;
12501
12472
  return useQuery9({
12502
12473
  queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
12503
12474
  queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
12504
12475
  enabled: enabled && !!clientSecret && !!publishableKey,
12505
12476
  staleTime: 0,
12506
- refetchInterval: pollingInterval || false,
12477
+ refetchInterval: (query) => {
12478
+ if (!pollingInterval) return false;
12479
+ const status = query.state.data?.status;
12480
+ if (status && TERMINAL_STATUSES.has(status)) return false;
12481
+ return pollingInterval;
12482
+ },
12507
12483
  refetchOnWindowFocus: true,
12508
12484
  retry: 3,
12509
12485
  retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
@@ -12636,7 +12612,7 @@ function CheckoutModal({
12636
12612
  clientSecret,
12637
12613
  publishableKey,
12638
12614
  enabled: open && !!clientSecret,
12639
- pollingInterval: 5e3
12615
+ pollingInterval: 3e3
12640
12616
  });
12641
12617
  const { projectConfig } = useProjectConfig({
12642
12618
  publishableKey,
@@ -13194,6 +13170,23 @@ function useSupportedDestinationTokens(publishableKey, enabled = true) {
13194
13170
  });
13195
13171
  }
13196
13172
 
13173
+ // src/hooks/use-default-destination-token.ts
13174
+ function useDefaultDestinationToken({
13175
+ destinationTokens,
13176
+ defaultDestinationChainType,
13177
+ defaultDestinationChainId,
13178
+ defaultDestinationTokenAddress,
13179
+ defaultDestinationSymbol
13180
+ }) {
13181
+ return useDefaultToken({
13182
+ tokens: destinationTokens,
13183
+ defaultChainType: defaultDestinationChainType,
13184
+ defaultChainId: defaultDestinationChainId,
13185
+ defaultTokenAddress: defaultDestinationTokenAddress,
13186
+ defaultSymbol: defaultDestinationSymbol
13187
+ });
13188
+ }
13189
+
13197
13190
  // src/hooks/use-source-token-validation.ts
13198
13191
  import { useQuery as useQuery12 } from "@tanstack/react-query";
13199
13192
  import { getSupportedDepositTokens as getSupportedDepositTokens3 } from "@unifold/core";
@@ -14755,6 +14748,10 @@ function WithdrawModal({
14755
14748
  sourceTokenSymbol,
14756
14749
  recipientAddress: recipientAddressProp,
14757
14750
  senderAddress,
14751
+ defaultDestinationChainType,
14752
+ defaultDestinationChainId,
14753
+ defaultDestinationTokenAddress,
14754
+ defaultDestinationSymbol,
14758
14755
  onWithdraw,
14759
14756
  onWithdrawSuccess,
14760
14757
  onWithdrawError,
@@ -14798,8 +14795,21 @@ function WithdrawModal({
14798
14795
  publishableKey,
14799
14796
  enabled: open
14800
14797
  });
14801
- const [selectedToken, setSelectedToken] = useState32(null);
14802
- const [selectedChain, setSelectedChain] = useState32(null);
14798
+ const {
14799
+ token: selectedTokenSymbol,
14800
+ chain: selectedChainKey,
14801
+ setToken: setSelectedTokenSymbol,
14802
+ setChain: setSelectedChainKey,
14803
+ initialSelectionDone
14804
+ } = useDefaultDestinationToken({
14805
+ destinationTokens,
14806
+ defaultDestinationChainType,
14807
+ defaultDestinationChainId,
14808
+ defaultDestinationTokenAddress,
14809
+ defaultDestinationSymbol
14810
+ });
14811
+ const selectedToken = selectedTokenSymbol ? destinationTokens.find((t11) => t11.symbol === selectedTokenSymbol) ?? null : null;
14812
+ const selectedChain = selectedToken && selectedChainKey ? selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === selectedChainKey) ?? null : null;
14803
14813
  const [view, setView] = useState32("form");
14804
14814
  const [withdrawDepositWalletId, setWithdrawDepositWalletId] = useState32();
14805
14815
  const [selectedExecution, setSelectedExecution] = useState32(null);
@@ -14841,21 +14851,11 @@ function WithdrawModal({
14841
14851
  setSubmittedTxInfo(txInfo);
14842
14852
  setView("confirming");
14843
14853
  }, []);
14844
- useEffect27(() => {
14845
- if (!destinationTokens.length || selectedToken) return;
14846
- const first = destinationTokens[0];
14847
- if (first?.chains.length > 0) {
14848
- setSelectedToken(first);
14849
- setSelectedChain(first.chains[0]);
14850
- }
14851
- }, [destinationTokens, selectedToken]);
14852
14854
  const resetViewTimeoutRef = useRef10(null);
14853
14855
  const handleClose = useCallback7(() => {
14854
14856
  onOpenChange(false);
14855
14857
  if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
14856
14858
  resetViewTimeoutRef.current = setTimeout(() => {
14857
- setSelectedToken(null);
14858
- setSelectedChain(null);
14859
14859
  setView("form");
14860
14860
  setSelectedExecution(null);
14861
14861
  setSubmittedTxInfo(null);
@@ -14869,8 +14869,6 @@ function WithdrawModal({
14869
14869
  clearTimeout(resetViewTimeoutRef.current);
14870
14870
  resetViewTimeoutRef.current = null;
14871
14871
  }
14872
- setSelectedToken(null);
14873
- setSelectedChain(null);
14874
14872
  setView("form");
14875
14873
  setSelectedExecution(null);
14876
14874
  setSubmittedTxInfo(null);
@@ -14880,19 +14878,13 @@ function WithdrawModal({
14880
14878
  if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
14881
14879
  }, []);
14882
14880
  const handleTokenSymbolChange = useCallback7((symbol) => {
14883
- const tok = destinationTokens.find((t11) => t11.symbol === symbol);
14884
- if (tok) {
14885
- setSelectedToken(tok);
14886
- if (tok.chains.length > 0) setSelectedChain(tok.chains[0]);
14887
- }
14888
- }, [destinationTokens]);
14881
+ setSelectedTokenSymbol(symbol);
14882
+ }, [setSelectedTokenSymbol]);
14889
14883
  const handleChainKeyChange = useCallback7((chainKey) => {
14890
- if (!selectedToken) return;
14891
- const chain = selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === chainKey);
14892
- if (chain) setSelectedChain(chain);
14893
- }, [selectedToken]);
14884
+ setSelectedChainKey(chainKey);
14885
+ }, [setSelectedChainKey]);
14894
14886
  const isSourceSupported = sourceValidation?.isSupported ?? null;
14895
- const isAnyLoading = tokensLoading || isCheckingSourceToken;
14887
+ const isAnyLoading = tokensLoading || isCheckingSourceToken || destinationTokens.length > 0 && !initialSelectionDone;
14896
14888
  const withdrawPoweredByFooter = /* @__PURE__ */ jsx57("div", { className: "uf-pt-3", children: /* @__PURE__ */ jsx57(PoweredByUnifold, { color: colors2.foregroundMuted, className: "uf-flex uf-justify-center uf-shrink-0" }) });
14897
14889
  return /* @__PURE__ */ jsx57(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ jsx57(Dialog, { open: hideOverlay || open, onOpenChange: hideOverlay ? void 0 : handleClose, modal: !hideOverlay, children: /* @__PURE__ */ jsx57(
14898
14890
  DialogContent,
@@ -15278,6 +15270,7 @@ export {
15278
15270
  useDepositQuote,
15279
15271
  usePaymentIntent,
15280
15272
  useSourceTokenValidation,
15273
+ useSupportedDepositTokens,
15281
15274
  useSupportedDestinationTokens,
15282
15275
  useTheme,
15283
15276
  useVerifyRecipientAddress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/ui-react",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "Unifold UI React - Deposit and onramp components for React applications",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -34,7 +34,7 @@
34
34
  "lucide-react": "^0.454.0",
35
35
  "qr-code-styling": "^1.6.0-rc.1",
36
36
  "tailwind-merge": "^2.0.0",
37
- "@unifold/core": "0.1.48"
37
+ "@unifold/core": "0.1.50"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@solana/web3.js": "^1.87.0",