@unifold/ui-react 0.1.42 → 0.1.44
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 +133 -39
- package/dist/index.d.ts +133 -39
- package/dist/index.js +1530 -471
- package/dist/index.mjs +1529 -462
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { AutoSwapResponse, ChainType, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, SupportedDestinationTokensResponse, VerifyAddressResponse } from '@unifold/core';
|
|
2
|
+
import { AutoSwapResponse, ChainType, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, VerifyAddressResponse } from '@unifold/core';
|
|
3
3
|
export { ChainType } from '@unifold/core';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
@@ -14,6 +14,11 @@ type DepositConfirmationMode = "auto_ui" | "auto_silent" | "manual";
|
|
|
14
14
|
interface UseDepositPollingOptions {
|
|
15
15
|
userId: string | undefined;
|
|
16
16
|
publishableKey: string;
|
|
17
|
+
/**
|
|
18
|
+
* When provided, polls executions via the payment-intent-scoped endpoint
|
|
19
|
+
* instead of the user-scoped queryExecutions endpoint.
|
|
20
|
+
*/
|
|
21
|
+
clientSecret?: string;
|
|
17
22
|
/** Controls when polling starts and whether a waiting UI is shown.
|
|
18
23
|
* - "auto_ui": After 10s, starts polling and shows "Processing..." card (default)
|
|
19
24
|
* - "auto_silent": After 10s, starts polling silently (no waiting UI)
|
|
@@ -50,7 +55,7 @@ interface UseDepositPollingResult {
|
|
|
50
55
|
/** Call this when user clicks "I've made the deposit" (manual mode) */
|
|
51
56
|
handleIveDeposited: () => void;
|
|
52
57
|
}
|
|
53
|
-
declare function useDepositPolling({ userId, publishableKey, depositConfirmationMode, depositWalletId, enabled, immediateDirectPolling, onDepositSuccess, onDepositError, }: UseDepositPollingOptions): UseDepositPollingResult;
|
|
58
|
+
declare function useDepositPolling({ userId, publishableKey, clientSecret, depositConfirmationMode, depositWalletId, enabled, immediateDirectPolling, onDepositSuccess, onDepositError, }: UseDepositPollingOptions): UseDepositPollingResult;
|
|
54
59
|
|
|
55
60
|
declare global {
|
|
56
61
|
interface Window {
|
|
@@ -224,6 +229,8 @@ declare function DepositHeader({ title, subtitle, showBack, showClose, onBack, o
|
|
|
224
229
|
interface TransferCryptoSingleInputProps {
|
|
225
230
|
userId: string;
|
|
226
231
|
publishableKey: string;
|
|
232
|
+
/** When provided, polls executions via the payment-intent-scoped endpoint instead of user-scoped. */
|
|
233
|
+
clientSecret?: string;
|
|
227
234
|
recipientAddress?: string;
|
|
228
235
|
destinationChainType?: ChainType;
|
|
229
236
|
destinationChainId?: string;
|
|
@@ -250,8 +257,23 @@ interface TransferCryptoSingleInputProps {
|
|
|
250
257
|
code?: string;
|
|
251
258
|
}) => void;
|
|
252
259
|
wallets?: Wallet[];
|
|
260
|
+
/** Called when the user changes the selected source token/chain. */
|
|
261
|
+
onSourceTokenChange?: (info: {
|
|
262
|
+
symbol: string;
|
|
263
|
+
chainType: string;
|
|
264
|
+
chainId: string;
|
|
265
|
+
tokenAddress: string;
|
|
266
|
+
minimumDepositAmountUsd: number;
|
|
267
|
+
}) => void;
|
|
268
|
+
/** Checkout mode: estimated source amount to send (from /public/quotes). Shown above the QR code. */
|
|
269
|
+
checkoutQuote?: {
|
|
270
|
+
sourceAmount: string;
|
|
271
|
+
sourceTokenDecimals: number;
|
|
272
|
+
sourceTokenSymbol: string;
|
|
273
|
+
sourceAmountUsd: string | null;
|
|
274
|
+
} | null;
|
|
253
275
|
}
|
|
254
|
-
declare function TransferCryptoSingleInput({ userId, publishableKey, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, depositConfirmationMode, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, }: TransferCryptoSingleInputProps): react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare function TransferCryptoSingleInput({ userId, publishableKey, clientSecret, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, depositConfirmationMode, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, onSourceTokenChange, checkoutQuote, }: TransferCryptoSingleInputProps): react_jsx_runtime.JSX.Element;
|
|
255
277
|
|
|
256
278
|
interface TransferCryptoDoubleInputProps {
|
|
257
279
|
userId: string;
|
|
@@ -425,8 +447,36 @@ interface ConfirmingViewProps {
|
|
|
425
447
|
onClose: () => void;
|
|
426
448
|
executions?: AutoSwapResponse[];
|
|
427
449
|
isPolling?: boolean;
|
|
450
|
+
onNewDeposit?: () => void;
|
|
451
|
+
onDone?: () => void;
|
|
452
|
+
paymentIntentStatus?: string;
|
|
453
|
+
/** Live amount_received_usd from the payment intent (updates via polling). */
|
|
454
|
+
amountReceivedUsd?: string;
|
|
455
|
+
/** Snapshot of amount_received_usd taken when the transaction was submitted. */
|
|
456
|
+
amountReceivedUsdAtSubmission?: string | null;
|
|
428
457
|
}
|
|
429
|
-
declare function ConfirmingView({ isConfirming, onClose, executions, isPolling, }: ConfirmingViewProps): react_jsx_runtime.JSX.Element;
|
|
458
|
+
declare function ConfirmingView({ isConfirming, onClose, executions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd, amountReceivedUsdAtSubmission, }: ConfirmingViewProps): react_jsx_runtime.JSX.Element;
|
|
459
|
+
|
|
460
|
+
interface CheckoutModalProps {
|
|
461
|
+
open: boolean;
|
|
462
|
+
onOpenChange: (open: boolean) => void;
|
|
463
|
+
clientSecret: string;
|
|
464
|
+
publishableKey: string;
|
|
465
|
+
modalTitle?: string;
|
|
466
|
+
/** Enable browser wallet connection option. Defaults to false */
|
|
467
|
+
enableConnectWallet?: boolean;
|
|
468
|
+
theme?: "light" | "dark" | "auto";
|
|
469
|
+
onCheckoutSuccess?: (data: {
|
|
470
|
+
paymentIntentId: string;
|
|
471
|
+
status: string;
|
|
472
|
+
}) => void;
|
|
473
|
+
onCheckoutError?: (error: {
|
|
474
|
+
message: string;
|
|
475
|
+
error?: unknown;
|
|
476
|
+
code?: string;
|
|
477
|
+
}) => void;
|
|
478
|
+
}
|
|
479
|
+
declare function CheckoutModal({ open, onOpenChange, clientSecret, publishableKey, modalTitle, enableConnectWallet, theme, onCheckoutSuccess, onCheckoutError, }: CheckoutModalProps): react_jsx_runtime.JSX.Element;
|
|
430
480
|
|
|
431
481
|
interface WithdrawTransactionInfo {
|
|
432
482
|
/** Source (sending) chain type */
|
|
@@ -517,34 +567,6 @@ declare function useAddressBalance(params: {
|
|
|
517
567
|
enabled?: boolean;
|
|
518
568
|
}): _tanstack_react_query.UseQueryResult<AddressBalanceResult | null, Error>;
|
|
519
569
|
|
|
520
|
-
type DetectedWallet = {
|
|
521
|
-
name: string;
|
|
522
|
-
address: string;
|
|
523
|
-
} & ({
|
|
524
|
-
chainFamily: "evm";
|
|
525
|
-
provider: EvmWalletProvider;
|
|
526
|
-
} | {
|
|
527
|
-
chainFamily: "solana";
|
|
528
|
-
provider: SolanaWalletProvider;
|
|
529
|
-
});
|
|
530
|
-
declare function sendEvmWithdraw(params: {
|
|
531
|
-
provider: EvmWalletProvider;
|
|
532
|
-
fromAddress: string;
|
|
533
|
-
depositWalletAddress: string;
|
|
534
|
-
sourceTokenAddress: string;
|
|
535
|
-
sourceChainId: string;
|
|
536
|
-
amountBaseUnit: string;
|
|
537
|
-
}): Promise<string>;
|
|
538
|
-
declare function sendSolanaWithdraw(params: {
|
|
539
|
-
provider: SolanaWalletProvider;
|
|
540
|
-
fromAddress: string;
|
|
541
|
-
depositWalletAddress: string;
|
|
542
|
-
sourceTokenAddress: string;
|
|
543
|
-
amountBaseUnit: string;
|
|
544
|
-
publishableKey: string;
|
|
545
|
-
}): Promise<string>;
|
|
546
|
-
declare function detectBrowserWallet(chainType: string, senderAddress?: string): Promise<DetectedWallet | null>;
|
|
547
|
-
|
|
548
570
|
interface WithdrawFormProps {
|
|
549
571
|
publishableKey: string;
|
|
550
572
|
externalUserId: string;
|
|
@@ -559,13 +581,9 @@ interface WithdrawFormProps {
|
|
|
559
581
|
estimatedProcessingTime: number | null;
|
|
560
582
|
maxSlippagePercent: number | null;
|
|
561
583
|
priceImpactPercent: number | null;
|
|
562
|
-
|
|
563
|
-
detectedWallet: DetectedWallet | null;
|
|
584
|
+
senderAddress: string;
|
|
564
585
|
sourceChainId: string;
|
|
565
586
|
sourceTokenAddress: string;
|
|
566
|
-
isWalletMatch: boolean;
|
|
567
|
-
connectedWalletName: string | null;
|
|
568
|
-
canWithdraw: boolean;
|
|
569
587
|
onWithdraw?: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
570
588
|
onWithdrawError?: (error: {
|
|
571
589
|
message: string;
|
|
@@ -587,7 +605,7 @@ interface WithdrawFormProps {
|
|
|
587
605
|
/** Optional element rendered on the left side of the footer row (e.g. tracker link) */
|
|
588
606
|
footerLeft?: React.ReactNode;
|
|
589
607
|
}
|
|
590
|
-
declare function WithdrawForm({ publishableKey, externalUserId, sourceChainType, selectedToken, selectedChain, sourceTokenSymbol, recipientAddressProp, balanceData, isLoadingBalance, minimumWithdrawAmountUsd, estimatedProcessingTime, maxSlippagePercent, priceImpactPercent,
|
|
608
|
+
declare function WithdrawForm({ publishableKey, externalUserId, sourceChainType, selectedToken, selectedChain, sourceTokenSymbol, recipientAddressProp, balanceData, isLoadingBalance, minimumWithdrawAmountUsd, estimatedProcessingTime, maxSlippagePercent, priceImpactPercent, senderAddress, sourceChainId, sourceTokenAddress, onWithdraw, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, footerLeft, }: WithdrawFormProps): react_jsx_runtime.JSX.Element;
|
|
591
609
|
|
|
592
610
|
interface WithdrawExecutionItemProps {
|
|
593
611
|
execution: AutoSwapResponse;
|
|
@@ -603,6 +621,46 @@ interface WithdrawConfirmingViewProps {
|
|
|
603
621
|
}
|
|
604
622
|
declare function WithdrawConfirmingView({ txInfo, executions, onClose, onViewTracker, }: WithdrawConfirmingViewProps): react_jsx_runtime.JSX.Element;
|
|
605
623
|
|
|
624
|
+
type DetectedWallet = {
|
|
625
|
+
name: string;
|
|
626
|
+
address: string;
|
|
627
|
+
} & ({
|
|
628
|
+
chainFamily: "evm";
|
|
629
|
+
provider: EvmWalletProvider;
|
|
630
|
+
} | {
|
|
631
|
+
chainFamily: "solana";
|
|
632
|
+
provider: SolanaWalletProvider;
|
|
633
|
+
});
|
|
634
|
+
declare function sendEvmWithdraw(params: {
|
|
635
|
+
provider: EvmWalletProvider;
|
|
636
|
+
fromAddress: string;
|
|
637
|
+
depositWalletAddress: string;
|
|
638
|
+
sourceTokenAddress: string;
|
|
639
|
+
sourceChainId: string;
|
|
640
|
+
amountBaseUnit: string;
|
|
641
|
+
}): Promise<string>;
|
|
642
|
+
declare function sendSolanaWithdraw(params: {
|
|
643
|
+
provider: SolanaWalletProvider;
|
|
644
|
+
fromAddress: string;
|
|
645
|
+
depositWalletAddress: string;
|
|
646
|
+
sourceTokenAddress: string;
|
|
647
|
+
amountBaseUnit: string;
|
|
648
|
+
publishableKey: string;
|
|
649
|
+
}): Promise<string>;
|
|
650
|
+
declare const HYPERCORE_CHAIN_ID = "1337";
|
|
651
|
+
declare function isHypercoreChain(chainId: string): boolean;
|
|
652
|
+
declare function sendHypercoreWithdraw(params: {
|
|
653
|
+
provider: EvmWalletProvider;
|
|
654
|
+
fromAddress: string;
|
|
655
|
+
depositWalletAddress: string;
|
|
656
|
+
sourceTokenAddress: string;
|
|
657
|
+
amount: string;
|
|
658
|
+
tokenSymbol: string;
|
|
659
|
+
publishableKey: string;
|
|
660
|
+
}): Promise<void>;
|
|
661
|
+
|
|
662
|
+
declare function detectBrowserWallet(chainType: string, senderAddress?: string): Promise<DetectedWallet | null>;
|
|
663
|
+
|
|
606
664
|
interface CurrencyListItemProps {
|
|
607
665
|
currency: FiatCurrency;
|
|
608
666
|
isSelected: boolean;
|
|
@@ -723,6 +781,42 @@ interface AllowedCountryResult {
|
|
|
723
781
|
*/
|
|
724
782
|
declare function useAllowedCountry(publishableKey: string): AllowedCountryResult;
|
|
725
783
|
|
|
784
|
+
interface UsePaymentIntentParams {
|
|
785
|
+
clientSecret: string;
|
|
786
|
+
publishableKey: string;
|
|
787
|
+
/** Whether the query should execute. Defaults to true. */
|
|
788
|
+
enabled?: boolean;
|
|
789
|
+
/** Polling interval in ms. Defaults to 5000 (5s). Set to 0 to disable. */
|
|
790
|
+
pollingInterval?: number;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Hook to retrieve and poll a payment intent via react-query.
|
|
794
|
+
*
|
|
795
|
+
* Fetches the payment intent on mount and polls at the configured interval
|
|
796
|
+
* so `amount_received_usd` and `status` stay up-to-date in the UI.
|
|
797
|
+
*/
|
|
798
|
+
declare function usePaymentIntent(params: UsePaymentIntentParams): _tanstack_react_query.UseQueryResult<PaymentIntent, Error>;
|
|
799
|
+
|
|
800
|
+
interface UseDepositQuoteParams {
|
|
801
|
+
publishableKey: string;
|
|
802
|
+
sourceChainType: string;
|
|
803
|
+
sourceChainId: string;
|
|
804
|
+
sourceTokenAddress: string;
|
|
805
|
+
destinationAmount: string;
|
|
806
|
+
destinationChainType: string;
|
|
807
|
+
destinationChainId: string;
|
|
808
|
+
destinationTokenAddress: string;
|
|
809
|
+
enabled?: boolean;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Hook to fetch a deposit quote via react-query.
|
|
813
|
+
*
|
|
814
|
+
* Returns the estimated source token amount needed to receive a specific
|
|
815
|
+
* destination amount, accounting for bridge fees and slippage.
|
|
816
|
+
* Server-side cached for 1 minute; client re-fetches on param change.
|
|
817
|
+
*/
|
|
818
|
+
declare function useDepositQuote(params: UseDepositQuoteParams): _tanstack_react_query.UseQueryResult<DepositQuote, Error>;
|
|
819
|
+
|
|
726
820
|
interface UseWithdrawPollingOptions {
|
|
727
821
|
userId: string | undefined;
|
|
728
822
|
publishableKey: string;
|
|
@@ -1066,4 +1160,4 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
1066
1160
|
*/
|
|
1067
1161
|
declare function truncateAddress(address: string, startChars?: number, endChars?: number): string;
|
|
1068
1162
|
|
|
1069
|
-
export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useSourceTokenValidation, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
|
|
1163
|
+
export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, CheckoutModal, type CheckoutModalProps, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, HYPERCORE_CHAIN_ID, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, type UseDepositQuoteParams, type UsePaymentIntentParams, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, isHypercoreChain, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendHypercoreWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useDepositQuote, usePaymentIntent, useSourceTokenValidation, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { AutoSwapResponse, ChainType, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, SupportedDestinationTokensResponse, VerifyAddressResponse } from '@unifold/core';
|
|
2
|
+
import { AutoSwapResponse, ChainType, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork, DestinationToken, DestinationTokenChain, PaymentIntent, DepositQuote, SupportedDestinationTokensResponse, VerifyAddressResponse } from '@unifold/core';
|
|
3
3
|
export { ChainType } from '@unifold/core';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
@@ -14,6 +14,11 @@ type DepositConfirmationMode = "auto_ui" | "auto_silent" | "manual";
|
|
|
14
14
|
interface UseDepositPollingOptions {
|
|
15
15
|
userId: string | undefined;
|
|
16
16
|
publishableKey: string;
|
|
17
|
+
/**
|
|
18
|
+
* When provided, polls executions via the payment-intent-scoped endpoint
|
|
19
|
+
* instead of the user-scoped queryExecutions endpoint.
|
|
20
|
+
*/
|
|
21
|
+
clientSecret?: string;
|
|
17
22
|
/** Controls when polling starts and whether a waiting UI is shown.
|
|
18
23
|
* - "auto_ui": After 10s, starts polling and shows "Processing..." card (default)
|
|
19
24
|
* - "auto_silent": After 10s, starts polling silently (no waiting UI)
|
|
@@ -50,7 +55,7 @@ interface UseDepositPollingResult {
|
|
|
50
55
|
/** Call this when user clicks "I've made the deposit" (manual mode) */
|
|
51
56
|
handleIveDeposited: () => void;
|
|
52
57
|
}
|
|
53
|
-
declare function useDepositPolling({ userId, publishableKey, depositConfirmationMode, depositWalletId, enabled, immediateDirectPolling, onDepositSuccess, onDepositError, }: UseDepositPollingOptions): UseDepositPollingResult;
|
|
58
|
+
declare function useDepositPolling({ userId, publishableKey, clientSecret, depositConfirmationMode, depositWalletId, enabled, immediateDirectPolling, onDepositSuccess, onDepositError, }: UseDepositPollingOptions): UseDepositPollingResult;
|
|
54
59
|
|
|
55
60
|
declare global {
|
|
56
61
|
interface Window {
|
|
@@ -224,6 +229,8 @@ declare function DepositHeader({ title, subtitle, showBack, showClose, onBack, o
|
|
|
224
229
|
interface TransferCryptoSingleInputProps {
|
|
225
230
|
userId: string;
|
|
226
231
|
publishableKey: string;
|
|
232
|
+
/** When provided, polls executions via the payment-intent-scoped endpoint instead of user-scoped. */
|
|
233
|
+
clientSecret?: string;
|
|
227
234
|
recipientAddress?: string;
|
|
228
235
|
destinationChainType?: ChainType;
|
|
229
236
|
destinationChainId?: string;
|
|
@@ -250,8 +257,23 @@ interface TransferCryptoSingleInputProps {
|
|
|
250
257
|
code?: string;
|
|
251
258
|
}) => void;
|
|
252
259
|
wallets?: Wallet[];
|
|
260
|
+
/** Called when the user changes the selected source token/chain. */
|
|
261
|
+
onSourceTokenChange?: (info: {
|
|
262
|
+
symbol: string;
|
|
263
|
+
chainType: string;
|
|
264
|
+
chainId: string;
|
|
265
|
+
tokenAddress: string;
|
|
266
|
+
minimumDepositAmountUsd: number;
|
|
267
|
+
}) => void;
|
|
268
|
+
/** Checkout mode: estimated source amount to send (from /public/quotes). Shown above the QR code. */
|
|
269
|
+
checkoutQuote?: {
|
|
270
|
+
sourceAmount: string;
|
|
271
|
+
sourceTokenDecimals: number;
|
|
272
|
+
sourceTokenSymbol: string;
|
|
273
|
+
sourceAmountUsd: string | null;
|
|
274
|
+
} | null;
|
|
253
275
|
}
|
|
254
|
-
declare function TransferCryptoSingleInput({ userId, publishableKey, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, depositConfirmationMode, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, }: TransferCryptoSingleInputProps): react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare function TransferCryptoSingleInput({ userId, publishableKey, clientSecret, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, depositConfirmationMode, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, onSourceTokenChange, checkoutQuote, }: TransferCryptoSingleInputProps): react_jsx_runtime.JSX.Element;
|
|
255
277
|
|
|
256
278
|
interface TransferCryptoDoubleInputProps {
|
|
257
279
|
userId: string;
|
|
@@ -425,8 +447,36 @@ interface ConfirmingViewProps {
|
|
|
425
447
|
onClose: () => void;
|
|
426
448
|
executions?: AutoSwapResponse[];
|
|
427
449
|
isPolling?: boolean;
|
|
450
|
+
onNewDeposit?: () => void;
|
|
451
|
+
onDone?: () => void;
|
|
452
|
+
paymentIntentStatus?: string;
|
|
453
|
+
/** Live amount_received_usd from the payment intent (updates via polling). */
|
|
454
|
+
amountReceivedUsd?: string;
|
|
455
|
+
/** Snapshot of amount_received_usd taken when the transaction was submitted. */
|
|
456
|
+
amountReceivedUsdAtSubmission?: string | null;
|
|
428
457
|
}
|
|
429
|
-
declare function ConfirmingView({ isConfirming, onClose, executions, isPolling, }: ConfirmingViewProps): react_jsx_runtime.JSX.Element;
|
|
458
|
+
declare function ConfirmingView({ isConfirming, onClose, executions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd, amountReceivedUsdAtSubmission, }: ConfirmingViewProps): react_jsx_runtime.JSX.Element;
|
|
459
|
+
|
|
460
|
+
interface CheckoutModalProps {
|
|
461
|
+
open: boolean;
|
|
462
|
+
onOpenChange: (open: boolean) => void;
|
|
463
|
+
clientSecret: string;
|
|
464
|
+
publishableKey: string;
|
|
465
|
+
modalTitle?: string;
|
|
466
|
+
/** Enable browser wallet connection option. Defaults to false */
|
|
467
|
+
enableConnectWallet?: boolean;
|
|
468
|
+
theme?: "light" | "dark" | "auto";
|
|
469
|
+
onCheckoutSuccess?: (data: {
|
|
470
|
+
paymentIntentId: string;
|
|
471
|
+
status: string;
|
|
472
|
+
}) => void;
|
|
473
|
+
onCheckoutError?: (error: {
|
|
474
|
+
message: string;
|
|
475
|
+
error?: unknown;
|
|
476
|
+
code?: string;
|
|
477
|
+
}) => void;
|
|
478
|
+
}
|
|
479
|
+
declare function CheckoutModal({ open, onOpenChange, clientSecret, publishableKey, modalTitle, enableConnectWallet, theme, onCheckoutSuccess, onCheckoutError, }: CheckoutModalProps): react_jsx_runtime.JSX.Element;
|
|
430
480
|
|
|
431
481
|
interface WithdrawTransactionInfo {
|
|
432
482
|
/** Source (sending) chain type */
|
|
@@ -517,34 +567,6 @@ declare function useAddressBalance(params: {
|
|
|
517
567
|
enabled?: boolean;
|
|
518
568
|
}): _tanstack_react_query.UseQueryResult<AddressBalanceResult | null, Error>;
|
|
519
569
|
|
|
520
|
-
type DetectedWallet = {
|
|
521
|
-
name: string;
|
|
522
|
-
address: string;
|
|
523
|
-
} & ({
|
|
524
|
-
chainFamily: "evm";
|
|
525
|
-
provider: EvmWalletProvider;
|
|
526
|
-
} | {
|
|
527
|
-
chainFamily: "solana";
|
|
528
|
-
provider: SolanaWalletProvider;
|
|
529
|
-
});
|
|
530
|
-
declare function sendEvmWithdraw(params: {
|
|
531
|
-
provider: EvmWalletProvider;
|
|
532
|
-
fromAddress: string;
|
|
533
|
-
depositWalletAddress: string;
|
|
534
|
-
sourceTokenAddress: string;
|
|
535
|
-
sourceChainId: string;
|
|
536
|
-
amountBaseUnit: string;
|
|
537
|
-
}): Promise<string>;
|
|
538
|
-
declare function sendSolanaWithdraw(params: {
|
|
539
|
-
provider: SolanaWalletProvider;
|
|
540
|
-
fromAddress: string;
|
|
541
|
-
depositWalletAddress: string;
|
|
542
|
-
sourceTokenAddress: string;
|
|
543
|
-
amountBaseUnit: string;
|
|
544
|
-
publishableKey: string;
|
|
545
|
-
}): Promise<string>;
|
|
546
|
-
declare function detectBrowserWallet(chainType: string, senderAddress?: string): Promise<DetectedWallet | null>;
|
|
547
|
-
|
|
548
570
|
interface WithdrawFormProps {
|
|
549
571
|
publishableKey: string;
|
|
550
572
|
externalUserId: string;
|
|
@@ -559,13 +581,9 @@ interface WithdrawFormProps {
|
|
|
559
581
|
estimatedProcessingTime: number | null;
|
|
560
582
|
maxSlippagePercent: number | null;
|
|
561
583
|
priceImpactPercent: number | null;
|
|
562
|
-
|
|
563
|
-
detectedWallet: DetectedWallet | null;
|
|
584
|
+
senderAddress: string;
|
|
564
585
|
sourceChainId: string;
|
|
565
586
|
sourceTokenAddress: string;
|
|
566
|
-
isWalletMatch: boolean;
|
|
567
|
-
connectedWalletName: string | null;
|
|
568
|
-
canWithdraw: boolean;
|
|
569
587
|
onWithdraw?: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
570
588
|
onWithdrawError?: (error: {
|
|
571
589
|
message: string;
|
|
@@ -587,7 +605,7 @@ interface WithdrawFormProps {
|
|
|
587
605
|
/** Optional element rendered on the left side of the footer row (e.g. tracker link) */
|
|
588
606
|
footerLeft?: React.ReactNode;
|
|
589
607
|
}
|
|
590
|
-
declare function WithdrawForm({ publishableKey, externalUserId, sourceChainType, selectedToken, selectedChain, sourceTokenSymbol, recipientAddressProp, balanceData, isLoadingBalance, minimumWithdrawAmountUsd, estimatedProcessingTime, maxSlippagePercent, priceImpactPercent,
|
|
608
|
+
declare function WithdrawForm({ publishableKey, externalUserId, sourceChainType, selectedToken, selectedChain, sourceTokenSymbol, recipientAddressProp, balanceData, isLoadingBalance, minimumWithdrawAmountUsd, estimatedProcessingTime, maxSlippagePercent, priceImpactPercent, senderAddress, sourceChainId, sourceTokenAddress, onWithdraw, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, footerLeft, }: WithdrawFormProps): react_jsx_runtime.JSX.Element;
|
|
591
609
|
|
|
592
610
|
interface WithdrawExecutionItemProps {
|
|
593
611
|
execution: AutoSwapResponse;
|
|
@@ -603,6 +621,46 @@ interface WithdrawConfirmingViewProps {
|
|
|
603
621
|
}
|
|
604
622
|
declare function WithdrawConfirmingView({ txInfo, executions, onClose, onViewTracker, }: WithdrawConfirmingViewProps): react_jsx_runtime.JSX.Element;
|
|
605
623
|
|
|
624
|
+
type DetectedWallet = {
|
|
625
|
+
name: string;
|
|
626
|
+
address: string;
|
|
627
|
+
} & ({
|
|
628
|
+
chainFamily: "evm";
|
|
629
|
+
provider: EvmWalletProvider;
|
|
630
|
+
} | {
|
|
631
|
+
chainFamily: "solana";
|
|
632
|
+
provider: SolanaWalletProvider;
|
|
633
|
+
});
|
|
634
|
+
declare function sendEvmWithdraw(params: {
|
|
635
|
+
provider: EvmWalletProvider;
|
|
636
|
+
fromAddress: string;
|
|
637
|
+
depositWalletAddress: string;
|
|
638
|
+
sourceTokenAddress: string;
|
|
639
|
+
sourceChainId: string;
|
|
640
|
+
amountBaseUnit: string;
|
|
641
|
+
}): Promise<string>;
|
|
642
|
+
declare function sendSolanaWithdraw(params: {
|
|
643
|
+
provider: SolanaWalletProvider;
|
|
644
|
+
fromAddress: string;
|
|
645
|
+
depositWalletAddress: string;
|
|
646
|
+
sourceTokenAddress: string;
|
|
647
|
+
amountBaseUnit: string;
|
|
648
|
+
publishableKey: string;
|
|
649
|
+
}): Promise<string>;
|
|
650
|
+
declare const HYPERCORE_CHAIN_ID = "1337";
|
|
651
|
+
declare function isHypercoreChain(chainId: string): boolean;
|
|
652
|
+
declare function sendHypercoreWithdraw(params: {
|
|
653
|
+
provider: EvmWalletProvider;
|
|
654
|
+
fromAddress: string;
|
|
655
|
+
depositWalletAddress: string;
|
|
656
|
+
sourceTokenAddress: string;
|
|
657
|
+
amount: string;
|
|
658
|
+
tokenSymbol: string;
|
|
659
|
+
publishableKey: string;
|
|
660
|
+
}): Promise<void>;
|
|
661
|
+
|
|
662
|
+
declare function detectBrowserWallet(chainType: string, senderAddress?: string): Promise<DetectedWallet | null>;
|
|
663
|
+
|
|
606
664
|
interface CurrencyListItemProps {
|
|
607
665
|
currency: FiatCurrency;
|
|
608
666
|
isSelected: boolean;
|
|
@@ -723,6 +781,42 @@ interface AllowedCountryResult {
|
|
|
723
781
|
*/
|
|
724
782
|
declare function useAllowedCountry(publishableKey: string): AllowedCountryResult;
|
|
725
783
|
|
|
784
|
+
interface UsePaymentIntentParams {
|
|
785
|
+
clientSecret: string;
|
|
786
|
+
publishableKey: string;
|
|
787
|
+
/** Whether the query should execute. Defaults to true. */
|
|
788
|
+
enabled?: boolean;
|
|
789
|
+
/** Polling interval in ms. Defaults to 5000 (5s). Set to 0 to disable. */
|
|
790
|
+
pollingInterval?: number;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Hook to retrieve and poll a payment intent via react-query.
|
|
794
|
+
*
|
|
795
|
+
* Fetches the payment intent on mount and polls at the configured interval
|
|
796
|
+
* so `amount_received_usd` and `status` stay up-to-date in the UI.
|
|
797
|
+
*/
|
|
798
|
+
declare function usePaymentIntent(params: UsePaymentIntentParams): _tanstack_react_query.UseQueryResult<PaymentIntent, Error>;
|
|
799
|
+
|
|
800
|
+
interface UseDepositQuoteParams {
|
|
801
|
+
publishableKey: string;
|
|
802
|
+
sourceChainType: string;
|
|
803
|
+
sourceChainId: string;
|
|
804
|
+
sourceTokenAddress: string;
|
|
805
|
+
destinationAmount: string;
|
|
806
|
+
destinationChainType: string;
|
|
807
|
+
destinationChainId: string;
|
|
808
|
+
destinationTokenAddress: string;
|
|
809
|
+
enabled?: boolean;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Hook to fetch a deposit quote via react-query.
|
|
813
|
+
*
|
|
814
|
+
* Returns the estimated source token amount needed to receive a specific
|
|
815
|
+
* destination amount, accounting for bridge fees and slippage.
|
|
816
|
+
* Server-side cached for 1 minute; client re-fetches on param change.
|
|
817
|
+
*/
|
|
818
|
+
declare function useDepositQuote(params: UseDepositQuoteParams): _tanstack_react_query.UseQueryResult<DepositQuote, Error>;
|
|
819
|
+
|
|
726
820
|
interface UseWithdrawPollingOptions {
|
|
727
821
|
userId: string | undefined;
|
|
728
822
|
publishableKey: string;
|
|
@@ -1066,4 +1160,4 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
1066
1160
|
*/
|
|
1067
1161
|
declare function truncateAddress(address: string, startChars?: number, endChars?: number): string;
|
|
1068
1162
|
|
|
1069
|
-
export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useSourceTokenValidation, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
|
|
1163
|
+
export { type AllowedCountryResult, type BrowserWalletAmountQuickSelect, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type BuyWithCardProps, type CardTokens, CheckoutModal, type CheckoutModalProps, type ComponentConfig, type ComponentOverrides, type ComponentTokens, ConfirmingView, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, type DepositConfirmationMode, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, type DepositModalInitialScreen, type DepositModalProps, DepositPollingUi, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, type DetectedWallet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type EvmWalletProvider, type FontConfig, HYPERCORE_CHAIN_ID, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SolanaWalletProvider, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, type UseDepositQuoteParams, type UsePaymentIntentParams, WithdrawConfirmingView, WithdrawDoubleInput, WithdrawExecutionItem, WithdrawForm, WithdrawModal, type WithdrawModalProps, WithdrawTokenSelector, type WithdrawTransactionInfo, buttonVariants, cn, colors, defaultColors, detectBrowserWallet, getColors, isHypercoreChain, mergeColors, resolveComponentTokens, sendEvmWithdraw, sendHypercoreWithdraw, sendSolanaWithdraw, truncateAddress, useAddressBalance, useAllowedCountry, useDepositPolling, useDepositQuote, usePaymentIntent, useSourceTokenValidation, useSupportedDestinationTokens, useTheme, useVerifyRecipientAddress, useWithdrawPolling };
|