@unifold/ui-react 0.1.66 → 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,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { AutoSwapResponse, ChainType, EvmContractCall, DepositEvent, Wallet, ProductType, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, ConfirmIntegrationTransferResult, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, SupportedDepositTokensResponse, VerifyAddressResponse } from '@unifold/core';
3
- export { ChainType } from '@unifold/core';
2
+ import { DirectExecutionSucceededEvent, DirectExecutionResponse, ChainType, EvmContractCall, DepositMethod, DepositEvent, Wallet, ProductType, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, ConfirmIntegrationTransferResult, WithdrawDirectExecutionSucceededEvent, WithdrawEvent, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, SupportedDepositTokensResponse, VerifyAddressResponse } from '@unifold/core';
3
+ export { ChainType, DepositMethod } 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';
6
6
  import * as React$1 from 'react';
@@ -41,6 +41,7 @@ interface UseDepositPollingOptions {
41
41
  message: string;
42
42
  transaction?: unknown;
43
43
  executionId?: string;
44
+ execution?: DirectExecutionSucceededEvent;
44
45
  }) => void;
45
46
  onDepositError?: (error: {
46
47
  message: string;
@@ -55,7 +56,7 @@ interface UseDepositPollingOptions {
55
56
  immediateDirectPolling?: boolean;
56
57
  }
57
58
  interface UseDepositPollingResult {
58
- executions: AutoSwapResponse[];
59
+ executions: DirectExecutionResponse[];
59
60
  isPolling: boolean;
60
61
  /** Whether the backend poll endpoint has been enabled */
61
62
  pollingEnabled: boolean;
@@ -217,12 +218,17 @@ interface DepositModalProps {
217
218
  message: string;
218
219
  transaction?: unknown;
219
220
  executionId?: string;
221
+ execution?: DirectExecutionSucceededEvent;
222
+ /** Which funding method produced this success event. */
223
+ method?: DepositMethod;
220
224
  }) => void;
221
225
  onEvent?: (event: DepositEvent) => void;
222
226
  onDepositError?: (error: {
223
227
  message: string;
224
228
  error?: unknown;
225
229
  code?: string;
230
+ /** Which funding method produced this error event. */
231
+ method?: DepositMethod;
226
232
  }) => void;
227
233
  theme?: "light" | "dark" | "auto";
228
234
  /** Hide the dialog overlay and close button for inline/embedded mode */
@@ -279,11 +285,12 @@ interface TransferCryptoSingleInputProps {
279
285
  * - "manual": User must click "I've made the deposit" to start polling
280
286
  */
281
287
  depositConfirmationMode?: DepositConfirmationMode;
282
- onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
288
+ onExecutionsChange?: (executions: DirectExecutionResponse[]) => void;
283
289
  onDepositSuccess?: (data: {
284
290
  message: string;
285
291
  transaction?: unknown;
286
292
  executionId?: string;
293
+ execution?: DirectExecutionSucceededEvent;
287
294
  }) => void;
288
295
  onDepositError?: (error: {
289
296
  message: string;
@@ -335,11 +342,12 @@ interface TransferCryptoDoubleInputProps {
335
342
  * - "manual": User must click "I've made the deposit" to start polling
336
343
  */
337
344
  depositConfirmationMode?: DepositConfirmationMode;
338
- onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
345
+ onExecutionsChange?: (executions: DirectExecutionResponse[]) => void;
339
346
  onDepositSuccess?: (data: {
340
347
  message: string;
341
348
  transaction?: unknown;
342
349
  executionId?: string;
350
+ execution?: DirectExecutionSucceededEvent;
343
351
  }) => void;
344
352
  onDepositError?: (error: {
345
353
  message: string;
@@ -366,6 +374,7 @@ interface BuyWithCardProps {
366
374
  message: string;
367
375
  transaction?: unknown;
368
376
  executionId?: string;
377
+ execution?: DirectExecutionSucceededEvent;
369
378
  }) => void;
370
379
  onEvent?: (event: DepositEvent) => void;
371
380
  onDepositError?: (error: {
@@ -406,7 +415,7 @@ interface DepositSuccessToastProps {
406
415
  tokenIconUrl?: string;
407
416
  sourceAmountUsd?: string;
408
417
  onClose: () => void;
409
- execution?: AutoSwapResponse;
418
+ execution?: DirectExecutionResponse;
410
419
  }
411
420
  declare function DepositSuccessToast({ depositTx, orderSubmittedAt, status, tokenIconUrl, sourceAmountUsd, onClose, execution, }: DepositSuccessToastProps): react_jsx_runtime.JSX.Element;
412
421
 
@@ -414,7 +423,7 @@ interface DepositsModalProps {
414
423
  open: boolean;
415
424
  onOpenChange: (open: boolean) => void;
416
425
  onCloseAll?: () => void;
417
- executions: AutoSwapResponse[];
426
+ executions: DirectExecutionResponse[];
418
427
  userId: string;
419
428
  publishableKey: string;
420
429
  themeClass?: string;
@@ -497,6 +506,17 @@ interface CoinbaseConnectProps {
497
506
  destinationChainId: string;
498
507
  destinationChainType: string;
499
508
  onTransferSuccess?: (result: ConfirmIntegrationTransferResult) => void;
509
+ onDepositSuccess?: (data: {
510
+ message: string;
511
+ transaction?: unknown;
512
+ executionId?: string;
513
+ execution?: DirectExecutionSucceededEvent;
514
+ }) => void;
515
+ onDepositError?: (error: {
516
+ message: string;
517
+ error?: unknown;
518
+ code?: string;
519
+ }) => void;
500
520
  onTransferError?: (error: {
501
521
  message: string;
502
522
  }) => void;
@@ -506,25 +526,25 @@ interface CoinbaseConnectProps {
506
526
  skipToHoldings?: boolean;
507
527
  /** Whether back navigation from the root view is available (false when opened as a standalone initial screen). */
508
528
  canGoBack?: boolean;
509
- onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
529
+ onExecutionsChange?: (executions: DirectExecutionResponse[]) => void;
510
530
  defaultSourceChainType?: ChainType;
511
531
  defaultSourceChainId?: string;
512
532
  defaultSourceTokenAddress?: string;
513
533
  defaultSourceSymbol?: string;
514
534
  }
515
- declare function CoinbaseConnect({ publishableKey, userId, wallets, recipientAddress, destinationTokenAddress, destinationChainId, destinationChainType, onTransferSuccess, onTransferError, onClose, onBack: parentOnBack, onDisconnect, skipToHoldings, canGoBack, onExecutionsChange, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, }: CoinbaseConnectProps): react_jsx_runtime.JSX.Element | null;
535
+ declare function CoinbaseConnect({ publishableKey, userId, wallets, recipientAddress, destinationTokenAddress, destinationChainId, destinationChainType, onTransferSuccess, onDepositSuccess, onDepositError, onTransferError, onClose, onBack: parentOnBack, onDisconnect, skipToHoldings, canGoBack, onExecutionsChange, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, }: CoinbaseConnectProps): react_jsx_runtime.JSX.Element | null;
516
536
  declare namespace CoinbaseConnect {
517
537
  var displayName: string;
518
538
  }
519
539
 
520
540
  interface DepositExecutionItemProps {
521
- execution: AutoSwapResponse;
541
+ execution: DirectExecutionResponse;
522
542
  onClick?: () => void;
523
543
  }
524
544
  declare function DepositExecutionItem({ execution, onClick, }: DepositExecutionItemProps): react_jsx_runtime.JSX.Element;
525
545
 
526
546
  interface DepositDetailContentProps {
527
- execution: AutoSwapResponse;
547
+ execution: DirectExecutionResponse;
528
548
  /** Merged into root (e.g. wider horizontal padding in embedded deposit details). */
529
549
  className?: string;
530
550
  /** Use "withdraw" to show "Withdrawal Tx" instead of "Deposit Tx" in details. */
@@ -553,7 +573,7 @@ declare function CheckingForDepositIndicator({ showWaitingUi, hasExecution, }: {
553
573
  interface ConfirmingViewProps {
554
574
  isConfirming: boolean;
555
575
  onClose: () => void;
556
- executions?: AutoSwapResponse[];
576
+ executions?: DirectExecutionResponse[];
557
577
  isPolling?: boolean;
558
578
  onNewDeposit?: () => void;
559
579
  onDone?: () => void;
@@ -652,16 +672,19 @@ interface WithdrawModalProps {
652
672
  onWithdrawSuccess?: (data: {
653
673
  message: string;
654
674
  transaction?: unknown;
675
+ executionId?: string;
676
+ execution?: WithdrawDirectExecutionSucceededEvent;
655
677
  }) => void;
656
678
  onWithdrawError?: (error: {
657
679
  message: string;
658
680
  error?: unknown;
659
681
  code?: string;
660
682
  }) => void;
683
+ onEvent?: (event: WithdrawEvent) => void;
661
684
  theme?: "light" | "dark" | "auto";
662
685
  hideOverlay?: boolean;
663
686
  }
664
- 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;
687
+ declare function WithdrawModal({ open, onOpenChange, publishableKey, modalTitle, externalUserId, sourceChainType, sourceChainId, sourceTokenAddress, sourceTokenSymbol, recipientAddress: recipientAddressProp, senderAddress, defaultDestinationChainType, defaultDestinationChainId, defaultDestinationTokenAddress, defaultDestinationSymbol, onWithdraw, onWithdrawSuccess, onWithdrawError, onEvent, theme, hideOverlay, }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
665
688
 
666
689
  interface WithdrawTokenSelectorProps {
667
690
  tokens: DestinationToken[];
@@ -744,14 +767,14 @@ interface WithdrawFormProps {
744
767
  declare function WithdrawForm({ publishableKey, externalUserId, sourceChainType, selectedToken, selectedChain, sourceTokenSymbol, recipientAddressProp, balanceData, isLoadingBalance, isStablecoin, minimumWithdrawAmountUsd, estimatedProcessingTime, maxSlippagePercent, priceImpactPercent, senderAddress, sourceChainId, sourceTokenAddress, onWithdraw, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, footerLeft, }: WithdrawFormProps): react_jsx_runtime.JSX.Element;
745
768
 
746
769
  interface WithdrawExecutionItemProps {
747
- execution: AutoSwapResponse;
770
+ execution: DirectExecutionResponse;
748
771
  onClick?: () => void;
749
772
  }
750
773
  declare function WithdrawExecutionItem({ execution, onClick, }: WithdrawExecutionItemProps): react_jsx_runtime.JSX.Element;
751
774
 
752
775
  interface WithdrawConfirmingViewProps {
753
776
  txInfo: WithdrawTransactionInfo;
754
- executions: AutoSwapResponse[];
777
+ executions: DirectExecutionResponse[];
755
778
  onClose: () => void;
756
779
  onViewTracker: () => void;
757
780
  }
@@ -973,6 +996,7 @@ interface UseWithdrawPollingOptions {
973
996
  message: string;
974
997
  transaction?: unknown;
975
998
  executionId?: string;
999
+ execution?: WithdrawDirectExecutionSucceededEvent;
976
1000
  }) => void;
977
1001
  onWithdrawError?: (error: {
978
1002
  message: string;
@@ -981,7 +1005,7 @@ interface UseWithdrawPollingOptions {
981
1005
  }) => void;
982
1006
  }
983
1007
  interface UseWithdrawPollingResult {
984
- executions: AutoSwapResponse[];
1008
+ executions: DirectExecutionResponse[];
985
1009
  isPolling: boolean;
986
1010
  }
987
1011
  declare function useWithdrawPolling({ userId, publishableKey, depositWalletId, enabled, onWithdrawSuccess, onWithdrawError, }: UseWithdrawPollingOptions): UseWithdrawPollingResult;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { AutoSwapResponse, ChainType, EvmContractCall, DepositEvent, Wallet, ProductType, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, ConfirmIntegrationTransferResult, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, SupportedDepositTokensResponse, VerifyAddressResponse } from '@unifold/core';
3
- export { ChainType } from '@unifold/core';
2
+ import { DirectExecutionSucceededEvent, DirectExecutionResponse, ChainType, EvmContractCall, DepositMethod, DepositEvent, Wallet, ProductType, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, ConfirmIntegrationTransferResult, WithdrawDirectExecutionSucceededEvent, WithdrawEvent, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, SupportedDepositTokensResponse, VerifyAddressResponse } from '@unifold/core';
3
+ export { ChainType, DepositMethod } 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';
6
6
  import * as React$1 from 'react';
@@ -41,6 +41,7 @@ interface UseDepositPollingOptions {
41
41
  message: string;
42
42
  transaction?: unknown;
43
43
  executionId?: string;
44
+ execution?: DirectExecutionSucceededEvent;
44
45
  }) => void;
45
46
  onDepositError?: (error: {
46
47
  message: string;
@@ -55,7 +56,7 @@ interface UseDepositPollingOptions {
55
56
  immediateDirectPolling?: boolean;
56
57
  }
57
58
  interface UseDepositPollingResult {
58
- executions: AutoSwapResponse[];
59
+ executions: DirectExecutionResponse[];
59
60
  isPolling: boolean;
60
61
  /** Whether the backend poll endpoint has been enabled */
61
62
  pollingEnabled: boolean;
@@ -217,12 +218,17 @@ interface DepositModalProps {
217
218
  message: string;
218
219
  transaction?: unknown;
219
220
  executionId?: string;
221
+ execution?: DirectExecutionSucceededEvent;
222
+ /** Which funding method produced this success event. */
223
+ method?: DepositMethod;
220
224
  }) => void;
221
225
  onEvent?: (event: DepositEvent) => void;
222
226
  onDepositError?: (error: {
223
227
  message: string;
224
228
  error?: unknown;
225
229
  code?: string;
230
+ /** Which funding method produced this error event. */
231
+ method?: DepositMethod;
226
232
  }) => void;
227
233
  theme?: "light" | "dark" | "auto";
228
234
  /** Hide the dialog overlay and close button for inline/embedded mode */
@@ -279,11 +285,12 @@ interface TransferCryptoSingleInputProps {
279
285
  * - "manual": User must click "I've made the deposit" to start polling
280
286
  */
281
287
  depositConfirmationMode?: DepositConfirmationMode;
282
- onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
288
+ onExecutionsChange?: (executions: DirectExecutionResponse[]) => void;
283
289
  onDepositSuccess?: (data: {
284
290
  message: string;
285
291
  transaction?: unknown;
286
292
  executionId?: string;
293
+ execution?: DirectExecutionSucceededEvent;
287
294
  }) => void;
288
295
  onDepositError?: (error: {
289
296
  message: string;
@@ -335,11 +342,12 @@ interface TransferCryptoDoubleInputProps {
335
342
  * - "manual": User must click "I've made the deposit" to start polling
336
343
  */
337
344
  depositConfirmationMode?: DepositConfirmationMode;
338
- onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
345
+ onExecutionsChange?: (executions: DirectExecutionResponse[]) => void;
339
346
  onDepositSuccess?: (data: {
340
347
  message: string;
341
348
  transaction?: unknown;
342
349
  executionId?: string;
350
+ execution?: DirectExecutionSucceededEvent;
343
351
  }) => void;
344
352
  onDepositError?: (error: {
345
353
  message: string;
@@ -366,6 +374,7 @@ interface BuyWithCardProps {
366
374
  message: string;
367
375
  transaction?: unknown;
368
376
  executionId?: string;
377
+ execution?: DirectExecutionSucceededEvent;
369
378
  }) => void;
370
379
  onEvent?: (event: DepositEvent) => void;
371
380
  onDepositError?: (error: {
@@ -406,7 +415,7 @@ interface DepositSuccessToastProps {
406
415
  tokenIconUrl?: string;
407
416
  sourceAmountUsd?: string;
408
417
  onClose: () => void;
409
- execution?: AutoSwapResponse;
418
+ execution?: DirectExecutionResponse;
410
419
  }
411
420
  declare function DepositSuccessToast({ depositTx, orderSubmittedAt, status, tokenIconUrl, sourceAmountUsd, onClose, execution, }: DepositSuccessToastProps): react_jsx_runtime.JSX.Element;
412
421
 
@@ -414,7 +423,7 @@ interface DepositsModalProps {
414
423
  open: boolean;
415
424
  onOpenChange: (open: boolean) => void;
416
425
  onCloseAll?: () => void;
417
- executions: AutoSwapResponse[];
426
+ executions: DirectExecutionResponse[];
418
427
  userId: string;
419
428
  publishableKey: string;
420
429
  themeClass?: string;
@@ -497,6 +506,17 @@ interface CoinbaseConnectProps {
497
506
  destinationChainId: string;
498
507
  destinationChainType: string;
499
508
  onTransferSuccess?: (result: ConfirmIntegrationTransferResult) => void;
509
+ onDepositSuccess?: (data: {
510
+ message: string;
511
+ transaction?: unknown;
512
+ executionId?: string;
513
+ execution?: DirectExecutionSucceededEvent;
514
+ }) => void;
515
+ onDepositError?: (error: {
516
+ message: string;
517
+ error?: unknown;
518
+ code?: string;
519
+ }) => void;
500
520
  onTransferError?: (error: {
501
521
  message: string;
502
522
  }) => void;
@@ -506,25 +526,25 @@ interface CoinbaseConnectProps {
506
526
  skipToHoldings?: boolean;
507
527
  /** Whether back navigation from the root view is available (false when opened as a standalone initial screen). */
508
528
  canGoBack?: boolean;
509
- onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
529
+ onExecutionsChange?: (executions: DirectExecutionResponse[]) => void;
510
530
  defaultSourceChainType?: ChainType;
511
531
  defaultSourceChainId?: string;
512
532
  defaultSourceTokenAddress?: string;
513
533
  defaultSourceSymbol?: string;
514
534
  }
515
- declare function CoinbaseConnect({ publishableKey, userId, wallets, recipientAddress, destinationTokenAddress, destinationChainId, destinationChainType, onTransferSuccess, onTransferError, onClose, onBack: parentOnBack, onDisconnect, skipToHoldings, canGoBack, onExecutionsChange, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, }: CoinbaseConnectProps): react_jsx_runtime.JSX.Element | null;
535
+ declare function CoinbaseConnect({ publishableKey, userId, wallets, recipientAddress, destinationTokenAddress, destinationChainId, destinationChainType, onTransferSuccess, onDepositSuccess, onDepositError, onTransferError, onClose, onBack: parentOnBack, onDisconnect, skipToHoldings, canGoBack, onExecutionsChange, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, }: CoinbaseConnectProps): react_jsx_runtime.JSX.Element | null;
516
536
  declare namespace CoinbaseConnect {
517
537
  var displayName: string;
518
538
  }
519
539
 
520
540
  interface DepositExecutionItemProps {
521
- execution: AutoSwapResponse;
541
+ execution: DirectExecutionResponse;
522
542
  onClick?: () => void;
523
543
  }
524
544
  declare function DepositExecutionItem({ execution, onClick, }: DepositExecutionItemProps): react_jsx_runtime.JSX.Element;
525
545
 
526
546
  interface DepositDetailContentProps {
527
- execution: AutoSwapResponse;
547
+ execution: DirectExecutionResponse;
528
548
  /** Merged into root (e.g. wider horizontal padding in embedded deposit details). */
529
549
  className?: string;
530
550
  /** Use "withdraw" to show "Withdrawal Tx" instead of "Deposit Tx" in details. */
@@ -553,7 +573,7 @@ declare function CheckingForDepositIndicator({ showWaitingUi, hasExecution, }: {
553
573
  interface ConfirmingViewProps {
554
574
  isConfirming: boolean;
555
575
  onClose: () => void;
556
- executions?: AutoSwapResponse[];
576
+ executions?: DirectExecutionResponse[];
557
577
  isPolling?: boolean;
558
578
  onNewDeposit?: () => void;
559
579
  onDone?: () => void;
@@ -652,16 +672,19 @@ interface WithdrawModalProps {
652
672
  onWithdrawSuccess?: (data: {
653
673
  message: string;
654
674
  transaction?: unknown;
675
+ executionId?: string;
676
+ execution?: WithdrawDirectExecutionSucceededEvent;
655
677
  }) => void;
656
678
  onWithdrawError?: (error: {
657
679
  message: string;
658
680
  error?: unknown;
659
681
  code?: string;
660
682
  }) => void;
683
+ onEvent?: (event: WithdrawEvent) => void;
661
684
  theme?: "light" | "dark" | "auto";
662
685
  hideOverlay?: boolean;
663
686
  }
664
- 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;
687
+ declare function WithdrawModal({ open, onOpenChange, publishableKey, modalTitle, externalUserId, sourceChainType, sourceChainId, sourceTokenAddress, sourceTokenSymbol, recipientAddress: recipientAddressProp, senderAddress, defaultDestinationChainType, defaultDestinationChainId, defaultDestinationTokenAddress, defaultDestinationSymbol, onWithdraw, onWithdrawSuccess, onWithdrawError, onEvent, theme, hideOverlay, }: WithdrawModalProps): react_jsx_runtime.JSX.Element;
665
688
 
666
689
  interface WithdrawTokenSelectorProps {
667
690
  tokens: DestinationToken[];
@@ -744,14 +767,14 @@ interface WithdrawFormProps {
744
767
  declare function WithdrawForm({ publishableKey, externalUserId, sourceChainType, selectedToken, selectedChain, sourceTokenSymbol, recipientAddressProp, balanceData, isLoadingBalance, isStablecoin, minimumWithdrawAmountUsd, estimatedProcessingTime, maxSlippagePercent, priceImpactPercent, senderAddress, sourceChainId, sourceTokenAddress, onWithdraw, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, footerLeft, }: WithdrawFormProps): react_jsx_runtime.JSX.Element;
745
768
 
746
769
  interface WithdrawExecutionItemProps {
747
- execution: AutoSwapResponse;
770
+ execution: DirectExecutionResponse;
748
771
  onClick?: () => void;
749
772
  }
750
773
  declare function WithdrawExecutionItem({ execution, onClick, }: WithdrawExecutionItemProps): react_jsx_runtime.JSX.Element;
751
774
 
752
775
  interface WithdrawConfirmingViewProps {
753
776
  txInfo: WithdrawTransactionInfo;
754
- executions: AutoSwapResponse[];
777
+ executions: DirectExecutionResponse[];
755
778
  onClose: () => void;
756
779
  onViewTracker: () => void;
757
780
  }
@@ -973,6 +996,7 @@ interface UseWithdrawPollingOptions {
973
996
  message: string;
974
997
  transaction?: unknown;
975
998
  executionId?: string;
999
+ execution?: WithdrawDirectExecutionSucceededEvent;
976
1000
  }) => void;
977
1001
  onWithdrawError?: (error: {
978
1002
  message: string;
@@ -981,7 +1005,7 @@ interface UseWithdrawPollingOptions {
981
1005
  }) => void;
982
1006
  }
983
1007
  interface UseWithdrawPollingResult {
984
- executions: AutoSwapResponse[];
1008
+ executions: DirectExecutionResponse[];
985
1009
  isPolling: boolean;
986
1010
  }
987
1011
  declare function useWithdrawPolling({ userId, publishableKey, depositWalletId, enabled, onWithdrawSuccess, onWithdrawError, }: UseWithdrawPollingOptions): UseWithdrawPollingResult;
package/dist/index.js CHANGED
@@ -1730,6 +1730,31 @@ function useDepositPolling({
1730
1730
  onDepositSuccess,
1731
1731
  onDepositError
1732
1732
  }) {
1733
+ const createExecutionSuccessEvent = (execution) => ({
1734
+ id: (0, import_core6.generatePrefixedKSUID)("sevt"),
1735
+ type: import_core6.DepositEventType.DIRECT_EXECUTION_SUCCEEDED,
1736
+ 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),
1737
+ data: { object: mapToDirectExecution(execution) }
1738
+ });
1739
+ const mapToDirectExecution = (execution) => ({
1740
+ id: execution.id,
1741
+ transactionHash: execution.transaction_hash,
1742
+ recipientAddress: execution.recipient_address,
1743
+ depositAddress: execution.deposit_wallet?.address,
1744
+ sourceChainType: execution.source_chain_type,
1745
+ sourceChainId: execution.source_chain_id,
1746
+ sourceTokenAddress: execution.source_token_address,
1747
+ destinationChainType: execution.destination_chain_type,
1748
+ destinationChainId: execution.destination_chain_id,
1749
+ destinationTokenAddress: execution.destination_token_address,
1750
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
1751
+ sourceAmountUsd: execution.source_amount_usd,
1752
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
1753
+ destinationAmountUsd: execution.destination_amount_usd,
1754
+ destinationTransactionHashes: execution.destination_transaction_hashes,
1755
+ status: execution.status,
1756
+ failureReason: execution.failure_reason
1757
+ });
1733
1758
  const [executions, setExecutions] = (0, import_react3.useState)([]);
1734
1759
  const [isPolling, setIsPolling] = (0, import_react3.useState)(false);
1735
1760
  const [pollingEnabled, setPollingEnabled] = (0, import_react3.useState)(false);
@@ -1843,7 +1868,9 @@ function useDepositPolling({
1843
1868
  onDepositSuccessRef.current?.({
1844
1869
  message: "Deposit completed successfully",
1845
1870
  executionId: execution.id,
1846
- transaction: execution
1871
+ // Backward compatibility: keep transaction in API response shape.
1872
+ transaction: execution,
1873
+ execution: createExecutionSuccessEvent(execution)
1847
1874
  });
1848
1875
  } else if (execution.status === import_core6.ExecutionStatus.FAILED && previousStatus !== import_core6.ExecutionStatus.FAILED) {
1849
1876
  onDepositErrorRef.current?.({
@@ -8213,6 +8240,8 @@ function CoinbaseConnect({
8213
8240
  destinationChainId,
8214
8241
  destinationChainType,
8215
8242
  onTransferSuccess,
8243
+ onDepositSuccess,
8244
+ onDepositError,
8216
8245
  onTransferError,
8217
8246
  onClose,
8218
8247
  onBack: parentOnBack,
@@ -8360,10 +8389,14 @@ function CoinbaseConnect({
8360
8389
  depositWalletId: transferDepositWalletId,
8361
8390
  enabled: view === "success" && !!transferDepositWalletId,
8362
8391
  immediateDirectPolling: true,
8363
- onDepositSuccess: onTransferSuccess ? () => {
8364
- if (confirmResult) onTransferSuccess(confirmResult);
8392
+ onDepositSuccess: onDepositSuccess || onTransferSuccess ? (data) => {
8393
+ onDepositSuccess?.(data);
8394
+ if (onTransferSuccess && confirmResult) onTransferSuccess(confirmResult);
8365
8395
  } : void 0,
8366
- onDepositError: onTransferError
8396
+ onDepositError: onDepositError || onTransferError ? (error) => {
8397
+ onDepositError?.(error);
8398
+ onTransferError?.({ message: error.message });
8399
+ } : void 0
8367
8400
  });
8368
8401
  (0, import_react12.useEffect)(() => {
8369
8402
  onExecutionsChange?.(depositExecutions);
@@ -14981,6 +15014,23 @@ function DepositModal({
14981
15014
  depositTrackerSubTitle = t7.depositTracker.subtitle
14982
15015
  }) {
14983
15016
  const { colors: colors2, fonts, components } = useTheme();
15017
+ const onDepositSuccessFor = (0, import_react20.useCallback)(
15018
+ (method) => onDepositSuccess || onEvent ? (data) => {
15019
+ const payload = { ...data, method };
15020
+ onDepositSuccess?.(payload);
15021
+ if (payload.execution) {
15022
+ onEvent?.({
15023
+ ...payload.execution,
15024
+ method
15025
+ });
15026
+ }
15027
+ } : void 0,
15028
+ [onDepositSuccess, onEvent]
15029
+ );
15030
+ const onDepositErrorFor = (0, import_react20.useCallback)(
15031
+ (method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
15032
+ [onDepositError]
15033
+ );
14984
15034
  const effectiveInitialScreen = (0, import_react20.useMemo)(() => {
14985
15035
  const s = initialScreen ?? "main";
14986
15036
  if (s === "tracker" && hideDepositTracker === true) return "main";
@@ -15665,8 +15715,8 @@ function DepositModal({
15665
15715
  defaultSourceSymbol,
15666
15716
  depositConfirmationMode,
15667
15717
  onExecutionsChange: setDepositExecutions,
15668
- onDepositSuccess,
15669
- onDepositError,
15718
+ onDepositSuccess: onDepositSuccessFor("transfer"),
15719
+ onDepositError: onDepositErrorFor("transfer"),
15670
15720
  wallets
15671
15721
  }
15672
15722
  ) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
@@ -15684,8 +15734,8 @@ function DepositModal({
15684
15734
  defaultSourceSymbol,
15685
15735
  depositConfirmationMode,
15686
15736
  onExecutionsChange: setDepositExecutions,
15687
- onDepositSuccess,
15688
- onDepositError,
15737
+ onDepositSuccess: onDepositSuccessFor("transfer"),
15738
+ onDepositError: onDepositErrorFor("transfer"),
15689
15739
  wallets
15690
15740
  }
15691
15741
  ),
@@ -15750,8 +15800,8 @@ function DepositModal({
15750
15800
  destinationChainType,
15751
15801
  destinationChainId,
15752
15802
  destinationTokenAddress,
15753
- onDepositSuccess,
15754
- onDepositError,
15803
+ onDepositSuccess: onDepositSuccessFor("card"),
15804
+ onDepositError: onDepositErrorFor("card"),
15755
15805
  onEvent,
15756
15806
  themeClass,
15757
15807
  wallets,
@@ -15786,8 +15836,8 @@ function DepositModal({
15786
15836
  destinationChainType,
15787
15837
  destinationChainId,
15788
15838
  destinationTokenAddress,
15789
- onDepositSuccess,
15790
- onDepositError,
15839
+ onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
15840
+ onDepositError: onDepositErrorFor("pay_with_exchange"),
15791
15841
  wallets,
15792
15842
  defaultToken: defaultToken ?? null
15793
15843
  }
@@ -15805,14 +15855,10 @@ function DepositModal({
15805
15855
  destinationTokenAddress: destinationTokenAddress ?? "",
15806
15856
  destinationChainId: destinationChainId ?? "",
15807
15857
  destinationChainType: destinationChainType ?? "",
15808
- onTransferSuccess: (result) => {
15809
- onDepositSuccess?.({
15810
- message: "Transfer completed via Coinbase Connect",
15811
- transaction: result
15812
- });
15813
- },
15858
+ onDepositSuccess: onDepositSuccessFor("exchange_connect"),
15859
+ onDepositError: onDepositErrorFor("exchange_connect"),
15814
15860
  onTransferError: (error) => {
15815
- onDepositError?.({
15861
+ onDepositErrorFor("exchange_connect")?.({
15816
15862
  message: error.message,
15817
15863
  error
15818
15864
  });
@@ -15841,20 +15887,14 @@ function DepositModal({
15841
15887
  publishableKey,
15842
15888
  assetCdnUrl: projectConfig?.asset_cdn_url,
15843
15889
  projectName: projectConfig?.project_name,
15844
- onSuccess: (txHash) => {
15845
- onDepositSuccess?.({
15846
- message: "Transaction sent successfully",
15847
- transaction: { txHash }
15848
- });
15849
- },
15850
15890
  onError: (error) => {
15851
- onDepositError?.({
15891
+ onDepositErrorFor("wallet_connect")?.({
15852
15892
  message: error.message,
15853
15893
  error
15854
15894
  });
15855
15895
  },
15856
- onDepositSuccess,
15857
- onDepositError,
15896
+ onDepositSuccess: onDepositSuccessFor("wallet_connect"),
15897
+ onDepositError: onDepositErrorFor("wallet_connect"),
15858
15898
  amountQuickSelect: browserWalletAmountQuickSelect,
15859
15899
  onWalletDisconnect: handleWalletDisconnect,
15860
15900
  onWalletConnected: (info, dw) => {
@@ -15898,8 +15938,8 @@ function DepositModal({
15898
15938
  onViewChange: setCashAppView,
15899
15939
  onAmountChange: setCashAppAmount,
15900
15940
  onEvent,
15901
- onDepositSuccess,
15902
- onDepositError
15941
+ onDepositSuccess: onDepositSuccessFor("cashapp"),
15942
+ onDepositError: onDepositErrorFor("cashapp")
15903
15943
  }
15904
15944
  ),
15905
15945
  depositPoweredByFooter
@@ -16774,6 +16814,31 @@ function useWithdrawPolling({
16774
16814
  onWithdrawSuccess,
16775
16815
  onWithdrawError
16776
16816
  }) {
16817
+ const createExecutionSuccessEvent = (execution) => ({
16818
+ id: (0, import_core37.generatePrefixedKSUID)("sevt"),
16819
+ type: import_core37.WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
16820
+ 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),
16821
+ data: { object: mapToDirectExecution(execution) }
16822
+ });
16823
+ const mapToDirectExecution = (execution) => ({
16824
+ id: execution.id,
16825
+ transactionHash: execution.transaction_hash,
16826
+ recipientAddress: execution.recipient_address,
16827
+ depositAddress: execution.deposit_wallet?.address,
16828
+ sourceChainType: execution.source_chain_type,
16829
+ sourceChainId: execution.source_chain_id,
16830
+ sourceTokenAddress: execution.source_token_address,
16831
+ destinationChainType: execution.destination_chain_type,
16832
+ destinationChainId: execution.destination_chain_id,
16833
+ destinationTokenAddress: execution.destination_token_address,
16834
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
16835
+ sourceAmountUsd: execution.source_amount_usd,
16836
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
16837
+ destinationAmountUsd: execution.destination_amount_usd,
16838
+ destinationTransactionHashes: execution.destination_transaction_hashes,
16839
+ status: execution.status,
16840
+ failureReason: execution.failure_reason
16841
+ });
16777
16842
  const [executions, setExecutions] = (0, import_react22.useState)([]);
16778
16843
  const [isPolling, setIsPolling] = (0, import_react22.useState)(false);
16779
16844
  const enabledAtRef = (0, import_react22.useRef)(/* @__PURE__ */ new Date());
@@ -16841,7 +16906,13 @@ function useWithdrawPolling({
16841
16906
  return [...list, ex];
16842
16907
  });
16843
16908
  if (ex.status === import_core37.ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
16844
- onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
16909
+ onSuccessRef.current?.({
16910
+ message: "Withdrawal completed successfully",
16911
+ executionId: ex.id,
16912
+ // Backward compatibility: keep transaction in API response shape.
16913
+ transaction: ex,
16914
+ execution: createExecutionSuccessEvent(ex)
16915
+ });
16845
16916
  } else if (ex.status === import_core37.ExecutionStatus.FAILED && prev !== import_core37.ExecutionStatus.FAILED) {
16846
16917
  onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
16847
16918
  }
@@ -18280,9 +18351,19 @@ function WithdrawModal({
18280
18351
  onWithdraw,
18281
18352
  onWithdrawSuccess,
18282
18353
  onWithdrawError,
18354
+ onEvent,
18283
18355
  theme = "dark",
18284
18356
  hideOverlay = false
18285
18357
  }) {
18358
+ const onWithdrawSuccessFor = (0, import_react26.useCallback)(
18359
+ (data) => {
18360
+ onWithdrawSuccess?.(data);
18361
+ if (data.execution) {
18362
+ onEvent?.(data.execution);
18363
+ }
18364
+ },
18365
+ [onWithdrawSuccess, onEvent]
18366
+ );
18286
18367
  const { colors: colors2, fonts, components } = useTheme();
18287
18368
  const [containerEl, setContainerEl] = (0, import_react26.useState)(null);
18288
18369
  const containerCallbackRef = (0, import_react26.useCallback)((el) => {
@@ -18344,7 +18425,7 @@ function WithdrawModal({
18344
18425
  publishableKey,
18345
18426
  depositWalletId: withdrawDepositWalletId,
18346
18427
  enabled: !!withdrawDepositWalletId && open,
18347
- onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
18428
+ onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
18348
18429
  onWithdrawError
18349
18430
  });
18350
18431
  const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
package/dist/index.mjs CHANGED
@@ -685,8 +685,8 @@ import {
685
685
  getIconUrlWithCdn,
686
686
  getPreferredIconUrl as getPreferredIconUrl2,
687
687
  getDefaultOnrampToken,
688
- generatePrefixedKSUID,
689
- DepositEventType
688
+ generatePrefixedKSUID as generatePrefixedKSUID2,
689
+ DepositEventType as DepositEventType2
690
690
  } from "@unifold/core";
691
691
 
692
692
  // src/hooks/use-deposit-address.ts
@@ -1624,7 +1624,9 @@ import {
1624
1624
  queryExecutions,
1625
1625
  listPaymentIntentExecutions,
1626
1626
  pollDirectExecutions,
1627
+ generatePrefixedKSUID,
1627
1628
  ExecutionStatus,
1629
+ DepositEventType,
1628
1630
  ActionType
1629
1631
  } from "@unifold/core";
1630
1632
  var DEPOSIT_CONFIRM_DELAY_MS = 5e3;
@@ -1643,6 +1645,31 @@ function useDepositPolling({
1643
1645
  onDepositSuccess,
1644
1646
  onDepositError
1645
1647
  }) {
1648
+ const createExecutionSuccessEvent = (execution) => ({
1649
+ id: generatePrefixedKSUID("sevt"),
1650
+ type: DepositEventType.DIRECT_EXECUTION_SUCCEEDED,
1651
+ 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),
1652
+ data: { object: mapToDirectExecution(execution) }
1653
+ });
1654
+ const mapToDirectExecution = (execution) => ({
1655
+ id: execution.id,
1656
+ transactionHash: execution.transaction_hash,
1657
+ recipientAddress: execution.recipient_address,
1658
+ depositAddress: execution.deposit_wallet?.address,
1659
+ sourceChainType: execution.source_chain_type,
1660
+ sourceChainId: execution.source_chain_id,
1661
+ sourceTokenAddress: execution.source_token_address,
1662
+ destinationChainType: execution.destination_chain_type,
1663
+ destinationChainId: execution.destination_chain_id,
1664
+ destinationTokenAddress: execution.destination_token_address,
1665
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
1666
+ sourceAmountUsd: execution.source_amount_usd,
1667
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
1668
+ destinationAmountUsd: execution.destination_amount_usd,
1669
+ destinationTransactionHashes: execution.destination_transaction_hashes,
1670
+ status: execution.status,
1671
+ failureReason: execution.failure_reason
1672
+ });
1646
1673
  const [executions, setExecutions] = useState5([]);
1647
1674
  const [isPolling, setIsPolling] = useState5(false);
1648
1675
  const [pollingEnabled, setPollingEnabled] = useState5(false);
@@ -1756,7 +1783,9 @@ function useDepositPolling({
1756
1783
  onDepositSuccessRef.current?.({
1757
1784
  message: "Deposit completed successfully",
1758
1785
  executionId: execution.id,
1759
- transaction: execution
1786
+ // Backward compatibility: keep transaction in API response shape.
1787
+ transaction: execution,
1788
+ execution: createExecutionSuccessEvent(execution)
1760
1789
  });
1761
1790
  } else if (execution.status === ExecutionStatus.FAILED && previousStatus !== ExecutionStatus.FAILED) {
1762
1791
  onDepositErrorRef.current?.({
@@ -3040,7 +3069,7 @@ function BuyWithCard({
3040
3069
  setQuotesError("Wallet address not available");
3041
3070
  return;
3042
3071
  }
3043
- const externalId = generatePrefixedKSUID("orsext");
3072
+ const externalId = generatePrefixedKSUID2("orsext");
3044
3073
  const sessionRequest = {
3045
3074
  service_provider: selectedProvider.service_provider,
3046
3075
  country_code: selectedProvider.country_code.toUpperCase() || "US",
@@ -3064,8 +3093,8 @@ function BuyWithCard({
3064
3093
  externalId
3065
3094
  });
3066
3095
  onEvent?.({
3067
- id: generatePrefixedKSUID("sevt"),
3068
- type: DepositEventType.ONRAMP_SESSION_CREATED,
3096
+ id: generatePrefixedKSUID2("sevt"),
3097
+ type: DepositEventType2.ONRAMP_SESSION_CREATED,
3069
3098
  created: Math.floor(Date.now() / 1e3),
3070
3099
  data: { object: { externalId } }
3071
3100
  });
@@ -3889,8 +3918,8 @@ import { Copy, Check as Check3, Clock, RefreshCw, Loader2 as Loader22 } from "lu
3889
3918
  import {
3890
3919
  createCashAppSession,
3891
3920
  getCashAppSessionStatus,
3892
- generatePrefixedKSUID as generatePrefixedKSUID2,
3893
- DepositEventType as DepositEventType2
3921
+ generatePrefixedKSUID as generatePrefixedKSUID3,
3922
+ DepositEventType as DepositEventType3
3894
3923
  } from "@unifold/core";
3895
3924
 
3896
3925
  // src/components/deposits/StyledQRCode.tsx
@@ -4140,7 +4169,7 @@ function PayWithCashApp({
4140
4169
  setLoading(true);
4141
4170
  setError(null);
4142
4171
  try {
4143
- const externalId = generatePrefixedKSUID2("ca");
4172
+ const externalId = generatePrefixedKSUID3("ca");
4144
4173
  const result = await createCashAppSession(
4145
4174
  {
4146
4175
  external_user_id: userId,
@@ -4160,7 +4189,7 @@ function PayWithCashApp({
4160
4189
  setStatus("pending");
4161
4190
  setView("payment");
4162
4191
  onEvent?.({
4163
- type: DepositEventType2.ONRAMP_SESSION_CREATED,
4192
+ type: DepositEventType3.ONRAMP_SESSION_CREATED,
4164
4193
  data: { object: { externalId: result.external_id } }
4165
4194
  });
4166
4195
  } catch (err) {
@@ -8166,6 +8195,8 @@ function CoinbaseConnect({
8166
8195
  destinationChainId,
8167
8196
  destinationChainType,
8168
8197
  onTransferSuccess,
8198
+ onDepositSuccess,
8199
+ onDepositError,
8169
8200
  onTransferError,
8170
8201
  onClose,
8171
8202
  onBack: parentOnBack,
@@ -8313,10 +8344,14 @@ function CoinbaseConnect({
8313
8344
  depositWalletId: transferDepositWalletId,
8314
8345
  enabled: view === "success" && !!transferDepositWalletId,
8315
8346
  immediateDirectPolling: true,
8316
- onDepositSuccess: onTransferSuccess ? () => {
8317
- if (confirmResult) onTransferSuccess(confirmResult);
8347
+ onDepositSuccess: onDepositSuccess || onTransferSuccess ? (data) => {
8348
+ onDepositSuccess?.(data);
8349
+ if (onTransferSuccess && confirmResult) onTransferSuccess(confirmResult);
8318
8350
  } : void 0,
8319
- onDepositError: onTransferError
8351
+ onDepositError: onDepositError || onTransferError ? (error) => {
8352
+ onDepositError?.(error);
8353
+ onTransferError?.({ message: error.message });
8354
+ } : void 0
8320
8355
  });
8321
8356
  useEffect17(() => {
8322
8357
  onExecutionsChange?.(depositExecutions);
@@ -14991,6 +15026,23 @@ function DepositModal({
14991
15026
  depositTrackerSubTitle = t7.depositTracker.subtitle
14992
15027
  }) {
14993
15028
  const { colors: colors2, fonts, components } = useTheme();
15029
+ const onDepositSuccessFor = useCallback5(
15030
+ (method) => onDepositSuccess || onEvent ? (data) => {
15031
+ const payload = { ...data, method };
15032
+ onDepositSuccess?.(payload);
15033
+ if (payload.execution) {
15034
+ onEvent?.({
15035
+ ...payload.execution,
15036
+ method
15037
+ });
15038
+ }
15039
+ } : void 0,
15040
+ [onDepositSuccess, onEvent]
15041
+ );
15042
+ const onDepositErrorFor = useCallback5(
15043
+ (method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
15044
+ [onDepositError]
15045
+ );
14994
15046
  const effectiveInitialScreen = useMemo10(() => {
14995
15047
  const s = initialScreen ?? "main";
14996
15048
  if (s === "tracker" && hideDepositTracker === true) return "main";
@@ -15675,8 +15727,8 @@ function DepositModal({
15675
15727
  defaultSourceSymbol,
15676
15728
  depositConfirmationMode,
15677
15729
  onExecutionsChange: setDepositExecutions,
15678
- onDepositSuccess,
15679
- onDepositError,
15730
+ onDepositSuccess: onDepositSuccessFor("transfer"),
15731
+ onDepositError: onDepositErrorFor("transfer"),
15680
15732
  wallets
15681
15733
  }
15682
15734
  ) : /* @__PURE__ */ jsx55(
@@ -15694,8 +15746,8 @@ function DepositModal({
15694
15746
  defaultSourceSymbol,
15695
15747
  depositConfirmationMode,
15696
15748
  onExecutionsChange: setDepositExecutions,
15697
- onDepositSuccess,
15698
- onDepositError,
15749
+ onDepositSuccess: onDepositSuccessFor("transfer"),
15750
+ onDepositError: onDepositErrorFor("transfer"),
15699
15751
  wallets
15700
15752
  }
15701
15753
  ),
@@ -15760,8 +15812,8 @@ function DepositModal({
15760
15812
  destinationChainType,
15761
15813
  destinationChainId,
15762
15814
  destinationTokenAddress,
15763
- onDepositSuccess,
15764
- onDepositError,
15815
+ onDepositSuccess: onDepositSuccessFor("card"),
15816
+ onDepositError: onDepositErrorFor("card"),
15765
15817
  onEvent,
15766
15818
  themeClass,
15767
15819
  wallets,
@@ -15796,8 +15848,8 @@ function DepositModal({
15796
15848
  destinationChainType,
15797
15849
  destinationChainId,
15798
15850
  destinationTokenAddress,
15799
- onDepositSuccess,
15800
- onDepositError,
15851
+ onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
15852
+ onDepositError: onDepositErrorFor("pay_with_exchange"),
15801
15853
  wallets,
15802
15854
  defaultToken: defaultToken ?? null
15803
15855
  }
@@ -15815,14 +15867,10 @@ function DepositModal({
15815
15867
  destinationTokenAddress: destinationTokenAddress ?? "",
15816
15868
  destinationChainId: destinationChainId ?? "",
15817
15869
  destinationChainType: destinationChainType ?? "",
15818
- onTransferSuccess: (result) => {
15819
- onDepositSuccess?.({
15820
- message: "Transfer completed via Coinbase Connect",
15821
- transaction: result
15822
- });
15823
- },
15870
+ onDepositSuccess: onDepositSuccessFor("exchange_connect"),
15871
+ onDepositError: onDepositErrorFor("exchange_connect"),
15824
15872
  onTransferError: (error) => {
15825
- onDepositError?.({
15873
+ onDepositErrorFor("exchange_connect")?.({
15826
15874
  message: error.message,
15827
15875
  error
15828
15876
  });
@@ -15851,20 +15899,14 @@ function DepositModal({
15851
15899
  publishableKey,
15852
15900
  assetCdnUrl: projectConfig?.asset_cdn_url,
15853
15901
  projectName: projectConfig?.project_name,
15854
- onSuccess: (txHash) => {
15855
- onDepositSuccess?.({
15856
- message: "Transaction sent successfully",
15857
- transaction: { txHash }
15858
- });
15859
- },
15860
15902
  onError: (error) => {
15861
- onDepositError?.({
15903
+ onDepositErrorFor("wallet_connect")?.({
15862
15904
  message: error.message,
15863
15905
  error
15864
15906
  });
15865
15907
  },
15866
- onDepositSuccess,
15867
- onDepositError,
15908
+ onDepositSuccess: onDepositSuccessFor("wallet_connect"),
15909
+ onDepositError: onDepositErrorFor("wallet_connect"),
15868
15910
  amountQuickSelect: browserWalletAmountQuickSelect,
15869
15911
  onWalletDisconnect: handleWalletDisconnect,
15870
15912
  onWalletConnected: (info, dw) => {
@@ -15908,8 +15950,8 @@ function DepositModal({
15908
15950
  onViewChange: setCashAppView,
15909
15951
  onAmountChange: setCashAppAmount,
15910
15952
  onEvent,
15911
- onDepositSuccess,
15912
- onDepositError
15953
+ onDepositSuccess: onDepositSuccessFor("cashapp"),
15954
+ onDepositError: onDepositErrorFor("cashapp")
15913
15955
  }
15914
15956
  ),
15915
15957
  depositPoweredByFooter
@@ -16790,7 +16832,9 @@ import { useState as useState34, useEffect as useEffect28, useRef as useRef11 }
16790
16832
  import {
16791
16833
  queryExecutions as queryExecutions5,
16792
16834
  pollDirectExecutions as pollDirectExecutions2,
16835
+ generatePrefixedKSUID as generatePrefixedKSUID4,
16793
16836
  ExecutionStatus as ExecutionStatus6,
16837
+ WithdrawEventType,
16794
16838
  ActionType as ActionType5
16795
16839
  } from "@unifold/core";
16796
16840
  var POLL_INTERVAL_MS3 = 2500;
@@ -16804,6 +16848,31 @@ function useWithdrawPolling({
16804
16848
  onWithdrawSuccess,
16805
16849
  onWithdrawError
16806
16850
  }) {
16851
+ const createExecutionSuccessEvent = (execution) => ({
16852
+ id: generatePrefixedKSUID4("sevt"),
16853
+ type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
16854
+ 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),
16855
+ data: { object: mapToDirectExecution(execution) }
16856
+ });
16857
+ const mapToDirectExecution = (execution) => ({
16858
+ id: execution.id,
16859
+ transactionHash: execution.transaction_hash,
16860
+ recipientAddress: execution.recipient_address,
16861
+ depositAddress: execution.deposit_wallet?.address,
16862
+ sourceChainType: execution.source_chain_type,
16863
+ sourceChainId: execution.source_chain_id,
16864
+ sourceTokenAddress: execution.source_token_address,
16865
+ destinationChainType: execution.destination_chain_type,
16866
+ destinationChainId: execution.destination_chain_id,
16867
+ destinationTokenAddress: execution.destination_token_address,
16868
+ sourceAmountBaseUnit: execution.source_amount_base_unit,
16869
+ sourceAmountUsd: execution.source_amount_usd,
16870
+ destinationAmountBaseUnit: execution.destination_amount_base_unit,
16871
+ destinationAmountUsd: execution.destination_amount_usd,
16872
+ destinationTransactionHashes: execution.destination_transaction_hashes,
16873
+ status: execution.status,
16874
+ failureReason: execution.failure_reason
16875
+ });
16807
16876
  const [executions, setExecutions] = useState34([]);
16808
16877
  const [isPolling, setIsPolling] = useState34(false);
16809
16878
  const enabledAtRef = useRef11(/* @__PURE__ */ new Date());
@@ -16871,7 +16940,13 @@ function useWithdrawPolling({
16871
16940
  return [...list, ex];
16872
16941
  });
16873
16942
  if (ex.status === ExecutionStatus6.SUCCEEDED && (!prev || inProgress.includes(prev))) {
16874
- onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
16943
+ onSuccessRef.current?.({
16944
+ message: "Withdrawal completed successfully",
16945
+ executionId: ex.id,
16946
+ // Backward compatibility: keep transaction in API response shape.
16947
+ transaction: ex,
16948
+ execution: createExecutionSuccessEvent(ex)
16949
+ });
16875
16950
  } else if (ex.status === ExecutionStatus6.FAILED && prev !== ExecutionStatus6.FAILED) {
16876
16951
  onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
16877
16952
  }
@@ -18335,9 +18410,19 @@ function WithdrawModal({
18335
18410
  onWithdraw,
18336
18411
  onWithdrawSuccess,
18337
18412
  onWithdrawError,
18413
+ onEvent,
18338
18414
  theme = "dark",
18339
18415
  hideOverlay = false
18340
18416
  }) {
18417
+ const onWithdrawSuccessFor = useCallback8(
18418
+ (data) => {
18419
+ onWithdrawSuccess?.(data);
18420
+ if (data.execution) {
18421
+ onEvent?.(data.execution);
18422
+ }
18423
+ },
18424
+ [onWithdrawSuccess, onEvent]
18425
+ );
18341
18426
  const { colors: colors2, fonts, components } = useTheme();
18342
18427
  const [containerEl, setContainerEl] = useState37(null);
18343
18428
  const containerCallbackRef = useCallback8((el) => {
@@ -18399,7 +18484,7 @@ function WithdrawModal({
18399
18484
  publishableKey,
18400
18485
  depositWalletId: withdrawDepositWalletId,
18401
18486
  enabled: !!withdrawDepositWalletId && open,
18402
- onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
18487
+ onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
18403
18488
  onWithdrawError
18404
18489
  });
18405
18490
  const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/ui-react",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
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",
@@ -36,7 +36,7 @@
36
36
  "mipd": "^0.0.7",
37
37
  "qr-code-styling": "^1.6.0-rc.1",
38
38
  "tailwind-merge": "^2.0.0",
39
- "@unifold/core": "0.1.66"
39
+ "@unifold/core": "0.1.67"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@solana/web3.js": "^1.87.0",