@fluent.xyz/connect 0.6.2 → 0.6.4

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/dist/index.d.ts CHANGED
@@ -2,7 +2,9 @@ import * as react from 'react';
2
2
  import { ReactNode, RefObject } from 'react';
3
3
  import * as web from '@privy-io/react-auth';
4
4
  import * as viem from 'viem';
5
- import { Chain, SignableMessage, Hex, TypedData, TypedDataDefinition, Address, Abi, Hash, TransactionReceipt, WalletClient } from 'viem';
5
+ import { Address, WalletClient } from 'viem';
6
+ import { a as FluentWidgetNetwork, b as FluentGasTokenSymbol, c as FluentGasPaymentEthRates, d as FluentAccountType, e as FluentBatchApi } from './batchOperation-BXn9nmvk.js';
7
+ export { f as FluentAccountCapabilities, F as FluentBatchCallInput, h as FluentBatchOperation, j as FluentBatchOperationExecuteOptions, k as FluentBatchOperationInput, l as FluentEncodedBatchCall, m as FluentExecuteResult, o as FluentExecuteTiming, p as FluentExecuteTimingInstants, q as FluentFixedAccountGas, r as FluentFixedPaymasterGas, s as FluentGasPayment, t as FluentSignApi, u as FluentSigningMode, v as FluentUserOperationGas, w as FluentUserOperationGasError, x as FluentUserOperationGasErrorCode, y as FluentWidgetAccount, z as FluentWidgetExecutionStatus, A as FluentWidgetGasPayment, B as getFluentChainForNetwork } from './batchOperation-BXn9nmvk.js';
6
8
 
7
9
  /**
8
10
  * Privy runtime supplied by a host using a native SDK. Its Provider owns session
@@ -106,34 +108,6 @@ declare const fluentTestnet: viem.Chain;
106
108
  /** Fluent mainnet (chain id 25363) */
107
109
  declare const fluentMainnet: viem.Chain;
108
110
 
109
- /** Which of Fluent's two deployments the widget runs on. */
110
- type FluentWidgetNetwork = "testnet" | "mainnet";
111
- /**
112
- * The viem chain of a Network, for a host's own chain config.
113
- *
114
- * @example
115
- * ```ts
116
- * import { getFluentChainForNetwork } from "@fluent.xyz/connect";
117
- *
118
- * export const chain = getFluentChainForNetwork("mainnet"); // chain.id === 25363
119
- * ```
120
- */
121
- declare function getFluentChainForNetwork(network: FluentWidgetNetwork): Chain;
122
-
123
- /**
124
- * A symbol that can pay for gas. Deliberately `string`: which tokens are
125
- * payable is data on the token definitions now, not a fixed set of literals.
126
- */
127
- type FluentGasTokenSymbol = string;
128
- /**
129
- * What one unit of each Gas token is worth in ETH, as a decimal string, keyed by its
130
- * `FluentGasTokenSymbol`.
131
- *
132
- * @experimental May change or be removed in a minor release while the defaults are measured;
133
- * the defaults are the recommended setting.
134
- */
135
- type FluentGasPaymentEthRates = Partial<Record<FluentGasTokenSymbol, string>>;
136
-
137
111
  /**
138
112
  * Why an operation was not sponsored, and the `code` of a `FluentSponsorshipFallbackError`.
139
113
  * `not_requested` is the only one that is not a failure: the caller asked to pay its own gas,
@@ -178,15 +152,20 @@ declare class FluentSponsorshipFallbackError extends Error {
178
152
  /**
179
153
  * Why a `FluentGasPaymentError` was thrown. `paymaster_unavailable`: the request for the address
180
154
  * of the paymaster that charges Gas tokens on the operation's Network failed, or its answer held
181
- * no address, so the widget has no spender to approve the Gas token to. Keep a `default` branch
182
- * in a `switch` over it: a later release may add a code.
155
+ * no address, so the widget has no spender to approve the Gas token to.
156
+ * `insufficient_gas_token`: the account's balance of the Gas token is below the fee the paymaster
157
+ * quotes for the operation, or the paymaster's simulation could not charge the fee in it.
158
+ * `paymaster_rejected`: the paymaster refused to charge the fee in the Gas token for another
159
+ * reason. Keep a `default` branch in a `switch` over it: a later release may add a code.
183
160
  */
184
- type FluentGasPaymentErrorCode = "paymaster_unavailable";
161
+ type FluentGasPaymentErrorCode = "paymaster_unavailable" | "insufficient_gas_token" | "paymaster_rejected";
185
162
  /**
186
163
  * A Gas token payment the widget could not prepare. Thrown by `execute()` of a Fluent ID's Batch
187
- * operation paid in a Gas token, before any signature is requested and before anything is sent,
188
- * so the operation can be tried again as it is. `code`, a `FluentGasPaymentErrorCode`,
189
- * identifies the failure; `cause` holds the error of the failed request when there was one.
164
+ * operation paid in a Gas token, before any signature is requested and before anything is sent.
165
+ * `code`, a `FluentGasPaymentErrorCode`, identifies the failure, and `message` names the Gas
166
+ * token for `insufficient_gas_token` and `paymaster_rejected`; `cause` holds the error of the
167
+ * failed request when there was one. Paying in ETH (`gasPayment: { symbol: "ETH" }`) avoids every
168
+ * code.
190
169
  */
191
170
  declare class FluentGasPaymentError extends Error {
192
171
  readonly code: FluentGasPaymentErrorCode;
@@ -195,477 +174,6 @@ declare class FluentGasPaymentError extends Error {
195
174
  });
196
175
  }
197
176
 
198
- /**
199
- * The signatures of the Widget API, for the Widget account. A Fluent ID shows the Review in
200
- * Prompt mode and none in Silent mode; an External wallet always shows the Review, then its own
201
- * prompt.
202
- */
203
- type FluentSignApi = {
204
- /**
205
- * EIP-191 signature. ERC-1271 (ERC-6492 before deployment) for a smart account, ECDSA for an
206
- * External wallet.
207
- *
208
- * @throws `FluentReviewRejectedError` with `code` `signature_review_rejected` when the person
209
- * dismisses the Review: always shown for an External wallet, and for a Fluent ID unless Quick
210
- * sign is on. An External wallet's refusal in its own prompt rejects with the wallet's error.
211
- * @throws `FluentAuthError` with `code` `not_connected` when no Widget account is connected or
212
- * the External wallet has no client, and `root_signer_required` when neither of the Fluent
213
- * ID's signing paths signs with its root Signer, a guard no configuration reaches today.
214
- *
215
- * @example
216
- * ```ts
217
- * import { useFluentWidget } from "@fluent.xyz/connect";
218
- *
219
- * export function useSignGreeting() {
220
- * const { widget } = useFluentWidget();
221
- * return () => widget.signMessage({ message: "Sign in to Marketplace" });
222
- * }
223
- * ```
224
- */
225
- signMessage: (params: {
226
- message: SignableMessage;
227
- }) => Promise<Hex>;
228
- /**
229
- * EIP-712 signature. ERC-1271 (ERC-6492 before deployment) for a smart account, ECDSA for an
230
- * External wallet.
231
- *
232
- * @throws `FluentReviewRejectedError` with `code` `signature_review_rejected` when the person
233
- * dismisses the Review, as for `signMessage`.
234
- * @throws `FluentAuthError` with `code` `not_connected` or `root_signer_required`, as for
235
- * `signMessage`.
236
- *
237
- * @example
238
- * ```ts
239
- * import { useFluentWidget } from "@fluent.xyz/connect";
240
- *
241
- * const verifyingContract = "0x0000000000000000000000000000000000000001";
242
- * const order = { maker: "0x0000000000000000000000000000000000000002", price: 100n } as const;
243
- *
244
- * export function useSignOrder() {
245
- * const { widget } = useFluentWidget();
246
- * return () =>
247
- * widget.signTypedData({
248
- * domain: { name: "Marketplace", version: "1", chainId: 20994, verifyingContract },
249
- * types: {
250
- * Order: [
251
- * { name: "maker", type: "address" },
252
- * { name: "price", type: "uint256" },
253
- * ],
254
- * },
255
- * primaryType: "Order",
256
- * message: order,
257
- * });
258
- * }
259
- * ```
260
- */
261
- signTypedData: <const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(typedData: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
262
- };
263
-
264
- /**
265
- * The account's own gas limits, all three fixed, for a `FluentUserOperationGas` that skips
266
- * estimation.
267
- *
268
- * @experimental May change or be removed in a minor release while the gas policy is measured;
269
- * omitting it, which lets the widget estimate, is the recommended setting.
270
- */
271
- type FluentFixedAccountGas = {
272
- /** Whole-batch execution budget, including any Gas token approval. Positive uint128. */
273
- callGasLimit: bigint;
274
- /** Account validation and deployment budget. Positive uint128. */
275
- verificationGasLimit: bigint;
276
- /** Calldata overhead, or its ceiling with provider-owned paymaster gas. Positive uint256. */
277
- preVerificationGas: bigint;
278
- };
279
- /**
280
- * The paymaster's gas limits for a `FluentUserOperationGas` that skips estimation: both, or
281
- * neither to use the limits the paymaster authorizes.
282
- *
283
- * @experimental May change or be removed in a minor release while the gas policy is measured;
284
- * omitting it, which lets the widget estimate, is the recommended setting.
285
- */
286
- type FluentFixedPaymasterGas = {
287
- /** Fixed validation budget, a positive uint128. Omit both paymaster limits to use its answer. */
288
- paymasterVerificationGasLimit?: bigint;
289
- /** Fixed post-operation budget, a nonnegative uint128. Supplied together with validation. */
290
- paymasterPostOpGasLimit?: bigint;
291
- };
292
- /**
293
- * Gas policy for a Fluent ID batch. Estimation is enabled unless `skipEstimation` is true.
294
- * Skipping requires account limits. Omit both paymaster limits to use provider-authorized
295
- * paymaster gas and calldata overhead within `preVerificationGas`; supply both to fix all gas.
296
- * The fixed limits are a `FluentFixedAccountGas` and a `FluentFixedPaymasterGas`.
297
- *
298
- * @experimental May change or be removed in a minor release while the gas policy is measured;
299
- * omitting it, which lets the widget estimate, is the recommended setting.
300
- */
301
- type FluentUserOperationGas = (FluentFixedAccountGas & FluentFixedPaymasterGas & {
302
- /** Skip the account gas hook and bundler gas estimation. Defaults to false. */
303
- skipEstimation: true;
304
- callGasBuffer?: never;
305
- }) | {
306
- skipEstimation?: false;
307
- callGasLimit: bigint;
308
- callGasBuffer?: never;
309
- } | {
310
- skipEstimation?: false;
311
- callGasLimit?: never;
312
- callGasBuffer: {
313
- /** Extra percent of the bundler estimate, rounded up. Must be a nonnegative safe integer. */
314
- percentage?: number;
315
- /** Extra gas added after the percentage buffer. Must be nonnegative. */
316
- fixed?: bigint;
317
- };
318
- };
319
- /**
320
- * Reasons explicit gas preparation can fail before signing.
321
- *
322
- * @experimental May change or be removed in a minor release while the gas policy is measured;
323
- * omitting it, which lets the widget estimate, is the recommended setting.
324
- */
325
- type FluentUserOperationGasErrorCode = "invalid_policy" | "paymaster_gas_mismatch";
326
- /**
327
- * An invalid skip-estimation policy or paymaster authorization for different gas limits.
328
- * `code`, a `FluentUserOperationGasErrorCode`, identifies the failure; `message` names the
329
- * option or gas field to correct.
330
- *
331
- * @experimental May change or be removed in a minor release while the gas policy is measured;
332
- * omitting it, which lets the widget estimate, is the recommended setting.
333
- */
334
- declare class FluentUserOperationGasError extends Error {
335
- readonly code: FluentUserOperationGasErrorCode;
336
- constructor(code: FluentUserOperationGasErrorCode, message: string);
337
- }
338
-
339
- /**
340
- * One contract call of a Batch operation: either raw `data`, or an `abi` with the `method` to
341
- * encode and its `args`.
342
- */
343
- type FluentBatchCallInput = {
344
- id?: string;
345
- label?: string;
346
- to: Address;
347
- /** Native ETH sent with the call, in wei. Defaults to `0n`. */
348
- value?: bigint;
349
- data?: Hex;
350
- abi?: Abi;
351
- /** The ABI function to encode, with `abi` and `args`, when `data` is not given. */
352
- method?: string;
353
- args?: readonly unknown[];
354
- };
355
- /** A Batch operation's call as it is sent: `data` encoded, `value` defaulted to `0n`. */
356
- type FluentEncodedBatchCall = {
357
- id?: string;
358
- label?: string;
359
- to: Address;
360
- value: bigint;
361
- data: Hex;
362
- };
363
- /**
364
- * Whether the Widget account can send now: `ready`, `disconnected`, `unavailable` (connected
365
- * but not ready yet) or `error` (see `FluentWidgetAccount.executionError`).
366
- */
367
- type FluentWidgetExecutionStatus = "disconnected" | "ready" | "unavailable" | "error";
368
- /** How the connected account executes transactions. */
369
- type FluentAccountType = "smart" | "eoa";
370
- /** What the Widget account can do, so a host adapts its UI without branching on its type. */
371
- type FluentAccountCapabilities = {
372
- /** Multiple calls land in a single atomic transaction (smart account only). */
373
- atomicBatch: boolean;
374
- /**
375
- * Gas can be paid in an ERC-20 (BLEND / USDnr) via the paymaster instead of
376
- * native ETH — smart account only. This is NOT free/sponsored gas: the user
377
- * still pays, just in a token.
378
- */
379
- erc20Gas: boolean;
380
- };
381
- /**
382
- * The Widget account as the Widget API reports it: its address and type, whether it is
383
- * connected and can send now, and what it can do.
384
- */
385
- type FluentWidgetAccount = {
386
- /** The Widget account's address: the Fluent ID's, or the External wallet's. */
387
- address?: Address;
388
- /** Whether a Widget account, a Fluent ID or an External wallet, is connected. */
389
- connected: boolean;
390
- /** Whether the Widget account can send now; `executionStatus` says why it cannot. */
391
- executionReady: boolean;
392
- /** Where sending stands, a `FluentWidgetExecutionStatus`. */
393
- executionStatus: FluentWidgetExecutionStatus;
394
- /**
395
- * The message of the last failure to prepare the Fluent ID's account, if any: the reason an
396
- * `executionStatus` of `"error"` gives.
397
- */
398
- executionError?: string;
399
- /** Active account kind, or undefined when nothing is connected. */
400
- type?: FluentAccountType;
401
- /** What the active account can do — lets hosts adapt UI without branching on `type`. */
402
- capabilities: FluentAccountCapabilities;
403
- };
404
- /**
405
- * Absolute instants behind `FluentExecuteTiming`, kept so its signed estimates can be
406
- * re-checked rather than believed. Epoch milliseconds (`Date.now()`), because the only other
407
- * clock in the arithmetic — the including block's `timestamp` — is a wall clock too.
408
- *
409
- * @experimental May change or be removed in a minor release while the numbers are measured.
410
- */
411
- type FluentExecuteTimingInstants = {
412
- /** When the first submission attempt of this send began. */
413
- submittedAtEpochMs: number;
414
- /** When the bundler accepted the operation that settled. */
415
- broadcastedAtEpochMs: number;
416
- /** When that operation's receipt was in hand. */
417
- receivedAtEpochMs: number;
418
- /**
419
- * The including block's `timestamp`, in milliseconds. Absent exactly when `inclusionMs` and
420
- * `detectMs` are absent: the block could not be read.
421
- */
422
- blockTimestampEpochMs?: number;
423
- /** How many operations were submitted; more than one means a retry or an own-gas fallback. */
424
- attempts: number;
425
- };
426
- /**
427
- * Where one send's milliseconds went, stage by stage.
428
- *
429
- * Two clocks, and the difference decides how these numbers may be read. `prepareMs`,
430
- * `signMs`, `broadcastMs`, `retryMs` and `totalMs` are direct monotonic measurements on the
431
- * client (`performance.now()`). `inclusionMs` and `detectMs` are *signed estimates* across the
432
- * client's clock and the chain's: `block.timestamp` has one-second resolution and no relation
433
- * to the browser's clock, so either may legitimately be negative when it is small, and neither
434
- * is clamped — a clamp would turn a known skew into a silent zero. `instants` keeps the inputs,
435
- * so the subtraction can be redone by whoever doubts it.
436
- *
437
- * `totalMs` is measured, not summed: it runs from the start of the first submission to the
438
- * instant the receipt was in hand, and excludes both the smart-account and authentication setup
439
- * before the send and the block read after it. It does not equal the sum of the stages and must
440
- * not be displayed as if it did.
441
- *
442
- * Collected for every send, whatever `debugLogging` is set to — the numbers are the answer to
443
- * "where did the four seconds go", which is a question a host asks in production. A failure
444
- * inside the measuring code costs the stages it could not establish, never the send.
445
- *
446
- * @experimental May change or be removed in a minor release while the numbers are measured.
447
- */
448
- type FluentExecuteTiming = {
449
- /**
450
- * Building the UserOperation — nonce, gas estimate, paymaster — up to the signature request.
451
- * Absent when the clock could not be read at that boundary: every stage here is absent rather
452
- * than approximated, because a stage silently widened to cover its neighbours is worse than a
453
- * stage the display can mark as unmeasured.
454
- */
455
- prepareMs?: number;
456
- /** Producing the signature. Absent when the settled attempt never got that far. */
457
- signMs?: number;
458
- /** Handing the signed operation to the bundler. Absent when signing never finished. */
459
- broadcastMs?: number;
460
- /**
461
- * Bundler acceptance to the including block's timestamp: bundling plus block time. Signed
462
- * estimate; absent when the including block could not be read.
463
- */
464
- inclusionMs?: number;
465
- /**
466
- * The including block's timestamp to the instant this client held the receipt: how long the
467
- * inclusion took to notice. Signed estimate; absent when the including block could not be read.
468
- */
469
- detectMs?: number;
470
- /**
471
- * Time spent on submissions that did not settle — a rejected sponsorship bearer, a refused
472
- * sponsorship falling back to own gas — and on the token exchange between them. It belongs to
473
- * no stage, is counted inside `totalMs`, and is `0` for a send that submitted once.
474
- */
475
- retryMs: number;
476
- /** First submission to receipt in hand. Measured directly; never a sum of the stages. */
477
- totalMs: number;
478
- /** The raw instants the signed estimates above were computed from. */
479
- instants: FluentExecuteTimingInstants;
480
- };
481
- /** Result of executing a batch operation. */
482
- type FluentExecuteResult = {
483
- /** Primary transaction hash — the final/target call (e.g. deposit/withdraw). */
484
- hash: Hash;
485
- /** All transaction hashes in order. One for a smart-account UserOp; one per call for an EOA. */
486
- hashes: Hash[];
487
- /** Included receipt for hash (the final EOA call); not a finality guarantee. */
488
- receipt?: TransactionReceipt;
489
- /** ERC-4337 operation hash when executing through a smart account. */
490
- userOpHash?: Hash;
491
- /** True when all calls landed atomically (smart account), false for sequential EOA txs. */
492
- atomic: boolean;
493
- /**
494
- * Whether the App's Sponsorship paid the gas for this operation, read back off the settled
495
- * operation (which contract the EntryPoint charged) first: a refused Sponsorship falls back
496
- * to the account paying its own gas, so a flag set from asking for Sponsorship would report
497
- * the fallback as a success. `false` for a Gas token payment and always for an External
498
- * wallet, which has no paymaster. When a Fluent ID's receipt names no paymaster, the way the
499
- * operation was sent decides: `false` when it made no sponsored submission (the fallback,
500
- * `sponsorship: "never"`, Sponsorship unavailable or not configured), and `null` after a
501
- * sponsored submission, where nothing says who paid.
502
- */
503
- sponsored: boolean | null;
504
- /**
505
- * The paymaster a Fluent ID's receipt names: the Sponsorship paymaster or a Gas token's
506
- * paymaster, when one paid. Undefined when the receipt carried no paymaster — `sponsored` is
507
- * then `false`, or `null` after a sponsored submission — and always for an External wallet,
508
- * which has no paymaster.
509
- *
510
- * @experimental May change or be removed in a minor release while the numbers are measured.
511
- */
512
- paymaster?: Address;
513
- /**
514
- * Where this send's milliseconds went, as a `FluentExecuteTiming` whose raw instants are a
515
- * `FluentExecuteTimingInstants`. Fluent ID only: an External wallet performs its prompt, its
516
- * signing and its broadcast behind one `sendTransaction` await, so EIP-1193 exposes no
517
- * truthful instant to put a boundary on.
518
- *
519
- * @experimental May change or be removed in a minor release while the numbers are measured.
520
- */
521
- timing?: FluentExecuteTiming;
522
- };
523
- /** The Gas payment chosen in the widget: the Gas token's symbol, its address and decimals. */
524
- type FluentWidgetGasPayment = {
525
- symbol: FluentGasTokenSymbol;
526
- token?: Address;
527
- decimals: number;
528
- };
529
- /** What `widget.createBatchOp` takes: the calls of one Batch operation, and its Review title. */
530
- type FluentBatchOperationInput = {
531
- id?: string;
532
- /**
533
- * Heading of this Batch operation's Review (Fluent ID, Prompt mode). Defaults to the
534
- * widget's own copy, "Confirm transaction".
535
- */
536
- reviewTitle?: string;
537
- calls: readonly FluentBatchCallInput[];
538
- };
539
- /**
540
- * How a Fluent ID signs: `"prompt"` shows the widget's Review first (Prompt mode), `"silent"`
541
- * signs with none (Silent mode), except that where the App set `quickSign.whitelistAddresses`, a
542
- * Batch operation with a call outside it is signed as `"prompt"`. An External wallet always
543
- * shows its own prompt.
544
- */
545
- type FluentSigningMode = "prompt" | "silent";
546
- /**
547
- * How one operation's gas is paid: a Gas token by symbol, or native ETH, and whether
548
- * Sponsorship is asked for.
549
- *
550
- * Without `includeApproval`, the widget adds the approval of the Gas token to its ERC-20
551
- * paymaster at the start of the operation when the account's allowance is below the threshold:
552
- * 1 USDnr when the allowance is below 0.1 USDnr, 10 BLEND when it is below 1 BLEND. An
553
- * allowance that cannot be read counts as none. `includeApproval: true` with an `approveAmount`
554
- * approves that amount instead, whatever the allowance. Either way the Review lists the
555
- * operation's own calls, and nothing is added for `"ETH"` or for an External wallet.
556
- */
557
- type FluentGasPayment = {
558
- /**
559
- * Gas token symbol. The widget resolves the ERC-20 address for the active
560
- * network internally — callers never pass (or risk mistyping) an address.
561
- * `"ETH"` means native gas (no ERC-20 paymaster).
562
- */
563
- symbol: FluentGasTokenSymbol;
564
- /**
565
- * Whether to ask the App's sponsorship paymaster to pay for this operation.
566
- *
567
- * `"auto"` tries Sponsorship, and if the paymaster refuses, resends with the account paying
568
- * its own gas. `"never"` skips the paymaster outright, so the account pays from the first
569
- * attempt and the result reports `sponsored: false`. What an omitted value means:
570
- * [guides/sponsorship.md](guides/sponsorship.md#not-asking-sponsorship-never-and-gas-tokens).
571
- *
572
- * Ignored when `symbol` names an ERC-20: that token's own paymaster pays,
573
- * and sponsorship is not in the picture.
574
- */
575
- sponsorship?: "auto" | "never";
576
- } & ({
577
- /** Approves `approveAmount` to the paymaster whatever the allowance, for a Gas token. */
578
- includeApproval: true;
579
- /** In the Gas token's smallest unit. */
580
- approveAmount: bigint;
581
- } | {
582
- includeApproval?: false;
583
- approveAmount?: never;
584
- });
585
- /** The options of `FluentBatchOperation.execute`, every one optional. */
586
- type FluentBatchOperationExecuteOptions = {
587
- /**
588
- * The `FluentSigningMode` of this operation. Defaults to the widget's `signingMode`, which
589
- * follows the person's Quick sign. A `"silent"` operation with a call outside
590
- * `quickSign.whitelistAddresses` is signed as `"prompt"`. Any value but `"silent"`, 0.5's
591
- * `"always"` and `"session"` included, is `"prompt"`. Ignored for an External wallet.
592
- */
593
- confirmation?: FluentSigningMode;
594
- /** How the gas of this operation is paid. Defaults to the Gas payment chosen in the widget. */
595
- gasPayment?: FluentGasPayment;
596
- /**
597
- * Fluent ID gas limits, estimation opt-out or headroom: a `FluentUserOperationGas`, whose
598
- * fixed limits are a `FluentFixedAccountGas` and a `FluentFixedPaymasterGas`. Ignored for
599
- * External wallet sends.
600
- *
601
- * @experimental May change or be removed in a minor release while the gas policy is measured;
602
- * omitting it, which lets the widget estimate, is the recommended setting.
603
- */
604
- userOperationGas?: FluentUserOperationGas;
605
- };
606
- /**
607
- * A Batch operation `widget.createBatchOp` built: its calls, encoded, and `execute`, which sends
608
- * them for the Widget account.
609
- */
610
- type FluentBatchOperation = {
611
- /** `FluentBatchOperationInput.id`, copied. */
612
- id?: string;
613
- /** `FluentBatchOperationInput.reviewTitle`, copied. */
614
- reviewTitle?: string;
615
- /** The calls as the host passed them. */
616
- calls: readonly FluentBatchCallInput[];
617
- /** The same calls encoded, in order: what `execute()` sends. */
618
- encodedCalls: FluentEncodedBatchCall[];
619
- /**
620
- * Whether the widget could send the operation when it was built: the Widget account ready, or
621
- * able to prepare itself when `execute()` is called. Not updated afterwards; read
622
- * `widget.account.executionReady` for the live value.
623
- */
624
- canExecute: boolean;
625
- /**
626
- * Executes the operation for the Widget account and resolves once it is included.
627
- *
628
- * @throws `FluentReviewRejectedError` with `code` `transaction_review_rejected` when the
629
- * person dismisses the Review, which a Fluent ID shows in Prompt mode; an External wallet's
630
- * refusal in its own prompt rejects with the wallet's error.
631
- * @throws `FluentSponsorshipFallbackError` when a Fluent ID asked for Sponsorship, a sponsored
632
- * submission failed, and the submission in which the account pays its own gas failed too;
633
- * its `code` says why Sponsorship failed: `denied`, `unauthorized`, `unreachable` or
634
- * `no_token`. A failure while waiting for an operation's inclusion is not wrapped: it rejects
635
- * with its own error, and an operation whose wait failed was submitted. What else is not
636
- * wrapped: [guides/sponsorship.md](guides/sponsorship.md#both-failed-fluentsponsorshipfallbackerror).
637
- * @throws `FluentUserOperationGasError` (experimental) with `code` `invalid_policy` for a
638
- * `skipEstimation` policy that cannot be used (other invalid `userOperationGas` values throw a
639
- * plain `Error`), and `paymaster_gas_mismatch` when, with estimation skipped,
640
- * the paymaster's authorization of a Gas token payment does not match the fixed gas limits.
641
- * Under Sponsorship, a failed check of the paymaster's gas fails the sponsored submission
642
- * instead, and the account pays its own gas.
643
- * @throws `FluentGasPaymentError` with `code` `paymaster_unavailable` when a Fluent ID's
644
- * operation is paid in a Gas token and the address of the paymaster to approve it to cannot be
645
- * read; nothing has been signed or sent.
646
- */
647
- execute: (options?: FluentBatchOperationExecuteOptions) => Promise<FluentExecuteResult>;
648
- };
649
- /**
650
- * The Widget API: what the widget gives an App's code to act for the Widget account. Reached as
651
- * `widget` in the render context or from `useFluentWidget()`.
652
- */
653
- type FluentBatchApi = FluentSignApi & {
654
- /** The Widget account: its address, type, readiness and capabilities. */
655
- account: FluentWidgetAccount;
656
- /** How the widget signs by default: `"silent"` while the person's Quick sign is on. */
657
- signingMode: FluentSigningMode;
658
- /** The Gas payment chosen in the widget, which `execute()` uses when given no `gasPayment`. */
659
- gasPayment: FluentWidgetGasPayment;
660
- /**
661
- * Builds a Batch operation, encoding its calls now; `execute()` sends it.
662
- *
663
- * @throws `Error` when `calls` is empty, or when a call has neither `data` nor `abi` with
664
- * `method`: a call that still names its function in 0.5's `functionName` is one.
665
- */
666
- createBatchOp: (input: FluentBatchOperationInput) => FluentBatchOperation;
667
- };
668
-
669
177
  /**
670
178
  * Images for the widget, each a URL or a data URI. Today the widget reads only `fluentLogo`,
671
179
  * which it passes to the provider behind Direct login as its logo; see `assets` in
@@ -1421,4 +929,4 @@ type AccountAvatarProps = {
1421
929
  */
1422
930
  declare function AccountAvatar({ userAvatarUrl, defaultLogoUrl, className }: AccountAvatarProps): react.JSX.Element;
1423
931
 
1424
- export { AccountAvatar, type AccountAvatarProps, type FluentAccountCapabilities, type FluentAccountType, FluentAuthError, type FluentAuthErrorCode, type FluentBatchApi, type FluentBatchCallInput, type FluentBatchOperation, type FluentBatchOperationExecuteOptions, type FluentBatchOperationInput, type FluentChainDefinition, type FluentEncodedBatchCall, type FluentExecuteResult, type FluentExecuteTiming, type FluentExecuteTimingInstants, type FluentExternalWalletState, type FluentFixedAccountGas, type FluentFixedPaymasterGas, type FluentGasPayment, FluentGasPaymentError, type FluentGasPaymentErrorCode, type FluentGasPaymentEthRates, type FluentGasTokenSymbol, type FluentIframeElement, type FluentLinkXResult, type FluentLinkXStatus, type FluentPrivyAdapter, FluentReviewRejectedError, type FluentReviewRejectedErrorCode, type FluentSignApi, type FluentSigningMode, FluentSponsorshipFallbackError, type FluentSponsorshipReason, type FluentTokenDefinition, type FluentUserOperationGas, FluentUserOperationGasError, type FluentUserOperationGasErrorCode, type FluentWalletChoice, FluentWidget, type FluentWidgetAccount, type FluentWidgetAssets, type FluentWidgetAuthMethod, type FluentWidgetConfig, FluentWidgetConfigError, type FluentWidgetConfigErrorCode, type FluentWidgetConnectButtonRenderContext, type FluentWidgetExecution, type FluentWidgetExecutionSource, type FluentWidgetExecutionStatus, type FluentWidgetGasPayment, type FluentWidgetNetwork, type FluentWidgetProps, type FluentWidgetRenderContext, type FluentWidgetSession, type FluentWidgetStatus, type FluentXAccount, type UseFluentIframeBridgeOptions, fluentMainnet, fluentTestnet, getFluentChainByChainId, getFluentChainForNetwork, useFluentIframeBridge, useFluentWidget, useLinkX };
932
+ export { AccountAvatar, type AccountAvatarProps, FluentAccountType, FluentAuthError, type FluentAuthErrorCode, FluentBatchApi, type FluentChainDefinition, type FluentExternalWalletState, FluentGasPaymentError, type FluentGasPaymentErrorCode, FluentGasPaymentEthRates, FluentGasTokenSymbol, type FluentIframeElement, type FluentLinkXResult, type FluentLinkXStatus, type FluentPrivyAdapter, FluentReviewRejectedError, type FluentReviewRejectedErrorCode, FluentSponsorshipFallbackError, type FluentSponsorshipReason, type FluentTokenDefinition, type FluentWalletChoice, FluentWidget, type FluentWidgetAssets, type FluentWidgetAuthMethod, type FluentWidgetConfig, FluentWidgetConfigError, type FluentWidgetConfigErrorCode, type FluentWidgetConnectButtonRenderContext, type FluentWidgetExecution, type FluentWidgetExecutionSource, FluentWidgetNetwork, type FluentWidgetProps, type FluentWidgetRenderContext, type FluentWidgetSession, type FluentWidgetStatus, type FluentXAccount, type UseFluentIframeBridgeOptions, fluentMainnet, fluentTestnet, getFluentChainByChainId, useFluentIframeBridge, useFluentWidget, useLinkX };