@unifold/connect-react 0.1.79 → 0.1.81

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/README.md CHANGED
@@ -24,6 +24,11 @@ function App() {
24
24
  config={{
25
25
  modalTitle: 'Deposit Crypto',
26
26
  hideDepositTracker: false,
27
+ display: {
28
+ transferCrypto: {
29
+ exchangeRate: true,
30
+ },
31
+ },
27
32
  }}
28
33
  >
29
34
  <YourApp />
@@ -93,6 +98,8 @@ Wraps your application and provides the Unifold context.
93
98
  - `'dark'`: Force dark mode (default)
94
99
  - `'auto'`: Use system preference and respond to changes
95
100
  - `layout` (optional): Deposit menu layout and its options - `{ type, tabOrder }` (`type` defaults to `'tabs'`)
101
+ - `display` (optional): Surface-specific presentation toggles
102
+ - `display.transferCrypto.exchangeRate` (optional): Show exchange rate on Transfer Crypto screens (defaults to `false`)
96
103
  - `children` (required): Your React components
97
104
 
98
105
  ```tsx
@@ -522,6 +529,11 @@ const providerConfig: UnifoldConnectProviderConfig = {
522
529
  config: {
523
530
  modalTitle: 'Deposit',
524
531
  hideDepositTracker: false,
532
+ display: {
533
+ transferCrypto: {
534
+ exchangeRate: true,
535
+ },
536
+ },
525
537
  },
526
538
  };
527
539
 
package/dist/index.d.mts CHANGED
@@ -21,9 +21,9 @@ interface UnifoldConnectProviderConfig {
21
21
  queryClient?: QueryClient;
22
22
  config?: {
23
23
  /**
24
- * UI language as a BCP-47 tag (e.g. "en", "zh", "zh-CN", "zh-TW"). When
25
- * omitted, the browser locale is auto-detected. Unsupported locales fall
26
- * back to English.
24
+ * UI language as a BCP-47 tag (e.g. "en", "zh", "fr", "ja", "ko", "th").
25
+ * When omitted, the browser locale is auto-detected. Unsupported locales
26
+ * fall back to English.
27
27
  */
28
28
  locale?: string;
29
29
  modalTitle?: string;
@@ -80,6 +80,18 @@ interface UnifoldConnectProviderConfig {
80
80
  */
81
81
  incidentBanner?: boolean;
82
82
  };
83
+ /**
84
+ * Display preferences for specific deposit surfaces.
85
+ */
86
+ display?: {
87
+ transferCrypto?: {
88
+ /**
89
+ * Show the reference exchange-rate row on Transfer Crypto screens.
90
+ * Defaults to false.
91
+ */
92
+ exchangeRate?: boolean;
93
+ };
94
+ };
83
95
  /**
84
96
  * Enable "Pay with Apple Pay" (headless Coinbase) option. Overrides
85
97
  * dashboard default. Resolves as flag ?? dashboard `apple_pay.enabled` ??
@@ -89,7 +101,7 @@ interface UnifoldConnectProviderConfig {
89
101
  enableApplePay?: boolean;
90
102
  /** Main menu — Apple Pay row title. @default `"Pay with Apple Pay"` (localized when omitted) */
91
103
  applePayTitle?: string;
92
- /** Main menu — Apple Pay row subtitle. @default `"Instant"` (localized when omitted) */
104
+ /** Main menu — Apple Pay row subtitle. @default `"Instant • Debit card only"` (localized when omitted) */
93
105
  applePaySubTitle?: string;
94
106
  /**
95
107
  * Enable "Pay with Google Pay" (headless Coinbase) option. Overrides
@@ -100,7 +112,7 @@ interface UnifoldConnectProviderConfig {
100
112
  enableGooglePay?: boolean;
101
113
  /** Main menu — Google Pay row title. @default `"Pay with Google Pay"` (localized when omitted) */
102
114
  googlePayTitle?: string;
103
- /** Main menu — Google Pay row subtitle. @default `"Instant"` (localized when omitted) */
115
+ /** Main menu — Google Pay row subtitle. @default `"Instant • Debit card only"` (localized when omitted) */
104
116
  googlePaySubTitle?: string;
105
117
  /** Simple accent/primary color override (applies to both light and dark modes) */
106
118
  accentColor?: string;
@@ -314,14 +326,37 @@ interface WithdrawConfig {
314
326
  defaultDestinationSymbol?: string;
315
327
  /**
316
328
  * The user's wallet address (the sender). Used to:
317
- * 1. Fetch balance for quick-select chips (25%/50%/75%/MAX)
329
+ * 1. Fetch balance for max / over-balance (unless `balanceInBaseUnit` is provided)
318
330
  * 2. Detect if a matching browser wallet is connected
319
331
  */
320
332
  senderAddress: string;
333
+ /**
334
+ * Sender token balance in smallest units (e.g. `"1500000"` for 1.5 USDC).
335
+ * When provided, the modal skips `/addresses/balance` and uses this as the
336
+ * source of truth for max withdraw, over-balance checks, and amount conversion.
337
+ */
338
+ balanceInBaseUnit?: string;
339
+ /**
340
+ * USD value of {@link WithdrawConfig.balanceInBaseUnit}. When provided with
341
+ * `balanceInBaseUnit`, used for fiat display, max, and crypto↔USD conversion
342
+ * with no extra network calls. When omitted, the modal prices the token
343
+ * (stablecoins assume $1) to compute USD.
344
+ */
345
+ balanceUsd?: string | number;
346
+ /**
347
+ * Source token decimals (e.g. `6` for USDC). Used with `balanceInBaseUnit`
348
+ * to format the human amount without waiting on the token catalog. Falls
349
+ * back to catalog decimals when omitted.
350
+ */
351
+ sourceTokenDecimals?: number;
321
352
  /**
322
353
  * Callback invoked with transaction details when the user confirms withdrawal.
323
354
  * The host app is responsible for signing and submitting the transaction — the
324
355
  * SDK does not have access to the user's private key.
356
+ *
357
+ * Move `txInfo.amountBaseUnit` to `txInfo.withdrawIntentAddress`. That address
358
+ * is not always on `sourceChainType`: withdrawing off a chain Unifold can't
359
+ * monitor (N1) hands back a Solana address to bridge to instead.
325
360
  */
326
361
  withdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
327
362
  onSuccess?: (data: WithdrawResult) => void;
package/dist/index.d.ts CHANGED
@@ -21,9 +21,9 @@ interface UnifoldConnectProviderConfig {
21
21
  queryClient?: QueryClient;
22
22
  config?: {
23
23
  /**
24
- * UI language as a BCP-47 tag (e.g. "en", "zh", "zh-CN", "zh-TW"). When
25
- * omitted, the browser locale is auto-detected. Unsupported locales fall
26
- * back to English.
24
+ * UI language as a BCP-47 tag (e.g. "en", "zh", "fr", "ja", "ko", "th").
25
+ * When omitted, the browser locale is auto-detected. Unsupported locales
26
+ * fall back to English.
27
27
  */
28
28
  locale?: string;
29
29
  modalTitle?: string;
@@ -80,6 +80,18 @@ interface UnifoldConnectProviderConfig {
80
80
  */
81
81
  incidentBanner?: boolean;
82
82
  };
83
+ /**
84
+ * Display preferences for specific deposit surfaces.
85
+ */
86
+ display?: {
87
+ transferCrypto?: {
88
+ /**
89
+ * Show the reference exchange-rate row on Transfer Crypto screens.
90
+ * Defaults to false.
91
+ */
92
+ exchangeRate?: boolean;
93
+ };
94
+ };
83
95
  /**
84
96
  * Enable "Pay with Apple Pay" (headless Coinbase) option. Overrides
85
97
  * dashboard default. Resolves as flag ?? dashboard `apple_pay.enabled` ??
@@ -89,7 +101,7 @@ interface UnifoldConnectProviderConfig {
89
101
  enableApplePay?: boolean;
90
102
  /** Main menu — Apple Pay row title. @default `"Pay with Apple Pay"` (localized when omitted) */
91
103
  applePayTitle?: string;
92
- /** Main menu — Apple Pay row subtitle. @default `"Instant"` (localized when omitted) */
104
+ /** Main menu — Apple Pay row subtitle. @default `"Instant • Debit card only"` (localized when omitted) */
93
105
  applePaySubTitle?: string;
94
106
  /**
95
107
  * Enable "Pay with Google Pay" (headless Coinbase) option. Overrides
@@ -100,7 +112,7 @@ interface UnifoldConnectProviderConfig {
100
112
  enableGooglePay?: boolean;
101
113
  /** Main menu — Google Pay row title. @default `"Pay with Google Pay"` (localized when omitted) */
102
114
  googlePayTitle?: string;
103
- /** Main menu — Google Pay row subtitle. @default `"Instant"` (localized when omitted) */
115
+ /** Main menu — Google Pay row subtitle. @default `"Instant • Debit card only"` (localized when omitted) */
104
116
  googlePaySubTitle?: string;
105
117
  /** Simple accent/primary color override (applies to both light and dark modes) */
106
118
  accentColor?: string;
@@ -314,14 +326,37 @@ interface WithdrawConfig {
314
326
  defaultDestinationSymbol?: string;
315
327
  /**
316
328
  * The user's wallet address (the sender). Used to:
317
- * 1. Fetch balance for quick-select chips (25%/50%/75%/MAX)
329
+ * 1. Fetch balance for max / over-balance (unless `balanceInBaseUnit` is provided)
318
330
  * 2. Detect if a matching browser wallet is connected
319
331
  */
320
332
  senderAddress: string;
333
+ /**
334
+ * Sender token balance in smallest units (e.g. `"1500000"` for 1.5 USDC).
335
+ * When provided, the modal skips `/addresses/balance` and uses this as the
336
+ * source of truth for max withdraw, over-balance checks, and amount conversion.
337
+ */
338
+ balanceInBaseUnit?: string;
339
+ /**
340
+ * USD value of {@link WithdrawConfig.balanceInBaseUnit}. When provided with
341
+ * `balanceInBaseUnit`, used for fiat display, max, and crypto↔USD conversion
342
+ * with no extra network calls. When omitted, the modal prices the token
343
+ * (stablecoins assume $1) to compute USD.
344
+ */
345
+ balanceUsd?: string | number;
346
+ /**
347
+ * Source token decimals (e.g. `6` for USDC). Used with `balanceInBaseUnit`
348
+ * to format the human amount without waiting on the token catalog. Falls
349
+ * back to catalog decimals when omitted.
350
+ */
351
+ sourceTokenDecimals?: number;
321
352
  /**
322
353
  * Callback invoked with transaction details when the user confirms withdrawal.
323
354
  * The host app is responsible for signing and submitting the transaction — the
324
355
  * SDK does not have access to the user's private key.
356
+ *
357
+ * Move `txInfo.amountBaseUnit` to `txInfo.withdrawIntentAddress`. That address
358
+ * is not always on `sourceChainType`: withdrawing off a chain Unifold can't
359
+ * monitor (N1) hands back a Solana address to bridge to instead.
325
360
  */
326
361
  withdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
327
362
  onSuccess?: (data: WithdrawResult) => void;