@fluent.xyz/connect 0.6.4 → 0.7.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.
@@ -1,6 +1,6 @@
1
1
  import { Address, Transport, Chain, PublicClient } from 'viem';
2
- import { F as FluentBatchCallInput } from './batchOperation-BXn9nmvk.js';
3
- export { g as getFluentExplorerBaseUrl, i as isFaucetNetwork, n as normalizeFluentWidgetNetwork } from './batchOperation-BXn9nmvk.js';
2
+ import { F as FluentBatchCallInput } from './batchOperation-CIcgSRv5.js';
3
+ export { g as getFluentExplorerBaseUrl, i as isFaucetNetwork, n as normalizeFluentWidgetNetwork } from './batchOperation-CIcgSRv5.js';
4
4
 
5
5
  type FluentNetworkName = "testnet" | "mainnet";
6
6
  /**
package/docs/api.md CHANGED
@@ -631,7 +631,7 @@ export type FluentBatchOperation = {
631
631
  | `calls` | `readonly FluentBatchCallInput[]` | no | no | The calls as the host passed them. |
632
632
  | `encodedCalls` | `FluentEncodedBatchCall[]` | no | no | The same calls encoded, in order: what `execute()` sends. |
633
633
  | `canExecute` | `boolean` | no | no | Whether the widget could send the operation when it was built: the Widget account ready, or able to prepare itself when `execute()` is called. Not updated afterwards; read `widget.account.executionReady` for the live value. |
634
- | `execute` | `(options?: FluentBatchOperationExecuteOptions) => Promise<FluentExecuteResult>` | no | no | Executes the operation for the Widget account and resolves once it is included. **Throws** `FluentReviewRejectedError` with `code` `transaction_review_rejected` when the person dismisses the Review, which a Fluent ID shows in Prompt mode; an External wallet's refusal in its own prompt rejects with the wallet's error. **Throws** `FluentSponsorshipFallbackError` when a Fluent ID asked for Sponsorship, a sponsored submission failed, and the submission in which the account pays its own gas failed too; its `code` says why Sponsorship failed: `denied`, `unauthorized`, `unreachable` or `no_token`. A failure while waiting for an operation's inclusion is not wrapped: it rejects with its own error, and an operation whose wait failed was submitted. What else is not wrapped: [guides/sponsorship.md](guides/sponsorship.md#both-failed-fluentsponsorshipfallbackerror). **Throws** `FluentUserOperationGasError` (experimental) with `code` `invalid_policy` for a `skipEstimation` policy that cannot be used (other invalid `userOperationGas` values throw a plain `Error`), and `paymaster_gas_mismatch` when, with estimation skipped, the paymaster's authorization of a Gas token payment does not match the fixed gas limits. Under Sponsorship, a failed check of the paymaster's gas fails the sponsored submission instead, and the account pays its own gas. **Throws** `FluentGasPaymentError` when a Fluent ID's operation is paid in a Gas token and cannot be prepared; nothing has been signed or sent. Its `code` is `paymaster_unavailable` when the address of the paymaster to approve the Gas token to cannot be read, `insufficient_gas_token` when the account's balance of the Gas token is below the fee the paymaster quotes for the operation or the paymaster's simulation cannot charge the fee in it, and `paymaster_rejected` when the paymaster refuses to charge the fee in the Gas token for another reason. |
634
+ | `execute` | `(options?: FluentBatchOperationExecuteOptions) => Promise<FluentExecuteResult>` | no | no | Executes the operation for the Widget account and resolves once it is included. **Throws** `FluentReviewRejectedError` with `code` `transaction_review_rejected` when the person dismisses the Review, which a Fluent ID shows in Prompt mode; an External wallet's refusal in its own prompt rejects with the wallet's error. **Throws** `FluentSponsorshipFallbackError` when a Fluent ID asked for Sponsorship, a sponsored submission failed, and the submission in which the account pays its own gas failed too; its `code` says why Sponsorship failed: `denied`, `unauthorized`, `unreachable` or `no_token`. A failure while waiting for an operation's inclusion is not wrapped: it rejects with its own error, and an operation whose wait failed was submitted. What else is not wrapped: [guides/sponsorship.md](guides/sponsorship.md#both-failed-fluentsponsorshipfallbackerror). **Throws** `FluentUserOperationGasError` (experimental) with `code` `invalid_policy` for a `skipEstimation` policy that cannot be used (other invalid `userOperationGas` values throw a plain `Error`), and `paymaster_gas_mismatch` when, with estimation skipped, the paymaster's authorization of a Gas token payment does not match the fixed gas limits. Under Sponsorship, a failed check of the paymaster's gas fails the sponsored submission instead, and the account pays its own gas. **Throws** `FluentGasPaymentError` when a Fluent ID's operation is paid in a Gas token and cannot be prepared; nothing has been signed or sent. Its `code` is `paymaster_unavailable` when the address of the paymaster to approve the Gas token to cannot be read, `insufficient_gas_token` when the paymaster's simulation of the operation cannot charge the fee in the Gas token, and `paymaster_rejected` when the paymaster refuses to charge the fee in the Gas token for another reason. The account's balance of the Gas token is not read first: the operation may acquire the fee itself. |
635
635
 
636
636
  ### `FluentBatchOperationExecuteOptions`
637
637
 
@@ -1147,8 +1147,8 @@ export class FluentGasPaymentError extends Error {
1147
1147
  Why a `FluentGasPaymentError` was thrown. `paymaster_unavailable`: the request for the address
1148
1148
  of the paymaster that charges Gas tokens on the operation's Network failed, or its answer held
1149
1149
  no address, so the widget has no spender to approve the Gas token to.
1150
- `insufficient_gas_token`: the account's balance of the Gas token is below the fee the paymaster
1151
- quotes for the operation, or the paymaster's simulation could not charge the fee in it.
1150
+ `insufficient_gas_token`: the paymaster's simulation of the operation could not charge the fee
1151
+ in the Gas token, the account's balance of it not covering the fee.
1152
1152
  `paymaster_rejected`: the paymaster refused to charge the fee in the Gas token for another
1153
1153
  reason. Keep a `default` branch in a `switch` over it: a later release may add a code.
1154
1154
 
package/docs/concepts.md CHANGED
@@ -91,6 +91,11 @@ 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
+ The page connects the External wallet that holds the funds by itself, on both
95
+ networks. A desktop browser offers the wallet extensions it announces; a phone
96
+ offers MetaMask, Trust Wallet and Rainbow, each opened through a link that
97
+ carries the WalletConnect pairing.
98
+
94
99
  Five consequences reach your integration:
95
100
 
96
101
  - **The swap is an operation from the smart account**, like a Send: it uses the
package/docs/errors.md CHANGED
@@ -206,11 +206,12 @@ measured.
206
206
 
207
207
  A Fluent ID's Batch operation paid in a Gas token could not be prepared. Before the operation is
208
208
  signed, the widget reads the address of the paymaster that charges Gas tokens, because the
209
- approval it may add to the operation names that paymaster as the spender; it compares the
210
- account's balance of the Gas token with the fee the paymaster quotes for the operation; and it
211
- asks the paymaster to charge the fee in the token. It throws before any signature is requested and
212
- before anything is sent. A balance or quote the widget cannot read does not throw: the operation
213
- goes to the paymaster as it is. `cause` holds the error of the failed request when there was one,
209
+ approval it may add to the operation names that paymaster as the spender, and it asks the
210
+ paymaster to charge the fee in the token. It throws before any signature is requested and before
211
+ anything is sent. The widget does not read the account's balance of the Gas token first: an
212
+ operation may acquire the fee itself, such as a swap into the Gas token, and only the paymaster's
213
+ simulation of the operation decides whether the fee can be charged. `cause` holds the error of the
214
+ failed request when there was one,
214
215
  and `message` names the Gas token for `insufficient_gas_token` and `paymaster_rejected`. An
215
216
  External wallet pays its own gas and an operation paid in ETH has no Gas token, so neither throws
216
217
  it.
@@ -218,7 +219,7 @@ it.
218
219
  | `code` | Thrown by | What it means | What to do |
219
220
  |---|---|---|---|
220
221
  | `paymaster_unavailable` | `execute()` | The request for the paymaster's address on the operation's Network failed, or its answer held no address, so the widget has no spender to approve the Gas token to. | Try again later, or pay in ETH (`gasPayment: { symbol: "ETH" }`). |
221
- | `insufficient_gas_token` | `execute()` | The account's balance of the Gas token is below the fee the paymaster quotes for the operation, or the paymaster's simulation of the operation could not charge the fee in the token. | Ask the person to pay the fee in ETH (`gasPayment: { symbol: "ETH" }`) or to add more of the Gas token, then send the operation again. The widget's own flows say "Not enough {symbol} to pay the network fee. Pay the fee in ETH or add {symbol}." |
222
+ | `insufficient_gas_token` | `execute()` | The paymaster's simulation of the operation could not charge the fee in the Gas token. | Ask the person to pay the fee in ETH (`gasPayment: { symbol: "ETH" }`) or to add more of the Gas token, then send the operation again. The widget's own flows say "Not enough {symbol} to pay the network fee. Pay the fee in ETH or add {symbol}." |
222
223
  | `paymaster_rejected` | `execute()` | The paymaster refused to charge the fee in the Gas token for another reason; `cause` holds its answer. | Pay in ETH (`gasPayment: { symbol: "ETH" }`) or try again later; report `cause` if it persists. |
223
224
 
224
225
  ## `FluentUserOperationGasError`
@@ -180,14 +180,14 @@ allowance the widget cannot read counts as none, and when ZeroDev cannot name th
180
180
  amount instead, whatever the allowance. The Review lists the operation's own calls, not the
181
181
  approval, and an operation paid in ETH or sent by an External wallet gets none.
182
182
 
183
- Before an operation paid in a Gas token is signed, the widget also compares the account's balance
184
- of that token with the fee the paymaster quotes for the operation. A balance below it rejects
185
- `execute()` with a `FluentGasPaymentError` whose `code` is `insufficient_gas_token` and whose
186
- `message` names the token; so does a paymaster whose simulation cannot charge the fee in the token,
187
- and any other refusal by the paymaster rejects with `code` `paymaster_rejected`. Nothing has been
188
- signed or sent in either case: offer the person the fee in ETH (`gasPayment: { symbol: "ETH" }`)
189
- or ask them to add more of the token. A balance or quote the widget cannot read does not stop the
190
- operation. The full list is in [errors.md](../errors.md#fluentgaspaymenterror).
183
+ The widget does not read the account's balance of the Gas token before sending: an operation may
184
+ acquire the fee itself, such as a swap into the Gas token from a balance of 0, and the paymaster's
185
+ simulation of the operation decides. When that simulation cannot charge the fee in the token,
186
+ `execute()` rejects with a `FluentGasPaymentError` whose `code` is `insufficient_gas_token` and
187
+ whose `message` names the token; any other refusal by the paymaster rejects with `code`
188
+ `paymaster_rejected`. Nothing has been signed or sent in either case: offer the person the fee in
189
+ ETH (`gasPayment: { symbol: "ETH" }`) or ask them to add more of the token. The full list is in
190
+ [errors.md](../errors.md#fluentgaspaymenterror).
191
191
 
192
192
  Gas limits can be fixed by hand with the experimental `userOperationGas` option
193
193
  ([experimental.md](../experimental.md#useroperationgas)); leaving it out lets the widget
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluent.xyz/connect",
3
- "version": "0.6.4",
3
+ "version": "0.7.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",