@pollar/react 0.10.0-rc.0 → 0.10.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -47
- package/dist/index.css +40 -11
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +92 -64
- package/dist/index.d.ts +92 -64
- package/dist/index.js +869 -243
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +869 -245
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,8 +12,7 @@ Stellar-based applications.
|
|
|
12
12
|
> (now accepts a `PollarClient` instance or a `PollarClientConfig`); `styles`
|
|
13
13
|
> moves under `appConfig.styles`; new `appConfig` prop is the opt-out switch
|
|
14
14
|
> for the remote `/applications/config` fetch (pass it — even `{}` — to skip
|
|
15
|
-
> the fetch)
|
|
16
|
-
> picker. Read the [CHANGELOG](../../CHANGELOG.md) and
|
|
15
|
+
> the fetch). Read the [CHANGELOG](../../CHANGELOG.md) and
|
|
17
16
|
> [UPGRADE.md](../../UPGRADE.md) before upgrading.
|
|
18
17
|
|
|
19
18
|
## Installation
|
|
@@ -89,11 +88,6 @@ Context provider that initialises the Pollar client and makes it available to ch
|
|
|
89
88
|
/* optional style overrides */
|
|
90
89
|
},
|
|
91
90
|
}}
|
|
92
|
-
ui={{
|
|
93
|
-
// Optional: replace the default Freighter/Albedo wallet picker.
|
|
94
|
-
// See "External wallet stacks" below for a kit-powered example.
|
|
95
|
-
renderWallets: undefined,
|
|
96
|
-
}}
|
|
97
91
|
adapters={
|
|
98
92
|
{
|
|
99
93
|
/* optional named adapter set */
|
|
@@ -104,12 +98,11 @@ Context provider that initialises the Pollar client and makes it available to ch
|
|
|
104
98
|
</PollarProvider>
|
|
105
99
|
```
|
|
106
100
|
|
|
107
|
-
| Prop | Type
|
|
108
|
-
| ----------- |
|
|
109
|
-
| `client` | `PollarClient \| PollarClientConfig`
|
|
110
|
-
| `appConfig` | `PollarConfig`
|
|
111
|
-
| `
|
|
112
|
-
| `adapters` | `PollarAdapters` | No | Named set of `PollarAdapter` objects (e.g. Trustless Work). See below |
|
|
101
|
+
| Prop | Type | Required | Description |
|
|
102
|
+
| ----------- | ------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
103
|
+
| `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 |
|
|
104
|
+
| `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 |
|
|
105
|
+
| `adapters` | `PollarAdapters` | No | Named set of `PollarAdapter` objects (e.g. Trustless Work). See below |
|
|
113
106
|
|
|
114
107
|
> **Renamed in 0.8.0** — `config` → `client`, `styles` → `appConfig.styles`.
|
|
115
108
|
> If you were passing `styles={{ ... }}` directly, move it to
|
|
@@ -252,8 +245,7 @@ want to swap the chrome but keep the data wiring from `usePollar()`.
|
|
|
252
245
|
`<TxStatusView>` is the shared status component (build → sign → success/error) reused by `TransactionModal` and
|
|
253
246
|
`SendModal`; it's exported on its own for consumers that want to embed the lifecycle elsewhere.
|
|
254
247
|
|
|
255
|
-
> **0.8.1** — `onWalletConnect` is now **optional** on `<LoginModalTemplate>` (defaults to a no-op).
|
|
256
|
-
> wallet picker entirely through `ui.renderWallets`, you no longer have to pass a handler you don't use.
|
|
248
|
+
> **0.8.1** — `onWalletConnect` is now **optional** on `<LoginModalTemplate>` (defaults to a no-op).
|
|
257
249
|
|
|
258
250
|
---
|
|
259
251
|
|
|
@@ -319,48 +311,36 @@ import { Networks } from '@creit.tech/stellar-wallets-kit';
|
|
|
319
311
|
```
|
|
320
312
|
|
|
321
313
|
Then any `login({ provider: 'wallet', type: '<kit wallet id>' })` is routed
|
|
322
|
-
through the kit.
|
|
323
|
-
unless you also wire `ui.renderWallets` (next section).
|
|
314
|
+
through the kit.
|
|
324
315
|
|
|
325
316
|
#### Showing every kit wallet in `LoginModal`
|
|
326
317
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
`<PollarProvider>` and the kit's full wallet list (xBull, Lobstr, Rabet, …)
|
|
331
|
-
renders in `LoginModal`:
|
|
318
|
+
Register the kit wallets with `walletAdapters` (plural) instead of the
|
|
319
|
+
signing-only resolver, and `LoginModal` auto-renders one button per wallet —
|
|
320
|
+
collapsed behind a single "Wallet" gateway button (their shared `meta.group`):
|
|
332
321
|
|
|
333
322
|
```tsx
|
|
334
323
|
import { PollarProvider } from '@pollar/react';
|
|
335
|
-
import {
|
|
324
|
+
import { stellarWalletsKitAdapters } from '@pollar/stellar-wallets-kit-adapter';
|
|
336
325
|
import { Networks } from '@creit.tech/stellar-wallets-kit';
|
|
337
326
|
|
|
338
|
-
const bundle = createStellarWalletsKitBundle({
|
|
339
|
-
network: Networks.PUBLIC,
|
|
340
|
-
picker: { wallets: ['xbull', 'lobstr', 'freighter'] }, // subset, optional
|
|
341
|
-
});
|
|
342
|
-
|
|
343
327
|
<PollarProvider
|
|
344
|
-
client={{
|
|
345
|
-
|
|
328
|
+
client={{
|
|
329
|
+
apiKey: 'your-api-key',
|
|
330
|
+
walletAdapters: stellarWalletsKitAdapters({
|
|
331
|
+
network: Networks.PUBLIC,
|
|
332
|
+
picker: { wallets: ['xbull', 'lobstr', 'freighter'] }, // subset, optional
|
|
333
|
+
}),
|
|
334
|
+
}}
|
|
346
335
|
>
|
|
347
336
|
{children}
|
|
348
337
|
</PollarProvider>;
|
|
349
338
|
```
|
|
350
339
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
```tsx
|
|
356
|
-
ui={{
|
|
357
|
-
renderWallets: ({ onConnect, authState }) => (
|
|
358
|
-
<button disabled={authState.step !== 'idle'} onClick={() => onConnect('xbull')}>
|
|
359
|
-
xBull
|
|
360
|
-
</button>
|
|
361
|
-
),
|
|
362
|
-
}}
|
|
363
|
-
```
|
|
340
|
+
Each adapter's `meta.group` controls placement: adapters sharing a group label
|
|
341
|
+
collapse behind one gateway button (the kit wallets default to `'Wallet'`),
|
|
342
|
+
while adapters with no group — e.g. Privy — render as their own button in the
|
|
343
|
+
root view. Pass `picker.groupLabel` to give the kit wallets a distinct gateway.
|
|
364
344
|
|
|
365
345
|
---
|
|
366
346
|
|
|
@@ -389,10 +369,6 @@ import type {
|
|
|
389
369
|
PollarConfig,
|
|
390
370
|
PollarStyles,
|
|
391
371
|
|
|
392
|
-
// 0.8.0 — wallet picker slot
|
|
393
|
-
RenderWalletsProps,
|
|
394
|
-
RenderWalletsSlot,
|
|
395
|
-
|
|
396
372
|
// Template props
|
|
397
373
|
SendModalTemplateProps,
|
|
398
374
|
ReceiveModalTemplateProps,
|
package/dist/index.css
CHANGED
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
display: flex;
|
|
20
20
|
align-items: center;
|
|
21
21
|
justify-content: center;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
padding: 1rem;
|
|
24
|
+
box-sizing: border-box;
|
|
22
25
|
background-color: rgba(0, 0, 0, 0.5);
|
|
23
26
|
}
|
|
24
27
|
.pollar-modal-card {
|
|
@@ -31,6 +34,8 @@
|
|
|
31
34
|
background-color: var(--pollar-bg);
|
|
32
35
|
box-sizing: border-box;
|
|
33
36
|
font-family: inherit;
|
|
37
|
+
max-height: calc(100dvh - 2rem);
|
|
38
|
+
overflow-y: auto;
|
|
34
39
|
}
|
|
35
40
|
.pollar-input {
|
|
36
41
|
width: 100%;
|
|
@@ -142,6 +147,7 @@
|
|
|
142
147
|
flex: 1;
|
|
143
148
|
}
|
|
144
149
|
.pollar-btn-primary {
|
|
150
|
+
width: 100%;
|
|
145
151
|
height: var(--pollar-buttons-height, 44px);
|
|
146
152
|
border: none;
|
|
147
153
|
border-radius: var(--pollar-buttons-border-radius, 0.5rem);
|
|
@@ -1019,26 +1025,29 @@
|
|
|
1019
1025
|
.pollar-wallet-list {
|
|
1020
1026
|
display: flex;
|
|
1021
1027
|
flex-direction: column;
|
|
1022
|
-
gap: 0.
|
|
1028
|
+
gap: 0.625rem;
|
|
1023
1029
|
margin-top: 0.5rem;
|
|
1024
1030
|
}
|
|
1025
1031
|
.pollar-wallet-list-btn {
|
|
1026
1032
|
display: flex;
|
|
1027
1033
|
width: 100%;
|
|
1028
1034
|
align-items: center;
|
|
1029
|
-
|
|
1030
|
-
|
|
1035
|
+
justify-content: center;
|
|
1036
|
+
gap: 0.75rem;
|
|
1037
|
+
min-height: var(--pollar-buttons-height, 44px);
|
|
1038
|
+
padding: 0 1rem;
|
|
1031
1039
|
border-radius: var(--pollar-buttons-border-radius, 0.5rem);
|
|
1032
|
-
border: 1px solid
|
|
1033
|
-
background-color:
|
|
1040
|
+
border: 1px solid var(--pollar-border);
|
|
1041
|
+
background-color: var(--pollar-input-bg);
|
|
1034
1042
|
color: var(--pollar-text);
|
|
1043
|
+
font-size: 1rem;
|
|
1044
|
+
font-weight: 500;
|
|
1035
1045
|
cursor: pointer;
|
|
1036
1046
|
transition: all 0.15s;
|
|
1037
1047
|
box-sizing: border-box;
|
|
1038
|
-
text-align:
|
|
1048
|
+
text-align: center;
|
|
1039
1049
|
}
|
|
1040
1050
|
.pollar-wallet-list-btn:hover:not(:disabled) {
|
|
1041
|
-
background-color: var(--pollar-input-bg);
|
|
1042
1051
|
border-color: var(--pollar-accent);
|
|
1043
1052
|
color: var(--pollar-accent);
|
|
1044
1053
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
|
@@ -1051,9 +1060,9 @@
|
|
|
1051
1060
|
cursor: not-allowed;
|
|
1052
1061
|
}
|
|
1053
1062
|
.pollar-wallet-list-icon {
|
|
1054
|
-
width:
|
|
1055
|
-
height:
|
|
1056
|
-
border-radius: 0.
|
|
1063
|
+
width: 1.5rem;
|
|
1064
|
+
height: 1.5rem;
|
|
1065
|
+
border-radius: 0.375rem;
|
|
1057
1066
|
flex-shrink: 0;
|
|
1058
1067
|
object-fit: contain;
|
|
1059
1068
|
}
|
|
@@ -1105,7 +1114,7 @@
|
|
|
1105
1114
|
height: var(--pollar-buttons-height, 44px);
|
|
1106
1115
|
align-items: center;
|
|
1107
1116
|
justify-content: center;
|
|
1108
|
-
gap: 0.
|
|
1117
|
+
gap: 0.75rem;
|
|
1109
1118
|
border-radius: var(--pollar-buttons-border-radius, 0.5rem);
|
|
1110
1119
|
border: 1px solid var(--pollar-border);
|
|
1111
1120
|
background-color: var(--pollar-input-bg);
|
|
@@ -1755,6 +1764,26 @@
|
|
|
1755
1764
|
animation: pollar-pulse 1.4s ease-in-out infinite;
|
|
1756
1765
|
}
|
|
1757
1766
|
|
|
1767
|
+
/* src/components/swap-modal/SwapModal.css */
|
|
1768
|
+
.pollar-swap-quote {
|
|
1769
|
+
display: flex;
|
|
1770
|
+
flex-direction: column;
|
|
1771
|
+
gap: 8px;
|
|
1772
|
+
padding: 12px;
|
|
1773
|
+
margin-bottom: 12px;
|
|
1774
|
+
border: 1px solid var(--pollar-border);
|
|
1775
|
+
border-radius: var(--pollar-card-border-radius);
|
|
1776
|
+
background: var(--pollar-input-bg);
|
|
1777
|
+
color: var(--pollar-text);
|
|
1778
|
+
font-size: 14px;
|
|
1779
|
+
}
|
|
1780
|
+
.pollar-swap-quote-row {
|
|
1781
|
+
display: flex;
|
|
1782
|
+
align-items: center;
|
|
1783
|
+
justify-content: space-between;
|
|
1784
|
+
gap: 12px;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1758
1787
|
/* src/components/sessions-modal/SessionsModal.css */
|
|
1759
1788
|
.pollar-sessions-modal {
|
|
1760
1789
|
max-width: 480px;
|