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

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,20 @@
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. `<RequirementFormModal>` asks a field
10
+ > with `showIf` only while the answer it depends on matches. `<CardModal>` copies the number, expiry date and CVC,
11
+ > offers a network picker when the user holds a wallet on Stellar and Solana, and funds the card from a co-signed
12
+ > wallet too. The email code input takes an autofilled one-time code. The ramp widget says a route's minimum or
13
+ > maximum and offers "Change amount", and an order whose price changed before anything moved offers "Get a new quote".
14
+ > A hook built with `createPollarAdapterHook` signs the auth entry an adapter answers with, without submitting
15
+ > anything, and hands it to the adapter's `complete`.
14
16
  >
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.
17
+ > 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
18
 
103
19
  ## Installation
104
20
 
@@ -110,7 +26,8 @@ pnpm add @pollar/react @pollar/core
110
26
  yarn add @pollar/react @pollar/core
111
27
  ```
112
28
 
113
- **Peer dependencies:** `react >= 18`, `react-dom >= 18`. Node ≥ 20 in toolchains.
29
+ **Peer dependencies:** `@pollar/core ^0.12.1`, `react >= 18`, `react-dom >= 18`. Node >= 20 in toolchains. npm 7+
30
+ installs peers automatically; on npm 6, Yarn 1 or `--legacy-peer-deps`, list `@pollar/core` in your own dependencies.
114
31
 
115
32
  ## Quick Start
116
33
 
@@ -158,17 +75,20 @@ Context provider that initialises the Pollar client and makes it available to ch
158
75
  <PollarProvider
159
76
  client={{
160
77
  apiKey: 'your-api-key',
161
- baseUrl: 'https://sdk.api.pollar.xyz', // optional, origin only — the SDK appends /v3
78
+ baseUrl: 'https://sdk.api.pollar.xyz', // optional, origin only - the SDK appends /v3
162
79
  stellarNetwork: 'testnet', // optional, default: 'testnet'
80
+ locale: 'pt-BR', // optional, BCP 47 tag for the modals' language (see Language below)
163
81
  storage, // optional, RN apps inject this
164
82
  keyManager, // optional, autodetects on web
165
- walletAdapters, // optional, WalletAdapter[] — external wallet stacks
166
- deviceLabel: 'iPhone — Safari', // optional, shown in SessionsModal
83
+ walletAdapters, // optional, WalletAdapter[] - external wallet stacks
84
+ deviceLabel: 'iPhone - Safari', // optional, shown in SessionsModal
167
85
  onStorageDegrade, // optional, telemetry hook
168
86
  }}
169
- // Optional: pass `appConfig` (even `{}`) to skip the remote
170
- // `/applications/config` fetch and use local-only styles/branding.
87
+ // Optional: pass `appConfig` to skip the remote `/applications/config` fetch
88
+ // and use a local config instead. `application` is required; `styles` may be partial,
89
+ // but a login method it leaves out (emailEnabled, providers, ...) is off.
171
90
  appConfig={{
91
+ application: { name: 'My app', network: 'testnet', chains: ['STELLAR'] },
172
92
  styles: {
173
93
  /* optional style overrides */
174
94
  },
@@ -183,35 +103,38 @@ Context provider that initialises the Pollar client and makes it available to ch
183
103
  </PollarProvider>
184
104
  ```
185
105
 
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 |
106
+ | Prop | Type | Required | Description |
107
+ | ------------------ | ------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
108
+ | `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 |
109
+ | `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) |
110
+ | `adapters` | `PollarAdapters` | No | Named set of `PollarAdapter` objects (e.g. Trustless Work). See [Custom adapters](#custom-adapters) |
111
+ | `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
112
 
192
113
  ---
193
114
 
194
115
  ### `usePollar()`
195
116
 
196
- Returns the full Pollar context. Every modal opener returned here renders an already-wired modal — no extra mounting
117
+ Returns the full Pollar context. Every modal opener returned here renders an already-wired modal - no extra mounting
197
118
  needed.
198
119
 
199
120
  ```ts
200
121
  const {
201
122
  // Session
202
- isAuthenticated, // boolean - true when a wallet address is present
123
+ isAuthenticated, // boolean - true while a session exists, with or without a wallet
203
124
  wallet, // WalletInfo | null - read wallet?.address for the on-chain address
204
125
  wallets, // WalletInfo[] - every wallet the user holds, one per chain. To drive
205
126
  // a network picker, prefer the useChains() hook (below) over reading
206
127
  // this directly - it applies the app's configured chain order
207
128
  verified, // boolean - true once the server has confirmed the session
129
+ hasWallet, // boolean - false until createWallet() runs on an app that creates wallets on demand
130
+ createWallet, // (options?: { custody? }) => Promise<WalletInfo> (custody: the user's pick under USER_CHOICE)
208
131
 
209
132
  // App config (the remote /config fetch behind the login modal)
210
133
  configStatus, // 'loading' | 'ready' | 'error'
211
134
  retryConfig, // () => void - re-runs the fetch after an error
212
135
 
213
136
  // Client escape hatch
214
- getClient, // () => PollarClient - for getUserProfile(), listSessions(), …
137
+ getClient, // () => PollarClient - for getUserProfile(), listSessions(), ...
215
138
 
216
139
  // Auth
217
140
  login, // (options: PollarLoginOptions) => void
@@ -222,6 +145,20 @@ const {
222
145
  sessions, // SessionsState
223
146
  openSessionsModal, // () => void
224
147
 
148
+ // Co-signed wallets (Turnkey)
149
+ cosign, // CosignState - requests waiting for this device's vote
150
+ openCosignModal, // () => void (also opens by itself when a request arrives)
151
+ setCosignNextStep, // (next: string | null) => void - keeps the prompt open for a flow's next approval
152
+ recovery, // RecoveryState | null
153
+ recoveryLocked, // boolean - true while the wallet cannot be recovered without this device
154
+ refreshRecovery, // () => void
155
+ openRecoveryModal, // () => void (passkeys, email, devices, recovery phrase)
156
+ custodyMigration, // CustodyMigrationState | null - while `required`, the provider shows the move to Turnkey
157
+ refreshCustodyMigration, // () => void
158
+
159
+ // Signature confirmation
160
+ confirmations, // PendingConfirmation[] - signing calls waiting under confirmation: 'prompt'; the provider shows the first
161
+
225
162
  // Transactions
226
163
  tx, // TransactionState
227
164
  buildTx, // (operation, params, options?) => Promise<BuildOutcome>
@@ -250,15 +187,15 @@ const {
250
187
 
251
188
  // Swap (DEX/AMM)
252
189
  getSwapQuote, // (params: SwapQuoteParams) => Promise<SwapQuote[]>
253
- swap, // (quote: SwapQuote, opts?) => Promise<SubmitOutcome>
190
+ swap, // (quote: SwapQuote, opts?: { autoTrustline? }) => Promise<SubmitOutcome>
254
191
  getSwapConfig, // () => Promise<SwapVenue[]> (which venues this app offers)
255
192
  getSwapTokens, // () => Promise<SwapToken[]>
256
193
  getSolanaSwapConfig, // () => Promise<SolanaSwapVenue[]> (Jupiter, Titan; mainnet)
257
194
  getSolanaSwapQuote, // (params: SolanaSwapQuoteParams) => Promise<SolanaSwapQuote[]>
258
- swapSolana, // (quote: SolanaSwapQuote, opts?) => Promise<SubmitOutcome>
195
+ swapSolana, // (quote: SolanaSwapQuote, opts?: { slippageBps? }) => Promise<SubmitOutcome>
259
196
  openSwapModal, // () => void
260
197
 
261
- // Earn (yield vaults + lending — DeFindex + Blend)
198
+ // Earn (yield vaults + lending - DeFindex + Blend)
262
199
  getEarnProviders, // () => Promise<EarnProviderId[]> ([] means Earn is disabled)
263
200
  getEarnOpportunities, // (provider: EarnProviderId) => Promise<EarnOpportunity[]>
264
201
  getEarnPosition, // (params: EarnPositionParams) => Promise<EarnPosition>
@@ -266,6 +203,9 @@ const {
266
203
  earnWithdraw, // (params: EarnTxParams) => Promise<SubmitOutcome>
267
204
  openEarnModal, // () => void
268
205
 
206
+ // Cards (the card calls live on getClient(): getCardProviders, issueCard, fundCard, ...)
207
+ openCardModal, // () => void
208
+
269
209
  // Distribution rules
270
210
  openDistributionRulesModal, // () => void
271
211
 
@@ -302,7 +242,7 @@ Custody is derived from `wallet`, not a separate field - e.g.
302
242
  login({ provider: 'google' });
303
243
  login({ provider: 'github' });
304
244
 
305
- // Email OTP
245
+ // Email OTP (the code input accepts a code the browser or keyboard autofills, or a paste)
306
246
  login({ provider: 'email', email: 'user@example.com' });
307
247
 
308
248
  // Built-in Stellar wallet adapters (the adapter's `type` IS the provider)
@@ -323,7 +263,7 @@ The login modal is gated on the remote app-config fetch. While it runs the modal
323
263
  driving `<LoginModalTemplate>` yourself. Passing `appConfig` to `<PollarProvider>` opts out of the fetch entirely, so
324
264
  neither state can occur.
325
265
 
326
- #### Self-driving interactive adapters (Privy, …)
266
+ #### Self-driving interactive adapters (Privy, ...)
327
267
 
328
268
  Registered adapters that opt into the interactive-auth contract
329
269
  (`isInteractiveAuthAdapter` + `onProviderAuthChange`) are auto-driven by the
@@ -346,7 +286,7 @@ provider:
346
286
  The single source of truth for "which chains, in what order, and which address to
347
287
  show". Every built-in component (`<WalletButton>`, the network pickers) reads from
348
288
  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 —
289
+ own wallet button or picker instead of calling `chainsOf(wallets)` yourself -
350
290
  `chainsOf` alone cannot know the app's configured order.
351
291
 
352
292
  ```ts
@@ -360,7 +300,7 @@ const { chains, primaryChain, primaryAddress, ready } = useChains();
360
300
  | `chains` | `WalletChain[]` | Chains to offer, in the app's configured order: those the app serves **and** the user holds. `[]` until config resolves |
361
301
  | `primaryChain` | `WalletChain \| null` | The app's first configured chain the user holds. `null` until ready |
362
302
  | `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 |
303
+ | `ready` | `boolean` | `false` while `/config` is loading or failed - gate any chain UI on it |
364
304
 
365
305
  The order and membership come from the app's `/applications/config`
366
306
  (`appConfig.application.chains`), not from the session's `wallets`: a chain the app
@@ -369,32 +309,60 @@ session still carries it.
369
309
 
370
310
  ---
371
311
 
312
+ ### Language
313
+
314
+ Every modal, shared block (footer, copy button, amount field, pickers) and exported template speaks English (`en`),
315
+ Spanish (`es`) and Portuguese (`pt`). The provider picks the language once, in this order:
316
+
317
+ 1. The language the app pins in the dashboard (Branding > Language, served as `styles.language`).
318
+ 2. The `language` prop of `<RampWidget>`, `<KycModal>`, `<RequirementFormModal>`, `<RegistryCheckModal>` or
319
+ `<ProviderRegistrationModal>`, a BCP 47 tag.
320
+ 3. The client's `locale` (`client={{ apiKey, locale: 'pt-BR' }}`), any BCP 47 tag.
321
+ 4. The browser language.
322
+
323
+ A tag the modals have no translation for is skipped, and English is the fallback. Every exported template takes a
324
+ `language` prop (`PollarLanguage` from `@pollar/core`: `'en' | 'es' | 'pt'`); a template rendered inside the provider
325
+ follows the provider's language, and one rendered outside it uses the browser's.
326
+
327
+ ---
328
+
372
329
  ### Components
373
330
 
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.
331
+ Every modal mounts itself when its `openXModal()` action is called. You don't need to render these directly - they're
332
+ already wired inside `<PollarProvider>` - and most are exported in case you want to mount them yourself.
376
333
 
377
334
  > Two wrappers are **not** exported: `<TxHistoryModal>` and `<TransactionModal>`. Only their templates
378
335
  > (`TxHistoryModalTemplate` / `TransactionModalTemplate`) are public. Mount those instead if you need to drive them
379
336
  > 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 |
337
+ >
338
+ > The provider also shows three prompts by itself, with no opener: `<ConfirmModal>` (internal) for a signing call
339
+ > waiting under `confirmation: 'prompt'`, including a Soroban token transfer (`kind: 'sign_auth_entry'`) with its
340
+ > destination, amount and asset; `<CosignModal>` when a co-signed wallet has a request for this device; and
341
+ > `<CustodyMigrationModal>` while `custodyMigration.required` asks to move a custodial wallet to Turnkey.
342
+
343
+ | Component | Purpose |
344
+ | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
345
+ | `<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 |
346
+ | `<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 |
347
+ | `<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 |
348
+ | `<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 |
349
+ | `<ReceiveModal>` | Wallet address as QR code with copy-to-clipboard (no external QR dependency required) |
350
+ | `<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 |
351
+ | `<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 |
352
+ | `<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) |
353
+ | `<DistributionRulesModal>` | Manage the wallet's distribution rules |
354
+ | `<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 |
355
+ | `<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 |
356
+ | `<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". Orders waiting on the user can be resumed |
357
+ | `<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` |
358
+ | `<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 |
359
+ | `<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 |
360
+ | `<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 |
361
+ | `<RecoveryModal>` | Opened with `openRecoveryModal()`: the recovery methods of a Turnkey wallet (passkeys, email, devices, recovery phrase) |
362
+ | `<CosignModal>` | The approval prompt of a co-signed wallet. Enables Approve only after the request verifies against Turnkey |
363
+ | `<CustodyMigrationModal>` | Moves a custodial wallet to Turnkey after login when the app keeps its wallets there (`state`, `onMoved`, `onLater` props) |
364
+ | `<KycStatus>` | A KYC status badge (`status`, optional `label`) |
365
+ | `<RouteDisplay>` / `<RejectedRouteDisplay>` | One ramp route, offered or refused, as the ramp widget lists it |
398
366
 
399
367
  ```tsx
400
368
  import { WalletButton } from '@pollar/react';
@@ -408,9 +376,9 @@ export function Header() {
408
376
 
409
377
  ### Template components
410
378
 
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.)
379
+ Almost every modal ships a pure presentational "template" companion - same name with a `Template` suffix. Use these when
380
+ you want to swap the chrome but keep the data wiring from `usePollar()`. (`<EarnModal>`, `<CardModal>`, `<RequirementFormModal>`,
381
+ `<RegistryCheckModal>` and `<ProviderRegistrationModal>` are the exceptions: they have no template.)
414
382
 
415
383
  > The enabled-assets template requires `chains`, `selectedChain` and `onSelectChain`; the wallet-balance, send and
416
384
  > receive templates require `selectedChain` and take `chains` / `onSelectChain` as optional - pass both to show the
@@ -434,16 +402,17 @@ you want to swap the chrome but keep the data wiring from `usePollar()`. (`<Earn
434
402
  | `<KycModal>` | `<KycModalTemplate>` |
435
403
  | `<RampWidget>` | `<RampWidgetTemplate>` |
436
404
  | `<SessionsModal>` | `<SessionsModalTemplate>` |
405
+ | `<CosignModal>` | `<CosignModalTemplate>` |
406
+ | `<RecoveryModal>` | `<RecoveryModalTemplate>` |
407
+ | `<CustodyMigrationModal>` | `<CustodyMigrationModalTemplate>` |
437
408
 
438
- `<TxStatusView>` is the shared status component (build → sign → success/error) reused by `TransactionModal` and
409
+ `<TxStatusView>` is the shared status component (build -> sign -> success/error) reused by `TransactionModal` and
439
410
  `SendModal`; it's exported on its own for consumers that want to embed the lifecycle elsewhere.
440
411
 
441
412
  > `onWalletConnect` is **optional** on `<LoginModalTemplate>` (defaults to a no-op).
442
413
 
443
414
  > `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
415
+ > `<WalletButtonTemplate>`. Render it when it is present: it is the sentence for a Stellar account the platform is still creating, and
447
416
  > without it a custom Send lets the user build a payment the server will refuse
448
417
  > (`SDK_WALLET_NOT_READY`). To phrase it yourself, call the exported
449
418
  > `walletNotReadyReason(wallet, chain)`. It gates on `STELLAR` and on the ACCOUNT only, so a
@@ -455,41 +424,72 @@ you want to swap the chrome but keep the data wiring from `usePollar()`. (`<Earn
455
424
  ### Custom adapters
456
425
 
457
426
  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.
427
+ receives params and returns either an unsigned transaction or a Soroban auth entry to sign; Pollar handles the
428
+ signing (and, for a transaction, the submission).
459
429
 
460
430
  ```tsx
461
431
  import type { PollarAdapter } from '@pollar/core';
462
432
 
463
- const trustlessWork: PollarAdapter = {
464
- initialize: async (params) => ({ unsignedTransaction: '…' }),
465
- release: async (params) => ({ unsignedTransaction: '…' }),
466
- };
433
+ const trustlessWork = {
434
+ initialize: async (params: InitializeParams) => ({ unsignedTransaction: '...' }),
435
+ release: async (params: ReleaseParams) => ({ unsignedTransaction: '...' }),
436
+ } satisfies PollarAdapter;
467
437
 
468
438
  <PollarProvider client={{ apiKey }} adapters={{ trustlessWork }}>
469
- …
439
+ ...
470
440
  </PollarProvider>;
471
441
  ```
472
442
 
473
443
  #### `createPollarAdapterHook(key)`
474
444
 
475
- Factory that generates a fully-typed hook mirroring an adapter's API with automatic XDR signing built in:
445
+ Factory that generates a fully-typed hook mirroring an adapter's API with signing built in:
476
446
 
477
- ```ts
447
+ ```tsx
478
448
  import { createPollarAdapterHook } from '@pollar/react';
479
449
 
480
450
  const useTrustlessWork = createPollarAdapterHook<typeof trustlessWork>('trustlessWork');
481
451
 
482
- function MyComponent() {
452
+ function ReleaseButton() {
483
453
  const tw = useTrustlessWork();
484
- await tw.initialize({
485
- /* … */
486
- }); // unsigned XDR is built, signed, and submitted automatically
454
+ // The adapter builds the XDR; the hook signs and submits it and resolves with a SubmitOutcome.
455
+ return (
456
+ <button
457
+ onClick={() =>
458
+ tw.release({
459
+ /* ... */
460
+ })
461
+ }
462
+ >
463
+ Release
464
+ </button>
465
+ );
487
466
  }
488
467
  ```
489
468
 
469
+ #### Auth-entry steps
470
+
471
+ When someone else submits the call and pays its fee (an x402 facilitator, a contract that sponsors the gas), an
472
+ adapter function answers `{ unsignedAuthEntry, validUntilLedger, complete }` instead of `{ unsignedTransaction }`.
473
+ The hook signs the entry with the user's wallet through `signAuthEntry` (the app's allowlist, the validity window,
474
+ the signature confirmation, a co-signed wallet's vote), submits nothing, and passes the signed entry to `complete`.
475
+ The call resolves with `{ status: 'completed', result }`, where `result` is what `complete` returned, or with the
476
+ signing outcome that stopped it (`{ status: 'cosign_pending', request }` or `{ status: 'error', code?, details? }`).
477
+
478
+ ```ts
479
+ const x402 = {
480
+ pay: async (params: PayParams) => ({
481
+ unsignedAuthEntry: entryXdr, // base64 XDR of the unsigned SorobanAuthorizationEntry
482
+ validUntilLedger, // within the app's validity window
483
+ complete: async (signedAuthEntry: string) => submitToFacilitator(signedAuthEntry),
484
+ }),
485
+ } satisfies PollarAdapter;
486
+ ```
487
+
488
+ `isAuthEntryAdapterStep` and `completeAuthEntryStep` (from `@pollar/core`) run the same step outside React.
489
+
490
490
  ---
491
491
 
492
- ### External wallet stacks (Stellar Wallets Kit, …)
492
+ ### External wallet stacks (Stellar Wallets Kit, ...)
493
493
 
494
494
  Register adapters for wallets that live outside `@pollar/core` by passing a
495
495
  `walletAdapters: WalletAdapter[]` array. `LoginModal` auto-renders one button per
@@ -516,7 +516,7 @@ import { Networks } from '@creit.tech/stellar-wallets-kit';
516
516
 
517
517
  Each adapter's `meta.group` controls placement: adapters sharing a group label
518
518
  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
519
+ while adapters with no group - e.g. Privy - render as their own button in the
520
520
  root view. Pass `picker.groupLabel` to give the kit wallets a distinct gateway.
521
521
 
522
522
  ---
@@ -548,13 +548,20 @@ import type {
548
548
  PollarAuthProvider,
549
549
  AuthProviderContext,
550
550
 
551
- // Network picker
551
+ // Network picker and co-signing
552
552
  ChainSelectProps,
553
553
  UseChainsResult,
554
+ UseCosignResult,
555
+
556
+ // Modal theming
557
+ ModalStyleOverrides,
558
+ ModalVariant,
559
+ ModalChrome,
554
560
 
555
561
  // Template props
556
562
  WalletButtonTemplateProps,
557
563
  SendModalTemplateProps,
564
+ SendMemoType,
558
565
  SwapModalTemplateProps,
559
566
  SwapAssetOption,
560
567
  ReceiveModalTemplateProps,
@@ -562,8 +569,13 @@ import type {
562
569
  TxStatusViewProps,
563
570
  WalletBalanceModalTemplateProps,
564
571
  EnabledAssetsModalTemplateProps,
572
+ CustomTrustlineModalTemplateProps,
565
573
  SessionsModalTemplateProps,
566
574
  SessionsState,
575
+ CosignModalTemplateProps,
576
+ RecoveryModalTemplateProps,
577
+ RecoveryView,
578
+ CustodyMigrationModalTemplateProps,
567
579
 
568
580
  // Step unions
569
581
  KycStep,
@@ -572,7 +584,8 @@ import type {
572
584
  ```
573
585
 
574
586
  The state types (`TransactionState`, `TxHistoryState`, `WalletBalanceState`, `NetworkState`, `AuthState`,
575
- `PollarPersistedSession`, `PollarUserProfile`, `SessionInfo`, …) are re-exported from `@pollar/core`.
587
+ `CosignState`, `RecoveryState`, `PendingConfirmation`, `PollarPersistedSession`, `PollarUserProfile`, `SessionInfo`,
588
+ `PollarLanguage`, ...) are exported by `@pollar/core`; import them from there.
576
589
 
577
590
  ---
578
591