@unifold/ui-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 +40 -16
- package/dist/index.d.ts +40 -16
- package/dist/index.js +135 -41
- package/dist/index.mjs +151 -53
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
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:
|
|
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:
|
|
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:
|
|
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?:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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?:
|
|
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:
|
|
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:
|
|
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:
|
|
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 {
|
|
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:
|
|
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:
|
|
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:
|
|
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?:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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?:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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);
|
|
@@ -14714,7 +14747,10 @@ function WalletConnect({
|
|
|
14714
14747
|
children: [
|
|
14715
14748
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
14716
14749
|
WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
|
|
14717
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.
|
|
14750
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
14751
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name }),
|
|
14752
|
+
wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime54.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" })
|
|
14753
|
+
] })
|
|
14718
14754
|
] }),
|
|
14719
14755
|
isPending ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react28.Loader2, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
14720
14756
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
|
|
@@ -14978,6 +15014,23 @@ function DepositModal({
|
|
|
14978
15014
|
depositTrackerSubTitle = t7.depositTracker.subtitle
|
|
14979
15015
|
}) {
|
|
14980
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
|
+
);
|
|
14981
15034
|
const effectiveInitialScreen = (0, import_react20.useMemo)(() => {
|
|
14982
15035
|
const s = initialScreen ?? "main";
|
|
14983
15036
|
if (s === "tracker" && hideDepositTracker === true) return "main";
|
|
@@ -15518,8 +15571,8 @@ function DepositModal({
|
|
|
15518
15571
|
cashAppMenuButton
|
|
15519
15572
|
].filter(Boolean);
|
|
15520
15573
|
const depositTabs = [
|
|
15521
|
-
{ id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
|
|
15522
|
-
{ id: "cash", label: "Use Cash", buttons: cashMenuButtons }
|
|
15574
|
+
{ id: "crypto", label: "Use Crypto", icon: import_lucide_react29.Bitcoin, buttons: cryptoMenuButtons },
|
|
15575
|
+
{ id: "cash", label: "Use Cash", icon: import_lucide_react29.DollarSign, buttons: cashMenuButtons }
|
|
15523
15576
|
].filter((tab) => tab.buttons.length > 0);
|
|
15524
15577
|
const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
|
|
15525
15578
|
const renderMainMenuBody = () => {
|
|
@@ -15542,18 +15595,16 @@ function DepositModal({
|
|
|
15542
15595
|
role: "tablist",
|
|
15543
15596
|
children: depositTabs.map((tab) => {
|
|
15544
15597
|
const active = activeDepositTab.id === tab.id;
|
|
15545
|
-
|
|
15598
|
+
const TabIcon = tab.icon;
|
|
15599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
15546
15600
|
"button",
|
|
15547
15601
|
{
|
|
15548
15602
|
type: "button",
|
|
15549
15603
|
role: "tab",
|
|
15550
15604
|
"aria-selected": active,
|
|
15551
15605
|
onClick: () => setDepositTab(tab.id),
|
|
15552
|
-
className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
|
|
15606
|
+
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",
|
|
15553
15607
|
style: {
|
|
15554
|
-
// Active tab is a soft, blurred glass pill — a faint accent
|
|
15555
|
-
// tint with its own backdrop blur and a subtle border/shadow,
|
|
15556
|
-
// so it looks frosted instead of like a hard solid button.
|
|
15557
15608
|
backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
|
|
15558
15609
|
backdropFilter: active ? "blur(8px)" : void 0,
|
|
15559
15610
|
WebkitBackdropFilter: active ? "blur(8px)" : void 0,
|
|
@@ -15561,7 +15612,19 @@ function DepositModal({
|
|
|
15561
15612
|
color: active ? colors2.foreground : colors2.foregroundMuted,
|
|
15562
15613
|
fontFamily: fonts.medium
|
|
15563
15614
|
},
|
|
15564
|
-
children:
|
|
15615
|
+
children: [
|
|
15616
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15617
|
+
"span",
|
|
15618
|
+
{
|
|
15619
|
+
className: "uf-inline-flex uf-items-center uf-justify-center uf-rounded-full uf-w-5 uf-h-5 uf-flex-shrink-0",
|
|
15620
|
+
style: {
|
|
15621
|
+
backgroundColor: active ? colors2.foreground : colors2.foregroundMuted
|
|
15622
|
+
},
|
|
15623
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TabIcon, { size: 12, style: { color: active ? colors2.background : colors2.background }, strokeWidth: 2.5 })
|
|
15624
|
+
}
|
|
15625
|
+
),
|
|
15626
|
+
tab.label
|
|
15627
|
+
]
|
|
15565
15628
|
},
|
|
15566
15629
|
tab.id
|
|
15567
15630
|
);
|
|
@@ -15652,8 +15715,8 @@ function DepositModal({
|
|
|
15652
15715
|
defaultSourceSymbol,
|
|
15653
15716
|
depositConfirmationMode,
|
|
15654
15717
|
onExecutionsChange: setDepositExecutions,
|
|
15655
|
-
onDepositSuccess,
|
|
15656
|
-
onDepositError,
|
|
15718
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
15719
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
15657
15720
|
wallets
|
|
15658
15721
|
}
|
|
15659
15722
|
) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -15671,8 +15734,8 @@ function DepositModal({
|
|
|
15671
15734
|
defaultSourceSymbol,
|
|
15672
15735
|
depositConfirmationMode,
|
|
15673
15736
|
onExecutionsChange: setDepositExecutions,
|
|
15674
|
-
onDepositSuccess,
|
|
15675
|
-
onDepositError,
|
|
15737
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
15738
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
15676
15739
|
wallets
|
|
15677
15740
|
}
|
|
15678
15741
|
),
|
|
@@ -15737,8 +15800,8 @@ function DepositModal({
|
|
|
15737
15800
|
destinationChainType,
|
|
15738
15801
|
destinationChainId,
|
|
15739
15802
|
destinationTokenAddress,
|
|
15740
|
-
onDepositSuccess,
|
|
15741
|
-
onDepositError,
|
|
15803
|
+
onDepositSuccess: onDepositSuccessFor("card"),
|
|
15804
|
+
onDepositError: onDepositErrorFor("card"),
|
|
15742
15805
|
onEvent,
|
|
15743
15806
|
themeClass,
|
|
15744
15807
|
wallets,
|
|
@@ -15773,8 +15836,8 @@ function DepositModal({
|
|
|
15773
15836
|
destinationChainType,
|
|
15774
15837
|
destinationChainId,
|
|
15775
15838
|
destinationTokenAddress,
|
|
15776
|
-
onDepositSuccess,
|
|
15777
|
-
onDepositError,
|
|
15839
|
+
onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
|
|
15840
|
+
onDepositError: onDepositErrorFor("pay_with_exchange"),
|
|
15778
15841
|
wallets,
|
|
15779
15842
|
defaultToken: defaultToken ?? null
|
|
15780
15843
|
}
|
|
@@ -15792,14 +15855,10 @@ function DepositModal({
|
|
|
15792
15855
|
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
15793
15856
|
destinationChainId: destinationChainId ?? "",
|
|
15794
15857
|
destinationChainType: destinationChainType ?? "",
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
message: "Transfer completed via Coinbase Connect",
|
|
15798
|
-
transaction: result
|
|
15799
|
-
});
|
|
15800
|
-
},
|
|
15858
|
+
onDepositSuccess: onDepositSuccessFor("exchange_connect"),
|
|
15859
|
+
onDepositError: onDepositErrorFor("exchange_connect"),
|
|
15801
15860
|
onTransferError: (error) => {
|
|
15802
|
-
|
|
15861
|
+
onDepositErrorFor("exchange_connect")?.({
|
|
15803
15862
|
message: error.message,
|
|
15804
15863
|
error
|
|
15805
15864
|
});
|
|
@@ -15828,20 +15887,14 @@ function DepositModal({
|
|
|
15828
15887
|
publishableKey,
|
|
15829
15888
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
15830
15889
|
projectName: projectConfig?.project_name,
|
|
15831
|
-
onSuccess: (txHash) => {
|
|
15832
|
-
onDepositSuccess?.({
|
|
15833
|
-
message: "Transaction sent successfully",
|
|
15834
|
-
transaction: { txHash }
|
|
15835
|
-
});
|
|
15836
|
-
},
|
|
15837
15890
|
onError: (error) => {
|
|
15838
|
-
|
|
15891
|
+
onDepositErrorFor("wallet_connect")?.({
|
|
15839
15892
|
message: error.message,
|
|
15840
15893
|
error
|
|
15841
15894
|
});
|
|
15842
15895
|
},
|
|
15843
|
-
onDepositSuccess,
|
|
15844
|
-
onDepositError,
|
|
15896
|
+
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
15897
|
+
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
15845
15898
|
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
15846
15899
|
onWalletDisconnect: handleWalletDisconnect,
|
|
15847
15900
|
onWalletConnected: (info, dw) => {
|
|
@@ -15885,8 +15938,8 @@ function DepositModal({
|
|
|
15885
15938
|
onViewChange: setCashAppView,
|
|
15886
15939
|
onAmountChange: setCashAppAmount,
|
|
15887
15940
|
onEvent,
|
|
15888
|
-
onDepositSuccess,
|
|
15889
|
-
onDepositError
|
|
15941
|
+
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
15942
|
+
onDepositError: onDepositErrorFor("cashapp")
|
|
15890
15943
|
}
|
|
15891
15944
|
),
|
|
15892
15945
|
depositPoweredByFooter
|
|
@@ -16761,6 +16814,31 @@ function useWithdrawPolling({
|
|
|
16761
16814
|
onWithdrawSuccess,
|
|
16762
16815
|
onWithdrawError
|
|
16763
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
|
+
});
|
|
16764
16842
|
const [executions, setExecutions] = (0, import_react22.useState)([]);
|
|
16765
16843
|
const [isPolling, setIsPolling] = (0, import_react22.useState)(false);
|
|
16766
16844
|
const enabledAtRef = (0, import_react22.useRef)(/* @__PURE__ */ new Date());
|
|
@@ -16828,7 +16906,13 @@ function useWithdrawPolling({
|
|
|
16828
16906
|
return [...list, ex];
|
|
16829
16907
|
});
|
|
16830
16908
|
if (ex.status === import_core37.ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
16831
|
-
onSuccessRef.current?.({
|
|
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
|
+
});
|
|
16832
16916
|
} else if (ex.status === import_core37.ExecutionStatus.FAILED && prev !== import_core37.ExecutionStatus.FAILED) {
|
|
16833
16917
|
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
16834
16918
|
}
|
|
@@ -18267,9 +18351,19 @@ function WithdrawModal({
|
|
|
18267
18351
|
onWithdraw,
|
|
18268
18352
|
onWithdrawSuccess,
|
|
18269
18353
|
onWithdrawError,
|
|
18354
|
+
onEvent,
|
|
18270
18355
|
theme = "dark",
|
|
18271
18356
|
hideOverlay = false
|
|
18272
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
|
+
);
|
|
18273
18367
|
const { colors: colors2, fonts, components } = useTheme();
|
|
18274
18368
|
const [containerEl, setContainerEl] = (0, import_react26.useState)(null);
|
|
18275
18369
|
const containerCallbackRef = (0, import_react26.useCallback)((el) => {
|
|
@@ -18331,7 +18425,7 @@ function WithdrawModal({
|
|
|
18331
18425
|
publishableKey,
|
|
18332
18426
|
depositWalletId: withdrawDepositWalletId,
|
|
18333
18427
|
enabled: !!withdrawDepositWalletId && open,
|
|
18334
|
-
onWithdrawSuccess: onWithdrawSuccess
|
|
18428
|
+
onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
|
|
18335
18429
|
onWithdrawError
|
|
18336
18430
|
});
|
|
18337
18431
|
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
useRef as useRef9,
|
|
8
8
|
useMemo as useMemo10
|
|
9
9
|
} from "react";
|
|
10
|
-
import { ChevronRight as ChevronRight14, MapPinOff, AlertTriangle as AlertTriangle2 } from "lucide-react";
|
|
10
|
+
import { ChevronRight as ChevronRight14, MapPinOff, AlertTriangle as AlertTriangle2, Bitcoin, DollarSign as DollarSign3 } from "lucide-react";
|
|
11
11
|
|
|
12
12
|
// src/components/shared/dialog.tsx
|
|
13
13
|
import * as React3 from "react";
|
|
@@ -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
|
-
|
|
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 =
|
|
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:
|
|
3068
|
-
type:
|
|
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
|
|
3893
|
-
DepositEventType as
|
|
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 =
|
|
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:
|
|
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
|
-
|
|
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);
|
|
@@ -14724,7 +14759,10 @@ function WalletConnect({
|
|
|
14724
14759
|
children: [
|
|
14725
14760
|
/* @__PURE__ */ jsxs48("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
14726
14761
|
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" }),
|
|
14727
|
-
/* @__PURE__ */
|
|
14762
|
+
/* @__PURE__ */ jsxs48("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
14763
|
+
/* @__PURE__ */ jsx54("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name }),
|
|
14764
|
+
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" })
|
|
14765
|
+
] })
|
|
14728
14766
|
] }),
|
|
14729
14767
|
isPending ? /* @__PURE__ */ jsx54(Loader28, { 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: [
|
|
14730
14768
|
/* @__PURE__ */ jsx54("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
|
|
@@ -14988,6 +15026,23 @@ function DepositModal({
|
|
|
14988
15026
|
depositTrackerSubTitle = t7.depositTracker.subtitle
|
|
14989
15027
|
}) {
|
|
14990
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
|
+
);
|
|
14991
15046
|
const effectiveInitialScreen = useMemo10(() => {
|
|
14992
15047
|
const s = initialScreen ?? "main";
|
|
14993
15048
|
if (s === "tracker" && hideDepositTracker === true) return "main";
|
|
@@ -15528,8 +15583,8 @@ function DepositModal({
|
|
|
15528
15583
|
cashAppMenuButton
|
|
15529
15584
|
].filter(Boolean);
|
|
15530
15585
|
const depositTabs = [
|
|
15531
|
-
{ id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
|
|
15532
|
-
{ id: "cash", label: "Use Cash", buttons: cashMenuButtons }
|
|
15586
|
+
{ id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
|
|
15587
|
+
{ id: "cash", label: "Use Cash", icon: DollarSign3, buttons: cashMenuButtons }
|
|
15533
15588
|
].filter((tab) => tab.buttons.length > 0);
|
|
15534
15589
|
const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
|
|
15535
15590
|
const renderMainMenuBody = () => {
|
|
@@ -15552,18 +15607,16 @@ function DepositModal({
|
|
|
15552
15607
|
role: "tablist",
|
|
15553
15608
|
children: depositTabs.map((tab) => {
|
|
15554
15609
|
const active = activeDepositTab.id === tab.id;
|
|
15555
|
-
|
|
15610
|
+
const TabIcon = tab.icon;
|
|
15611
|
+
return /* @__PURE__ */ jsxs49(
|
|
15556
15612
|
"button",
|
|
15557
15613
|
{
|
|
15558
15614
|
type: "button",
|
|
15559
15615
|
role: "tab",
|
|
15560
15616
|
"aria-selected": active,
|
|
15561
15617
|
onClick: () => setDepositTab(tab.id),
|
|
15562
|
-
className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
|
|
15618
|
+
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",
|
|
15563
15619
|
style: {
|
|
15564
|
-
// Active tab is a soft, blurred glass pill — a faint accent
|
|
15565
|
-
// tint with its own backdrop blur and a subtle border/shadow,
|
|
15566
|
-
// so it looks frosted instead of like a hard solid button.
|
|
15567
15620
|
backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
|
|
15568
15621
|
backdropFilter: active ? "blur(8px)" : void 0,
|
|
15569
15622
|
WebkitBackdropFilter: active ? "blur(8px)" : void 0,
|
|
@@ -15571,7 +15624,19 @@ function DepositModal({
|
|
|
15571
15624
|
color: active ? colors2.foreground : colors2.foregroundMuted,
|
|
15572
15625
|
fontFamily: fonts.medium
|
|
15573
15626
|
},
|
|
15574
|
-
children:
|
|
15627
|
+
children: [
|
|
15628
|
+
/* @__PURE__ */ jsx55(
|
|
15629
|
+
"span",
|
|
15630
|
+
{
|
|
15631
|
+
className: "uf-inline-flex uf-items-center uf-justify-center uf-rounded-full uf-w-5 uf-h-5 uf-flex-shrink-0",
|
|
15632
|
+
style: {
|
|
15633
|
+
backgroundColor: active ? colors2.foreground : colors2.foregroundMuted
|
|
15634
|
+
},
|
|
15635
|
+
children: /* @__PURE__ */ jsx55(TabIcon, { size: 12, style: { color: active ? colors2.background : colors2.background }, strokeWidth: 2.5 })
|
|
15636
|
+
}
|
|
15637
|
+
),
|
|
15638
|
+
tab.label
|
|
15639
|
+
]
|
|
15575
15640
|
},
|
|
15576
15641
|
tab.id
|
|
15577
15642
|
);
|
|
@@ -15662,8 +15727,8 @@ function DepositModal({
|
|
|
15662
15727
|
defaultSourceSymbol,
|
|
15663
15728
|
depositConfirmationMode,
|
|
15664
15729
|
onExecutionsChange: setDepositExecutions,
|
|
15665
|
-
onDepositSuccess,
|
|
15666
|
-
onDepositError,
|
|
15730
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
15731
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
15667
15732
|
wallets
|
|
15668
15733
|
}
|
|
15669
15734
|
) : /* @__PURE__ */ jsx55(
|
|
@@ -15681,8 +15746,8 @@ function DepositModal({
|
|
|
15681
15746
|
defaultSourceSymbol,
|
|
15682
15747
|
depositConfirmationMode,
|
|
15683
15748
|
onExecutionsChange: setDepositExecutions,
|
|
15684
|
-
onDepositSuccess,
|
|
15685
|
-
onDepositError,
|
|
15749
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
15750
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
15686
15751
|
wallets
|
|
15687
15752
|
}
|
|
15688
15753
|
),
|
|
@@ -15747,8 +15812,8 @@ function DepositModal({
|
|
|
15747
15812
|
destinationChainType,
|
|
15748
15813
|
destinationChainId,
|
|
15749
15814
|
destinationTokenAddress,
|
|
15750
|
-
onDepositSuccess,
|
|
15751
|
-
onDepositError,
|
|
15815
|
+
onDepositSuccess: onDepositSuccessFor("card"),
|
|
15816
|
+
onDepositError: onDepositErrorFor("card"),
|
|
15752
15817
|
onEvent,
|
|
15753
15818
|
themeClass,
|
|
15754
15819
|
wallets,
|
|
@@ -15783,8 +15848,8 @@ function DepositModal({
|
|
|
15783
15848
|
destinationChainType,
|
|
15784
15849
|
destinationChainId,
|
|
15785
15850
|
destinationTokenAddress,
|
|
15786
|
-
onDepositSuccess,
|
|
15787
|
-
onDepositError,
|
|
15851
|
+
onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
|
|
15852
|
+
onDepositError: onDepositErrorFor("pay_with_exchange"),
|
|
15788
15853
|
wallets,
|
|
15789
15854
|
defaultToken: defaultToken ?? null
|
|
15790
15855
|
}
|
|
@@ -15802,14 +15867,10 @@ function DepositModal({
|
|
|
15802
15867
|
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
15803
15868
|
destinationChainId: destinationChainId ?? "",
|
|
15804
15869
|
destinationChainType: destinationChainType ?? "",
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
message: "Transfer completed via Coinbase Connect",
|
|
15808
|
-
transaction: result
|
|
15809
|
-
});
|
|
15810
|
-
},
|
|
15870
|
+
onDepositSuccess: onDepositSuccessFor("exchange_connect"),
|
|
15871
|
+
onDepositError: onDepositErrorFor("exchange_connect"),
|
|
15811
15872
|
onTransferError: (error) => {
|
|
15812
|
-
|
|
15873
|
+
onDepositErrorFor("exchange_connect")?.({
|
|
15813
15874
|
message: error.message,
|
|
15814
15875
|
error
|
|
15815
15876
|
});
|
|
@@ -15838,20 +15899,14 @@ function DepositModal({
|
|
|
15838
15899
|
publishableKey,
|
|
15839
15900
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
15840
15901
|
projectName: projectConfig?.project_name,
|
|
15841
|
-
onSuccess: (txHash) => {
|
|
15842
|
-
onDepositSuccess?.({
|
|
15843
|
-
message: "Transaction sent successfully",
|
|
15844
|
-
transaction: { txHash }
|
|
15845
|
-
});
|
|
15846
|
-
},
|
|
15847
15902
|
onError: (error) => {
|
|
15848
|
-
|
|
15903
|
+
onDepositErrorFor("wallet_connect")?.({
|
|
15849
15904
|
message: error.message,
|
|
15850
15905
|
error
|
|
15851
15906
|
});
|
|
15852
15907
|
},
|
|
15853
|
-
onDepositSuccess,
|
|
15854
|
-
onDepositError,
|
|
15908
|
+
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
15909
|
+
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
15855
15910
|
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
15856
15911
|
onWalletDisconnect: handleWalletDisconnect,
|
|
15857
15912
|
onWalletConnected: (info, dw) => {
|
|
@@ -15895,8 +15950,8 @@ function DepositModal({
|
|
|
15895
15950
|
onViewChange: setCashAppView,
|
|
15896
15951
|
onAmountChange: setCashAppAmount,
|
|
15897
15952
|
onEvent,
|
|
15898
|
-
onDepositSuccess,
|
|
15899
|
-
onDepositError
|
|
15953
|
+
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
15954
|
+
onDepositError: onDepositErrorFor("cashapp")
|
|
15900
15955
|
}
|
|
15901
15956
|
),
|
|
15902
15957
|
depositPoweredByFooter
|
|
@@ -16777,7 +16832,9 @@ import { useState as useState34, useEffect as useEffect28, useRef as useRef11 }
|
|
|
16777
16832
|
import {
|
|
16778
16833
|
queryExecutions as queryExecutions5,
|
|
16779
16834
|
pollDirectExecutions as pollDirectExecutions2,
|
|
16835
|
+
generatePrefixedKSUID as generatePrefixedKSUID4,
|
|
16780
16836
|
ExecutionStatus as ExecutionStatus6,
|
|
16837
|
+
WithdrawEventType,
|
|
16781
16838
|
ActionType as ActionType5
|
|
16782
16839
|
} from "@unifold/core";
|
|
16783
16840
|
var POLL_INTERVAL_MS3 = 2500;
|
|
@@ -16791,6 +16848,31 @@ function useWithdrawPolling({
|
|
|
16791
16848
|
onWithdrawSuccess,
|
|
16792
16849
|
onWithdrawError
|
|
16793
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
|
+
});
|
|
16794
16876
|
const [executions, setExecutions] = useState34([]);
|
|
16795
16877
|
const [isPolling, setIsPolling] = useState34(false);
|
|
16796
16878
|
const enabledAtRef = useRef11(/* @__PURE__ */ new Date());
|
|
@@ -16858,7 +16940,13 @@ function useWithdrawPolling({
|
|
|
16858
16940
|
return [...list, ex];
|
|
16859
16941
|
});
|
|
16860
16942
|
if (ex.status === ExecutionStatus6.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
16861
|
-
onSuccessRef.current?.({
|
|
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
|
+
});
|
|
16862
16950
|
} else if (ex.status === ExecutionStatus6.FAILED && prev !== ExecutionStatus6.FAILED) {
|
|
16863
16951
|
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
16864
16952
|
}
|
|
@@ -17055,7 +17143,7 @@ import {
|
|
|
17055
17143
|
ChevronUp as ChevronUp7,
|
|
17056
17144
|
Clock as Clock5,
|
|
17057
17145
|
ClipboardPaste,
|
|
17058
|
-
DollarSign as
|
|
17146
|
+
DollarSign as DollarSign4,
|
|
17059
17147
|
Loader2 as Loader29,
|
|
17060
17148
|
ShieldCheck as ShieldCheck3,
|
|
17061
17149
|
Wallet as Wallet3
|
|
@@ -17928,7 +18016,7 @@ function WithdrawForm({
|
|
|
17928
18016
|
] })
|
|
17929
18017
|
] }),
|
|
17930
18018
|
/* @__PURE__ */ jsxs52("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
17931
|
-
/* @__PURE__ */ jsx58("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ jsx58(
|
|
18019
|
+
/* @__PURE__ */ jsx58("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ jsx58(DollarSign4, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
|
|
17932
18020
|
/* @__PURE__ */ jsxs52("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
17933
18021
|
tCrypto.priceImpact.label,
|
|
17934
18022
|
":",
|
|
@@ -18322,9 +18410,19 @@ function WithdrawModal({
|
|
|
18322
18410
|
onWithdraw,
|
|
18323
18411
|
onWithdrawSuccess,
|
|
18324
18412
|
onWithdrawError,
|
|
18413
|
+
onEvent,
|
|
18325
18414
|
theme = "dark",
|
|
18326
18415
|
hideOverlay = false
|
|
18327
18416
|
}) {
|
|
18417
|
+
const onWithdrawSuccessFor = useCallback8(
|
|
18418
|
+
(data) => {
|
|
18419
|
+
onWithdrawSuccess?.(data);
|
|
18420
|
+
if (data.execution) {
|
|
18421
|
+
onEvent?.(data.execution);
|
|
18422
|
+
}
|
|
18423
|
+
},
|
|
18424
|
+
[onWithdrawSuccess, onEvent]
|
|
18425
|
+
);
|
|
18328
18426
|
const { colors: colors2, fonts, components } = useTheme();
|
|
18329
18427
|
const [containerEl, setContainerEl] = useState37(null);
|
|
18330
18428
|
const containerCallbackRef = useCallback8((el) => {
|
|
@@ -18386,7 +18484,7 @@ function WithdrawModal({
|
|
|
18386
18484
|
publishableKey,
|
|
18387
18485
|
depositWalletId: withdrawDepositWalletId,
|
|
18388
18486
|
enabled: !!withdrawDepositWalletId && open,
|
|
18389
|
-
onWithdrawSuccess: onWithdrawSuccess
|
|
18487
|
+
onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
|
|
18390
18488
|
onWithdrawError
|
|
18391
18489
|
});
|
|
18392
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.
|
|
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.
|
|
39
|
+
"@unifold/core": "0.1.67"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@solana/web3.js": "^1.87.0",
|