@zama-fhe/react-sdk 1.0.0-alpha.2 → 1.0.0-alpha.20

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,30 +1,46 @@
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, ZamaSDKEventListener, ZamaSDK, EncryptParams, EncryptResult, UserDecryptParams, PublicDecryptResult, FHEKeypair, EIP712TypedData, Address, DelegatedUserDecryptParams, ZKProofLike, Token, TransactionResult, ReadonlyToken } from '@zama-fhe/sdk';
4
- export { ActivityAmount, ActivityDirection, ActivityItem, ActivityLogMetadata, ActivityType, Address, ApprovalFailedError, ApproveSubmittedEvent, ApproveUnderlyingSubmittedEvent, BATCH_SWAP_ABI, BatchDecryptOptions, BatchTransferData, ConfidentialTransferEvent, ContractCallConfig, CredentialExpiredError, CredentialsCachedEvent, CredentialsCreatedEvent, CredentialsCreatingEvent, CredentialsExpiredEvent, CredentialsLoadingEvent, CredentialsManager, DEPLOYMENT_COORDINATOR_ABI, DecryptEndEvent, DecryptErrorEvent, DecryptStartEvent, DecryptionFailedError, DelegatedUserDecryptParams, EIP712TypedData, ENCRYPTION_ABI, ERC165_ABI, ERC20_ABI, ERC20_METADATA_ABI, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, EncryptEndEvent, EncryptErrorEvent, EncryptParams, EncryptResult, EncryptStartEvent, EncryptionFailedError, FEE_MANAGER_ABI, FHEKeypair, FhevmInstanceConfig, FinalizeUnwrapSubmittedEvent, GenericSigner, GenericStringStorage, HardhatConfig, Hex, IndexedDBStorage, InputProofBytesType, InvalidCredentialsError, KmsDelegatedUserDecryptEIP712Type, MainnetConfig, MemoryStorage, NetworkType, NoCiphertextError, OnChainEvent, PublicDecryptResult, RawLog, ReadonlyToken, ReadonlyTokenConfig, RelayerRequestFailedError, RelayerSDK, RelayerSDKStatus, RelayerWeb, RelayerWebConfig, SepoliaConfig, ShieldSubmittedEvent, SigningFailedError, SigningRejectedError, StoredCredentials, TOKEN_TOPICS, TRANSFER_BATCHER_ABI, Token, TokenConfig, Topics, TransactionErrorEvent, TransactionReceipt, TransactionResult, TransactionRevertedError, TransferFromSubmittedEvent, TransferSubmittedEvent, UnshieldCallbacks, UnshieldPhase1SubmittedEvent, UnshieldPhase2StartedEvent, UnshieldPhase2SubmittedEvent, UnwrapRequestedEvent, UnwrapSubmittedEvent, UnwrappedFinalizedEvent, UnwrappedStartedEvent, UserDecryptParams, WRAPPER_ABI, WrappedEvent, ZERO_HANDLE, ZKProofLike, ZamaError, ZamaErrorCode, ZamaSDK, ZamaSDKConfig, ZamaSDKEvent, ZamaSDKEventInput, ZamaSDKEventListener, ZamaSDKEventType, ZamaSDKEvents, allowanceContract, applyDecryptedValues, approveContract, balanceOfContract, clearPendingUnshield, confidentialBalanceOfContract, confidentialBatchTransferContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, decimalsContract, decodeConfidentialTransfer, decodeOnChainEvent, decodeOnChainEvents, decodeUnwrapRequested, decodeUnwrappedFinalized, decodeUnwrappedStarted, decodeWrapped, deploymentCoordinatorContract, extractEncryptedHandles, finalizeUnwrapContract, findUnwrapRequested, findWrapped, getBatchTransferFeeContract, getFeeRecipientContract, getUnwrapFeeContract, getWrapFeeContract, getWrapperContract, indexedDBStorage, isConfidentialTokenContract, isConfidentialWrapperContract, isFinalizeUnwrapOperatorContract, isOperatorContract, loadPendingUnshield, matchZamaError, nameContract, parseActivityFeed, rateContract, savePendingUnshield, setFinalizeUnwrapOperatorContract, setOperatorContract, sortByBlockNumber, supportsInterfaceContract, symbolContract, totalSupplyContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract, wrapETHContract, wrapperExistsContract } from '@zama-fhe/sdk';
5
- import { PropsWithChildren } from 'react';
6
- import * as _tanstack_react_query from '@tanstack/react-query';
7
- import { UseMutationOptions, UseQueryOptions, UseQueryResult, UseSuspenseQueryResult } from '@tanstack/react-query';
8
- import * as _zama_fhe_relayer_sdk_web from '@zama-fhe/relayer-sdk/web';
9
- import { U as UseZamaConfig } from './use-approve-underlying-DAkxWhfm.js';
10
- export { A as ApproveUnderlyingParams, C as ConfidentialApproveParams, a as ConfidentialTransferFromParams, R as ResumeUnshieldParams, T as TokenMetadata, b as UnshieldAllParams, c as UnshieldParams, d as UseActivityFeedConfig, e as UseConfidentialBalanceConfig, f as UseConfidentialBalanceOptions, g as UseConfidentialBalancesConfig, h as UseConfidentialBalancesOptions, i as activityFeedQueryKeys, j as approveUnderlyingMutationOptions, k as authorizeAllMutationOptions, l as confidentialApproveMutationOptions, m as confidentialTransferFromMutationOptions, r as resumeUnshieldMutationOptions, t as tokenMetadataQueryKeys, n as tokenMetadataQueryOptions, u as unshieldAllMutationOptions, o as unshieldMutationOptions, p as unwrapAllMutationOptions, q as useActivityFeed, s as useApproveUnderlying, v as useAuthorizeAll, w as useConfidentialApprove, x as useConfidentialBalance, y as useConfidentialBalances, z as useConfidentialTransferFrom, B as useResumeUnshield, D as useToken, E as useTokenMetadata, F as useTokenMetadataSuspense, G as useUnshield, H as useUnshieldAll, I as useUnwrapAll } from './use-approve-underlying-DAkxWhfm.js';
1
+ "use client";
11
2
 
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, 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
12
14
  /** Props for {@link ZamaProvider}. */
13
15
  interface ZamaProviderProps extends PropsWithChildren {
14
- /** FHE relayer backend (RelayerWeb for browser, RelayerNode for server). */
15
- relayer: RelayerSDK;
16
- /** Wallet signer (ViemSigner, EthersSigner, or custom GenericSigner). */
17
- signer: GenericSigner;
18
- /** Credential storage backend (IndexedDBStorage for browser, MemoryStorage for tests). */
19
- storage: GenericStringStorage;
20
- /** Number of days credentials remain valid (default: relayer default). */
21
- credentialDurationDays?: number;
22
- /** Callback invoked on SDK lifecycle events. */
23
- onEvent?: ZamaSDKEventListener;
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;
24
41
  }
25
42
  /**
26
43
  * Provides a {@link ZamaSDK} instance to all descendant hooks.
27
- * Terminates the relayer on unmount.
28
44
  *
29
45
  * @example
30
46
  * ```tsx
@@ -33,10 +49,19 @@ interface ZamaProviderProps extends PropsWithChildren {
33
49
  * </ZamaProvider>
34
50
  * ```
35
51
  */
36
- declare function ZamaProvider({ children, relayer, signer, storage, credentialDurationDays, onEvent, }: ZamaProviderProps): 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;
37
62
  /**
38
63
  * Access the {@link ZamaSDK} instance from context.
39
- * Must be used within a {@link ZamaProvider}.
64
+ * Throws if called outside a {@link ZamaProvider} or when no signer is provided.
40
65
  *
41
66
  * @example
42
67
  * ```tsx
@@ -44,18 +69,9 @@ declare function ZamaProvider({ children, relayer, signer, storage, credentialDu
44
69
  * const token = sdk.createReadonlyToken("0x...");
45
70
  * ```
46
71
  */
47
- declare function useZamaSDK(): ZamaSDK;
48
-
49
- /**
50
- * TanStack Query mutation options factory for FHE encrypt.
51
- *
52
- * @param sdk - A `ZamaSDK` instance.
53
- * @returns Mutation options with `mutationKey` and `mutationFn`.
54
- */
55
- declare function encryptMutationOptions(sdk: ZamaSDK): {
56
- mutationKey: readonly ["encrypt"];
57
- mutationFn: (params: EncryptParams) => Promise<EncryptResult>;
58
- };
72
+ declare function useZamaSDK(): ZamaSDK$1;
73
+ //#endregion
74
+ //#region src/relayer/use-encrypt.d.ts
59
75
  /**
60
76
  * Encrypt a plaintext value using FHE.
61
77
  * Calls the relayer's `encrypt` method via a mutation.
@@ -68,8 +84,9 @@ declare function encryptMutationOptions(sdk: ZamaSDK): {
68
84
  * encrypt.mutate({ values: [1000n], bits: [64] });
69
85
  * ```
70
86
  */
71
- declare function useEncrypt(): _tanstack_react_query.UseMutationResult<EncryptResult, Error, EncryptParams, unknown>;
72
-
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
73
90
  /**
74
91
  * Thin wrapper around sdk.userDecrypt().
75
92
  * Caller is responsible for providing all params (keypair, signature, etc.).
@@ -79,8 +96,9 @@ declare function useEncrypt(): _tanstack_react_query.UseMutationResult<EncryptRe
79
96
  * On success, populates the decryption cache so useUserDecryptedValue/useUserDecryptedValues
80
97
  * can read the results.
81
98
  */
82
- declare function useUserDecrypt(): _tanstack_react_query.UseMutationResult<Record<string, bigint>, Error, UserDecryptParams, unknown>;
83
-
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
84
102
  /**
85
103
  * Decrypt FHE ciphertext handles using the network public key (no credential needed).
86
104
  * On success, populates the decryption cache so {@link useUserDecryptedValue} / {@link useUserDecryptedValues}
@@ -95,8 +113,9 @@ declare function useUserDecrypt(): _tanstack_react_query.UseMutationResult<Recor
95
113
  * // publicDecrypt.data?.clearValues => { "0xHandle1": 500n, ... }
96
114
  * ```
97
115
  */
98
- declare function usePublicDecrypt(): _tanstack_react_query.UseMutationResult<PublicDecryptResult, Error, string[], unknown>;
99
-
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
100
119
  /**
101
120
  * Generate an FHE keypair via the relayer.
102
121
  * Returns a public/private key pair for use in decrypt authorization.
@@ -110,18 +129,19 @@ declare function usePublicDecrypt(): _tanstack_react_query.UseMutationResult<Pub
110
129
  * // generateKeypair.data?.publicKey, generateKeypair.data?.privateKey
111
130
  * ```
112
131
  */
113
- declare function useGenerateKeypair(): _tanstack_react_query.UseMutationResult<FHEKeypair, Error, void, unknown>;
114
-
132
+ declare function useGenerateKeypair(): _tanstack_react_query0.UseMutationResult<_zama_fhe_sdk0.KeypairType<`0x${string}`>, Error, void, unknown>;
133
+ //#endregion
134
+ //#region src/relayer/use-create-eip712.d.ts
115
135
  /** Parameters for {@link useCreateEIP712}. */
116
136
  interface CreateEIP712Params {
117
- /** The FHE public key (hex-encoded). */
118
- publicKey: string;
119
- /** Contract addresses the credential authorizes decryption for. */
120
- contractAddresses: `0x${string}`[];
121
- /** Unix timestamp (seconds) when the credential becomes valid. */
122
- startTimestamp: number;
123
- /** Number of days the credential remains valid. Default: 1. */
124
- durationDays?: number;
137
+ /** The FHE public key (hex-encoded). */
138
+ publicKey: `0x${string}`;
139
+ /** Contract addresses the credential authorizes decryption for. */
140
+ contractAddresses: Address$1[];
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;
125
145
  }
126
146
  /**
127
147
  * Create EIP-712 typed data for signing an FHE decrypt credential.
@@ -139,20 +159,21 @@ interface CreateEIP712Params {
139
159
  * });
140
160
  * ```
141
161
  */
142
- declare function useCreateEIP712(): _tanstack_react_query.UseMutationResult<EIP712TypedData, Error, CreateEIP712Params, unknown>;
143
-
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
144
165
  /** Parameters for {@link useCreateDelegatedUserDecryptEIP712}. */
145
166
  interface CreateDelegatedUserDecryptEIP712Params {
146
- /** The FHE public key (hex-encoded). */
147
- publicKey: string;
148
- /** Contract addresses the credential authorizes decryption for. */
149
- contractAddresses: Address[];
150
- /** Address of the wallet that delegated decrypt authority. */
151
- delegatorAddress: string;
152
- /** Unix timestamp (seconds) when the credential becomes valid. */
153
- startTimestamp: number;
154
- /** Number of days the credential remains valid. Default: 1. */
155
- durationDays?: number;
167
+ /** The FHE public key (hex-encoded). */
168
+ publicKey: `0x${string}`;
169
+ /** Contract addresses the credential authorizes decryption for. */
170
+ contractAddresses: Address$1[];
171
+ /** Address of the wallet that delegated decrypt authority. */
172
+ delegatorAddress: Address$1;
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;
156
177
  }
157
178
  /**
158
179
  * Create EIP-712 typed data for a delegated user decrypt credential.
@@ -171,13 +192,14 @@ interface CreateDelegatedUserDecryptEIP712Params {
171
192
  * });
172
193
  * ```
173
194
  */
174
- declare function useCreateDelegatedUserDecryptEIP712(): _tanstack_react_query.UseMutationResult<Readonly<{
175
- types: _zama_fhe_relayer_sdk_web.KmsDelegatedUserDecryptEIP712TypesType;
176
- primaryType: "DelegatedUserDecryptRequestVerification";
177
- domain: _zama_fhe_relayer_sdk_web.KmsEIP712DomainType;
178
- 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;
179
200
  }>, Error, CreateDelegatedUserDecryptEIP712Params, unknown>;
180
-
201
+ //#endregion
202
+ //#region src/relayer/use-delegated-user-decrypt.d.ts
181
203
  /**
182
204
  * Decrypt FHE ciphertext handles using delegated user credentials.
183
205
  * Returns a map of handle → plaintext bigint.
@@ -191,8 +213,9 @@ declare function useCreateDelegatedUserDecryptEIP712(): _tanstack_react_query.Us
191
213
  * // decrypt.data => { "0xHandle1": 1000n }
192
214
  * ```
193
215
  */
194
- declare function useDelegatedUserDecrypt(): _tanstack_react_query.UseMutationResult<Record<string, bigint>, Error, DelegatedUserDecryptParams, unknown>;
195
-
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
196
219
  /**
197
220
  * Submit a ZK proof for on-chain verification.
198
221
  * Returns the input proof bytes for use in contract calls.
@@ -206,38 +229,19 @@ declare function useDelegatedUserDecrypt(): _tanstack_react_query.UseMutationRes
206
229
  * // verify.data => Uint8Array (input proof bytes)
207
230
  * ```
208
231
  */
209
- declare function useRequestZKProofVerification(): _tanstack_react_query.UseMutationResult<Readonly<{
210
- handles: Uint8Array[];
211
- inputProof: Uint8Array;
212
- }>, Error, ZKProofLike, unknown>;
213
-
214
- /**
215
- * Query key factory for the FHE public key query.
216
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
217
- */
218
- declare const publicKeyQueryKeys: {
219
- /** Match the public key query. */
220
- readonly all: readonly ["publicKey"];
221
- };
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
222
238
  /** Shape of the FHE public key data returned by the relayer. */
223
239
  interface PublicKeyData {
224
- /** Unique identifier for this public key version. */
225
- publicKeyId: string;
226
- /** The raw FHE public key bytes. */
227
- publicKey: Uint8Array;
240
+ /** Unique identifier for this public key version. */
241
+ publicKeyId: string;
242
+ /** The raw FHE public key bytes. */
243
+ publicKey: Uint8Array;
228
244
  }
229
- type PublicKeyResult = PublicKeyData | null;
230
- /**
231
- * TanStack Query options factory for the FHE public key.
232
- *
233
- * @param sdk - A `ZamaSDK` instance.
234
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
235
- */
236
- declare function publicKeyQueryOptions(sdk: ZamaSDK): {
237
- readonly queryKey: readonly ["publicKey"];
238
- readonly queryFn: () => Promise<PublicKeyResult>;
239
- readonly staleTime: number;
240
- };
241
245
  /**
242
246
  * Fetch the FHE network public key from the relayer.
243
247
  * Cached indefinitely since the key does not change during a session.
@@ -250,38 +254,19 @@ declare function publicKeyQueryOptions(sdk: ZamaSDK): {
250
254
  * // publicKey?.publicKeyId, publicKey?.publicKey
251
255
  * ```
252
256
  */
253
- declare function usePublicKey(): _tanstack_react_query.UseQueryResult<PublicKeyResult, Error>;
254
-
255
- /**
256
- * Query key factory for FHE public params queries.
257
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
258
- */
259
- declare const publicParamsQueryKeys: {
260
- /** Match all public params queries. */
261
- readonly all: readonly ["publicParams"];
262
- /** Match public params query for a specific bit size. */
263
- readonly bits: (bits: number) => readonly ["publicParams", number];
264
- };
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
265
263
  /** Shape of the FHE public parameters returned by the relayer. */
266
264
  interface PublicParamsData {
267
- /** The raw public parameters bytes (WASM-ready). */
268
- publicParams: Uint8Array;
269
- /** Unique identifier for this public params version. */
270
- publicParamsId: string;
265
+ /** The raw public parameters bytes (WASM-ready). */
266
+ publicParams: Uint8Array;
267
+ /** Unique identifier for this public params version. */
268
+ publicParamsId: string;
271
269
  }
272
- type PublicParamsResult = PublicParamsData | null;
273
- /**
274
- * TanStack Query options factory for FHE public parameters.
275
- *
276
- * @param sdk - A `ZamaSDK` instance.
277
- * @param bits - The FHE bit size to fetch parameters for (e.g. 2048).
278
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
279
- */
280
- declare function publicParamsQueryOptions(sdk: ZamaSDK, bits: number): {
281
- readonly queryKey: readonly ["publicParams", number];
282
- readonly queryFn: () => Promise<PublicParamsResult>;
283
- readonly staleTime: number;
284
- };
285
270
  /**
286
271
  * Fetch FHE public parameters for a given bit size from the relayer.
287
272
  * Cached indefinitely since parameters do not change during a session.
@@ -295,33 +280,117 @@ declare function publicParamsQueryOptions(sdk: ZamaSDK, bits: number): {
295
280
  * // params?.publicParams, params?.publicParamsId
296
281
  * ```
297
282
  */
298
- declare function usePublicParams(bits: number): _tanstack_react_query.UseQueryResult<PublicParamsResult, Error>;
299
-
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
300
341
  /**
301
342
  * Look up a single cached decrypted value by its handle.
302
343
  * Values are populated automatically when useUserDecrypt or usePublicDecrypt succeed.
303
344
  * You can also populate manually via queryClient.setQueryData(decryptionKeys.value(handle), value).
304
345
  */
305
- declare function useUserDecryptedValue(handle: string | undefined): _tanstack_react_query.UseQueryResult<bigint, Error>;
306
-
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
307
349
  /**
308
350
  * Look up multiple cached decrypted values by their handles.
309
351
  * Values are populated automatically when useUserDecrypt or usePublicDecrypt succeed.
310
352
  */
311
- declare function useUserDecryptedValues(handles: string[]): {
312
- data: Record<string, bigint | undefined>;
313
- 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>[];
314
356
  };
315
-
357
+ //#endregion
358
+ //#region src/relayer/decryption-cache.d.ts
316
359
  /**
317
360
  * Query key helpers for the shared decryption cache.
318
361
  * Used by useUserDecrypt/usePublicDecrypt to populate,
319
362
  * and by useUserDecryptedValue to read.
320
363
  */
321
364
  declare const decryptionKeys: {
322
- value: (handle: string) => readonly ["decryptedValue", string];
365
+ value: (handle: Handle$1, contractAddress?: Address$1) => readonly ["zama.decryption", {
366
+ readonly contractAddress?: `0x${string}` | undefined;
367
+ readonly handle: string;
368
+ }];
323
369
  };
324
-
370
+ //#endregion
371
+ //#region src/token/use-token.d.ts
372
+ /** Base configuration shared by all mutation hooks that need a Token instance. */
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;
378
+ }
379
+ /**
380
+ * Get a {@link Token} instance, memoized by address pair.
381
+ * Reads signer and storage from the nearest {@link ZamaProvider}.
382
+ *
383
+ * @param config - Token and optional wrapper addresses.
384
+ * @returns A memoized `Token` instance.
385
+ *
386
+ * @example
387
+ * ```tsx
388
+ * const token = useToken({ tokenAddress: "0xToken", wrapperAddress: "0xWrapper" });
389
+ * ```
390
+ */
391
+ declare function useToken(config: UseZamaConfig): _zama_fhe_sdk0.Token;
392
+ //#endregion
393
+ //#region src/token/use-readonly-token.d.ts
325
394
  /**
326
395
  * Get a {@link ReadonlyToken} instance, memoized by address.
327
396
  * Supports balance queries, ERC-165 checks, and authorization — no wrapper needed.
@@ -336,34 +405,479 @@ declare const decryptionKeys: {
336
405
  * // token.balanceOf(), token.isConfidential(), etc.
337
406
  * ```
338
407
  */
339
- declare function useReadonlyToken(address: Address): _zama_fhe_sdk.ReadonlyToken;
340
-
341
- /** Parameters passed to the `mutate` function of {@link useConfidentialTransfer}. */
342
- interface ConfidentialTransferParams {
343
- /** Recipient address. */
344
- to: Address;
345
- /** Amount to transfer (plaintext — encrypted automatically). */
346
- amount: bigint;
408
+ declare function useReadonlyToken(address: Address$1): _zama_fhe_sdk0.ReadonlyToken;
409
+ //#endregion
410
+ //#region src/token/use-confidential-balance.d.ts
411
+ /** Configuration for {@link useConfidentialBalance}. */
412
+ interface UseConfidentialBalanceConfig {
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;
347
417
  }
348
- /** Configuration for {@link useConfidentialTransfer}. */
349
- interface UseConfidentialTransferConfig extends UseZamaConfig {
350
- /**
351
- * When `true`, optimistically subtracts the transfer amount from cached balance
352
- * before the transaction confirms. Rolls back on error.
353
- * @defaultValue false
354
- */
355
- optimistic?: boolean;
418
+ /** Query options for the decrypt phase of {@link useConfidentialBalance}. */
419
+ type UseConfidentialBalanceOptions = Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">;
420
+ /**
421
+ * Declarative hook to read the connected wallet's confidential token balance.
422
+ * Uses two-phase polling: cheaply polls the encrypted handle, then only
423
+ * decrypts when the handle changes (new balance).
424
+ *
425
+ * @param config - Token address and optional polling interval.
426
+ * @param options - React Query options forwarded to the decrypt query.
427
+ * @returns The decrypt query result plus `handleQuery` for Phase 1 state.
428
+ *
429
+ * @example
430
+ * ```tsx
431
+ * const { data: balance, isLoading, handleQuery } = useConfidentialBalance({
432
+ * tokenAddress: "0x...",
433
+ * });
434
+ * ```
435
+ */
436
+ declare function useConfidentialBalance(config: UseConfidentialBalanceConfig, options?: UseConfidentialBalanceOptions): {
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>;
464
+ } | {
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>;
492
+ } | {
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>;
520
+ } | {
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>;
548
+ } | {
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>;
576
+ } | {
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>;
604
+ };
605
+ //#endregion
606
+ //#region src/token/use-confidential-balances.d.ts
607
+ /** Configuration for {@link useConfidentialBalances}. */
608
+ interface UseConfidentialBalancesConfig {
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;
356
615
  }
616
+ /** Query options for the decrypt phase of {@link useConfidentialBalances}. */
617
+ type UseConfidentialBalancesOptions = Omit<UseQueryOptions<ConfidentialBalancesData$1, Error>, "queryKey" | "queryFn">;
357
618
  /**
358
- * TanStack Query mutation options factory for confidential transfer.
619
+ * Declarative hook to read multiple confidential token balances in batch.
620
+ * Uses two-phase polling: cheaply polls encrypted handles, then only
621
+ * decrypts when any handle changes.
622
+ *
623
+ * Returns partial results when some tokens fail — successful balances are
624
+ * always returned alongside per-token error information.
625
+ *
626
+ * @param config - Token addresses and optional polling interval.
627
+ * @param options - React Query options forwarded to the decrypt query.
628
+ * @returns The decrypt query result plus `handlesQuery` for Phase 1 state.
359
629
  *
360
- * @param token - A `Token` instance.
361
- * @returns Mutation options with `mutationKey` and `mutationFn`.
630
+ * @example
631
+ * ```tsx
632
+ * const { data } = useConfidentialBalances({
633
+ * tokenAddresses: ["0xTokenA", "0xTokenB"],
634
+ * });
635
+ * const balance = data?.balances.get("0xTokenA");
636
+ * if (data?.isPartialError) {
637
+ * // some tokens failed — check data.errors
638
+ * }
639
+ * ```
362
640
  */
363
- declare function confidentialTransferMutationOptions(token: Token): {
364
- mutationKey: readonly ["confidentialTransfer", `0x${string}`];
365
- mutationFn: ({ to, amount }: ConfidentialTransferParams) => Promise<TransactionResult>;
641
+ declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions): {
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>;
669
+ } | {
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>;
697
+ } | {
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>;
725
+ } | {
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>;
753
+ } | {
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>;
781
+ } | {
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>;
366
809
  };
810
+ //#endregion
811
+ //#region src/token/use-allow.d.ts
812
+ /**
813
+ * Pre-authorize FHE decrypt credentials for a list of token addresses.
814
+ * A single wallet signature covers all addresses, so subsequent decrypt
815
+ * operations on any of these tokens reuse cached credentials.
816
+ *
817
+ * @example
818
+ * ```tsx
819
+ * const { mutateAsync: allow, isPending } = useAllow();
820
+ * // Call allow(allTokenAddresses) before any individual reveal
821
+ * ```
822
+ */
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
826
+ /**
827
+ * Check whether a session signature is cached for the connected wallet.
828
+ * Returns `true` if decrypt operations can proceed without a wallet prompt.
829
+ *
830
+ * @example
831
+ * ```tsx
832
+ * const { data: allowed } = useIsAllowed();
833
+ * ```
834
+ */
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
+ }
367
881
  /**
368
882
  * Encrypt and send a confidential transfer. Invalidates balance caches on success.
369
883
  *
@@ -394,46 +908,62 @@ declare function confidentialTransferMutationOptions(token: Token): {
394
908
  * );
395
909
  * ```
396
910
  */
397
- declare function useConfidentialTransfer(config: UseConfidentialTransferConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, `0x${string}`>;
398
-
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
914
+ /**
915
+ * Operator transfer on behalf of another address. Caller must be an approved operator.
916
+ * Invalidates balance caches on success.
917
+ *
918
+ * @param config - Token address (and optional wrapper) identifying the token.
919
+ * @param options - React Query mutation options.
920
+ *
921
+ * @example
922
+ * ```tsx
923
+ * const transferFrom = useConfidentialTransferFrom({ tokenAddress: "0x..." });
924
+ * transferFrom.mutate({ from: "0xOwner", to: "0xRecipient", amount: 500n });
925
+ * ```
926
+ */
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
399
930
  /**
400
- * Query key factory for confidential approval queries.
401
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
931
+ * Set operator approval for a confidential token. Defaults to 1 hour.
932
+ *
933
+ * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
934
+ * - {@link SigningRejectedError} — user rejected the wallet prompt
935
+ * - {@link TransactionRevertedError} — on-chain transaction reverted
936
+ *
937
+ * @param config - Token address (and optional wrapper) identifying the token.
938
+ * @param options - React Query mutation options.
939
+ *
940
+ * @example
941
+ * ```tsx
942
+ * const approve = useConfidentialApprove({ tokenAddress: "0x..." });
943
+ * approve.mutate({ spender: "0xOperator" });
944
+ * ```
402
945
  */
403
- declare const confidentialIsApprovedQueryKeys: {
404
- /** Match all approval queries. */
405
- readonly all: readonly ["confidentialIsApproved"];
406
- /** Match approval queries for a specific token. */
407
- readonly token: (tokenAddress: string) => readonly ["confidentialIsApproved", string];
408
- /** Match approval queries for a specific token + spender pair. */
409
- readonly spender: (tokenAddress: string, spender: string) => readonly ["confidentialIsApproved", string, string];
410
- };
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
411
949
  /** Configuration for {@link useConfidentialIsApproved}. */
412
950
  interface UseConfidentialIsApprovedConfig extends UseZamaConfig {
413
- /** Address to check approval for. Pass `undefined` to disable the query. */
414
- spender: Address | undefined;
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;
415
955
  }
416
956
  /** Configuration for {@link useConfidentialIsApprovedSuspense}. */
417
957
  interface UseConfidentialIsApprovedSuspenseConfig extends UseZamaConfig {
418
- /** Address to check approval for. */
419
- spender: Address;
958
+ /** Address to check approval for. */
959
+ spender: Address$1;
960
+ /** Token holder address. Defaults to the connected wallet. */
961
+ holder?: Address$1;
420
962
  }
421
963
  /**
422
- * TanStack Query options factory for confidential approval check.
423
- *
424
- * @param token - A `Token` instance.
425
- * @param spender - Address to check approval for.
426
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
427
- */
428
- declare function confidentialIsApprovedQueryOptions(token: Token, spender: Address): {
429
- readonly queryKey: readonly ["confidentialIsApproved", string, string];
430
- readonly queryFn: () => Promise<boolean>;
431
- readonly staleTime: 30000;
432
- };
433
- /**
434
- * 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).
435
965
  *
436
- * @param config - Token address and spender to check.
966
+ * @param config - Token address, spender, and optional holder to check.
437
967
  * @param options - React Query options (forwarded to `useQuery`).
438
968
  * @returns Query result with `data: boolean`.
439
969
  *
@@ -442,15 +972,16 @@ declare function confidentialIsApprovedQueryOptions(token: Token, spender: Addre
442
972
  * const { data: isApproved } = useConfidentialIsApproved({
443
973
  * tokenAddress: "0xToken",
444
974
  * spender: "0xSpender",
975
+ * holder: "0xHolder", // optional
445
976
  * });
446
977
  * ```
447
978
  */
448
- 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>;
449
980
  /**
450
981
  * Suspense variant of {@link useConfidentialIsApproved}.
451
982
  * Suspends rendering until the approval check resolves.
452
983
  *
453
- * @param config - Token address and spender to check.
984
+ * @param config - Token address, spender, and optional holder to check.
454
985
  * @returns Suspense query result with `data: boolean`.
455
986
  *
456
987
  * @example
@@ -458,39 +989,22 @@ declare function useConfidentialIsApproved(config: UseConfidentialIsApprovedConf
458
989
  * const { data: isApproved } = useConfidentialIsApprovedSuspense({
459
990
  * tokenAddress: "0xToken",
460
991
  * spender: "0xSpender",
992
+ * holder: "0xHolder", // optional
461
993
  * });
462
994
  * ```
463
995
  */
464
- declare function useConfidentialIsApprovedSuspense(config: UseConfidentialIsApprovedSuspenseConfig): _tanstack_react_query.UseSuspenseQueryResult<boolean, Error>;
465
-
466
- /** Parameters passed to the `mutate` function of {@link useShield}. */
467
- interface ShieldParams {
468
- /** Amount of underlying ERC-20 tokens to wrap. */
469
- amount: bigint;
470
- /** Optional fee amount (for native ETH wrapping with fees). */
471
- fees?: bigint;
472
- /** ERC-20 approval strategy: `"exact"` (default), `"max"`, or `"skip"`. */
473
- approvalStrategy?: "max" | "exact" | "skip";
474
- }
996
+ declare function useConfidentialIsApprovedSuspense(config: UseConfidentialIsApprovedSuspenseConfig): _tanstack_react_query0.UseSuspenseQueryResult<boolean, Error>;
997
+ //#endregion
998
+ //#region src/token/use-shield.d.ts
475
999
  /** Configuration for {@link useShield}. */
476
1000
  interface UseShieldConfig extends UseZamaConfig {
477
- /**
478
- * When `true`, optimistically adds the wrap amount to the cached confidential balance
479
- * before the transaction confirms. Rolls back on error.
480
- * @defaultValue false
481
- */
482
- optimistic?: boolean;
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;
483
1007
  }
484
- /**
485
- * TanStack Query mutation options factory for shield.
486
- *
487
- * @param token - A `Token` instance.
488
- * @returns Mutation options with `mutationKey` and `mutationFn`.
489
- */
490
- declare function shieldMutationOptions(token: Token): {
491
- mutationKey: readonly ["shield", `0x${string}`];
492
- mutationFn: ({ amount, fees, approvalStrategy }: ShieldParams) => Promise<TransactionResult>;
493
- };
494
1008
  /**
495
1009
  * Shield public ERC-20 tokens into confidential tokens.
496
1010
  * Handles ERC-20 approval automatically. Invalidates balance caches on success.
@@ -510,25 +1024,9 @@ declare function shieldMutationOptions(token: Token): {
510
1024
  * shield.mutate({ amount: 1000n });
511
1025
  * ```
512
1026
  */
513
- declare function useShield(config: UseShieldConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ShieldParams, `0x${string}`>;
514
-
515
- /** Parameters passed to the `mutate` function of {@link useShieldETH}. */
516
- interface ShieldETHParams {
517
- /** Amount of ETH to wrap (in wei). */
518
- amount: bigint;
519
- /** ETH value to send with the transaction. Defaults to `amount`. */
520
- value?: bigint;
521
- }
522
- /**
523
- * TanStack Query mutation options factory for shield ETH.
524
- *
525
- * @param token - A `Token` instance.
526
- * @returns Mutation options with `mutationKey` and `mutationFn`.
527
- */
528
- declare function shieldETHMutationOptions(token: Token): {
529
- mutationKey: readonly ["shieldETH", `0x${string}`];
530
- mutationFn: ({ amount, value }: ShieldETHParams) => Promise<TransactionResult>;
531
- };
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
532
1030
  /**
533
1031
  * Shield native ETH into confidential tokens.
534
1032
  * Invalidates balance caches on success.
@@ -542,23 +1040,9 @@ declare function shieldETHMutationOptions(token: Token): {
542
1040
  * shieldETH.mutate({ amount: 1000000000000000000n }); // 1 ETH
543
1041
  * ```
544
1042
  */
545
- declare function useShieldETH(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldETHParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ShieldETHParams, `0x${string}`>;
546
-
547
- /** Parameters passed to the `mutate` function of {@link useUnwrap}. */
548
- interface UnwrapParams {
549
- /** Amount to unwrap (plaintext — encrypted automatically). */
550
- amount: bigint;
551
- }
552
- /**
553
- * TanStack Query mutation options factory for unwrap.
554
- *
555
- * @param token - A `Token` instance.
556
- * @returns Mutation options with `mutationKey` and `mutationFn`.
557
- */
558
- declare function unwrapMutationOptions(token: Token): {
559
- mutationKey: readonly ["unwrap", `0x${string}`];
560
- mutationFn: ({ amount }: UnwrapParams) => Promise<TransactionResult>;
561
- };
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
562
1046
  /**
563
1047
  * Request an unwrap for a specific amount. Encrypts the amount first.
564
1048
  * Call {@link useFinalizeUnwrap} after the request is processed on-chain,
@@ -573,23 +1057,26 @@ declare function unwrapMutationOptions(token: Token): {
573
1057
  * unwrap.mutate({ amount: 500n });
574
1058
  * ```
575
1059
  */
576
- declare function useUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, UnwrapParams, `0x${string}`>;
577
-
578
- /** Parameters passed to the `mutate` function of {@link useFinalizeUnwrap}. */
579
- interface FinalizeUnwrapParams {
580
- /** Encrypted amount handle from the UnwrapRequested event. */
581
- burnAmountHandle: Address;
582
- }
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
583
1063
  /**
584
- * TanStack Query mutation options factory for finalize-unwrap.
1064
+ * Request an unwrap for the entire confidential balance.
1065
+ * Uses the on-chain balance handle directly (no encryption needed).
1066
+ * Call {@link useFinalizeUnwrap} after processing, or use {@link useUnshieldAll} for single-call orchestration.
1067
+ *
1068
+ * @param config - Token address (and optional wrapper) identifying the token.
1069
+ * @param options - React Query mutation options.
585
1070
  *
586
- * @param token - A `Token` instance.
587
- * @returns Mutation options with `mutationKey` and `mutationFn`.
1071
+ * @example
1072
+ * ```tsx
1073
+ * const unwrapAll = useUnwrapAll({ tokenAddress: "0x..." });
1074
+ * unwrapAll.mutate();
1075
+ * ```
588
1076
  */
589
- declare function finalizeUnwrapMutationOptions(token: Token): {
590
- mutationKey: readonly ["finalizeUnwrap", `0x${string}`];
591
- mutationFn: ({ burnAmountHandle }: FinalizeUnwrapParams) => Promise<TransactionResult>;
592
- };
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
593
1080
  /**
594
1081
  * Complete an unwrap by providing the public decryption proof.
595
1082
  * Call this after an unwrap request has been processed on-chain.
@@ -603,37 +1090,75 @@ declare function finalizeUnwrapMutationOptions(token: Token): {
603
1090
  * finalize.mutate({ burnAmountHandle: event.encryptedAmount });
604
1091
  * ```
605
1092
  */
606
- declare function useFinalizeUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, FinalizeUnwrapParams, `0x${string}`>;
607
-
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
608
1096
  /**
609
- * Query key factory for underlying ERC-20 allowance queries.
610
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1097
+ * Unshield a specific amount and finalize in one call.
1098
+ * Orchestrates: unwrap wait for receipt → parse event → finalize.
1099
+ *
1100
+ * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
1101
+ * - {@link SigningRejectedError} — user rejected the wallet prompt
1102
+ * - {@link EncryptionFailedError} — FHE encryption failed during unwrap
1103
+ * - {@link DecryptionFailedError} — public decryption failed during finalize
1104
+ * - {@link TransactionRevertedError} — on-chain transaction reverted
1105
+ *
1106
+ * @param config - Token and wrapper addresses.
1107
+ * @param options - React Query mutation options.
1108
+ *
1109
+ * @example
1110
+ * ```tsx
1111
+ * const unshield = useUnshield({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1112
+ * unshield.mutate({ amount: 500n });
1113
+ * ```
611
1114
  */
612
- declare const underlyingAllowanceQueryKeys: {
613
- /** Match all underlying allowance queries. */
614
- readonly all: readonly ["underlyingAllowance"];
615
- /** Match allowance query for a specific token + wrapper pair. */
616
- readonly token: (tokenAddress: string, wrapper: string) => readonly ["underlyingAllowance", string, string];
617
- };
618
- /** Configuration for {@link useUnderlyingAllowance}. */
619
- interface UseUnderlyingAllowanceConfig {
620
- /** Address of the underlying ERC-20 token. */
621
- tokenAddress: Address;
622
- /** Address of the wrapper contract (the spender). */
623
- wrapperAddress: Address;
624
- }
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
1118
+ /**
1119
+ * Unshield the entire balance and finalize in one call.
1120
+ * Orchestrates: unwrapAll → wait for receipt → parse event → finalize.
1121
+ *
1122
+ * @param config - Token and wrapper addresses.
1123
+ * @param options - React Query mutation options.
1124
+ *
1125
+ * @example
1126
+ * ```tsx
1127
+ * const unshieldAll = useUnshieldAll({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1128
+ * unshieldAll.mutate();
1129
+ * ```
1130
+ */
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
625
1134
  /**
626
- * TanStack Query options factory for underlying ERC-20 allowance.
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.
627
1145
  *
628
- * @param token - A `ReadonlyToken` instance.
629
- * @param wrapperAddress - Address of the wrapper contract (the spender).
630
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1146
+ * @example
1147
+ * ```tsx
1148
+ * const resumeUnshield = useResumeUnshield({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1149
+ * resumeUnshield.mutate({ unwrapTxHash: "0xabc..." });
1150
+ * ```
631
1151
  */
632
- declare function underlyingAllowanceQueryOptions(token: ReadonlyToken, wrapperAddress: Address): {
633
- readonly queryKey: readonly ["underlyingAllowance", string, string];
634
- readonly queryFn: () => Promise<bigint>;
635
- readonly staleTime: 30000;
636
- };
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
1155
+ /** Configuration for {@link useUnderlyingAllowance}. */
1156
+ interface UseUnderlyingAllowanceConfig {
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;
1161
+ }
637
1162
  /**
638
1163
  * Read the underlying ERC-20 allowance granted to the wrapper contract.
639
1164
  * Useful to check if an approval is needed before shielding.
@@ -645,12 +1170,12 @@ declare function underlyingAllowanceQueryOptions(token: ReadonlyToken, wrapperAd
645
1170
  * @example
646
1171
  * ```tsx
647
1172
  * const { data: allowance } = useUnderlyingAllowance({
648
- * tokenAddress: "0xUnderlying",
1173
+ * tokenAddress: "0xConfidentialToken",
649
1174
  * wrapperAddress: "0xWrapper",
650
1175
  * });
651
1176
  * ```
652
1177
  */
653
- 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>;
654
1179
  /**
655
1180
  * Suspense variant of {@link useUnderlyingAllowance}.
656
1181
  * Suspends rendering until the allowance is loaded.
@@ -661,107 +1186,28 @@ declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, op
661
1186
  * @example
662
1187
  * ```tsx
663
1188
  * const { data: allowance } = useUnderlyingAllowanceSuspense({
664
- * tokenAddress: "0xUnderlying",
1189
+ * tokenAddress: "0xConfidentialToken",
665
1190
  * wrapperAddress: "0xWrapper",
666
1191
  * });
667
1192
  * ```
668
1193
  */
669
- declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceConfig): _tanstack_react_query.UseSuspenseQueryResult<bigint, Error>;
670
-
671
- /**
672
- * Query key factories for confidential balance queries.
673
- * Use with `queryClient.invalidateQueries()` / `resetQueries()` / `removeQueries()`.
674
- *
675
- * @example
676
- * ```ts
677
- * // Invalidate all balance queries
678
- * queryClient.invalidateQueries({ queryKey: confidentialBalanceQueryKeys.all });
679
- *
680
- * // Reset balance for a specific token + owner
681
- * queryClient.resetQueries({
682
- * queryKey: confidentialBalanceQueryKeys.owner("0xToken", "0xOwner"),
683
- * });
684
- * ```
685
- */
686
- declare const confidentialBalanceQueryKeys: {
687
- /** Match all single-token balance queries. */
688
- readonly all: readonly ["confidentialBalance"];
689
- /** Match balance queries for a specific token (any owner). */
690
- readonly token: (tokenAddress: string) => readonly ["confidentialBalance", string];
691
- /** Match balance query for a specific token + owner. */
692
- readonly owner: (tokenAddress: string, owner: string) => readonly ["confidentialBalance", string, string];
693
- };
694
- /**
695
- * Query key factory for batch balance queries (multiple tokens).
696
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
697
- */
698
- declare const confidentialBalancesQueryKeys: {
699
- /** Match all batch balance queries. */
700
- readonly all: readonly ["confidentialBalances"];
701
- /** Match batch balance query for a specific token set + owner. */
702
- readonly tokens: (tokenAddresses: string[], owner: string) => readonly ["confidentialBalances", string[], string];
703
- };
704
- /**
705
- * Query key factory for encrypted handle queries (Phase 1 of two-phase polling).
706
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
707
- */
708
- declare const confidentialHandleQueryKeys: {
709
- /** Match all single-token handle queries. */
710
- readonly all: readonly ["confidentialHandle"];
711
- /** Match handle queries for a specific token (any owner). */
712
- readonly token: (tokenAddress: string) => readonly ["confidentialHandle", string];
713
- /** Match handle query for a specific token + owner. */
714
- readonly owner: (tokenAddress: string, owner: string) => readonly ["confidentialHandle", string, string];
715
- };
716
- /**
717
- * Query key factory for batch encrypted handle queries (Phase 1, multiple tokens).
718
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
719
- */
720
- declare const confidentialHandlesQueryKeys: {
721
- /** Match all batch handle queries. */
722
- readonly all: readonly ["confidentialHandles"];
723
- /** Match batch handle query for a specific token set + owner. */
724
- readonly tokens: (tokenAddresses: string[], owner: string) => readonly ["confidentialHandles", string[], string];
725
- };
726
-
727
- /**
728
- * Query key factory for wrapper discovery queries.
729
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
730
- */
731
- declare const wrapperDiscoveryQueryKeys: {
732
- /** Match all wrapper discovery queries. */
733
- readonly all: readonly ["wrapperDiscovery"];
734
- /** Match wrapper discovery queries for a specific token. */
735
- readonly token: (tokenAddress: string) => readonly ["wrapperDiscovery", string];
736
- /** Match wrapper discovery query for a specific token + coordinator pair. */
737
- readonly tokenCoordinator: (tokenAddress: string, coordinatorAddress: string) => readonly ["wrapperDiscovery", string, string];
738
- };
1194
+ declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceConfig): _tanstack_react_query0.UseSuspenseQueryResult<bigint, Error>;
1195
+ //#endregion
1196
+ //#region src/token/use-wrapper-discovery.d.ts
739
1197
  /** Configuration for {@link useWrapperDiscovery}. */
740
1198
  interface UseWrapperDiscoveryConfig {
741
- /** Address of the underlying ERC-20 token. */
742
- tokenAddress: Address;
743
- /** Address of the wrapper coordinator. Pass `undefined` to disable the query. */
744
- 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;
745
1203
  }
746
1204
  /** Configuration for {@link useWrapperDiscoverySuspense}. */
747
1205
  interface UseWrapperDiscoverySuspenseConfig {
748
- /** Address of the underlying ERC-20 token. */
749
- tokenAddress: Address;
750
- /** Address of the wrapper coordinator. */
751
- coordinatorAddress: Address;
1206
+ /** Address of the underlying ERC-20 token. */
1207
+ tokenAddress: Address$1;
1208
+ /** Address of the wrapper coordinator. */
1209
+ coordinatorAddress: Address$1;
752
1210
  }
753
- /**
754
- * TanStack Query options factory for wrapper discovery.
755
- *
756
- * @param token - A `ReadonlyToken` instance.
757
- * @param coordinatorAddress - Address of the wrapper coordinator.
758
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
759
- */
760
- declare function wrapperDiscoveryQueryOptions(token: ReadonlyToken, coordinatorAddress: Address): {
761
- readonly queryKey: readonly ["wrapperDiscovery", string, string];
762
- readonly queryFn: () => Promise<`0x${string}` | null>;
763
- readonly staleTime: number;
764
- };
765
1211
  /**
766
1212
  * Discover the wrapper contract for an ERC-20 token.
767
1213
  * Returns the wrapper address if one exists, or `null` if not.
@@ -779,7 +1225,7 @@ declare function wrapperDiscoveryQueryOptions(token: ReadonlyToken, coordinatorA
779
1225
  * });
780
1226
  * ```
781
1227
  */
782
- 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>;
783
1229
  /**
784
1230
  * Suspense variant of {@link useWrapperDiscovery}.
785
1231
  * Suspends rendering until the wrapper address is resolved.
@@ -795,50 +1241,91 @@ declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?
795
1241
  * });
796
1242
  * ```
797
1243
  */
798
- declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig): UseSuspenseQueryResult<Address | null, Error>;
799
-
1244
+ declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig): _tanstack_react_query0.UseSuspenseQueryResult<`0x${string}` | null, Error>;
1245
+ //#endregion
1246
+ //#region src/token/use-metadata.d.ts
800
1247
  /**
801
- * Query key factory for ERC-165 confidential interface checks.
802
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1248
+ * Read ERC-20 token metadata (name, symbol, decimals).
1249
+ * Fetches all three in parallel. Cached indefinitely since metadata is immutable.
1250
+ *
1251
+ * @param tokenAddress - Address of the token contract.
1252
+ * @param options - React Query options (forwarded to `useQuery`).
1253
+ * @returns Query result with `data: TokenMetadata`.
1254
+ *
1255
+ * @example
1256
+ * ```tsx
1257
+ * const { data: metadata } = useMetadata("0xToken");
1258
+ * // metadata?.name, metadata?.symbol, metadata?.decimals
1259
+ * ```
803
1260
  */
804
- declare const isConfidentialQueryKeys: {
805
- /** Match all confidential interface queries. */
806
- readonly all: readonly ["isConfidential"];
807
- /** Match confidential interface query for a specific token. */
808
- readonly token: (tokenAddress: string) => readonly ["isConfidential", string];
809
- };
1261
+ declare function useMetadata(tokenAddress: Address$1, options?: Omit<UseQueryOptions<TokenMetadata, Error>, "queryKey" | "queryFn">): _tanstack_react_query0.UseQueryResult<TokenMetadata, Error>;
810
1262
  /**
811
- * Query key factory for ERC-165 wrapper interface checks.
812
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
1263
+ * Suspense variant of {@link useMetadata}.
1264
+ * Suspends rendering until metadata is loaded.
1265
+ *
1266
+ * @param tokenAddress - Address of the token contract.
1267
+ * @returns Suspense query result with `data: TokenMetadata`.
1268
+ *
1269
+ * @example
1270
+ * ```tsx
1271
+ * const { data: metadata } = useMetadataSuspense("0xToken");
1272
+ * ```
813
1273
  */
814
- declare const isWrapperQueryKeys: {
815
- /** Match all wrapper interface queries. */
816
- readonly all: readonly ["isWrapper"];
817
- /** Match wrapper interface query for a specific token. */
818
- readonly token: (tokenAddress: string) => readonly ["isWrapper", string];
819
- };
1274
+ declare function useMetadataSuspense(tokenAddress: Address$1): _tanstack_react_query0.UseSuspenseQueryResult<TokenMetadata, Error>;
1275
+ //#endregion
1276
+ //#region src/token/use-activity-feed.d.ts
1277
+ /** Configuration for {@link useActivityFeed}. */
1278
+ interface UseActivityFeedConfig {
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;
1287
+ }
820
1288
  /**
821
- * TanStack Query options factory for ERC-165 confidential interface check.
1289
+ * Two-phase activity feed hook.
1290
+ * Phase 1: Instantly parses raw logs into classified {@link ActivityItem}s (sync, cheap).
1291
+ * Phase 2: Batch-decrypts encrypted transfer amounts via the relayer (async).
1292
+ *
1293
+ * The wallet provides logs (from its own provider — viem, ethers, etc.)
1294
+ * and this hook normalizes + decrypts them.
1295
+ *
1296
+ * @param config - Token address, user address, raw logs, and decrypt option.
1297
+ * @returns Query result with `data: ActivityItem[]`.
822
1298
  *
823
- * @param token - A `ReadonlyToken` instance.
824
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1299
+ * @example
1300
+ * ```tsx
1301
+ * const { data: activity } = useActivityFeed({
1302
+ * tokenAddress: "0xToken",
1303
+ * userAddress: "0xUser",
1304
+ * logs: rawLogs,
1305
+ * });
1306
+ * ```
825
1307
  */
826
- declare function isConfidentialQueryOptions(token: ReadonlyToken): {
827
- readonly queryKey: readonly ["isConfidential", string];
828
- readonly queryFn: () => Promise<boolean>;
829
- readonly staleTime: number;
830
- };
1308
+ declare function useActivityFeed(config: UseActivityFeedConfig): _tanstack_react_query0.UseQueryResult<ActivityItem$1[], Error>;
1309
+ //#endregion
1310
+ //#region src/token/use-approve-underlying.d.ts
831
1311
  /**
832
- * TanStack Query options factory for ERC-165 wrapper interface check.
1312
+ * Approve the wrapper contract to spend the underlying ERC-20.
1313
+ * Defaults to max uint256. Resets to zero first if there's an existing
1314
+ * non-zero allowance (required by tokens like USDT).
1315
+ *
1316
+ * @param config - Token and wrapper addresses.
1317
+ * @param options - React Query mutation options.
833
1318
  *
834
- * @param token - A `ReadonlyToken` instance.
835
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1319
+ * @example
1320
+ * ```tsx
1321
+ * const approve = useApproveUnderlying({ tokenAddress: "0x...", wrapperAddress: "0x..." });
1322
+ * approve.mutate({}); // max approval
1323
+ * approve.mutate({ amount: 1000n }); // exact amount
1324
+ * ```
836
1325
  */
837
- declare function isWrapperQueryOptions(token: ReadonlyToken): {
838
- readonly queryKey: readonly ["isWrapper", string];
839
- readonly queryFn: () => Promise<boolean>;
840
- readonly staleTime: number;
841
- };
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
842
1329
  /**
843
1330
  * Check if a token supports the ERC-7984 confidential interface via ERC-165.
844
1331
  * Result is cached indefinitely since interface support does not change.
@@ -852,7 +1339,7 @@ declare function isWrapperQueryOptions(token: ReadonlyToken): {
852
1339
  * const { data: isConfidential } = useIsConfidential("0xToken");
853
1340
  * ```
854
1341
  */
855
- 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>;
856
1343
  /**
857
1344
  * Suspense variant of {@link useIsConfidential}.
858
1345
  * Suspends rendering until the ERC-165 check resolves.
@@ -865,7 +1352,7 @@ declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQuer
865
1352
  * const { data: isConfidential } = useIsConfidentialSuspense("0xToken");
866
1353
  * ```
867
1354
  */
868
- declare function useIsConfidentialSuspense(tokenAddress: Address): UseSuspenseQueryResult<boolean, Error>;
1355
+ declare function useIsConfidentialSuspense(tokenAddress: Address$1): _tanstack_react_query0.UseSuspenseQueryResult<boolean, Error>;
869
1356
  /**
870
1357
  * Check if a token supports the ERC-7984 wrapper interface via ERC-165.
871
1358
  * Result is cached indefinitely since interface support does not change.
@@ -879,7 +1366,7 @@ declare function useIsConfidentialSuspense(tokenAddress: Address): UseSuspenseQu
879
1366
  * const { data: isWrapper } = useIsWrapper("0xToken");
880
1367
  * ```
881
1368
  */
882
- 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>;
883
1370
  /**
884
1371
  * Suspense variant of {@link useIsWrapper}.
885
1372
  * Suspends rendering until the ERC-165 check resolves.
@@ -892,29 +1379,9 @@ declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOpti
892
1379
  * const { data: isWrapper } = useIsWrapperSuspense("0xToken");
893
1380
  * ```
894
1381
  */
895
- declare function useIsWrapperSuspense(tokenAddress: Address): UseSuspenseQueryResult<boolean, Error>;
896
-
897
- /**
898
- * Query key factory for total supply queries.
899
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
900
- */
901
- declare const totalSupplyQueryKeys: {
902
- /** Match all total supply queries. */
903
- readonly all: readonly ["totalSupply"];
904
- /** Match total supply query for a specific token. */
905
- readonly token: (tokenAddress: string) => readonly ["totalSupply", string];
906
- };
907
- /**
908
- * TanStack Query options factory for total supply.
909
- *
910
- * @param token - A `ReadonlyToken` instance.
911
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
912
- */
913
- declare function totalSupplyQueryOptions(token: ReadonlyToken): {
914
- readonly queryKey: readonly ["totalSupply", string];
915
- readonly queryFn: () => Promise<bigint>;
916
- readonly staleTime: 30000;
917
- };
1382
+ declare function useIsWrapperSuspense(tokenAddress: Address$1): _tanstack_react_query0.UseSuspenseQueryResult<boolean, Error>;
1383
+ //#endregion
1384
+ //#region src/token/use-total-supply.d.ts
918
1385
  /**
919
1386
  * Read the total supply of a token.
920
1387
  * Stale after 30 seconds to balance freshness and RPC cost.
@@ -928,7 +1395,7 @@ declare function totalSupplyQueryOptions(token: ReadonlyToken): {
928
1395
  * const { data: totalSupply } = useTotalSupply("0xToken");
929
1396
  * ```
930
1397
  */
931
- 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>;
932
1399
  /**
933
1400
  * Suspense variant of {@link useTotalSupply}.
934
1401
  * Suspends rendering until the total supply is loaded.
@@ -941,81 +1408,20 @@ declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOp
941
1408
  * const { data: totalSupply } = useTotalSupplySuspense("0xToken");
942
1409
  * ```
943
1410
  */
944
- declare function useTotalSupplySuspense(tokenAddress: Address): UseSuspenseQueryResult<bigint, Error>;
945
-
946
- /**
947
- * Query key factory for fee-related queries.
948
- * Use with `queryClient.invalidateQueries()` / `resetQueries()`.
949
- */
950
- declare const feeQueryKeys: {
951
- /** Match shield fee query for given parameters. */
952
- readonly shieldFee: (feeManagerAddress: string, amount?: string, from?: string, to?: string) => readonly ["shieldFee", string, ...(string | undefined)[]];
953
- /** Match unshield fee query for given parameters. */
954
- readonly unshieldFee: (feeManagerAddress: string, amount?: string, from?: string, to?: string) => readonly ["unshieldFee", string, ...(string | undefined)[]];
955
- /** Match batch transfer fee query for a specific fee manager. */
956
- readonly batchTransferFee: (feeManagerAddress: string) => readonly ["batchTransferFee", string];
957
- /** Match fee recipient query for a specific fee manager. */
958
- readonly feeRecipient: (feeManagerAddress: string) => readonly ["feeRecipient", string];
959
- };
1411
+ declare function useTotalSupplySuspense(tokenAddress: Address$1): _tanstack_react_query0.UseSuspenseQueryResult<bigint, Error>;
1412
+ //#endregion
1413
+ //#region src/token/use-fees.d.ts
960
1414
  /** Configuration for {@link useShieldFee} and {@link useUnshieldFee}. */
961
1415
  interface UseFeeConfig {
962
- /** Address of the fee manager contract. */
963
- feeManagerAddress: Address;
964
- /** Amount to calculate the fee for. */
965
- amount: bigint;
966
- /** Sender address. */
967
- from: Address;
968
- /** Receiver address. */
969
- 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;
970
1424
  }
971
- /**
972
- * TanStack Query options factory for shield fee.
973
- *
974
- * @param signer - A `GenericSigner` instance.
975
- * @param config - {@link UseFeeConfig} with fee manager address, amount, from, and to.
976
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
977
- */
978
- declare function shieldFeeQueryOptions(signer: GenericSigner, config: UseFeeConfig): {
979
- readonly queryKey: readonly ["shieldFee", string, ...(string | undefined)[]];
980
- readonly queryFn: () => Promise<bigint>;
981
- readonly staleTime: 30000;
982
- };
983
- /**
984
- * TanStack Query options factory for unshield fee.
985
- *
986
- * @param signer - A `GenericSigner` instance.
987
- * @param config - Fee manager address, amount, from, and to.
988
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
989
- */
990
- declare function unshieldFeeQueryOptions(signer: GenericSigner, config: UseFeeConfig): {
991
- readonly queryKey: readonly ["unshieldFee", string, ...(string | undefined)[]];
992
- readonly queryFn: () => Promise<bigint>;
993
- readonly staleTime: 30000;
994
- };
995
- /**
996
- * TanStack Query options factory for batch transfer fee.
997
- *
998
- * @param signer - A `GenericSigner` instance.
999
- * @param feeManagerAddress - Address of the fee manager contract.
1000
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1001
- */
1002
- declare function batchTransferFeeQueryOptions(signer: GenericSigner, feeManagerAddress: Address): {
1003
- readonly queryKey: readonly ["batchTransferFee", string];
1004
- readonly queryFn: () => Promise<bigint>;
1005
- readonly staleTime: 30000;
1006
- };
1007
- /**
1008
- * TanStack Query options factory for fee recipient.
1009
- *
1010
- * @param signer - A `GenericSigner` instance.
1011
- * @param feeManagerAddress - Address of the fee manager contract.
1012
- * @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
1013
- */
1014
- declare function feeRecipientQueryOptions(signer: GenericSigner, feeManagerAddress: Address): {
1015
- readonly queryKey: readonly ["feeRecipient", string];
1016
- readonly queryFn: () => Promise<`0x${string}`>;
1017
- readonly staleTime: 30000;
1018
- };
1019
1425
  /**
1020
1426
  * Read the shield fee for a given amount and address pair.
1021
1427
  *
@@ -1033,7 +1439,7 @@ declare function feeRecipientQueryOptions(signer: GenericSigner, feeManagerAddre
1033
1439
  * });
1034
1440
  * ```
1035
1441
  */
1036
- declare function useShieldFee(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>;
1037
1443
  /**
1038
1444
  * Read the unshield fee for a given amount and address pair.
1039
1445
  *
@@ -1051,7 +1457,7 @@ declare function useShieldFee(config: UseFeeConfig, options?: Omit<UseQueryOptio
1051
1457
  * });
1052
1458
  * ```
1053
1459
  */
1054
- declare function useUnshieldFee(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>;
1055
1461
  /**
1056
1462
  * Read the batch transfer fee from the fee manager.
1057
1463
  *
@@ -1064,7 +1470,7 @@ declare function useUnshieldFee(config: UseFeeConfig, options?: Omit<UseQueryOpt
1064
1470
  * const { data: fee } = useBatchTransferFee("0xFeeManager");
1065
1471
  * ```
1066
1472
  */
1067
- 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>;
1068
1474
  /**
1069
1475
  * Read the fee recipient address from the fee manager.
1070
1476
  *
@@ -1077,6 +1483,7 @@ declare function useBatchTransferFee(feeManagerAddress: Address, options?: Omit<
1077
1483
  * const { data: recipient } = useFeeRecipient("0xFeeManager");
1078
1484
  * ```
1079
1485
  */
1080
- declare function useFeeRecipient(feeManagerAddress: Address, options?: Omit<UseQueryOptions<Address, Error>, "queryKey" | "queryFn">): UseQueryResult<Address, Error>;
1081
-
1082
- export { type ConfidentialTransferParams, type CreateDelegatedUserDecryptEIP712Params, type CreateEIP712Params, type FinalizeUnwrapParams, type PublicKeyData, type PublicParamsData, type ShieldETHParams, type ShieldParams, type UnwrapParams, type UseConfidentialIsApprovedConfig, type UseConfidentialIsApprovedSuspenseConfig, type UseConfidentialTransferConfig, type UseFeeConfig, type UseShieldConfig, type UseUnderlyingAllowanceConfig, type UseWrapperDiscoveryConfig, type UseWrapperDiscoverySuspenseConfig, UseZamaConfig, ZamaProvider, batchTransferFeeQueryOptions, confidentialBalanceQueryKeys, confidentialBalancesQueryKeys, confidentialHandleQueryKeys, confidentialHandlesQueryKeys, confidentialIsApprovedQueryKeys, confidentialIsApprovedQueryOptions, confidentialTransferMutationOptions, decryptionKeys, encryptMutationOptions, feeQueryKeys, feeRecipientQueryOptions, finalizeUnwrapMutationOptions, isConfidentialQueryKeys, isConfidentialQueryOptions, isWrapperQueryKeys, isWrapperQueryOptions, publicKeyQueryKeys, publicKeyQueryOptions, publicParamsQueryKeys, publicParamsQueryOptions, shieldETHMutationOptions, shieldFeeQueryOptions, shieldMutationOptions, totalSupplyQueryKeys, totalSupplyQueryOptions, underlyingAllowanceQueryKeys, underlyingAllowanceQueryOptions, unshieldFeeQueryOptions, unwrapMutationOptions, useBatchTransferFee, useConfidentialIsApproved, useConfidentialIsApprovedSuspense, useConfidentialTransfer, useCreateDelegatedUserDecryptEIP712, useCreateEIP712, useDelegatedUserDecrypt, useEncrypt, useFeeRecipient, useFinalizeUnwrap, useGenerateKeypair, useIsConfidential, useIsConfidentialSuspense, useIsWrapper, useIsWrapperSuspense, usePublicDecrypt, usePublicKey, usePublicParams, useReadonlyToken, useRequestZKProofVerification, useShield, useShieldETH, useShieldFee, useTotalSupply, useTotalSupplySuspense, useUnderlyingAllowance, useUnderlyingAllowanceSuspense, useUnshieldFee, useUnwrap, useUserDecrypt, useUserDecryptedValue, useUserDecryptedValues, useWrapperDiscovery, useWrapperDiscoverySuspense, useZamaSDK, 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