@unifold/connect-react 0.1.41 → 0.1.42
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 +51 -4
- package/dist/index.d.ts +51 -4
- package/dist/index.js +2620 -674
- package/dist/index.mjs +2618 -669
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ThemeMode, ThemeConfig, FontConfig, ComponentConfig, DepositModalInitialScreen, ChainType, DepositConfirmationMode, AllowedCountryResult } from '@unifold/ui-react';
|
|
4
|
-
export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode } from '@unifold/ui-react';
|
|
5
|
-
export { AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SupportedChain, SupportedDepositTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, setApiConfig, useUserIp } from '@unifold/core';
|
|
3
|
+
import { ThemeMode, ThemeConfig, FontConfig, ComponentConfig, DepositModalInitialScreen, ChainType, DepositConfirmationMode, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
|
|
4
|
+
export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, WithdrawTransactionInfo } from '@unifold/ui-react';
|
|
5
|
+
export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
|
|
6
6
|
|
|
7
7
|
interface UnifoldConnectProviderConfig {
|
|
8
8
|
publishableKey: string;
|
|
9
9
|
config?: {
|
|
10
10
|
modalTitle?: string;
|
|
11
|
+
/** Custom title for the withdraw modal. @default `"Withdraw"` */
|
|
12
|
+
withdrawModalTitle?: string;
|
|
11
13
|
hideDepositTracker?: boolean;
|
|
12
14
|
/** Show balance in deposit modal header. Defaults to true */
|
|
13
15
|
showBalanceHeader?: boolean;
|
|
@@ -92,11 +94,56 @@ interface DepositConfig {
|
|
|
92
94
|
*/
|
|
93
95
|
initialScreen?: DepositModalInitialScreen;
|
|
94
96
|
}
|
|
97
|
+
interface WithdrawResult {
|
|
98
|
+
message: string;
|
|
99
|
+
transaction?: unknown;
|
|
100
|
+
}
|
|
101
|
+
interface WithdrawError {
|
|
102
|
+
message: string;
|
|
103
|
+
error?: unknown;
|
|
104
|
+
code?: string;
|
|
105
|
+
}
|
|
106
|
+
interface WithdrawConfig {
|
|
107
|
+
/** External user ID — required, same as deposit */
|
|
108
|
+
externalUserId: string;
|
|
109
|
+
/** Source token chain type (e.g. 'ethereum', 'solana'). Must be a supported stablecoin. */
|
|
110
|
+
sourceChainType: ChainType;
|
|
111
|
+
/** Source token chain ID (e.g. '8453', 'mainnet') */
|
|
112
|
+
sourceChainId: string;
|
|
113
|
+
/** Source token contract address */
|
|
114
|
+
sourceTokenAddress: string;
|
|
115
|
+
/** Source token symbol (e.g. 'USDC'). Optional but recommended for display. */
|
|
116
|
+
sourceTokenSymbol?: string;
|
|
117
|
+
/** Optional: pre-fill the recipient address the user is withdrawing to */
|
|
118
|
+
recipientAddress?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The user's wallet address (the sender). Used to:
|
|
121
|
+
* 1. Fetch balance for quick-select chips (25%/50%/75%/MAX)
|
|
122
|
+
* 2. Detect if a matching browser wallet is connected
|
|
123
|
+
*/
|
|
124
|
+
senderAddress: string;
|
|
125
|
+
/**
|
|
126
|
+
* Callback invoked with transaction details when user confirms withdrawal.
|
|
127
|
+
* The platform must implement the actual transaction signing/sending since
|
|
128
|
+
* we don't have the private key.
|
|
129
|
+
*
|
|
130
|
+
* Optional — if omitted, the user must have a matching connected browser wallet
|
|
131
|
+
* to execute the withdrawal. If neither `withdraw` nor a connected wallet is available,
|
|
132
|
+
* the modal will show an error.
|
|
133
|
+
*/
|
|
134
|
+
withdraw?: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
135
|
+
onSuccess?: (data: WithdrawResult) => void;
|
|
136
|
+
onError?: (error: WithdrawError) => void;
|
|
137
|
+
onClose?: () => void;
|
|
138
|
+
}
|
|
139
|
+
|
|
95
140
|
declare function UnifoldProvider({ children, publishableKey, config, }: React.PropsWithChildren<UnifoldConnectProviderConfig>): react_jsx_runtime.JSX.Element;
|
|
96
141
|
declare function useUnifold(): {
|
|
97
142
|
publishableKey: string;
|
|
98
143
|
beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
|
|
99
144
|
closeDeposit: () => void;
|
|
145
|
+
beginWithdraw: (config: WithdrawConfig) => Promise<WithdrawResult>;
|
|
146
|
+
closeWithdraw: () => void;
|
|
100
147
|
};
|
|
101
148
|
/**
|
|
102
149
|
* Convenience wrapper for useAllowedCountry that automatically passes publishableKey from context
|
|
@@ -122,4 +169,4 @@ declare function useUnifold(): {
|
|
|
122
169
|
*/
|
|
123
170
|
declare function useAllowedCountry(): AllowedCountryResult;
|
|
124
171
|
|
|
125
|
-
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, useAllowedCountry, useUnifold };
|
|
172
|
+
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type WithdrawConfig, type WithdrawError, type WithdrawResult, useAllowedCountry, useUnifold };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ThemeMode, ThemeConfig, FontConfig, ComponentConfig, DepositModalInitialScreen, ChainType, DepositConfirmationMode, AllowedCountryResult } from '@unifold/ui-react';
|
|
4
|
-
export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode } from '@unifold/ui-react';
|
|
5
|
-
export { AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SupportedChain, SupportedDepositTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, setApiConfig, useUserIp } from '@unifold/core';
|
|
3
|
+
import { ThemeMode, ThemeConfig, FontConfig, ComponentConfig, DepositModalInitialScreen, ChainType, DepositConfirmationMode, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react';
|
|
4
|
+
export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, FontConfig, HeaderTokens, InputTokens, ListTokens, SearchTokens, ThemeColors, ThemeConfig, ThemeMode, WithdrawTransactionInfo } from '@unifold/ui-react';
|
|
5
|
+
export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DestinationToken, DestinationTokenChain, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionRequest, OnrampSessionResponse, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, createDepositAddress, createOnrampSession, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp } from '@unifold/core';
|
|
6
6
|
|
|
7
7
|
interface UnifoldConnectProviderConfig {
|
|
8
8
|
publishableKey: string;
|
|
9
9
|
config?: {
|
|
10
10
|
modalTitle?: string;
|
|
11
|
+
/** Custom title for the withdraw modal. @default `"Withdraw"` */
|
|
12
|
+
withdrawModalTitle?: string;
|
|
11
13
|
hideDepositTracker?: boolean;
|
|
12
14
|
/** Show balance in deposit modal header. Defaults to true */
|
|
13
15
|
showBalanceHeader?: boolean;
|
|
@@ -92,11 +94,56 @@ interface DepositConfig {
|
|
|
92
94
|
*/
|
|
93
95
|
initialScreen?: DepositModalInitialScreen;
|
|
94
96
|
}
|
|
97
|
+
interface WithdrawResult {
|
|
98
|
+
message: string;
|
|
99
|
+
transaction?: unknown;
|
|
100
|
+
}
|
|
101
|
+
interface WithdrawError {
|
|
102
|
+
message: string;
|
|
103
|
+
error?: unknown;
|
|
104
|
+
code?: string;
|
|
105
|
+
}
|
|
106
|
+
interface WithdrawConfig {
|
|
107
|
+
/** External user ID — required, same as deposit */
|
|
108
|
+
externalUserId: string;
|
|
109
|
+
/** Source token chain type (e.g. 'ethereum', 'solana'). Must be a supported stablecoin. */
|
|
110
|
+
sourceChainType: ChainType;
|
|
111
|
+
/** Source token chain ID (e.g. '8453', 'mainnet') */
|
|
112
|
+
sourceChainId: string;
|
|
113
|
+
/** Source token contract address */
|
|
114
|
+
sourceTokenAddress: string;
|
|
115
|
+
/** Source token symbol (e.g. 'USDC'). Optional but recommended for display. */
|
|
116
|
+
sourceTokenSymbol?: string;
|
|
117
|
+
/** Optional: pre-fill the recipient address the user is withdrawing to */
|
|
118
|
+
recipientAddress?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The user's wallet address (the sender). Used to:
|
|
121
|
+
* 1. Fetch balance for quick-select chips (25%/50%/75%/MAX)
|
|
122
|
+
* 2. Detect if a matching browser wallet is connected
|
|
123
|
+
*/
|
|
124
|
+
senderAddress: string;
|
|
125
|
+
/**
|
|
126
|
+
* Callback invoked with transaction details when user confirms withdrawal.
|
|
127
|
+
* The platform must implement the actual transaction signing/sending since
|
|
128
|
+
* we don't have the private key.
|
|
129
|
+
*
|
|
130
|
+
* Optional — if omitted, the user must have a matching connected browser wallet
|
|
131
|
+
* to execute the withdrawal. If neither `withdraw` nor a connected wallet is available,
|
|
132
|
+
* the modal will show an error.
|
|
133
|
+
*/
|
|
134
|
+
withdraw?: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
135
|
+
onSuccess?: (data: WithdrawResult) => void;
|
|
136
|
+
onError?: (error: WithdrawError) => void;
|
|
137
|
+
onClose?: () => void;
|
|
138
|
+
}
|
|
139
|
+
|
|
95
140
|
declare function UnifoldProvider({ children, publishableKey, config, }: React.PropsWithChildren<UnifoldConnectProviderConfig>): react_jsx_runtime.JSX.Element;
|
|
96
141
|
declare function useUnifold(): {
|
|
97
142
|
publishableKey: string;
|
|
98
143
|
beginDeposit: (config: DepositConfig) => Promise<DepositResult>;
|
|
99
144
|
closeDeposit: () => void;
|
|
145
|
+
beginWithdraw: (config: WithdrawConfig) => Promise<WithdrawResult>;
|
|
146
|
+
closeWithdraw: () => void;
|
|
100
147
|
};
|
|
101
148
|
/**
|
|
102
149
|
* Convenience wrapper for useAllowedCountry that automatically passes publishableKey from context
|
|
@@ -122,4 +169,4 @@ declare function useUnifold(): {
|
|
|
122
169
|
*/
|
|
123
170
|
declare function useAllowedCountry(): AllowedCountryResult;
|
|
124
171
|
|
|
125
|
-
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, useAllowedCountry, useUnifold };
|
|
172
|
+
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type WithdrawConfig, type WithdrawError, type WithdrawResult, useAllowedCountry, useUnifold };
|