@pollar/react 0.12.1-rc.6 → 0.12.1-rc.8

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,7 +1,37 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { pollarPaths, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, CosignCustody, PollarLoginOptions, SessionsState, CosignState, RecoveryState, CustodyMigrationState, PendingConfirmation, TransactionState, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuoteParams, SwapQuote, SolanaSwapVenue, SolanaSwapQuoteParams, SolanaSwapQuote, EarnProviderId, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, AuthEntryAdapterStep, AuthEntryAdapterOutcome, PasskeyCeremony, PasskeySigner, RecoveryPasskeyCeremony, WalletChain, PollarLanguage, CosignRequest, CosignVerification, CosignQuorumReport, CosignDevicesContent, KycStatus as KycStatus$1, RampQuoteRejection, RampQuoteRequirement, RampWalletStep, RampQuote, WalletId, AuthState, KycProvider, KycStartResponse, RampDirection, RampFiat, RampAsset, RampField, RampOrder, EnabledAssetRecord, WalletBalanceRecord, DistributionRulesState, DistributionRule } from '@pollar/core';
2
+ import { WalletChain, pollarPaths, WalletBalanceRecord, TransactionState, WalletId, PollarLanguage, SwapQuoteParams, BridgeChain, BridgeTransfer, EarnProviderId, CardFundingChain, CardFunding, PollarClient, PollarClientConfig, PollarAdapters, OnStorageDegrade, WalletInfo, CosignCustody, PollarLoginOptions, SessionsState, CosignState, RecoveryState, CustodyMigrationState, PendingConfirmation, TxBuildBody, BuildOutcome, SubmitOutcome, SignOutcome, SendPaymentParams, StellarNetwork, WalletBalanceState, EnabledAssetsState, TrustlineOutcome, TxHistoryState, SwapVenue, SwapToken, SwapQuote, SolanaSwapVenue, SolanaSwapQuoteParams, SolanaSwapQuote, EarnOpportunity, EarnPositionParams, EarnPosition, EarnTxParams, PollarAdapter, AuthEntryAdapterStep, AuthEntryAdapterOutcome, PasskeyCeremony, PasskeySigner, RecoveryPasskeyCeremony, CosignRequest, CosignVerification, CosignQuorumReport, CosignDevicesContent, KycStatus as KycStatus$1, RampQuoteRejection, RampQuoteRequirement, RampWalletStep, RampQuote, AuthState, KycProvider, KycStartResponse, RampDirection, RampFiat, RampAsset, RampField, RampOrder, EnabledAssetRecord, BridgeQuote, DistributionRulesState, DistributionRule } from '@pollar/core';
3
3
  export { AuthProviderContext, PollarAuthProvider, SessionsState } from '@pollar/core';
4
- import { ReactNode, CSSProperties } from 'react';
4
+ import { CSSProperties, ReactNode } from 'react';
5
+
6
+ /** Where the ramp widget opens: a starting point the user can change, never a lock. */
7
+ interface RampModalOptions {
8
+ direction?: 'buy' | 'sell';
9
+ /** ISO 3166-1 alpha-2, e.g. 'BR'. */
10
+ country?: string;
11
+ /** e.g. 'BRL'; the country's first fiat when left out or not offered there. */
12
+ fiat?: string;
13
+ /** e.g. 'USDC'. */
14
+ asset?: string;
15
+ amount?: string;
16
+ }
17
+ interface RampWidgetProps {
18
+ onClose: () => void;
19
+ /** Initial direction, country, fiat, asset and amount. A country that does not route in that direction opens on the defaults. */
20
+ initial?: RampModalOptions | undefined;
21
+ /** Language of the widget and the steps it opens, as a BCP 47 tag. A language pinned in the dashboard wins over it. */
22
+ language?: string | undefined;
23
+ }
24
+ declare function RampWidget({ onClose, language: languageProp, initial }: RampWidgetProps): react_jsx_runtime.JSX.Element;
25
+
26
+ /** Where the receive modal opens: the network whose address it shows. A network the app does not offer is left out. */
27
+ interface ReceiveModalOptions {
28
+ chain?: WalletChain;
29
+ }
30
+ interface ReceiveModalProps {
31
+ onClose: () => void;
32
+ initial?: ReceiveModalOptions | undefined;
33
+ }
34
+ declare function ReceiveModal({ onClose, initial }: ReceiveModalProps): react_jsx_runtime.JSX.Element;
5
35
 
6
36
  type ConfigResponse = pollarPaths['/applications/config']['get']['responses'][200]['content']['application/json'];
7
37
  type PollarConfig = ConfigResponse['content'];
@@ -18,6 +48,315 @@ interface AuthModalProps {
18
48
  onSuccess?: () => void;
19
49
  }
20
50
 
51
+ /** Per-app overrides for the modal chrome, configured in the dashboard's
52
+ * Branding screen. Every field is optional: absent means "use the value the
53
+ * theme derives", which is what every modal rendered before these existed. */
54
+ interface ModalStyleOverrides {
55
+ /** Card background. Overrides the theme's white / #1a1a1a. */
56
+ backgroundColor?: string | null | undefined;
57
+ /** Body text. Overrides the theme's #111827 / white. With a background or a
58
+ * text color set, borders, secondary ("muted") text and input fills are
59
+ * blended from the pair instead of taken from the theme. */
60
+ textColor?: string | null | undefined;
61
+ /** Fill of the SECONDARY buttons (the wallet / social / provider entries, the
62
+ * retry button). The primary button is the accent's job. Unset => the theme's
63
+ * own surface color, which is what these buttons always used. */
64
+ buttonColor?: string | null | undefined;
65
+ /** Radius of the modal card itself, in px. */
66
+ modalBorderRadius?: number | null | undefined;
67
+ /** Radius of the buttons inside the modal, in px. Independent of the card's. */
68
+ buttonBorderRadius?: number | null | undefined;
69
+ }
70
+ /** Text color that stays legible on `background`. The primary button's label was
71
+ * hardcoded white, which a light fill (the Amber accent preset, say) turns
72
+ * invisible - so it follows the fill's luminance instead. Unparseable colors
73
+ * keep white, the pre-existing behavior. */
74
+ declare function readableTextOn(background: string): string;
75
+ /** How much room a modal gives its header. 'hero' is the identity-forward set
76
+ * (login, KYC, ramp, the Privy sub-modal): roomier padding and a larger
77
+ * centered heading. 'compact' is every utility modal (send, balance, history,
78
+ * ...), which keeps the card's own 1.75rem padding. */
79
+ type ModalVariant = 'hero' | 'compact';
80
+ /** The app's Branding as inline CSS custom properties for a Pollar root (a modal
81
+ * card, the wallet button).
82
+ *
83
+ * Everything is written under the private `--pollar-brand-*` names, never the
84
+ * public `--pollar-*` ones: `shared.css` maps brand onto public inside a
85
+ * zero-specificity `:where()`, so a host stylesheet that sets a public variable
86
+ * on a Pollar root beats the Branding, and the Branding beats the theme
87
+ * defaults. An inline `--pollar-*` would beat every stylesheet instead.
88
+ *
89
+ * The palette (background, text, borders, status colors) is only written when
90
+ * the app pinned it: a dark theme, or a background or text color of its own.
91
+ * Left out, the light defaults in `shared.css` apply, and a host `html.dark`
92
+ * swaps them for the dark ones. */
93
+ declare function buildModalCssVars(theme: string, accentColor: string, overrides?: ModalStyleOverrides, variant?: ModalVariant): CSSProperties;
94
+ /** Everything a modal wrapper needs to dress itself from the app's branding:
95
+ * the theme pair its template already took, the overrides to forward to that
96
+ * template, and the inline style for the fixed overlay behind it. */
97
+ interface ModalChrome {
98
+ theme: string;
99
+ accentColor: string;
100
+ styleOverrides: ModalStyleOverrides;
101
+ overlayStyle: CSSProperties;
102
+ }
103
+ /** Resolve the branding config into the props/styles a modal wrapper applies.
104
+ * Called by every `.pollar-overlay` renderer so the z-index and the card
105
+ * overrides can't drift apart between modals. */
106
+ declare function modalChrome(styles: PollarStyles): ModalChrome;
107
+
108
+ /** The memo types the backend accepts on a Stellar payment. */
109
+ type SendMemoType = 'text' | 'id' | 'hash';
110
+ interface SendModalTemplateProps {
111
+ theme: string;
112
+ accentColor: string;
113
+ /** Per-app modal chrome overrides (background, card + button radius). */
114
+ styleOverrides?: ModalStyleOverrides;
115
+ /**
116
+ * `create-account`: the Stellar destination has no account yet, so the user
117
+ * chooses between creating it with the XLM being sent and waiting for someone
118
+ * else to fund it.
119
+ */
120
+ step: 'form' | 'create-account' | 'tx';
121
+ txTitle: string;
122
+ assets: WalletBalanceRecord[];
123
+ selectedAsset: WalletBalanceRecord | null;
124
+ selectedChain: WalletChain | null;
125
+ /**
126
+ * The networks the user can send from, in the app's configured order. The
127
+ * picker renders only with two or more, so a single-chain app shows none.
128
+ */
129
+ chains?: WalletChain[];
130
+ /** @deprecated The sender address is not shown; kept so existing templates compile. */
131
+ walletAddress?: string;
132
+ /** Can a payment be built on {@link selectedChain}? Stellar and Solana only. */
133
+ canSendOnChain: boolean;
134
+ /**
135
+ * Why the wallet cannot act on-chain right now (its Stellar account is still
136
+ * being created, or its creation failed), or null when it can.
137
+ *
138
+ * Separate from {@link canSendOnChain}: that one is about the NETWORK not
139
+ * having a transfer path, this one about the user's own account. Collapsing
140
+ * them would tell someone waiting on a brand-new wallet that Stellar does not
141
+ * support sending. Optional, so a custom template that does not read it keeps
142
+ * compiling.
143
+ */
144
+ notReadyReason?: string | null;
145
+ onSelectChain?: (chain: WalletChain) => void;
146
+ amount: string;
147
+ destination: string;
148
+ formError: string;
149
+ isLoadingBalance: boolean;
150
+ /** The destination's account is being looked up; the form waits for it. */
151
+ isCheckingDestination?: boolean;
152
+ /** The least XLM a new Stellar account can start with. */
153
+ minStartingBalance?: number;
154
+ /** Builds a `create_account` for the destination, funded with the amount. Required for the `create-account` step. */
155
+ onCreateAccount?: () => void;
156
+ transaction: TransactionState;
157
+ showXdr: boolean;
158
+ copied: boolean;
159
+ explorerUrl: string | null;
160
+ walletType?: WalletId | null | undefined;
161
+ showBack: boolean;
162
+ isInProgress: boolean;
163
+ onClose: () => void;
164
+ onBack: () => void;
165
+ onRefresh: () => void;
166
+ onSelectAsset: (asset: WalletBalanceRecord) => void;
167
+ onAmountChange: (value: string) => void;
168
+ onMax: () => void;
169
+ onPaste: () => void;
170
+ onDestinationChange: (value: string) => void;
171
+ /**
172
+ * Optional Stellar memo. The field renders only on Stellar and only when
173
+ * {@link onMemoChange} is passed, so a custom template without a memo field
174
+ * keeps compiling.
175
+ */
176
+ memo?: string;
177
+ memoType?: SendMemoType;
178
+ onMemoChange?: (value: string) => void;
179
+ onMemoTypeChange?: (type: SendMemoType) => void;
180
+ onSubmit: () => void;
181
+ onSignAndSend: () => void;
182
+ onToggleXdr: () => void;
183
+ onCopyHash: () => void;
184
+ onRetry: () => void;
185
+ onDone: () => void;
186
+ /** Language of the modal. Defaults to the user's device; the modal passes the resolved one. */
187
+ language?: PollarLanguage | undefined;
188
+ }
189
+ declare function SendModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, assets, selectedAsset, selectedChain, canSendOnChain, notReadyReason, chains, onSelectChain, amount, destination, formError, isLoadingBalance, isCheckingDestination, minStartingBalance, onCreateAccount, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectAsset, onAmountChange, onMax, onPaste, onDestinationChange, memo, memoType, onMemoChange, onMemoTypeChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, language: languageProp, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
190
+
191
+ /** Where the send modal opens: a starting point the user can change. An option the wallet cannot use is left out. */
192
+ interface SendModalOptions {
193
+ chain?: WalletChain;
194
+ /** Asset code, e.g. 'USDC'. */
195
+ asset?: string;
196
+ destination?: string;
197
+ amount?: string;
198
+ memo?: string;
199
+ memoType?: SendMemoType;
200
+ /** Called once the payment lands, with its transaction hash. */
201
+ onSuccess?: (result: {
202
+ hash: string;
203
+ }) => void;
204
+ }
205
+ interface SendModalProps {
206
+ onClose: () => void;
207
+ initial?: SendModalOptions | undefined;
208
+ }
209
+ declare function SendModal({ onClose, initial }: SendModalProps): react_jsx_runtime.JSX.Element;
210
+
211
+ /** The chain a swap runs on; the modal shows a selector when the app offers both. */
212
+ type SwapChain = 'STELLAR' | 'SOLANA';
213
+ interface SwapAssetOption {
214
+ /** Stellar: the asset ref the quote takes. */
215
+ ref?: SwapQuoteParams['sellAsset'] | undefined;
216
+ code: string;
217
+ /** Stellar: the issuer. Solana: the mint (wrapped SOL for SOL). */
218
+ issuer?: string | undefined;
219
+ /** Solana: the mint's decimals, to turn a decimal amount into base units. */
220
+ decimals?: number | undefined;
221
+ available?: string | undefined;
222
+ enabledInApp?: boolean | undefined;
223
+ }
224
+ /** A quote as the form shows it, whichever chain priced it: decimal amounts. */
225
+ interface SwapQuoteView {
226
+ provider: string;
227
+ amountOut: string;
228
+ minReceived: string;
229
+ /** Percent; null when the venue does not report it. */
230
+ priceImpactPct: string | null;
231
+ }
232
+ interface SwapModalTemplateProps {
233
+ theme: string;
234
+ accentColor: string;
235
+ styleOverrides?: ModalStyleOverrides;
236
+ step: 'form' | 'tx';
237
+ txTitle: string;
238
+ sellOptions: SwapAssetOption[];
239
+ buyOptions: SwapAssetOption[];
240
+ selectedSell: SwapAssetOption | null;
241
+ selectedBuy: SwapAssetOption | null;
242
+ amount: string;
243
+ /** The chains the app offers swaps on; a selector shows when there are two. */
244
+ chains: SwapChain[];
245
+ chain: SwapChain;
246
+ provider: string;
247
+ providers: string[];
248
+ quote: SwapQuoteView | null;
249
+ quoteLoading: boolean;
250
+ quoteError: string;
251
+ formError: string;
252
+ isLoadingData: boolean;
253
+ smartUnsupported: boolean;
254
+ configLoading: boolean;
255
+ swapUnavailable: boolean;
256
+ buyNeedsTrustline: boolean;
257
+ transaction: TransactionState;
258
+ showXdr: boolean;
259
+ copied: boolean;
260
+ explorerUrl: string | null;
261
+ walletType?: WalletId | null | undefined;
262
+ showBack: boolean;
263
+ isInProgress: boolean;
264
+ /** Language of the modal's text; the device's when not given. */
265
+ language?: PollarLanguage | undefined;
266
+ onClose: () => void;
267
+ onBack: () => void;
268
+ onRefresh: () => void;
269
+ onSelectSell: (o: SwapAssetOption) => void;
270
+ onSelectBuy: (o: SwapAssetOption) => void;
271
+ onReverse: () => void;
272
+ onMax: () => void;
273
+ onAddCustomToken: (code: string, issuer: string) => string | null;
274
+ onAmountChange: (value: string) => void;
275
+ onChainChange: (chain: SwapChain) => void;
276
+ onProviderChange: (p: string) => void;
277
+ onSwap: () => void;
278
+ onToggleXdr: () => void;
279
+ onCopyHash: () => void;
280
+ onRetry: () => void;
281
+ onDone: () => void;
282
+ }
283
+ declare function SwapModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, sellOptions, buyOptions, selectedSell, selectedBuy, amount, chains, chain, provider, providers, quote, quoteLoading, quoteError, formError, isLoadingData, smartUnsupported, configLoading, swapUnavailable, buyNeedsTrustline, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, language: languageProp, onClose, onBack, onRefresh, onSelectSell, onSelectBuy, onAddCustomToken, onReverse, onMax, onAmountChange, onChainChange, onProviderChange, onSwap, onToggleXdr, onCopyHash, onRetry, onDone, }: SwapModalTemplateProps): react_jsx_runtime.JSX.Element;
284
+
285
+ /** Where the swap modal opens: a starting point the user can change. An option the app does not offer is left out. */
286
+ interface SwapModalOptions {
287
+ chain?: SwapChain;
288
+ /** Code of the asset sold, e.g. 'XLM'. */
289
+ sell?: string;
290
+ /** Code of the asset bought, e.g. 'USDC'. */
291
+ buy?: string;
292
+ amount?: string;
293
+ /** Called once the swap lands, with its transaction hash. */
294
+ onSuccess?: (result: {
295
+ hash: string;
296
+ }) => void;
297
+ }
298
+ interface SwapModalProps {
299
+ onClose: () => void;
300
+ initial?: SwapModalOptions | undefined;
301
+ }
302
+ declare function SwapModal({ onClose, initial }: SwapModalProps): react_jsx_runtime.JSX.Element;
303
+
304
+ /** Where the bridge modal opens: a starting point the user can change, never a lock. */
305
+ interface BridgeModalOptions {
306
+ /** Used only when the user can bridge from that chain. */
307
+ fromChain?: BridgeChain;
308
+ /** Used only when the user can bridge to it from the chain the modal opens on. */
309
+ toChain?: BridgeChain;
310
+ /** USDC, e.g. '25'. */
311
+ amount?: string;
312
+ /** Called once the USDC arrives on the destination, with the completed transfer. */
313
+ onSuccess?: (transfer: BridgeTransfer) => void;
314
+ }
315
+ interface BridgeModalProps {
316
+ onClose: () => void;
317
+ initial?: BridgeModalOptions | undefined;
318
+ }
319
+ declare function BridgeModal({ onClose, initial }: BridgeModalProps): react_jsx_runtime.JSX.Element;
320
+
321
+ /** Where the earn modal opens: a starting point the user can change. An option the app does not offer is left out. */
322
+ interface EarnModalOptions {
323
+ provider?: EarnProviderId;
324
+ /** The vault or pool, as `getEarnOpportunities` names it. */
325
+ opportunityId?: string;
326
+ tab?: 'deposit' | 'withdraw';
327
+ amount?: string;
328
+ /** Called once the deposit or withdrawal lands, with its transaction hash. */
329
+ onSuccess?: (result: {
330
+ hash: string;
331
+ }) => void;
332
+ }
333
+ interface EarnModalProps {
334
+ onClose: () => void;
335
+ initial?: EarnModalOptions | undefined;
336
+ }
337
+ declare function EarnModal({ onClose, initial }: EarnModalProps): react_jsx_runtime.JSX.Element;
338
+
339
+ /** Where the card modal opens: a starting point the user can change. An option the user cannot use is left out. */
340
+ interface CardModalOptions {
341
+ /** 'fund' opens the funding panel once the user's card has loaded; a user without a card stays on the card screen. */
342
+ panel?: 'fund';
343
+ amount?: string;
344
+ /** Network to fund from, when it is one the user can fund from. */
345
+ chain?: CardFundingChain;
346
+ /** Called with each funding the user sends from the modal. */
347
+ onFunded?: (funding: CardFunding) => void;
348
+ }
349
+ interface CardModalProps {
350
+ onClose: () => void;
351
+ initial?: CardModalOptions | undefined;
352
+ }
353
+ declare function CardModal({ onClose, initial }: CardModalProps): react_jsx_runtime.JSX.Element;
354
+
355
+ /** Where the history opens: the network whose transactions it lists. A network the app does not offer is left out. */
356
+ interface TxHistoryModalOptions {
357
+ chain?: WalletChain;
358
+ }
359
+
21
360
  interface PollarContextValue {
22
361
  /**
23
362
  * The authenticated user's wallet as a discriminated union over `custody`
@@ -153,12 +492,16 @@ interface PollarContextValue {
153
492
  level?: 'basic' | 'intermediate' | 'enhanced';
154
493
  onApproved?: () => void;
155
494
  }) => void;
156
- openRampModal: () => void;
495
+ /** Opens the ramp widget, on the direction, country, fiat, asset and amount given; without options, on its defaults. */
496
+ openRampModal: (options?: RampModalOptions) => void;
157
497
  txHistory: TxHistoryState;
158
- openTxHistoryModal: () => void;
498
+ /** Opens the history, on the network given; without options, on the app's first network. */
499
+ openTxHistoryModal: (options?: TxHistoryModalOptions) => void;
159
500
  openWalletBalanceModal: () => void;
160
- openSendModal: () => void;
161
- openReceiveModal: () => void;
501
+ /** Opens the send modal, prefilled with the options given; `onSuccess` hears the payment land. */
502
+ openSendModal: (options?: SendModalOptions) => void;
503
+ /** Opens the receive modal, on the network given. */
504
+ openReceiveModal: (options?: ReceiveModalOptions) => void;
162
505
  /**
163
506
  * The swap venues this app exposes to end-users (empty = swap disabled, hide
164
507
  * swap UI). Mirrors {@link PollarClient.getSwapConfig}.
@@ -190,7 +533,10 @@ interface PollarContextValue {
190
533
  slippageBps?: number;
191
534
  }) => Promise<SubmitOutcome>;
192
535
  /** Open the swap modal. */
193
- openSwapModal: () => void;
536
+ /** Opens the swap modal, on the network, assets and amount given; `onSuccess` hears the swap land. */
537
+ openSwapModal: (options?: SwapModalOptions) => void;
538
+ /** Opens the modal that moves USDC between the user's wallets on different networks (mainnet), on the direction and amount given; `onSuccess` hears the USDC arrive. */
539
+ openBridgeModal: (options?: BridgeModalOptions) => void;
194
540
  /**
195
541
  * The yield providers this app exposes to end-users (empty = Earn disabled,
196
542
  * hide Earn UI). Mirrors {@link PollarClient.getEarnProviders}.
@@ -217,13 +563,15 @@ interface PollarContextValue {
217
563
  */
218
564
  earnWithdraw: (params: EarnTxParams) => Promise<SubmitOutcome>;
219
565
  /** Open the Earn modal. */
220
- openEarnModal: () => void;
566
+ /** Opens the earn modal, on the provider, opportunity, tab and amount given; `onSuccess` hears the transaction land. */
567
+ openEarnModal: (options?: EarnModalOptions) => void;
221
568
  /**
222
569
  * Open the Cards modal: sign-up, identity verification, issuing, the card
223
570
  * itself and its activity. The card calls live on {@link PollarClient}
224
571
  * (`getCardProviders`, `issueCard`, `revealCardSecrets`, ...).
225
572
  */
226
- openCardModal: () => void;
573
+ /** Opens the card modal, on its funding panel when asked; `onFunded` hears each funding sent. */
574
+ openCardModal: (options?: CardModalOptions) => void;
227
575
  openDistributionRulesModal: () => void;
228
576
  adapters?: PollarAdapters;
229
577
  }
@@ -242,6 +590,14 @@ interface PollarProviderProps {
242
590
  * always kept.
243
591
  */
244
592
  client: PollarClient | PollarClientConfig;
593
+ /**
594
+ * Language of the modals, a BCP 47 tag such as `'es'` or `'pt-BR'`: typically
595
+ * the app's current language. Unlike `client`, it is followed on every render,
596
+ * so open modals switch when it changes. It wins over the client's `locale`; a
597
+ * language pinned in the dashboard wins over it, and a tag the modals have no
598
+ * translation for is skipped.
599
+ */
600
+ language?: string | undefined;
245
601
  /**
246
602
  * Local REPLACEMENT for the `/applications/config` response, not a patch over
247
603
  * it. Passing anything at all skips the remote fetch entirely; what you pass
@@ -281,7 +637,7 @@ interface PollarProviderProps {
281
637
  onStorageDegrade?: OnStorageDegrade;
282
638
  children: ReactNode;
283
639
  }
284
- declare function PollarProvider({ client, appConfig: appConfigProp, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
640
+ declare function PollarProvider({ client, language, appConfig: appConfigProp, adapters, onStorageDegrade, children, }: PollarProviderProps): react_jsx_runtime.JSX.Element;
285
641
  declare function usePollar(): PollarContextValue;
286
642
 
287
643
  /** A transaction adapter answers with the submit; an auth-entry one with what its `complete` returned. */
@@ -346,63 +702,6 @@ declare function walletNotReadyReason(wallet: WalletInfo | null | undefined, cha
346
702
 
347
703
  declare function WalletButton(): react_jsx_runtime.JSX.Element;
348
704
 
349
- /** Per-app overrides for the modal chrome, configured in the dashboard's
350
- * Branding screen. Every field is optional: absent means "use the value the
351
- * theme derives", which is what every modal rendered before these existed. */
352
- interface ModalStyleOverrides {
353
- /** Card background. Overrides the theme's white / #1a1a1a. */
354
- backgroundColor?: string | null | undefined;
355
- /** Body text. Overrides the theme's #111827 / white. With a background or a
356
- * text color set, borders, secondary ("muted") text and input fills are
357
- * blended from the pair instead of taken from the theme. */
358
- textColor?: string | null | undefined;
359
- /** Fill of the SECONDARY buttons (the wallet / social / provider entries, the
360
- * retry button). The primary button is the accent's job. Unset => the theme's
361
- * own surface color, which is what these buttons always used. */
362
- buttonColor?: string | null | undefined;
363
- /** Radius of the modal card itself, in px. */
364
- modalBorderRadius?: number | null | undefined;
365
- /** Radius of the buttons inside the modal, in px. Independent of the card's. */
366
- buttonBorderRadius?: number | null | undefined;
367
- }
368
- /** Text color that stays legible on `background`. The primary button's label was
369
- * hardcoded white, which a light fill (the Amber accent preset, say) turns
370
- * invisible - so it follows the fill's luminance instead. Unparseable colors
371
- * keep white, the pre-existing behavior. */
372
- declare function readableTextOn(background: string): string;
373
- /** How much room a modal gives its header. 'hero' is the identity-forward set
374
- * (login, KYC, ramp, the Privy sub-modal): roomier padding and a larger
375
- * centered heading. 'compact' is every utility modal (send, balance, history,
376
- * ...), which keeps the card's own 1.75rem padding. */
377
- type ModalVariant = 'hero' | 'compact';
378
- /** The app's Branding as inline CSS custom properties for a Pollar root (a modal
379
- * card, the wallet button).
380
- *
381
- * Everything is written under the private `--pollar-brand-*` names, never the
382
- * public `--pollar-*` ones: `shared.css` maps brand onto public inside a
383
- * zero-specificity `:where()`, so a host stylesheet that sets a public variable
384
- * on a Pollar root beats the Branding, and the Branding beats the theme
385
- * defaults. An inline `--pollar-*` would beat every stylesheet instead.
386
- *
387
- * The palette (background, text, borders, status colors) is only written when
388
- * the app pinned it: a dark theme, or a background or text color of its own.
389
- * Left out, the light defaults in `shared.css` apply, and a host `html.dark`
390
- * swaps them for the dark ones. */
391
- declare function buildModalCssVars(theme: string, accentColor: string, overrides?: ModalStyleOverrides, variant?: ModalVariant): CSSProperties;
392
- /** Everything a modal wrapper needs to dress itself from the app's branding:
393
- * the theme pair its template already took, the overrides to forward to that
394
- * template, and the inline style for the fixed overlay behind it. */
395
- interface ModalChrome {
396
- theme: string;
397
- accentColor: string;
398
- styleOverrides: ModalStyleOverrides;
399
- overlayStyle: CSSProperties;
400
- }
401
- /** Resolve the branding config into the props/styles a modal wrapper applies.
402
- * Called by every `.pollar-overlay` renderer so the z-index and the card
403
- * overrides can't drift apart between modals. */
404
- declare function modalChrome(styles: PollarStyles): ModalChrome;
405
-
406
705
  interface WalletButtonTemplateProps {
407
706
  walletAddress: string | null;
408
707
  theme: string;
@@ -641,13 +940,6 @@ interface KycStatusProps {
641
940
  }
642
941
  declare function KycStatus({ status, label, className, language: languageProp }: KycStatusProps): react_jsx_runtime.JSX.Element;
643
942
 
644
- interface RampWidgetProps {
645
- onClose: () => void;
646
- /** Language of the widget and the steps it opens, as a BCP 47 tag. A language pinned in the dashboard wins over it. */
647
- language?: string | undefined;
648
- }
649
- declare function RampWidget({ onClose, language: languageProp }: RampWidgetProps): react_jsx_runtime.JSX.Element;
650
-
651
943
  interface RouteDisplayProps {
652
944
  quote: RampQuote;
653
945
  /** The first quote: the most received (or least sent) for the amount. */
@@ -702,31 +994,6 @@ interface EnabledAssetsModalProps {
702
994
  }
703
995
  declare function EnabledAssetsModal({ onClose }: EnabledAssetsModalProps): react_jsx_runtime.JSX.Element;
704
996
 
705
- interface SendModalProps {
706
- onClose: () => void;
707
- }
708
- declare function SendModal({ onClose }: SendModalProps): react_jsx_runtime.JSX.Element;
709
-
710
- interface SwapModalProps {
711
- onClose: () => void;
712
- }
713
- declare function SwapModal({ onClose }: SwapModalProps): react_jsx_runtime.JSX.Element;
714
-
715
- interface EarnModalProps {
716
- onClose: () => void;
717
- }
718
- declare function EarnModal({ onClose }: EarnModalProps): react_jsx_runtime.JSX.Element;
719
-
720
- interface CardModalProps {
721
- onClose: () => void;
722
- }
723
- declare function CardModal({ onClose }: CardModalProps): react_jsx_runtime.JSX.Element;
724
-
725
- interface ReceiveModalProps {
726
- onClose: () => void;
727
- }
728
- declare function ReceiveModal({ onClose }: ReceiveModalProps): react_jsx_runtime.JSX.Element;
729
-
730
997
  interface SessionsModalProps {
731
998
  onClose: () => void;
732
999
  }
@@ -1074,162 +1341,43 @@ interface CustomTrustlineModalTemplateProps {
1074
1341
  language?: PollarLanguage | undefined;
1075
1342
  }
1076
1343
 
1077
- /** The memo types the backend accepts on a Stellar payment. */
1078
- type SendMemoType = 'text' | 'id' | 'hash';
1079
- interface SendModalTemplateProps {
1344
+ type BridgeModalStep = 'loading' | 'unavailable' | 'form' | 'transfer';
1345
+ interface BridgeModalTemplateProps {
1080
1346
  theme: string;
1081
1347
  accentColor: string;
1082
- /** Per-app modal chrome overrides (background, card + button radius). */
1083
1348
  styleOverrides?: ModalStyleOverrides;
1084
- /**
1085
- * `create-account`: the Stellar destination has no account yet, so the user
1086
- * chooses between creating it with the XLM being sent and waiting for someone
1087
- * else to fund it.
1088
- */
1089
- step: 'form' | 'create-account' | 'tx';
1090
- txTitle: string;
1091
- assets: WalletBalanceRecord[];
1092
- selectedAsset: WalletBalanceRecord | null;
1093
- selectedChain: WalletChain | null;
1094
- /**
1095
- * The networks the user can send from, in the app's configured order. The
1096
- * picker renders only with two or more, so a single-chain app shows none.
1097
- */
1098
- chains?: WalletChain[];
1099
- /** @deprecated The sender address is not shown; kept so existing templates compile. */
1100
- walletAddress?: string;
1101
- /** Can a payment be built on {@link selectedChain}? Stellar and Solana only. */
1102
- canSendOnChain: boolean;
1103
- /**
1104
- * Why the wallet cannot act on-chain right now (its Stellar account is still
1105
- * being created, or its creation failed), or null when it can.
1106
- *
1107
- * Separate from {@link canSendOnChain}: that one is about the NETWORK not
1108
- * having a transfer path, this one about the user's own account. Collapsing
1109
- * them would tell someone waiting on a brand-new wallet that Stellar does not
1110
- * support sending. Optional, so a custom template that does not read it keeps
1111
- * compiling.
1112
- */
1113
- notReadyReason?: string | null;
1114
- onSelectChain?: (chain: WalletChain) => void;
1349
+ step: BridgeModalStep;
1350
+ /** Why the form is not offered: off mainnet, or no pair of wallets to bridge between. */
1351
+ unavailableReason: 'mainnet_only' | 'no_directions' | null;
1352
+ sources: BridgeChain[];
1353
+ targets: BridgeChain[];
1354
+ fromChain: BridgeChain | null;
1355
+ toChain: BridgeChain | null;
1356
+ onFromChange: (chain: BridgeChain) => void;
1357
+ onToChange: (chain: BridgeChain) => void;
1115
1358
  amount: string;
1116
- destination: string;
1117
- formError: string;
1118
- isLoadingBalance: boolean;
1119
- /** The destination's account is being looked up; the form waits for it. */
1120
- isCheckingDestination?: boolean;
1121
- /** The least XLM a new Stellar account can start with. */
1122
- minStartingBalance?: number;
1123
- /** Builds a `create_account` for the destination, funded with the amount. Required for the `create-account` step. */
1124
- onCreateAccount?: () => void;
1125
- transaction: TransactionState;
1126
- showXdr: boolean;
1127
- copied: boolean;
1128
- explorerUrl: string | null;
1129
- walletType?: WalletId | null | undefined;
1130
- showBack: boolean;
1131
- isInProgress: boolean;
1132
- onClose: () => void;
1133
- onBack: () => void;
1134
- onRefresh: () => void;
1135
- onSelectAsset: (asset: WalletBalanceRecord) => void;
1136
- onAmountChange: (value: string) => void;
1359
+ onAmountChange: (amount: string) => void;
1360
+ /** USDC available on `fromChain`; null while unknown. */
1361
+ balance: string | null;
1137
1362
  onMax: () => void;
1138
- onPaste: () => void;
1139
- onDestinationChange: (value: string) => void;
1140
- /**
1141
- * Optional Stellar memo. The field renders only on Stellar and only when
1142
- * {@link onMemoChange} is passed, so a custom template without a memo field
1143
- * keeps compiling.
1144
- */
1145
- memo?: string;
1146
- memoType?: SendMemoType;
1147
- onMemoChange?: (value: string) => void;
1148
- onMemoTypeChange?: (type: SendMemoType) => void;
1363
+ quote: BridgeQuote | null;
1364
+ quoting: boolean;
1365
+ /** What is wrong with the form or what the server refused, ready to show. */
1366
+ formError: string | null;
1367
+ canSubmit: boolean;
1368
+ submitting: boolean;
1149
1369
  onSubmit: () => void;
1150
- onSignAndSend: () => void;
1151
- onToggleXdr: () => void;
1152
- onCopyHash: () => void;
1153
- onRetry: () => void;
1154
- onDone: () => void;
1155
- /** Language of the modal. Defaults to the user's device; the modal passes the resolved one. */
1156
- language?: PollarLanguage | undefined;
1157
- }
1158
- declare function SendModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, assets, selectedAsset, selectedChain, canSendOnChain, notReadyReason, chains, onSelectChain, amount, destination, formError, isLoadingBalance, isCheckingDestination, minStartingBalance, onCreateAccount, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, onClose, onBack, onRefresh, onSelectAsset, onAmountChange, onMax, onPaste, onDestinationChange, memo, memoType, onMemoChange, onMemoTypeChange, onSubmit, onSignAndSend, onToggleXdr, onCopyHash, onRetry, onDone, language: languageProp, }: SendModalTemplateProps): react_jsx_runtime.JSX.Element;
1159
-
1160
- /** The chain a swap runs on; the modal shows a selector when the app offers both. */
1161
- type SwapChain = 'STELLAR' | 'SOLANA';
1162
- interface SwapAssetOption {
1163
- /** Stellar: the asset ref the quote takes. */
1164
- ref?: SwapQuoteParams['sellAsset'] | undefined;
1165
- code: string;
1166
- /** Stellar: the issuer. Solana: the mint (wrapped SOL for SOL). */
1167
- issuer?: string | undefined;
1168
- /** Solana: the mint's decimals, to turn a decimal amount into base units. */
1169
- decimals?: number | undefined;
1170
- available?: string | undefined;
1171
- enabledInApp?: boolean | undefined;
1172
- }
1173
- /** A quote as the form shows it, whichever chain priced it: decimal amounts. */
1174
- interface SwapQuoteView {
1175
- provider: string;
1176
- amountOut: string;
1177
- minReceived: string;
1178
- /** Percent; null when the venue does not report it. */
1179
- priceImpactPct: string | null;
1180
- }
1181
- interface SwapModalTemplateProps {
1182
- theme: string;
1183
- accentColor: string;
1184
- styleOverrides?: ModalStyleOverrides;
1185
- step: 'form' | 'tx';
1186
- txTitle: string;
1187
- sellOptions: SwapAssetOption[];
1188
- buyOptions: SwapAssetOption[];
1189
- selectedSell: SwapAssetOption | null;
1190
- selectedBuy: SwapAssetOption | null;
1191
- amount: string;
1192
- /** The chains the app offers swaps on; a selector shows when there are two. */
1193
- chains: SwapChain[];
1194
- chain: SwapChain;
1195
- provider: string;
1196
- providers: string[];
1197
- quote: SwapQuoteView | null;
1198
- quoteLoading: boolean;
1199
- quoteError: string;
1200
- formError: string;
1201
- isLoadingData: boolean;
1202
- smartUnsupported: boolean;
1203
- configLoading: boolean;
1204
- swapUnavailable: boolean;
1205
- buyNeedsTrustline: boolean;
1206
- transaction: TransactionState;
1207
- showXdr: boolean;
1208
- copied: boolean;
1209
- explorerUrl: string | null;
1210
- walletType?: WalletId | null | undefined;
1211
- showBack: boolean;
1212
- isInProgress: boolean;
1213
- /** Language of the modal's text; the device's when not given. */
1214
- language?: PollarLanguage | undefined;
1370
+ transfer: BridgeTransfer | null;
1371
+ signing: boolean;
1372
+ onAuthorize: () => void;
1373
+ onApprove: () => void;
1374
+ actionError: string | null;
1375
+ pollTrouble: boolean;
1376
+ onNewBridge: () => void;
1215
1377
  onClose: () => void;
1216
- onBack: () => void;
1217
- onRefresh: () => void;
1218
- onSelectSell: (o: SwapAssetOption) => void;
1219
- onSelectBuy: (o: SwapAssetOption) => void;
1220
- onReverse: () => void;
1221
- onMax: () => void;
1222
- onAddCustomToken: (code: string, issuer: string) => string | null;
1223
- onAmountChange: (value: string) => void;
1224
- onChainChange: (chain: SwapChain) => void;
1225
- onProviderChange: (p: string) => void;
1226
- onSwap: () => void;
1227
- onToggleXdr: () => void;
1228
- onCopyHash: () => void;
1229
- onRetry: () => void;
1230
- onDone: () => void;
1378
+ language?: PollarLanguage | undefined;
1231
1379
  }
1232
- declare function SwapModalTemplate({ theme, accentColor, styleOverrides, step, txTitle, sellOptions, buyOptions, selectedSell, selectedBuy, amount, chains, chain, provider, providers, quote, quoteLoading, quoteError, formError, isLoadingData, smartUnsupported, configLoading, swapUnavailable, buyNeedsTrustline, transaction, showXdr, copied, explorerUrl, walletType, showBack, isInProgress, language: languageProp, onClose, onBack, onRefresh, onSelectSell, onSelectBuy, onAddCustomToken, onReverse, onMax, onAmountChange, onChainChange, onProviderChange, onSwap, onToggleXdr, onCopyHash, onRetry, onDone, }: SwapModalTemplateProps): react_jsx_runtime.JSX.Element;
1380
+ declare function BridgeModalTemplate(props: BridgeModalTemplateProps): react_jsx_runtime.JSX.Element;
1233
1381
 
1234
1382
  interface ReceiveModalTemplateProps {
1235
1383
  theme: string;
@@ -1302,6 +1450,10 @@ interface CosignModalTemplateProps {
1302
1450
  error: string | null;
1303
1451
  /** Approve stays off for a request whose approval just failed. */
1304
1452
  approveBlocked?: boolean;
1453
+ /** This device is not one of the wallet's devices: it cannot vote, only reject, until it is added. */
1454
+ deviceNotLinked?: boolean;
1455
+ /** Opens where this device gets added; the button shows only with it. */
1456
+ onLinkDevice?: () => void;
1305
1457
  /** The last request that reached a final state, shown once the list is empty. */
1306
1458
  lastResolved?: CosignRequest;
1307
1459
  /** Explorer page of {@link lastResolved}'s transaction, when it was sent. */
@@ -1319,7 +1471,7 @@ interface CosignModalTemplateProps {
1319
1471
  onReject: (request: CosignRequest) => void;
1320
1472
  onClose: () => void;
1321
1473
  }
1322
- declare function CosignModalTemplate({ theme, accentColor, styleOverrides, pending, current, verification, busy, error, approveBlocked, lastResolved, explorerUrl, closesIn, nextStep, language: languageProp, network, onSelect, onApprove, onReject, onClose, }: CosignModalTemplateProps): react_jsx_runtime.JSX.Element;
1474
+ declare function CosignModalTemplate({ theme, accentColor, styleOverrides, pending, current, verification, busy, error, approveBlocked, deviceNotLinked, onLinkDevice, lastResolved, explorerUrl, closesIn, nextStep, language: languageProp, network, onSelect, onApprove, onReject, onClose, }: CosignModalTemplateProps): react_jsx_runtime.JSX.Element;
1323
1475
 
1324
1476
  interface CustodyMigrationModalProps {
1325
1477
  state: CustodyMigrationState;
@@ -1414,4 +1566,4 @@ interface DistributionRulesModalTemplateProps {
1414
1566
  }
1415
1567
  declare function DistributionRulesModalTemplate({ theme, accentColor, styleOverrides, state, claimingId, claimErrors, claimedIds, language: languageProp, onRefresh, onClaim, onClose, }: DistributionRulesModalTemplateProps): react_jsx_runtime.JSX.Element;
1416
1568
 
1417
- export { type AuthModalProps, CardModal, ChainSelect, type ChainSelectProps, CosignModal, CosignModalTemplate, type CosignModalTemplateProps, CustodyMigrationModal, CustodyMigrationModalTemplate, type CustodyMigrationModalTemplateProps, type CustomTrustlineModalTemplateProps, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type ModalChrome, type ModalStyleOverrides, type ModalVariant, type PollarConfig, PollarProvider, type PollarStyles, ProviderRegistrationModal, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, type ReceiveModalTemplateProps, RecoveryModal, RecoveryModalTemplate, type RecoveryModalTemplateProps, type RecoveryView, RegistryCheckModal, RejectedRouteDisplay, RequirementFormModal, RouteDisplay, type SendMemoType, SendModal, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, type UseChainsResult, type UseCosignResult, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, addressForChain, browserPasskeyCeremony, browserPasskeySigner, browserRecoveryPasskey, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };
1569
+ export { type AuthModalProps, BridgeModal, type BridgeModalOptions, type BridgeModalStep, BridgeModalTemplate, type BridgeModalTemplateProps, CardModal, type CardModalOptions, ChainSelect, type ChainSelectProps, CosignModal, CosignModalTemplate, type CosignModalTemplateProps, CustodyMigrationModal, CustodyMigrationModalTemplate, type CustodyMigrationModalTemplateProps, type CustomTrustlineModalTemplateProps, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, type EarnModalOptions, EnabledAssetsModal, EnabledAssetsModalTemplate, type EnabledAssetsModalTemplateProps, KycModal, KycModalTemplate, KycStatus, type KycStep, type LoginButtonProps, LoginModalTemplate, type ModalChrome, type ModalStyleOverrides, type ModalVariant, type PollarConfig, PollarProvider, type PollarStyles, ProviderRegistrationModal, type RampModalOptions, type RampStep, RampWidget, RampWidgetTemplate, ReceiveModal, type ReceiveModalOptions, ReceiveModalTemplate, type ReceiveModalTemplateProps, RecoveryModal, RecoveryModalTemplate, type RecoveryModalTemplateProps, type RecoveryView, RegistryCheckModal, RejectedRouteDisplay, RequirementFormModal, RouteDisplay, type SendMemoType, SendModal, type SendModalOptions, SendModalTemplate, type SendModalTemplateProps, SessionsModal, SessionsModalTemplate, type SessionsModalTemplateProps, type SwapAssetOption, SwapModal, type SwapModalOptions, SwapModalTemplate, type SwapModalTemplateProps, TransactionModalTemplate, type TransactionModalTemplateProps, type TxHistoryModalOptions, TxHistoryModalTemplate, TxStatusView, type TxStatusViewProps, type UseChainsResult, type UseCosignResult, WalletBalanceModal, WalletBalanceModalTemplate, type WalletBalanceModalTemplateProps, WalletButton, WalletButtonTemplate, type WalletButtonTemplateProps, addressForChain, browserPasskeyCeremony, browserPasskeySigner, browserRecoveryPasskey, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };