@fluent.xyz/connect 0.4.1 → 0.5.0
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/INTEGRATION.md +232 -96
- package/README.md +76 -20
- package/dist/fluent-connect.css +1 -1
- package/dist/index.d.ts +363 -57
- package/dist/index.js +2047 -1162
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -51,7 +51,6 @@ export function App() {
|
|
|
51
51
|
privyClientId: "client-<issued by Fluent>",
|
|
52
52
|
network: resolveFluentWidgetNetworkFromEnv() ?? "testnet",
|
|
53
53
|
appName: "My App",
|
|
54
|
-
authMode: "direct",
|
|
55
54
|
}}
|
|
56
55
|
mode="page"
|
|
57
56
|
renderPage={({ session, openConnect, widget }) => (
|
|
@@ -69,7 +68,7 @@ App's identity — sponsorship, auth and analytics speak it — and must be the
|
|
|
69
68
|
value the Fluent Dashboard shows; the widget throws on any other shape. `privyClientId` is
|
|
70
69
|
login configuration: the Privy app client carrying your allowed origins.
|
|
71
70
|
|
|
72
|
-
For Capacitor social login,
|
|
71
|
+
For Capacitor social login, pass
|
|
73
72
|
`customOAuthRedirectUrl: "https://app.example.com/auth/ios/callback"` in `config`.
|
|
74
73
|
This forwards an HTTPS Universal Link callback to Privy; the host must configure
|
|
75
74
|
the dashboard allowlists, iOS Associated Domains, and callback handling.
|
|
@@ -79,19 +78,15 @@ See [Capacitor OAuth setup](https://github.com/fluentlabs-xyz/fluent-connect-sdk
|
|
|
79
78
|
> from `partner_…` to `app_…`; passing `partnerId` throws with the same hint. Migrating from
|
|
80
79
|
> `clientId`? That option is gone: the value it held is now `privyClientId`.
|
|
81
80
|
|
|
82
|
-
###
|
|
81
|
+
### Logging in
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
`
|
|
90
|
-
|
|
91
|
-
(deprecated) opens the Fluent authorize popup and needs no origin allow-listing; a Fluent ID
|
|
92
|
-
signed in that way has its Privy session on the authorize page rather than in yours, so
|
|
93
|
-
`signMessage`, `signTypedData` and `linkX()` reject there with `hosted_not_supported`, and so
|
|
94
|
-
does `getAuthToken()` for a Fluent ID.
|
|
83
|
+
Clicking Connect opens Fluent's own sign-in dialog inside your page — Direct login, the one
|
|
84
|
+
way to log in to a Fluent ID. It mounts Privy on your origin, so that origin has to be
|
|
85
|
+
registered on the Privy app client behind your `privyClientId`; Privy answers an unregistered
|
|
86
|
+
origin with a silent no-op on the login button. Fluent registers the origins you give it when
|
|
87
|
+
it issues the client. The user's Privy session then lives in your page, which is what lets
|
|
88
|
+
`signMessage`, `signTypedData`, `getAuthToken()` and `linkX()` answer for a Fluent ID without
|
|
89
|
+
leaving it. External wallets connect through Reown AppKit beside it.
|
|
95
90
|
|
|
96
91
|
### Authenticating your backend
|
|
97
92
|
|
|
@@ -99,16 +94,16 @@ does `getAuthToken()` for a Fluent ID.
|
|
|
99
94
|
Fluent Connect. Send it to your backend once and issue your own session; verify it with the keys
|
|
100
95
|
at `<iss>/.well-known/jwks.json` — `iss` is the API host root, not `/api/v1` — and check `iss`,
|
|
101
96
|
`aud` (your `appId`) and `exp`. `sub` is stable per user per app. `addresses` is present only
|
|
102
|
-
when your app has the `addresses` scope. A Fluent ID
|
|
103
|
-
|
|
104
|
-
either mode — an EOA or a deployed contract wallet signs in; a counterfactual smart account
|
|
97
|
+
when your app has the `addresses` scope. A Fluent ID and an external wallet both get a token —
|
|
98
|
+
for a wallet, an EOA or a deployed contract wallet signs in; a counterfactual smart account
|
|
105
99
|
cannot (no ERC-6492).
|
|
106
100
|
The token renews itself silently for both account types — against a service that issues the
|
|
107
101
|
refresh credential this release expects, an external wallet signs once, when the session opens,
|
|
108
102
|
not once per token; against a deployment that answers without one there is nothing to renew from,
|
|
109
103
|
and every expired token costs another signature. The session and what holding it costs are in
|
|
110
|
-
[`INTEGRATION.md` §8](INTEGRATION.md#8-auth-
|
|
111
|
-
|
|
104
|
+
[`INTEGRATION.md` §8](INTEGRATION.md#8-auth-and-the-fluent-token). See
|
|
105
|
+
[`apps/auth-demo`](https://github.com/fluentlabs-xyz/fluent-connect-sdk/tree/main/apps/auth-demo)
|
|
106
|
+
for a browser-side verifier.
|
|
112
107
|
|
|
113
108
|
Brand images (logo, wallet icons) ship inside the package as bundled data URLs — you do not need a `/fluent-assets` folder.
|
|
114
109
|
|
|
@@ -125,7 +120,6 @@ By default the connect control floats top-right (`connectButton="fixed"`). To pl
|
|
|
125
120
|
privyClientId: "client-…",
|
|
126
121
|
network: "testnet",
|
|
127
122
|
appName: "My App",
|
|
128
|
-
authMode: "direct",
|
|
129
123
|
}}
|
|
130
124
|
mode="page"
|
|
131
125
|
renderPage={({ openConnect, openAccount, hasConnectedAccount }) => (
|
|
@@ -237,6 +231,29 @@ Headroom increases the maximum gas budget and does not guarantee execution if
|
|
|
237
231
|
state changes. An included outer transaction can still contain a failed
|
|
238
232
|
UserOperation; the widget continues to reject that failed execution.
|
|
239
233
|
|
|
234
|
+
For a batch with known gas budgets, opt out of SDK gas estimation explicitly:
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
await widget.createBatchOp({ calls }).execute({
|
|
238
|
+
userOperationGas: {
|
|
239
|
+
skipEstimation: true,
|
|
240
|
+
callGasLimit: 600_000n,
|
|
241
|
+
verificationGasLimit: 500_000n,
|
|
242
|
+
preVerificationGas: 100_000n,
|
|
243
|
+
paymasterVerificationGasLimit: 100_000n,
|
|
244
|
+
paymasterPostOpGasLimit: 50_000n,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
This skips the account gas hook and `eth_estimateUserOperationGas`. Supply budgets
|
|
250
|
+
for the complete batch, account deployment and paymaster; the example values are
|
|
251
|
+
illustrative. Paymaster limits are required when sponsorship or ERC-20 gas uses a
|
|
252
|
+
paymaster. The default is `skipEstimation: false`; a fixed `callGasLimit` alone
|
|
253
|
+
still allows other gas fields to be estimated. See
|
|
254
|
+
[`INTEGRATION.md` §7](INTEGRATION.md#skipping-useroperation-gas-estimation) for validation,
|
|
255
|
+
authorization and remaining network requests.
|
|
256
|
+
|
|
240
257
|
## Styles
|
|
241
258
|
|
|
242
259
|
Import the package CSS once in your app entry:
|
|
@@ -245,6 +262,45 @@ Import the package CSS once in your app entry:
|
|
|
245
262
|
import "@fluent.xyz/connect/styles.css";
|
|
246
263
|
```
|
|
247
264
|
|
|
265
|
+
## Upgrading from 0.4
|
|
266
|
+
|
|
267
|
+
0.5.0 removes hosted mode. Direct login — Fluent's sign-in dialog inside your page — is the one
|
|
268
|
+
way to log in to a Fluent ID.
|
|
269
|
+
|
|
270
|
+
- **`authMode` is removed from `FluentWidgetConfig`.** Delete the key. A config that passed
|
|
271
|
+
`authMode: "direct"` keeps exactly the behaviour it had; the widget accepts the key one last
|
|
272
|
+
time, ignores it and warns once. `authMode: "hosted"` throws at startup with this note's
|
|
273
|
+
instructions.
|
|
274
|
+
- **A config that omitted `authMode` was on hosted mode** — it was the 0.4.x default — and is
|
|
275
|
+
now on Direct login. Direct login mounts Privy on your page, so your App's origin has to be
|
|
276
|
+
registered on the Privy app client behind your `privyClientId`. Ask Fluent to add it before
|
|
277
|
+
you upgrade, or your users meet a login button that silently does nothing.
|
|
278
|
+
- **`fluent.initialize().connect()` and `.buildAuthorizeUrl()` are removed**, together with
|
|
279
|
+
`authorizeUrl` and `redirectUri` on `fluent.initialize()`. There is no authorize popup to
|
|
280
|
+
open. `initialize`, `status()`, `setSession()` and `disconnect()` are unchanged.
|
|
281
|
+
- **The `hosted_not_supported` error code is gone** from `FluentAuthError` and from `linkX()`:
|
|
282
|
+
nothing refuses a signature, a token or a link for want of an in-page Privy session any more.
|
|
283
|
+
- **A user signed in through hosted mode on 0.4.x signs in again** after your App upgrades.
|
|
284
|
+
Their stored session still shows them as connected and the first signature finds no signer;
|
|
285
|
+
Disconnect, then sign in again, clears it.
|
|
286
|
+
- `FluentWidgetAuthMode` is no longer exported, and `FluentWidgetRenderContext` and
|
|
287
|
+
`FluentIframeRpcExecutor` no longer carry `authMode`.
|
|
288
|
+
|
|
289
|
+
## Native Privy SDK adapter
|
|
290
|
+
|
|
291
|
+
Hosts that use a native Privy SDK can supply `privyAdapter` to `FluentWidget`.
|
|
292
|
+
The adapter implements `FluentPrivyAdapter`: a provider and
|
|
293
|
+
Privy-compatible hooks for authentication, user/identity tokens, embedded wallet
|
|
294
|
+
RPC and the enabled login methods. Fluent Connect continues to derive the same
|
|
295
|
+
ZeroDev account, exchange verified Privy tokens, review operations and apply
|
|
296
|
+
sponsorship policy. Web hosts omit this prop and retain the React SDK.
|
|
297
|
+
|
|
298
|
+
Keep one stable adapter and Provider per SDK runtime. The native provider must
|
|
299
|
+
restore its own session before reporting ready, publish logout and token changes,
|
|
300
|
+
and bind every signature to the connected native wallet. It must keep wallet keys
|
|
301
|
+
in the SDK and implement or disable the login methods exposed by the UI. Passing
|
|
302
|
+
mobile client IDs to the web provider alone does not provide native authentication.
|
|
303
|
+
|
|
248
304
|
## License
|
|
249
305
|
|
|
250
306
|
Apache-2.0
|