@zama-fhe/react-sdk 1.0.0-alpha.10

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.
@@ -0,0 +1,2024 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _zama_fhe_sdk from '@zama-fhe/sdk';
3
+ import { RelayerSDK, GenericSigner, GenericStorage, ZamaSDKEventListener, ZamaSDK, EncryptParams, EncryptResult, DecryptedValue, UserDecryptParams, PublicDecryptResult, FHEKeypair, EIP712TypedData, Address, DelegatedUserDecryptParams, ZKProofLike, Hex, TransferCallbacks, Token, TransactionResult, ShieldCallbacks, UnshieldCallbacks, ReadonlyToken, RawLog, ActivityLogMetadata, ActivityItem } from '@zama-fhe/sdk';
4
+ export { ActivityAmount, ActivityDirection, ActivityItem, ActivityLogMetadata, ActivityType, Address, ApprovalFailedError, ApproveSubmittedEvent, ApproveUnderlyingSubmittedEvent, BATCH_SWAP_ABI, BaseEvent, BatchDecryptOptions, BatchTransferData, ChromeSessionStorage, ConfidentialTransferEvent, ContractCallConfig, CredentialExpiredError, CredentialsAllowedEvent, CredentialsCachedEvent, CredentialsCreatedEvent, CredentialsCreatingEvent, CredentialsExpiredEvent, CredentialsLoadingEvent, CredentialsManager, CredentialsManagerConfig, CredentialsRevokedEvent, DEPLOYMENT_COORDINATOR_ABI, DecryptEndEvent, DecryptErrorEvent, DecryptStartEvent, DecryptedValue, DecryptionFailedError, DelegatedUserDecryptParams, EIP712TypedData, ENCRYPTION_ABI, ERC165_ABI, ERC20_ABI, ERC20_METADATA_ABI, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, EncryptEndEvent, EncryptErrorEvent, EncryptInput, EncryptParams, EncryptResult, EncryptStartEvent, EncryptionFailedError, FEE_MANAGER_ABI, FHEKeypair, FheType, FhevmInstanceConfig, FinalizeUnwrapSubmittedEvent, GenericSigner, GenericStorage, HardhatConfig, Hex, IndexedDBStorage, InputProofBytesType, InvalidCredentialsError, KmsDelegatedUserDecryptEIP712Type, MainnetConfig, MemoryStorage, NetworkType, NoCiphertextError, OnChainEvent, PublicDecryptResult, RawLog, ReadonlyToken, ReadonlyTokenConfig, RelayerRequestFailedError, RelayerSDK, RelayerSDKStatus, RelayerWeb, RelayerWebConfig, RelayerWebSecurityConfig, SepoliaConfig, ShieldCallbacks, ShieldSubmittedEvent, SigningFailedError, SigningRejectedError, StoredCredentials, TOKEN_TOPICS, TRANSFER_BATCHER_ABI, Token, TokenConfig, Topics, TransactionErrorEvent, TransactionReceipt, TransactionResult, TransactionRevertedError, TransferCallbacks, TransferFromSubmittedEvent, TransferSubmittedEvent, UnshieldCallbacks, UnshieldPhase1SubmittedEvent, UnshieldPhase2StartedEvent, UnshieldPhase2SubmittedEvent, UnwrapRequestedEvent, UnwrapSubmittedEvent, UnwrappedFinalizedEvent, UnwrappedStartedEvent, UserDecryptParams, WRAPPER_ABI, WrappedEvent, ZERO_HANDLE, ZKProofLike, ZamaError, ZamaErrorCode, ZamaSDK, ZamaSDKConfig, ZamaSDKEvent, ZamaSDKEventInput, ZamaSDKEventListener, ZamaSDKEventType, ZamaSDKEvents, allowanceContract, applyDecryptedValues, approveContract, balanceOfContract, chromeSessionStorage, clearPendingUnshield, confidentialBalanceOfContract, confidentialBatchTransferContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, decimalsContract, decodeConfidentialTransfer, decodeOnChainEvent, decodeOnChainEvents, decodeUnwrapRequested, decodeUnwrappedFinalized, decodeUnwrappedStarted, decodeWrapped, deploymentCoordinatorContract, extractEncryptedHandles, finalizeUnwrapContract, findUnwrapRequested, findWrapped, getBatchTransferFeeContract, getFeeRecipientContract, getUnwrapFeeContract, getWrapFeeContract, getWrapperContract, indexedDBStorage, isConfidentialTokenContract, isConfidentialWrapperContract, isFinalizeUnwrapOperatorContract, isOperatorContract, loadPendingUnshield, matchZamaError, nameContract, parseActivityFeed, rateContract, savePendingUnshield, setFinalizeUnwrapOperatorContract, setOperatorContract, sortByBlockNumber, supportsInterfaceContract, symbolContract, totalSupplyContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract, wrapETHContract, wrapperExistsContract } from '@zama-fhe/sdk';
5
+ import { PropsWithChildren } from 'react';
6
+ import * as _tanstack_react_query from '@tanstack/react-query';
7
+ import { UseQueryOptions, UseMutationOptions, UseQueryResult, UseSuspenseQueryResult } from '@tanstack/react-query';
8
+ import * as _zama_fhe_relayer_sdk_web from '@zama-fhe/relayer-sdk/web';
9
+
10
+ /** Props for {@link ZamaProvider}. */
11
+ interface ZamaProviderProps extends PropsWithChildren {
12
+ /** FHE relayer backend (RelayerWeb for browser, RelayerNode for server). */
13
+ relayer: RelayerSDK;
14
+ /**
15
+ * Wallet signer (ViemSigner, EthersSigner, or custom GenericSigner).
16
+ * When `undefined`, the SDK operates in read-only mode — hooks that require
17
+ * a signer (mutations, balance queries) will be disabled until a signer is provided.
18
+ */
19
+ signer?: GenericSigner;
20
+ /** Credential storage backend (IndexedDBStorage for browser, MemoryStorage for tests). */
21
+ storage: GenericStorage;
22
+ /**
23
+ * Session storage for wallet signatures. Defaults to in-memory (lost on reload).
24
+ * Pass a `chrome.storage.session`-backed store for web extensions.
25
+ */
26
+ sessionStorage?: GenericStorage;
27
+ /** Number of days credentials remain valid (default: relayer default). */
28
+ credentialDurationDays?: number;
29
+ /** Callback invoked on SDK lifecycle events. */
30
+ onEvent?: ZamaSDKEventListener;
31
+ }
32
+ /**
33
+ * Provides a {@link ZamaSDK} instance to all descendant hooks.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * <ZamaProvider relayer={relayer} signer={signer} storage={storage}>
38
+ * <App />
39
+ * </ZamaProvider>
40
+ * ```
41
+ */
42
+ declare function ZamaProvider({ children, relayer, signer, storage, sessionStorage, credentialDurationDays, onEvent, }: ZamaProviderProps): react_jsx_runtime.JSX.Element;
43
+ /**
44
+ * Access the {@link ZamaSDK} instance from context.
45
+ * Throws if called outside a {@link ZamaProvider} or when no signer is provided.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * const sdk = useZamaSDK();
50
+ * const token = sdk.createReadonlyToken("0x...");
51
+ * ```
52
+ */
53
+ declare function useZamaSDK(): ZamaSDK;
54
+ /**
55
+ * Access the {@link ZamaSDK} instance, returning `null` when no signer is connected.
56
+ * Use this in components that should render in read-only mode before wallet connection.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * const sdk = useReadonlyZamaSDK();
61
+ * if (!sdk) return <ConnectWalletPrompt />;
62
+ * ```
63
+ */
64
+ declare function useReadonlyZamaSDK(): ZamaSDK | null;
65
+
66
+ /**
67
+ * TanStack Query mutation options factory for FHE encrypt.
68
+ *
69
+ * @param sdk - A `ZamaSDK` instance.
70
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
71
+ */
72
+ declare function encryptMutationOptions(sdk: ZamaSDK): {
73
+ mutationKey: readonly ["encrypt"];
74
+ mutationFn: (params: EncryptParams) => Promise<EncryptResult>;
75
+ };
76
+ /**
77
+ * Encrypt a plaintext value using FHE.
78
+ * Calls the relayer's `encrypt` method via a mutation.
79
+ *
80
+ * @returns A mutation whose `mutate` accepts {@link EncryptParams}.
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * const encrypt = useEncrypt();
85
+ * encrypt.mutate({ values: [1000n], bits: [64] });
86
+ * ```
87
+ */
88
+ declare function useEncrypt(): _tanstack_react_query.UseMutationResult<EncryptResult, Error, EncryptParams, unknown>;
89
+
90
+ /**
91
+ * Thin wrapper around sdk.userDecrypt().
92
+ * Caller is responsible for providing all params (keypair, signature, etc.).
93
+ * For the full orchestration (signature management, EIP712 signing),
94
+ * see the app-level useUserDecryptFlow hook.
95
+ *
96
+ * On success, populates the decryption cache so useUserDecryptedValue/useUserDecryptedValues
97
+ * can read the results.
98
+ */
99
+ declare function useUserDecrypt(): _tanstack_react_query.UseMutationResult<Record<string, DecryptedValue>, Error, UserDecryptParams, unknown>;
100
+
101
+ /**
102
+ * Decrypt FHE ciphertext handles using the network public key (no credential needed).
103
+ * On success, populates the decryption cache so {@link useUserDecryptedValue} / {@link useUserDecryptedValues}
104
+ * can read the results.
105
+ *
106
+ * @returns A mutation whose `mutate` accepts an array of handle strings.
107
+ *
108
+ * @example
109
+ * ```tsx
110
+ * const publicDecrypt = usePublicDecrypt();
111
+ * publicDecrypt.mutate(["0xHandle1", "0xHandle2"]);
112
+ * // publicDecrypt.data?.clearValues => { "0xHandle1": 500n, ... }
113
+ * ```
114
+ */
115
+ declare function usePublicDecrypt(): _tanstack_react_query.UseMutationResult<PublicDecryptResult, Error, string[], unknown>;
116
+
117
+ /**
118
+ * Generate an FHE keypair via the relayer.
119
+ * Returns a public/private key pair for use in decrypt authorization.
120
+ *
121
+ * @returns A mutation whose `mutate` takes no parameters.
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * const generateKeypair = useGenerateKeypair();
126
+ * generateKeypair.mutate();
127
+ * // generateKeypair.data?.publicKey, generateKeypair.data?.privateKey
128
+ * ```
129
+ */
130
+ declare function useGenerateKeypair(): _tanstack_react_query.UseMutationResult<FHEKeypair, Error, void, unknown>;
131
+
132
+ /** Parameters for {@link useCreateEIP712}. */
133
+ interface CreateEIP712Params {
134
+ /** The FHE public key (hex-encoded). */
135
+ publicKey: string;
136
+ /** Contract addresses the credential authorizes decryption for. */
137
+ contractAddresses: `0x${string}`[];
138
+ /** Unix timestamp (seconds) when the credential becomes valid. */
139
+ startTimestamp: number;
140
+ /** Number of days the credential remains valid. Default: 1. */
141
+ durationDays?: number;
142
+ }
143
+ /**
144
+ * Create EIP-712 typed data for signing an FHE decrypt credential.
145
+ * The returned typed data is signed by the wallet to authorize decryption.
146
+ *
147
+ * @returns A mutation whose `mutate` accepts {@link CreateEIP712Params}.
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * const createEIP712 = useCreateEIP712();
152
+ * createEIP712.mutate({
153
+ * publicKey: keypair.publicKey,
154
+ * contractAddresses: ["0xToken"],
155
+ * startTimestamp: Math.floor(Date.now() / 1000),
156
+ * });
157
+ * ```
158
+ */
159
+ declare function useCreateEIP712(): _tanstack_react_query.UseMutationResult<EIP712TypedData, Error, CreateEIP712Params, unknown>;
160
+
161
+ /** Parameters for {@link useCreateDelegatedUserDecryptEIP712}. */
162
+ interface CreateDelegatedUserDecryptEIP712Params {
163
+ /** The FHE public key (hex-encoded). */
164
+ publicKey: string;
165
+ /** Contract addresses the credential authorizes decryption for. */
166
+ contractAddresses: Address[];
167
+ /** Address of the wallet that delegated decrypt authority. */
168
+ delegatorAddress: string;
169
+ /** Unix timestamp (seconds) when the credential becomes valid. */
170
+ startTimestamp: number;
171
+ /** Number of days the credential remains valid. Default: 1. */
172
+ durationDays?: number;
173
+ }
174
+ /**
175
+ * Create EIP-712 typed data for a delegated user decrypt credential.
176
+ * Used when one wallet authorizes another to decrypt on its behalf.
177
+ *
178
+ * @returns A mutation whose `mutate` accepts {@link CreateDelegatedUserDecryptEIP712Params}.
179
+ *
180
+ * @example
181
+ * ```tsx
182
+ * const createEIP712 = useCreateDelegatedUserDecryptEIP712();
183
+ * createEIP712.mutate({
184
+ * publicKey: keypair.publicKey,
185
+ * contractAddresses: ["0xToken"],
186
+ * delegatorAddress: "0xDelegator",
187
+ * startTimestamp: Math.floor(Date.now() / 1000),
188
+ * });
189
+ * ```
190
+ */
191
+ declare function useCreateDelegatedUserDecryptEIP712(): _tanstack_react_query.UseMutationResult<Readonly<{
192
+ types: _zama_fhe_relayer_sdk_web.KmsDelegatedUserDecryptEIP712TypesType;
193
+ primaryType: "DelegatedUserDecryptRequestVerification";
194
+ domain: _zama_fhe_relayer_sdk_web.KmsEIP712DomainType;
195
+ message: _zama_fhe_relayer_sdk_web.KmsDelegatedUserDecryptEIP712MessageType;
196
+ }>, Error, CreateDelegatedUserDecryptEIP712Params, unknown>;
197
+
198
+ /**
199
+ * Decrypt FHE ciphertext handles using delegated user credentials.
200
+ * Returns a map of handle → plaintext bigint.
201
+ *
202
+ * @returns A mutation whose `mutate` accepts {@link DelegatedUserDecryptParams}.
203
+ *
204
+ * @example
205
+ * ```tsx
206
+ * const decrypt = useDelegatedUserDecrypt();
207
+ * decrypt.mutate({ handles: ["0xHandle1"], ...credentials });
208
+ * // decrypt.data => { "0xHandle1": 1000n }
209
+ * ```
210
+ */
211
+ declare function useDelegatedUserDecrypt(): _tanstack_react_query.UseMutationResult<Record<string, DecryptedValue>, Error, DelegatedUserDecryptParams, unknown>;
212
+
213
+ /**
214
+ * Submit a ZK proof for on-chain verification.
215
+ * Returns the input proof bytes for use in contract calls.
216
+ *
217
+ * @returns A mutation whose `mutate` accepts a {@link ZKProofLike}.
218
+ *
219
+ * @example
220
+ * ```tsx
221
+ * const verify = useRequestZKProofVerification();
222
+ * verify.mutate(zkProof);
223
+ * // verify.data => Uint8Array (input proof bytes)
224
+ * ```
225
+ */
226
+ declare function useRequestZKProofVerification(): _tanstack_react_query.UseMutationResult<Readonly<{
227
+ handles: Uint8Array[];
228
+ inputProof: Uint8Array;
229
+ }>, Error, ZKProofLike, unknown>;
230
+
231
+ /**
232
+ * Query key factory for the FHE public key query.
233
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
234
+ */
235
+ declare const publicKeyQueryKeys: {
236
+ /** Match the public key query. */
237
+ readonly all: readonly ["publicKey"];
238
+ };
239
+ /** Shape of the FHE public key data returned by the relayer. */
240
+ interface PublicKeyData {
241
+ /** Unique identifier for this public key version. */
242
+ publicKeyId: string;
243
+ /** The raw FHE public key bytes. */
244
+ publicKey: Uint8Array;
245
+ }
246
+ type PublicKeyResult = PublicKeyData | null;
247
+ /**
248
+ * TanStack Query options factory for the FHE public key.
249
+ *
250
+ * @param sdk - A `ZamaSDK` instance.
251
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
252
+ */
253
+ declare function publicKeyQueryOptions(sdk: ZamaSDK): {
254
+ readonly queryKey: readonly ["publicKey"];
255
+ readonly queryFn: () => Promise<PublicKeyResult>;
256
+ readonly staleTime: number;
257
+ };
258
+ /**
259
+ * Fetch the FHE network public key from the relayer.
260
+ * Cached indefinitely since the key does not change during a session.
261
+ *
262
+ * @returns Query result with `data: PublicKeyData | null`.
263
+ *
264
+ * @example
265
+ * ```tsx
266
+ * const { data: publicKey } = usePublicKey();
267
+ * // publicKey?.publicKeyId, publicKey?.publicKey
268
+ * ```
269
+ */
270
+ declare function usePublicKey(): _tanstack_react_query.UseQueryResult<PublicKeyResult, Error>;
271
+
272
+ /**
273
+ * Query key factory for FHE public params queries.
274
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
275
+ */
276
+ declare const publicParamsQueryKeys: {
277
+ /** Match all public params queries. */
278
+ readonly all: readonly ["publicParams"];
279
+ /** Match public params query for a specific bit size. */
280
+ readonly bits: (bits: number) => readonly ["publicParams", number];
281
+ };
282
+ /** Shape of the FHE public parameters returned by the relayer. */
283
+ interface PublicParamsData {
284
+ /** The raw public parameters bytes (WASM-ready). */
285
+ publicParams: Uint8Array;
286
+ /** Unique identifier for this public params version. */
287
+ publicParamsId: string;
288
+ }
289
+ type PublicParamsResult = PublicParamsData | null;
290
+ /**
291
+ * TanStack Query options factory for FHE public parameters.
292
+ *
293
+ * @param sdk - A `ZamaSDK` instance.
294
+ * @param bits - The FHE bit size to fetch parameters for (e.g. 2048).
295
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
296
+ */
297
+ declare function publicParamsQueryOptions(sdk: ZamaSDK, bits: number): {
298
+ readonly queryKey: readonly ["publicParams", number];
299
+ readonly queryFn: () => Promise<PublicParamsResult>;
300
+ readonly staleTime: number;
301
+ };
302
+ /**
303
+ * Fetch FHE public parameters for a given bit size from the relayer.
304
+ * Cached indefinitely since parameters do not change during a session.
305
+ *
306
+ * @param bits - The FHE bit size to fetch parameters for (e.g. 2048).
307
+ * @returns Query result with `data: PublicParamsData | null`.
308
+ *
309
+ * @example
310
+ * ```tsx
311
+ * const { data: params } = usePublicParams(2048);
312
+ * // params?.publicParams, params?.publicParamsId
313
+ * ```
314
+ */
315
+ declare function usePublicParams(bits: number): _tanstack_react_query.UseQueryResult<PublicParamsResult, Error>;
316
+
317
+ /** A handle to decrypt, paired with its originating contract address. */
318
+ interface DecryptHandle {
319
+ handle: string;
320
+ contractAddress: Address;
321
+ }
322
+ /** Parameters for {@link useUserDecryptFlow}. */
323
+ interface UserDecryptFlowParams {
324
+ /** Encrypted handles to decrypt. */
325
+ handles: DecryptHandle[];
326
+ /** Number of days the credential remains valid. Default: 1. */
327
+ durationDays?: number;
328
+ }
329
+ /** Progress callbacks for each step of the decrypt flow. */
330
+ interface UserDecryptFlowCallbacks {
331
+ /** Fired after the keypair is generated. */
332
+ onKeypairGenerated?: () => void;
333
+ /** Fired after the EIP-712 typed data is created, before wallet signing. */
334
+ onEIP712Created?: () => void;
335
+ /** Fired after the wallet signature is obtained. */
336
+ onSigned?: (signature: Hex) => void;
337
+ /** Fired after decryption completes. */
338
+ onDecrypted?: (values: Record<string, DecryptedValue>) => void;
339
+ }
340
+ /** Configuration for {@link useUserDecryptFlow}. */
341
+ interface UseUserDecryptFlowConfig {
342
+ /** Optional progress callbacks. */
343
+ callbacks?: UserDecryptFlowCallbacks;
344
+ }
345
+ /**
346
+ * High-level orchestration hook for user decryption.
347
+ * Handles the full flow: keypair generation → EIP-712 creation → wallet signature → decryption.
348
+ *
349
+ * On success, populates the decryption cache so `useUserDecryptedValue` / `useUserDecryptedValues`
350
+ * can read the results.
351
+ *
352
+ * @param config - Optional callbacks for step-by-step UX feedback.
353
+ * @returns A mutation whose `mutate` accepts {@link UserDecryptFlowParams}.
354
+ *
355
+ * @example
356
+ * ```tsx
357
+ * const decryptFlow = useUserDecryptFlow({
358
+ * callbacks: { onSigned: () => setStep("decrypting") },
359
+ * });
360
+ * decryptFlow.mutate({
361
+ * handles: [{ handle: "0xHandle", contractAddress: "0xContract" }],
362
+ * durationDays: 7,
363
+ * });
364
+ * ```
365
+ */
366
+ declare function useUserDecryptFlow(config?: UseUserDecryptFlowConfig): _tanstack_react_query.UseMutationResult<Record<string, DecryptedValue>, Error, UserDecryptFlowParams, unknown>;
367
+
368
+ /**
369
+ * Look up a single cached decrypted value by its handle.
370
+ * Values are populated automatically when useUserDecrypt or usePublicDecrypt succeed.
371
+ * You can also populate manually via queryClient.setQueryData(decryptionKeys.value(handle), value).
372
+ */
373
+ declare function useUserDecryptedValue(handle: string | undefined): _tanstack_react_query.UseQueryResult<DecryptedValue, Error>;
374
+
375
+ /**
376
+ * Look up multiple cached decrypted values by their handles.
377
+ * Values are populated automatically when useUserDecrypt or usePublicDecrypt succeed.
378
+ */
379
+ declare function useUserDecryptedValues(handles: string[]): {
380
+ data: Record<string, DecryptedValue | undefined>;
381
+ results: _tanstack_react_query.UseQueryResult<never, Error>[];
382
+ };
383
+
384
+ /**
385
+ * Query key helpers for the shared decryption cache.
386
+ * Used by useUserDecrypt/usePublicDecrypt to populate,
387
+ * and by useUserDecryptedValue to read.
388
+ */
389
+ declare const decryptionKeys: {
390
+ value: (handle: string) => readonly ["decryptedValue", string];
391
+ };
392
+
393
+ /** Base configuration shared by all mutation hooks that need a Token instance. */
394
+ interface UseZamaConfig {
395
+ /** Address of the confidential token contract. */
396
+ tokenAddress: Address;
397
+ /** Address of the wrapper contract (required for shield/unshield operations). */
398
+ wrapperAddress?: Address;
399
+ }
400
+ /**
401
+ * Get a {@link Token} instance, memoized by address pair.
402
+ * Reads signer and storage from the nearest {@link ZamaProvider}.
403
+ *
404
+ * @param config - Token and optional wrapper addresses.
405
+ * @returns A memoized `Token` instance.
406
+ *
407
+ * @example
408
+ * ```tsx
409
+ * const token = useToken({ tokenAddress: "0xToken", wrapperAddress: "0xWrapper" });
410
+ * ```
411
+ */
412
+ declare function useToken(config: UseZamaConfig): _zama_fhe_sdk.Token;
413
+
414
+ /**
415
+ * Get a {@link ReadonlyToken} instance, memoized by address.
416
+ * Supports balance queries, ERC-165 checks, and authorization — no wrapper needed.
417
+ * Reads signer and storage from the nearest {@link ZamaProvider}.
418
+ *
419
+ * @param address - Address of the confidential token contract.
420
+ * @returns A memoized `ReadonlyToken` instance.
421
+ *
422
+ * @example
423
+ * ```tsx
424
+ * const token = useReadonlyToken("0xToken");
425
+ * // token.balanceOf(), token.isConfidential(), etc.
426
+ * ```
427
+ */
428
+ declare function useReadonlyToken(address: Address): _zama_fhe_sdk.ReadonlyToken;
429
+
430
+ /** Configuration for {@link useConfidentialBalance}. */
431
+ interface UseConfidentialBalanceConfig {
432
+ /** Address of the confidential token contract. */
433
+ tokenAddress: Address;
434
+ /** Polling interval (ms) for the encrypted handle. Default: 10 000. */
435
+ handleRefetchInterval?: number;
436
+ }
437
+ /** Query options for the decrypt phase of {@link useConfidentialBalance}. */
438
+ type UseConfidentialBalanceOptions = Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">;
439
+ /**
440
+ * Declarative hook to read the connected wallet's confidential token balance.
441
+ * Uses two-phase polling: cheaply polls the encrypted handle, then only
442
+ * decrypts when the handle changes (new balance).
443
+ *
444
+ * @param config - Token address and optional polling interval.
445
+ * @param options - React Query options forwarded to the decrypt query.
446
+ * @returns The decrypt query result plus `handleQuery` for Phase 1 state.
447
+ *
448
+ * @example
449
+ * ```tsx
450
+ * const { data: balance, isLoading, handleQuery } = useConfidentialBalance({
451
+ * tokenAddress: "0x...",
452
+ * });
453
+ * ```
454
+ */
455
+ declare function useConfidentialBalance(config: UseConfidentialBalanceConfig, options?: UseConfidentialBalanceOptions): {
456
+ handleQuery: _tanstack_react_query.UseQueryResult<`0x${string}`, Error>;
457
+ data: bigint;
458
+ error: Error;
459
+ isError: true;
460
+ isPending: false;
461
+ isLoading: false;
462
+ isLoadingError: false;
463
+ isRefetchError: true;
464
+ isSuccess: false;
465
+ isPlaceholderData: false;
466
+ status: "error";
467
+ dataUpdatedAt: number;
468
+ errorUpdatedAt: number;
469
+ failureCount: number;
470
+ failureReason: Error | null;
471
+ errorUpdateCount: number;
472
+ isFetched: boolean;
473
+ isFetchedAfterMount: boolean;
474
+ isFetching: boolean;
475
+ isInitialLoading: boolean;
476
+ isPaused: boolean;
477
+ isRefetching: boolean;
478
+ isStale: boolean;
479
+ isEnabled: boolean;
480
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, Error>>;
481
+ fetchStatus: _tanstack_react_query.FetchStatus;
482
+ promise: Promise<bigint>;
483
+ } | {
484
+ handleQuery: _tanstack_react_query.UseQueryResult<`0x${string}`, Error>;
485
+ data: bigint;
486
+ error: null;
487
+ isError: false;
488
+ isPending: false;
489
+ isLoading: false;
490
+ isLoadingError: false;
491
+ isRefetchError: false;
492
+ isSuccess: true;
493
+ isPlaceholderData: false;
494
+ status: "success";
495
+ dataUpdatedAt: number;
496
+ errorUpdatedAt: number;
497
+ failureCount: number;
498
+ failureReason: Error | null;
499
+ errorUpdateCount: number;
500
+ isFetched: boolean;
501
+ isFetchedAfterMount: boolean;
502
+ isFetching: boolean;
503
+ isInitialLoading: boolean;
504
+ isPaused: boolean;
505
+ isRefetching: boolean;
506
+ isStale: boolean;
507
+ isEnabled: boolean;
508
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, Error>>;
509
+ fetchStatus: _tanstack_react_query.FetchStatus;
510
+ promise: Promise<bigint>;
511
+ } | {
512
+ handleQuery: _tanstack_react_query.UseQueryResult<`0x${string}`, Error>;
513
+ data: undefined;
514
+ error: Error;
515
+ isError: true;
516
+ isPending: false;
517
+ isLoading: false;
518
+ isLoadingError: true;
519
+ isRefetchError: false;
520
+ isSuccess: false;
521
+ isPlaceholderData: false;
522
+ status: "error";
523
+ dataUpdatedAt: number;
524
+ errorUpdatedAt: number;
525
+ failureCount: number;
526
+ failureReason: Error | null;
527
+ errorUpdateCount: number;
528
+ isFetched: boolean;
529
+ isFetchedAfterMount: boolean;
530
+ isFetching: boolean;
531
+ isInitialLoading: boolean;
532
+ isPaused: boolean;
533
+ isRefetching: boolean;
534
+ isStale: boolean;
535
+ isEnabled: boolean;
536
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, Error>>;
537
+ fetchStatus: _tanstack_react_query.FetchStatus;
538
+ promise: Promise<bigint>;
539
+ } | {
540
+ handleQuery: _tanstack_react_query.UseQueryResult<`0x${string}`, Error>;
541
+ data: undefined;
542
+ error: null;
543
+ isError: false;
544
+ isPending: true;
545
+ isLoading: true;
546
+ isLoadingError: false;
547
+ isRefetchError: false;
548
+ isSuccess: false;
549
+ isPlaceholderData: false;
550
+ status: "pending";
551
+ dataUpdatedAt: number;
552
+ errorUpdatedAt: number;
553
+ failureCount: number;
554
+ failureReason: Error | null;
555
+ errorUpdateCount: number;
556
+ isFetched: boolean;
557
+ isFetchedAfterMount: boolean;
558
+ isFetching: boolean;
559
+ isInitialLoading: boolean;
560
+ isPaused: boolean;
561
+ isRefetching: boolean;
562
+ isStale: boolean;
563
+ isEnabled: boolean;
564
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, Error>>;
565
+ fetchStatus: _tanstack_react_query.FetchStatus;
566
+ promise: Promise<bigint>;
567
+ } | {
568
+ handleQuery: _tanstack_react_query.UseQueryResult<`0x${string}`, Error>;
569
+ data: undefined;
570
+ error: null;
571
+ isError: false;
572
+ isPending: true;
573
+ isLoadingError: false;
574
+ isRefetchError: false;
575
+ isSuccess: false;
576
+ isPlaceholderData: false;
577
+ status: "pending";
578
+ dataUpdatedAt: number;
579
+ errorUpdatedAt: number;
580
+ failureCount: number;
581
+ failureReason: Error | null;
582
+ errorUpdateCount: number;
583
+ isFetched: boolean;
584
+ isFetchedAfterMount: boolean;
585
+ isFetching: boolean;
586
+ isLoading: boolean;
587
+ isInitialLoading: boolean;
588
+ isPaused: boolean;
589
+ isRefetching: boolean;
590
+ isStale: boolean;
591
+ isEnabled: boolean;
592
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, Error>>;
593
+ fetchStatus: _tanstack_react_query.FetchStatus;
594
+ promise: Promise<bigint>;
595
+ } | {
596
+ handleQuery: _tanstack_react_query.UseQueryResult<`0x${string}`, Error>;
597
+ data: bigint;
598
+ isError: false;
599
+ error: null;
600
+ isPending: false;
601
+ isLoading: false;
602
+ isLoadingError: false;
603
+ isRefetchError: false;
604
+ isSuccess: true;
605
+ isPlaceholderData: true;
606
+ status: "success";
607
+ dataUpdatedAt: number;
608
+ errorUpdatedAt: number;
609
+ failureCount: number;
610
+ failureReason: Error | null;
611
+ errorUpdateCount: number;
612
+ isFetched: boolean;
613
+ isFetchedAfterMount: boolean;
614
+ isFetching: boolean;
615
+ isInitialLoading: boolean;
616
+ isPaused: boolean;
617
+ isRefetching: boolean;
618
+ isStale: boolean;
619
+ isEnabled: boolean;
620
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<bigint, Error>>;
621
+ fetchStatus: _tanstack_react_query.FetchStatus;
622
+ promise: Promise<bigint>;
623
+ };
624
+
625
+ /** Configuration for {@link useConfidentialBalances}. */
626
+ interface UseConfidentialBalancesConfig {
627
+ /** Addresses of the confidential token contracts to batch-query. */
628
+ tokenAddresses: Address[];
629
+ /** Polling interval (ms) for the encrypted handles. Default: 10 000. */
630
+ handleRefetchInterval?: number;
631
+ /** Maximum number of concurrent decrypt calls. Default: `Infinity` (no limit). */
632
+ maxConcurrency?: number;
633
+ }
634
+ /** Result type for the decrypt phase of {@link useConfidentialBalances}. */
635
+ interface ConfidentialBalancesData {
636
+ /** Successfully decrypted balances (address → balance). */
637
+ balances: Map<Address, bigint>;
638
+ /** Per-token errors for tokens that failed to decrypt. */
639
+ errors: Map<Address, Error>;
640
+ /** `true` if some but not all tokens failed. */
641
+ isPartialError: boolean;
642
+ }
643
+ /** Query options for the decrypt phase of {@link useConfidentialBalances}. */
644
+ type UseConfidentialBalancesOptions = Omit<UseQueryOptions<ConfidentialBalancesData, Error>, "queryKey" | "queryFn">;
645
+ /**
646
+ * Declarative hook to read multiple confidential token balances in batch.
647
+ * Uses two-phase polling: cheaply polls encrypted handles, then only
648
+ * decrypts when any handle changes.
649
+ *
650
+ * Returns partial results when some tokens fail — successful balances are
651
+ * always returned alongside per-token error information.
652
+ *
653
+ * @param config - Token addresses and optional polling interval.
654
+ * @param options - React Query options forwarded to the decrypt query.
655
+ * @returns The decrypt query result plus `handlesQuery` for Phase 1 state.
656
+ *
657
+ * @example
658
+ * ```tsx
659
+ * const { data } = useConfidentialBalances({
660
+ * tokenAddresses: ["0xTokenA", "0xTokenB"],
661
+ * });
662
+ * const balance = data?.balances.get("0xTokenA");
663
+ * if (data?.isPartialError) {
664
+ * // some tokens failed — check data.errors
665
+ * }
666
+ * ```
667
+ */
668
+ declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions): {
669
+ handlesQuery: _tanstack_react_query.UseQueryResult<`0x${string}`[], Error>;
670
+ data: ConfidentialBalancesData;
671
+ error: Error;
672
+ isError: true;
673
+ isPending: false;
674
+ isLoading: false;
675
+ isLoadingError: false;
676
+ isRefetchError: true;
677
+ isSuccess: false;
678
+ isPlaceholderData: false;
679
+ status: "error";
680
+ dataUpdatedAt: number;
681
+ errorUpdatedAt: number;
682
+ failureCount: number;
683
+ failureReason: Error | null;
684
+ errorUpdateCount: number;
685
+ isFetched: boolean;
686
+ isFetchedAfterMount: boolean;
687
+ isFetching: boolean;
688
+ isInitialLoading: boolean;
689
+ isPaused: boolean;
690
+ isRefetching: boolean;
691
+ isStale: boolean;
692
+ isEnabled: boolean;
693
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ConfidentialBalancesData, Error>>;
694
+ fetchStatus: _tanstack_react_query.FetchStatus;
695
+ promise: Promise<ConfidentialBalancesData>;
696
+ } | {
697
+ handlesQuery: _tanstack_react_query.UseQueryResult<`0x${string}`[], Error>;
698
+ data: ConfidentialBalancesData;
699
+ error: null;
700
+ isError: false;
701
+ isPending: false;
702
+ isLoading: false;
703
+ isLoadingError: false;
704
+ isRefetchError: false;
705
+ isSuccess: true;
706
+ isPlaceholderData: false;
707
+ status: "success";
708
+ dataUpdatedAt: number;
709
+ errorUpdatedAt: number;
710
+ failureCount: number;
711
+ failureReason: Error | null;
712
+ errorUpdateCount: number;
713
+ isFetched: boolean;
714
+ isFetchedAfterMount: boolean;
715
+ isFetching: boolean;
716
+ isInitialLoading: boolean;
717
+ isPaused: boolean;
718
+ isRefetching: boolean;
719
+ isStale: boolean;
720
+ isEnabled: boolean;
721
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ConfidentialBalancesData, Error>>;
722
+ fetchStatus: _tanstack_react_query.FetchStatus;
723
+ promise: Promise<ConfidentialBalancesData>;
724
+ } | {
725
+ handlesQuery: _tanstack_react_query.UseQueryResult<`0x${string}`[], Error>;
726
+ data: undefined;
727
+ error: Error;
728
+ isError: true;
729
+ isPending: false;
730
+ isLoading: false;
731
+ isLoadingError: true;
732
+ isRefetchError: false;
733
+ isSuccess: false;
734
+ isPlaceholderData: false;
735
+ status: "error";
736
+ dataUpdatedAt: number;
737
+ errorUpdatedAt: number;
738
+ failureCount: number;
739
+ failureReason: Error | null;
740
+ errorUpdateCount: number;
741
+ isFetched: boolean;
742
+ isFetchedAfterMount: boolean;
743
+ isFetching: boolean;
744
+ isInitialLoading: boolean;
745
+ isPaused: boolean;
746
+ isRefetching: boolean;
747
+ isStale: boolean;
748
+ isEnabled: boolean;
749
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ConfidentialBalancesData, Error>>;
750
+ fetchStatus: _tanstack_react_query.FetchStatus;
751
+ promise: Promise<ConfidentialBalancesData>;
752
+ } | {
753
+ handlesQuery: _tanstack_react_query.UseQueryResult<`0x${string}`[], Error>;
754
+ data: undefined;
755
+ error: null;
756
+ isError: false;
757
+ isPending: true;
758
+ isLoading: true;
759
+ isLoadingError: false;
760
+ isRefetchError: false;
761
+ isSuccess: false;
762
+ isPlaceholderData: false;
763
+ status: "pending";
764
+ dataUpdatedAt: number;
765
+ errorUpdatedAt: number;
766
+ failureCount: number;
767
+ failureReason: Error | null;
768
+ errorUpdateCount: number;
769
+ isFetched: boolean;
770
+ isFetchedAfterMount: boolean;
771
+ isFetching: boolean;
772
+ isInitialLoading: boolean;
773
+ isPaused: boolean;
774
+ isRefetching: boolean;
775
+ isStale: boolean;
776
+ isEnabled: boolean;
777
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ConfidentialBalancesData, Error>>;
778
+ fetchStatus: _tanstack_react_query.FetchStatus;
779
+ promise: Promise<ConfidentialBalancesData>;
780
+ } | {
781
+ handlesQuery: _tanstack_react_query.UseQueryResult<`0x${string}`[], Error>;
782
+ data: undefined;
783
+ error: null;
784
+ isError: false;
785
+ isPending: true;
786
+ isLoadingError: false;
787
+ isRefetchError: false;
788
+ isSuccess: false;
789
+ isPlaceholderData: false;
790
+ status: "pending";
791
+ dataUpdatedAt: number;
792
+ errorUpdatedAt: number;
793
+ failureCount: number;
794
+ failureReason: Error | null;
795
+ errorUpdateCount: number;
796
+ isFetched: boolean;
797
+ isFetchedAfterMount: boolean;
798
+ isFetching: boolean;
799
+ isLoading: boolean;
800
+ isInitialLoading: boolean;
801
+ isPaused: boolean;
802
+ isRefetching: boolean;
803
+ isStale: boolean;
804
+ isEnabled: boolean;
805
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ConfidentialBalancesData, Error>>;
806
+ fetchStatus: _tanstack_react_query.FetchStatus;
807
+ promise: Promise<ConfidentialBalancesData>;
808
+ } | {
809
+ handlesQuery: _tanstack_react_query.UseQueryResult<`0x${string}`[], Error>;
810
+ data: ConfidentialBalancesData;
811
+ isError: false;
812
+ error: null;
813
+ isPending: false;
814
+ isLoading: false;
815
+ isLoadingError: false;
816
+ isRefetchError: false;
817
+ isSuccess: true;
818
+ isPlaceholderData: true;
819
+ status: "success";
820
+ dataUpdatedAt: number;
821
+ errorUpdatedAt: number;
822
+ failureCount: number;
823
+ failureReason: Error | null;
824
+ errorUpdateCount: number;
825
+ isFetched: boolean;
826
+ isFetchedAfterMount: boolean;
827
+ isFetching: boolean;
828
+ isInitialLoading: boolean;
829
+ isPaused: boolean;
830
+ isRefetching: boolean;
831
+ isStale: boolean;
832
+ isEnabled: boolean;
833
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ConfidentialBalancesData, Error>>;
834
+ fetchStatus: _tanstack_react_query.FetchStatus;
835
+ promise: Promise<ConfidentialBalancesData>;
836
+ };
837
+
838
+ /**
839
+ * TanStack Query mutation options factory for token allow.
840
+ *
841
+ * @param sdk - A `ZamaSDK` instance.
842
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
843
+ */
844
+ declare function allowMutationOptions(sdk: ZamaSDK): {
845
+ mutationKey: readonly ["allow"];
846
+ mutationFn: (tokenAddresses: Address[]) => Promise<void>;
847
+ };
848
+ /**
849
+ * Pre-authorize FHE decrypt credentials for a list of token addresses.
850
+ * A single wallet signature covers all addresses, so subsequent decrypt
851
+ * operations on any of these tokens reuse cached credentials.
852
+ *
853
+ * @example
854
+ * ```tsx
855
+ * const { mutateAsync: allow, isPending } = useAllow();
856
+ * // Call allow(allTokenAddresses) before any individual reveal
857
+ * ```
858
+ */
859
+ declare function useAllow(): _tanstack_react_query.UseMutationResult<void, Error, `0x${string}`[], unknown>;
860
+
861
+ declare const isAllowedQueryKeys: {
862
+ all: readonly ["zama", "isAllowed"];
863
+ };
864
+ declare function isAllowedQueryOptions(sdk: ZamaSDK): {
865
+ queryKey: readonly ["zama", "isAllowed"];
866
+ queryFn: () => Promise<boolean>;
867
+ };
868
+ /**
869
+ * Check whether a session signature is cached for the connected wallet.
870
+ * Returns `true` if decrypt operations can proceed without a wallet prompt.
871
+ *
872
+ * @example
873
+ * ```tsx
874
+ * const { data: allowed } = useIsAllowed();
875
+ * ```
876
+ */
877
+ declare function useIsAllowed(): _tanstack_react_query.UseQueryResult<boolean, Error>;
878
+
879
+ /**
880
+ * TanStack Query mutation options factory for token revoke.
881
+ *
882
+ * @param sdk - A `ZamaSDK` instance.
883
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
884
+ */
885
+ declare function revokeMutationOptions(sdk: ZamaSDK): {
886
+ mutationKey: readonly ["revoke"];
887
+ mutationFn: (tokenAddresses: Address[]) => Promise<void>;
888
+ };
889
+ /**
890
+ * Revoke the session signature for the connected wallet.
891
+ * Stored credentials remain intact, but the next decrypt operation
892
+ * will require a fresh wallet signature.
893
+ *
894
+ * The addresses are passed through to the `credentials:revoked` event
895
+ * for observability.
896
+ *
897
+ * @example
898
+ * ```tsx
899
+ * const { mutate: revoke } = useRevoke();
900
+ * revoke(["0xTokenA", "0xTokenB"]);
901
+ * ```
902
+ */
903
+ declare function useRevoke(): _tanstack_react_query.UseMutationResult<void, Error, `0x${string}`[], unknown>;
904
+
905
+ /**
906
+ * TanStack Query mutation options factory for session revoke.
907
+ *
908
+ * @param sdk - A `ZamaSDK` instance.
909
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
910
+ */
911
+ declare function revokeSessionMutationOptions(sdk: ZamaSDK): {
912
+ mutationKey: readonly ["revokeSession"];
913
+ mutationFn: () => Promise<void>;
914
+ };
915
+ /**
916
+ * Revoke the session signature for the connected wallet without
917
+ * specifying contract addresses. Useful for wallet disconnect handlers.
918
+ *
919
+ * @example
920
+ * ```tsx
921
+ * const { mutate: revokeSession } = useRevokeSession();
922
+ * revokeSession();
923
+ * ```
924
+ */
925
+ declare function useRevokeSession(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
926
+
927
+ /** Parameters passed to the `mutate` function of {@link useConfidentialTransfer}. */
928
+ interface ConfidentialTransferParams {
929
+ /** Recipient address. */
930
+ to: Address;
931
+ /** Amount to transfer (plaintext — encrypted automatically). */
932
+ amount: bigint;
933
+ /** Optional progress callbacks for the multi-step transfer flow. */
934
+ callbacks?: TransferCallbacks;
935
+ }
936
+ /** Configuration for {@link useConfidentialTransfer}. */
937
+ interface UseConfidentialTransferConfig extends UseZamaConfig {
938
+ /**
939
+ * When `true`, optimistically subtracts the transfer amount from cached balance
940
+ * before the transaction confirms. Rolls back on error.
941
+ * @defaultValue false
942
+ */
943
+ optimistic?: boolean;
944
+ }
945
+ /**
946
+ * TanStack Query mutation options factory for confidential transfer.
947
+ *
948
+ * @param token - A `Token` instance.
949
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
950
+ */
951
+ declare function confidentialTransferMutationOptions(token: Token): {
952
+ mutationKey: readonly ["confidentialTransfer", `0x${string}`];
953
+ mutationFn: ({ to, amount, callbacks }: ConfidentialTransferParams) => Promise<TransactionResult>;
954
+ };
955
+ /**
956
+ * Encrypt and send a confidential transfer. Invalidates balance caches on success.
957
+ *
958
+ * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
959
+ * - {@link SigningRejectedError} — user rejected the wallet prompt
960
+ * - {@link EncryptionFailedError} — FHE encryption failed
961
+ * - {@link TransactionRevertedError} — on-chain transaction reverted
962
+ *
963
+ * @param config - Token address (and optional wrapper) identifying the token.
964
+ * Set `optimistic: true` to subtract the amount from the cached balance immediately.
965
+ * @param options - React Query mutation options.
966
+ *
967
+ * @example
968
+ * ```tsx
969
+ * const transfer = useConfidentialTransfer({
970
+ * tokenAddress: "0x...",
971
+ * optimistic: true,
972
+ * });
973
+ * transfer.mutate(
974
+ * { to: "0xRecipient", amount: 1000n },
975
+ * {
976
+ * onError: (error) => {
977
+ * if (error instanceof SigningRejectedError) {
978
+ * // user cancelled — no action needed
979
+ * }
980
+ * },
981
+ * },
982
+ * );
983
+ * ```
984
+ */
985
+ declare function useConfidentialTransfer(config: UseConfidentialTransferConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, `0x${string}`>;
986
+
987
+ /** Parameters passed to the `mutate` function of {@link useConfidentialTransferFrom}. */
988
+ interface ConfidentialTransferFromParams {
989
+ /** Address to transfer from. Caller must be an approved operator. */
990
+ from: Address;
991
+ /** Recipient address. */
992
+ to: Address;
993
+ /** Amount to transfer (plaintext — encrypted automatically). */
994
+ amount: bigint;
995
+ /** Optional progress callbacks for the multi-step transfer flow. */
996
+ callbacks?: TransferCallbacks;
997
+ }
998
+ /**
999
+ * TanStack Query mutation options factory for confidential transfer-from.
1000
+ *
1001
+ * @param token - A `Token` instance.
1002
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1003
+ */
1004
+ declare function confidentialTransferFromMutationOptions(token: Token): {
1005
+ mutationKey: readonly ["confidentialTransferFrom", `0x${string}`];
1006
+ mutationFn: ({ from, to, amount, callbacks }: ConfidentialTransferFromParams) => Promise<TransactionResult>;
1007
+ };
1008
+ /**
1009
+ * Operator transfer on behalf of another address. Caller must be an approved operator.
1010
+ * Invalidates balance caches on success.
1011
+ *
1012
+ * @param config - Token address (and optional wrapper) identifying the token.
1013
+ * @param options - React Query mutation options.
1014
+ *
1015
+ * @example
1016
+ * ```tsx
1017
+ * const transferFrom = useConfidentialTransferFrom({ tokenAddress: "0x..." });
1018
+ * transferFrom.mutate({ from: "0xOwner", to: "0xRecipient", amount: 500n });
1019
+ * ```
1020
+ */
1021
+ declare function useConfidentialTransferFrom(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferFromParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ConfidentialTransferFromParams, `0x${string}`>;
1022
+
1023
+ /** Parameters passed to the `mutate` function of {@link useConfidentialApprove}. */
1024
+ interface ConfidentialApproveParams {
1025
+ /** Address to approve as operator. */
1026
+ spender: Address;
1027
+ /** Unix timestamp until which the approval is valid. Defaults to 1 hour from now. */
1028
+ until?: number;
1029
+ }
1030
+ /**
1031
+ * TanStack Query mutation options factory for confidential approve.
1032
+ *
1033
+ * @param token - A `Token` instance.
1034
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1035
+ */
1036
+ declare function confidentialApproveMutationOptions(token: Token): {
1037
+ mutationKey: readonly ["confidentialApprove", `0x${string}`];
1038
+ mutationFn: ({ spender, until }: ConfidentialApproveParams) => Promise<TransactionResult>;
1039
+ };
1040
+ /**
1041
+ * Set operator approval for a confidential token. Defaults to 1 hour.
1042
+ *
1043
+ * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
1044
+ * - {@link SigningRejectedError} — user rejected the wallet prompt
1045
+ * - {@link TransactionRevertedError} — on-chain transaction reverted
1046
+ *
1047
+ * @param config - Token address (and optional wrapper) identifying the token.
1048
+ * @param options - React Query mutation options.
1049
+ *
1050
+ * @example
1051
+ * ```tsx
1052
+ * const approve = useConfidentialApprove({ tokenAddress: "0x..." });
1053
+ * approve.mutate({ spender: "0xOperator" });
1054
+ * ```
1055
+ */
1056
+ declare function useConfidentialApprove(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialApproveParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ConfidentialApproveParams, `0x${string}`>;
1057
+
1058
+ /**
1059
+ * Query key factory for confidential approval queries.
1060
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1061
+ */
1062
+ declare const confidentialIsApprovedQueryKeys: {
1063
+ /** Match all approval queries. */
1064
+ readonly all: readonly ["confidentialIsApproved"];
1065
+ /** Match approval queries for a specific token. */
1066
+ readonly token: (tokenAddress: string) => readonly ["confidentialIsApproved", string];
1067
+ /** Match approval queries for a specific token + spender pair. */
1068
+ readonly spender: (tokenAddress: string, spender: string, holder?: string) => readonly ["confidentialIsApproved", string, string, string];
1069
+ };
1070
+ /** Configuration for {@link useConfidentialIsApproved}. */
1071
+ interface UseConfidentialIsApprovedConfig extends UseZamaConfig {
1072
+ /** Address to check approval for. Pass `undefined` to disable the query. */
1073
+ spender: Address | undefined;
1074
+ /** Token holder address. Defaults to the connected wallet. */
1075
+ holder?: Address;
1076
+ }
1077
+ /** Configuration for {@link useConfidentialIsApprovedSuspense}. */
1078
+ interface UseConfidentialIsApprovedSuspenseConfig extends UseZamaConfig {
1079
+ /** Address to check approval for. */
1080
+ spender: Address;
1081
+ /** Token holder address. Defaults to the connected wallet. */
1082
+ holder?: Address;
1083
+ }
1084
+ /**
1085
+ * TanStack Query options factory for confidential approval check.
1086
+ *
1087
+ * @param token - A `Token` instance.
1088
+ * @param spender - Address to check approval for.
1089
+ * @param holder - Optional holder address. Defaults to the connected wallet.
1090
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1091
+ */
1092
+ declare function confidentialIsApprovedQueryOptions(token: Token, spender: Address, holder?: Address): {
1093
+ readonly queryKey: readonly ["confidentialIsApproved", string, string, string];
1094
+ readonly queryFn: () => Promise<boolean>;
1095
+ readonly staleTime: 30000;
1096
+ };
1097
+ /**
1098
+ * Check if a spender is an approved operator for a given holder (defaults to connected wallet).
1099
+ *
1100
+ * @param config - Token address, spender, and optional holder to check.
1101
+ * @param options - React Query options (forwarded to `useQuery`).
1102
+ * @returns Query result with `data: boolean`.
1103
+ *
1104
+ * @example
1105
+ * ```tsx
1106
+ * const { data: isApproved } = useConfidentialIsApproved({
1107
+ * tokenAddress: "0xToken",
1108
+ * spender: "0xSpender",
1109
+ * holder: "0xHolder", // optional
1110
+ * });
1111
+ * ```
1112
+ */
1113
+ declare function useConfidentialIsApproved(config: UseConfidentialIsApprovedConfig, options?: Omit<UseQueryOptions<boolean, Error>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<boolean, Error>;
1114
+ /**
1115
+ * Suspense variant of {@link useConfidentialIsApproved}.
1116
+ * Suspends rendering until the approval check resolves.
1117
+ *
1118
+ * @param config - Token address, spender, and optional holder to check.
1119
+ * @returns Suspense query result with `data: boolean`.
1120
+ *
1121
+ * @example
1122
+ * ```tsx
1123
+ * const { data: isApproved } = useConfidentialIsApprovedSuspense({
1124
+ * tokenAddress: "0xToken",
1125
+ * spender: "0xSpender",
1126
+ * holder: "0xHolder", // optional
1127
+ * });
1128
+ * ```
1129
+ */
1130
+ declare function useConfidentialIsApprovedSuspense(config: UseConfidentialIsApprovedSuspenseConfig): _tanstack_react_query.UseSuspenseQueryResult<boolean, Error>;
1131
+
1132
+ /** Parameters passed to the `mutate` function of {@link useShield}. */
1133
+ interface ShieldParams {
1134
+ /** Amount of underlying ERC-20 tokens to wrap. */
1135
+ amount: bigint;
1136
+ /** Optional fee amount (for native ETH wrapping with fees). */
1137
+ fees?: bigint;
1138
+ /** ERC-20 approval strategy: `"exact"` (default), `"max"`, or `"skip"`. */
1139
+ approvalStrategy?: "max" | "exact" | "skip";
1140
+ /** Recipient address for the shielded tokens. Defaults to the connected wallet. */
1141
+ to?: Address;
1142
+ /** Optional progress callbacks for the multi-step shield flow. */
1143
+ callbacks?: ShieldCallbacks;
1144
+ }
1145
+ /** Configuration for {@link useShield}. */
1146
+ interface UseShieldConfig extends UseZamaConfig {
1147
+ /**
1148
+ * When `true`, optimistically adds the wrap amount to the cached confidential balance
1149
+ * before the transaction confirms. Rolls back on error.
1150
+ * @defaultValue false
1151
+ */
1152
+ optimistic?: boolean;
1153
+ }
1154
+ /**
1155
+ * TanStack Query mutation options factory for shield.
1156
+ *
1157
+ * @param token - A `Token` instance.
1158
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1159
+ */
1160
+ declare function shieldMutationOptions(token: Token): {
1161
+ mutationKey: readonly ["shield", `0x${string}`];
1162
+ mutationFn: ({ amount, fees, approvalStrategy, to, callbacks }: ShieldParams) => Promise<TransactionResult>;
1163
+ };
1164
+ /**
1165
+ * Shield public ERC-20 tokens into confidential tokens.
1166
+ * Handles ERC-20 approval automatically. Invalidates balance caches on success.
1167
+ *
1168
+ * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
1169
+ * - {@link SigningRejectedError} — user rejected the wallet prompt
1170
+ * - {@link ApprovalFailedError} — ERC-20 approval transaction failed
1171
+ * - {@link TransactionRevertedError} — shield transaction reverted
1172
+ *
1173
+ * @param config - Token and wrapper addresses.
1174
+ * Set `optimistic: true` to add the amount to the cached balance immediately.
1175
+ * @param options - React Query mutation options.
1176
+ *
1177
+ * @example
1178
+ * ```tsx
1179
+ * const shield = useShield({ tokenAddress: "0x...", wrapperAddress: "0x...", optimistic: true });
1180
+ * shield.mutate({ amount: 1000n });
1181
+ * ```
1182
+ */
1183
+ declare function useShield(config: UseShieldConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ShieldParams, `0x${string}`>;
1184
+
1185
+ /** Parameters passed to the `mutate` function of {@link useShieldETH}. */
1186
+ interface ShieldETHParams {
1187
+ /** Amount of ETH to wrap (in wei). */
1188
+ amount: bigint;
1189
+ /** ETH value to send with the transaction. Defaults to `amount`. */
1190
+ value?: bigint;
1191
+ }
1192
+ /**
1193
+ * TanStack Query mutation options factory for shield ETH.
1194
+ *
1195
+ * @param token - A `Token` instance.
1196
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1197
+ */
1198
+ declare function shieldETHMutationOptions(token: Token): {
1199
+ mutationKey: readonly ["shieldETH", `0x${string}`];
1200
+ mutationFn: ({ amount, value }: ShieldETHParams) => Promise<TransactionResult>;
1201
+ };
1202
+ /**
1203
+ * Shield native ETH into confidential tokens.
1204
+ * Invalidates balance caches on success.
1205
+ *
1206
+ * @param config - Token and wrapper addresses.
1207
+ * @param options - React Query mutation options.
1208
+ *
1209
+ * @example
1210
+ * ```tsx
1211
+ * const shieldETH = useShieldETH({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1212
+ * shieldETH.mutate({ amount: 1000000000000000000n }); // 1 ETH
1213
+ * ```
1214
+ */
1215
+ declare function useShieldETH(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldETHParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ShieldETHParams, `0x${string}`>;
1216
+
1217
+ /** Parameters passed to the `mutate` function of {@link useUnwrap}. */
1218
+ interface UnwrapParams {
1219
+ /** Amount to unwrap (plaintext — encrypted automatically). */
1220
+ amount: bigint;
1221
+ }
1222
+ /**
1223
+ * TanStack Query mutation options factory for unwrap.
1224
+ *
1225
+ * @param token - A `Token` instance.
1226
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1227
+ */
1228
+ declare function unwrapMutationOptions(token: Token): {
1229
+ mutationKey: readonly ["unwrap", `0x${string}`];
1230
+ mutationFn: ({ amount }: UnwrapParams) => Promise<TransactionResult>;
1231
+ };
1232
+ /**
1233
+ * Request an unwrap for a specific amount. Encrypts the amount first.
1234
+ * Call {@link useFinalizeUnwrap} after the request is processed on-chain,
1235
+ * or use {@link useUnshield} for a single-call orchestration.
1236
+ *
1237
+ * @param config - Token address (and optional wrapper) identifying the token.
1238
+ * @param options - React Query mutation options.
1239
+ *
1240
+ * @example
1241
+ * ```tsx
1242
+ * const unwrap = useUnwrap({ tokenAddress: "0x..." });
1243
+ * unwrap.mutate({ amount: 500n });
1244
+ * ```
1245
+ */
1246
+ declare function useUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, UnwrapParams, `0x${string}`>;
1247
+
1248
+ /**
1249
+ * TanStack Query mutation options factory for unwrap-all.
1250
+ *
1251
+ * @param token - A `Token` instance.
1252
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1253
+ */
1254
+ declare function unwrapAllMutationOptions(token: Token): {
1255
+ mutationKey: readonly ["unwrapAll", `0x${string}`];
1256
+ mutationFn: () => Promise<TransactionResult>;
1257
+ };
1258
+ /**
1259
+ * Request an unwrap for the entire confidential balance.
1260
+ * Uses the on-chain balance handle directly (no encryption needed).
1261
+ * Call {@link useFinalizeUnwrap} after processing, or use {@link useUnshieldAll} for single-call orchestration.
1262
+ *
1263
+ * @param config - Token address (and optional wrapper) identifying the token.
1264
+ * @param options - React Query mutation options.
1265
+ *
1266
+ * @example
1267
+ * ```tsx
1268
+ * const unwrapAll = useUnwrapAll({ tokenAddress: "0x..." });
1269
+ * unwrapAll.mutate();
1270
+ * ```
1271
+ */
1272
+ declare function useUnwrapAll(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, void, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, void, `0x${string}`>;
1273
+
1274
+ /** Parameters passed to the `mutate` function of {@link useFinalizeUnwrap}. */
1275
+ interface FinalizeUnwrapParams {
1276
+ /** Encrypted amount handle from the UnwrapRequested event. */
1277
+ burnAmountHandle: Address;
1278
+ }
1279
+ /**
1280
+ * TanStack Query mutation options factory for finalize-unwrap.
1281
+ *
1282
+ * @param token - A `Token` instance.
1283
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1284
+ */
1285
+ declare function finalizeUnwrapMutationOptions(token: Token): {
1286
+ mutationKey: readonly ["finalizeUnwrap", `0x${string}`];
1287
+ mutationFn: ({ burnAmountHandle }: FinalizeUnwrapParams) => Promise<TransactionResult>;
1288
+ };
1289
+ /**
1290
+ * Complete an unwrap by providing the public decryption proof.
1291
+ * Call this after an unwrap request has been processed on-chain.
1292
+ *
1293
+ * @param config - Token address (and optional wrapper) identifying the token.
1294
+ * @param options - React Query mutation options.
1295
+ *
1296
+ * @example
1297
+ * ```tsx
1298
+ * const finalize = useFinalizeUnwrap({ tokenAddress: "0x..." });
1299
+ * finalize.mutate({ burnAmountHandle: event.encryptedAmount });
1300
+ * ```
1301
+ */
1302
+ declare function useFinalizeUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, FinalizeUnwrapParams, `0x${string}`>;
1303
+
1304
+ /** Parameters passed to the `mutate` function of {@link useUnshield}. */
1305
+ interface UnshieldParams {
1306
+ /** Amount to unshield (plaintext — encrypted automatically). */
1307
+ amount: bigint;
1308
+ /** Optional progress callbacks for the multi-step unshield flow. */
1309
+ callbacks?: UnshieldCallbacks;
1310
+ }
1311
+ /**
1312
+ * TanStack Query mutation options factory for unshield.
1313
+ *
1314
+ * @param token - A `Token` instance.
1315
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1316
+ */
1317
+ declare function unshieldMutationOptions(token: Token): {
1318
+ mutationKey: readonly ["unshield", `0x${string}`];
1319
+ mutationFn: ({ amount, callbacks }: UnshieldParams) => Promise<TransactionResult>;
1320
+ };
1321
+ /**
1322
+ * Unshield a specific amount and finalize in one call.
1323
+ * Orchestrates: unwrap → wait for receipt → parse event → finalize.
1324
+ *
1325
+ * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
1326
+ * - {@link SigningRejectedError} — user rejected the wallet prompt
1327
+ * - {@link EncryptionFailedError} — FHE encryption failed during unwrap
1328
+ * - {@link DecryptionFailedError} — public decryption failed during finalize
1329
+ * - {@link TransactionRevertedError} — on-chain transaction reverted
1330
+ *
1331
+ * @param config - Token and wrapper addresses.
1332
+ * @param options - React Query mutation options.
1333
+ *
1334
+ * @example
1335
+ * ```tsx
1336
+ * const unshield = useUnshield({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1337
+ * unshield.mutate({ amount: 500n });
1338
+ * ```
1339
+ */
1340
+ declare function useUnshield(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnshieldParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, UnshieldParams, `0x${string}`>;
1341
+
1342
+ /**
1343
+ * TanStack Query mutation options factory for unshield-all.
1344
+ *
1345
+ * @param token - A `Token` instance.
1346
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1347
+ */
1348
+ /** Parameters passed to the `mutate` function of {@link useUnshieldAll}. */
1349
+ interface UnshieldAllParams {
1350
+ /** Optional progress callbacks for the multi-step unshield flow. */
1351
+ callbacks?: UnshieldCallbacks;
1352
+ }
1353
+ declare function unshieldAllMutationOptions(token: Token): {
1354
+ mutationKey: readonly ["unshieldAll", `0x${string}`];
1355
+ mutationFn: (params?: UnshieldAllParams) => Promise<TransactionResult>;
1356
+ };
1357
+ /**
1358
+ * Unshield the entire balance and finalize in one call.
1359
+ * Orchestrates: unwrapAll → wait for receipt → parse event → finalize.
1360
+ *
1361
+ * @param config - Token and wrapper addresses.
1362
+ * @param options - React Query mutation options.
1363
+ *
1364
+ * @example
1365
+ * ```tsx
1366
+ * const unshieldAll = useUnshieldAll({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1367
+ * unshieldAll.mutate();
1368
+ * ```
1369
+ */
1370
+ declare function useUnshieldAll(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnshieldAllParams | void, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, void | UnshieldAllParams, `0x${string}`>;
1371
+
1372
+ /** Parameters passed to the `mutate` function of {@link useResumeUnshield}. */
1373
+ interface ResumeUnshieldParams {
1374
+ /** The unwrap transaction hash from a previously interrupted unshield. */
1375
+ unwrapTxHash: Hex;
1376
+ /** Optional progress callbacks for the finalization flow. */
1377
+ callbacks?: UnshieldCallbacks;
1378
+ }
1379
+ /**
1380
+ * TanStack Query mutation options factory for resume-unshield.
1381
+ *
1382
+ * @param token - A `Token` instance.
1383
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1384
+ */
1385
+ declare function resumeUnshieldMutationOptions(token: Token): {
1386
+ mutationKey: readonly ["resumeUnshield", `0x${string}`];
1387
+ mutationFn: ({ unwrapTxHash, callbacks }: ResumeUnshieldParams) => Promise<TransactionResult>;
1388
+ };
1389
+ /**
1390
+ * Resume an interrupted unshield from an existing unwrap tx hash.
1391
+ * Useful when the user submitted the unwrap but the finalize step was
1392
+ * interrupted (e.g. page reload, network error).
1393
+ *
1394
+ * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
1395
+ * - {@link DecryptionFailedError} — public decryption failed during finalize
1396
+ * - {@link TransactionRevertedError} — on-chain transaction reverted
1397
+ *
1398
+ * @param config - Token and wrapper addresses.
1399
+ * @param options - React Query mutation options.
1400
+ *
1401
+ * @example
1402
+ * ```tsx
1403
+ * const resumeUnshield = useResumeUnshield({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1404
+ * resumeUnshield.mutate({ unwrapTxHash: "0xabc..." });
1405
+ * ```
1406
+ */
1407
+ declare function useResumeUnshield(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ResumeUnshieldParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ResumeUnshieldParams, `0x${string}`>;
1408
+
1409
+ /**
1410
+ * Query key factory for underlying ERC-20 allowance queries.
1411
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1412
+ */
1413
+ declare const underlyingAllowanceQueryKeys: {
1414
+ /** Match all underlying allowance queries. */
1415
+ readonly all: readonly ["underlyingAllowance"];
1416
+ /** Match allowance query for a specific token + wrapper pair. */
1417
+ readonly token: (tokenAddress: string, wrapper: string) => readonly ["underlyingAllowance", string, string];
1418
+ };
1419
+ /** Configuration for {@link useUnderlyingAllowance}. */
1420
+ interface UseUnderlyingAllowanceConfig {
1421
+ /** Address of the underlying ERC-20 token. */
1422
+ tokenAddress: Address;
1423
+ /** Address of the wrapper contract (the spender). */
1424
+ wrapperAddress: Address;
1425
+ }
1426
+ /**
1427
+ * TanStack Query options factory for underlying ERC-20 allowance.
1428
+ *
1429
+ * @param token - A `ReadonlyToken` instance.
1430
+ * @param wrapperAddress - Address of the wrapper contract (the spender).
1431
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1432
+ */
1433
+ declare function underlyingAllowanceQueryOptions(token: ReadonlyToken, wrapperAddress: Address): {
1434
+ readonly queryKey: readonly ["underlyingAllowance", string, string];
1435
+ readonly queryFn: () => Promise<bigint>;
1436
+ readonly staleTime: 30000;
1437
+ };
1438
+ /**
1439
+ * Read the underlying ERC-20 allowance granted to the wrapper contract.
1440
+ * Useful to check if an approval is needed before shielding.
1441
+ *
1442
+ * @param config - Token and wrapper addresses.
1443
+ * @param options - React Query options (forwarded to `useQuery`).
1444
+ * @returns Query result with `data: bigint` (current allowance).
1445
+ *
1446
+ * @example
1447
+ * ```tsx
1448
+ * const { data: allowance } = useUnderlyingAllowance({
1449
+ * tokenAddress: "0xUnderlying",
1450
+ * wrapperAddress: "0xWrapper",
1451
+ * });
1452
+ * ```
1453
+ */
1454
+ declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<bigint, Error>;
1455
+ /**
1456
+ * Suspense variant of {@link useUnderlyingAllowance}.
1457
+ * Suspends rendering until the allowance is loaded.
1458
+ *
1459
+ * @param config - Token and wrapper addresses.
1460
+ * @returns Suspense query result with `data: bigint`.
1461
+ *
1462
+ * @example
1463
+ * ```tsx
1464
+ * const { data: allowance } = useUnderlyingAllowanceSuspense({
1465
+ * tokenAddress: "0xUnderlying",
1466
+ * wrapperAddress: "0xWrapper",
1467
+ * });
1468
+ * ```
1469
+ */
1470
+ declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceConfig): _tanstack_react_query.UseSuspenseQueryResult<bigint, Error>;
1471
+
1472
+ /**
1473
+ * Query key factories for confidential balance queries.
1474
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()` / `removeQueries()`.
1475
+ *
1476
+ * @example
1477
+ * ```ts
1478
+ * // Invalidate all balance queries
1479
+ * queryClient.invalidateQueries({ queryKey: confidentialBalanceQueryKeys.all });
1480
+ *
1481
+ * // Reset balance for a specific token + owner
1482
+ * queryClient.resetQueries({
1483
+ * queryKey: confidentialBalanceQueryKeys.owner("0xToken", "0xOwner"),
1484
+ * });
1485
+ * ```
1486
+ */
1487
+ declare const confidentialBalanceQueryKeys: {
1488
+ /** Match all single-token balance queries. */
1489
+ readonly all: readonly ["confidentialBalance"];
1490
+ /** Match balance queries for a specific token (any owner). */
1491
+ readonly token: (tokenAddress: string) => readonly ["confidentialBalance", string];
1492
+ /** Match balance query for a specific token + owner. */
1493
+ readonly owner: (tokenAddress: string, owner: string) => readonly ["confidentialBalance", string, string];
1494
+ };
1495
+ /**
1496
+ * Query key factory for batch balance queries (multiple tokens).
1497
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1498
+ */
1499
+ declare const confidentialBalancesQueryKeys: {
1500
+ /** Match all batch balance queries. */
1501
+ readonly all: readonly ["confidentialBalances"];
1502
+ /** Match batch balance query for a specific token set + owner. */
1503
+ readonly tokens: (tokenAddresses: string[], owner: string) => readonly ["confidentialBalances", string[], string];
1504
+ };
1505
+ /**
1506
+ * Query key factory for encrypted handle queries (Phase 1 of two-phase polling).
1507
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1508
+ */
1509
+ declare const confidentialHandleQueryKeys: {
1510
+ /** Match all single-token handle queries. */
1511
+ readonly all: readonly ["confidentialHandle"];
1512
+ /** Match handle queries for a specific token (any owner). */
1513
+ readonly token: (tokenAddress: string) => readonly ["confidentialHandle", string];
1514
+ /** Match handle query for a specific token + owner. */
1515
+ readonly owner: (tokenAddress: string, owner: string) => readonly ["confidentialHandle", string, string];
1516
+ };
1517
+ /**
1518
+ * Query key factory for batch encrypted handle queries (Phase 1, multiple tokens).
1519
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1520
+ */
1521
+ declare const confidentialHandlesQueryKeys: {
1522
+ /** Match all batch handle queries. */
1523
+ readonly all: readonly ["confidentialHandles"];
1524
+ /** Match batch handle query for a specific token set + owner. */
1525
+ readonly tokens: (tokenAddresses: string[], owner: string) => readonly ["confidentialHandles", string[], string];
1526
+ };
1527
+
1528
+ /**
1529
+ * Query key factory for wrapper discovery queries.
1530
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1531
+ */
1532
+ declare const wrapperDiscoveryQueryKeys: {
1533
+ /** Match all wrapper discovery queries. */
1534
+ readonly all: readonly ["wrapperDiscovery"];
1535
+ /** Match wrapper discovery queries for a specific token. */
1536
+ readonly token: (tokenAddress: string) => readonly ["wrapperDiscovery", string];
1537
+ /** Match wrapper discovery query for a specific token + coordinator pair. */
1538
+ readonly tokenCoordinator: (tokenAddress: string, coordinatorAddress: string) => readonly ["wrapperDiscovery", string, string];
1539
+ };
1540
+ /** Configuration for {@link useWrapperDiscovery}. */
1541
+ interface UseWrapperDiscoveryConfig {
1542
+ /** Address of the underlying ERC-20 token. */
1543
+ tokenAddress: Address;
1544
+ /** Address of the wrapper coordinator. Pass `undefined` to disable the query. */
1545
+ coordinatorAddress: Address | undefined;
1546
+ }
1547
+ /** Configuration for {@link useWrapperDiscoverySuspense}. */
1548
+ interface UseWrapperDiscoverySuspenseConfig {
1549
+ /** Address of the underlying ERC-20 token. */
1550
+ tokenAddress: Address;
1551
+ /** Address of the wrapper coordinator. */
1552
+ coordinatorAddress: Address;
1553
+ }
1554
+ /**
1555
+ * TanStack Query options factory for wrapper discovery.
1556
+ *
1557
+ * @param token - A `ReadonlyToken` instance.
1558
+ * @param coordinatorAddress - Address of the wrapper coordinator.
1559
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1560
+ */
1561
+ declare function wrapperDiscoveryQueryOptions(token: ReadonlyToken, coordinatorAddress: Address): {
1562
+ readonly queryKey: readonly ["wrapperDiscovery", string, string];
1563
+ readonly queryFn: () => Promise<`0x${string}` | null>;
1564
+ readonly staleTime: number;
1565
+ };
1566
+ /**
1567
+ * Discover the wrapper contract for an ERC-20 token.
1568
+ * Returns the wrapper address if one exists, or `null` if not.
1569
+ * Cached indefinitely since wrapper mappings are immutable.
1570
+ *
1571
+ * @param config - Token and coordinator addresses.
1572
+ * @param options - React Query options (forwarded to `useQuery`).
1573
+ * @returns Query result with `data: Address | null`.
1574
+ *
1575
+ * @example
1576
+ * ```tsx
1577
+ * const { data: wrapperAddress } = useWrapperDiscovery({
1578
+ * tokenAddress: "0xUnderlying",
1579
+ * coordinatorAddress: "0xCoordinator",
1580
+ * });
1581
+ * ```
1582
+ */
1583
+ declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address | null, Error>, "queryKey" | "queryFn">): UseQueryResult<Address | null, Error>;
1584
+ /**
1585
+ * Suspense variant of {@link useWrapperDiscovery}.
1586
+ * Suspends rendering until the wrapper address is resolved.
1587
+ *
1588
+ * @param config - Token and coordinator addresses.
1589
+ * @returns Suspense query result with `data: Address | null`.
1590
+ *
1591
+ * @example
1592
+ * ```tsx
1593
+ * const { data: wrapperAddress } = useWrapperDiscoverySuspense({
1594
+ * tokenAddress: "0xUnderlying",
1595
+ * coordinatorAddress: "0xCoordinator",
1596
+ * });
1597
+ * ```
1598
+ */
1599
+ declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig): UseSuspenseQueryResult<Address | null, Error>;
1600
+
1601
+ /**
1602
+ * Query key factory for token metadata queries.
1603
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1604
+ */
1605
+ declare const metadataQueryKeys: {
1606
+ /** Match all token metadata queries. */
1607
+ readonly all: readonly ["tokenMetadata"];
1608
+ /** Match metadata query for a specific token. */
1609
+ readonly token: (tokenAddress: string) => readonly ["tokenMetadata", string];
1610
+ };
1611
+ /** ERC-20 token metadata (name, symbol, decimals). */
1612
+ interface TokenMetadata {
1613
+ /** Human-readable token name (e.g. "Wrapped Ether"). */
1614
+ name: string;
1615
+ /** Short ticker symbol (e.g. "WETH"). */
1616
+ symbol: string;
1617
+ /** Number of decimal places (e.g. 18). */
1618
+ decimals: number;
1619
+ }
1620
+ /**
1621
+ * TanStack Query options factory for token metadata.
1622
+ * Returns a config object usable with `useQuery`, `prefetchQuery`, `useQueries`, etc.
1623
+ *
1624
+ * @param token - A `ReadonlyToken` instance.
1625
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1626
+ *
1627
+ * @example
1628
+ * ```ts
1629
+ * const options = metadataQueryOptions(token);
1630
+ * await queryClient.prefetchQuery(options);
1631
+ * ```
1632
+ */
1633
+ declare function metadataQueryOptions(token: ReadonlyToken): {
1634
+ readonly queryKey: readonly ["tokenMetadata", string];
1635
+ readonly queryFn: () => Promise<TokenMetadata>;
1636
+ readonly staleTime: number;
1637
+ };
1638
+ /**
1639
+ * Read ERC-20 token metadata (name, symbol, decimals).
1640
+ * Fetches all three in parallel. Cached indefinitely since metadata is immutable.
1641
+ *
1642
+ * @param tokenAddress - Address of the token contract.
1643
+ * @param options - React Query options (forwarded to `useQuery`).
1644
+ * @returns Query result with `data: TokenMetadata`.
1645
+ *
1646
+ * @example
1647
+ * ```tsx
1648
+ * const { data: metadata } = useMetadata("0xToken");
1649
+ * // metadata?.name, metadata?.symbol, metadata?.decimals
1650
+ * ```
1651
+ */
1652
+ declare function useMetadata(tokenAddress: Address, options?: Omit<UseQueryOptions<TokenMetadata, Error>, "queryKey" | "queryFn">): UseQueryResult<TokenMetadata, Error>;
1653
+ /**
1654
+ * Suspense variant of {@link useMetadata}.
1655
+ * Suspends rendering until metadata is loaded.
1656
+ *
1657
+ * @param tokenAddress - Address of the token contract.
1658
+ * @returns Suspense query result with `data: TokenMetadata`.
1659
+ *
1660
+ * @example
1661
+ * ```tsx
1662
+ * const { data: metadata } = useMetadataSuspense("0xToken");
1663
+ * ```
1664
+ */
1665
+ declare function useMetadataSuspense(tokenAddress: Address): UseSuspenseQueryResult<TokenMetadata, Error>;
1666
+
1667
+ /**
1668
+ * Query key factory for activity feed queries.
1669
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1670
+ */
1671
+ declare const activityFeedQueryKeys: {
1672
+ /** Match all activity feed queries. */
1673
+ readonly all: readonly ["activityFeed"];
1674
+ /** Match activity feed queries for a specific token. */
1675
+ readonly token: (tokenAddress: string) => readonly ["activityFeed", string];
1676
+ };
1677
+ /** Configuration for {@link useActivityFeed}. */
1678
+ interface UseActivityFeedConfig {
1679
+ /** Address of the confidential token contract. */
1680
+ tokenAddress: Address;
1681
+ /** Connected wallet address. Pass `undefined` to disable the query. */
1682
+ userAddress: Address | undefined;
1683
+ /** Raw event logs from the provider (viem, ethers, etc.). Pass `undefined` to disable. */
1684
+ logs: readonly (RawLog & Partial<ActivityLogMetadata>)[] | undefined;
1685
+ /** Whether to batch-decrypt encrypted transfer amounts. Default: `true`. */
1686
+ decrypt?: boolean;
1687
+ }
1688
+ /**
1689
+ * Two-phase activity feed hook.
1690
+ * Phase 1: Instantly parses raw logs into classified {@link ActivityItem}s (sync, cheap).
1691
+ * Phase 2: Batch-decrypts encrypted transfer amounts via the relayer (async).
1692
+ *
1693
+ * The wallet provides logs (from its own provider — viem, ethers, etc.)
1694
+ * and this hook normalizes + decrypts them.
1695
+ *
1696
+ * @param config - Token address, user address, raw logs, and decrypt option.
1697
+ * @returns Query result with `data: ActivityItem[]`.
1698
+ *
1699
+ * @example
1700
+ * ```tsx
1701
+ * const { data: activity } = useActivityFeed({
1702
+ * tokenAddress: "0xToken",
1703
+ * userAddress: "0xUser",
1704
+ * logs: rawLogs,
1705
+ * });
1706
+ * ```
1707
+ */
1708
+ declare function useActivityFeed(config: UseActivityFeedConfig): UseQueryResult<ActivityItem[], Error>;
1709
+
1710
+ /** Parameters passed to the `mutate` function of {@link useApproveUnderlying}. */
1711
+ interface ApproveUnderlyingParams {
1712
+ /** Approval amount. Defaults to max uint256 if omitted. */
1713
+ amount?: bigint;
1714
+ }
1715
+ /**
1716
+ * TanStack Query mutation options factory for approve-underlying.
1717
+ *
1718
+ * @param token - A `Token` instance.
1719
+ * @returns Mutation options with `mutationKey` and `mutationFn`.
1720
+ */
1721
+ declare function approveUnderlyingMutationOptions(token: Token): {
1722
+ mutationKey: readonly ["approveUnderlying", `0x${string}`];
1723
+ mutationFn: ({ amount }: ApproveUnderlyingParams) => Promise<TransactionResult>;
1724
+ };
1725
+ /**
1726
+ * Approve the wrapper contract to spend the underlying ERC-20.
1727
+ * Defaults to max uint256. Resets to zero first if there's an existing
1728
+ * non-zero allowance (required by tokens like USDT).
1729
+ *
1730
+ * @param config - Token and wrapper addresses.
1731
+ * @param options - React Query mutation options.
1732
+ *
1733
+ * @example
1734
+ * ```tsx
1735
+ * const approve = useApproveUnderlying({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1736
+ * approve.mutate({}); // max approval
1737
+ * approve.mutate({ amount: 1000n }); // exact amount
1738
+ * ```
1739
+ */
1740
+ declare function useApproveUnderlying(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ApproveUnderlyingParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ApproveUnderlyingParams, `0x${string}`>;
1741
+
1742
+ /**
1743
+ * Query key factory for ERC-165 confidential interface checks.
1744
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1745
+ */
1746
+ declare const isConfidentialQueryKeys: {
1747
+ /** Match all confidential interface queries. */
1748
+ readonly all: readonly ["isConfidential"];
1749
+ /** Match confidential interface query for a specific token. */
1750
+ readonly token: (tokenAddress: string) => readonly ["isConfidential", string];
1751
+ };
1752
+ /**
1753
+ * Query key factory for ERC-165 wrapper interface checks.
1754
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1755
+ */
1756
+ declare const isWrapperQueryKeys: {
1757
+ /** Match all wrapper interface queries. */
1758
+ readonly all: readonly ["isWrapper"];
1759
+ /** Match wrapper interface query for a specific token. */
1760
+ readonly token: (tokenAddress: string) => readonly ["isWrapper", string];
1761
+ };
1762
+ /**
1763
+ * TanStack Query options factory for ERC-165 confidential interface check.
1764
+ *
1765
+ * @param token - A `ReadonlyToken` instance.
1766
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1767
+ */
1768
+ declare function isConfidentialQueryOptions(token: ReadonlyToken): {
1769
+ readonly queryKey: readonly ["isConfidential", string];
1770
+ readonly queryFn: () => Promise<boolean>;
1771
+ readonly staleTime: number;
1772
+ };
1773
+ /**
1774
+ * TanStack Query options factory for ERC-165 wrapper interface check.
1775
+ *
1776
+ * @param token - A `ReadonlyToken` instance.
1777
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1778
+ */
1779
+ declare function isWrapperQueryOptions(token: ReadonlyToken): {
1780
+ readonly queryKey: readonly ["isWrapper", string];
1781
+ readonly queryFn: () => Promise<boolean>;
1782
+ readonly staleTime: number;
1783
+ };
1784
+ /**
1785
+ * Check if a token supports the ERC-7984 confidential interface via ERC-165.
1786
+ * Result is cached indefinitely since interface support does not change.
1787
+ *
1788
+ * @param tokenAddress - Address of the token contract to check.
1789
+ * @param options - React Query options (forwarded to `useQuery`).
1790
+ * @returns Query result with `data: boolean`.
1791
+ *
1792
+ * @example
1793
+ * ```tsx
1794
+ * const { data: isConfidential } = useIsConfidential("0xToken");
1795
+ * ```
1796
+ */
1797
+ declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean, Error>, "queryKey" | "queryFn">): UseQueryResult<boolean, Error>;
1798
+ /**
1799
+ * Suspense variant of {@link useIsConfidential}.
1800
+ * Suspends rendering until the ERC-165 check resolves.
1801
+ *
1802
+ * @param tokenAddress - Address of the token contract to check.
1803
+ * @returns Suspense query result with `data: boolean`.
1804
+ *
1805
+ * @example
1806
+ * ```tsx
1807
+ * const { data: isConfidential } = useIsConfidentialSuspense("0xToken");
1808
+ * ```
1809
+ */
1810
+ declare function useIsConfidentialSuspense(tokenAddress: Address): UseSuspenseQueryResult<boolean, Error>;
1811
+ /**
1812
+ * Check if a token supports the ERC-7984 wrapper interface via ERC-165.
1813
+ * Result is cached indefinitely since interface support does not change.
1814
+ *
1815
+ * @param tokenAddress - Address of the token contract to check.
1816
+ * @param options - React Query options (forwarded to `useQuery`).
1817
+ * @returns Query result with `data: boolean`.
1818
+ *
1819
+ * @example
1820
+ * ```tsx
1821
+ * const { data: isWrapper } = useIsWrapper("0xToken");
1822
+ * ```
1823
+ */
1824
+ declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean, Error>, "queryKey" | "queryFn">): UseQueryResult<boolean, Error>;
1825
+ /**
1826
+ * Suspense variant of {@link useIsWrapper}.
1827
+ * Suspends rendering until the ERC-165 check resolves.
1828
+ *
1829
+ * @param tokenAddress - Address of the token contract to check.
1830
+ * @returns Suspense query result with `data: boolean`.
1831
+ *
1832
+ * @example
1833
+ * ```tsx
1834
+ * const { data: isWrapper } = useIsWrapperSuspense("0xToken");
1835
+ * ```
1836
+ */
1837
+ declare function useIsWrapperSuspense(tokenAddress: Address): UseSuspenseQueryResult<boolean, Error>;
1838
+
1839
+ /**
1840
+ * Query key factory for total supply queries.
1841
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1842
+ */
1843
+ declare const totalSupplyQueryKeys: {
1844
+ /** Match all total supply queries. */
1845
+ readonly all: readonly ["totalSupply"];
1846
+ /** Match total supply query for a specific token. */
1847
+ readonly token: (tokenAddress: string) => readonly ["totalSupply", string];
1848
+ };
1849
+ /**
1850
+ * TanStack Query options factory for total supply.
1851
+ *
1852
+ * @param token - A `ReadonlyToken` instance.
1853
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1854
+ */
1855
+ declare function totalSupplyQueryOptions(token: ReadonlyToken): {
1856
+ readonly queryKey: readonly ["totalSupply", string];
1857
+ readonly queryFn: () => Promise<bigint>;
1858
+ readonly staleTime: 30000;
1859
+ };
1860
+ /**
1861
+ * Read the total supply of a token.
1862
+ * Stale after 30 seconds to balance freshness and RPC cost.
1863
+ *
1864
+ * @param tokenAddress - Address of the token contract.
1865
+ * @param options - React Query options (forwarded to `useQuery`).
1866
+ * @returns Query result with `data: bigint`.
1867
+ *
1868
+ * @example
1869
+ * ```tsx
1870
+ * const { data: totalSupply } = useTotalSupply("0xToken");
1871
+ * ```
1872
+ */
1873
+ declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
1874
+ /**
1875
+ * Suspense variant of {@link useTotalSupply}.
1876
+ * Suspends rendering until the total supply is loaded.
1877
+ *
1878
+ * @param tokenAddress - Address of the token contract.
1879
+ * @returns Suspense query result with `data: bigint`.
1880
+ *
1881
+ * @example
1882
+ * ```tsx
1883
+ * const { data: totalSupply } = useTotalSupplySuspense("0xToken");
1884
+ * ```
1885
+ */
1886
+ declare function useTotalSupplySuspense(tokenAddress: Address): UseSuspenseQueryResult<bigint, Error>;
1887
+
1888
+ /**
1889
+ * Query key factory for fee-related queries.
1890
+ * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1891
+ */
1892
+ declare const feeQueryKeys: {
1893
+ /** Match shield fee query for given parameters. */
1894
+ readonly shieldFee: (feeManagerAddress: string, amount?: string, from?: string, to?: string) => readonly ["shieldFee", string, ...(string | undefined)[]];
1895
+ /** Match unshield fee query for given parameters. */
1896
+ readonly unshieldFee: (feeManagerAddress: string, amount?: string, from?: string, to?: string) => readonly ["unshieldFee", string, ...(string | undefined)[]];
1897
+ /** Match batch transfer fee query for a specific fee manager. */
1898
+ readonly batchTransferFee: (feeManagerAddress: string) => readonly ["batchTransferFee", string];
1899
+ /** Match fee recipient query for a specific fee manager. */
1900
+ readonly feeRecipient: (feeManagerAddress: string) => readonly ["feeRecipient", string];
1901
+ };
1902
+ /** Configuration for {@link useShieldFee} and {@link useUnshieldFee}. */
1903
+ interface UseFeeConfig {
1904
+ /** Address of the fee manager contract. */
1905
+ feeManagerAddress: Address;
1906
+ /** Amount to calculate the fee for. */
1907
+ amount: bigint;
1908
+ /** Sender address. */
1909
+ from: Address;
1910
+ /** Receiver address. */
1911
+ to: Address;
1912
+ }
1913
+ /**
1914
+ * TanStack Query options factory for shield fee.
1915
+ *
1916
+ * @param signer - A `GenericSigner` instance.
1917
+ * @param config - {@link UseFeeConfig} with fee manager address, amount, from, and to.
1918
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1919
+ */
1920
+ declare function shieldFeeQueryOptions(signer: GenericSigner, config: UseFeeConfig): {
1921
+ readonly queryKey: readonly ["shieldFee", string, ...(string | undefined)[]];
1922
+ readonly queryFn: () => Promise<bigint>;
1923
+ readonly staleTime: 30000;
1924
+ };
1925
+ /**
1926
+ * TanStack Query options factory for unshield fee.
1927
+ *
1928
+ * @param signer - A `GenericSigner` instance.
1929
+ * @param config - Fee manager address, amount, from, and to.
1930
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1931
+ */
1932
+ declare function unshieldFeeQueryOptions(signer: GenericSigner, config: UseFeeConfig): {
1933
+ readonly queryKey: readonly ["unshieldFee", string, ...(string | undefined)[]];
1934
+ readonly queryFn: () => Promise<bigint>;
1935
+ readonly staleTime: 30000;
1936
+ };
1937
+ /**
1938
+ * TanStack Query options factory for batch transfer fee.
1939
+ *
1940
+ * @param signer - A `GenericSigner` instance.
1941
+ * @param feeManagerAddress - Address of the fee manager contract.
1942
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1943
+ */
1944
+ declare function batchTransferFeeQueryOptions(signer: GenericSigner, feeManagerAddress: Address): {
1945
+ readonly queryKey: readonly ["batchTransferFee", string];
1946
+ readonly queryFn: () => Promise<bigint>;
1947
+ readonly staleTime: 30000;
1948
+ };
1949
+ /**
1950
+ * TanStack Query options factory for fee recipient.
1951
+ *
1952
+ * @param signer - A `GenericSigner` instance.
1953
+ * @param feeManagerAddress - Address of the fee manager contract.
1954
+ * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1955
+ */
1956
+ declare function feeRecipientQueryOptions(signer: GenericSigner, feeManagerAddress: Address): {
1957
+ readonly queryKey: readonly ["feeRecipient", string];
1958
+ readonly queryFn: () => Promise<`0x${string}`>;
1959
+ readonly staleTime: 30000;
1960
+ };
1961
+ /**
1962
+ * Read the shield fee for a given amount and address pair.
1963
+ *
1964
+ * @param config - Fee manager address, amount, from, and to.
1965
+ * @param options - React Query options (forwarded to `useQuery`).
1966
+ * @returns Query result with `data: bigint` (the fee amount).
1967
+ *
1968
+ * @example
1969
+ * ```tsx
1970
+ * const { data: fee } = useShieldFee({
1971
+ * feeManagerAddress: "0xFeeManager",
1972
+ * amount: 1000n,
1973
+ * from: "0xSender",
1974
+ * to: "0xReceiver",
1975
+ * });
1976
+ * ```
1977
+ */
1978
+ declare function useShieldFee(config: UseFeeConfig, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
1979
+ /**
1980
+ * Read the unshield fee for a given amount and address pair.
1981
+ *
1982
+ * @param config - Fee manager address, amount, from, and to.
1983
+ * @param options - React Query options (forwarded to `useQuery`).
1984
+ * @returns Query result with `data: bigint` (the fee amount).
1985
+ *
1986
+ * @example
1987
+ * ```tsx
1988
+ * const { data: fee } = useUnshieldFee({
1989
+ * feeManagerAddress: "0xFeeManager",
1990
+ * amount: 1000n,
1991
+ * from: "0xSender",
1992
+ * to: "0xReceiver",
1993
+ * });
1994
+ * ```
1995
+ */
1996
+ declare function useUnshieldFee(config: UseFeeConfig, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
1997
+ /**
1998
+ * Read the batch transfer fee from the fee manager.
1999
+ *
2000
+ * @param feeManagerAddress - Address of the fee manager contract.
2001
+ * @param options - React Query options (forwarded to `useQuery`).
2002
+ * @returns Query result with `data: bigint` (the fee amount).
2003
+ *
2004
+ * @example
2005
+ * ```tsx
2006
+ * const { data: fee } = useBatchTransferFee("0xFeeManager");
2007
+ * ```
2008
+ */
2009
+ declare function useBatchTransferFee(feeManagerAddress: Address, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
2010
+ /**
2011
+ * Read the fee recipient address from the fee manager.
2012
+ *
2013
+ * @param feeManagerAddress - Address of the fee manager contract.
2014
+ * @param options - React Query options (forwarded to `useQuery`).
2015
+ * @returns Query result with `data: Address` (the fee recipient).
2016
+ *
2017
+ * @example
2018
+ * ```tsx
2019
+ * const { data: recipient } = useFeeRecipient("0xFeeManager");
2020
+ * ```
2021
+ */
2022
+ declare function useFeeRecipient(feeManagerAddress: Address, options?: Omit<UseQueryOptions<Address, Error>, "queryKey" | "queryFn">): UseQueryResult<Address, Error>;
2023
+
2024
+ export { type ApproveUnderlyingParams, type ConfidentialApproveParams, type ConfidentialBalancesData, type ConfidentialTransferFromParams, type ConfidentialTransferParams, type CreateDelegatedUserDecryptEIP712Params, type CreateEIP712Params, type DecryptHandle, type FinalizeUnwrapParams, type PublicKeyData, type PublicKeyResult, type PublicParamsData, type PublicParamsResult, type ResumeUnshieldParams, type ShieldETHParams, type ShieldParams, type TokenMetadata, type UnshieldAllParams, type UnshieldParams, type UnwrapParams, type UseActivityFeedConfig, type UseConfidentialBalanceConfig, type UseConfidentialBalanceOptions, type UseConfidentialBalancesConfig, type UseConfidentialBalancesOptions, type UseConfidentialIsApprovedConfig, type UseConfidentialIsApprovedSuspenseConfig, type UseConfidentialTransferConfig, type UseFeeConfig, type UseShieldConfig, type UseUnderlyingAllowanceConfig, type UseUserDecryptFlowConfig, type UseWrapperDiscoveryConfig, type UseWrapperDiscoverySuspenseConfig, type UseZamaConfig, type UserDecryptFlowCallbacks, type UserDecryptFlowParams, ZamaProvider, type ZamaProviderProps, activityFeedQueryKeys, allowMutationOptions, approveUnderlyingMutationOptions, batchTransferFeeQueryOptions, confidentialApproveMutationOptions, confidentialBalanceQueryKeys, confidentialBalancesQueryKeys, confidentialHandleQueryKeys, confidentialHandlesQueryKeys, confidentialIsApprovedQueryKeys, confidentialIsApprovedQueryOptions, confidentialTransferFromMutationOptions, confidentialTransferMutationOptions, decryptionKeys, encryptMutationOptions, feeQueryKeys, feeRecipientQueryOptions, finalizeUnwrapMutationOptions, isAllowedQueryKeys, isAllowedQueryOptions, isConfidentialQueryKeys, isConfidentialQueryOptions, isWrapperQueryKeys, isWrapperQueryOptions, metadataQueryKeys, metadataQueryOptions, publicKeyQueryKeys, publicKeyQueryOptions, publicParamsQueryKeys, publicParamsQueryOptions, resumeUnshieldMutationOptions, revokeMutationOptions, revokeSessionMutationOptions, shieldETHMutationOptions, shieldFeeQueryOptions, shieldMutationOptions, totalSupplyQueryKeys, totalSupplyQueryOptions, underlyingAllowanceQueryKeys, underlyingAllowanceQueryOptions, unshieldAllMutationOptions, unshieldFeeQueryOptions, unshieldMutationOptions, unwrapAllMutationOptions, unwrapMutationOptions, useActivityFeed, useAllow, useApproveUnderlying, useBatchTransferFee, useConfidentialApprove, useConfidentialBalance, useConfidentialBalances, useConfidentialIsApproved, useConfidentialIsApprovedSuspense, useConfidentialTransfer, useConfidentialTransferFrom, useCreateDelegatedUserDecryptEIP712, useCreateEIP712, useDelegatedUserDecrypt, useEncrypt, useFeeRecipient, useFinalizeUnwrap, useGenerateKeypair, useIsAllowed, useIsConfidential, useIsConfidentialSuspense, useIsWrapper, useIsWrapperSuspense, useMetadata, useMetadataSuspense, usePublicDecrypt, usePublicKey, usePublicParams, useReadonlyToken, useReadonlyZamaSDK, useRequestZKProofVerification, useResumeUnshield, useRevoke, useRevokeSession, useShield, useShieldETH, useShieldFee, useToken, useTotalSupply, useTotalSupplySuspense, useUnderlyingAllowance, useUnderlyingAllowanceSuspense, useUnshield, useUnshieldAll, useUnshieldFee, useUnwrap, useUnwrapAll, useUserDecrypt, useUserDecryptFlow, useUserDecryptedValue, useUserDecryptedValues, useWrapperDiscovery, useWrapperDiscoverySuspense, useZamaSDK, wrapperDiscoveryQueryKeys, wrapperDiscoveryQueryOptions };