@pollar/react 0.12.1-rc.15 → 0.12.1-rc.17
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 +50 -34
- package/dist/index.css +907 -790
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +60 -10
- package/dist/index.d.ts +60 -10
- package/dist/index.js +4064 -3475
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4066 -3477
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -199,15 +199,25 @@ const {
|
|
|
199
199
|
getSwapTokens, // () => Promise<SwapToken[]>
|
|
200
200
|
getSolanaSwapConfig, // () => Promise<SolanaSwapVenue[]> (Jupiter, Titan; mainnet)
|
|
201
201
|
getSolanaSwapQuote, // (params: SolanaSwapQuoteParams) => Promise<SolanaSwapQuote[]>
|
|
202
|
-
swapSolana, // (quote: SolanaSwapQuote, opts?: { slippageBps? }) => Promise<SubmitOutcome>
|
|
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)
|
|
203
205
|
openSwapModal, // (options?: SwapModalOptions) => void
|
|
204
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
|
|
209
|
+
|
|
205
210
|
// Earn (yield vaults + lending - DeFindex + Blend)
|
|
206
211
|
getEarnProviders, // () => Promise<EarnProviderId[]> ([] means Earn is disabled)
|
|
207
212
|
getEarnOpportunities, // (provider: EarnProviderId) => Promise<EarnOpportunity[]>
|
|
208
213
|
getEarnPosition, // (params: EarnPositionParams) => Promise<EarnPosition>
|
|
209
214
|
earnDeposit, // (params: EarnTxParams) => Promise<SubmitOutcome>
|
|
210
215
|
earnWithdraw, // (params: EarnTxParams) => Promise<SubmitOutcome>
|
|
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>
|
|
211
221
|
openEarnModal, // (options?: EarnModalOptions) => void
|
|
212
222
|
|
|
213
223
|
// Cards (the card calls live on getClient(): getCardProviders, issueCard, fundCard, ...)
|
|
@@ -279,22 +289,26 @@ modal takes the same options as its `initial` prop.
|
|
|
279
289
|
```ts
|
|
280
290
|
openSendModal({ asset: 'USDC', destination: 'G...', amount: '25', memo: 'order-1042', onSuccess: ({ hash }) => save(hash) });
|
|
281
291
|
openSwapModal({ sell: 'XLM', buy: 'USDC', amount: '100' });
|
|
292
|
+
openSwapModal({ chain: 'SOLANA', destinationChain: 'POLYGON' });
|
|
282
293
|
openEarnModal({ provider: 'blend', tab: 'withdraw' });
|
|
294
|
+
openEarnModal({ chain: 'SOLANA' });
|
|
295
|
+
openBridgeModal({ fromChain: 'STELLAR', toChain: 'SOLANA', amount: '25', onSuccess: (transfer) => track(transfer.id) });
|
|
283
296
|
openReceiveModal({ chain: 'SOLANA' });
|
|
284
297
|
openCardModal({ panel: 'fund', amount: '50', onFunded: (funding) => track(funding.id) });
|
|
285
298
|
```
|
|
286
299
|
|
|
287
|
-
| Action | Options
|
|
288
|
-
| -------------------- |
|
|
289
|
-
| `openSendModal` | `chain`, `asset` (code), `destination`, `amount`, `memo`, `memoType` (`'text' \| 'id' \| 'hash'`), `onSuccess({ hash })`
|
|
290
|
-
| `openSwapModal` | `chain` (`'STELLAR' \| 'SOLANA'`), `sell` (code), `buy` (code), `amount`, `onSuccess({ hash })`
|
|
291
|
-
| `openEarnModal` | `provider`, `opportunityId`, `tab` (`'deposit' \| 'withdraw'`), `amount`, `onSuccess({ hash })`
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
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)` |
|
|
295
309
|
|
|
296
|
-
`onSuccess` is called once per transaction that lands while the modal is open
|
|
297
|
-
sends from the card modal. A Solana or Polygon send takes `amount` in the asset's decimals, as the form shows it.
|
|
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.
|
|
298
312
|
|
|
299
313
|
#### Login options
|
|
300
314
|
|
|
@@ -411,29 +425,30 @@ already wired inside `<PollarProvider>` - and most are exported in case you want
|
|
|
411
425
|
> destination, amount and asset; `<CosignModal>` when a co-signed wallet has a request for this device; and
|
|
412
426
|
> `<CustodyMigrationModal>` while `custodyMigration.required` asks to move a custodial wallet to Turnkey.
|
|
413
427
|
|
|
414
|
-
| Component | Purpose
|
|
415
|
-
| ------------------------------------------- |
|
|
416
|
-
| `<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
|
|
417
|
-
| `<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
|
|
418
|
-
| `<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
|
|
419
|
-
| `<EarnModal>` | Deposit/withdraw across DeFindex vaults and Blend pools
|
|
420
|
-
| `<
|
|
421
|
-
| `<
|
|
422
|
-
| `<
|
|
423
|
-
| `<
|
|
424
|
-
| `<
|
|
425
|
-
| `<
|
|
426
|
-
| `<
|
|
427
|
-
| `<
|
|
428
|
-
| `<
|
|
429
|
-
| `<
|
|
430
|
-
| `<
|
|
431
|
-
| `<
|
|
432
|
-
| `<
|
|
433
|
-
| `<
|
|
434
|
-
| `<
|
|
435
|
-
| `<
|
|
436
|
-
| `<
|
|
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 |
|
|
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". 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
|
+
| `<KycStatus>` | A KYC status badge (`status`, optional `label`) |
|
|
451
|
+
| `<RouteDisplay>` / `<RejectedRouteDisplay>` | One ramp route, offered or refused, as the ramp widget lists it |
|
|
437
452
|
|
|
438
453
|
```tsx
|
|
439
454
|
import { WalletButton } from '@pollar/react';
|
|
@@ -473,6 +488,7 @@ you want to swap the chrome but keep the data wiring from `usePollar()`. (`<Earn
|
|
|
473
488
|
| `<KycModal>` | `<KycModalTemplate>` |
|
|
474
489
|
| `<RampWidget>` | `<RampWidgetTemplate>` |
|
|
475
490
|
| `<SessionsModal>` | `<SessionsModalTemplate>` |
|
|
491
|
+
| `<BridgeModal>` | `<BridgeModalTemplate>` |
|
|
476
492
|
| `<CosignModal>` | `<CosignModalTemplate>` |
|
|
477
493
|
| `<RecoveryModal>` | `<RecoveryModalTemplate>` |
|
|
478
494
|
| `<CustodyMigrationModal>` | `<CustodyMigrationModalTemplate>` |
|