@unifold/connect-react 0.1.65 → 0.1.67

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,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
- import { ChainType, DepositConfirmationMode, DepositModalInitialScreen, ThemeMode, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
- export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, useSupportedDepositTokens } from '@unifold/ui-react';
6
- import { EvmContractCall, DepositEvent } from '@unifold/core';
7
- export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DepositEvent, DepositEventType, DepositQuote, DepositQuoteRequest, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, LockedQuoteLimits, LockedQuotePreview, LockedQuotePreviewRequest, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionCreatedData, OnrampSessionCreatedEvent, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentIntentStatus, PaymentIntentType, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SourceToken, SourceTokenNetwork, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedSourceTokensQuery, SupportedSourceTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, generatePrefixedKSUID, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, retrievePaymentIntent, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
4
+ import { ChainType, DepositConfirmationMode, DepositMethod, DepositModalInitialScreen, ThemeMode, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
+ export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, DepositMethod, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, useSupportedDepositTokens } from '@unifold/ui-react';
6
+ import { EvmContractCall, DirectExecutionSucceededEvent, DepositEvent, WithdrawDirectExecutionSucceededEvent, WithdrawEvent } from '@unifold/core';
7
+ export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DepositEvent, DepositEventType, DepositQuote, DepositQuoteRequest, DestinationToken, DestinationTokenChain, DirectExecution, DirectExecutionResponse, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, LockedQuoteLimits, LockedQuotePreview, LockedQuotePreviewRequest, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionCreatedData, OnrampSessionCreatedEvent, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentIntentStatus, PaymentIntentType, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SourceToken, SourceTokenNetwork, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedSourceTokensQuery, SupportedSourceTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, WithdrawDirectExecutionSucceededEvent, WithdrawEvent, WithdrawEventType, createDepositAddress, createOnrampSession, generatePrefixedKSUID, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, retrievePaymentIntent, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
8
8
 
9
9
  interface UnifoldConnectProviderConfig {
10
10
  publishableKey: string;
@@ -79,11 +79,14 @@ interface DepositResult {
79
79
  message: string;
80
80
  transaction?: unknown;
81
81
  executionId?: string;
82
+ execution?: DirectExecutionSucceededEvent;
83
+ method?: DepositMethod;
82
84
  }
83
85
  interface DepositError {
84
86
  message: string;
85
87
  error?: unknown;
86
88
  code?: string;
89
+ method?: DepositMethod;
87
90
  }
88
91
  interface DepositConfig {
89
92
  externalUserId: string;
@@ -144,6 +147,8 @@ interface CheckoutError {
144
147
  interface WithdrawResult {
145
148
  message: string;
146
149
  transaction?: unknown;
150
+ executionId?: string;
151
+ execution?: WithdrawDirectExecutionSucceededEvent;
147
152
  }
148
153
  interface WithdrawError {
149
154
  message: string;
@@ -210,6 +215,8 @@ interface WithdrawConfig {
210
215
  withdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
211
216
  onSuccess?: (data: WithdrawResult) => void;
212
217
  onError?: (error: WithdrawError) => void;
218
+ /** Called when withdraw lifecycle events occur. */
219
+ onEvent?: (event: WithdrawEvent) => void;
213
220
  onClose?: () => void;
214
221
  }
215
222
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
- import { ChainType, DepositConfirmationMode, DepositModalInitialScreen, ThemeMode, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
- export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, useSupportedDepositTokens } from '@unifold/ui-react';
6
- import { EvmContractCall, DepositEvent } from '@unifold/core';
7
- export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DepositEvent, DepositEventType, DepositQuote, DepositQuoteRequest, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, LockedQuoteLimits, LockedQuotePreview, LockedQuotePreviewRequest, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionCreatedData, OnrampSessionCreatedEvent, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentIntentStatus, PaymentIntentType, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SourceToken, SourceTokenNetwork, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedSourceTokensQuery, SupportedSourceTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, generatePrefixedKSUID, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, retrievePaymentIntent, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
4
+ import { ChainType, DepositConfirmationMode, DepositMethod, DepositModalInitialScreen, ThemeMode, ThemeConfig, FontConfig, ComponentConfig, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
5
+ export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, DepositMethod, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawTransactionInfo, useSupportedDepositTokens } from '@unifold/ui-react';
6
+ import { EvmContractCall, DirectExecutionSucceededEvent, DepositEvent, WithdrawDirectExecutionSucceededEvent, WithdrawEvent } from '@unifold/core';
7
+ export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DepositEvent, DepositEventType, DepositQuote, DepositQuoteRequest, DestinationToken, DestinationTokenChain, DirectExecution, DirectExecutionResponse, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, LockedQuoteLimits, LockedQuotePreview, LockedQuotePreviewRequest, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionCreatedData, OnrampSessionCreatedEvent, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentIntentStatus, PaymentIntentType, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SourceToken, SourceTokenNetwork, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedSourceTokensQuery, SupportedSourceTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, WithdrawDirectExecutionSucceededEvent, WithdrawEvent, WithdrawEventType, createDepositAddress, createOnrampSession, generatePrefixedKSUID, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, retrievePaymentIntent, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
8
8
 
9
9
  interface UnifoldConnectProviderConfig {
10
10
  publishableKey: string;
@@ -79,11 +79,14 @@ interface DepositResult {
79
79
  message: string;
80
80
  transaction?: unknown;
81
81
  executionId?: string;
82
+ execution?: DirectExecutionSucceededEvent;
83
+ method?: DepositMethod;
82
84
  }
83
85
  interface DepositError {
84
86
  message: string;
85
87
  error?: unknown;
86
88
  code?: string;
89
+ method?: DepositMethod;
87
90
  }
88
91
  interface DepositConfig {
89
92
  externalUserId: string;
@@ -144,6 +147,8 @@ interface CheckoutError {
144
147
  interface WithdrawResult {
145
148
  message: string;
146
149
  transaction?: unknown;
150
+ executionId?: string;
151
+ execution?: WithdrawDirectExecutionSucceededEvent;
147
152
  }
148
153
  interface WithdrawError {
149
154
  message: string;
@@ -210,6 +215,8 @@ interface WithdrawConfig {
210
215
  withdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
211
216
  onSuccess?: (data: WithdrawResult) => void;
212
217
  onError?: (error: WithdrawError) => void;
218
+ /** Called when withdraw lifecycle events occur. */
219
+ onEvent?: (event: WithdrawEvent) => void;
213
220
  onClose?: () => void;
214
221
  }
215
222
 
package/dist/index.js CHANGED
@@ -1159,6 +1159,7 @@ __export(index_exports, {
1159
1159
  ExecutionStatus: () => ExecutionStatus,
1160
1160
  SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
1161
1161
  UnifoldProvider: () => UnifoldProvider2,
1162
+ WithdrawEventType: () => WithdrawEventType,
1162
1163
  createDepositAddress: () => createDepositAddress,
1163
1164
  createOnrampSession: () => createOnrampSession,
1164
1165
  generatePrefixedKSUID: () => generatePrefixedKSUID,
@@ -1353,6 +1354,17 @@ var ArrowUpDown = createLucideIcon("ArrowUpDown", [
1353
1354
  ["path", { d: "M7 4v16", key: "1glfcx" }]
1354
1355
  ]);
1355
1356
 
1357
+ // ../../node_modules/.pnpm/lucide-react@0.454.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/bitcoin.js
1358
+ var Bitcoin = createLucideIcon("Bitcoin", [
1359
+ [
1360
+ "path",
1361
+ {
1362
+ d: "M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",
1363
+ key: "yr8idg"
1364
+ }
1365
+ ]
1366
+ ]);
1367
+
1356
1368
  // ../../node_modules/.pnpm/lucide-react@0.454.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/check.js
1357
1369
  var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
1358
1370
 
@@ -7144,8 +7156,13 @@ async function sendHypercoreTransaction(request, publishableKey) {
7144
7156
  }
7145
7157
  var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
7146
7158
  DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
7159
+ DepositEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
7147
7160
  return DepositEventType2;
7148
7161
  })(DepositEventType || {});
7162
+ var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
7163
+ WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
7164
+ return WithdrawEventType2;
7165
+ })(WithdrawEventType || {});
7149
7166
  function useUserIp() {
7150
7167
  const {
7151
7168
  data: userIpInfo,
@@ -15115,6 +15132,31 @@ function useDepositPolling({
15115
15132
  onDepositSuccess,
15116
15133
  onDepositError
15117
15134
  }) {
15135
+ const createExecutionSuccessEvent = (execution) => ({
15136
+ id: generatePrefixedKSUID("sevt"),
15137
+ type: DepositEventType.DIRECT_EXECUTION_SUCCEEDED,
15138
+ created: execution.updated_at ? Math.floor(new Date(execution.updated_at).getTime() / 1e3) : execution.created_at ? Math.floor(new Date(execution.created_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3),
15139
+ data: { object: mapToDirectExecution(execution) }
15140
+ });
15141
+ const mapToDirectExecution = (execution) => ({
15142
+ id: execution.id,
15143
+ transactionHash: execution.transaction_hash,
15144
+ recipientAddress: execution.recipient_address,
15145
+ depositAddress: execution.deposit_wallet?.address,
15146
+ sourceChainType: execution.source_chain_type,
15147
+ sourceChainId: execution.source_chain_id,
15148
+ sourceTokenAddress: execution.source_token_address,
15149
+ destinationChainType: execution.destination_chain_type,
15150
+ destinationChainId: execution.destination_chain_id,
15151
+ destinationTokenAddress: execution.destination_token_address,
15152
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
15153
+ sourceAmountUsd: execution.source_amount_usd,
15154
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
15155
+ destinationAmountUsd: execution.destination_amount_usd,
15156
+ destinationTransactionHashes: execution.destination_transaction_hashes,
15157
+ status: execution.status,
15158
+ failureReason: execution.failure_reason
15159
+ });
15118
15160
  const [executions, setExecutions] = (0, import_react12.useState)([]);
15119
15161
  const [isPolling, setIsPolling] = (0, import_react12.useState)(false);
15120
15162
  const [pollingEnabled, setPollingEnabled] = (0, import_react12.useState)(false);
@@ -15228,7 +15270,9 @@ function useDepositPolling({
15228
15270
  onDepositSuccessRef.current?.({
15229
15271
  message: "Deposit completed successfully",
15230
15272
  executionId: execution.id,
15231
- transaction: execution
15273
+ // Backward compatibility: keep transaction in API response shape.
15274
+ transaction: execution,
15275
+ execution: createExecutionSuccessEvent(execution)
15232
15276
  });
15233
15277
  } else if (execution.status === ExecutionStatus.FAILED && previousStatus !== ExecutionStatus.FAILED) {
15234
15278
  onDepositErrorRef.current?.({
@@ -21409,6 +21453,8 @@ function CoinbaseConnect({
21409
21453
  destinationChainId,
21410
21454
  destinationChainType,
21411
21455
  onTransferSuccess,
21456
+ onDepositSuccess,
21457
+ onDepositError,
21412
21458
  onTransferError,
21413
21459
  onClose,
21414
21460
  onBack: parentOnBack,
@@ -21556,10 +21602,14 @@ function CoinbaseConnect({
21556
21602
  depositWalletId: transferDepositWalletId,
21557
21603
  enabled: view === "success" && !!transferDepositWalletId,
21558
21604
  immediateDirectPolling: true,
21559
- onDepositSuccess: onTransferSuccess ? () => {
21560
- if (confirmResult) onTransferSuccess(confirmResult);
21605
+ onDepositSuccess: onDepositSuccess || onTransferSuccess ? (data) => {
21606
+ onDepositSuccess?.(data);
21607
+ if (onTransferSuccess && confirmResult) onTransferSuccess(confirmResult);
21561
21608
  } : void 0,
21562
- onDepositError: onTransferError
21609
+ onDepositError: onDepositError || onTransferError ? (error) => {
21610
+ onDepositError?.(error);
21611
+ onTransferError?.({ message: error.message });
21612
+ } : void 0
21563
21613
  });
21564
21614
  (0, import_react20.useEffect)(() => {
21565
21615
  onExecutionsChange?.(depositExecutions);
@@ -27746,7 +27796,10 @@ function WalletConnect({
27746
27796
  children: [
27747
27797
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
27748
27798
  WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
27749
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name })
27799
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
27800
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name }),
27801
+ wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Last used" })
27802
+ ] })
27750
27803
  ] }),
27751
27804
  isPending ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Detected" }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
27752
27805
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
@@ -28007,6 +28060,23 @@ function DepositModal({
28007
28060
  depositTrackerSubTitle = t7.depositTracker.subtitle
28008
28061
  }) {
28009
28062
  const { colors: colors2, fonts, components } = useTheme();
28063
+ const onDepositSuccessFor = (0, import_react8.useCallback)(
28064
+ (method) => onDepositSuccess || onEvent ? (data) => {
28065
+ const payload = { ...data, method };
28066
+ onDepositSuccess?.(payload);
28067
+ if (payload.execution) {
28068
+ onEvent?.({
28069
+ ...payload.execution,
28070
+ method
28071
+ });
28072
+ }
28073
+ } : void 0,
28074
+ [onDepositSuccess, onEvent]
28075
+ );
28076
+ const onDepositErrorFor = (0, import_react8.useCallback)(
28077
+ (method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
28078
+ [onDepositError]
28079
+ );
28010
28080
  const effectiveInitialScreen = (0, import_react8.useMemo)(() => {
28011
28081
  const s = initialScreen ?? "main";
28012
28082
  if (s === "tracker" && hideDepositTracker === true) return "main";
@@ -28547,8 +28617,8 @@ function DepositModal({
28547
28617
  cashAppMenuButton
28548
28618
  ].filter(Boolean);
28549
28619
  const depositTabs = [
28550
- { id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
28551
- { id: "cash", label: "Use Cash", buttons: cashMenuButtons }
28620
+ { id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
28621
+ { id: "cash", label: "Use Cash", icon: DollarSign, buttons: cashMenuButtons }
28552
28622
  ].filter((tab) => tab.buttons.length > 0);
28553
28623
  const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
28554
28624
  const renderMainMenuBody = () => {
@@ -28571,18 +28641,16 @@ function DepositModal({
28571
28641
  role: "tablist",
28572
28642
  children: depositTabs.map((tab) => {
28573
28643
  const active = activeDepositTab.id === tab.id;
28574
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
28644
+ const TabIcon = tab.icon;
28645
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
28575
28646
  "button",
28576
28647
  {
28577
28648
  type: "button",
28578
28649
  role: "tab",
28579
28650
  "aria-selected": active,
28580
28651
  onClick: () => setDepositTab(tab.id),
28581
- className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
28652
+ className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all uf-flex uf-items-center uf-justify-center uf-gap-1.5",
28582
28653
  style: {
28583
- // Active tab is a soft, blurred glass pill — a faint accent
28584
- // tint with its own backdrop blur and a subtle border/shadow,
28585
- // so it looks frosted instead of like a hard solid button.
28586
28654
  backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
28587
28655
  backdropFilter: active ? "blur(8px)" : void 0,
28588
28656
  WebkitBackdropFilter: active ? "blur(8px)" : void 0,
@@ -28590,7 +28658,19 @@ function DepositModal({
28590
28658
  color: active ? colors2.foreground : colors2.foregroundMuted,
28591
28659
  fontFamily: fonts.medium
28592
28660
  },
28593
- children: tab.label
28661
+ children: [
28662
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
28663
+ "span",
28664
+ {
28665
+ className: "uf-inline-flex uf-items-center uf-justify-center uf-rounded-full uf-w-5 uf-h-5 uf-flex-shrink-0",
28666
+ style: {
28667
+ backgroundColor: active ? colors2.foreground : colors2.foregroundMuted
28668
+ },
28669
+ children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TabIcon, { size: 12, style: { color: active ? colors2.background : colors2.background }, strokeWidth: 2.5 })
28670
+ }
28671
+ ),
28672
+ tab.label
28673
+ ]
28594
28674
  },
28595
28675
  tab.id
28596
28676
  );
@@ -28681,8 +28761,8 @@ function DepositModal({
28681
28761
  defaultSourceSymbol,
28682
28762
  depositConfirmationMode,
28683
28763
  onExecutionsChange: setDepositExecutions,
28684
- onDepositSuccess,
28685
- onDepositError,
28764
+ onDepositSuccess: onDepositSuccessFor("transfer"),
28765
+ onDepositError: onDepositErrorFor("transfer"),
28686
28766
  wallets
28687
28767
  }
28688
28768
  ) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
@@ -28700,8 +28780,8 @@ function DepositModal({
28700
28780
  defaultSourceSymbol,
28701
28781
  depositConfirmationMode,
28702
28782
  onExecutionsChange: setDepositExecutions,
28703
- onDepositSuccess,
28704
- onDepositError,
28783
+ onDepositSuccess: onDepositSuccessFor("transfer"),
28784
+ onDepositError: onDepositErrorFor("transfer"),
28705
28785
  wallets
28706
28786
  }
28707
28787
  ),
@@ -28766,8 +28846,8 @@ function DepositModal({
28766
28846
  destinationChainType,
28767
28847
  destinationChainId,
28768
28848
  destinationTokenAddress,
28769
- onDepositSuccess,
28770
- onDepositError,
28849
+ onDepositSuccess: onDepositSuccessFor("card"),
28850
+ onDepositError: onDepositErrorFor("card"),
28771
28851
  onEvent,
28772
28852
  themeClass,
28773
28853
  wallets,
@@ -28802,8 +28882,8 @@ function DepositModal({
28802
28882
  destinationChainType,
28803
28883
  destinationChainId,
28804
28884
  destinationTokenAddress,
28805
- onDepositSuccess,
28806
- onDepositError,
28885
+ onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
28886
+ onDepositError: onDepositErrorFor("pay_with_exchange"),
28807
28887
  wallets,
28808
28888
  defaultToken: defaultToken ?? null
28809
28889
  }
@@ -28821,14 +28901,10 @@ function DepositModal({
28821
28901
  destinationTokenAddress: destinationTokenAddress ?? "",
28822
28902
  destinationChainId: destinationChainId ?? "",
28823
28903
  destinationChainType: destinationChainType ?? "",
28824
- onTransferSuccess: (result) => {
28825
- onDepositSuccess?.({
28826
- message: "Transfer completed via Coinbase Connect",
28827
- transaction: result
28828
- });
28829
- },
28904
+ onDepositSuccess: onDepositSuccessFor("exchange_connect"),
28905
+ onDepositError: onDepositErrorFor("exchange_connect"),
28830
28906
  onTransferError: (error) => {
28831
- onDepositError?.({
28907
+ onDepositErrorFor("exchange_connect")?.({
28832
28908
  message: error.message,
28833
28909
  error
28834
28910
  });
@@ -28857,20 +28933,14 @@ function DepositModal({
28857
28933
  publishableKey,
28858
28934
  assetCdnUrl: projectConfig?.asset_cdn_url,
28859
28935
  projectName: projectConfig?.project_name,
28860
- onSuccess: (txHash) => {
28861
- onDepositSuccess?.({
28862
- message: "Transaction sent successfully",
28863
- transaction: { txHash }
28864
- });
28865
- },
28866
28936
  onError: (error) => {
28867
- onDepositError?.({
28937
+ onDepositErrorFor("wallet_connect")?.({
28868
28938
  message: error.message,
28869
28939
  error
28870
28940
  });
28871
28941
  },
28872
- onDepositSuccess,
28873
- onDepositError,
28942
+ onDepositSuccess: onDepositSuccessFor("wallet_connect"),
28943
+ onDepositError: onDepositErrorFor("wallet_connect"),
28874
28944
  amountQuickSelect: browserWalletAmountQuickSelect,
28875
28945
  onWalletDisconnect: handleWalletDisconnect,
28876
28946
  onWalletConnected: (info, dw) => {
@@ -28914,8 +28984,8 @@ function DepositModal({
28914
28984
  onViewChange: setCashAppView,
28915
28985
  onAmountChange: setCashAppAmount,
28916
28986
  onEvent,
28917
- onDepositSuccess,
28918
- onDepositError
28987
+ onDepositSuccess: onDepositSuccessFor("cashapp"),
28988
+ onDepositError: onDepositErrorFor("cashapp")
28919
28989
  }
28920
28990
  ),
28921
28991
  depositPoweredByFooter
@@ -29753,6 +29823,31 @@ function useWithdrawPolling({
29753
29823
  onWithdrawSuccess,
29754
29824
  onWithdrawError
29755
29825
  }) {
29826
+ const createExecutionSuccessEvent = (execution) => ({
29827
+ id: generatePrefixedKSUID("sevt"),
29828
+ type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
29829
+ created: execution.updated_at ? Math.floor(new Date(execution.updated_at).getTime() / 1e3) : execution.created_at ? Math.floor(new Date(execution.created_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3),
29830
+ data: { object: mapToDirectExecution(execution) }
29831
+ });
29832
+ const mapToDirectExecution = (execution) => ({
29833
+ id: execution.id,
29834
+ transactionHash: execution.transaction_hash,
29835
+ recipientAddress: execution.recipient_address,
29836
+ depositAddress: execution.deposit_wallet?.address,
29837
+ sourceChainType: execution.source_chain_type,
29838
+ sourceChainId: execution.source_chain_id,
29839
+ sourceTokenAddress: execution.source_token_address,
29840
+ destinationChainType: execution.destination_chain_type,
29841
+ destinationChainId: execution.destination_chain_id,
29842
+ destinationTokenAddress: execution.destination_token_address,
29843
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
29844
+ sourceAmountUsd: execution.source_amount_usd,
29845
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
29846
+ destinationAmountUsd: execution.destination_amount_usd,
29847
+ destinationTransactionHashes: execution.destination_transaction_hashes,
29848
+ status: execution.status,
29849
+ failureReason: execution.failure_reason
29850
+ });
29756
29851
  const [executions, setExecutions] = (0, import_react30.useState)([]);
29757
29852
  const [isPolling, setIsPolling] = (0, import_react30.useState)(false);
29758
29853
  const enabledAtRef = (0, import_react30.useRef)(/* @__PURE__ */ new Date());
@@ -29820,7 +29915,13 @@ function useWithdrawPolling({
29820
29915
  return [...list, ex];
29821
29916
  });
29822
29917
  if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
29823
- onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
29918
+ onSuccessRef.current?.({
29919
+ message: "Withdrawal completed successfully",
29920
+ executionId: ex.id,
29921
+ // Backward compatibility: keep transaction in API response shape.
29922
+ transaction: ex,
29923
+ execution: createExecutionSuccessEvent(ex)
29924
+ });
29824
29925
  } else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
29825
29926
  onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
29826
29927
  }
@@ -31022,9 +31123,19 @@ function WithdrawModal({
31022
31123
  onWithdraw,
31023
31124
  onWithdrawSuccess,
31024
31125
  onWithdrawError,
31126
+ onEvent,
31025
31127
  theme = "dark",
31026
31128
  hideOverlay = false
31027
31129
  }) {
31130
+ const onWithdrawSuccessFor = (0, import_react29.useCallback)(
31131
+ (data) => {
31132
+ onWithdrawSuccess?.(data);
31133
+ if (data.execution) {
31134
+ onEvent?.(data.execution);
31135
+ }
31136
+ },
31137
+ [onWithdrawSuccess, onEvent]
31138
+ );
31028
31139
  const { colors: colors2, fonts, components } = useTheme();
31029
31140
  const [containerEl, setContainerEl] = (0, import_react29.useState)(null);
31030
31141
  const containerCallbackRef = (0, import_react29.useCallback)((el) => {
@@ -31086,7 +31197,7 @@ function WithdrawModal({
31086
31197
  publishableKey,
31087
31198
  depositWalletId: withdrawDepositWalletId,
31088
31199
  enabled: !!withdrawDepositWalletId && open,
31089
- onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
31200
+ onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
31090
31201
  onWithdrawError
31091
31202
  });
31092
31203
  const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
@@ -31586,6 +31697,7 @@ function UnifoldProvider2({
31586
31697
  onWithdraw: withdrawConfig.withdraw,
31587
31698
  onWithdrawSuccess: handleWithdrawSuccess,
31588
31699
  onWithdrawError: handleWithdrawError,
31700
+ onEvent: withdrawConfig.onEvent,
31589
31701
  theme: resolvedTheme
31590
31702
  }
31591
31703
  ),
@@ -31681,6 +31793,7 @@ function useAllowedCountry2() {
31681
31793
  ExecutionStatus,
31682
31794
  SOLANA_USDC_ADDRESS,
31683
31795
  UnifoldProvider,
31796
+ WithdrawEventType,
31684
31797
  createDepositAddress,
31685
31798
  createOnrampSession,
31686
31799
  generatePrefixedKSUID,
@@ -31718,6 +31831,7 @@ lucide-react/dist/esm/createLucideIcon.js:
31718
31831
  lucide-react/dist/esm/icons/arrow-left-right.js:
31719
31832
  lucide-react/dist/esm/icons/arrow-left.js:
31720
31833
  lucide-react/dist/esm/icons/arrow-up-down.js:
31834
+ lucide-react/dist/esm/icons/bitcoin.js:
31721
31835
  lucide-react/dist/esm/icons/check.js:
31722
31836
  lucide-react/dist/esm/icons/chevron-down.js:
31723
31837
  lucide-react/dist/esm/icons/chevron-right.js:
package/dist/index.mjs CHANGED
@@ -1326,6 +1326,17 @@ var ArrowUpDown = createLucideIcon("ArrowUpDown", [
1326
1326
  ["path", { d: "M7 4v16", key: "1glfcx" }]
1327
1327
  ]);
1328
1328
 
1329
+ // ../../node_modules/.pnpm/lucide-react@0.454.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/bitcoin.js
1330
+ var Bitcoin = createLucideIcon("Bitcoin", [
1331
+ [
1332
+ "path",
1333
+ {
1334
+ d: "M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",
1335
+ key: "yr8idg"
1336
+ }
1337
+ ]
1338
+ ]);
1339
+
1329
1340
  // ../../node_modules/.pnpm/lucide-react@0.454.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/check.js
1330
1341
  var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
1331
1342
 
@@ -7117,8 +7128,13 @@ async function sendHypercoreTransaction(request, publishableKey) {
7117
7128
  }
7118
7129
  var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
7119
7130
  DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
7131
+ DepositEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
7120
7132
  return DepositEventType2;
7121
7133
  })(DepositEventType || {});
7134
+ var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
7135
+ WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
7136
+ return WithdrawEventType2;
7137
+ })(WithdrawEventType || {});
7122
7138
  function useUserIp() {
7123
7139
  const {
7124
7140
  data: userIpInfo,
@@ -15101,6 +15117,31 @@ function useDepositPolling({
15101
15117
  onDepositSuccess,
15102
15118
  onDepositError
15103
15119
  }) {
15120
+ const createExecutionSuccessEvent = (execution) => ({
15121
+ id: generatePrefixedKSUID("sevt"),
15122
+ type: DepositEventType.DIRECT_EXECUTION_SUCCEEDED,
15123
+ created: execution.updated_at ? Math.floor(new Date(execution.updated_at).getTime() / 1e3) : execution.created_at ? Math.floor(new Date(execution.created_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3),
15124
+ data: { object: mapToDirectExecution(execution) }
15125
+ });
15126
+ const mapToDirectExecution = (execution) => ({
15127
+ id: execution.id,
15128
+ transactionHash: execution.transaction_hash,
15129
+ recipientAddress: execution.recipient_address,
15130
+ depositAddress: execution.deposit_wallet?.address,
15131
+ sourceChainType: execution.source_chain_type,
15132
+ sourceChainId: execution.source_chain_id,
15133
+ sourceTokenAddress: execution.source_token_address,
15134
+ destinationChainType: execution.destination_chain_type,
15135
+ destinationChainId: execution.destination_chain_id,
15136
+ destinationTokenAddress: execution.destination_token_address,
15137
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
15138
+ sourceAmountUsd: execution.source_amount_usd,
15139
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
15140
+ destinationAmountUsd: execution.destination_amount_usd,
15141
+ destinationTransactionHashes: execution.destination_transaction_hashes,
15142
+ status: execution.status,
15143
+ failureReason: execution.failure_reason
15144
+ });
15104
15145
  const [executions, setExecutions] = useState52([]);
15105
15146
  const [isPolling, setIsPolling] = useState52(false);
15106
15147
  const [pollingEnabled, setPollingEnabled] = useState52(false);
@@ -15214,7 +15255,9 @@ function useDepositPolling({
15214
15255
  onDepositSuccessRef.current?.({
15215
15256
  message: "Deposit completed successfully",
15216
15257
  executionId: execution.id,
15217
- transaction: execution
15258
+ // Backward compatibility: keep transaction in API response shape.
15259
+ transaction: execution,
15260
+ execution: createExecutionSuccessEvent(execution)
15218
15261
  });
15219
15262
  } else if (execution.status === ExecutionStatus.FAILED && previousStatus !== ExecutionStatus.FAILED) {
15220
15263
  onDepositErrorRef.current?.({
@@ -21395,6 +21438,8 @@ function CoinbaseConnect({
21395
21438
  destinationChainId,
21396
21439
  destinationChainType,
21397
21440
  onTransferSuccess,
21441
+ onDepositSuccess,
21442
+ onDepositError,
21398
21443
  onTransferError,
21399
21444
  onClose,
21400
21445
  onBack: parentOnBack,
@@ -21542,10 +21587,14 @@ function CoinbaseConnect({
21542
21587
  depositWalletId: transferDepositWalletId,
21543
21588
  enabled: view === "success" && !!transferDepositWalletId,
21544
21589
  immediateDirectPolling: true,
21545
- onDepositSuccess: onTransferSuccess ? () => {
21546
- if (confirmResult) onTransferSuccess(confirmResult);
21590
+ onDepositSuccess: onDepositSuccess || onTransferSuccess ? (data) => {
21591
+ onDepositSuccess?.(data);
21592
+ if (onTransferSuccess && confirmResult) onTransferSuccess(confirmResult);
21547
21593
  } : void 0,
21548
- onDepositError: onTransferError
21594
+ onDepositError: onDepositError || onTransferError ? (error) => {
21595
+ onDepositError?.(error);
21596
+ onTransferError?.({ message: error.message });
21597
+ } : void 0
21549
21598
  });
21550
21599
  useEffect172(() => {
21551
21600
  onExecutionsChange?.(depositExecutions);
@@ -27732,7 +27781,10 @@ function WalletConnect({
27732
27781
  children: [
27733
27782
  /* @__PURE__ */ jsxs48("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
27734
27783
  WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ jsx54(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ jsx54("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
27735
- /* @__PURE__ */ jsx54("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name })
27784
+ /* @__PURE__ */ jsxs48("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
27785
+ /* @__PURE__ */ jsx54("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name }),
27786
+ wallet.id === recentWalletId && /* @__PURE__ */ jsx54("span", { className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Last used" })
27787
+ ] })
27736
27788
  ] }),
27737
27789
  isPending ? /* @__PURE__ */ jsx54(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ jsx54("span", { className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Detected" }) : /* @__PURE__ */ jsxs48("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
27738
27790
  /* @__PURE__ */ jsx54("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
@@ -27993,6 +28045,23 @@ function DepositModal({
27993
28045
  depositTrackerSubTitle = t7.depositTracker.subtitle
27994
28046
  }) {
27995
28047
  const { colors: colors2, fonts, components } = useTheme();
28048
+ const onDepositSuccessFor = useCallback52(
28049
+ (method) => onDepositSuccess || onEvent ? (data) => {
28050
+ const payload = { ...data, method };
28051
+ onDepositSuccess?.(payload);
28052
+ if (payload.execution) {
28053
+ onEvent?.({
28054
+ ...payload.execution,
28055
+ method
28056
+ });
28057
+ }
28058
+ } : void 0,
28059
+ [onDepositSuccess, onEvent]
28060
+ );
28061
+ const onDepositErrorFor = useCallback52(
28062
+ (method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
28063
+ [onDepositError]
28064
+ );
27996
28065
  const effectiveInitialScreen = useMemo10(() => {
27997
28066
  const s = initialScreen ?? "main";
27998
28067
  if (s === "tracker" && hideDepositTracker === true) return "main";
@@ -28533,8 +28602,8 @@ function DepositModal({
28533
28602
  cashAppMenuButton
28534
28603
  ].filter(Boolean);
28535
28604
  const depositTabs = [
28536
- { id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
28537
- { id: "cash", label: "Use Cash", buttons: cashMenuButtons }
28605
+ { id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
28606
+ { id: "cash", label: "Use Cash", icon: DollarSign, buttons: cashMenuButtons }
28538
28607
  ].filter((tab) => tab.buttons.length > 0);
28539
28608
  const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
28540
28609
  const renderMainMenuBody = () => {
@@ -28557,18 +28626,16 @@ function DepositModal({
28557
28626
  role: "tablist",
28558
28627
  children: depositTabs.map((tab) => {
28559
28628
  const active = activeDepositTab.id === tab.id;
28560
- return /* @__PURE__ */ jsx55(
28629
+ const TabIcon = tab.icon;
28630
+ return /* @__PURE__ */ jsxs49(
28561
28631
  "button",
28562
28632
  {
28563
28633
  type: "button",
28564
28634
  role: "tab",
28565
28635
  "aria-selected": active,
28566
28636
  onClick: () => setDepositTab(tab.id),
28567
- className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
28637
+ className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all uf-flex uf-items-center uf-justify-center uf-gap-1.5",
28568
28638
  style: {
28569
- // Active tab is a soft, blurred glass pill — a faint accent
28570
- // tint with its own backdrop blur and a subtle border/shadow,
28571
- // so it looks frosted instead of like a hard solid button.
28572
28639
  backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
28573
28640
  backdropFilter: active ? "blur(8px)" : void 0,
28574
28641
  WebkitBackdropFilter: active ? "blur(8px)" : void 0,
@@ -28576,7 +28643,19 @@ function DepositModal({
28576
28643
  color: active ? colors2.foreground : colors2.foregroundMuted,
28577
28644
  fontFamily: fonts.medium
28578
28645
  },
28579
- children: tab.label
28646
+ children: [
28647
+ /* @__PURE__ */ jsx55(
28648
+ "span",
28649
+ {
28650
+ className: "uf-inline-flex uf-items-center uf-justify-center uf-rounded-full uf-w-5 uf-h-5 uf-flex-shrink-0",
28651
+ style: {
28652
+ backgroundColor: active ? colors2.foreground : colors2.foregroundMuted
28653
+ },
28654
+ children: /* @__PURE__ */ jsx55(TabIcon, { size: 12, style: { color: active ? colors2.background : colors2.background }, strokeWidth: 2.5 })
28655
+ }
28656
+ ),
28657
+ tab.label
28658
+ ]
28580
28659
  },
28581
28660
  tab.id
28582
28661
  );
@@ -28667,8 +28746,8 @@ function DepositModal({
28667
28746
  defaultSourceSymbol,
28668
28747
  depositConfirmationMode,
28669
28748
  onExecutionsChange: setDepositExecutions,
28670
- onDepositSuccess,
28671
- onDepositError,
28749
+ onDepositSuccess: onDepositSuccessFor("transfer"),
28750
+ onDepositError: onDepositErrorFor("transfer"),
28672
28751
  wallets
28673
28752
  }
28674
28753
  ) : /* @__PURE__ */ jsx55(
@@ -28686,8 +28765,8 @@ function DepositModal({
28686
28765
  defaultSourceSymbol,
28687
28766
  depositConfirmationMode,
28688
28767
  onExecutionsChange: setDepositExecutions,
28689
- onDepositSuccess,
28690
- onDepositError,
28768
+ onDepositSuccess: onDepositSuccessFor("transfer"),
28769
+ onDepositError: onDepositErrorFor("transfer"),
28691
28770
  wallets
28692
28771
  }
28693
28772
  ),
@@ -28752,8 +28831,8 @@ function DepositModal({
28752
28831
  destinationChainType,
28753
28832
  destinationChainId,
28754
28833
  destinationTokenAddress,
28755
- onDepositSuccess,
28756
- onDepositError,
28834
+ onDepositSuccess: onDepositSuccessFor("card"),
28835
+ onDepositError: onDepositErrorFor("card"),
28757
28836
  onEvent,
28758
28837
  themeClass,
28759
28838
  wallets,
@@ -28788,8 +28867,8 @@ function DepositModal({
28788
28867
  destinationChainType,
28789
28868
  destinationChainId,
28790
28869
  destinationTokenAddress,
28791
- onDepositSuccess,
28792
- onDepositError,
28870
+ onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
28871
+ onDepositError: onDepositErrorFor("pay_with_exchange"),
28793
28872
  wallets,
28794
28873
  defaultToken: defaultToken ?? null
28795
28874
  }
@@ -28807,14 +28886,10 @@ function DepositModal({
28807
28886
  destinationTokenAddress: destinationTokenAddress ?? "",
28808
28887
  destinationChainId: destinationChainId ?? "",
28809
28888
  destinationChainType: destinationChainType ?? "",
28810
- onTransferSuccess: (result) => {
28811
- onDepositSuccess?.({
28812
- message: "Transfer completed via Coinbase Connect",
28813
- transaction: result
28814
- });
28815
- },
28889
+ onDepositSuccess: onDepositSuccessFor("exchange_connect"),
28890
+ onDepositError: onDepositErrorFor("exchange_connect"),
28816
28891
  onTransferError: (error) => {
28817
- onDepositError?.({
28892
+ onDepositErrorFor("exchange_connect")?.({
28818
28893
  message: error.message,
28819
28894
  error
28820
28895
  });
@@ -28843,20 +28918,14 @@ function DepositModal({
28843
28918
  publishableKey,
28844
28919
  assetCdnUrl: projectConfig?.asset_cdn_url,
28845
28920
  projectName: projectConfig?.project_name,
28846
- onSuccess: (txHash) => {
28847
- onDepositSuccess?.({
28848
- message: "Transaction sent successfully",
28849
- transaction: { txHash }
28850
- });
28851
- },
28852
28921
  onError: (error) => {
28853
- onDepositError?.({
28922
+ onDepositErrorFor("wallet_connect")?.({
28854
28923
  message: error.message,
28855
28924
  error
28856
28925
  });
28857
28926
  },
28858
- onDepositSuccess,
28859
- onDepositError,
28927
+ onDepositSuccess: onDepositSuccessFor("wallet_connect"),
28928
+ onDepositError: onDepositErrorFor("wallet_connect"),
28860
28929
  amountQuickSelect: browserWalletAmountQuickSelect,
28861
28930
  onWalletDisconnect: handleWalletDisconnect,
28862
28931
  onWalletConnected: (info, dw) => {
@@ -28900,8 +28969,8 @@ function DepositModal({
28900
28969
  onViewChange: setCashAppView,
28901
28970
  onAmountChange: setCashAppAmount,
28902
28971
  onEvent,
28903
- onDepositSuccess,
28904
- onDepositError
28972
+ onDepositSuccess: onDepositSuccessFor("cashapp"),
28973
+ onDepositError: onDepositErrorFor("cashapp")
28905
28974
  }
28906
28975
  ),
28907
28976
  depositPoweredByFooter
@@ -29739,6 +29808,31 @@ function useWithdrawPolling({
29739
29808
  onWithdrawSuccess,
29740
29809
  onWithdrawError
29741
29810
  }) {
29811
+ const createExecutionSuccessEvent = (execution) => ({
29812
+ id: generatePrefixedKSUID("sevt"),
29813
+ type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
29814
+ created: execution.updated_at ? Math.floor(new Date(execution.updated_at).getTime() / 1e3) : execution.created_at ? Math.floor(new Date(execution.created_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3),
29815
+ data: { object: mapToDirectExecution(execution) }
29816
+ });
29817
+ const mapToDirectExecution = (execution) => ({
29818
+ id: execution.id,
29819
+ transactionHash: execution.transaction_hash,
29820
+ recipientAddress: execution.recipient_address,
29821
+ depositAddress: execution.deposit_wallet?.address,
29822
+ sourceChainType: execution.source_chain_type,
29823
+ sourceChainId: execution.source_chain_id,
29824
+ sourceTokenAddress: execution.source_token_address,
29825
+ destinationChainType: execution.destination_chain_type,
29826
+ destinationChainId: execution.destination_chain_id,
29827
+ destinationTokenAddress: execution.destination_token_address,
29828
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
29829
+ sourceAmountUsd: execution.source_amount_usd,
29830
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
29831
+ destinationAmountUsd: execution.destination_amount_usd,
29832
+ destinationTransactionHashes: execution.destination_transaction_hashes,
29833
+ status: execution.status,
29834
+ failureReason: execution.failure_reason
29835
+ });
29742
29836
  const [executions, setExecutions] = useState34([]);
29743
29837
  const [isPolling, setIsPolling] = useState34(false);
29744
29838
  const enabledAtRef = useRef112(/* @__PURE__ */ new Date());
@@ -29806,7 +29900,13 @@ function useWithdrawPolling({
29806
29900
  return [...list, ex];
29807
29901
  });
29808
29902
  if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
29809
- onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
29903
+ onSuccessRef.current?.({
29904
+ message: "Withdrawal completed successfully",
29905
+ executionId: ex.id,
29906
+ // Backward compatibility: keep transaction in API response shape.
29907
+ transaction: ex,
29908
+ execution: createExecutionSuccessEvent(ex)
29909
+ });
29810
29910
  } else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
29811
29911
  onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
29812
29912
  }
@@ -31008,9 +31108,19 @@ function WithdrawModal({
31008
31108
  onWithdraw,
31009
31109
  onWithdrawSuccess,
31010
31110
  onWithdrawError,
31111
+ onEvent,
31011
31112
  theme = "dark",
31012
31113
  hideOverlay = false
31013
31114
  }) {
31115
+ const onWithdrawSuccessFor = useCallback82(
31116
+ (data) => {
31117
+ onWithdrawSuccess?.(data);
31118
+ if (data.execution) {
31119
+ onEvent?.(data.execution);
31120
+ }
31121
+ },
31122
+ [onWithdrawSuccess, onEvent]
31123
+ );
31014
31124
  const { colors: colors2, fonts, components } = useTheme();
31015
31125
  const [containerEl, setContainerEl] = useState37(null);
31016
31126
  const containerCallbackRef = useCallback82((el) => {
@@ -31072,7 +31182,7 @@ function WithdrawModal({
31072
31182
  publishableKey,
31073
31183
  depositWalletId: withdrawDepositWalletId,
31074
31184
  enabled: !!withdrawDepositWalletId && open,
31075
- onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
31185
+ onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
31076
31186
  onWithdrawError
31077
31187
  });
31078
31188
  const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
@@ -31572,6 +31682,7 @@ function UnifoldProvider2({
31572
31682
  onWithdraw: withdrawConfig.withdraw,
31573
31683
  onWithdrawSuccess: handleWithdrawSuccess,
31574
31684
  onWithdrawError: handleWithdrawError,
31685
+ onEvent: withdrawConfig.onEvent,
31575
31686
  theme: resolvedTheme
31576
31687
  }
31577
31688
  ),
@@ -31666,6 +31777,7 @@ export {
31666
31777
  ExecutionStatus,
31667
31778
  SOLANA_USDC_ADDRESS,
31668
31779
  UnifoldProvider2 as UnifoldProvider,
31780
+ WithdrawEventType,
31669
31781
  createDepositAddress,
31670
31782
  createOnrampSession,
31671
31783
  generatePrefixedKSUID,
@@ -31703,6 +31815,7 @@ lucide-react/dist/esm/createLucideIcon.js:
31703
31815
  lucide-react/dist/esm/icons/arrow-left-right.js:
31704
31816
  lucide-react/dist/esm/icons/arrow-left.js:
31705
31817
  lucide-react/dist/esm/icons/arrow-up-down.js:
31818
+ lucide-react/dist/esm/icons/bitcoin.js:
31706
31819
  lucide-react/dist/esm/icons/check.js:
31707
31820
  lucide-react/dist/esm/icons/chevron-down.js:
31708
31821
  lucide-react/dist/esm/icons/chevron-right.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/connect-react",
3
- "version": "0.1.65",
3
+ "version": "0.1.67",
4
4
  "description": "Unifold Connect React - Complete React SDK with UI components for crypto deposits",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@tanstack/react-query": "^5.90.11",
29
- "@unifold/core": "0.1.65",
30
- "@unifold/ui-react": "0.1.65",
31
- "@unifold/react-provider": "0.1.65"
29
+ "@unifold/core": "0.1.67",
30
+ "@unifold/react-provider": "0.1.67",
31
+ "@unifold/ui-react": "0.1.67"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/react": "^19.0.0",