@fluent.xyz/connect 0.5.3 → 0.6.0-rc.2
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 +43 -1429
- package/README.md +89 -285
- package/dist/fluent-connect.css +1 -1
- package/dist/index.d.ts +1024 -2885
- package/dist/index.js +11182 -9560
- package/dist/index.js.map +1 -1
- package/docs/api.md +1789 -0
- package/docs/concepts.md +126 -0
- package/docs/configuration.md +276 -0
- package/docs/errors.md +213 -0
- package/docs/experimental.md +247 -0
- package/docs/getting-started.md +336 -0
- package/docs/guides/backend-auth.md +176 -0
- package/docs/guides/iframe.md +108 -0
- package/docs/guides/link-x.md +166 -0
- package/docs/guides/signing.md +157 -0
- package/docs/guides/sponsorship.md +248 -0
- package/docs/guides/transactions.md +251 -0
- package/docs/upgrading-0.5.md +376 -0
- package/package.json +5 -2
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
# Upgrading from 0.5
|
|
2
|
+
|
|
3
|
+
`@fluent.xyz/connect` 0.6.0 publishes only the API it keeps. This file lists everything 0.5.3
|
|
4
|
+
exported that 0.6.0 does not, every member of a kept type that 0.6.0 removes or renames, and the
|
|
5
|
+
behaviour that changes under code that still compiles. It is the one document of the package
|
|
6
|
+
that names the removed exports; every other guide uses the 0.6.0 names only. The kept API is in
|
|
7
|
+
[the API reference](api.md).
|
|
8
|
+
|
|
9
|
+
## How to read this file
|
|
10
|
+
|
|
11
|
+
Every row of the tables below is exactly one of three kinds:
|
|
12
|
+
|
|
13
|
+
| Kind | Meaning | What the row gives |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| **rename** | Every use of the old name works after replacing it with the new one: the same inputs, the same result, the same effect; for a type, assignable both ways. | The new name. |
|
|
16
|
+
| **recipe** | The kept API reaches the same result another way. | A link to a short checked example using kept names only, with the condition under which the result is not always the same. |
|
|
17
|
+
| **none** | There is no public way. | The reason, in one line. |
|
|
18
|
+
|
|
19
|
+
A name that is not a rename is never a drop-in replacement, even when a kept name looks alike.
|
|
20
|
+
A removed export your code still imports is a compile error in TypeScript. The package is ESM
|
|
21
|
+
only, so in JavaScript a named import of it fails when the module is linked, before any of its
|
|
22
|
+
code runs. Code that compiles against 0.6.0 but behaves differently is listed under
|
|
23
|
+
[Behaviour changes](#behaviour-changes), not in a row.
|
|
24
|
+
|
|
25
|
+
## Behaviour changes
|
|
26
|
+
|
|
27
|
+
- **`network` is required and has no default.** 0.5 fell back to the `VITE_FLUENT_WIDGET_NETWORK` or `FLUENT_NETWORK` environment variable (with the aliases `dev`, `development`, `prod` and `production`), then to `"testnet"`. 0.6.0 reads no environment variable: a JavaScript host that omits `network` or passes `null` gets a `FluentWidgetConfigError` with `missing_option` when `<FluentWidget>` renders, and any other value than `"testnet"` and `"mainnet"` gets `invalid_option`. A host that set only the environment variable reads it itself and passes the Network.
|
|
28
|
+
- **`confirmation` fails closed.** A `confirmation` that is passed is Silent mode only when it is exactly `"silent"`; every other value, `null` and the 0.5 values `"always"` and `"session"` included, is Prompt mode. A 0.5 host that passed `"session"` to skip the Review gets the Review on a Fluent ID's Batch operations; it passes `"silent"` instead. An omitted `confirmation` follows Quick sign: see [Prompt mode and Silent mode](concepts.md#prompt-mode-and-silent-mode).
|
|
29
|
+
- **`FluentExecuteResult.sponsored` can be `null`.** It is `null` when a Fluent ID operation in
|
|
30
|
+
ETH made a sponsored submission and the receipt names no paymaster; 0.5 reported the send's
|
|
31
|
+
guess. It is `false` for a Gas token payment, for a Fluent ID operation in ETH that made no
|
|
32
|
+
sponsored submission and whose receipt names no paymaster, such as the fallback, and for every
|
|
33
|
+
External wallet operation.
|
|
34
|
+
- **The Widget session is a projection.** `onSessionChange`, the render context's `session` and `useFluentWidget().session` hand out `{ account: { address, type }, issuedAt }` and nothing else; a JavaScript host reading `session.user`, `session.idToken` or `session.wallet` gets `undefined`. A session stored by 0.5 is still restored, unless its address or `issuedAt` is malformed: the widget then discards it when it loads.
|
|
35
|
+
- **Config errors are `FluentWidgetConfigError` with a `code`.** Outside `execution`, a config the widget refused threw a plain `Error` in 0.5; 0.6.0 throws a `FluentWidgetConfigError` (still an `Error`) with `missing_option`, `invalid_option` or `removed_option`, its message naming the option. A host that compared a message switches on `code`.
|
|
36
|
+
- **Error codes change at runtime.** A `FluentAuthError` carries `invalid_login_credential`, `login_credential_missing`, `no_signer`, `challenge_unknown`, `challenge_used` and `challenge_expired` where 0.5 carried `invalid_privy_token`, `privy_token_missing`, `no_embedded_wallet`, `nonce_unknown`, `nonce_used` and `nonce_expired`, and a service refusal whose code the SDK does not name arrives as `service_refused`, where 0.5 passed the service's code through. `FluentReviewRejectedError` and `FluentSponsorshipFallbackError` gain a `code`.
|
|
37
|
+
- **`FluentSponsorshipFallbackError` carries summaries, not the vendor errors.** In 0.5, `cause` and `fallbackError` were the errors the sponsored and own-gas submissions threw, with their request URLs, request bodies and addresses. In 0.6.0 each is a plain `{ name, message, status? }` object whose `message` has those identifiers replaced by placeholders, and the error's own `message` is redacted the same way; see [errors.md](errors.md#fluentsponsorshipfallbackerror). A host that read `details`, `shortMessage`, `url`, `walk()` or `instanceof` on either reads `message` and `status` instead.
|
|
38
|
+
- **Debug logs carry no Privy DID nor Signer address.** With `debugLogging` on, the console no longer shows either value.
|
|
39
|
+
- **Removed options and members in JavaScript.** A `config.scopes`, a `showDebugPayload` prop or an `AccountAvatar` `userLogoUrl` that a JavaScript host still passes has no effect, so an Account avatar given only `userLogoUrl` shows its `defaultLogoUrl` or the Fluent mark; an executor passed to `execute()` is read as options, none of which it sets, so the widget sends the Batch operation itself; and a call with `functionName` but no `method` makes `widget.createBatchOp` throw, where 0.5 encoded `functionName`.
|
|
40
|
+
- **The debug panel follows `debugLogging`.** In `mode="home"`, 0.5 showed the debug panel unless `showDebugPayload` was `false`; 0.6.0 shows it only while `debugLogging` is on.
|
|
41
|
+
|
|
42
|
+
## Removed exports
|
|
43
|
+
|
|
44
|
+
### UI primitives
|
|
45
|
+
|
|
46
|
+
| Removed | Kind | Use instead |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `Button`, `buttonVariants`, `Dialog`, `DialogClose`, `DialogContent`, `DialogDescription`, `DialogFooter`, `DialogHeader`, `DialogOverlay`, `DialogPortal`, `DialogTitle`, `DialogTrigger`, `Icon`, `IconName`, `Label`, `Separator`, `Switch`, `WIDGET_STYLE_SCOPE`, `FluentPortalContainerProvider` | none | Internal UI: the widget's own building blocks and styling scope are not public. |
|
|
49
|
+
|
|
50
|
+
### Widget components
|
|
51
|
+
|
|
52
|
+
| Removed | Kind | Use instead |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `FluentAccountDrawer`, `WalletMenuActionCard` | none | Internal UI; `openAccount` opens the widget's own account drawer. |
|
|
55
|
+
| `FluentWidgetConnectButton`, `FluentWidgetConnectButtonProps` | none | Internal UI; `renderConnectButton` replaces the connect button, and its `DefaultButton` draws the widget's own. |
|
|
56
|
+
| `useWidget` | recipe | [Recipe: `useWidget`](#recipe-usewidget) |
|
|
57
|
+
|
|
58
|
+
#### Recipe: `useWidget`
|
|
59
|
+
|
|
60
|
+
0.5's `useWidget()` returned `useFluentWidget().widget`, and so does this hook, throwing in the
|
|
61
|
+
same way outside `<FluentWidget>`; the Widget API it returns has 0.6.0's members, listed under
|
|
62
|
+
[Removed or renamed members](#removed-or-renamed-members).
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { useFluentWidget } from "@fluent.xyz/connect";
|
|
66
|
+
|
|
67
|
+
export function useWidgetApi() {
|
|
68
|
+
return useFluentWidget().widget;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Batch operations and signing
|
|
73
|
+
|
|
74
|
+
| Removed | Kind | Use instead |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `createFluentBatchOp`, `FluentBatchOperationExecutor` | none | The feature is removed: a Batch operation with an executor the App builds. A Batch operation is built by `widget.createBatchOp` and sent by the widget. |
|
|
77
|
+
| `FluentBatchConfirmationMode` | recipe | [Recipe: `confirmation` values](#recipe-confirmation-values) |
|
|
78
|
+
| `FluentBatchOperationReview`, `FluentSignatureReview` | none | Internal UI: the Review is the widget's own screen. |
|
|
79
|
+
| `FluentTypedDataRequest` | recipe | [Recipe: `FluentTypedDataRequest`](#recipe-fluenttypeddatarequest) |
|
|
80
|
+
|
|
81
|
+
#### Recipe: `FluentTypedDataRequest`
|
|
82
|
+
|
|
83
|
+
The parameter of `widget.signTypedData`, with its generics at their constraints, is the same type
|
|
84
|
+
as 0.5's `FluentTypedDataRequest`, assignable both ways.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import type { FluentSignApi } from "@fluent.xyz/connect";
|
|
88
|
+
|
|
89
|
+
export type TypedDataRequest = Parameters<FluentSignApi["signTypedData"]>[0];
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Permission sessions
|
|
93
|
+
|
|
94
|
+
| Removed | Kind | Use instead |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `CallType`, `ParamCondition`, `createFluentPermissionApi`, `createFluentPermissionClient`, `createFluentPermissionPolicyBuilders`, `createFluentPermissionSession`, `createFluentZeroDevPermissionSession`, `FluentCallPermission`, `FluentPermissionApi`, `FluentPermissionArgConstraint`, `FluentPermissionArgs`, `FluentPermissionBatchPolicy`, `FluentPermissionBatchPolicyInput`, `FluentPermissionCallInput`, `FluentPermissionCallPolicy`, `FluentPermissionClient`, `FluentPermissionClientConfig`, `FluentPermissionGrant`, `FluentPermissionGrantRequest`, `FluentPermissionPolicy`, `FluentPermissionPolicyBuilders`, `FluentPermissionPreview`, `FluentPermissionSession`, `FluentPermissionSessionExecutor`, `FluentPermissionSessionInput`, `FluentPermissionStatus`, `FluentSpendPeriod`, `FluentSpendPermission`, `FluentZeroDevPermissionCall`, `FluentZeroDevPermissionSession` | none | The feature is removed: permission sessions and their policies. |
|
|
97
|
+
|
|
98
|
+
### ZeroDev and paymaster plumbing
|
|
99
|
+
|
|
100
|
+
| Removed | Kind | Use instead |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| `FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY`, `FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT`, `createFluentSponsorshipRpcUrl`, `createFluentZeroDevErc20Paymaster`, `createFluentZeroDevErc20PaymasterApprovalCall`, `createFluentZeroDevErc20PaymasterClient`, `createFluentZeroDevErc20PaymasterRpcUrl`, `createFluentZeroDevRpcUrl`, `createFluentZeroDevSponsoredPaymaster`, `fluentIntegrations`, `fluentZeroDevChainIds`, `getFluentZeroDevErc20PaymasterTokens`, `getZeroDevRpcUrl`, `getZerodevIntegration`, `isFluentZeroDevChain`, `resolveFluentZeroDevErc20PaymasterToken`, `sendFluentZeroDevErc20PaymasterDemo`, `useFluentZeroDevAccount`, `FluentZeroDevErc20PaymasterToken`, `FluentZeroDevErc20PaymasterTokenInfo`, `FluentZeroDevKernel`, `FluentZeroDevPaymasterDemoResult`, `FluentZeroDevPaymasterKernel`, `FluentZeroDevSignerMode`, `FluentZeroDevSponsorshipTokenSource`, `ZerodevIntegration` | none | The widget does this itself: it prepares the Fluent ID's account and pays gas through `execute()`, with `gasPayment` choosing how. |
|
|
103
|
+
|
|
104
|
+
### Chains and registry
|
|
105
|
+
|
|
106
|
+
| Removed | Kind | Use instead |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| `fluentChain` | recipe | [Recipe: `fluentChain`](#recipe-fluentchain) |
|
|
109
|
+
| `fluentChains` | recipe | [Recipe: `fluentChains`](#recipe-fluentchains) |
|
|
110
|
+
| `getFluentChain` | recipe | [Recipe: `getFluentChain`](#recipe-getfluentchain) |
|
|
111
|
+
| `getFluentExplorerBaseUrl` | recipe | [Recipe: `getFluentExplorerBaseUrl`](#recipe-getfluentexplorerbaseurl) |
|
|
112
|
+
| `fluentDefinitionToViemChain` | none | 0.6.0 converts no chain definition to a viem chain. |
|
|
113
|
+
| `fluentL1Chains`, `getL1Chain`, `getL1ForFluentChain`, `l1DefinitionToViemChain`, `resolveL1Definition`, `L1ChainDefinition` | none | The registry's L1 chains are not public. |
|
|
114
|
+
| `fluentApps`, `getApp`, `AppDefinition`, `registryVersion` | none | The registry's app entries and version are not public. |
|
|
115
|
+
| `fluentBridgeAbi`, `BridgeAddresses`, `resolveBridgeAddresses`, `getContractAddressFromChain` | none | The bridge contracts' ABI and address helpers are not public. |
|
|
116
|
+
|
|
117
|
+
#### Recipe: `fluentChain`
|
|
118
|
+
|
|
119
|
+
0.5's `fluentChain` was the object `{ testnet: fluentTestnet, mainnet: fluentMainnet }`; this one
|
|
120
|
+
holds the same two viem chains.
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import { fluentMainnet, fluentTestnet } from "@fluent.xyz/connect";
|
|
124
|
+
|
|
125
|
+
export const chainsByNetwork = { testnet: fluentTestnet, mainnet: fluentMainnet } as const;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Recipe: `fluentChains`
|
|
129
|
+
|
|
130
|
+
0.5's `fluentChains` held the registry's two chain definitions by Network; this record holds the
|
|
131
|
+
same definitions, found by the chain ids of `fluentTestnet` and `fluentMainnet`. Each value is
|
|
132
|
+
typed `FluentChainDefinition | undefined`, though both ids are always found.
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { fluentMainnet, fluentTestnet, getFluentChainByChainId } from "@fluent.xyz/connect";
|
|
136
|
+
|
|
137
|
+
export const chainDefinitions = {
|
|
138
|
+
testnet: getFluentChainByChainId(fluentTestnet.id),
|
|
139
|
+
mainnet: getFluentChainByChainId(fluentMainnet.id),
|
|
140
|
+
};
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### Recipe: `getFluentChain`
|
|
144
|
+
|
|
145
|
+
0.5's `getFluentChain(network)` returned the registry's definition of `"testnet"` or `"mainnet"`;
|
|
146
|
+
this function returns the same definition. Its result is typed `FluentChainDefinition |
|
|
147
|
+
undefined`: it is defined for `"testnet"` and `"mainnet"`, and `undefined` for any other value a
|
|
148
|
+
JavaScript caller passes, as 0.5's was.
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import {
|
|
152
|
+
fluentMainnet,
|
|
153
|
+
fluentTestnet,
|
|
154
|
+
getFluentChainByChainId,
|
|
155
|
+
type FluentWidgetNetwork,
|
|
156
|
+
} from "@fluent.xyz/connect";
|
|
157
|
+
|
|
158
|
+
const chainIds = { testnet: fluentTestnet.id, mainnet: fluentMainnet.id } as const;
|
|
159
|
+
|
|
160
|
+
export function chainDefinitionOf(network: FluentWidgetNetwork) {
|
|
161
|
+
return getFluentChainByChainId(chainIds[network]);
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Recipe: `getFluentExplorerBaseUrl`
|
|
166
|
+
|
|
167
|
+
0.5's `getFluentExplorerBaseUrl(network)` was this expression. Like it, it returns testnet's
|
|
168
|
+
explorer for any value other than `"mainnet"`.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import { getFluentChainForNetwork, type FluentWidgetNetwork } from "@fluent.xyz/connect";
|
|
172
|
+
|
|
173
|
+
export function explorerBaseUrlOf(network: FluentWidgetNetwork): string | undefined {
|
|
174
|
+
return getFluentChainForNetwork(network).blockExplorers?.default.url;
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Network and config
|
|
179
|
+
|
|
180
|
+
| Removed | Kind | Use instead |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| `normalizeFluentWidgetNetwork` | none | The widget takes only `"testnet"` or `"mainnet"`; the App maps its own value and passes it as `network`. |
|
|
183
|
+
| `resolveFluentWidgetNetworkFromEnv` | none | The widget reads no environment variable; the App passes `network`. |
|
|
184
|
+
| `FluentWidgetNetworkProvider`, `useFluentWidgetNetwork`, `isFaucetNetwork` | none | Internal: the App passes `network` itself, so it already knows it. |
|
|
185
|
+
| `ResolvedFluentWidgetConfig`, `ResolvedFluentWidgetExecution` | none | There is no public resolved config. |
|
|
186
|
+
| `FLUENT_CONNECT_DEFAULT_ASSETS` | none | The widget's default images are internal. |
|
|
187
|
+
|
|
188
|
+
### Storage keys and session
|
|
189
|
+
|
|
190
|
+
| Removed | Kind | Use instead |
|
|
191
|
+
|---|---|---|
|
|
192
|
+
| `FLUENT_WIDGET_SESSION_STORAGE_KEY` | none | The widget's storage is internal. Read the render context's `session`, which holds a restored session, and `onSessionChange` for later Direct-login changes. |
|
|
193
|
+
| `FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY`, `FLUENT_WIDGET_USER_TOKENS_IMPORT_MARKER_KEY` | none | The widget's storage is internal. |
|
|
194
|
+
| `FluentSession` | none | The 0.5 session shape is not public; the Widget session is `FluentWidgetSession`, a different shape. |
|
|
195
|
+
| `clearPrivyRecentLoginMethod` | none | The widget does this itself. |
|
|
196
|
+
|
|
197
|
+
### Fluent client and families
|
|
198
|
+
|
|
199
|
+
| Removed | Kind | Use instead |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| `fluent`, `createFluentClient`, `FluentClient`, `FluentClientConfig`, `createFluentFamiliesClient`, `FluentFamilies`, `FluentFamiliesClient`, `FluentFamiliesClientConfig`, `FluentFamily`, `FluentFamilyTier`, `FluentFamilyType` | none | The feature is removed: the standalone client and the families lookup. |
|
|
202
|
+
|
|
203
|
+
### Tokens and balances
|
|
204
|
+
|
|
205
|
+
| Removed | Kind | Use instead |
|
|
206
|
+
|---|---|---|
|
|
207
|
+
| `fluentMainnetTokenDefaults`, `fluentTestnetTokenDefaults`, `getFluentTokenDefaults`, `getFluentTokenDefaultsForNetwork`, `getFluentDefaultWidgetDisplayTokens`, `getFluentDefaultWidgetGasTokens`, `isFluentDefaultToken`, `isFluentNativeToken`, `fluentTokenIdentity`, `mergeFluentDisplayTokens`, `findFluentSymbolCollisions` | none | The widget does this itself: it lists its Default tokens beside the App's `tokens`. |
|
|
208
|
+
| `readFluentTokenBalances`, `readFluentTokenMetadata`, `FluentTokenBalance` | none | The widget reads balances itself; `refreshBalances` refetches them. |
|
|
209
|
+
| `FLUENT_USER_TOKEN_LIMIT`, `createFluentUserTokenStore`, `createFluentBackendUserTokenStore`, `useFluentUserTokens`, `UserTokenStore`, `BackendUserTokenStore`, `FluentUserTokenAddResult` | none | The widget keeps the person's User tokens itself. |
|
|
210
|
+
|
|
211
|
+
### Gas payment
|
|
212
|
+
|
|
213
|
+
| Removed | Kind | Use instead |
|
|
214
|
+
|---|---|---|
|
|
215
|
+
| `FLUENT_WIDGET_DEFAULT_GAS_TOKEN`, `resolveDefaultGasToken` | none | The widget does this itself; `config.gasPayment.defaultToken` sets the Gas token it starts with. |
|
|
216
|
+
| `FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES`, `deriveFluentGasEthRates`, `getFluentGasPaymentEthValue`, `getFluentGasPaymentTokens`, `getFluentGasPaymentValueTier`, `getFluentGasTokenAddress`, `selectFluentGasPaymentToken`, `sortFluentGasTokens`, `FluentGasPaymentSelection`, `FluentGasPaymentValueTier` | none | The widget does this itself: `widget.gasPayment` is the Gas payment chosen in the widget. |
|
|
217
|
+
|
|
218
|
+
### Token transfer
|
|
219
|
+
|
|
220
|
+
| Removed | Kind | Use instead |
|
|
221
|
+
|---|---|---|
|
|
222
|
+
| `buildFluentTransferCall`, `checkFluentTransferFee`, `fluentTransferAbi`, `parseFluentTransferAmount`, `parseFluentTransferRecipient`, `FluentTokenTransferOutcome`, `FluentTokenTransferRequest`, `FluentTokenTransferSender`, `FluentTransferAmount`, `FluentTransferFee`, `FluentTransferRecipient` | none | Internal to the widget's Send form. |
|
|
223
|
+
|
|
224
|
+
### User settings
|
|
225
|
+
|
|
226
|
+
| Removed | Kind | Use instead |
|
|
227
|
+
|---|---|---|
|
|
228
|
+
| `createFluentSettingsClient`, `FluentSettingsClient`, `FluentSettingsError`, `FluentSettingsErrorCode`, `FluentUserSettings`, `FluentUserSettingsPatch`, `FluentProfile` | none | The widget keeps User settings itself. |
|
|
229
|
+
|
|
230
|
+
### Iframe
|
|
231
|
+
|
|
232
|
+
| Removed | Kind | Use instead |
|
|
233
|
+
|---|---|---|
|
|
234
|
+
| `createFluentIframeBridge`, `createFluentIframeRpcHandler`, `FluentIframeBridge`, `FluentIframeBridgeOptions`, `FluentIframeRpcExecutor`, `FluentIframeRpcHandler`, `FluentIframeRpcRequest` | none | The feature is removed: a bridge with an executor the App builds. `useFluentIframeBridge` bridges an iframe to the Widget account. |
|
|
235
|
+
| `FluentIframeRpcError` | none | Numeric RPC errors are internal; a dismissed Review reaches the iframe as `4001`. |
|
|
236
|
+
|
|
237
|
+
## Removed or renamed members
|
|
238
|
+
|
|
239
|
+
### `AccountAvatarProps`
|
|
240
|
+
|
|
241
|
+
| Member | Kind | Use instead |
|
|
242
|
+
|---|---|---|
|
|
243
|
+
| `AccountAvatarProps.userLogoUrl` | rename | `AccountAvatarProps.userAvatarUrl` |
|
|
244
|
+
|
|
245
|
+
### `FluentBatchApi`
|
|
246
|
+
|
|
247
|
+
| Member | Kind | Use instead |
|
|
248
|
+
|---|---|---|
|
|
249
|
+
| `FluentBatchApi.confirmationMode` | recipe | [Recipe: `FluentBatchApi.confirmationMode`](#recipe-fluentbatchapiconfirmationmode) |
|
|
250
|
+
| `FluentBatchApi.createPermissionSession`, `FluentBatchApi.policies` | none | The feature is removed: permission sessions and their policies. |
|
|
251
|
+
|
|
252
|
+
#### Recipe: `FluentBatchApi.confirmationMode`
|
|
253
|
+
|
|
254
|
+
0.5's `widget.confirmationMode` was `"session"` while the person's Quick sign was on and
|
|
255
|
+
`"always"` otherwise; 0.6.0's `widget.signingMode` is `"silent"` and `"prompt"` in the same
|
|
256
|
+
states, and this hook gives back the 0.5 value.
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { useFluentWidget } from "@fluent.xyz/connect";
|
|
260
|
+
|
|
261
|
+
export function useConfirmationMode(): "always" | "session" {
|
|
262
|
+
return useFluentWidget().widget.signingMode === "silent" ? "session" : "always";
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### `FluentBatchCallInput`
|
|
267
|
+
|
|
268
|
+
| Member | Kind | Use instead |
|
|
269
|
+
|---|---|---|
|
|
270
|
+
| `FluentBatchCallInput.functionName` | rename | `FluentBatchCallInput.method` |
|
|
271
|
+
|
|
272
|
+
### `FluentBatchOperation`
|
|
273
|
+
|
|
274
|
+
| Member | Kind | Use instead |
|
|
275
|
+
|---|---|---|
|
|
276
|
+
| `FluentBatchOperation.execute` | none | Its executor argument is removed: `execute(options)` takes the options only and sends through the widget. |
|
|
277
|
+
|
|
278
|
+
### `FluentBatchOperationExecuteOptions`
|
|
279
|
+
|
|
280
|
+
| Member | Kind | Use instead |
|
|
281
|
+
|---|---|---|
|
|
282
|
+
| `FluentBatchOperationExecuteOptions.confirmation` | recipe | [Recipe: `confirmation` values](#recipe-confirmation-values) |
|
|
283
|
+
| `FluentSigningMode` `"always"` | recipe | [Recipe: `confirmation` values](#recipe-confirmation-values) |
|
|
284
|
+
| `FluentSigningMode` `"session"` | recipe | [Recipe: `confirmation` values](#recipe-confirmation-values) |
|
|
285
|
+
|
|
286
|
+
#### Recipe: `confirmation` values
|
|
287
|
+
|
|
288
|
+
`confirmation` is kept, and its values changed: 0.5's `"session"` signed as Silent mode and
|
|
289
|
+
`"always"` as Prompt mode. This function gives the 0.6.0 value with the same effect for every 0.5
|
|
290
|
+
value. A 0.5 value passed unchanged is read as [Behaviour changes](#behaviour-changes) says.
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import type { FluentSigningMode } from "@fluent.xyz/connect";
|
|
294
|
+
|
|
295
|
+
export function signingModeOf(confirmation: "always" | "session"): FluentSigningMode {
|
|
296
|
+
return confirmation === "session" ? "silent" : "prompt";
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### `FluentTokenDefinition`
|
|
301
|
+
|
|
302
|
+
| Member | Kind | Use instead |
|
|
303
|
+
|---|---|---|
|
|
304
|
+
| `FluentTokenDefinition.gasPriority`, `FluentTokenDefinition.native` | none | The widget already ignored both on a token the App passed: only a Default token can be a Gas token or the chain's own currency. |
|
|
305
|
+
|
|
306
|
+
### `FluentWidgetAccount`
|
|
307
|
+
|
|
308
|
+
| Member | Kind | Use instead |
|
|
309
|
+
|---|---|---|
|
|
310
|
+
| `FluentWidgetAccount.signerAddress` | none | The Signer's address is not part of the Widget API. |
|
|
311
|
+
|
|
312
|
+
### `FluentWidgetConfig`
|
|
313
|
+
|
|
314
|
+
| Member | Kind | Use instead |
|
|
315
|
+
|---|---|---|
|
|
316
|
+
| `FluentWidgetConfig.scopes` | none | The option is removed; it only filled the 0.5 session's `scopes`. |
|
|
317
|
+
|
|
318
|
+
### `FluentWidgetProps`
|
|
319
|
+
|
|
320
|
+
| Member | Kind | Use instead |
|
|
321
|
+
|---|---|---|
|
|
322
|
+
| `FluentWidgetProps.showDebugPayload` | none | The prop is removed; the debug panel follows `debugLogging`. |
|
|
323
|
+
|
|
324
|
+
### `FluentWidgetRenderContext`
|
|
325
|
+
|
|
326
|
+
| Member | Kind | Use instead |
|
|
327
|
+
|---|---|---|
|
|
328
|
+
| `FluentWidgetRenderContext.connecting` | recipe | [Recipe: `FluentWidgetRenderContext.connecting`](#recipe-fluentwidgetrendercontextconnecting) |
|
|
329
|
+
| `FluentWidgetRenderContext.connectedAddress` | none | No member holds the same value in every state: `connectedAddress` preferred a Fluent ID's address, and `widget.account.address` is a connected External wallet's until the Fluent ID's account is ready. |
|
|
330
|
+
|
|
331
|
+
#### Recipe: `FluentWidgetRenderContext.connecting`
|
|
332
|
+
|
|
333
|
+
0.5's `connecting` was `true` exactly when `status` was `"connecting"`, in every state; this hook
|
|
334
|
+
reads the same.
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
import { useFluentWidget } from "@fluent.xyz/connect";
|
|
338
|
+
|
|
339
|
+
export function useConnecting(): boolean {
|
|
340
|
+
return useFluentWidget().status === "connecting";
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### `FluentWidgetSession`
|
|
345
|
+
|
|
346
|
+
| Member | Kind | Use instead |
|
|
347
|
+
|---|---|---|
|
|
348
|
+
| `FluentWidgetSession.wallet` | recipe | [Recipe: `FluentWidgetSession.wallet`](#recipe-fluentwidgetsessionwallet) |
|
|
349
|
+
| `FluentWidgetSession.app`, `FluentWidgetSession.appId`, `FluentWidgetSession.expiresAt`, `FluentWidgetSession.idToken`, `FluentWidgetSession.metadata`, `FluentWidgetSession.scopes`, `FluentWidgetSession.user` | none | The Widget session is `{ account, issuedAt }` only; an App proves who the person is with an Auth token from `getAuthToken()`. |
|
|
350
|
+
|
|
351
|
+
#### Recipe: `FluentWidgetSession.wallet`
|
|
352
|
+
|
|
353
|
+
0.5's `session.wallet.smartAccountAddress` is `session.account.address`, the same address copied
|
|
354
|
+
from the same stored session. Only that field has a replacement: `wallet.signerAddress` and
|
|
355
|
+
`wallet.authorizationSession` have none.
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
import { useFluentWidget } from "@fluent.xyz/connect";
|
|
359
|
+
|
|
360
|
+
export function useSessionAddress() {
|
|
361
|
+
return useFluentWidget().session?.account.address;
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### `FluentAuthErrorCode`
|
|
366
|
+
|
|
367
|
+
Each 0.6.0 code is raised exactly where 0.5 raised the old one.
|
|
368
|
+
|
|
369
|
+
| Member | Kind | Use instead |
|
|
370
|
+
|---|---|---|
|
|
371
|
+
| `FluentAuthErrorCode` `"invalid_privy_token"` | rename | `"invalid_login_credential"` |
|
|
372
|
+
| `FluentAuthErrorCode` `"privy_token_missing"` | rename | `"login_credential_missing"` |
|
|
373
|
+
| `FluentAuthErrorCode` `"no_embedded_wallet"` | rename | `"no_signer"` |
|
|
374
|
+
| `FluentAuthErrorCode` `"nonce_unknown"` | rename | `"challenge_unknown"` |
|
|
375
|
+
| `FluentAuthErrorCode` `"nonce_used"` | rename | `"challenge_used"` |
|
|
376
|
+
| `FluentAuthErrorCode` `"nonce_expired"` | rename | `"challenge_expired"` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluent.xyz/connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-rc.2",
|
|
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",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"dist",
|
|
49
|
+
"docs",
|
|
49
50
|
"LICENSE",
|
|
50
51
|
"README.md",
|
|
51
52
|
"INTEGRATION.md"
|
|
@@ -56,9 +57,10 @@
|
|
|
56
57
|
"build:css": "tailwindcss -i ./src/styles/globals.css -o ./dist/fluent-connect.css --minify",
|
|
57
58
|
"dev": "tsup --watch --clean=false",
|
|
58
59
|
"dev:css": "tailwindcss -i ./src/styles/globals.css -o ./dist/fluent-connect.css --watch=always",
|
|
59
|
-
"typecheck": "tsc --noEmit",
|
|
60
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.lock.json && tsc --noEmit -p tsconfig.docs.json",
|
|
60
61
|
"test": "vitest run",
|
|
61
62
|
"test:kernel-signature": "FLUENT_KERNEL_SIGNATURE_TEST=1 vitest run src/widget/kernelSignature.fork.test.ts",
|
|
63
|
+
"docs:api": "node --experimental-strip-types scripts/api-doc.ts",
|
|
62
64
|
"clean": "rm -rf dist",
|
|
63
65
|
"prepack": "pnpm run build",
|
|
64
66
|
"pack:dry": "npm pack --dry-run",
|
|
@@ -111,6 +113,7 @@
|
|
|
111
113
|
"@zerodev/ecdsa-validator": "^5.4.5",
|
|
112
114
|
"@zerodev/permissions": "^5.6.3",
|
|
113
115
|
"@zerodev/sdk": "^5.5.10",
|
|
116
|
+
"fast-check": "^4.10.2",
|
|
114
117
|
"jsdom": "^30",
|
|
115
118
|
"publint": "^0.3.15",
|
|
116
119
|
"react": "^18.3.1",
|