@zama-fhe/react-sdk 1.0.0 → 1.0.1

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