@fluent.xyz/connect 0.7.1 → 0.8.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/docs/concepts.md CHANGED
@@ -91,6 +91,14 @@ account swaps what landed, on Fluent, through FluxFlow. The user signs the bridg
91
91
  alone; once the deposit lands, the swap is priced and sent without a second
92
92
  press, from whichever drawer page the user is on.
93
93
 
94
+ On mainnet a deposit of USDC is an **Order deposit** where the Order deposit
95
+ service quotes one: the External wallet approves USDC and opens one order on
96
+ Ethereum, and a solver pays USDnr to the Fluent account. The page shows the
97
+ solver's fee and what arrives before the user signs. When the service has no
98
+ quote, or cannot be reached, the page converts USDC to USDnr on Ethereum and
99
+ sends that over the bridge instead. The service's URL is the experimental
100
+ `orderDepositUrl` option ([experimental.md](experimental.md#orderdepositurl)).
101
+
94
102
  The page connects the External wallet that holds the funds by itself, on both
95
103
  networks. A desktop browser offers the wallet extensions it announces; a phone
96
104
  offers MetaMask, Trust Wallet and Rainbow, each opened through a link that
@@ -85,9 +85,10 @@ The two chains are exported as [`fluentTestnet`](api.md#fluenttestnet) and
85
85
 
86
86
  **`enabledAuthMethods`**. The Auth methods the connect dialog offers beside X, in the order
87
87
  given: any of `"google"`, `"email"` and `"passkey"`. X is always offered and is not a value here.
88
- The default is `["google", "email", "passkey"]`; a shorter list drops the rest, and `[]` leaves X
89
- alone. Unknown values and duplicates are dropped. An Auth method also has to be enabled for the
90
- App by Fluent: listing it here only decides whether its button is drawn.
88
+ The default is `["google", "email"]`: a passkey is offered only when the list names it, a shorter
89
+ list drops the rest, and `[]` leaves X alone. Unknown values and duplicates are dropped. An Auth
90
+ method also has to be enabled for the App by Fluent: listing it here only decides whether its
91
+ button is drawn.
91
92
 
92
93
  - `invalid_option` when it is not a list or another iterable. `null` counts as unset and gives
93
94
  the default; a non-empty string is read character by character, so every value is dropped and
@@ -182,6 +183,7 @@ find it; what it does is in [experimental.md](experimental.md):
182
183
  - `gasPayment.ethValueByToken`: [experimental.md](experimental.md#gaspaymentethvaluebytoken)
183
184
  - `execution`: [experimental.md](experimental.md#execution)
184
185
  - `sponsorshipUrl`: [experimental.md](experimental.md#sponsorshipurl)
186
+ - `orderDepositUrl`: [experimental.md](experimental.md#orderdepositurl)
185
187
  - `privyClientId`, which is required: [experimental.md](experimental.md#privyclientid)
186
188
 
187
189
  ### Removed options
@@ -19,6 +19,7 @@ applies to: a Fluent ID, an External wallet, or both. The exact types are in [ap
19
19
  | `customOAuthRedirectUrl` | `FluentWidgetConfig` | [`customOAuthRedirectUrl`](#customoauthredirecturl) |
20
20
  | `swapper` | `FluentWidgetConfig` | [`swapper`](#swapper) |
21
21
  | `sponsorshipUrl` | `FluentWidgetConfig` | [`sponsorshipUrl`](#sponsorshipurl) |
22
+ | `orderDepositUrl` | `FluentWidgetConfig` | [`orderDepositUrl`](#orderdepositurl) |
22
23
  | `privyClientId` | `FluentWidgetConfig` | [`privyClientId`](#privyclientid) |
23
24
 
24
25
  ## `privyAdapter`
@@ -240,6 +241,27 @@ Network's own ([api.md](api.md#fluentwidgetconfig)).
240
241
  - **Applies to**: Sponsorship of a Fluent ID's operations. An External wallet is never
241
242
  sponsored.
242
243
 
244
+ ## `orderDepositUrl`
245
+
246
+ `FluentWidgetConfig.orderDepositUrl` points the widget at an Order deposit service other than
247
+ the Network's own: the base URL its quote and order requests go to
248
+ ([api.md](api.md#fluentwidgetconfig)).
249
+
250
+ - **What it does**: on the Swap page a USDC deposit is sent as one order on Ethereum when the
251
+ service quotes it, and a solver pays USDnr to the Fluent account. When the service has no
252
+ quote, or cannot be reached, USDC is converted to USDnr on Ethereum and crosses over the
253
+ bridge, as it did before this option existed. The Activity list reads the wallet's orders
254
+ from the same service.
255
+ - **Default**: the Order deposit service of the configured Network on mainnet. Testnet has
256
+ none, and USDC cannot be deposited there.
257
+ - **When to use it**: local development of the service only. An empty string turns Order
258
+ deposits off. Every real integration uses the default.
259
+ - **Errors**: `<FluentWidget>` throws `FluentWidgetConfigError` with `code` `invalid_option`
260
+ when the value is not a string, or is not an absolute `http(s)` URL without a query or a
261
+ fragment ([errors.md](errors.md#fluentwidgetconfigerror)).
262
+ - **Applies to**: a deposit of USDC from an External wallet on Ethereum, whichever account kind
263
+ receives it.
264
+
243
265
  ## `privyClientId`
244
266
 
245
267
  `FluentWidgetConfig.privyClientId` is the login client Fluent issues for the App, a `client-…`
@@ -56,6 +56,10 @@ Import the widget's stylesheet once, in your App's entry module:
56
56
  import "@fluent.xyz/connect/styles.css";
57
57
  ```
58
58
 
59
+ Every rule in it is scoped to the widget's own root, and every length in it is stated in px. An
60
+ App that sets its own root font size — `html { font-size: 14px }` and the like — resizes its own
61
+ type and leaves the widget's layout at the size it was designed at.
62
+
59
63
  ## Network
60
64
 
61
65
  `config.network` names the Network the widget runs on: `"testnet"` or `"mainnet"`. It is
@@ -130,6 +134,21 @@ export function Root() {
130
134
  }
131
135
  ```
132
136
 
137
+ ## Server-side rendering
138
+
139
+ `<FluentWidget>` renders on a server. The render context it hands your content there is the
140
+ `restoring` status with no session and no wallet — a server cannot know what this browser has
141
+ stored — and the real state arrives after hydration, which is why
142
+ [Reading the account](#reading-the-account) says to branch on `status`. A route that renders
143
+ the widget server-side returns markup rather than an error, with no client-only island and no
144
+ `ssr.noExternal`. The package's own suite renders it with `renderToString` in plain Node
145
+ (`test/serverRender.node.test.ts`).
146
+
147
+ For the Next.js App Router, both entries carry `"use client"`, so a Server Component may import
148
+ the package. Function props cannot cross a React Server Components boundary, though — and
149
+ `renderPage`, `renderHome`, `renderConnectButton` and `onSessionChange` are function props — so
150
+ mount the widget from a Client Component of your own and compose your pages below it.
151
+
133
152
  ## The connect button
134
153
 
135
154
  `connectButton` decides where the widget's own button goes:
@@ -340,7 +359,7 @@ stay empty, history does not load, Sponsorship is refused.
340
359
  | Bundler and paymaster (ZeroDev) | `rpc.zerodev.app` | `rpc.zerodev.app` |
341
360
  | USD prices: Coinbase and CoinGecko first, DefiLlama for what they leave unanswered | `api.coinbase.com`, `api.coingecko.com`, `coins.llama.fi` | the same three |
342
361
  | Transaction history (the explorer's API) | `testnet.fluentscan.xyz` | `fluentscan.xyz` |
343
- | Bridge: the Ethereum RPC, the deposit indexer, the Hyperlane explorer | `ethereum-sepolia-rpc.publicnode.com`, `api.gblend.xyz`, `api.hyperlane.xyz` | `ethereum-rpc.publicnode.com`, `eth.llamarpc.com`, `eth.drpc.org`, `api.fluent.xyz`, `api.hyperlane.xyz` |
362
+ | Bridge: the Ethereum RPC, the deposit indexer, the Hyperlane explorer and, on mainnet, the Order deposit service | `ethereum-sepolia-rpc.publicnode.com`, `api.gblend.xyz`, `api.hyperlane.xyz` | `ethereum-rpc.publicnode.com`, `eth.llamarpc.com`, `eth.drpc.org`, `api.fluent.xyz`, `api.hyperlane.xyz`, `portal.fluent.xyz` |
344
363
  | Pre-funding a new Fluent ID (faucet) | `eco-faucet-api.fluent.xyz` | not used |
345
364
 
346
365
  The SDKs the widget embeds reach their own hosts, and their documentation is the list to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluent.xyz/connect",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Fluent Connect React widget \u2014 Privy login, ZeroDev smart account, batch operations, and wallet UI",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",