@pollar/react 0.12.1-rc.2 → 0.12.1-rc.23

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
@@ -1,104 +1,26 @@
1
1
  # @pollar/react
2
2
 
3
- React bindings for [Pollar](https://pollar.xyz) — drop-in authentication UI, transaction modals, and hooks for
3
+ React bindings for [Pollar](https://pollar.xyz) - drop-in authentication UI, transaction modals, and hooks for
4
4
  Stellar and Solana applications.
5
5
 
6
6
  > **0.12.1** (requires `@pollar/core@^0.12.1`). Every modal and exported template speaks English, Spanish and
7
- > Portuguese: the dashboard's language wins, then a component's `language` prop, the client's `locale`, and the
8
- > browser's. `<SwapModal>` swaps on Solana too, with a Network selector when the app has venues on both chains.
9
- > `<SendModal>` offers a Hash memo next to Text and ID. `<RequirementFormModal>` asks a field with `showIf` only while
10
- > the answer it depends on matches. The card modal copies the number, expiry date and CVC, the email code input takes
11
- > an autofilled one-time code, and the ramp widget says a route's minimum or maximum. A hook built with
12
- > `createPollarAdapterHook` signs the auth entry an adapter answers with, without submitting anything, and hands it to
13
- > the adapter's `complete`.
7
+ > Portuguese (see [Language](#language)). `<SwapModal>` swaps on Solana too, with a Network selector when the app has
8
+ > venues on both chains. `<SendModal>` offers a Hash memo next to Text and ID. `<ConfirmModal>` shows a Soroban token
9
+ > transfer (`kind: 'sign_auth_entry'`) with its destination, amount and asset. `<ConfirmModal>`, `<CosignModal>` and
10
+ > every transaction status view share one review: what moves, a fee badge when who pays is known, and "Show details"
11
+ > with the addresses, network, fee, raw transaction and hash. `<RequirementFormModal>` asks a field
12
+ > with `showIf` only while the answer it depends on matches. `<CardModal>` copies the number, expiry date and CVC,
13
+ > offers a network picker when the user holds a wallet on Stellar and Solana, and funds the card from a co-signed
14
+ > wallet too. The email code input takes an autofilled one-time code. The ramp widget says a route's minimum or
15
+ > maximum and offers "Change amount", and an order whose price changed before anything moved offers "Get a new quote".
16
+ > `openRampModal(options)` opens the ramp widget on a direction, country, fiat, asset and amount; the send, swap, earn,
17
+ > receive, history and card modals take options too, with `onSuccess` / `onFunded` callbacks.
18
+ > `<PollarProvider language>` and `client.setLocale()` switch the modals' language at runtime, open ones included. The
19
+ > ramp widget names each country in the modal's language.
20
+ > A hook built with `createPollarAdapterHook` signs the auth entry an adapter answers with, without submitting
21
+ > anything, and hands it to the adapter's `complete`.
14
22
  >
15
- > Earlier: **0.12.0** (requires `@pollar/core@^0.12.0`). `<RampWidget>` runs on the v3 ramps API: routes, quotes leg by
16
- > leg, the fields a quote asks for, the order's progress and its pending action; it signs a leg with the connected
17
- > Stellar or Solana wallet only when the leg was built for it. **Wallets the user holds**: the wallet button lets the
18
- > user pick co-signed or self-custody when the app leaves it to them, `<RecoveryModal>` manages passkeys, email,
19
- > devices and the recovery phrase (`recoveryLocked`, `openRecoveryModal()`), and `<CustodyMigrationModal>` moves a
20
- > custodial wallet to Turnkey after login. `<SendModal>` offers to create a Stellar account that does not exist.
21
- > Branding yields to the host stylesheet, with `--pollar-font-family` and `--pollar-font-family-mono`;
22
- > `WalletButtonTemplateProps` takes `theme`, `accentColor` and `styleOverrides`. **Breaking**; see
23
- > [UPGRADE.md](../../UPGRADE.md).
24
- >
25
- > Earlier: **0.11.5** (requires `@pollar/core@^0.11.5`).
26
- > **Turnkey co-signed wallets**: `<CosignModal>` opens for a request the device did not settle and enables
27
- > Approve only after it verifies against Turnkey; `useCosign()` exposes the pending requests.
28
- > `<ConfirmModal>` shows every signature first under `confirmation: 'prompt'`. The ramp widget links the
29
- > chain a ramp settles on and retries funds in transit; Send takes a Stellar memo (`SendMemoType`). See
30
- > [UPGRADE.md](../../UPGRADE.md).
31
- >
32
- > Earlier: **0.11.4** (requires `@pollar/core@^0.11.4`).
33
- > **KYC by ramp corridor**: `<RampWidget>` lists routes locked by a requirement step and opens that
34
- > step - `<KycModal>`, `<RequirementFormModal>`, `<RegistryCheckModal>` or `<ProviderRegistrationModal>`
35
- > (all exported) - then quotes again; `openKycModal()` without a corridor walks the app's own KYC
36
- > steps. **Redesign**: Send, Swap, Receive, Sessions and Wallet balance follow the new design, keeping the
37
- > network picker (a multichain app) and Swap's custom buy token. A template you
38
- > mount yourself gains required handlers (`onMax`, `onPaste`, `onReverse`, `revokeError`,
39
- > `kycRequired`, `onVerifyRoute`) - see [UPGRADE.md](../../UPGRADE.md). Licensed under Apache-2.0
40
- > from this release.
41
- >
42
- > **Wallet provisioning** (requires `@pollar/core@^0.11.4`, no breaking change). The platform now creates an
43
- > end-user's Stellar account **in the background**, so a login returns before the account is on
44
- > the ledger and the first payment in that window is refused by the server. Two things changed
45
- > here. **A wallet that finishes provisioning now reaches the UI**: `sessionsEqual` did not
46
- > compare `provisioning` and the context memo's dependency list did not include it, and either
47
- > one alone froze every screen built on the transition. And the modals say what is happening -
48
- > **Send** refuses to build a payment while the account is off the ledger and gives the reason
49
- > (kept apart from the "no transfer path on this network" message, which would otherwise tell
50
- > someone waiting on a brand-new wallet that Stellar cannot send), **Receive** warns while the
51
- > address is still unbacked, and the **wallet button** carries the same reason as a banner in its
52
- > dropdown. `walletNotReadyReason(wallet, chain)` is exported so a custom template phrases the
53
- > wait the way the built-ins do; `SendModalTemplateProps`, `ReceiveModalTemplateProps` and
54
- > `WalletButtonTemplateProps` each gain an **optional** `notReadyReason`, so a custom template
55
- > written before this keeps compiling untouched. In the **ramp widget**: a user whose provider
56
- > setup is still pending is no longer asked to verify an identity they already verified
57
- > (`onboardingStatus: 'awaiting_provider'` says the account is being set up and stops the
58
- > pointless KYC poll), and three failures that printed as raw error codes get sentences.
59
- > `RampWidgetTemplateProps` gains an optional `onboardingStatus`.
60
- >
61
- > **Cards**: `<CardModal>`, opened with `openCardModal()` from `usePollar()`, walks the user through
62
- > the card provider's steps, sign-up and issuing, then shows the card with the app's logo and card
63
- > label, its balance and movements, funding from the wallet (each funding's step while it is in
64
- > flight) and the number revealed on the device. **Wallets on demand**: `usePollar()` exposes
65
- > `hasWallet` and `createWallet`, and signed in without a wallet `<WalletButton>` offers Create wallet
66
- > to an app that creates wallets on demand. The modals that act on the session close when it ends,
67
- > and form fields are checked before sending.
68
- >
69
- > Earlier: **0.11.3** required `@pollar/core@^0.11.3`. A **pre-built `PollarClient`
70
- > passed to `PollarProvider` no longer loses passkey support**: the provider installs the
71
- > browser passkey ceremony on every path (via core's new `setPasskeyDefaults()`), and an
72
- > explicit `passkey: undefined` no longer wipes the default. `browserPasskeyCeremony` and
73
- > `browserPasskeySigner` are now exported for consumers who build their own client or want
74
- > to wrap the ceremony. Also, **StrictMode no longer leaves an orphaned `PollarClient`
75
- > running**: the provider keys the client it builds on the config object, so StrictMode's
76
- > second render pass reuses the first pass's instance instead of constructing a second
77
- > client whose refresh loop could clear the session the real login just wrote (dev only,
78
- > no API change). Packaging: **`@pollar/core` moved from `dependencies` to
79
- > `peerDependencies`**, so npm no longer installs a package-local duplicate of core (the
80
- > configuration that broke `instanceof` and split the live-client registry); the provider
81
- > now discriminates with core's new `isPollarClient()` guard, which works across copies.
82
- > npm 7+ installs peers automatically; on npm 6, Yarn 1 or `--legacy-peer-deps`, add
83
- > `@pollar/core` to your own dependencies. If you pin exact versions, keep both packages
84
- > on the same version.
85
- >
86
- > Earlier: **0.11.2** required `@pollar/core@^0.11.2`. The **Transaction History modal
87
- > goes multichain**: the same network picker and address chip as the Balance /
88
- > Send modals, a server-side chain filter (pagination is server-side, so
89
- > switching networks refetches and resets to page 1), per-chain explorer links
90
- > (stellar.expert for Stellar, explorer.solana.com for Solana), and the unified
91
- > `{ amount, unit }` fee, so a Solana row reads "5000 lamports". The picker
92
- > hides itself on a single-chain app. Non-breaking.
93
- >
94
- > Earlier: **0.11.1** added the network picker (`<ChainSelect>`) across the
95
- > wallet-balance, enabled-assets, send and receive modals - each scopes its rows
96
- > to the selected chain instead of tagging every row, with a local filter (the
97
- > backend returns every chain in one payload). Balances format against each
98
- > token's own `decimals`, and a `null` balance renders as a dash rather than as
99
- > `0`, because `null` means the chain could not be read. See the
100
- > [CHANGELOG](../../CHANGELOG.md) and [UPGRADE.md](../../UPGRADE.md) for the full
101
- > version history before upgrading.
23
+ > See the [CHANGELOG](https://github.com/pollar-xyz/pollar/blob/main/CHANGELOG.md) for earlier releases and [UPGRADE.md](https://github.com/pollar-xyz/pollar/blob/main/UPGRADE.md) before upgrading.
102
24
 
103
25
  ## Installation
104
26
 
@@ -110,7 +32,8 @@ pnpm add @pollar/react @pollar/core
110
32
  yarn add @pollar/react @pollar/core
111
33
  ```
112
34
 
113
- **Peer dependencies:** `react >= 18`, `react-dom >= 18`. Node ≥ 20 in toolchains.
35
+ **Peer dependencies:** `@pollar/core ^0.12.1`, `react >= 18`, `react-dom >= 18`. Node >= 20 in toolchains. npm 7+
36
+ installs peers automatically; on npm 6, Yarn 1 or `--legacy-peer-deps`, list `@pollar/core` in your own dependencies.
114
37
 
115
38
  ## Quick Start
116
39
 
@@ -158,17 +81,20 @@ Context provider that initialises the Pollar client and makes it available to ch
158
81
  <PollarProvider
159
82
  client={{
160
83
  apiKey: 'your-api-key',
161
- baseUrl: 'https://sdk.api.pollar.xyz', // optional, origin only — the SDK appends /v3
84
+ baseUrl: 'https://sdk.api.pollar.xyz', // optional, origin only - the SDK appends /v3
162
85
  stellarNetwork: 'testnet', // optional, default: 'testnet'
86
+ locale: 'pt-BR', // optional, BCP 47 tag for the modals' language (see Language below)
163
87
  storage, // optional, RN apps inject this
164
88
  keyManager, // optional, autodetects on web
165
- walletAdapters, // optional, WalletAdapter[] — external wallet stacks
166
- deviceLabel: 'iPhone — Safari', // optional, shown in SessionsModal
89
+ walletAdapters, // optional, WalletAdapter[] - external wallet stacks
90
+ deviceLabel: 'iPhone - Safari', // optional, shown in SessionsModal
167
91
  onStorageDegrade, // optional, telemetry hook
168
92
  }}
169
- // Optional: pass `appConfig` (even `{}`) to skip the remote
170
- // `/applications/config` fetch and use local-only styles/branding.
93
+ // Optional: pass `appConfig` to skip the remote `/applications/config` fetch
94
+ // and use a local config instead. `application` is required; `styles` may be partial,
95
+ // but a login method it leaves out (emailEnabled, providers, ...) is off.
171
96
  appConfig={{
97
+ application: { name: 'My app', network: 'testnet', chains: ['STELLAR'] },
172
98
  styles: {
173
99
  /* optional style overrides */
174
100
  },
@@ -183,35 +109,39 @@ Context provider that initialises the Pollar client and makes it available to ch
183
109
  </PollarProvider>
184
110
  ```
185
111
 
186
- | Prop | Type | Required | Description |
187
- | ----------- | ------------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
188
- | `client` | `PollarClient \| PollarClientConfig` | Yes | Either a pre-built `PollarClient` (testing, reuse outside React) or a `PollarClientConfig` the provider will construct one from. **Locked at first render** — swapping after mount is ignored |
189
- | `appConfig` | `PollarConfig` | No | Local override of `/applications/config`. **Presence is the opt-out switch**: pass it (even `{}`) and the remote fetch is skipped. Omit it to keep the existing remote-fetch-on-mount behaviour. Unlike `client`, it can be added or swapped after mount — the context re-applies it (compared by value, so an inline object literal is fine) |
190
- | `adapters` | `PollarAdapters` | No | Named set of `PollarAdapter` objects (e.g. Trustless Work). See below |
112
+ | Prop | Type | Required | Description |
113
+ | ------------------ | ------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
114
+ | `client` | `PollarClient \| PollarClientConfig` | Yes | Either a pre-built `PollarClient` (testing, reuse outside React) or a `PollarClientConfig` the provider will construct one from. **Locked at first render** - swapping after mount is ignored |
115
+ | `language` | `string` | No | The modals' language, a BCP 47 tag (`'es'`, `'pt-BR'`): typically the app's current language. Followed on every render, so open modals switch when it changes. See [Language](#language) |
116
+ | `appConfig` | `PollarConfig` | No | Local replacement for `/applications/config`, used verbatim and never merged with the server's answer. **Presence is the opt-out switch**: pass it and the remote fetch is skipped. Omit it to fetch the config on mount, which keeps branding, login methods and chains current. Unlike `client`, it can be added or swapped after mount - the context re-applies it (compared by value, so an inline object literal is fine) |
117
+ | `adapters` | `PollarAdapters` | No | Named set of `PollarAdapter` objects (e.g. Trustless Work). See [Custom adapters](#custom-adapters) |
118
+ | `onStorageDegrade` | `OnStorageDegrade` | No | Called once when persistent storage falls back to in-memory mode (Safari private browsing, sandboxed iframes), so the session will not survive a reload |
191
119
 
192
120
  ---
193
121
 
194
122
  ### `usePollar()`
195
123
 
196
- Returns the full Pollar context. Every modal opener returned here renders an already-wired modal — no extra mounting
124
+ Returns the full Pollar context. Every modal opener returned here renders an already-wired modal - no extra mounting
197
125
  needed.
198
126
 
199
127
  ```ts
200
128
  const {
201
129
  // Session
202
- isAuthenticated, // boolean - true when a wallet address is present
130
+ isAuthenticated, // boolean - true while a session exists, with or without a wallet
203
131
  wallet, // WalletInfo | null - read wallet?.address for the on-chain address
204
132
  wallets, // WalletInfo[] - every wallet the user holds, one per chain. To drive
205
133
  // a network picker, prefer the useChains() hook (below) over reading
206
134
  // this directly - it applies the app's configured chain order
207
135
  verified, // boolean - true once the server has confirmed the session
136
+ hasWallet, // boolean - false until createWallet() runs on an app that creates wallets on demand
137
+ createWallet, // (options?: { custody? }) => Promise<WalletInfo> (custody: the user's pick under USER_CHOICE)
208
138
 
209
139
  // App config (the remote /config fetch behind the login modal)
210
140
  configStatus, // 'loading' | 'ready' | 'error'
211
141
  retryConfig, // () => void - re-runs the fetch after an error
212
142
 
213
143
  // Client escape hatch
214
- getClient, // () => PollarClient - for getUserProfile(), listSessions(), …
144
+ getClient, // () => PollarClient - for getUserProfile(), listSessions(), ...
215
145
 
216
146
  // Auth
217
147
  login, // (options: PollarLoginOptions) => void
@@ -222,6 +152,20 @@ const {
222
152
  sessions, // SessionsState
223
153
  openSessionsModal, // () => void
224
154
 
155
+ // Co-signed wallets (Turnkey)
156
+ cosign, // CosignState - requests waiting for this device's vote
157
+ openCosignModal, // () => void (also opens by itself when a request arrives)
158
+ setCosignNextStep, // (next: string | null) => void - keeps the prompt open for a flow's next approval
159
+ recovery, // RecoveryState | null
160
+ recoveryLocked, // boolean - true while the wallet cannot be recovered without this device
161
+ refreshRecovery, // () => void
162
+ openRecoveryModal, // () => void (passkeys, email, devices, recovery phrase)
163
+ custodyMigration, // CustodyMigrationState | null - while `required`, the provider shows the move to Turnkey
164
+ refreshCustodyMigration, // () => void
165
+
166
+ // Signature confirmation
167
+ confirmations, // PendingConfirmation[] - signing calls waiting under confirmation: 'prompt'; the provider shows the first
168
+
225
169
  // Transactions
226
170
  tx, // TransactionState
227
171
  buildTx, // (operation, params, options?) => Promise<BuildOutcome>
@@ -235,7 +179,7 @@ const {
235
179
 
236
180
  // Transaction history
237
181
  txHistory, // TxHistoryState
238
- openTxHistoryModal, // () => void
182
+ openTxHistoryModal, // (options?: TxHistoryModalOptions) => void
239
183
 
240
184
  // Wallet balance
241
185
  walletBalance, // WalletBalanceState
@@ -250,28 +194,41 @@ const {
250
194
 
251
195
  // Swap (DEX/AMM)
252
196
  getSwapQuote, // (params: SwapQuoteParams) => Promise<SwapQuote[]>
253
- swap, // (quote: SwapQuote, opts?) => Promise<SubmitOutcome>
197
+ swap, // (quote: SwapQuote, opts?: { autoTrustline? }) => Promise<SubmitOutcome>
254
198
  getSwapConfig, // () => Promise<SwapVenue[]> (which venues this app offers)
255
199
  getSwapTokens, // () => Promise<SwapToken[]>
256
200
  getSolanaSwapConfig, // () => Promise<SolanaSwapVenue[]> (Jupiter, Titan; mainnet)
257
201
  getSolanaSwapQuote, // (params: SolanaSwapQuoteParams) => Promise<SolanaSwapQuote[]>
258
- swapSolana, // (quote: SolanaSwapQuote, opts?) => Promise<SubmitOutcome>
259
- openSwapModal, // () => void
202
+ swapSolana, // (quote: SolanaSwapQuote, opts?: { slippageBps?, idempotencyKey? }) => Promise<SubmitOutcome>
203
+ getSolanaSwapOptions, // () => Promise<SolanaSwapOptions> (venues and the chains a swap can deliver to, e.g. POLYGON)
204
+ getSwapStatus, // (idempotencyKey: string) => Promise<SwapStatus> (follows a cross-chain swap's delivery)
205
+ openSwapModal, // (options?: SwapModalOptions) => void
206
+
207
+ // Bridge (USDC between the user's own wallets on Stellar, Solana and Polygon; the bridge calls live on getClient())
208
+ openBridgeModal, // (options?: BridgeModalOptions) => void
260
209
 
261
- // Earn (yield vaults + lending — DeFindex + Blend)
210
+ // Earn (yield vaults + lending - DeFindex + Blend)
262
211
  getEarnProviders, // () => Promise<EarnProviderId[]> ([] means Earn is disabled)
263
212
  getEarnOpportunities, // (provider: EarnProviderId) => Promise<EarnOpportunity[]>
264
213
  getEarnPosition, // (params: EarnPositionParams) => Promise<EarnPosition>
265
214
  earnDeposit, // (params: EarnTxParams) => Promise<SubmitOutcome>
266
215
  earnWithdraw, // (params: EarnTxParams) => Promise<SubmitOutcome>
267
- openEarnModal, // () => void
216
+ getSolanaEarnProviders, // () => Promise<SolanaEarnProviderId[]> ([] means no Earn on Solana)
217
+ getSolanaEarnOpportunities, // () => Promise<SolanaEarnOpportunity[]>
218
+ getSolanaEarnPosition, // (opportunity: string) => Promise<SolanaEarnPosition>
219
+ earnSolanaDeposit, // (params: SolanaEarnTxParams) => Promise<SubmitOutcome>
220
+ earnSolanaWithdraw, // (params: SolanaEarnTxParams) => Promise<SubmitOutcome>
221
+ openEarnModal, // (options?: EarnModalOptions) => void
222
+
223
+ // Cards (the card calls live on getClient(): getCardProviders, issueCard, fundCard, ...)
224
+ openCardModal, // (options?: CardModalOptions) => void
268
225
 
269
226
  // Distribution rules
270
227
  openDistributionRulesModal, // () => void
271
228
 
272
229
  // Send / Receive
273
- openSendModal, // () => void
274
- openReceiveModal, // () => void
230
+ openSendModal, // (options?: SendModalOptions) => void
231
+ openReceiveModal, // (options?: ReceiveModalOptions) => void
275
232
 
276
233
  // Network
277
234
  network, // StellarNetwork - 'mainnet' | 'testnet'
@@ -281,7 +238,7 @@ const {
281
238
  openKycModal, // (options?: { corridorId?, providerId?, country?, level?, onApproved? }) => void
282
239
 
283
240
  // Ramp (fiat on/off-ramps on the v3 ramps API, wired through core)
284
- openRampModal, // () => void
241
+ openRampModal, // (options?: RampModalOptions) => void
285
242
 
286
243
  // App config / styles served by the Pollar API
287
244
  appConfig, // PollarConfig
@@ -295,6 +252,64 @@ const {
295
252
  Custody is derived from `wallet`, not a separate field - e.g.
296
253
  `wallet?.custody === 'external' ? wallet.provider : null`.
297
254
 
255
+ #### Ramp options
256
+
257
+ `openRampModal()` opens the ramp widget on its defaults. `openRampModal(options)` opens it on a direction, country,
258
+ fiat, asset and amount; the user can still change each one.
259
+
260
+ ```ts
261
+ import type { RampModalOptions } from '@pollar/react';
262
+
263
+ openRampModal({ country: 'BR', direction: flow === 'withdraw' ? 'sell' : 'buy' });
264
+ openRampModal({ direction: 'buy', country: 'MX', fiat: 'MXN', asset: 'USDC', amount: '500' });
265
+ ```
266
+
267
+ | Option | Type | Description |
268
+ | ----------- | ----------------- | -------------------------------------------------------------------- |
269
+ | `direction` | `'buy' \| 'sell'` | Buy (on-ramp) or sell (off-ramp). Defaults to `'buy'` |
270
+ | `country` | `string` | ISO 3166-1 alpha-2, e.g. `'BR'` |
271
+ | `fiat` | `string` | Currency code, e.g. `'BRL'`. Defaults to the country's first fiat |
272
+ | `asset` | `string` | Asset code, e.g. `'USDC'`. Defaults to the first asset for that fiat |
273
+ | `amount` | `string` | A plain decimal, e.g. `'100'` or `'12.5'`; anything else is left out |
274
+
275
+ A country that does not route in the requested direction, or that the app does not offer, opens on the widget's default
276
+ country, without the fiat, asset or amount; a fiat or asset the country does not offer opens on the country's first one.
277
+ Nothing is thrown. The options wait for the routes when they are still loading. Each call starts over: opening again
278
+ with other options, or with none, drops the earlier ones. `<RampWidget initial={options}>` takes the same options.
279
+
280
+ #### Modal options
281
+
282
+ The other `open*Modal` actions take options the same way: the modal opens on them and the user can still change each
283
+ one. An option the app or wallet cannot use (a network the app does not offer, an asset the wallet does not hold, a
284
+ provider that is not enabled, an amount that is not a plain decimal) is left out and that field opens on its default;
285
+ nothing is thrown. An option whose data is still loading is applied when it arrives. Each call starts over: opening
286
+ again with other options, or with none, drops the earlier ones. Every type is exported from `@pollar/react`, and each
287
+ modal takes the same options as its `initial` prop.
288
+
289
+ ```ts
290
+ openSendModal({ asset: 'USDC', destination: 'G...', amount: '25', memo: 'order-1042', onSuccess: ({ hash }) => save(hash) });
291
+ openSwapModal({ sell: 'XLM', buy: 'USDC', amount: '100' });
292
+ openSwapModal({ chain: 'SOLANA', destinationChain: 'POLYGON' });
293
+ openEarnModal({ provider: 'blend', tab: 'withdraw' });
294
+ openEarnModal({ chain: 'SOLANA' });
295
+ openBridgeModal({ fromChain: 'STELLAR', toChain: 'SOLANA', amount: '25', onSuccess: (transfer) => track(transfer.id) });
296
+ openReceiveModal({ chain: 'SOLANA' });
297
+ openCardModal({ panel: 'fund', amount: '50', onFunded: (funding) => track(funding.id) });
298
+ ```
299
+
300
+ | Action | Options |
301
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
302
+ | `openSendModal` | `chain`, `asset` (code), `destination`, `amount`, `memo`, `memoType` (`'text' \| 'id' \| 'hash'`), `onSuccess({ hash })` |
303
+ | `openSwapModal` | `chain` (`'STELLAR' \| 'SOLANA'`), `sell` (code), `buy` (code), `amount`, `destinationChain` (Solana only, e.g. `'POLYGON'`), `onSuccess({ hash })` |
304
+ | `openEarnModal` | `chain` (`'STELLAR' \| 'SOLANA'`), `provider`, `opportunityId`, `tab` (`'deposit' \| 'withdraw'`), `amount`, `onSuccess({ hash })` |
305
+ | `openBridgeModal` | `fromChain`, `toChain` (`'STELLAR' \| 'SOLANA' \| 'POLYGON'`), `amount` (USDC), `onSuccess(transfer)` |
306
+ | `openReceiveModal` | `chain` |
307
+ | `openTxHistoryModal` | `chain` |
308
+ | `openCardModal` | `panel: 'fund'` (opens the funding panel once the user's card loads), `amount`, `chain`, `onFunded(funding)` |
309
+
310
+ `onSuccess` is called once per transaction that lands while the modal is open (the bridge modal's once the USDC arrives
311
+ on the destination, with the completed transfer); `onFunded` with each funding the user sends from the card modal. A Solana or Polygon send takes `amount` in the asset's decimals, as the form shows it.
312
+
298
313
  #### Login options
299
314
 
300
315
  ```ts
@@ -302,7 +317,7 @@ Custody is derived from `wallet`, not a separate field - e.g.
302
317
  login({ provider: 'google' });
303
318
  login({ provider: 'github' });
304
319
 
305
- // Email OTP
320
+ // Email OTP (the code input accepts a code the browser or keyboard autofills, or a paste)
306
321
  login({ provider: 'email', email: 'user@example.com' });
307
322
 
308
323
  // Built-in Stellar wallet adapters (the adapter's `type` IS the provider)
@@ -323,7 +338,7 @@ The login modal is gated on the remote app-config fetch. While it runs the modal
323
338
  driving `<LoginModalTemplate>` yourself. Passing `appConfig` to `<PollarProvider>` opts out of the fetch entirely, so
324
339
  neither state can occur.
325
340
 
326
- #### Self-driving interactive adapters (Privy, …)
341
+ #### Self-driving interactive adapters (Privy, ...)
327
342
 
328
343
  Registered adapters that opt into the interactive-auth contract
329
344
  (`isInteractiveAuthAdapter` + `onProviderAuthChange`) are auto-driven by the
@@ -346,7 +361,7 @@ provider:
346
361
  The single source of truth for "which chains, in what order, and which address to
347
362
  show". Every built-in component (`<WalletButton>`, the network pickers) reads from
348
363
  it, so they can never disagree about which chain leads. Use it when you build your
349
- own wallet button or picker instead of calling `chainsOf(wallets)` yourself —
364
+ own wallet button or picker instead of calling `chainsOf(wallets)` yourself -
350
365
  `chainsOf` alone cannot know the app's configured order.
351
366
 
352
367
  ```ts
@@ -360,7 +375,7 @@ const { chains, primaryChain, primaryAddress, ready } = useChains();
360
375
  | `chains` | `WalletChain[]` | Chains to offer, in the app's configured order: those the app serves **and** the user holds. `[]` until config resolves |
361
376
  | `primaryChain` | `WalletChain \| null` | The app's first configured chain the user holds. `null` until ready |
362
377
  | `primaryAddress` | `string` | The address on `primaryChain`. Falls back to the session's first wallet while config is in flight |
363
- | `ready` | `boolean` | `false` while `/config` is loading or failed — gate any chain UI on it |
378
+ | `ready` | `boolean` | `false` while `/config` is loading or failed - gate any chain UI on it |
364
379
 
365
380
  The order and membership come from the app's `/applications/config`
366
381
  (`appConfig.application.chains`), not from the session's `wallets`: a chain the app
@@ -369,32 +384,73 @@ session still carries it.
369
384
 
370
385
  ---
371
386
 
387
+ ### Language
388
+
389
+ Every modal, shared block (footer, copy button, amount field, pickers) and exported template speaks English (`en`),
390
+ Spanish (`es`) and Portuguese (`pt`). The language is, in this order:
391
+
392
+ 1. The language the app pins in the dashboard (Branding > Language, served as `styles.language`).
393
+ 2. The `language` prop of `<RampWidget>`, `<KycModal>`, `<RequirementFormModal>`, `<RegistryCheckModal>` or
394
+ `<ProviderRegistrationModal>`, a BCP 47 tag.
395
+ 3. The `language` prop of `<PollarProvider>`, a BCP 47 tag.
396
+ 4. The client's `locale` (`client={{ apiKey, locale: 'pt-BR' }}`, or `client.setLocale(tag)` later), any BCP 47 tag.
397
+ 5. The browser language.
398
+
399
+ An app whose language changes at runtime passes it to the provider, and every open or later modal follows it without
400
+ remounting anything:
401
+
402
+ ```tsx
403
+ <PollarProvider client={{ apiKey }} language={i18n.language}>
404
+ ```
405
+
406
+ `getClient().setLocale(tag)` does the same from outside React; `config.locale` is the starting value.
407
+
408
+ A tag the modals have no translation for is skipped, and English is the fallback. Every exported template takes a
409
+ `language` prop (`PollarLanguage` from `@pollar/core`: `'en' | 'es' | 'pt'`); a template rendered inside the provider
410
+ follows the provider's language, and one rendered outside it uses the browser's.
411
+
412
+ ---
413
+
372
414
  ### Components
373
415
 
374
- Every modal mounts itself when its `openXModal()` action is called. You don't need to render these directly — they're
375
- already wired inside `<PollarProvider>` — and most are exported in case you want to mount them yourself.
416
+ Every modal mounts itself when its `openXModal()` action is called. You don't need to render these directly - they're
417
+ already wired inside `<PollarProvider>` - and most are exported in case you want to mount them yourself.
376
418
 
377
419
  > Two wrappers are **not** exported: `<TxHistoryModal>` and `<TransactionModal>`. Only their templates
378
420
  > (`TxHistoryModalTemplate` / `TransactionModalTemplate`) are public. Mount those instead if you need to drive them
379
421
  > yourself.
380
-
381
- | Component | Purpose |
382
- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
383
- | `<WalletButton>` | Drop-in button. Opens login when signed out; signed in, shows the wallet address with a dropdown (Send, Receive, copy address, balance, history, ramp, KYC, distribution rules, sessions, sign out, plus a "Create account" action when the external wallet has no on-chain account yet). Inline arc spinner during in-progress transactions |
384
- | `<SendModal>` | Full send flow: network picker (shown when the app has more than one chain), asset picker, amount with Max (from the available balance), destination with Paste, inline build > sign > success/error. Sending is available on Stellar and Solana; Polygon can be browsed but not sent from |
385
- | `<SwapModal>` | On-chain asset-to-asset swap on Stellar and Solana (a Network selector when the app has venues on both): pick from/to assets and amount, quote across venues, execute (auto-trustline on the buy asset when needed); paste a custom Stellar buy token (code + issuer) |
386
- | `<EarnModal>` | Deposit/withdraw across DeFindex vaults and Blend pools: provider + opportunity selection with live APY, wallet balance, over-spend guards, and auto-trustline on deposit |
387
- | `<ReceiveModal>` | Wallet address as QR code with copy-to-clipboard (no external QR dependency required) |
388
- | `<TxHistoryModal>` | Paginated multichain transaction history with auto-fetch on open. A `<ChainSelect>` in the header filters server-side (switching networks refetches and resets to page 1); rows link to their own chain's explorer (stellar.expert for Stellar, explorer.solana.com for Solana) and show the unified `{ amount, unit }` fee |
389
- | `<WalletBalanceModal>` | Multichain wallet balances (Stellar, Polygon, Solana). A `<ChainSelect>` picks the network and the rows are filtered to it; shows that chain's address plus a refresh button, and each row's issuer with a copy action. An unreadable chain's balance renders as a dash, never as `0`. On Solana testnet each row offers a faucet hint — a devnet SOL faucet on the native row, Circle's USDC faucet on the USDC row |
390
- | `<EnabledAssetsModal>` | The application's dashboard-enabled assets for the network picked in the header, with per-asset trustline state; establish/remove trustlines (Stellar only - other chains are informational) |
391
- | `<DistributionRulesModal>` | Manage the wallet's distribution rules |
392
- | `<SessionsModal>` | Lists every active refresh-token family for the current user with device metadata, marks the local session, per-row revoke, and a "Sign out everywhere" button |
393
- | `<KycModal>` | Identity verification: hosted (iframe or redirect) flow per option, corridor-scoped when a ramp route asks for it (`corridorId`), or started on one option (`providerId`). Shows review, expiry and retry states; without either id it walks the app's own KYC steps |
394
- | `<RampWidget>` | Buy/sell crypto: direction tabs, country, fiat and asset pickers, route comparison leg by leg, the fields a route asks for, then the order's progress with its pending action (payment QR or bank details, Authorize, co-sign approval, verification link) and what to do when a leg fails. Orders waiting on the user can be resumed. |
395
- | `<RequirementFormModal>` | One `FORM` requirement step of a ramp route: renders the form the backend names (`formId`), prefilled with the user's previous answers, and stores the answers encrypted. `<RampWidget>` opens it itself; exported for consumers who build their own route list from `requirementsRequired` |
396
- | `<RegistryCheckModal>` | One `REGISTRY_CHECK` step (SEGIP through Stereum, `optionId`): the verified identity prefilled and read-only except the surname split and the CI complement; a check the registry did not confirm shows the review state with nothing to retry |
397
- | `<ProviderRegistrationModal>` | One `PROVIDER_REGISTRATION` step (`corridorId`): lists what the ramp provider receives and registers the user with it on consent; an already registered user is passed through |
422
+ >
423
+ > The provider also shows three prompts by itself, with no opener: `<ConfirmModal>` (internal) for a signing call
424
+ > waiting under `confirmation: 'prompt'`, including a Soroban token transfer (`kind: 'sign_auth_entry'`) with its
425
+ > destination, amount and asset; `<CosignModal>` when a co-signed wallet has a request for this device; and
426
+ > `<CustodyMigrationModal>` while `custodyMigration.required` asks to move a custodial wallet to Turnkey.
427
+
428
+ | Component | Purpose |
429
+ | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
430
+ | `<WalletButton>` | Drop-in button. Opens login when signed out; signed in, shows the wallet address with a dropdown (Send, Receive, copy address, balance, history, ramp, KYC, distribution rules, sessions, recovery methods, sign out, plus a "Create account" action when the external wallet has no on-chain account yet). Inline arc spinner during in-progress transactions |
431
+ | `<SendModal>` | Full send flow: network picker (shown when the app has more than one chain), asset picker, amount with Max (from the available balance), destination with Paste, a Stellar memo (Text, ID or Hash: 64 hex characters), inline build > sign > success/error. A Stellar destination with no account offers to create it with the XLM being sent. Sending is available on Stellar and Solana; Polygon can be browsed but not sent from |
432
+ | `<SwapModal>` | On-chain asset-to-asset swap on Stellar and Solana (a Network selector when the app has venues on both): pick from/to assets and amount, quote across venues, execute (auto-trustline on the buy asset when needed); paste a custom Stellar buy token (code + issuer). On Solana it sells what the Solana wallet holds, buys SOL or a token the app enabled, shows the route's output and minimum, and links the swap to Solscan. When the app offers a venue that crosses chains, a Receive on selector delivers a Solana swap to the user's Polygon wallet, shows each fee by kind, asks for a new price when the quote lapses and follows the delivery |
433
+ | `<EarnModal>` | Deposit/withdraw across DeFindex vaults and Blend pools on Stellar and the app's Solana opportunities, with a network picker when the app offers both: opportunity selection with the asset's logo and APY after fees, a position card (deposited, earned after fees, position), wallet balance, over-spend guards, auto-trustline on a Stellar deposit, and a result that names what happened, who paid the network fee and the explorer link |
434
+ | `<BridgeModal>` | Opened with `openBridgeModal()`: moves USDC between the user's own wallets on Stellar, Solana and Polygon by Circle CCTP (mainnet). Picks the direction among the ones the user holds wallets for, quotes what arrives and Pollar's fee, signs the way the source wallet signs (custodial at once, co-signed on the device, an external wallet in the connected wallet), and follows the transfer until the USDC arrives |
435
+ | `<ReceiveModal>` | Wallet address as QR code with copy-to-clipboard (no external QR dependency required) |
436
+ | `<TxHistoryModal>` | Paginated multichain transaction history with auto-fetch on open. A `<ChainSelect>` in the header filters server-side (switching networks refetches and resets to page 1); rows link to their own chain's explorer (stellar.expert for Stellar, explorer.solana.com for Solana) and show the unified `{ amount, unit }` fee. Ramp orders appear as rows with their fiat side, say when one was refunded, and link to the explorer once they have a hash |
437
+ | `<WalletBalanceModal>` | Multichain wallet balances (Stellar, Polygon, Solana). A `<ChainSelect>` picks the network and the rows are filtered to it; shows that chain's address plus a refresh button, and each row's issuer with a copy action. An unreadable chain's balance renders as a dash, never as `0`. On Solana testnet each row offers a faucet hint - a devnet SOL faucet on the native row, Circle's USDC faucet on the USDC row |
438
+ | `<EnabledAssetsModal>` | The application's dashboard-enabled assets for the network picked in the header, with per-asset trustline state; establish/remove trustlines (Stellar only - other chains are informational) |
439
+ | `<DistributionRulesModal>` | Manage the wallet's distribution rules |
440
+ | `<SessionsModal>` | Lists every active refresh-token family for the current user with device metadata, marks the local session, per-row revoke, and a "Sign out everywhere" button |
441
+ | `<KycModal>` | Identity verification: hosted (iframe or redirect) flow per option, corridor-scoped when a ramp route asks for it (`corridorId`), or started on one option (`providerId`). Shows review, expiry and retry states; without either id it walks the app's own KYC steps. While the vendor's page is open it reads the status every 4 seconds and shows the result once it settles |
442
+ | `<RampWidget>` | Buy/sell crypto: direction tabs, country, fiat and asset pickers, route comparison leg by leg, the fields a route asks for, then the order's progress with its pending action (payment QR or bank details, Authorize, co-sign approval, verification link) and what to do when a leg fails. A route refused for its amount says the minimum or maximum it takes and offers "Change amount"; an order whose price changed before anything moved offers "Get a new quote". A stopped order says why, and one that needs support links to the app's contact (the client's `support`, else the dashboard's) with the order id to copy. Orders waiting on the user can be resumed |
443
+ | `<RequirementFormModal>` | One `FORM` requirement step of a ramp route: renders the form the backend names (`formId`), prefilled with the user's previous answers, and stores the answers encrypted. A field with `showIf: { key, in }` is shown only while the earlier select, multiselect or checkbox it names answers one of those values, and is neither checked nor sent while hidden. `<RampWidget>` opens it itself; exported for consumers who build their own route list from `requirementsRequired` |
444
+ | `<RegistryCheckModal>` | One `REGISTRY_CHECK` step (SEGIP through Stereum, `optionId`): the verified identity prefilled and read-only except the surname split and the CI complement; a check the registry did not confirm shows the review state with nothing to retry |
445
+ | `<ProviderRegistrationModal>` | One `PROVIDER_REGISTRATION` step (`corridorId`): lists what the ramp provider receives and registers the user with it on consent; an already registered user is passed through |
446
+ | `<CardModal>` | Opened with `openCardModal()`: the card provider's sign-up, identity verification and issuing, then the card with the app's logo and label, its balance and movements, and the number revealed on the device. Copy buttons next to the number and CVC while the details are shown, and next to the expiry date always. Funds the card from the wallet, including a co-signed one, with a network picker when the user holds a wallet on Stellar and Solana, and shows each funding's steps. The network picker offers only the chains `getCardFundingRoutes()` lists, and says when a funding crosses chains |
447
+ | `<RecoveryModal>` | Opened with `openRecoveryModal()`: the recovery methods of a Turnkey wallet (passkeys, email, devices, recovery phrase). The provider also opens it by itself when a co-signed signature fails with `SDK_WALLET_RECOVERY_REQUIRED` (no recovery method yet) or `SDK_COSIGN_DEVICE_NOT_ENROLLED` (this browser origin is not one of the wallet's devices), from any modal or a direct app call |
448
+ | `<CosignModal>` | The approval prompt of a co-signed wallet. Enables Approve only after the request verifies against Turnkey. On a device that is not one of the wallet's devices it disables Approve and offers Link this device, which opens recovery |
449
+ | `<CustodyMigrationModal>` | Moves a custodial wallet to Turnkey after login when the app keeps its wallets there (`state`, `onMoved`, `onLater` props) |
450
+ | `<LoginFlow>` | The app's sign-in inline in the host's page, with no backdrop and no close button, at the width of its container. For a page whose first job is signing the user in; once signed in, read `isAuthenticated` and swap it for the next screen |
451
+ | `<KycFlow>` | The app's own KYC steps inline in the host's page (`onApproved`, `country`, `level`): the pending step's card (the vendor's verification or a form), the next one as soon as a step is approved, and nothing once every step is complete. Signed-in users only |
452
+ | `<KycStatus>` | A KYC status badge (`status`, optional `label`) |
453
+ | `<RouteDisplay>` / `<RejectedRouteDisplay>` | One ramp route, offered or refused, as the ramp widget lists it |
398
454
 
399
455
  ```tsx
400
456
  import { WalletButton } from '@pollar/react';
@@ -408,9 +464,9 @@ export function Header() {
408
464
 
409
465
  ### Template components
410
466
 
411
- Almost every modal ships a pure presentational "template" companion — same name with a `Template` suffix. Use these when
412
- you want to swap the chrome but keep the data wiring from `usePollar()`. (`<EarnModal>`, `<RequirementFormModal>`,
413
- `<RegistryCheckModal>` and `<ProviderRegistrationModal>` are the exceptions: they have no template yet.)
467
+ Almost every modal ships a pure presentational "template" companion - same name with a `Template` suffix. Use these when
468
+ you want to swap the chrome but keep the data wiring from `usePollar()`. (`<EarnModal>`, `<CardModal>`, `<RequirementFormModal>`,
469
+ `<RegistryCheckModal>` and `<ProviderRegistrationModal>` are the exceptions: they have no template.)
414
470
 
415
471
  > The enabled-assets template requires `chains`, `selectedChain` and `onSelectChain`; the wallet-balance, send and
416
472
  > receive templates require `selectedChain` and take `chains` / `onSelectChain` as optional - pass both to show the
@@ -434,16 +490,20 @@ you want to swap the chrome but keep the data wiring from `usePollar()`. (`<Earn
434
490
  | `<KycModal>` | `<KycModalTemplate>` |
435
491
  | `<RampWidget>` | `<RampWidgetTemplate>` |
436
492
  | `<SessionsModal>` | `<SessionsModalTemplate>` |
493
+ | `<BridgeModal>` | `<BridgeModalTemplate>` |
494
+ | `<CosignModal>` | `<CosignModalTemplate>` |
495
+ | `<RecoveryModal>` | `<RecoveryModalTemplate>` |
496
+ | `<CustodyMigrationModal>` | `<CustodyMigrationModalTemplate>` |
437
497
 
438
- `<TxStatusView>` is the shared status component (build → sign → success/error) reused by `TransactionModal` and
439
- `SendModal`; it's exported on its own for consumers that want to embed the lifecycle elsewhere.
498
+ `<TxStatusView>` is the shared status component (build -> sign -> success/error) reused by `TransactionModal` and
499
+ `SendModal`; it's exported on its own for consumers that want to embed the lifecycle elsewhere. It shows the same
500
+ review as `<ConfirmModal>` and `<CosignModal>`: the asset and chain logos with the sender and recipient, the fee badge
501
+ once the platform reports who paid, and "Show details".
440
502
 
441
503
  > `onWalletConnect` is **optional** on `<LoginModalTemplate>` (defaults to a no-op).
442
504
 
443
505
  > `notReadyReason` is **optional** on `<SendModalTemplate>`, `<ReceiveModalTemplate>` and
444
- > `<WalletButtonTemplate>`, and `onboardingStatus` is optional on `<RampWidgetTemplate>` - a custom
445
- > template written before 0.11.4 keeps compiling and keeps its old wording. Render `notReadyReason`
446
- > when it is present: it is the sentence for a Stellar account the platform is still creating, and
506
+ > `<WalletButtonTemplate>`. Render it when it is present: it is the sentence for a Stellar account the platform is still creating, and
447
507
  > without it a custom Send lets the user build a payment the server will refuse
448
508
  > (`SDK_WALLET_NOT_READY`). To phrase it yourself, call the exported
449
509
  > `walletNotReadyReason(wallet, chain)`. It gates on `STELLAR` and on the ACCOUNT only, so a
@@ -455,41 +515,72 @@ you want to swap the chrome but keep the data wiring from `usePollar()`. (`<Earn
455
515
  ### Custom adapters
456
516
 
457
517
  The `adapters` prop on `<PollarProvider>` accepts any named set of `PollarAdapter` objects. Each adapter function
458
- receives params, returns an unsigned XDR, and Pollar handles signing and submission automatically.
518
+ receives params and returns either an unsigned transaction or a Soroban auth entry to sign; Pollar handles the
519
+ signing (and, for a transaction, the submission).
459
520
 
460
521
  ```tsx
461
522
  import type { PollarAdapter } from '@pollar/core';
462
523
 
463
- const trustlessWork: PollarAdapter = {
464
- initialize: async (params) => ({ unsignedTransaction: '…' }),
465
- release: async (params) => ({ unsignedTransaction: '…' }),
466
- };
524
+ const trustlessWork = {
525
+ initialize: async (params: InitializeParams) => ({ unsignedTransaction: '...' }),
526
+ release: async (params: ReleaseParams) => ({ unsignedTransaction: '...' }),
527
+ } satisfies PollarAdapter;
467
528
 
468
529
  <PollarProvider client={{ apiKey }} adapters={{ trustlessWork }}>
469
- …
530
+ ...
470
531
  </PollarProvider>;
471
532
  ```
472
533
 
473
534
  #### `createPollarAdapterHook(key)`
474
535
 
475
- Factory that generates a fully-typed hook mirroring an adapter's API with automatic XDR signing built in:
536
+ Factory that generates a fully-typed hook mirroring an adapter's API with signing built in:
476
537
 
477
- ```ts
538
+ ```tsx
478
539
  import { createPollarAdapterHook } from '@pollar/react';
479
540
 
480
541
  const useTrustlessWork = createPollarAdapterHook<typeof trustlessWork>('trustlessWork');
481
542
 
482
- function MyComponent() {
543
+ function ReleaseButton() {
483
544
  const tw = useTrustlessWork();
484
- await tw.initialize({
485
- /* … */
486
- }); // unsigned XDR is built, signed, and submitted automatically
545
+ // The adapter builds the XDR; the hook signs and submits it and resolves with a SubmitOutcome.
546
+ return (
547
+ <button
548
+ onClick={() =>
549
+ tw.release({
550
+ /* ... */
551
+ })
552
+ }
553
+ >
554
+ Release
555
+ </button>
556
+ );
487
557
  }
488
558
  ```
489
559
 
560
+ #### Auth-entry steps
561
+
562
+ When someone else submits the call and pays its fee (an x402 facilitator, a contract that sponsors the gas), an
563
+ adapter function answers `{ unsignedAuthEntry, validUntilLedger, complete }` instead of `{ unsignedTransaction }`.
564
+ The hook signs the entry with the user's wallet through `signAuthEntry` (the app's allowlist, the validity window,
565
+ the signature confirmation, a co-signed wallet's vote), submits nothing, and passes the signed entry to `complete`.
566
+ The call resolves with `{ status: 'completed', result }`, where `result` is what `complete` returned, or with the
567
+ signing outcome that stopped it (`{ status: 'cosign_pending', request }` or `{ status: 'error', code?, details? }`).
568
+
569
+ ```ts
570
+ const x402 = {
571
+ pay: async (params: PayParams) => ({
572
+ unsignedAuthEntry: entryXdr, // base64 XDR of the unsigned SorobanAuthorizationEntry
573
+ validUntilLedger, // within the app's validity window
574
+ complete: async (signedAuthEntry: string) => submitToFacilitator(signedAuthEntry),
575
+ }),
576
+ } satisfies PollarAdapter;
577
+ ```
578
+
579
+ `isAuthEntryAdapterStep` and `completeAuthEntryStep` (from `@pollar/core`) run the same step outside React.
580
+
490
581
  ---
491
582
 
492
- ### External wallet stacks (Stellar Wallets Kit, …)
583
+ ### External wallet stacks (Stellar Wallets Kit, ...)
493
584
 
494
585
  Register adapters for wallets that live outside `@pollar/core` by passing a
495
586
  `walletAdapters: WalletAdapter[]` array. `LoginModal` auto-renders one button per
@@ -516,7 +607,7 @@ import { Networks } from '@creit.tech/stellar-wallets-kit';
516
607
 
517
608
  Each adapter's `meta.group` controls placement: adapters sharing a group label
518
609
  collapse behind one gateway button (the kit wallets default to `'Wallet'`),
519
- while adapters with no group — e.g. Privy — render as their own button in the
610
+ while adapters with no group - e.g. Privy - render as their own button in the
520
611
  root view. Pass `picker.groupLabel` to give the kit wallets a distinct gateway.
521
612
 
522
613
  ---
@@ -548,13 +639,20 @@ import type {
548
639
  PollarAuthProvider,
549
640
  AuthProviderContext,
550
641
 
551
- // Network picker
642
+ // Network picker and co-signing
552
643
  ChainSelectProps,
553
644
  UseChainsResult,
645
+ UseCosignResult,
646
+
647
+ // Modal theming
648
+ ModalStyleOverrides,
649
+ ModalVariant,
650
+ ModalChrome,
554
651
 
555
652
  // Template props
556
653
  WalletButtonTemplateProps,
557
654
  SendModalTemplateProps,
655
+ SendMemoType,
558
656
  SwapModalTemplateProps,
559
657
  SwapAssetOption,
560
658
  ReceiveModalTemplateProps,
@@ -562,8 +660,13 @@ import type {
562
660
  TxStatusViewProps,
563
661
  WalletBalanceModalTemplateProps,
564
662
  EnabledAssetsModalTemplateProps,
663
+ CustomTrustlineModalTemplateProps,
565
664
  SessionsModalTemplateProps,
566
665
  SessionsState,
666
+ CosignModalTemplateProps,
667
+ RecoveryModalTemplateProps,
668
+ RecoveryView,
669
+ CustodyMigrationModalTemplateProps,
567
670
 
568
671
  // Step unions
569
672
  KycStep,
@@ -572,7 +675,8 @@ import type {
572
675
  ```
573
676
 
574
677
  The state types (`TransactionState`, `TxHistoryState`, `WalletBalanceState`, `NetworkState`, `AuthState`,
575
- `PollarPersistedSession`, `PollarUserProfile`, `SessionInfo`, …) are re-exported from `@pollar/core`.
678
+ `CosignState`, `RecoveryState`, `PendingConfirmation`, `PollarPersistedSession`, `PollarUserProfile`, `SessionInfo`,
679
+ `PollarLanguage`, ...) are exported by `@pollar/core`; import them from there.
576
680
 
577
681
  ---
578
682