@pollar/react 0.10.0-rc.0 → 0.10.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,46 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { WalletId, AuthState, pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, PollarAdapter, KycStatus as KycStatus$1, RampQuote, KycProvider, KycStartResponse, RampDirection, PaymentInstructions, EnabledAssetRecord, WalletBalanceRecord, DistributionRulesState, DistributionRule } from '@pollar/core';
2
+ import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapQuoteParams, SwapQuote, PollarAdapter, WalletId, KycStatus as KycStatus$1, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, RampTxStatus, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
3
3
  export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  type ConfigResponse = pollarPaths['/applications/config']['get']['responses'][200]['content']['application/json'];
7
7
  type PollarConfig = ConfigResponse['content'];
8
8
  type PollarStyles = PollarConfig['styles'];
9
- /**
10
- * Props passed by `@pollar/react` to a `renderWallets` slot. External wallet
11
- * picker components receive these and call `onConnect(id)` when the user picks
12
- * a wallet; `@pollar/react` wraps that into `client.loginWallet(id)`.
13
- */
14
- interface RenderWalletsProps {
15
- /** Wrapper around `client.loginWallet(id)`. */
16
- onConnect: (id: WalletId) => void;
17
- /** Current auth state — picker can disable buttons / surface loading. */
18
- authState: AuthState;
19
- }
20
- /**
21
- * Signature for the `ui.renderWallets` slot on `<PollarProvider>`. When
22
- * provided, replaces the default Freighter/Albedo buttons in the LoginModal
23
- * with whatever the slot returns (typically a kit-powered wallet grid).
24
- */
25
- type RenderWalletsSlot = (props: RenderWalletsProps) => ReactNode;
26
- /**
27
- * Presentation metadata for a custom login provider button in the LoginModal
28
- * (e.g. Privy, Magic). Pairs with a {@link PollarAuthProvider} registered on the
29
- * client via its `providers` config: clicking the button calls
30
- * `client.login({ provider: id })`, and the provider opens its own UI.
31
- *
32
- * Logic (the actual login) lives in the `PollarAuthProvider`; this is only the
33
- * button's look. Keeping them separate means React never needs to know how a
34
- * provider authenticates.
35
- */
36
- interface CustomLoginProvider {
37
- /** Must match the `id` of a registered `PollarAuthProvider`. */
38
- id: string;
39
- /** Button label, e.g. "Continue with Privy". */
40
- label: string;
41
- /** Optional icon URL rendered in the button. */
42
- iconUrl?: string;
43
- }
44
9
  interface LoginButtonProps {
45
10
  onSuccess?: () => void;
46
11
  onError?: (error: Error) => void;
@@ -78,10 +43,6 @@ interface PollarContextValue {
78
43
  openSessionsModal: () => void;
79
44
  appConfig: PollarConfig;
80
45
  styles: PollarStyles;
81
- /** UI slot for wallet picker (forwarded from provider props). */
82
- renderWallets?: RenderWalletsSlot;
83
- /** Custom login provider buttons (forwarded from `ui.customProviders`). */
84
- customProviders?: CustomLoginProvider[];
85
46
  openTxModal: () => void;
86
47
  tx: TransactionState;
87
48
  buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<BuildOutcome>;
@@ -130,6 +91,20 @@ interface PollarContextValue {
130
91
  openWalletBalanceModal: () => void;
131
92
  openSendModal: () => void;
132
93
  openReceiveModal: () => void;
94
+ /**
95
+ * Quote an asset-to-asset swap across the requested venue(s). Read-only;
96
+ * returns quotes ranked best-first. Mirrors {@link PollarClient.getSwapQuote}.
97
+ */
98
+ getSwapQuote: (params: SwapQuoteParams) => Promise<SwapQuote[]>;
99
+ /**
100
+ * Execute a swap from a quote (establishes the buy-asset trustline first when
101
+ * needed). Drives the transaction state machine. Mirrors {@link PollarClient.swap}.
102
+ */
103
+ swap: (quote: SwapQuote, opts?: {
104
+ autoTrustline?: boolean;
105
+ }) => Promise<SubmitOutcome>;
106
+ /** Open the swap modal. */
107
+ openSwapModal: () => void;
133
108
  openDistributionRulesModal: () => void;
134
109
  adapters?: PollarAdapters;
135
110
  }
@@ -150,17 +125,6 @@ interface PollarProviderProps {
150
125
  * `/applications/config` on mount.
151
126
  */
152
127
  appConfig?: PollarConfig;
153
- /** UI customization slots. */
154
- ui?: {
155
- /** Replaces the default Freighter/Albedo wallet picker. */
156
- renderWallets?: RenderWalletsSlot;
157
- /**
158
- * Custom login provider buttons (e.g. Privy) shown in the LoginModal. Each
159
- * must match a {@link PollarAuthProvider} registered on the client; clicking
160
- * one calls `client.login({ provider: id })` and the provider opens its own UI.
161
- */
162
- customProviders?: CustomLoginProvider[];
163
- };
164
128
  adapters?: PollarAdapters;
165
129
  /**
166
130
  * Notified when persistent storage silently degrades to in-memory mode
@@ -174,7 +138,7 @@ interface PollarProviderProps {
174
138
  onStorageDegrade?: OnStorageDegrade;
175
139
  children: ReactNode;
176
140
  }
177
- declare function PollarProvider({ client, appConfig: appConfigProp, ui, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
141
+ declare function PollarProvider({ client, appConfig: appConfigProp, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
178
142
  declare function usePollar(): PollarContextValue;
179
143
 
180
144
  type WrappedAdapter<T extends PollarAdapter> = {
@@ -253,6 +217,11 @@ interface SendModalProps {
253
217
  }
254
218
  declare function SendModal({ onClose }: SendModalProps): react_jsx_runtime.JSX.Element;
255
219
 
220
+ interface SwapModalProps {
221
+ onClose: () => void;
222
+ }
223
+ declare function SwapModal({ onClose }: SwapModalProps): react_jsx_runtime.JSX.Element;
224
+
256
225
  interface ReceiveModalProps {
257
226
  onClose: () => void;
258
227
  }
@@ -268,6 +237,14 @@ interface DistributionRulesModalProps {
268
237
  }
269
238
  declare function DistributionRulesModal({ onClose }: DistributionRulesModalProps): react_jsx_runtime.JSX.Element;
270
239
 
240
+ type WalletAdapterEntry = {
241
+ id: WalletId;
242
+ meta: {
243
+ label: string;
244
+ iconUrl?: string;
245
+ group?: string;
246
+ };
247
+ };
271
248
  interface LoginModalTemplateProps {
272
249
  theme: string;
273
250
  accentColor: string;
@@ -284,22 +261,18 @@ interface LoginModalTemplateProps {
284
261
  github: boolean;
285
262
  apple: boolean;
286
263
  };
287
- /** Custom login provider buttons (e.g. Privy). Each calls `onCustomLogin(id)`. */
288
- customProviders?: CustomLoginProvider[];
264
+ /** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy, …). */
265
+ walletAdapters: WalletAdapterEntry[];
289
266
  appName: string;
290
267
  email?: string;
291
268
  onEmailChange?: (email: string) => void;
292
269
  onEmailSubmit?: () => void;
293
270
  onSocialLogin?: (provider: 'google' | 'github') => void;
294
- /** Triggers a custom provider login by id (wraps `client.login({ provider: id })`). */
295
- onCustomLogin?: (id: string) => void;
296
271
  onWalletConnect?: (id: WalletId) => void;
297
272
  /** Log in with an existing passkey (returning user). */
298
273
  onLoginSmartWallet?: () => void;
299
274
  /** Create a new passkey + smart wallet (new user). */
300
275
  onCreateSmartWallet?: () => void;
301
- /** Optional override for the wallet picker view. Defaults to a Freighter+Albedo list. */
302
- renderWallets?: RenderWalletsSlot;
303
276
  authState: AuthState;
304
277
  codeInputKey?: number;
305
278
  onCodeSubmit?: (code: string) => void;
@@ -307,7 +280,7 @@ interface LoginModalTemplateProps {
307
280
  onCancel: () => void;
308
281
  onRetry: () => void;
309
282
  }
310
- declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, customProviders, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onCustomLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, renderWallets, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
283
+ declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
311
284
 
312
285
  type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
313
286
  interface KycModalTemplateProps {
@@ -325,7 +298,7 @@ interface KycModalTemplateProps {
325
298
  }
326
299
  declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
327
300
 
328
- type RampStep = 'input' | 'loading_quote' | 'select_route' | 'payment_instructions';
301
+ type RampStep = 'input' | 'loading_quote' | 'select_route' | 'status' | 'error';
329
302
  interface RampWidgetTemplateProps {
330
303
  theme: string;
331
304
  accentColor: string;
@@ -335,18 +308,26 @@ interface RampWidgetTemplateProps {
335
308
  currency: string;
336
309
  country: string;
337
310
  quotes: RampQuote[];
338
- paymentInstructions: PaymentInstructions | null;
339
311
  isLoading: boolean;
312
+ provider: string;
313
+ txStatus: RampTxStatus | null;
314
+ kycUrl: string | null;
315
+ stellarTxHash: string | null;
316
+ canComplete: boolean;
317
+ completing: boolean;
318
+ errorMsg: string | null;
340
319
  onDirectionChange: (d: RampDirection) => void;
341
320
  onAmountChange: (v: string) => void;
342
321
  onCurrencyChange: (v: string) => void;
343
322
  onCountryChange: (v: string) => void;
344
323
  onFindRoute: () => void;
345
324
  onSelectQuote: (q: RampQuote) => void;
346
- onCopy: (value: string) => void;
325
+ onOpenKyc: () => void;
326
+ onCompleteWithdraw: () => void;
327
+ onRetry: () => void;
347
328
  onClose: () => void;
348
329
  }
349
- declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes, paymentInstructions, isLoading, onDirectionChange, onAmountChange, onCurrencyChange, onCountryChange, onFindRoute, onSelectQuote, onCopy, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
330
+ declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onCurrencyChange, onCountryChange, onFindRoute, onSelectQuote, onOpenKyc, onCompleteWithdraw, onRetry, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
350
331
 
351
332
  interface TransactionModalTemplateProps {
352
333
  theme: string;
@@ -447,6 +428,53 @@ interface SendModalTemplateProps {
447
428
  }
448
429
  declare function SendModalTemplate({ theme, accentColor, step, txTitle, assets, selectedAsset, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onSelectAsset, onAmountChange, onDestinationChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
449
430
 
431
+ /** A selectable asset in the sell/buy pickers, normalized across balance/enabled records. */
432
+ interface SwapAssetOption {
433
+ ref: SwapQuoteParams['sellAsset'];
434
+ code: string;
435
+ issuer?: string | undefined;
436
+ available?: string | undefined;
437
+ enabledInApp?: boolean | undefined;
438
+ }
439
+ interface SwapModalTemplateProps {
440
+ theme: string;
441
+ accentColor: string;
442
+ step: 'form' | 'tx';
443
+ txTitle: string;
444
+ sellOptions: SwapAssetOption[];
445
+ buyOptions: SwapAssetOption[];
446
+ selectedSell: SwapAssetOption | null;
447
+ selectedBuy: SwapAssetOption | null;
448
+ amount: string;
449
+ provider: SwapProvider;
450
+ providers: SwapProvider[];
451
+ quote: SwapQuote | null;
452
+ quoteLoading: boolean;
453
+ quoteError: string;
454
+ formError: string;
455
+ isLoadingData: boolean;
456
+ smartUnsupported: boolean;
457
+ transaction: TransactionState;
458
+ showXdr: boolean;
459
+ copied: boolean;
460
+ explorerUrl: string | null;
461
+ walletType?: WalletId | null | undefined;
462
+ showBack: boolean;
463
+ isInProgress: boolean;
464
+ onClose: () => void;
465
+ onBack: () => void;
466
+ onSelectSell: (o: SwapAssetOption) => void;
467
+ onSelectBuy: (o: SwapAssetOption) => void;
468
+ onAmountChange: (value: string) => void;
469
+ onProviderChange: (p: SwapProvider) => void;
470
+ onSwap: () => void;
471
+ onToggleXdr: () => void;
472
+ onCopyHash: () => void;
473
+ onRetry: () => void;
474
+ onDone: () => void;
475
+ }
476
+ declare function SwapModalTemplate({ theme, accentColor, step, txTitle, sellOptions, buyOptions, selectedSell, selectedBuy, amount, provider, providers, quote, quoteLoading, quoteError, formError, isLoadingData, smartUnsupported, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onSelectSell, onSelectBuy, onAmountChange, onProviderChange, onSwap, onToggleXdr, onCopyHash, onRetry, onDone, }: SwapModalTemplateProps): react_jsx_runtime.JSX.Element;
477
+
450
478
  interface ReceiveModalTemplateProps {
451
479
  theme: string;
452
480
  accentColor: string;
@@ -483,4 +511,4 @@ interface DistributionRulesModalTemplateProps {
483
511
  }
484
512
  declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
485
513
 
486
- export { type AuthModalProps, type CustomLoginProvider, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, type RenderWalletsProps, type RenderWalletsSlot, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, createPollarAdapterHook, usePollar };
514
+ export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, createPollarAdapterHook, usePollar };
package/dist/index.d.ts CHANGED
@@ -1,46 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { WalletId, AuthState, pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, PollarAdapter, KycStatus as KycStatus$1, RampQuote, KycProvider, KycStartResponse, RampDirection, PaymentInstructions, EnabledAssetRecord, WalletBalanceRecord, DistributionRulesState, DistributionRule } from '@pollar/core';
2
+ import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, PollarLoginOptions, SessionsState, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapQuoteParams, SwapQuote, PollarAdapter, WalletId, KycStatus as KycStatus$1, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, RampTxStatus, EnabledAssetRecord, WalletBalanceRecord, SwapProvider, DistributionRulesState, DistributionRule } from '@pollar/core';
3
3
  export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  type ConfigResponse = pollarPaths['/applications/config']['get']['responses'][200]['content']['application/json'];
7
7
  type PollarConfig = ConfigResponse['content'];
8
8
  type PollarStyles = PollarConfig['styles'];
9
- /**
10
- * Props passed by `@pollar/react` to a `renderWallets` slot. External wallet
11
- * picker components receive these and call `onConnect(id)` when the user picks
12
- * a wallet; `@pollar/react` wraps that into `client.loginWallet(id)`.
13
- */
14
- interface RenderWalletsProps {
15
- /** Wrapper around `client.loginWallet(id)`. */
16
- onConnect: (id: WalletId) => void;
17
- /** Current auth state — picker can disable buttons / surface loading. */
18
- authState: AuthState;
19
- }
20
- /**
21
- * Signature for the `ui.renderWallets` slot on `<PollarProvider>`. When
22
- * provided, replaces the default Freighter/Albedo buttons in the LoginModal
23
- * with whatever the slot returns (typically a kit-powered wallet grid).
24
- */
25
- type RenderWalletsSlot = (props: RenderWalletsProps) => ReactNode;
26
- /**
27
- * Presentation metadata for a custom login provider button in the LoginModal
28
- * (e.g. Privy, Magic). Pairs with a {@link PollarAuthProvider} registered on the
29
- * client via its `providers` config: clicking the button calls
30
- * `client.login({ provider: id })`, and the provider opens its own UI.
31
- *
32
- * Logic (the actual login) lives in the `PollarAuthProvider`; this is only the
33
- * button's look. Keeping them separate means React never needs to know how a
34
- * provider authenticates.
35
- */
36
- interface CustomLoginProvider {
37
- /** Must match the `id` of a registered `PollarAuthProvider`. */
38
- id: string;
39
- /** Button label, e.g. "Continue with Privy". */
40
- label: string;
41
- /** Optional icon URL rendered in the button. */
42
- iconUrl?: string;
43
- }
44
9
  interface LoginButtonProps {
45
10
  onSuccess?: () => void;
46
11
  onError?: (error: Error) => void;
@@ -78,10 +43,6 @@ interface PollarContextValue {
78
43
  openSessionsModal: () => void;
79
44
  appConfig: PollarConfig;
80
45
  styles: PollarStyles;
81
- /** UI slot for wallet picker (forwarded from provider props). */
82
- renderWallets?: RenderWalletsSlot;
83
- /** Custom login provider buttons (forwarded from `ui.customProviders`). */
84
- customProviders?: CustomLoginProvider[];
85
46
  openTxModal: () => void;
86
47
  tx: TransactionState;
87
48
  buildTx: (operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']) => Promise<BuildOutcome>;
@@ -130,6 +91,20 @@ interface PollarContextValue {
130
91
  openWalletBalanceModal: () => void;
131
92
  openSendModal: () => void;
132
93
  openReceiveModal: () => void;
94
+ /**
95
+ * Quote an asset-to-asset swap across the requested venue(s). Read-only;
96
+ * returns quotes ranked best-first. Mirrors {@link PollarClient.getSwapQuote}.
97
+ */
98
+ getSwapQuote: (params: SwapQuoteParams) => Promise<SwapQuote[]>;
99
+ /**
100
+ * Execute a swap from a quote (establishes the buy-asset trustline first when
101
+ * needed). Drives the transaction state machine. Mirrors {@link PollarClient.swap}.
102
+ */
103
+ swap: (quote: SwapQuote, opts?: {
104
+ autoTrustline?: boolean;
105
+ }) => Promise<SubmitOutcome>;
106
+ /** Open the swap modal. */
107
+ openSwapModal: () => void;
133
108
  openDistributionRulesModal: () => void;
134
109
  adapters?: PollarAdapters;
135
110
  }
@@ -150,17 +125,6 @@ interface PollarProviderProps {
150
125
  * `/applications/config` on mount.
151
126
  */
152
127
  appConfig?: PollarConfig;
153
- /** UI customization slots. */
154
- ui?: {
155
- /** Replaces the default Freighter/Albedo wallet picker. */
156
- renderWallets?: RenderWalletsSlot;
157
- /**
158
- * Custom login provider buttons (e.g. Privy) shown in the LoginModal. Each
159
- * must match a {@link PollarAuthProvider} registered on the client; clicking
160
- * one calls `client.login({ provider: id })` and the provider opens its own UI.
161
- */
162
- customProviders?: CustomLoginProvider[];
163
- };
164
128
  adapters?: PollarAdapters;
165
129
  /**
166
130
  * Notified when persistent storage silently degrades to in-memory mode
@@ -174,7 +138,7 @@ interface PollarProviderProps {
174
138
  onStorageDegrade?: OnStorageDegrade;
175
139
  children: ReactNode;
176
140
  }
177
- declare function PollarProvider({ client, appConfig: appConfigProp, ui, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
141
+ declare function PollarProvider({ client, appConfig: appConfigProp, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
178
142
  declare function usePollar(): PollarContextValue;
179
143
 
180
144
  type WrappedAdapter<T extends PollarAdapter> = {
@@ -253,6 +217,11 @@ interface SendModalProps {
253
217
  }
254
218
  declare function SendModal({ onClose }: SendModalProps): react_jsx_runtime.JSX.Element;
255
219
 
220
+ interface SwapModalProps {
221
+ onClose: () => void;
222
+ }
223
+ declare function SwapModal({ onClose }: SwapModalProps): react_jsx_runtime.JSX.Element;
224
+
256
225
  interface ReceiveModalProps {
257
226
  onClose: () => void;
258
227
  }
@@ -268,6 +237,14 @@ interface DistributionRulesModalProps {
268
237
  }
269
238
  declare function DistributionRulesModal({ onClose }: DistributionRulesModalProps): react_jsx_runtime.JSX.Element;
270
239
 
240
+ type WalletAdapterEntry = {
241
+ id: WalletId;
242
+ meta: {
243
+ label: string;
244
+ iconUrl?: string;
245
+ group?: string;
246
+ };
247
+ };
271
248
  interface LoginModalTemplateProps {
272
249
  theme: string;
273
250
  accentColor: string;
@@ -284,22 +261,18 @@ interface LoginModalTemplateProps {
284
261
  github: boolean;
285
262
  apple: boolean;
286
263
  };
287
- /** Custom login provider buttons (e.g. Privy). Each calls `onCustomLogin(id)`. */
288
- customProviders?: CustomLoginProvider[];
264
+ /** Registered wallet adapters to render as buttons (Freighter, Albedo, Privy, …). */
265
+ walletAdapters: WalletAdapterEntry[];
289
266
  appName: string;
290
267
  email?: string;
291
268
  onEmailChange?: (email: string) => void;
292
269
  onEmailSubmit?: () => void;
293
270
  onSocialLogin?: (provider: 'google' | 'github') => void;
294
- /** Triggers a custom provider login by id (wraps `client.login({ provider: id })`). */
295
- onCustomLogin?: (id: string) => void;
296
271
  onWalletConnect?: (id: WalletId) => void;
297
272
  /** Log in with an existing passkey (returning user). */
298
273
  onLoginSmartWallet?: () => void;
299
274
  /** Create a new passkey + smart wallet (new user). */
300
275
  onCreateSmartWallet?: () => void;
301
- /** Optional override for the wallet picker view. Defaults to a Freighter+Albedo list. */
302
- renderWallets?: RenderWalletsSlot;
303
276
  authState: AuthState;
304
277
  codeInputKey?: number;
305
278
  onCodeSubmit?: (code: string) => void;
@@ -307,7 +280,7 @@ interface LoginModalTemplateProps {
307
280
  onCancel: () => void;
308
281
  onRetry: () => void;
309
282
  }
310
- declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, customProviders, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onCustomLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, renderWallets, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
283
+ declare function LoginModalTemplate({ theme, accentColor, logoUrl, emailEnabled, embeddedWallets, smartWallet, providers, walletAdapters, appName, email, onEmailChange, onEmailSubmit, onSocialLogin, onWalletConnect, onLoginSmartWallet, onCreateSmartWallet, authState, codeInputKey, onCodeSubmit, onBack, onCancel, onRetry, }: LoginModalTemplateProps): react_jsx_runtime.JSX.Element;
311
284
 
312
285
  type KycStep = 'select_provider' | 'verifying' | 'polling' | 'done';
313
286
  interface KycModalTemplateProps {
@@ -325,7 +298,7 @@ interface KycModalTemplateProps {
325
298
  }
326
299
  declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
327
300
 
328
- type RampStep = 'input' | 'loading_quote' | 'select_route' | 'payment_instructions';
301
+ type RampStep = 'input' | 'loading_quote' | 'select_route' | 'status' | 'error';
329
302
  interface RampWidgetTemplateProps {
330
303
  theme: string;
331
304
  accentColor: string;
@@ -335,18 +308,26 @@ interface RampWidgetTemplateProps {
335
308
  currency: string;
336
309
  country: string;
337
310
  quotes: RampQuote[];
338
- paymentInstructions: PaymentInstructions | null;
339
311
  isLoading: boolean;
312
+ provider: string;
313
+ txStatus: RampTxStatus | null;
314
+ kycUrl: string | null;
315
+ stellarTxHash: string | null;
316
+ canComplete: boolean;
317
+ completing: boolean;
318
+ errorMsg: string | null;
340
319
  onDirectionChange: (d: RampDirection) => void;
341
320
  onAmountChange: (v: string) => void;
342
321
  onCurrencyChange: (v: string) => void;
343
322
  onCountryChange: (v: string) => void;
344
323
  onFindRoute: () => void;
345
324
  onSelectQuote: (q: RampQuote) => void;
346
- onCopy: (value: string) => void;
325
+ onOpenKyc: () => void;
326
+ onCompleteWithdraw: () => void;
327
+ onRetry: () => void;
347
328
  onClose: () => void;
348
329
  }
349
- declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes, paymentInstructions, isLoading, onDirectionChange, onAmountChange, onCurrencyChange, onCountryChange, onFindRoute, onSelectQuote, onCopy, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
330
+ declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onCurrencyChange, onCountryChange, onFindRoute, onSelectQuote, onOpenKyc, onCompleteWithdraw, onRetry, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
350
331
 
351
332
  interface TransactionModalTemplateProps {
352
333
  theme: string;
@@ -447,6 +428,53 @@ interface SendModalTemplateProps {
447
428
  }
448
429
  declare function SendModalTemplate({ theme, accentColor, step, txTitle, assets, selectedAsset, amount, destination, formError, isLoadingBalance, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onSelectAsset, onAmountChange, onDestinationChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
449
430
 
431
+ /** A selectable asset in the sell/buy pickers, normalized across balance/enabled records. */
432
+ interface SwapAssetOption {
433
+ ref: SwapQuoteParams['sellAsset'];
434
+ code: string;
435
+ issuer?: string | undefined;
436
+ available?: string | undefined;
437
+ enabledInApp?: boolean | undefined;
438
+ }
439
+ interface SwapModalTemplateProps {
440
+ theme: string;
441
+ accentColor: string;
442
+ step: 'form' | 'tx';
443
+ txTitle: string;
444
+ sellOptions: SwapAssetOption[];
445
+ buyOptions: SwapAssetOption[];
446
+ selectedSell: SwapAssetOption | null;
447
+ selectedBuy: SwapAssetOption | null;
448
+ amount: string;
449
+ provider: SwapProvider;
450
+ providers: SwapProvider[];
451
+ quote: SwapQuote | null;
452
+ quoteLoading: boolean;
453
+ quoteError: string;
454
+ formError: string;
455
+ isLoadingData: boolean;
456
+ smartUnsupported: boolean;
457
+ transaction: TransactionState;
458
+ showXdr: boolean;
459
+ copied: boolean;
460
+ explorerUrl: string | null;
461
+ walletType?: WalletId | null | undefined;
462
+ showBack: boolean;
463
+ isInProgress: boolean;
464
+ onClose: () => void;
465
+ onBack: () => void;
466
+ onSelectSell: (o: SwapAssetOption) => void;
467
+ onSelectBuy: (o: SwapAssetOption) => void;
468
+ onAmountChange: (value: string) => void;
469
+ onProviderChange: (p: SwapProvider) => void;
470
+ onSwap: () => void;
471
+ onToggleXdr: () => void;
472
+ onCopyHash: () => void;
473
+ onRetry: () => void;
474
+ onDone: () => void;
475
+ }
476
+ declare function SwapModalTemplate({ theme, accentColor, step, txTitle, sellOptions, buyOptions, selectedSell, selectedBuy, amount, provider, providers, quote, quoteLoading, quoteError, formError, isLoadingData, smartUnsupported, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onSelectSell, onSelectBuy, onAmountChange, onProviderChange, onSwap, onToggleXdr, onCopyHash, onRetry, onDone, }: SwapModalTemplateProps): react_jsx_runtime.JSX.Element;
477
+
450
478
  interface ReceiveModalTemplateProps {
451
479
  theme: string;
452
480
  accentColor: string;
@@ -483,4 +511,4 @@ interface DistributionRulesModalTemplateProps {
483
511
  }
484
512
  declare function DistributionRulesModalTemplate({ theme, accentColor, state, claimingId, claimErrors, claimedIds, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
485
513
 
486
- export { type AuthModalProps, type CustomLoginProvider, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, type RenderWalletsProps, type RenderWalletsSlot, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, createPollarAdapterHook, usePollar };
514
+ export { type AuthModalProps, DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type PollarConfig, PollarProvider, type PollarStyles, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RouteDisplay, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, createPollarAdapterHook, usePollar };