@zama-fhe/react-sdk 3.0.0-alpha.40 → 3.0.0-alpha.42
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 +56 -175
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { ApproveUnderlyingParams, BatchDecryptBalancesAsParams, ConfidentialSetOperatorParams, ConfidentialTransferFromParams, ConfidentialTransferParams, CreateDelegatedUserDecryptEIP712Params, CreateEIP712Params, DecryptBalanceAsParams, DecryptResult, DelegateDecryptionParams, DelegatedDecryptMutationParams, DelegationStatusData, FinalizeUnwrapParams, ResumeUnshieldParams, RevokeDelegationParams, ShieldParams, TokenMetadata, UnshieldAllParams, UnshieldParams, UnwrapParams, UserDecryptQueryConfig } from "@zama-fhe/sdk/query";
|
|
6
|
-
import * as _$_tanstack_react_query0 from "@tanstack/react-query";
|
|
3
|
+
import { Address, BatchBalancesResult, EncryptParams, PaginatedResult, Token, TokenWrapperPair, TokenWrapperPairWithMetadata, TransactionResult, WrappedToken, ZamaConfig, ZamaSDK } from "@zama-fhe/sdk";
|
|
4
|
+
import { ApproveUnderlyingParams, BatchDecryptBalancesAsParams, ConfidentialSetOperatorParams, ConfidentialTransferFromParams, ConfidentialTransferParams, DecryptBalanceAsParams, DecryptResult, DelegateDecryptionParams, DelegatedDecryptMutationParams, DelegationStatusData, FinalizeUnwrapParams, ResumeUnshieldParams, RevokeDelegationParams, ShieldParams, TokenMetadata, UnshieldAllParams, UnshieldParams, UnwrapParams } from "@zama-fhe/sdk/query";
|
|
7
5
|
import { UseMutationOptions, UseMutationResult, UseQueryOptions } from "@tanstack/react-query";
|
|
8
6
|
import { PropsWithChildren } from "react";
|
|
9
|
-
import
|
|
10
|
-
import * as _$_zama_fhe_relayer_sdk_web0 from "@zama-fhe/relayer-sdk/web";
|
|
7
|
+
import { EncryptedInput } from "@zama-fhe/sdk/query/user-decrypt";
|
|
11
8
|
|
|
12
9
|
//#region src/provider.d.ts
|
|
13
10
|
/** Props for {@link ZamaProvider}. */
|
|
@@ -28,7 +25,7 @@ interface ZamaProviderProps extends PropsWithChildren {
|
|
|
28
25
|
declare function ZamaProvider({
|
|
29
26
|
children,
|
|
30
27
|
config
|
|
31
|
-
}: ZamaProviderProps):
|
|
28
|
+
}: ZamaProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
32
29
|
/**
|
|
33
30
|
* Access the {@link ZamaSDK} instance from context.
|
|
34
31
|
* Throws if called outside a {@link ZamaProvider}.
|
|
@@ -57,7 +54,7 @@ declare function useZamaSDK(): ZamaSDK;
|
|
|
57
54
|
* encrypt.mutate({ values: [{ value: 1000n, type: "euint64" }], contractAddress: "0x...", userAddress: "0x..." });
|
|
58
55
|
* ```
|
|
59
56
|
*/
|
|
60
|
-
declare function useEncrypt():
|
|
57
|
+
declare function useEncrypt(): import("@tanstack/react-query").UseMutationResult<Readonly<{
|
|
61
58
|
handles: Uint8Array[];
|
|
62
59
|
inputProof: Uint8Array;
|
|
63
60
|
}>, Error, EncryptParams, unknown>;
|
|
@@ -67,7 +64,7 @@ declare function useEncrypt(): _$_tanstack_react_query0.UseMutationResult<Readon
|
|
|
67
64
|
* React hook for FHE user decryption. Thin wrapper around
|
|
68
65
|
* `userDecryptQueryOptions` with `useQuery` semantics.
|
|
69
66
|
*/
|
|
70
|
-
declare function useUserDecrypt(
|
|
67
|
+
declare function useUserDecrypt(encryptedInputs: EncryptedInput[], options?: Omit<UseQueryOptions<DecryptResult>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<Readonly<Record<`0x${string}`, import("@zama-fhe/relayer-sdk/web").ClearValueType>>, Error>;
|
|
71
68
|
/** Return type of {@link useUserDecrypt}. */
|
|
72
69
|
type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;
|
|
73
70
|
//#endregion
|
|
@@ -86,75 +83,12 @@ type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;
|
|
|
86
83
|
* // publicDecrypt.data?.clearValues => { "0xHandle1": 500n, ... }
|
|
87
84
|
* ```
|
|
88
85
|
*/
|
|
89
|
-
declare function usePublicDecrypt():
|
|
90
|
-
clearValues:
|
|
86
|
+
declare function usePublicDecrypt(): import("@tanstack/react-query").UseMutationResult<Readonly<{
|
|
87
|
+
clearValues: import("@zama-fhe/relayer-sdk/web").ClearValues;
|
|
91
88
|
abiEncodedClearValues: `0x${string}`;
|
|
92
89
|
decryptionProof: `0x${string}`;
|
|
93
90
|
}>, Error, `0x${string}`[], unknown>;
|
|
94
91
|
//#endregion
|
|
95
|
-
//#region src/relayer/use-generate-keypair.d.ts
|
|
96
|
-
/**
|
|
97
|
-
* Generate an FHE keypair via the relayer.
|
|
98
|
-
* Returns a public/private key pair for use in decrypt authorization.
|
|
99
|
-
*
|
|
100
|
-
* Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
|
|
101
|
-
* - {@link RelayerRequestFailedError} — relayer keypair generation request failed
|
|
102
|
-
*
|
|
103
|
-
* @returns A mutation whose `mutate` takes no parameters.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```tsx
|
|
107
|
-
* const generateKeypair = useGenerateKeypair();
|
|
108
|
-
* generateKeypair.mutate();
|
|
109
|
-
* // generateKeypair.data?.publicKey, generateKeypair.data?.privateKey
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
declare function useGenerateKeypair(): _$_tanstack_react_query0.UseMutationResult<_$_zama_fhe_sdk0.KeypairType<`0x${string}`>, Error, void, unknown>;
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/relayer/use-create-eip712.d.ts
|
|
115
|
-
/**
|
|
116
|
-
* Create EIP-712 typed data for signing an FHE decrypt credential.
|
|
117
|
-
* The returned typed data is signed by the wallet to authorize decryption.
|
|
118
|
-
*
|
|
119
|
-
* @returns A mutation whose `mutate` accepts {@link CreateEIP712Params}.
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* ```tsx
|
|
123
|
-
* const createEIP712 = useCreateEIP712();
|
|
124
|
-
* createEIP712.mutate({
|
|
125
|
-
* publicKey: keypair.publicKey,
|
|
126
|
-
* contractAddresses: ["0xToken"],
|
|
127
|
-
* startTimestamp: Math.floor(Date.now() / 1000),
|
|
128
|
-
* });
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
declare function useCreateEIP712(): _$_tanstack_react_query0.UseMutationResult<EIP712TypedData, Error, CreateEIP712Params, unknown>;
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region src/relayer/use-create-delegated-user-decrypt-eip712.d.ts
|
|
134
|
-
/**
|
|
135
|
-
* Create EIP-712 typed data for a delegated user decrypt credential.
|
|
136
|
-
* Used when one wallet authorizes another to decrypt on its behalf.
|
|
137
|
-
*
|
|
138
|
-
* @returns A mutation whose `mutate` accepts {@link CreateDelegatedUserDecryptEIP712Params}.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```tsx
|
|
142
|
-
* const createEIP712 = useCreateDelegatedUserDecryptEIP712();
|
|
143
|
-
* createEIP712.mutate({
|
|
144
|
-
* publicKey: keypair.publicKey,
|
|
145
|
-
* contractAddresses: ["0xToken"],
|
|
146
|
-
* delegatorAddress: "0xDelegator",
|
|
147
|
-
* startTimestamp: Math.floor(Date.now() / 1000),
|
|
148
|
-
* });
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
declare function useCreateDelegatedUserDecryptEIP712(): _$_tanstack_react_query0.UseMutationResult<Readonly<{
|
|
152
|
-
types: _$_zama_fhe_relayer_sdk_web0.KmsDelegatedUserDecryptEIP712TypesType;
|
|
153
|
-
primaryType: "DelegatedUserDecryptRequestVerification";
|
|
154
|
-
domain: _$_zama_fhe_relayer_sdk_web0.KmsEIP712DomainType;
|
|
155
|
-
message: _$_zama_fhe_relayer_sdk_web0.KmsDelegatedUserDecryptEIP712MessageType;
|
|
156
|
-
}>, Error, CreateDelegatedUserDecryptEIP712Params, unknown>;
|
|
157
|
-
//#endregion
|
|
158
92
|
//#region src/decrypt/use-delegated-decrypt.d.ts
|
|
159
93
|
/**
|
|
160
94
|
* Decrypt FHE ciphertext handles using delegated user credentials.
|
|
@@ -165,64 +99,11 @@ declare function useCreateDelegatedUserDecryptEIP712(): _$_tanstack_react_query0
|
|
|
165
99
|
* @example
|
|
166
100
|
* ```tsx
|
|
167
101
|
* const decrypt = useDelegatedDecrypt();
|
|
168
|
-
* decrypt.mutate({
|
|
102
|
+
* decrypt.mutate({ encryptedInputs: [{ encryptedValue: "0xHandle1", contractAddress: "0x..." }], delegatorAddress: "0x..." });
|
|
169
103
|
* // decrypt.data => { "0xHandle1": 1000n }
|
|
170
104
|
* ```
|
|
171
105
|
*/
|
|
172
|
-
declare function useDelegatedDecrypt():
|
|
173
|
-
//#endregion
|
|
174
|
-
//#region src/relayer/use-request-zk-proof-verification.d.ts
|
|
175
|
-
/**
|
|
176
|
-
* Submit a ZK proof for on-chain verification.
|
|
177
|
-
* Returns the input proof bytes for use in contract calls.
|
|
178
|
-
*
|
|
179
|
-
* @returns A mutation whose `mutate` accepts a {@link ZKProofLike}.
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* ```tsx
|
|
183
|
-
* const verify = useRequestZKProofVerification();
|
|
184
|
-
* verify.mutate(zkProof);
|
|
185
|
-
* // verify.data => Uint8Array (input proof bytes)
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
188
|
-
declare function useRequestZKProofVerification(): _$_tanstack_react_query0.UseMutationResult<Readonly<{
|
|
189
|
-
handles: Uint8Array[];
|
|
190
|
-
inputProof: Uint8Array;
|
|
191
|
-
}>, Error, ZKProofLike, unknown>;
|
|
192
|
-
//#endregion
|
|
193
|
-
//#region src/relayer/use-public-key.d.ts
|
|
194
|
-
/**
|
|
195
|
-
* Fetch the FHE network public key from the relayer.
|
|
196
|
-
* Cached indefinitely since the key does not change during a session.
|
|
197
|
-
*
|
|
198
|
-
* @returns Query result with `data: PublicKeyData | null`.
|
|
199
|
-
*
|
|
200
|
-
* @example
|
|
201
|
-
* ```tsx
|
|
202
|
-
* const { data: publicKey } = usePublicKey();
|
|
203
|
-
* // publicKey?.publicKeyId, publicKey?.publicKey
|
|
204
|
-
* ```
|
|
205
|
-
*/
|
|
206
|
-
declare function usePublicKey(): _$_tanstack_react_query0.UseQueryResult<PublicKeyData | null, Error>;
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region src/relayer/use-public-params.d.ts
|
|
209
|
-
/**
|
|
210
|
-
* Fetch FHE public parameters for a given bit size from the relayer.
|
|
211
|
-
* Cached indefinitely since parameters do not change during a session.
|
|
212
|
-
*
|
|
213
|
-
* @param bits - The FHE bit size to fetch parameters for (e.g. 2048).
|
|
214
|
-
* @returns Query result with `data: PublicParamsData | null`.
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* ```tsx
|
|
218
|
-
* const { data: params } = usePublicParams(2048);
|
|
219
|
-
* // params?.publicParams, params?.publicParamsId
|
|
220
|
-
* ```
|
|
221
|
-
*/
|
|
222
|
-
declare function usePublicParams(bits: number): _$_tanstack_react_query0.UseQueryResult<{
|
|
223
|
-
publicParams: Uint8Array<ArrayBufferLike>;
|
|
224
|
-
publicParamsId: string;
|
|
225
|
-
} | null, Error>;
|
|
106
|
+
declare function useDelegatedDecrypt(): import("@tanstack/react-query").UseMutationResult<Record<`0x${string}`, import("@zama-fhe/relayer-sdk/web").ClearValueType>, Error, DelegatedDecryptMutationParams, unknown>;
|
|
226
107
|
//#endregion
|
|
227
108
|
//#region src/permits/use-grant-permit.d.ts
|
|
228
109
|
/**
|
|
@@ -245,7 +126,7 @@ declare function usePublicParams(bits: number): _$_tanstack_react_query0.UseQuer
|
|
|
245
126
|
* await grantPermit([tokenAddress, auctionAddress, governanceAddress]);
|
|
246
127
|
* ```
|
|
247
128
|
*/
|
|
248
|
-
declare function useGrantPermit(options?: UseMutationOptions<void, Error, Address[]>):
|
|
129
|
+
declare function useGrantPermit(options?: UseMutationOptions<void, Error, Address[]>): import("@tanstack/react-query").UseMutationResult<void, Error, `0x${string}`[], unknown>;
|
|
249
130
|
//#endregion
|
|
250
131
|
//#region src/permits/use-has-permit.d.ts
|
|
251
132
|
/** Configuration for {@link useHasPermit}. */
|
|
@@ -269,7 +150,7 @@ interface UseHasPermitConfig {
|
|
|
269
150
|
* const { data: hasPermit } = useHasPermit({ contractAddresses: ["0xToken"] });
|
|
270
151
|
* ```
|
|
271
152
|
*/
|
|
272
|
-
declare function useHasPermit(config: UseHasPermitConfig):
|
|
153
|
+
declare function useHasPermit(config: UseHasPermitConfig): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
273
154
|
//#endregion
|
|
274
155
|
//#region src/permits/use-revoke-permits.d.ts
|
|
275
156
|
/**
|
|
@@ -289,7 +170,7 @@ declare function useHasPermit(config: UseHasPermitConfig): _$_tanstack_react_que
|
|
|
289
170
|
* revokePermits(); // every permit, all chains, all delegators
|
|
290
171
|
* ```
|
|
291
172
|
*/
|
|
292
|
-
declare function useRevokePermits(options?: UseMutationOptions<void, Error, Address[] | void>):
|
|
173
|
+
declare function useRevokePermits(options?: UseMutationOptions<void, Error, Address[] | void>): import("@tanstack/react-query").UseMutationResult<void, Error, void | `0x${string}`[], unknown>;
|
|
293
174
|
//#endregion
|
|
294
175
|
//#region src/permits/use-clear-credentials.d.ts
|
|
295
176
|
/**
|
|
@@ -303,7 +184,7 @@ declare function useRevokePermits(options?: UseMutationOptions<void, Error, Addr
|
|
|
303
184
|
* clearCredentials();
|
|
304
185
|
* ```
|
|
305
186
|
*/
|
|
306
|
-
declare function useClearCredentials(options?: UseMutationOptions<void>):
|
|
187
|
+
declare function useClearCredentials(options?: UseMutationOptions<void>): import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
|
|
307
188
|
//#endregion
|
|
308
189
|
//#region src/token/use-token.d.ts
|
|
309
190
|
/**
|
|
@@ -355,9 +236,9 @@ interface UseConfidentialBalanceOptions extends Omit<UseQueryOptions<bigint>, "q
|
|
|
355
236
|
enabled?: boolean;
|
|
356
237
|
}
|
|
357
238
|
/**
|
|
358
|
-
* Hook for fetching a confidential token balance. Reads the on-chain
|
|
359
|
-
* decrypts via the SDK; cached values are returned instantly
|
|
360
|
-
* only hit when the
|
|
239
|
+
* Hook for fetching a confidential token balance. Reads the on-chain encrypted
|
|
240
|
+
* value and decrypts via the SDK; cached clear values are returned instantly
|
|
241
|
+
* and the relayer is only hit when the encrypted value changes.
|
|
361
242
|
*
|
|
362
243
|
* @example
|
|
363
244
|
* ```tsx
|
|
@@ -367,7 +248,7 @@ interface UseConfidentialBalanceOptions extends Omit<UseQueryOptions<bigint>, "q
|
|
|
367
248
|
* });
|
|
368
249
|
* ```
|
|
369
250
|
*/
|
|
370
|
-
declare function useConfidentialBalance(config: UseConfidentialBalanceConfig, options?: UseConfidentialBalanceOptions):
|
|
251
|
+
declare function useConfidentialBalance(config: UseConfidentialBalanceConfig, options?: UseConfidentialBalanceOptions): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
371
252
|
//#endregion
|
|
372
253
|
//#region src/balance/use-confidential-balances.d.ts
|
|
373
254
|
interface UseConfidentialBalancesConfig {
|
|
@@ -401,7 +282,7 @@ interface UseConfidentialBalancesOptions extends Omit<UseQueryOptions<BatchBalan
|
|
|
401
282
|
* }
|
|
402
283
|
* ```
|
|
403
284
|
*/
|
|
404
|
-
declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions):
|
|
285
|
+
declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions): import("@tanstack/react-query").UseQueryResult<BatchBalancesResult, Error>;
|
|
405
286
|
//#endregion
|
|
406
287
|
//#region src/transfer/use-confidential-transfer.d.ts
|
|
407
288
|
/** Configuration for {@link useConfidentialTransfer}. */
|
|
@@ -466,7 +347,7 @@ declare function useConfidentialTransfer<TContext = unknown>(config: UseConfiden
|
|
|
466
347
|
* transferFrom.mutate({ from: "0xOwner", to: "0xRecipient", amount: 500n });
|
|
467
348
|
* ```
|
|
468
349
|
*/
|
|
469
|
-
declare function useConfidentialTransferFrom(address: Address, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferFromParams, Address>):
|
|
350
|
+
declare function useConfidentialTransferFrom(address: Address, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferFromParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ConfidentialTransferFromParams, `0x${string}`>;
|
|
470
351
|
//#endregion
|
|
471
352
|
//#region src/operator/use-confidential-set-operator.d.ts
|
|
472
353
|
/**
|
|
@@ -485,7 +366,7 @@ declare function useConfidentialTransferFrom(address: Address, options?: UseMuta
|
|
|
485
366
|
* setOperator.mutate({ operator: "0xOperator" });
|
|
486
367
|
* ```
|
|
487
368
|
*/
|
|
488
|
-
declare function useConfidentialSetOperator(address: Address, options?: UseMutationOptions<TransactionResult, Error, ConfidentialSetOperatorParams, Address>):
|
|
369
|
+
declare function useConfidentialSetOperator(address: Address, options?: UseMutationOptions<TransactionResult, Error, ConfidentialSetOperatorParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ConfidentialSetOperatorParams, `0x${string}`>;
|
|
489
370
|
//#endregion
|
|
490
371
|
//#region src/operator/use-confidential-is-operator.d.ts
|
|
491
372
|
interface UseConfidentialIsOperatorConfig {
|
|
@@ -520,7 +401,7 @@ interface UseConfidentialIsOperatorSuspenseConfig {
|
|
|
520
401
|
* });
|
|
521
402
|
* ```
|
|
522
403
|
*/
|
|
523
|
-
declare function useConfidentialIsOperator(config: UseConfidentialIsOperatorConfig, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">):
|
|
404
|
+
declare function useConfidentialIsOperator(config: UseConfidentialIsOperatorConfig, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
524
405
|
/**
|
|
525
406
|
* Suspense variant of {@link useConfidentialIsOperator}. Suspends rendering
|
|
526
407
|
* until the operator check resolves.
|
|
@@ -534,7 +415,7 @@ declare function useConfidentialIsOperator(config: UseConfidentialIsOperatorConf
|
|
|
534
415
|
* });
|
|
535
416
|
* ```
|
|
536
417
|
*/
|
|
537
|
-
declare function useConfidentialIsOperatorSuspense(config: UseConfidentialIsOperatorSuspenseConfig):
|
|
418
|
+
declare function useConfidentialIsOperatorSuspense(config: UseConfidentialIsOperatorSuspenseConfig): import("@tanstack/react-query").UseSuspenseQueryResult<boolean, Error>;
|
|
538
419
|
//#endregion
|
|
539
420
|
//#region src/shield/use-shield.d.ts
|
|
540
421
|
/** Configuration for {@link useShield}. */
|
|
@@ -587,7 +468,7 @@ declare function useShield<TContext = unknown>(config: UseShieldConfig, options?
|
|
|
587
468
|
* unwrap.mutate({ amount: 500n });
|
|
588
469
|
* ```
|
|
589
470
|
*/
|
|
590
|
-
declare function useUnwrap(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>):
|
|
471
|
+
declare function useUnwrap(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, UnwrapParams, `0x${string}`>;
|
|
591
472
|
//#endregion
|
|
592
473
|
//#region src/unwrap/use-unwrap-all.d.ts
|
|
593
474
|
/**
|
|
@@ -608,7 +489,7 @@ declare function useUnwrap(address: Address, options?: UseMutationOptions<Transa
|
|
|
608
489
|
* unwrapAll.mutate();
|
|
609
490
|
* ```
|
|
610
491
|
*/
|
|
611
|
-
declare function useUnwrapAll(address: Address, options?: UseMutationOptions<TransactionResult, Error, void, Address>):
|
|
492
|
+
declare function useUnwrapAll(address: Address, options?: UseMutationOptions<TransactionResult, Error, void, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, void, `0x${string}`>;
|
|
612
493
|
//#endregion
|
|
613
494
|
//#region src/unwrap/use-finalize-unwrap.d.ts
|
|
614
495
|
/**
|
|
@@ -635,7 +516,7 @@ declare function useUnwrapAll(address: Address, options?: UseMutationOptions<Tra
|
|
|
635
516
|
* );
|
|
636
517
|
* ```
|
|
637
518
|
*/
|
|
638
|
-
declare function useFinalizeUnwrap(address: Address, options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>):
|
|
519
|
+
declare function useFinalizeUnwrap(address: Address, options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, FinalizeUnwrapParams, `0x${string}`>;
|
|
639
520
|
//#endregion
|
|
640
521
|
//#region src/unshield/use-unshield.d.ts
|
|
641
522
|
/**
|
|
@@ -657,7 +538,7 @@ declare function useFinalizeUnwrap(address: Address, options?: UseMutationOption
|
|
|
657
538
|
* unshield.mutate({ amount: 500n });
|
|
658
539
|
* ```
|
|
659
540
|
*/
|
|
660
|
-
declare function useUnshield(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnshieldParams, Address>):
|
|
541
|
+
declare function useUnshield(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnshieldParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, UnshieldParams, `0x${string}`>;
|
|
661
542
|
//#endregion
|
|
662
543
|
//#region src/unshield/use-unshield-all.d.ts
|
|
663
544
|
/**
|
|
@@ -678,7 +559,7 @@ declare function useUnshield(address: Address, options?: UseMutationOptions<Tran
|
|
|
678
559
|
* unshieldAll.mutate();
|
|
679
560
|
* ```
|
|
680
561
|
*/
|
|
681
|
-
declare function useUnshieldAll(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnshieldAllParams | void, Address>):
|
|
562
|
+
declare function useUnshieldAll(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnshieldAllParams | void, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, void | UnshieldAllParams, `0x${string}`>;
|
|
682
563
|
//#endregion
|
|
683
564
|
//#region src/unshield/use-resume-unshield.d.ts
|
|
684
565
|
/**
|
|
@@ -699,7 +580,7 @@ declare function useUnshieldAll(address: Address, options?: UseMutationOptions<T
|
|
|
699
580
|
* resumeUnshield.mutate({ unwrapTxHash: "0xabc..." });
|
|
700
581
|
* ```
|
|
701
582
|
*/
|
|
702
|
-
declare function useResumeUnshield(address: Address, options?: UseMutationOptions<TransactionResult, Error, ResumeUnshieldParams, Address>):
|
|
583
|
+
declare function useResumeUnshield(address: Address, options?: UseMutationOptions<TransactionResult, Error, ResumeUnshieldParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ResumeUnshieldParams, `0x${string}`>;
|
|
703
584
|
//#endregion
|
|
704
585
|
//#region src/shield/use-underlying-allowance.d.ts
|
|
705
586
|
interface UseUnderlyingAllowanceConfig {
|
|
@@ -726,7 +607,7 @@ interface UseUnderlyingAllowanceSuspenseConfig {
|
|
|
726
607
|
* });
|
|
727
608
|
* ```
|
|
728
609
|
*/
|
|
729
|
-
declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">):
|
|
610
|
+
declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
730
611
|
/**
|
|
731
612
|
* Suspense variant of {@link useUnderlyingAllowance}. Suspends rendering until
|
|
732
613
|
* the allowance resolves.
|
|
@@ -739,7 +620,7 @@ declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, op
|
|
|
739
620
|
* });
|
|
740
621
|
* ```
|
|
741
622
|
*/
|
|
742
|
-
declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceSuspenseConfig):
|
|
623
|
+
declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceSuspenseConfig): import("@tanstack/react-query").UseSuspenseQueryResult<bigint, Error>;
|
|
743
624
|
//#endregion
|
|
744
625
|
//#region src/token/use-wrapper-discovery.d.ts
|
|
745
626
|
/** Configuration for {@link useWrapperDiscovery}. */
|
|
@@ -781,7 +662,7 @@ interface UseWrapperDiscoverySuspenseConfig {
|
|
|
781
662
|
* });
|
|
782
663
|
* ```
|
|
783
664
|
*/
|
|
784
|
-
declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address | null>, "queryKey" | "queryFn">):
|
|
665
|
+
declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address | null>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<`0x${string}` | null, Error>;
|
|
785
666
|
/**
|
|
786
667
|
* Suspense variant of {@link useWrapperDiscovery}.
|
|
787
668
|
* Suspends rendering until the wrapper address is resolved.
|
|
@@ -797,7 +678,7 @@ declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?
|
|
|
797
678
|
* });
|
|
798
679
|
* ```
|
|
799
680
|
*/
|
|
800
|
-
declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig):
|
|
681
|
+
declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig): import("@tanstack/react-query").UseSuspenseQueryResult<`0x${string}` | null, Error>;
|
|
801
682
|
//#endregion
|
|
802
683
|
//#region src/token/use-metadata.d.ts
|
|
803
684
|
/**
|
|
@@ -814,7 +695,7 @@ declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspense
|
|
|
814
695
|
* // metadata?.name, metadata?.symbol, metadata?.decimals
|
|
815
696
|
* ```
|
|
816
697
|
*/
|
|
817
|
-
declare function useMetadata(tokenAddress: Address, options?: Omit<UseQueryOptions<TokenMetadata>, "queryKey" | "queryFn">):
|
|
698
|
+
declare function useMetadata(tokenAddress: Address, options?: Omit<UseQueryOptions<TokenMetadata>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<TokenMetadata, Error>;
|
|
818
699
|
/**
|
|
819
700
|
* Suspense variant of {@link useMetadata}.
|
|
820
701
|
* Suspends rendering until metadata is loaded.
|
|
@@ -827,7 +708,7 @@ declare function useMetadata(tokenAddress: Address, options?: Omit<UseQueryOptio
|
|
|
827
708
|
* const { data: metadata } = useMetadataSuspense("0xToken");
|
|
828
709
|
* ```
|
|
829
710
|
*/
|
|
830
|
-
declare function useMetadataSuspense(tokenAddress: Address):
|
|
711
|
+
declare function useMetadataSuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<TokenMetadata, Error>;
|
|
831
712
|
//#endregion
|
|
832
713
|
//#region src/delegations/use-delegate-decryption.d.ts
|
|
833
714
|
/**
|
|
@@ -843,7 +724,7 @@ declare function useMetadataSuspense(tokenAddress: Address): _$_tanstack_react_q
|
|
|
843
724
|
* delegate.mutate({ delegateAddress: "0xDelegate" });
|
|
844
725
|
* ```
|
|
845
726
|
*/
|
|
846
|
-
declare function useDelegateDecryption(address: Address, options?: UseMutationOptions<TransactionResult, Error, DelegateDecryptionParams>):
|
|
727
|
+
declare function useDelegateDecryption(address: Address, options?: UseMutationOptions<TransactionResult, Error, DelegateDecryptionParams>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, DelegateDecryptionParams, unknown>;
|
|
847
728
|
//#endregion
|
|
848
729
|
//#region src/delegations/use-revoke-delegation.d.ts
|
|
849
730
|
/**
|
|
@@ -858,7 +739,7 @@ declare function useDelegateDecryption(address: Address, options?: UseMutationOp
|
|
|
858
739
|
* revoke.mutate({ delegateAddress: "0xDelegate" });
|
|
859
740
|
* ```
|
|
860
741
|
*/
|
|
861
|
-
declare function useRevokeDelegation(address: Address, options?: UseMutationOptions<TransactionResult, Error, RevokeDelegationParams>):
|
|
742
|
+
declare function useRevokeDelegation(address: Address, options?: UseMutationOptions<TransactionResult, Error, RevokeDelegationParams>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, RevokeDelegationParams, unknown>;
|
|
862
743
|
//#endregion
|
|
863
744
|
//#region src/delegations/use-delegation-status.d.ts
|
|
864
745
|
interface UseDelegationStatusConfig {
|
|
@@ -886,7 +767,7 @@ interface UseDelegationStatusConfig {
|
|
|
886
767
|
* // data?.isActive, data?.expiryTimestamp
|
|
887
768
|
* ```
|
|
888
769
|
*/
|
|
889
|
-
declare function useDelegationStatus(config: UseDelegationStatusConfig, options?: Omit<UseQueryOptions<DelegationStatusData>, "queryKey" | "queryFn">):
|
|
770
|
+
declare function useDelegationStatus(config: UseDelegationStatusConfig, options?: Omit<UseQueryOptions<DelegationStatusData>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<DelegationStatusData, Error>;
|
|
890
771
|
//#endregion
|
|
891
772
|
//#region src/delegations/use-decrypt-balance-as.d.ts
|
|
892
773
|
/**
|
|
@@ -902,7 +783,7 @@ declare function useDelegationStatus(config: UseDelegationStatusConfig, options?
|
|
|
902
783
|
* // decryptAs.data => 1000n
|
|
903
784
|
* ```
|
|
904
785
|
*/
|
|
905
|
-
declare function useDecryptBalanceAs(address: Address, options?: UseMutationOptions<bigint, Error, DecryptBalanceAsParams>):
|
|
786
|
+
declare function useDecryptBalanceAs(address: Address, options?: UseMutationOptions<bigint, Error, DecryptBalanceAsParams>): import("@tanstack/react-query").UseMutationResult<bigint, Error, DecryptBalanceAsParams, unknown>;
|
|
906
787
|
//#endregion
|
|
907
788
|
//#region src/delegations/use-batch-decrypt-balances-as.d.ts
|
|
908
789
|
/**
|
|
@@ -920,7 +801,7 @@ declare function useDecryptBalanceAs(address: Address, options?: UseMutationOpti
|
|
|
920
801
|
* // batchDecryptAs.data => Map { "0xTokenA" => 100n, "0xTokenB" => 200n }
|
|
921
802
|
* ```
|
|
922
803
|
*/
|
|
923
|
-
declare function useBatchDecryptBalancesAs(tokens: Token[], options?: UseMutationOptions<Map<Address, bigint>, Error, BatchDecryptBalancesAsParams>):
|
|
804
|
+
declare function useBatchDecryptBalancesAs(tokens: Token[], options?: UseMutationOptions<Map<Address, bigint>, Error, BatchDecryptBalancesAsParams>): import("@tanstack/react-query").UseMutationResult<Map<`0x${string}`, bigint>, Error, import("@zama-fhe/sdk").BatchDecryptAsOptions, unknown>;
|
|
924
805
|
//#endregion
|
|
925
806
|
//#region src/shield/use-approve-underlying.d.ts
|
|
926
807
|
/**
|
|
@@ -942,7 +823,7 @@ declare function useBatchDecryptBalancesAs(tokens: Token[], options?: UseMutatio
|
|
|
942
823
|
* approve.mutate({ amount: 1000n }); // exact amount
|
|
943
824
|
* ```
|
|
944
825
|
*/
|
|
945
|
-
declare function useApproveUnderlying(address: Address, options?: UseMutationOptions<TransactionResult, Error, ApproveUnderlyingParams, Address>):
|
|
826
|
+
declare function useApproveUnderlying(address: Address, options?: UseMutationOptions<TransactionResult, Error, ApproveUnderlyingParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ApproveUnderlyingParams, `0x${string}`>;
|
|
946
827
|
//#endregion
|
|
947
828
|
//#region src/token/use-is-confidential.d.ts
|
|
948
829
|
/**
|
|
@@ -958,7 +839,7 @@ declare function useApproveUnderlying(address: Address, options?: UseMutationOpt
|
|
|
958
839
|
* const { data: isConfidential } = useIsConfidential("0xToken");
|
|
959
840
|
* ```
|
|
960
841
|
*/
|
|
961
|
-
declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">):
|
|
842
|
+
declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
962
843
|
/**
|
|
963
844
|
* Suspense variant of {@link useIsConfidential}.
|
|
964
845
|
* Suspends rendering until the ERC-165 check resolves.
|
|
@@ -971,7 +852,7 @@ declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQuer
|
|
|
971
852
|
* const { data: isConfidential } = useIsConfidentialSuspense("0xToken");
|
|
972
853
|
* ```
|
|
973
854
|
*/
|
|
974
|
-
declare function useIsConfidentialSuspense(tokenAddress: Address):
|
|
855
|
+
declare function useIsConfidentialSuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<boolean, Error>;
|
|
975
856
|
/**
|
|
976
857
|
* Check if a token supports the ERC-7984 wrapper interface via ERC-165.
|
|
977
858
|
* Result is cached indefinitely since interface support does not change.
|
|
@@ -985,7 +866,7 @@ declare function useIsConfidentialSuspense(tokenAddress: Address): _$_tanstack_r
|
|
|
985
866
|
* const { data: isWrapper } = useIsWrapper("0xToken");
|
|
986
867
|
* ```
|
|
987
868
|
*/
|
|
988
|
-
declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">):
|
|
869
|
+
declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
989
870
|
/**
|
|
990
871
|
* Suspense variant of {@link useIsWrapper}.
|
|
991
872
|
* Suspends rendering until the ERC-165 check resolves.
|
|
@@ -998,7 +879,7 @@ declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOpti
|
|
|
998
879
|
* const { data: isWrapper } = useIsWrapperSuspense("0xToken");
|
|
999
880
|
* ```
|
|
1000
881
|
*/
|
|
1001
|
-
declare function useIsWrapperSuspense(tokenAddress: Address):
|
|
882
|
+
declare function useIsWrapperSuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<boolean, Error>;
|
|
1002
883
|
//#endregion
|
|
1003
884
|
//#region src/token/use-total-supply.d.ts
|
|
1004
885
|
/**
|
|
@@ -1016,7 +897,7 @@ declare function useIsWrapperSuspense(tokenAddress: Address): _$_tanstack_react_
|
|
|
1016
897
|
* const { data: totalSupply } = useTotalSupply("0xToken");
|
|
1017
898
|
* ```
|
|
1018
899
|
*/
|
|
1019
|
-
declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">):
|
|
900
|
+
declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
1020
901
|
/**
|
|
1021
902
|
* Suspense variant of {@link useTotalSupply}.
|
|
1022
903
|
* Suspends rendering until the total supply is loaded.
|
|
@@ -1031,7 +912,7 @@ declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOp
|
|
|
1031
912
|
* const { data: totalSupply } = useTotalSupplySuspense("0xToken");
|
|
1032
913
|
* ```
|
|
1033
914
|
*/
|
|
1034
|
-
declare function useTotalSupplySuspense(tokenAddress: Address):
|
|
915
|
+
declare function useTotalSupplySuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<bigint, Error>;
|
|
1035
916
|
//#endregion
|
|
1036
917
|
//#region src/wrappers-registry/use-wrappers-registry-address.d.ts
|
|
1037
918
|
/**
|
|
@@ -1051,13 +932,13 @@ declare function useWrappersRegistryAddress(): Address | undefined;
|
|
|
1051
932
|
* Fetches all token wrapper pairs from the ConfidentialTokenWrappersRegistry
|
|
1052
933
|
* contract on the current chain.
|
|
1053
934
|
*/
|
|
1054
|
-
declare function useTokenPairsRegistry():
|
|
935
|
+
declare function useTokenPairsRegistry(): import("@tanstack/react-query").UseQueryResult<readonly TokenWrapperPair[], Error>;
|
|
1055
936
|
//#endregion
|
|
1056
937
|
//#region src/wrappers-registry/use-token-pairs-length.d.ts
|
|
1057
938
|
/**
|
|
1058
939
|
* Returns the total number of token wrapper pairs in the registry.
|
|
1059
940
|
*/
|
|
1060
|
-
declare function useTokenPairsLength():
|
|
941
|
+
declare function useTokenPairsLength(): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
1061
942
|
//#endregion
|
|
1062
943
|
//#region src/wrappers-registry/use-token-pairs-slice.d.ts
|
|
1063
944
|
/**
|
|
@@ -1072,7 +953,7 @@ declare function useTokenPairsSlice({
|
|
|
1072
953
|
}: {
|
|
1073
954
|
fromIndex: bigint | undefined;
|
|
1074
955
|
toIndex: bigint | undefined;
|
|
1075
|
-
}):
|
|
956
|
+
}): import("@tanstack/react-query").UseQueryResult<readonly TokenWrapperPair[], Error>;
|
|
1076
957
|
//#endregion
|
|
1077
958
|
//#region src/wrappers-registry/use-token-pair.d.ts
|
|
1078
959
|
/**
|
|
@@ -1084,7 +965,7 @@ declare function useTokenPair({
|
|
|
1084
965
|
index
|
|
1085
966
|
}: {
|
|
1086
967
|
index: bigint | undefined;
|
|
1087
|
-
}):
|
|
968
|
+
}): import("@tanstack/react-query").UseQueryResult<TokenWrapperPair, Error>;
|
|
1088
969
|
//#endregion
|
|
1089
970
|
//#region src/wrappers-registry/use-confidential-token-address.d.ts
|
|
1090
971
|
/**
|
|
@@ -1094,7 +975,7 @@ declare function useConfidentialTokenAddress({
|
|
|
1094
975
|
tokenAddress
|
|
1095
976
|
}: {
|
|
1096
977
|
tokenAddress: Address | undefined;
|
|
1097
|
-
}):
|
|
978
|
+
}): import("@tanstack/react-query").UseQueryResult<readonly [boolean, `0x${string}`], Error>;
|
|
1098
979
|
//#endregion
|
|
1099
980
|
//#region src/wrappers-registry/use-token-address.d.ts
|
|
1100
981
|
/**
|
|
@@ -1104,7 +985,7 @@ declare function useTokenAddress({
|
|
|
1104
985
|
confidentialTokenAddress
|
|
1105
986
|
}: {
|
|
1106
987
|
confidentialTokenAddress: Address | undefined;
|
|
1107
|
-
}):
|
|
988
|
+
}): import("@tanstack/react-query").UseQueryResult<readonly [boolean, `0x${string}`], Error>;
|
|
1108
989
|
//#endregion
|
|
1109
990
|
//#region src/wrappers-registry/use-is-confidential-token-valid.d.ts
|
|
1110
991
|
/**
|
|
@@ -1117,7 +998,7 @@ declare function useIsConfidentialTokenValid({
|
|
|
1117
998
|
confidentialTokenAddress
|
|
1118
999
|
}: {
|
|
1119
1000
|
confidentialTokenAddress: Address | undefined;
|
|
1120
|
-
}):
|
|
1001
|
+
}): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
1121
1002
|
//#endregion
|
|
1122
1003
|
//#region src/wrappers-registry/use-list-pairs.d.ts
|
|
1123
1004
|
/**
|
|
@@ -1141,7 +1022,7 @@ declare function useListPairs({
|
|
|
1141
1022
|
page?: number;
|
|
1142
1023
|
pageSize?: number;
|
|
1143
1024
|
metadata?: boolean;
|
|
1144
|
-
}):
|
|
1025
|
+
}): import("@tanstack/react-query").UseQueryResult<PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>, Error>;
|
|
1145
1026
|
//#endregion
|
|
1146
|
-
export { type UseConfidentialBalanceConfig, type UseConfidentialBalanceOptions, type UseConfidentialBalancesConfig, type UseConfidentialBalancesOptions, type UseConfidentialIsOperatorConfig, type UseConfidentialIsOperatorSuspenseConfig, type UseConfidentialTransferConfig, type UseDelegationStatusConfig, type UseHasPermitConfig, type UseShieldConfig, type UseUnderlyingAllowanceConfig, type UseUnderlyingAllowanceSuspenseConfig, type UseUserDecryptResult, type UseWrapperDiscoveryConfig, type UseWrapperDiscoverySuspenseConfig, ZamaProvider, type ZamaProviderProps, useApproveUnderlying, useBatchDecryptBalancesAs, useClearCredentials, useConfidentialBalance, useConfidentialBalances, useConfidentialIsOperator, useConfidentialIsOperatorSuspense, useConfidentialSetOperator, useConfidentialTokenAddress, useConfidentialTransfer, useConfidentialTransferFrom,
|
|
1027
|
+
export { type UseConfidentialBalanceConfig, type UseConfidentialBalanceOptions, type UseConfidentialBalancesConfig, type UseConfidentialBalancesOptions, type UseConfidentialIsOperatorConfig, type UseConfidentialIsOperatorSuspenseConfig, type UseConfidentialTransferConfig, type UseDelegationStatusConfig, type UseHasPermitConfig, type UseShieldConfig, type UseUnderlyingAllowanceConfig, type UseUnderlyingAllowanceSuspenseConfig, type UseUserDecryptResult, type UseWrapperDiscoveryConfig, type UseWrapperDiscoverySuspenseConfig, ZamaProvider, type ZamaProviderProps, useApproveUnderlying, useBatchDecryptBalancesAs, useClearCredentials, useConfidentialBalance, useConfidentialBalances, useConfidentialIsOperator, useConfidentialIsOperatorSuspense, useConfidentialSetOperator, useConfidentialTokenAddress, useConfidentialTransfer, useConfidentialTransferFrom, useDecryptBalanceAs, useDelegateDecryption, useDelegatedDecrypt, useDelegationStatus, useEncrypt, useFinalizeUnwrap, useGrantPermit, useHasPermit, useIsConfidential, useIsConfidentialSuspense, useIsConfidentialTokenValid, useIsWrapper, useIsWrapperSuspense, useListPairs, useMetadata, useMetadataSuspense, usePublicDecrypt, useResumeUnshield, useRevokeDelegation, useRevokePermits, useShield, useToken, useTokenAddress, useTokenPair, useTokenPairsLength, useTokenPairsRegistry, useTokenPairsSlice, useTotalSupply, useTotalSupplySuspense, useUnderlyingAllowance, useUnderlyingAllowanceSuspense, useUnshield, useUnshieldAll, useUnwrap, useUnwrapAll, useUserDecrypt, useWrappedToken, useWrapperDiscovery, useWrapperDiscoverySuspense, useWrappersRegistryAddress, useZamaSDK };
|
|
1147
1028
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{ZamaSDK as e}from"@zama-fhe/sdk";import{approveUnderlyingMutationOptions as t,batchDecryptBalancesAsMutationOptions as n,clearCredentialsMutationOptions as r,confidentialBalanceQueryOptions as i,confidentialBalancesQueryOptions as a,confidentialIsOperatorQueryOptions as o,confidentialSetOperatorMutationOptions as s,confidentialTokenAddressQueryOptions as c,confidentialTransferFromMutationOptions as ee,confidentialTransferMutationOptions as te,createDelegatedUserDecryptEIP712MutationOptions as ne,createEIP712MutationOptions as re,decryptBalanceAsMutationOptions as ie,delegateDecryptionMutationOptions as ae,delegatedDecryptMutationOptions as oe,delegationStatusQueryOptions as se,encryptMutationOptions as ce,finalizeUnwrapMutationOptions as le,generateKeypairMutationOptions as ue,grantPermitMutationOptions as de,hasPermitQueryOptions as fe,hashFn as l,invalidateAfterApproveUnderlying as u,invalidateAfterSetOperator as d,invalidateAfterShield as pe,invalidateAfterTransfer as f,invalidateAfterUnshield as p,invalidateAfterUnwrap as m,invalidateWalletLifecycleQueries as h,isConfidentialQueryOptions as g,isConfidentialTokenValidQueryOptions as me,isWrapperQueryOptions as _,listPairsQueryOptions as he,publicDecryptMutationOptions as ge,publicKeyQueryOptions as _e,publicParamsQueryOptions as ve,requestZKProofVerificationMutationOptions as v,resumeUnshieldMutationOptions as y,revokeDelegationMutationOptions as b,revokePermitsMutationOptions as x,shieldMutationOptions as S,tokenAddressQueryOptions as C,tokenMetadataQueryOptions as w,tokenPairQueryOptions as T,tokenPairsLengthQueryOptions as E,tokenPairsQueryOptions as D,tokenPairsSliceQueryOptions as O,totalSupplyQueryOptions as k,underlyingAllowanceQueryOptions as A,unshieldAllMutationOptions as j,unshieldMutationOptions as M,unwrapAllMutationOptions as N,unwrapMutationOptions as P,userDecryptQueryOptions as F,wrapperDiscoveryQueryOptions as I,zamaQueryKeys as L}from"@zama-fhe/sdk/query";import{useMutation as R,useQuery as ye,useQueryClient as z,useSuspenseQuery as be}from"@tanstack/react-query";import{createContext as xe,useContext as Se,useEffect as B,useMemo as V,useRef as Ce,useSyncExternalStore as we}from"react";import{jsx as Te}from"react/jsx-runtime";const H=xe(null);function Ee({children:t,config:n}){let r=z(),i=Ce(n.onEvent);B(()=>{i.current=n.onEvent});let a=V(()=>new e({...n,onEvent:i.current}),[n]);return B(()=>a.onWalletAccountChange(({previous:e})=>{e&&h(r)}),[a,r]),B(()=>()=>a.dispose(),[a]),Te(H.Provider,{value:a,children:t})}function U(){let e=Se(H);if(!e)throw Error(`useZamaSDK must be used within a <ZamaProvider>. Wrap your component tree in <ZamaProvider config={createConfig(...)}>.`);return e}function De(){return R(ce(U()))}function W(e){return ye({...e,queryKeyHashFn:l})}function G(e){return be({...e,queryKeyHashFn:l})}function K(e){return we(t=>e.onWalletAccountChange(t),()=>e.signer?.walletAccount.getSnapshot(),()=>void 0)}function Oe(e,t){let n=U(),r=F(n,e,{walletAccount:K(n)});return W({...r,...t,enabled:r.enabled&&(t?.enabled??!1)})}function ke(){return R(ge(U()))}function Ae(){return R(ue(U()))}function je(){return R(re(U()))}function q(){return R(ne(U()))}function Me(){return R(oe(U()))}function Ne(){return R(v(U()))}function Pe(){return W(_e(U()))}function Fe(e){return W(ve(U(),e))}function Ie(e){return R({...de(U()),...e,onSuccess:(t,n,r,i)=>{e?.onSuccess?.(t,n,r,i),i.client.removeQueries({queryKey:L.hasPermit.all})}})}function Le(e){let t=U();return W(fe(t,e,{walletAccount:K(t)}))}function Re(e){return R({...x(U()),...e,onSuccess:(t,n,r,i)=>{e?.onSuccess?.(t,n,r,i),i.client.removeQueries({queryKey:L.hasPermit.all}),i.client.removeQueries({queryKey:L.decryption.all})}})}function ze(e){return R({...r(U()),...e,onSuccess:(t,n,r,i)=>{e?.onSuccess?.(t,n,r,i),i.client.removeQueries({queryKey:L.hasPermit.all}),i.client.removeQueries({queryKey:L.decryption.all})}})}function J(e){let t=U();return V(()=>t.createToken(e),[t,e])}function Y(e){let t=U();return V(()=>t.createWrappedToken(e),[t,e])}function Be(e,t){let{address:n,account:r}=e,{enabled:a=!0}=t??{},o=J(n),s=K(o.sdk),c=i(o,{tokenAddress:n,account:r},{walletAccount:s});return W({...c,...t,enabled:!!c.enabled&&a})}function Ve(e,t){let{addresses:n,account:r}=e,{enabled:i=!0}=t??{},o=U(),s=K(o),c=a(V(()=>n.map(e=>o.createToken(e)),[o,n]),{account:r},{walletAccount:s});return W({...c,...t,enabled:!!c.enabled&&i})}function X(e,t){let n=e?t:void 0;return{wrappedContext:n,callerContext:e?n?.callerContext:t}}async function Z({queryClient:e,tokenAddress:t,amount:n,mode:r}){let i=L.confidentialBalance.token(t);await e.cancelQueries({queryKey:i});let a=e.getQueriesData({queryKey:i});for(let[t,i]of a)i!==void 0&&e.setQueryData(t,r===`add`?i+n:i-n);return a}function Q(e,t){for(let[n,r]of t)e.setQueryData(n,r)}function He({optimistic:e,tokenAddress:t,queryClient:n,options:r}){return{onMutate:e?async(e,i)=>({snapshot:await Z({queryClient:n,tokenAddress:t,amount:e.amount,mode:`add`}),callerContext:await r?.onMutate?.(e,i)}):r?.onMutate,onError:(t,i,a,o)=>{let{wrappedContext:s,callerContext:c}=X(e,a);try{s&&Q(n,s.snapshot)}finally{r?.onError?.(t,i,c,o)}},onSuccess:(n,i,a,o)=>{let{callerContext:s}=X(e,a);r?.onSuccess?.(n,i,s,o),pe(o.client,t)},onSettled:(t,n,i,a,o)=>{let{callerContext:s}=X(e,a);r?.onSettled?.(t,n,i,s,o)}}}function Ue(e,t){let n=J(e.address),r=z();return R({...te(n),...t,onMutate:e.optimistic?async(e,i)=>({snapshot:await Z({queryClient:r,tokenAddress:n.address,amount:e.amount,mode:`subtract`}),callerContext:await t?.onMutate?.(e,i)}):t?.onMutate,onError:(n,i,a,o)=>{let{wrappedContext:s,callerContext:c}=X(e.optimistic,a);try{s&&Q(r,s.snapshot)}finally{t?.onError?.(n,i,c,o)}},onSuccess:(r,i,a,o)=>{let{callerContext:s}=X(e.optimistic,a);t?.onSuccess?.(r,i,s,o),f(o.client,n.address)},onSettled:(n,r,i,a,o)=>{let{callerContext:s}=X(e.optimistic,a);t?.onSettled?.(n,r,i,s,o)}})}function We(e,t){let n=J(e);return R({...ee(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),f(a.client,n.address)}})}function Ge(e,t){let n=J(e);return R({...s(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),d(a.client,n.address)}})}function Ke(e,t){let{address:n,spender:r,holder:i}=e,a=o(U(),n,{holder:i,spender:r});return W({...a,...t,enabled:(a.enabled??!0)&&(t?.enabled??!0)})}function qe(e){let{spender:t,holder:n,address:r}=e;return G(o(U(),r,{holder:n,spender:t}))}function Je(e,t){let n=Y(e.address),r=z();return R({...S(n),...t,...He({optimistic:e.optimistic,tokenAddress:n.address,queryClient:r,options:t})})}function Ye(e,t){let n=Y(e);return R({...P(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),m(a.client,n.address)}})}function Xe(e,t){let n=Y(e);return R({...N(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),m(a.client,n.address)}})}function Ze(e,t){let n=Y(e);return R({...le(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),p(a.client,n.address)}})}function Qe(e,t){let n=Y(e);return R({...M(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),p(a.client,n.address)}})}function $e(e,t){let n=Y(e);return R({...j(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),p(a.client,n.address)}})}function et(e,t){let n=Y(e);return R({...y(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),p(a.client,n.address)}})}function tt(e,t){let{address:n,owner:r}=e,i=A(U(),n,{owner:r});return W({...i,...t,enabled:(i.enabled??!0)&&(t?.enabled??!0)})}function nt(e){let{address:t,owner:n}=e;return G(A(U(),t,{owner:n}))}function $(){let e=U(),{data:t}=W({queryKey:L.wrappersRegistry.chainId(),queryFn:()=>e.provider.getChainId(),staleTime:3e4});return t===void 0?void 0:e.registry.getAddress(t)}function rt(e,t){let{tokenAddress:n,erc20Address:r}=e,i=U(),a=$(),o=I(i.registry,{tokenAddress:n,erc20Address:r,registryAddress:a});return W({...o,...t,enabled:(o.enabled??!0)&&(t?.enabled??!0)})}function it(e){let{tokenAddress:t,erc20Address:n}=e,r=U(),i=$();return G(I(r.registry,{tokenAddress:t,erc20Address:n,registryAddress:i}))}function at(e,t){return W({...w(U(),e),...t})}function ot(e){return G(w(U(),e))}function st(e,t){return R({...ae(U(),e),...t,onSuccess:(e,n,r,i)=>{try{t?.onSuccess?.(e,n,r,i)}finally{i.client.invalidateQueries({queryKey:L.delegationStatus.all})}}})}function ct(e,t){return R({...b(U(),e),...t,onSuccess:(e,n,r,i)=>{try{t?.onSuccess?.(e,n,r,i)}finally{i.client.invalidateQueries({queryKey:L.delegationStatus.all})}}})}function lt(e,t){let n=se(U(),e);return W({...n,...t,enabled:(n.enabled??!0)&&(t?.enabled??!0)})}function ut(e,t){return R({...ie(J(e)),...t})}function dt(e,t){return R({...n(e),...t})}function ft(e,n){let r=Y(e);return R({...t(r),...n,onSuccess:(e,t,i,a)=>{n?.onSuccess?.(e,t,i,a),u(a.client,r.address)}})}function pt(e,t){return W({...g(U(),e),...t})}function mt(e){return G(g(U(),e))}function ht(e,t){return W({..._(U(),e),...t})}function gt(e){return G(_(U(),e))}function _t(e,t){return W({...k(U(),e),...t})}function vt(e){return G(k(U(),e))}function yt(){return W(D(U(),{registryAddress:$()}))}function bt(){return W(E(U(),{registryAddress:$()}))}function xt({fromIndex:e,toIndex:t}){return W(O(U(),{registryAddress:$(),fromIndex:e,toIndex:t}))}function St({index:e}){return W(T(U(),{registryAddress:$(),index:e}))}function Ct({tokenAddress:e}){return W(c(U(),{registryAddress:$(),tokenAddress:e}))}function wt({confidentialTokenAddress:e}){return W(C(U(),{registryAddress:$(),confidentialTokenAddress:e}))}function Tt({confidentialTokenAddress:e}){return W(me(U(),{registryAddress:$(),confidentialTokenAddress:e}))}function Et({page:e=1,pageSize:t=100,metadata:n=!1}={}){let r=U(),i=$();return W(he(r.registry,{registryAddress:i,page:e,pageSize:t,metadata:n}))}export{Ee as ZamaProvider,ft as useApproveUnderlying,dt as useBatchDecryptBalancesAs,ze as useClearCredentials,Be as useConfidentialBalance,Ve as useConfidentialBalances,Ke as useConfidentialIsOperator,qe as useConfidentialIsOperatorSuspense,Ge as useConfidentialSetOperator,Ct as useConfidentialTokenAddress,Ue as useConfidentialTransfer,We as useConfidentialTransferFrom,q as useCreateDelegatedUserDecryptEIP712,je as useCreateEIP712,ut as useDecryptBalanceAs,st as useDelegateDecryption,Me as useDelegatedDecrypt,lt as useDelegationStatus,De as useEncrypt,Ze as useFinalizeUnwrap,Ae as useGenerateKeypair,Ie as useGrantPermit,Le as useHasPermit,pt as useIsConfidential,mt as useIsConfidentialSuspense,Tt as useIsConfidentialTokenValid,ht as useIsWrapper,gt as useIsWrapperSuspense,Et as useListPairs,at as useMetadata,ot as useMetadataSuspense,ke as usePublicDecrypt,Pe as usePublicKey,Fe as usePublicParams,Ne as useRequestZKProofVerification,et as useResumeUnshield,ct as useRevokeDelegation,Re as useRevokePermits,Je as useShield,J as useToken,wt as useTokenAddress,St as useTokenPair,bt as useTokenPairsLength,yt as useTokenPairsRegistry,xt as useTokenPairsSlice,_t as useTotalSupply,vt as useTotalSupplySuspense,tt as useUnderlyingAllowance,nt as useUnderlyingAllowanceSuspense,Qe as useUnshield,$e as useUnshieldAll,Ye as useUnwrap,Xe as useUnwrapAll,Oe as useUserDecrypt,Y as useWrappedToken,rt as useWrapperDiscovery,it as useWrapperDiscoverySuspense,$ as useWrappersRegistryAddress,U as useZamaSDK};
|
|
1
|
+
"use client";import{ZamaSDK as e}from"@zama-fhe/sdk";import{approveUnderlyingMutationOptions as t,batchDecryptBalancesAsMutationOptions as n,clearCredentialsMutationOptions as r,confidentialBalanceQueryOptions as i,confidentialBalancesQueryOptions as a,confidentialIsOperatorQueryOptions as o,confidentialSetOperatorMutationOptions as s,confidentialTokenAddressQueryOptions as c,confidentialTransferFromMutationOptions as l,confidentialTransferMutationOptions as ee,decryptBalanceAsMutationOptions as te,delegateDecryptionMutationOptions as ne,delegatedDecryptMutationOptions as re,delegationStatusQueryOptions as ie,encryptMutationOptions as ae,finalizeUnwrapMutationOptions as oe,grantPermitMutationOptions as u,hasPermitQueryOptions as d,hashFn as f,invalidateAfterApproveUnderlying as p,invalidateAfterSetOperator as m,invalidateAfterShield as se,invalidateAfterTransfer as h,invalidateAfterUnshield as g,invalidateAfterUnwrap as _,invalidateWalletLifecycleQueries as v,isConfidentialQueryOptions as y,isConfidentialTokenValidQueryOptions as b,isWrapperQueryOptions as x,listPairsQueryOptions as ce,publicDecryptMutationOptions as le,resumeUnshieldMutationOptions as ue,revokeDelegationMutationOptions as de,revokePermitsMutationOptions as fe,shieldMutationOptions as pe,tokenAddressQueryOptions as me,tokenMetadataQueryOptions as S,tokenPairQueryOptions as C,tokenPairsLengthQueryOptions as w,tokenPairsQueryOptions as T,tokenPairsSliceQueryOptions as E,totalSupplyQueryOptions as D,underlyingAllowanceQueryOptions as O,unshieldAllMutationOptions as k,unshieldMutationOptions as A,unwrapAllMutationOptions as j,unwrapMutationOptions as M,userDecryptQueryOptions as N,wrapperDiscoveryQueryOptions as P,zamaQueryKeys as F}from"@zama-fhe/sdk/query";import{useMutation as I,useQuery as L,useQueryClient as R,useSuspenseQuery as z}from"@tanstack/react-query";import{createContext as he,useContext as ge,useEffect as B,useMemo as V,useRef as _e,useSyncExternalStore as ve}from"react";import{jsx as ye}from"react/jsx-runtime";const H=he(null);function be({children:t,config:n}){let r=R(),i=_e(n.onEvent);B(()=>{i.current=n.onEvent});let a=V(()=>new e({...n,onEvent:i.current}),[n]);return B(()=>a.onWalletAccountChange(({previous:e})=>{e&&v(r)}),[a,r]),B(()=>()=>a.dispose(),[a]),ye(H.Provider,{value:a,children:t})}function U(){let e=ge(H);if(!e)throw Error(`useZamaSDK must be used within a <ZamaProvider>. Wrap your component tree in <ZamaProvider config={createConfig(...)}>.`);return e}function xe(){return I(ae(U()))}function W(e){return L({...e,queryKeyHashFn:f})}function G(e){return z({...e,queryKeyHashFn:f})}function K(e){return ve(t=>e.onWalletAccountChange(t),()=>e.signer?.walletAccount.getSnapshot(),()=>void 0)}function Se(e,t){let n=U(),r=N(n,e,{walletAccount:K(n)});return W({...r,...t,enabled:r.enabled&&(t?.enabled??!1)})}function Ce(){return I(le(U()))}function q(){return I(re(U()))}function we(e){return I({...u(U()),...e,onSuccess:(t,n,r,i)=>{e?.onSuccess?.(t,n,r,i),i.client.removeQueries({queryKey:F.hasPermit.all})}})}function Te(e){let t=U();return W(d(t,e,{walletAccount:K(t)}))}function Ee(e){return I({...fe(U()),...e,onSuccess:(t,n,r,i)=>{e?.onSuccess?.(t,n,r,i),i.client.removeQueries({queryKey:F.hasPermit.all}),i.client.removeQueries({queryKey:F.decryption.all})}})}function De(e){return I({...r(U()),...e,onSuccess:(t,n,r,i)=>{e?.onSuccess?.(t,n,r,i),i.client.removeQueries({queryKey:F.hasPermit.all}),i.client.removeQueries({queryKey:F.decryption.all})}})}function J(e){let t=U();return V(()=>t.createToken(e),[t,e])}function Y(e){let t=U();return V(()=>t.createWrappedToken(e),[t,e])}function Oe(e,t){let{address:n,account:r}=e,{enabled:a=!0}=t??{},o=J(n),s=K(o.sdk),c=i(o,{tokenAddress:n,account:r},{walletAccount:s});return W({...c,...t,enabled:!!c.enabled&&a})}function ke(e,t){let{addresses:n,account:r}=e,{enabled:i=!0}=t??{},o=U(),s=K(o),c=a(V(()=>n.map(e=>o.createToken(e)),[o,n]),{account:r},{walletAccount:s});return W({...c,...t,enabled:!!c.enabled&&i})}function X(e,t){let n=e?t:void 0;return{wrappedContext:n,callerContext:e?n?.callerContext:t}}async function Z({queryClient:e,tokenAddress:t,amount:n,mode:r}){let i=F.confidentialBalance.token(t);await e.cancelQueries({queryKey:i});let a=e.getQueriesData({queryKey:i});for(let[t,i]of a)i!==void 0&&e.setQueryData(t,r===`add`?i+n:i-n);return a}function Q(e,t){for(let[n,r]of t)e.setQueryData(n,r)}function Ae({optimistic:e,tokenAddress:t,queryClient:n,options:r}){return{onMutate:e?async(e,i)=>({snapshot:await Z({queryClient:n,tokenAddress:t,amount:e.amount,mode:`add`}),callerContext:await r?.onMutate?.(e,i)}):r?.onMutate,onError:(t,i,a,o)=>{let{wrappedContext:s,callerContext:c}=X(e,a);try{s&&Q(n,s.snapshot)}finally{r?.onError?.(t,i,c,o)}},onSuccess:(n,i,a,o)=>{let{callerContext:s}=X(e,a);r?.onSuccess?.(n,i,s,o),se(o.client,t)},onSettled:(t,n,i,a,o)=>{let{callerContext:s}=X(e,a);r?.onSettled?.(t,n,i,s,o)}}}function je(e,t){let n=J(e.address),r=R();return I({...ee(n),...t,onMutate:e.optimistic?async(e,i)=>({snapshot:await Z({queryClient:r,tokenAddress:n.address,amount:e.amount,mode:`subtract`}),callerContext:await t?.onMutate?.(e,i)}):t?.onMutate,onError:(n,i,a,o)=>{let{wrappedContext:s,callerContext:c}=X(e.optimistic,a);try{s&&Q(r,s.snapshot)}finally{t?.onError?.(n,i,c,o)}},onSuccess:(r,i,a,o)=>{let{callerContext:s}=X(e.optimistic,a);t?.onSuccess?.(r,i,s,o),h(o.client,n.address)},onSettled:(n,r,i,a,o)=>{let{callerContext:s}=X(e.optimistic,a);t?.onSettled?.(n,r,i,s,o)}})}function Me(e,t){let n=J(e);return I({...l(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),h(a.client,n.address)}})}function Ne(e,t){let n=J(e);return I({...s(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),m(a.client,n.address)}})}function Pe(e,t){let{address:n,spender:r,holder:i}=e,a=o(U(),n,{holder:i,spender:r});return W({...a,...t,enabled:(a.enabled??!0)&&(t?.enabled??!0)})}function Fe(e){let{spender:t,holder:n,address:r}=e;return G(o(U(),r,{holder:n,spender:t}))}function Ie(e,t){let n=Y(e.address),r=R();return I({...pe(n),...t,...Ae({optimistic:e.optimistic,tokenAddress:n.address,queryClient:r,options:t})})}function Le(e,t){let n=Y(e);return I({...M(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),_(a.client,n.address)}})}function Re(e,t){let n=Y(e);return I({...j(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),_(a.client,n.address)}})}function ze(e,t){let n=Y(e);return I({...oe(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),g(a.client,n.address)}})}function Be(e,t){let n=Y(e);return I({...A(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),g(a.client,n.address)}})}function Ve(e,t){let n=Y(e);return I({...k(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),g(a.client,n.address)}})}function He(e,t){let n=Y(e);return I({...ue(n),...t,onSuccess:(e,r,i,a)=>{t?.onSuccess?.(e,r,i,a),g(a.client,n.address)}})}function Ue(e,t){let{address:n,owner:r}=e,i=O(U(),n,{owner:r});return W({...i,...t,enabled:(i.enabled??!0)&&(t?.enabled??!0)})}function We(e){let{address:t,owner:n}=e;return G(O(U(),t,{owner:n}))}function $(){let e=U(),{data:t}=W({queryKey:F.wrappersRegistry.chainId(),queryFn:()=>e.provider.getChainId(),staleTime:3e4});return t===void 0?void 0:e.registry.getAddress(t)}function Ge(e,t){let{tokenAddress:n,erc20Address:r}=e,i=U(),a=$(),o=P(i.registry,{tokenAddress:n,erc20Address:r,registryAddress:a});return W({...o,...t,enabled:(o.enabled??!0)&&(t?.enabled??!0)})}function Ke(e){let{tokenAddress:t,erc20Address:n}=e,r=U(),i=$();return G(P(r.registry,{tokenAddress:t,erc20Address:n,registryAddress:i}))}function qe(e,t){return W({...S(U(),e),...t})}function Je(e){return G(S(U(),e))}function Ye(e,t){return I({...ne(U(),e),...t,onSuccess:(e,n,r,i)=>{try{t?.onSuccess?.(e,n,r,i)}finally{i.client.invalidateQueries({queryKey:F.delegationStatus.all})}}})}function Xe(e,t){return I({...de(U(),e),...t,onSuccess:(e,n,r,i)=>{try{t?.onSuccess?.(e,n,r,i)}finally{i.client.invalidateQueries({queryKey:F.delegationStatus.all})}}})}function Ze(e,t){let n=ie(U(),e);return W({...n,...t,enabled:(n.enabled??!0)&&(t?.enabled??!0)})}function Qe(e,t){return I({...te(J(e)),...t})}function $e(e,t){return I({...n(e),...t})}function et(e,n){let r=Y(e);return I({...t(r),...n,onSuccess:(e,t,i,a)=>{n?.onSuccess?.(e,t,i,a),p(a.client,r.address)}})}function tt(e,t){return W({...y(U(),e),...t})}function nt(e){return G(y(U(),e))}function rt(e,t){return W({...x(U(),e),...t})}function it(e){return G(x(U(),e))}function at(e,t){return W({...D(U(),e),...t})}function ot(e){return G(D(U(),e))}function st(){return W(T(U(),{registryAddress:$()}))}function ct(){return W(w(U(),{registryAddress:$()}))}function lt({fromIndex:e,toIndex:t}){return W(E(U(),{registryAddress:$(),fromIndex:e,toIndex:t}))}function ut({index:e}){return W(C(U(),{registryAddress:$(),index:e}))}function dt({tokenAddress:e}){return W(c(U(),{registryAddress:$(),tokenAddress:e}))}function ft({confidentialTokenAddress:e}){return W(me(U(),{registryAddress:$(),confidentialTokenAddress:e}))}function pt({confidentialTokenAddress:e}){return W(b(U(),{registryAddress:$(),confidentialTokenAddress:e}))}function mt({page:e=1,pageSize:t=100,metadata:n=!1}={}){let r=U(),i=$();return W(ce(r.registry,{registryAddress:i,page:e,pageSize:t,metadata:n}))}export{be as ZamaProvider,et as useApproveUnderlying,$e as useBatchDecryptBalancesAs,De as useClearCredentials,Oe as useConfidentialBalance,ke as useConfidentialBalances,Pe as useConfidentialIsOperator,Fe as useConfidentialIsOperatorSuspense,Ne as useConfidentialSetOperator,dt as useConfidentialTokenAddress,je as useConfidentialTransfer,Me as useConfidentialTransferFrom,Qe as useDecryptBalanceAs,Ye as useDelegateDecryption,q as useDelegatedDecrypt,Ze as useDelegationStatus,xe as useEncrypt,ze as useFinalizeUnwrap,we as useGrantPermit,Te as useHasPermit,tt as useIsConfidential,nt as useIsConfidentialSuspense,pt as useIsConfidentialTokenValid,rt as useIsWrapper,it as useIsWrapperSuspense,mt as useListPairs,qe as useMetadata,Je as useMetadataSuspense,Ce as usePublicDecrypt,He as useResumeUnshield,Xe as useRevokeDelegation,Ee as useRevokePermits,Ie as useShield,J as useToken,ft as useTokenAddress,ut as useTokenPair,ct as useTokenPairsLength,st as useTokenPairsRegistry,lt as useTokenPairsSlice,at as useTotalSupply,ot as useTotalSupplySuspense,Ue as useUnderlyingAllowance,We as useUnderlyingAllowanceSuspense,Be as useUnshield,Ve as useUnshieldAll,Le as useUnwrap,Re as useUnwrapAll,Se as useUserDecrypt,Y as useWrappedToken,Ge as useWrapperDiscovery,Ke as useWrapperDiscoverySuspense,$ as useWrappersRegistryAddress,U as useZamaSDK};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useQuery","tanstack_useQuery","useSuspenseQuery","tanstack_useSuspenseQuery","useQuery","useQuery","useQuery","useQuery","useQuery","useQuery","typed","useQuery","useSuspenseQuery","useQuery","useSuspenseQuery","useQuery","useQuery","useSuspenseQuery","useQuery","useSuspenseQuery","useQuery","useQuery","useSuspenseQuery","useQuery","useSuspenseQuery","useQuery","useQuery","useQuery","useQuery","useQuery","useQuery","useQuery","useQuery"],"sources":["../src/provider.tsx","../src/relayer/use-encrypt.ts","../src/utils/query.ts","../src/utils/wallet-account.ts","../src/decrypt/use-user-decrypt.ts","../src/decrypt/use-public-decrypt.ts","../src/relayer/use-generate-keypair.ts","../src/relayer/use-create-eip712.ts","../src/relayer/use-create-delegated-user-decrypt-eip712.ts","../src/decrypt/use-delegated-decrypt.ts","../src/relayer/use-request-zk-proof-verification.ts","../src/relayer/use-public-key.ts","../src/relayer/use-public-params.ts","../src/permits/use-grant-permit.ts","../src/permits/use-has-permit.ts","../src/permits/use-revoke-permits.ts","../src/permits/use-clear-credentials.ts","../src/token/use-token.ts","../src/token/use-wrapped-token.ts","../src/balance/use-confidential-balance.ts","../src/balance/use-confidential-balances.ts","../src/balance/optimistic-balance-update.ts","../src/transfer/use-confidential-transfer.ts","../src/transfer/use-confidential-transfer-from.ts","../src/operator/use-confidential-set-operator.ts","../src/operator/use-confidential-is-operator.ts","../src/shield/use-shield.ts","../src/unwrap/use-unwrap.ts","../src/unwrap/use-unwrap-all.ts","../src/unwrap/use-finalize-unwrap.ts","../src/unshield/use-unshield.ts","../src/unshield/use-unshield-all.ts","../src/unshield/use-resume-unshield.ts","../src/shield/use-underlying-allowance.ts","../src/wrappers-registry/use-wrappers-registry-address.ts","../src/token/use-wrapper-discovery.ts","../src/token/use-metadata.ts","../src/delegations/use-delegate-decryption.ts","../src/delegations/use-revoke-delegation.ts","../src/delegations/use-delegation-status.ts","../src/delegations/use-decrypt-balance-as.ts","../src/delegations/use-batch-decrypt-balances-as.ts","../src/shield/use-approve-underlying.ts","../src/token/use-is-confidential.ts","../src/token/use-total-supply.ts","../src/wrappers-registry/use-token-pairs-registry.ts","../src/wrappers-registry/use-token-pairs-length.ts","../src/wrappers-registry/use-token-pairs-slice.ts","../src/wrappers-registry/use-token-pair.ts","../src/wrappers-registry/use-confidential-token-address.ts","../src/wrappers-registry/use-token-address.ts","../src/wrappers-registry/use-is-confidential-token-valid.ts","../src/wrappers-registry/use-list-pairs.ts"],"sourcesContent":["\"use client\";\n\nimport type { ZamaConfig } from \"@zama-fhe/sdk\";\nimport { ZamaSDK } from \"@zama-fhe/sdk\";\nimport { invalidateWalletLifecycleQueries } from \"@zama-fhe/sdk/query\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport {\n createContext,\n type PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\n\n/** Props for {@link ZamaProvider}. */\nexport interface ZamaProviderProps extends PropsWithChildren {\n /** Configuration object created by {@link createConfig}. */\n config: ZamaConfig;\n}\n\nconst ZamaSDKContext = createContext<ZamaSDK | null>(null);\n\n/**\n * Provides a {@link ZamaSDK} instance to all descendant hooks.\n *\n * @example\n * ```tsx\n * <ZamaProvider config={zamaConfig}>\n * <App />\n * </ZamaProvider>\n * ```\n */\nexport function ZamaProvider({ children, config }: ZamaProviderProps) {\n const queryClient = useQueryClient();\n\n // Stabilize onEvent so an inline arrow doesn't recreate the SDK every render.\n const onEventRef = useRef(config.onEvent);\n\n useEffect(() => {\n onEventRef.current = config.onEvent;\n });\n\n const sdk = useMemo(() => new ZamaSDK({ ...config, onEvent: onEventRef.current }), [config]);\n\n // SDK internally does credential/cache cleanup. React layer clears the\n // wallet-lifecycle query state.\n useEffect(\n () =>\n sdk.onWalletAccountChange(({ previous }) => {\n if (previous) {\n invalidateWalletLifecycleQueries(queryClient);\n }\n }),\n [sdk, queryClient],\n );\n\n // Clean up SDK-owned signer subscriptions on unmount without terminating\n // the caller-owned relayer. dispose() is idempotent.\n useEffect(() => () => sdk.dispose(), [sdk]);\n\n return <ZamaSDKContext.Provider value={sdk}>{children}</ZamaSDKContext.Provider>;\n}\n\n/**\n * Access the {@link ZamaSDK} instance from context.\n * Throws if called outside a {@link ZamaProvider}.\n *\n * @example\n * ```tsx\n * const sdk = useZamaSDK();\n * const token = sdk.createToken(\"0x...\");\n * ```\n */\nexport function useZamaSDK(): ZamaSDK {\n const context = useContext(ZamaSDKContext);\n\n if (!context) {\n throw new Error(\n \"useZamaSDK must be used within a <ZamaProvider>. \" +\n \"Wrap your component tree in <ZamaProvider config={createConfig(...)}>.\",\n );\n }\n return context;\n}\n","\"use client\";\n\nimport type { EncryptParams, EncryptResult } from \"@zama-fhe/sdk\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { encryptMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Encrypt a plaintext value using FHE.\n * Calls the relayer's `encrypt` method via a mutation.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link EncryptionFailedError} — FHE encryption failed\n *\n * @returns A mutation whose `mutate` accepts {@link EncryptParams}.\n *\n * @example\n * ```tsx\n * const encrypt = useEncrypt();\n * encrypt.mutate({ values: [{ value: 1000n, type: \"euint64\" }], contractAddress: \"0x...\", userAddress: \"0x...\" });\n * ```\n */\nexport function useEncrypt() {\n const sdk = useZamaSDK();\n return useMutation<EncryptResult, Error, EncryptParams>(encryptMutationOptions(sdk));\n}\n","import {\n type DefaultError,\n type QueriesOptions,\n type QueriesResults,\n useQueries as tanstack_useQueries,\n useQuery as tanstack_useQuery,\n useSuspenseQuery as tanstack_useSuspenseQuery,\n type UseQueryOptions,\n type UseQueryResult,\n type UseSuspenseQueryOptions,\n type UseSuspenseQueryResult,\n} from \"@tanstack/react-query\";\nimport { hashFn } from \"@zama-fhe/sdk/query\";\n\n/**\n * Thin wrapper around TanStack's useQuery that injects our custom queryKeyHashFn.\n * Mirrors the wagmi pattern — the type safety boundary is at the factory and hook levels.\n *\n * Callers typically specify only `<TData>` (e.g. `useQuery<PublicKeyData>(...)`) while\n * factory options carry specific tuple keys (e.g. `readonly [\"zama.publicKey\"]`).\n * We erase the QueryKey param via `AnyKeyQueryOptions` so callers don't need to\n * spell out the key type — any QueryKey subtype is accepted.\n */\ntype AnyKeyQueryOptions<TData, TError> = UseQueryOptions<\n TData,\n TError,\n TData,\n // oxlint-disable-next-line typescript/no-explicit-any\n any\n>;\ntype AnyKeySuspenseOptions<TData, TError> = UseSuspenseQueryOptions<\n TData,\n TError,\n TData,\n // oxlint-disable-next-line typescript/no-explicit-any\n any\n>;\n\nexport function useQuery<TData = unknown, TError = DefaultError>(\n options: AnyKeyQueryOptions<TData, TError>,\n): UseQueryResult<TData, TError> {\n return tanstack_useQuery({\n ...options,\n queryKeyHashFn: hashFn,\n });\n}\n\nexport function useSuspenseQuery<TData = unknown, TError = DefaultError>(\n options: AnyKeySuspenseOptions<TData, TError>,\n): UseSuspenseQueryResult<TData, TError> {\n return tanstack_useSuspenseQuery({\n ...options,\n queryKeyHashFn: hashFn,\n });\n}\n\n/**\n * Thin wrapper around TanStack's useQueries that injects our custom queryKeyHashFn\n * on every query in the array.\n */\nexport function useQueries<\n // oxlint-disable-next-line typescript/no-explicit-any\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>({\n queries,\n ...options\n}: {\n queries: readonly [...QueriesOptions<T>];\n combine?: (result: QueriesResults<T>) => TCombinedResult;\n subscribed?: boolean;\n}): TCombinedResult {\n return tanstack_useQueries({\n ...options,\n queries: queries.map((q) => ({\n ...q,\n queryKeyHashFn: hashFn,\n })) as [...QueriesOptions<T>],\n });\n}\n","\"use client\";\n\nimport { useSyncExternalStore } from \"react\";\nimport type { WalletAccount, ZamaSDK } from \"@zama-fhe/sdk\";\n\nexport function useWalletAccount(sdk: ZamaSDK): WalletAccount | undefined {\n return useSyncExternalStore(\n (listener) => sdk.onWalletAccountChange(listener),\n () => sdk.signer?.walletAccount.getSnapshot(),\n () => undefined,\n );\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { DecryptResult, UserDecryptQueryConfig } from \"@zama-fhe/sdk/query\";\nimport { userDecryptQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\n/**\n * React hook for FHE user decryption. Thin wrapper around\n * `userDecryptQueryOptions` with `useQuery` semantics.\n */\nexport function useUserDecrypt(\n config: UserDecryptQueryConfig,\n options?: Omit<UseQueryOptions<DecryptResult>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n const walletAccount = useWalletAccount(sdk);\n const queryOpts = userDecryptQueryOptions(sdk, config, { walletAccount });\n return useQuery<DecryptResult>({\n ...queryOpts,\n ...options,\n enabled: queryOpts.enabled && (options?.enabled ?? false),\n });\n}\n\n/** Return type of {@link useUserDecrypt}. */\nexport type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Handle, PublicDecryptResult } from \"@zama-fhe/sdk\";\nimport { publicDecryptMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Decrypt FHE ciphertext handles using the network public key (no credential needed).\n * On success, results are available via `data.clearValues` and written to the\n * persistent decrypt cache.\n *\n * @returns A mutation whose `mutate` accepts an array of handle strings.\n *\n * @example\n * ```tsx\n * const publicDecrypt = usePublicDecrypt();\n * publicDecrypt.mutate([\"0xHandle1\", \"0xHandle2\"]);\n * // publicDecrypt.data?.clearValues => { \"0xHandle1\": 500n, ... }\n * ```\n */\nexport function usePublicDecrypt() {\n const sdk = useZamaSDK();\n return useMutation<PublicDecryptResult, Error, Handle[]>(publicDecryptMutationOptions(sdk));\n}\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { generateKeypairMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Generate an FHE keypair via the relayer.\n * Returns a public/private key pair for use in decrypt authorization.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link RelayerRequestFailedError} — relayer keypair generation request failed\n *\n * @returns A mutation whose `mutate` takes no parameters.\n *\n * @example\n * ```tsx\n * const generateKeypair = useGenerateKeypair();\n * generateKeypair.mutate();\n * // generateKeypair.data?.publicKey, generateKeypair.data?.privateKey\n * ```\n */\nexport function useGenerateKeypair() {\n const sdk = useZamaSDK();\n return useMutation(generateKeypairMutationOptions(sdk));\n}\n","\"use client\";\n\nimport type { EIP712TypedData } from \"@zama-fhe/sdk\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { createEIP712MutationOptions } from \"@zama-fhe/sdk/query\";\nimport type { CreateEIP712Params } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Create EIP-712 typed data for signing an FHE decrypt credential.\n * The returned typed data is signed by the wallet to authorize decryption.\n *\n * @returns A mutation whose `mutate` accepts {@link CreateEIP712Params}.\n *\n * @example\n * ```tsx\n * const createEIP712 = useCreateEIP712();\n * createEIP712.mutate({\n * publicKey: keypair.publicKey,\n * contractAddresses: [\"0xToken\"],\n * startTimestamp: Math.floor(Date.now() / 1000),\n * });\n * ```\n */\nexport function useCreateEIP712() {\n const sdk = useZamaSDK();\n return useMutation<EIP712TypedData, Error, CreateEIP712Params>(createEIP712MutationOptions(sdk));\n}\n","\"use client\";\n\nimport type { KmsDelegatedUserDecryptEIP712Type } from \"@zama-fhe/sdk\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { createDelegatedUserDecryptEIP712MutationOptions } from \"@zama-fhe/sdk/query\";\nimport type { CreateDelegatedUserDecryptEIP712Params } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Create EIP-712 typed data for a delegated user decrypt credential.\n * Used when one wallet authorizes another to decrypt on its behalf.\n *\n * @returns A mutation whose `mutate` accepts {@link CreateDelegatedUserDecryptEIP712Params}.\n *\n * @example\n * ```tsx\n * const createEIP712 = useCreateDelegatedUserDecryptEIP712();\n * createEIP712.mutate({\n * publicKey: keypair.publicKey,\n * contractAddresses: [\"0xToken\"],\n * delegatorAddress: \"0xDelegator\",\n * startTimestamp: Math.floor(Date.now() / 1000),\n * });\n * ```\n */\nexport function useCreateDelegatedUserDecryptEIP712() {\n const sdk = useZamaSDK();\n return useMutation<\n KmsDelegatedUserDecryptEIP712Type,\n Error,\n CreateDelegatedUserDecryptEIP712Params\n >(createDelegatedUserDecryptEIP712MutationOptions(sdk));\n}\n","\"use client\";\n\nimport type { ClearValueType, Handle } from \"@zama-fhe/sdk\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport {\n delegatedDecryptMutationOptions,\n type DelegatedDecryptMutationParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Decrypt FHE ciphertext handles using delegated user credentials.\n * Returns a map of handle → plaintext bigint.\n *\n * @returns A mutation whose `mutate` accepts {@link DelegatedDecryptMutationParams}.\n *\n * @example\n * ```tsx\n * const decrypt = useDelegatedDecrypt();\n * decrypt.mutate({ handles: [{ handle: \"0xHandle1\", contractAddress: \"0x...\" }], delegatorAddress: \"0x...\" });\n * // decrypt.data => { \"0xHandle1\": 1000n }\n * ```\n */\nexport function useDelegatedDecrypt() {\n const sdk = useZamaSDK();\n return useMutation<Record<Handle, ClearValueType>, Error, DelegatedDecryptMutationParams>(\n delegatedDecryptMutationOptions(sdk),\n );\n}\n","\"use client\";\n\nimport type { InputProofBytesType, ZKProofLike } from \"@zama-fhe/sdk\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { requestZKProofVerificationMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Submit a ZK proof for on-chain verification.\n * Returns the input proof bytes for use in contract calls.\n *\n * @returns A mutation whose `mutate` accepts a {@link ZKProofLike}.\n *\n * @example\n * ```tsx\n * const verify = useRequestZKProofVerification();\n * verify.mutate(zkProof);\n * // verify.data => Uint8Array (input proof bytes)\n * ```\n */\nexport function useRequestZKProofVerification() {\n const sdk = useZamaSDK();\n return useMutation<InputProofBytesType, Error, ZKProofLike>(\n requestZKProofVerificationMutationOptions(sdk),\n );\n}\n","\"use client\";\n\nimport type { PublicKeyData } from \"@zama-fhe/sdk\";\nimport { useQuery } from \"../utils/query\";\nimport { publicKeyQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Fetch the FHE network public key from the relayer.\n * Cached indefinitely since the key does not change during a session.\n *\n * @returns Query result with `data: PublicKeyData | null`.\n *\n * @example\n * ```tsx\n * const { data: publicKey } = usePublicKey();\n * // publicKey?.publicKeyId, publicKey?.publicKey\n * ```\n */\nexport function usePublicKey() {\n const sdk = useZamaSDK();\n return useQuery<PublicKeyData | null>(publicKeyQueryOptions(sdk));\n}\n","\"use client\";\n\nimport type { PublicParamsData } from \"@zama-fhe/sdk\";\nimport { useQuery } from \"../utils/query\";\nimport { publicParamsQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Fetch FHE public parameters for a given bit size from the relayer.\n * Cached indefinitely since parameters do not change during a session.\n *\n * @param bits - The FHE bit size to fetch parameters for (e.g. 2048).\n * @returns Query result with `data: PublicParamsData | null`.\n *\n * @example\n * ```tsx\n * const { data: params } = usePublicParams(2048);\n * // params?.publicParams, params?.publicParamsId\n * ```\n */\nexport function usePublicParams(bits: number) {\n const sdk = useZamaSDK();\n return useQuery<PublicParamsData | null>(publicParamsQueryOptions(sdk, bits));\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { grantPermitMutationOptions, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Sign an EIP-712 message authorizing decryption of confidential handles\n * for a list of contract addresses. This is not token-specific — any\n * contract that uses FHE-encrypted values (tokens, DeFi vaults, games, etc.)\n * can be authorized in a single wallet signature. Subsequent decrypt\n * operations on any of these contracts reuse cached credentials.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link KeypairExpiredError} — the re-encryption keypair has expired\n *\n * @example\n * ```tsx\n * const { mutateAsync: grantPermit, isPending } = useGrantPermit();\n *\n * // Authorize decryption for any contracts with encrypted state:\n * // confidential tokens, auction contracts, governance contracts, etc.\n * await grantPermit([tokenAddress, auctionAddress, governanceAddress]);\n * ```\n */\nexport function useGrantPermit(options?: UseMutationOptions<void, Error, Address[]>) {\n const sdk = useZamaSDK();\n\n return useMutation<void, Error, Address[]>({\n ...grantPermitMutationOptions(sdk),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n context.client.removeQueries({ queryKey: zamaQueryKeys.hasPermit.all });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery } from \"../utils/query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { hasPermitQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\n/** Configuration for {@link useHasPermit}. */\nexport interface UseHasPermitConfig {\n /** Contract addresses to check credentials against (at least one required). */\n contractAddresses: [Address, ...Address[]];\n}\n\n/**\n * Check whether stored permits cover the given contract addresses for the\n * connected signer. Returns `true` if decrypt operations can proceed without\n * a wallet prompt.\n *\n * @returns Query result with `data: boolean` — `true` if a stored permit covers\n * every entry in `contractAddresses`. The query auto-disables when no signer is configured\n * (`data` stays `undefined`, `status` stays `\"pending\"`).\n * @throws if the query runs without a signer configured (the `enabled` guard normally\n * prevents this; only reachable if the caller forces `query: { enabled: true }`). {@link SignerNotConfiguredError}\n *\n * @example\n * ```tsx\n * const { data: hasPermit } = useHasPermit({ contractAddresses: [\"0xToken\"] });\n * ```\n */\nexport function useHasPermit(config: UseHasPermitConfig) {\n const sdk = useZamaSDK();\n const walletAccount = useWalletAccount(sdk);\n return useQuery<boolean>(hasPermitQueryOptions(sdk, config, { walletAccount }));\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { revokePermitsMutationOptions, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Revoke FHE permits for the current signer.\n *\n * - Called with no arguments: every permit is removed across all chains and\n * delegators. The keypair survives — use {@link useClearCredentials} to also\n * wipe the keypair.\n * - Called with a contract list: only direct-decrypt permits on the current\n * chain whose payload touches a listed address are removed. Delegated\n * permits are not touched in this mode.\n *\n * @example\n * ```tsx\n * const { mutate: revokePermits } = useRevokePermits();\n * revokePermits([tokenAddress]); // direct-decrypt scope, current chain\n * revokePermits(); // every permit, all chains, all delegators\n * ```\n */\nexport function useRevokePermits(options?: UseMutationOptions<void, Error, Address[] | void>) {\n const sdk = useZamaSDK();\n\n return useMutation<void, Error, Address[] | void>({\n ...revokePermitsMutationOptions(sdk),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n context.client.removeQueries({ queryKey: zamaQueryKeys.hasPermit.all });\n context.client.removeQueries({ queryKey: zamaQueryKeys.decryption.all });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport { clearCredentialsMutationOptions, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Wipe the keypair for the current signer and cascade-delete every permit\n * (across chains and delegators) referencing it. Useful for \"log out\"\n * handlers that should leave no trace.\n *\n * @example\n * ```tsx\n * const { mutate: clearCredentials } = useClearCredentials();\n * clearCredentials();\n * ```\n */\nexport function useClearCredentials(options?: UseMutationOptions<void>) {\n const sdk = useZamaSDK();\n\n return useMutation<void>({\n ...clearCredentialsMutationOptions(sdk),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n context.client.removeQueries({ queryKey: zamaQueryKeys.hasPermit.all });\n context.client.removeQueries({ queryKey: zamaQueryKeys.decryption.all });\n },\n });\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport type { Address, Token } from \"@zama-fhe/sdk\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Get a {@link Token} instance for an ERC-7984 confidential token, memoized by address.\n * Supports balance queries, transfers, and operator approval.\n *\n * For ERC-7984 wrappers (shield/unshield), use {@link useWrappedToken} instead.\n *\n * @param address - The confidential token contract address.\n * @returns A memoized `Token` instance.\n *\n * @example\n * ```tsx\n * const token = useToken(\"0xToken\");\n * // token.balanceOf(), token.confidentialTransfer(), etc.\n * ```\n */\nexport function useToken(address: Address): Token {\n const sdk = useZamaSDK();\n return useMemo<Token>(() => sdk.createToken(address), [sdk, address]);\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport type { Address, WrappedToken } from \"@zama-fhe/sdk\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Get a {@link WrappedToken} instance for an ERC-7984 ERC-20 wrapper,\n * memoized by address. Adds wrapper-specific operations (shield, unshield,\n * underlying, allowance) on top of the base {@link useToken} API.\n *\n * The address is the wrapper contract address itself — the wrapper IS the\n * confidential token.\n *\n * @param address - The confidential wrapper contract address.\n * @returns A memoized `WrappedToken` instance.\n *\n * @example\n * ```tsx\n * const wrapped = useWrappedToken(\"0xWrapper\");\n * // wrapped.shield(1000n), wrapped.unshield(500n), etc.\n * ```\n */\nexport function useWrappedToken(address: Address): WrappedToken {\n const sdk = useZamaSDK();\n return useMemo<WrappedToken>(() => sdk.createWrappedToken(address), [sdk, address]);\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { confidentialBalanceQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\nimport { useQuery } from \"../utils/query\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\nexport interface UseConfidentialBalanceConfig {\n /** Address of the confidential token contract. */\n address: Address;\n /** Account to fetch balance for. The query is disabled while `undefined`. */\n account: Address | undefined;\n}\n\nexport interface UseConfidentialBalanceOptions extends Omit<\n UseQueryOptions<bigint>,\n \"queryKey\" | \"queryFn\" | \"enabled\"\n> {\n /** Set this to `false` to disable this query from automatically running. */\n enabled?: boolean;\n}\n\n/**\n * Hook for fetching a confidential token balance. Reads the on-chain handle and\n * decrypts via the SDK; cached values are returned instantly and the relayer is\n * only hit when the handle changes.\n *\n * @example\n * ```tsx\n * const { data: balance } = useConfidentialBalance({\n * address: \"0xToken\",\n * account: \"0xAccount\",\n * });\n * ```\n */\nexport function useConfidentialBalance(\n config: UseConfidentialBalanceConfig,\n options?: UseConfidentialBalanceOptions,\n) {\n const { address, account } = config;\n const { enabled = true } = options ?? {};\n const token = useToken(address);\n const walletAccount = useWalletAccount(token.sdk);\n\n const baseOptions = confidentialBalanceQueryOptions(\n token,\n {\n tokenAddress: address,\n account,\n },\n { walletAccount },\n );\n\n return useQuery<bigint>({\n ...baseOptions,\n ...options,\n enabled: Boolean(baseOptions.enabled) && enabled,\n });\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport { useQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address, BatchBalancesResult } from \"@zama-fhe/sdk\";\nimport { confidentialBalancesQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\nexport interface UseConfidentialBalancesConfig {\n /** Addresses of the confidential token contracts to batch-query. The query is disabled while empty. */\n addresses: Address[];\n /** Account to fetch balances for. The query is disabled while `undefined`. */\n account: Address | undefined;\n}\n\nexport interface UseConfidentialBalancesOptions extends Omit<\n UseQueryOptions<BatchBalancesResult>,\n \"queryKey\" | \"queryFn\" | \"enabled\"\n> {\n /** Set this to `false` to disable this query from automatically running. */\n enabled?: boolean;\n}\n\n/**\n * Hook for fetching multiple confidential token balances in batch. Returns\n * partial results when some tokens fail — successful balances are available\n * alongside per-token error information.\n *\n * @param config - Token addresses configuration.\n * @param options - React Query options forwarded to the balance query.\n * @returns The balance query result.\n *\n * @example\n * ```tsx\n * const { data } = useConfidentialBalances({\n * addresses: [\"0xTokenA\", \"0xTokenB\"],\n * account: \"0xAccount\",\n * });\n * const balance = data?.results.get(\"0xTokenA\");\n * if (data && data.errors.size > 0) {\n * // some tokens failed — check data.errors\n * }\n * ```\n */\nexport function useConfidentialBalances(\n config: UseConfidentialBalancesConfig,\n options?: UseConfidentialBalancesOptions,\n) {\n const { addresses, account } = config;\n const { enabled = true } = options ?? {};\n const sdk = useZamaSDK();\n const walletAccount = useWalletAccount(sdk);\n\n const tokens = useMemo(() => addresses.map((addr) => sdk.createToken(addr)), [sdk, addresses]);\n\n const baseOptions = confidentialBalancesQueryOptions(\n tokens,\n {\n account,\n },\n { walletAccount },\n );\n\n return useQuery<BatchBalancesResult>({\n ...baseOptions,\n ...options,\n enabled: Boolean(baseOptions.enabled) && enabled,\n });\n}\n","import type { QueryClient, QueryKey, UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport { invalidateAfterShield, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\n\ntype BalanceDeltaMode = \"add\" | \"subtract\";\nexport type OptimisticBalanceSnapshot = [QueryKey, bigint | undefined][];\n\n/** Combined context returned by optimistic `onMutate`. */\nexport interface OptimisticMutateContext {\n snapshot: OptimisticBalanceSnapshot;\n callerContext?: unknown;\n}\n\nexport function unwrapOptimisticCallerContext(\n optimistic: boolean | undefined,\n rawContext: unknown,\n): {\n wrappedContext: OptimisticMutateContext | undefined;\n callerContext: OptimisticMutateContext | undefined;\n} {\n const typed = rawContext as OptimisticMutateContext | undefined;\n const wrappedContext = optimistic ? typed : undefined;\n const callerContext = (optimistic ? wrappedContext?.callerContext : rawContext) as\n | OptimisticMutateContext\n | undefined;\n return { wrappedContext, callerContext };\n}\n\nexport async function applyOptimisticBalanceDelta({\n queryClient,\n tokenAddress,\n amount,\n mode,\n}: {\n queryClient: QueryClient;\n tokenAddress: Address;\n amount: bigint;\n mode: BalanceDeltaMode;\n}): Promise<OptimisticBalanceSnapshot> {\n const balanceKey = zamaQueryKeys.confidentialBalance.token(tokenAddress);\n await queryClient.cancelQueries({ queryKey: balanceKey });\n const previous = queryClient.getQueriesData<bigint>({ queryKey: balanceKey });\n for (const [key, value] of previous) {\n if (value === undefined) {\n continue;\n }\n // Temporary optimistic underflow (`amount > value`) is acceptable because\n // settlement invalidates and rewrites this cache entry.\n queryClient.setQueryData(key, mode === \"add\" ? value + amount : value - amount);\n }\n return previous;\n}\n\nexport function rollbackOptimisticBalanceDelta(\n queryClient: QueryClient,\n snapshot: OptimisticBalanceSnapshot,\n) {\n for (const [key, value] of snapshot) {\n queryClient.setQueryData(key, value);\n }\n}\n\n/**\n * Build optimistic mutation callbacks for shield operations.\n * Wraps the caller's `onMutate`/`onError`/`onSuccess`/`onSettled` with snapshot/rollback logic\n * and returns overrides ready to spread into `useMutation`.\n */\nexport function optimisticBalanceCallbacks<TParams extends { amount: bigint }>({\n optimistic,\n tokenAddress,\n queryClient,\n options,\n}: {\n optimistic: boolean | undefined;\n tokenAddress: Address;\n queryClient: QueryClient;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n options: UseMutationOptions<TransactionResult, Error, TParams, any> | undefined;\n}): Pick<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n UseMutationOptions<TransactionResult, Error, TParams, any>,\n \"onMutate\" | \"onError\" | \"onSuccess\" | \"onSettled\"\n> {\n return {\n onMutate: optimistic\n ? async (variables, mutationContext) => {\n const snapshot = await applyOptimisticBalanceDelta({\n queryClient,\n tokenAddress,\n amount: variables.amount,\n mode: \"add\",\n });\n const callerContext = await options?.onMutate?.(variables, mutationContext);\n return { snapshot, callerContext };\n }\n : options?.onMutate,\n onError: (error, variables, rawContext, context) => {\n const { wrappedContext, callerContext } = unwrapOptimisticCallerContext(\n optimistic,\n rawContext,\n );\n try {\n if (wrappedContext) {\n rollbackOptimisticBalanceDelta(queryClient, wrappedContext.snapshot);\n }\n } finally {\n options?.onError?.(error, variables, callerContext, context);\n }\n },\n onSuccess: (data, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(optimistic, rawContext);\n options?.onSuccess?.(data, variables, callerContext, context);\n invalidateAfterShield(context.client, tokenAddress);\n },\n onSettled: (data, error, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(optimistic, rawContext);\n options?.onSettled?.(data, error, variables, callerContext, context);\n },\n };\n}\n","\"use client\";\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n type UseMutationResult,\n} from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n confidentialTransferMutationOptions,\n invalidateAfterTransfer,\n type ConfidentialTransferParams,\n} from \"@zama-fhe/sdk/query\";\nimport {\n applyOptimisticBalanceDelta,\n rollbackOptimisticBalanceDelta,\n unwrapOptimisticCallerContext,\n} from \"../balance/optimistic-balance-update\";\nimport { useToken } from \"../token/use-token\";\n\n/** Configuration for {@link useConfidentialTransfer}. */\nexport interface UseConfidentialTransferConfig {\n /** Address of the confidential token contract. */\n address: Address;\n /**\n * When `true`, optimistically subtracts the transfer amount from cached balance\n * before the transaction confirms. Rolls back on error.\n * @defaultValue false\n */\n optimistic?: boolean;\n}\n\n/**\n * Encrypt and send a confidential transfer. Invalidates balance caches on success.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption failed\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param config - Token address (and optional wrapper) identifying the token.\n * Set `optimistic: true` to subtract the amount from the cached balance immediately.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const transfer = useConfidentialTransfer({\n * address: \"0xToken\",\n * optimistic: true,\n * });\n * transfer.mutate(\n * { to: \"0xRecipient\", amount: 1000n },\n * {\n * onError: (error) => {\n * if (error instanceof SigningRejectedError) {\n * // user cancelled — no action needed\n * }\n * },\n * },\n * );\n * ```\n */\nexport function useConfidentialTransfer<TContext = unknown>(\n config: UseConfidentialTransferConfig,\n options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferParams, TContext>,\n): UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, TContext> {\n const token = useToken(config.address);\n const queryClient = useQueryClient();\n\n // Internal mutation uses `any` for TContext because optimistic mode wraps\n // the caller's context in OptimisticMutateContext; the public return type\n // is cast back to the caller's TContext.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return useMutation<TransactionResult, Error, ConfidentialTransferParams, any>({\n ...confidentialTransferMutationOptions(token),\n ...options,\n onMutate: config.optimistic\n ? async (variables, mutationContext) => {\n const snapshot = await applyOptimisticBalanceDelta({\n queryClient,\n tokenAddress: token.address,\n amount: variables.amount,\n mode: \"subtract\",\n });\n const callerContext = await options?.onMutate?.(variables, mutationContext);\n return { snapshot, callerContext };\n }\n : options?.onMutate,\n onError: (error, variables, rawContext, context) => {\n const { wrappedContext, callerContext } = unwrapOptimisticCallerContext(\n config.optimistic,\n rawContext,\n );\n try {\n if (wrappedContext) {\n rollbackOptimisticBalanceDelta(queryClient, wrappedContext.snapshot);\n }\n } finally {\n options?.onError?.(error, variables, callerContext as TContext, context);\n }\n },\n onSuccess: (data, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(config.optimistic, rawContext);\n options?.onSuccess?.(data, variables, callerContext as TContext, context);\n invalidateAfterTransfer(context.client, token.address);\n },\n onSettled: (data, error, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(config.optimistic, rawContext);\n options?.onSettled?.(data, error, variables, callerContext as TContext, context);\n },\n }) as UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, TContext>;\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n confidentialTransferFromMutationOptions,\n invalidateAfterTransfer,\n type ConfidentialTransferFromParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\n\n/**\n * Operator transfer on behalf of another address. Caller must be an approved operator.\n * Invalidates balance caches on success.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption of the transfer amount failed\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential token contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const transferFrom = useConfidentialTransferFrom(\"0xToken\");\n * transferFrom.mutate({ from: \"0xOwner\", to: \"0xRecipient\", amount: 500n });\n * ```\n */\nexport function useConfidentialTransferFrom(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferFromParams, Address>,\n) {\n const token = useToken(address);\n\n return useMutation<TransactionResult, Error, ConfidentialTransferFromParams, Address>({\n ...confidentialTransferFromMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterTransfer(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n confidentialSetOperatorMutationOptions,\n invalidateAfterSetOperator,\n type ConfidentialSetOperatorParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\n\n/**\n * Set operator approval for a confidential token. Defaults to 1 hour.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential token contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const setOperator = useConfidentialSetOperator(\"0xToken\");\n * setOperator.mutate({ operator: \"0xOperator\" });\n * ```\n */\nexport function useConfidentialSetOperator(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ConfidentialSetOperatorParams, Address>,\n) {\n const token = useToken(address);\n\n return useMutation<TransactionResult, Error, ConfidentialSetOperatorParams, Address>({\n ...confidentialSetOperatorMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterSetOperator(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { confidentialIsOperatorQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport interface UseConfidentialIsOperatorConfig {\n /** Address of the confidential token contract. The query is disabled while `undefined`. */\n address: Address | undefined;\n /** Address to check operator status for. The query is disabled while `undefined`. */\n spender: Address | undefined;\n /** Token holder address. The query is disabled while `undefined`. */\n holder: Address | undefined;\n}\n\nexport interface UseConfidentialIsOperatorSuspenseConfig {\n /** Address of the confidential token contract. */\n address: Address;\n /** Address to check operator status for. */\n spender: Address;\n /** Token holder address. */\n holder: Address;\n}\n\n/**\n * Check if a spender is an approved operator for a holder.\n *\n * @param config - Token address, spender, and holder to check.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isOperator } = useConfidentialIsOperator({\n * address: \"0xToken\",\n * spender: \"0xSpender\",\n * holder: \"0xHolder\",\n * });\n * ```\n */\nexport function useConfidentialIsOperator(\n config: UseConfidentialIsOperatorConfig,\n options?: Omit<UseQueryOptions<boolean>, \"queryKey\" | \"queryFn\">,\n) {\n const { address, spender, holder } = config;\n const sdk = useZamaSDK();\n const baseOpts = confidentialIsOperatorQueryOptions(sdk, address, {\n holder,\n spender,\n });\n\n return useQuery({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n\n/**\n * Suspense variant of {@link useConfidentialIsOperator}. Suspends rendering\n * until the operator check resolves.\n *\n * @example\n * ```tsx\n * const { data: isOperator } = useConfidentialIsOperatorSuspense({\n * address: \"0xToken\",\n * spender: \"0xSpender\",\n * holder: \"0xHolder\",\n * });\n * ```\n */\nexport function useConfidentialIsOperatorSuspense(config: UseConfidentialIsOperatorSuspenseConfig) {\n const { spender, holder, address } = config;\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<boolean>(\n confidentialIsOperatorQueryOptions(sdk, address, {\n holder,\n spender,\n }),\n );\n}\n","\"use client\";\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n type UseMutationResult,\n} from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport { shieldMutationOptions, type ShieldParams } from \"@zama-fhe/sdk/query\";\nimport { optimisticBalanceCallbacks } from \"../balance/optimistic-balance-update\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/** Configuration for {@link useShield}. */\nexport interface UseShieldConfig {\n /** Address of the confidential wrapper contract. */\n address: Address;\n /**\n * When `true`, optimistically adds the wrap amount to the cached confidential balance\n * before the transaction confirms. Rolls back on error.\n * @defaultValue false\n */\n optimistic?: boolean;\n}\n\n/**\n * Shield public ERC-20 tokens into confidential tokens.\n * Handles ERC-20 approval automatically. Invalidates balance caches on success.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — approval or shield transaction reverted\n *\n * @param config - Wrapper address (and optional `optimistic` flag).\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const shield = useShield({ address: \"0xWrapper\", optimistic: true });\n * shield.mutate({ amount: 1000n });\n * ```\n */\nexport function useShield<TContext = unknown>(\n config: UseShieldConfig,\n options?: UseMutationOptions<TransactionResult, Error, ShieldParams, TContext>,\n): UseMutationResult<TransactionResult, Error, ShieldParams, TContext> {\n const token = useWrappedToken(config.address);\n const queryClient = useQueryClient();\n\n return useMutation({\n ...shieldMutationOptions(token),\n ...options,\n ...optimisticBalanceCallbacks({\n optimistic: config.optimistic,\n tokenAddress: token.address,\n queryClient,\n options,\n }),\n }) as UseMutationResult<TransactionResult, Error, ShieldParams, TContext>;\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnwrap,\n type UnwrapParams,\n unwrapMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Request an unwrap for a specific amount. Encrypts the amount first.\n * Call {@link useFinalizeUnwrap} after the request is processed on-chain,\n * or use {@link useUnshield} for a single-call orchestration.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption of the unwrap amount failed\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unwrap = useUnwrap(\"0xWrapper\");\n * unwrap.mutate({ amount: 500n });\n * ```\n */\nexport function useUnwrap(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, UnwrapParams, Address>({\n ...unwrapMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnwrap(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport { invalidateAfterUnwrap, unwrapAllMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Request an unwrap for the entire confidential balance.\n * Uses the on-chain balance handle directly (no encryption needed).\n * Call {@link useFinalizeUnwrap} after processing, or use {@link useUnshieldAll} for single-call orchestration.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unwrapAll = useUnwrapAll(\"0xWrapper\");\n * unwrapAll.mutate();\n * ```\n */\nexport function useUnwrapAll(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, void, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, void, Address>({\n ...unwrapAllMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnwrap(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n finalizeUnwrapMutationOptions,\n invalidateAfterUnshield,\n type FinalizeUnwrapParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Complete an unwrap by providing the public decryption proof.\n * Call this after an unwrap request has been processed on-chain.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link DecryptionFailedError} — public decryption of the burn amount failed\n * - {@link TransactionRevertedError} — on-chain finalize transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const finalize = useFinalizeUnwrap(\"0xWrapper\");\n * const event = findUnwrapRequested(receipt.logs);\n * // Pass unwrapRequestId from upgraded events, or fall back to encryptedAmount for legacy ones.\n * finalize.mutate(\n * event.unwrapRequestId\n * ? { unwrapRequestId: event.unwrapRequestId }\n * : { burnAmountHandle: event.encryptedAmount },\n * );\n * ```\n */\nexport function useFinalizeUnwrap(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, FinalizeUnwrapParams, Address>({\n ...finalizeUnwrapMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnshield,\n type UnshieldParams,\n unshieldMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Unshield a specific amount and finalize in one call.\n * Orchestrates: unwrap → wait for receipt → parse event → finalize.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption failed during unwrap\n * - {@link DecryptionFailedError} — public decryption failed during finalize\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unshield = useUnshield(\"0xWrapper\");\n * unshield.mutate({ amount: 500n });\n * ```\n */\nexport function useUnshield(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, UnshieldParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, UnshieldParams, Address>({\n ...unshieldMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnshield,\n type UnshieldAllParams,\n unshieldAllMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Unshield the entire balance and finalize in one call.\n * Orchestrates: unwrapAll → wait for receipt → parse event → finalize.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link DecryptionFailedError} — public decryption failed during finalize\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unshieldAll = useUnshieldAll(\"0xWrapper\");\n * unshieldAll.mutate();\n * ```\n */\nexport function useUnshieldAll(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, UnshieldAllParams | void, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, UnshieldAllParams | void, Address>({\n ...unshieldAllMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnshield,\n type ResumeUnshieldParams,\n resumeUnshieldMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Resume an interrupted unshield from an existing unwrap tx hash.\n * Useful when the user submitted the unwrap but the finalize step was\n * interrupted (e.g. page reload, network error).\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link DecryptionFailedError} — public decryption failed during finalize\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const resumeUnshield = useResumeUnshield(\"0xWrapper\");\n * resumeUnshield.mutate({ unwrapTxHash: \"0xabc...\" });\n * ```\n */\nexport function useResumeUnshield(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ResumeUnshieldParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, ResumeUnshieldParams, Address>({\n ...resumeUnshieldMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { underlyingAllowanceQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport { underlyingAllowanceQueryOptions };\n\nexport interface UseUnderlyingAllowanceConfig {\n /** Address of the confidential wrapper contract. */\n address: Address;\n /** Owner to fetch allowance for. The query is disabled while `undefined`. */\n owner: Address | undefined;\n}\n\nexport interface UseUnderlyingAllowanceSuspenseConfig {\n /** Address of the confidential wrapper contract. */\n address: Address;\n /** Owner to fetch allowance for. */\n owner: Address;\n}\n\n/**\n * Hook for fetching the underlying ERC-20 allowance granted to the wrapper\n * contract. Useful to check if an approval is needed before shielding.\n *\n * @example\n * ```tsx\n * const { data: allowance } = useUnderlyingAllowance({\n * address: \"0xWrapper\",\n * owner: \"0xOwner\",\n * });\n * ```\n */\nexport function useUnderlyingAllowance(\n config: UseUnderlyingAllowanceConfig,\n options?: Omit<UseQueryOptions<bigint>, \"queryKey\" | \"queryFn\">,\n) {\n const { address, owner } = config;\n const sdk = useZamaSDK();\n\n const baseOpts = underlyingAllowanceQueryOptions(sdk, address, { owner });\n\n return useQuery<bigint>({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n\n/**\n * Suspense variant of {@link useUnderlyingAllowance}. Suspends rendering until\n * the allowance resolves.\n *\n * @example\n * ```tsx\n * const { data: allowance } = useUnderlyingAllowanceSuspense({\n * address: \"0xWrapper\",\n * owner: \"0xOwner\",\n * });\n * ```\n */\nexport function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceSuspenseConfig) {\n const { address, owner } = config;\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<bigint>(underlyingAllowanceQueryOptions(sdk, address, { owner }));\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\n\n/**\n * Resolves the wrappers registry address for the current chain.\n * Uses the registry addresses from `sdk.registry` (built-in defaults from chain configs).\n *\n * Returns `undefined` when the chain ID hasn't been fetched yet\n * or when no registry is configured for the connected chain.\n *\n * The chain ID is cached for 30 seconds (`staleTime`), so chain\n * switches may take up to 30s to reflect.\n */\nexport function useWrappersRegistryAddress(): Address | undefined {\n const sdk = useZamaSDK();\n\n const { data: chainId } = useQuery<number>({\n queryKey: zamaQueryKeys.wrappersRegistry.chainId(),\n queryFn: () => sdk.provider.getChainId(),\n staleTime: 30_000,\n });\n\n return chainId !== undefined ? sdk.registry.getAddress(chainId) : undefined;\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { wrapperDiscoveryQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"../wrappers-registry/use-wrappers-registry-address\";\n\nexport { wrapperDiscoveryQueryOptions };\n\n/** Configuration for {@link useWrapperDiscovery}. */\nexport interface UseWrapperDiscoveryConfig {\n /**\n * Address of any confidential token you control.\n * Used only to derive the signer context and to scope the query cache key —\n * it does not affect which wrapper the registry returns.\n */\n tokenAddress: Address;\n /** ERC-20 address to discover the wrapper for. Pass `undefined` to disable the query. */\n erc20Address: Address | undefined;\n}\n\n/** Configuration for {@link useWrapperDiscoverySuspense}. */\nexport interface UseWrapperDiscoverySuspenseConfig {\n /**\n * Address of any confidential token you control.\n * Used only to derive the signer context and to scope the query cache key —\n * it does not affect which wrapper the registry returns.\n */\n tokenAddress: Address;\n /** ERC-20 address to discover the wrapper for. */\n erc20Address: Address;\n}\n\n/**\n * Discover the confidential wrapper for an ERC-20 token via the on-chain registry.\n * Returns the wrapper address if one exists, or `null` if not.\n * Cached indefinitely since wrapper mappings are immutable.\n *\n * @param config - Token and ERC-20 addresses.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: Address | null`.\n *\n * @example\n * ```tsx\n * const { data: wrapperAddress } = useWrapperDiscovery({\n * tokenAddress: \"0xConfidentialToken\",\n * erc20Address: \"0xUSDC\",\n * });\n * ```\n */\nexport function useWrapperDiscovery(\n config: UseWrapperDiscoveryConfig,\n options?: Omit<UseQueryOptions<Address | null>, \"queryKey\" | \"queryFn\">,\n) {\n const { tokenAddress, erc20Address } = config;\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n const baseOpts = wrapperDiscoveryQueryOptions(sdk.registry, {\n tokenAddress,\n erc20Address,\n registryAddress,\n });\n\n return useQuery<Address | null>({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n\n/**\n * Suspense variant of {@link useWrapperDiscovery}.\n * Suspends rendering until the wrapper address is resolved.\n *\n * @param config - Token and ERC-20 addresses.\n * @returns Suspense query result with `data: Address | null`.\n *\n * @example\n * ```tsx\n * const { data: wrapperAddress } = useWrapperDiscoverySuspense({\n * tokenAddress: \"0xConfidentialToken\",\n * erc20Address: \"0xUSDC\",\n * });\n * ```\n */\nexport function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig) {\n const { tokenAddress, erc20Address } = config;\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useSuspenseQuery<Address | null>(\n wrapperDiscoveryQueryOptions(sdk.registry, {\n tokenAddress,\n erc20Address,\n registryAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { tokenMetadataQueryOptions, type TokenMetadata } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\n\n/**\n * Read ERC-20 token metadata (name, symbol, decimals).\n * Fetches all three in parallel. Cached indefinitely since metadata is immutable.\n *\n * @param tokenAddress - Address of the token contract.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: TokenMetadata`.\n *\n * @example\n * ```tsx\n * const { data: metadata } = useMetadata(\"0xToken\");\n * // metadata?.name, metadata?.symbol, metadata?.decimals\n * ```\n */\nexport function useMetadata(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<TokenMetadata>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n return useQuery<TokenMetadata>({\n ...tokenMetadataQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useMetadata}.\n * Suspends rendering until metadata is loaded.\n *\n * @param tokenAddress - Address of the token contract.\n * @returns Suspense query result with `data: TokenMetadata`.\n *\n * @example\n * ```tsx\n * const { data: metadata } = useMetadataSuspense(\"0xToken\");\n * ```\n */\nexport function useMetadataSuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n return useSuspenseQuery<TokenMetadata>(tokenMetadataQueryOptions(sdk, tokenAddress));\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n delegateDecryptionMutationOptions,\n zamaQueryKeys,\n type DelegateDecryptionParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Delegate FHE decryption rights for a confidential contract to another address\n * via the on-chain ACL.\n *\n * @param address - Confidential contract address to delegate on.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const delegate = useDelegateDecryption(\"0xToken\");\n * delegate.mutate({ delegateAddress: \"0xDelegate\" });\n * ```\n */\nexport function useDelegateDecryption(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, DelegateDecryptionParams>,\n) {\n const sdk = useZamaSDK();\n\n return useMutation<TransactionResult, Error, DelegateDecryptionParams>({\n ...delegateDecryptionMutationOptions(sdk, address),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n try {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n } finally {\n void context.client.invalidateQueries({ queryKey: zamaQueryKeys.delegationStatus.all });\n }\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n revokeDelegationMutationOptions,\n zamaQueryKeys,\n type RevokeDelegationParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Revoke FHE decryption delegation for a confidential contract from a delegate address.\n *\n * @param address - Confidential contract address to revoke delegation on.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const revoke = useRevokeDelegation(\"0xToken\");\n * revoke.mutate({ delegateAddress: \"0xDelegate\" });\n * ```\n */\nexport function useRevokeDelegation(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, RevokeDelegationParams>,\n) {\n const sdk = useZamaSDK();\n\n return useMutation<TransactionResult, Error, RevokeDelegationParams>({\n ...revokeDelegationMutationOptions(sdk, address),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n try {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n } finally {\n void context.client.invalidateQueries({ queryKey: zamaQueryKeys.delegationStatus.all });\n }\n },\n });\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { delegationStatusQueryOptions, type DelegationStatusData } from \"@zama-fhe/sdk/query\";\nimport { useQuery } from \"../utils/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport interface UseDelegationStatusConfig {\n /** Address of the confidential contract. Pass `undefined` to disable the query. */\n contractAddress: Address | undefined;\n /** The address that granted the delegation. */\n delegatorAddress?: Address;\n /** The address that received delegation rights. */\n delegateAddress?: Address;\n}\n\n/**\n * Query delegation status between a delegator and delegate for a token.\n *\n * @param config - Token address, delegator, and delegate addresses.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns `{ isActive, expiryTimestamp, isLoading, error }`.\n *\n * @example\n * ```tsx\n * const { data } = useDelegationStatus({\n * contractAddress: \"0xToken\",\n * delegatorAddress: \"0xDelegator\",\n * delegateAddress: \"0xDelegate\",\n * });\n * // data?.isActive, data?.expiryTimestamp\n * ```\n */\nexport function useDelegationStatus(\n config: UseDelegationStatusConfig,\n options?: Omit<UseQueryOptions<DelegationStatusData>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n const baseOpts = delegationStatusQueryOptions(sdk, config);\n\n return useQuery<DelegationStatusData>({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { decryptBalanceAsMutationOptions, type DecryptBalanceAsParams } from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\n\n/**\n * Decrypt another user's confidential balance as a delegate.\n *\n * @param address - Address of the confidential token contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const decryptAs = useDecryptBalanceAs(\"0xToken\");\n * decryptAs.mutate({ delegatorAddress: \"0xDelegator\" });\n * // decryptAs.data => 1000n\n * ```\n */\nexport function useDecryptBalanceAs(\n address: Address,\n options?: UseMutationOptions<bigint, Error, DecryptBalanceAsParams>,\n) {\n const token = useToken(address);\n\n return useMutation<bigint, Error, DecryptBalanceAsParams>({\n ...decryptBalanceAsMutationOptions(token),\n ...options,\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, Token } from \"@zama-fhe/sdk\";\nimport {\n batchDecryptBalancesAsMutationOptions,\n type BatchDecryptBalancesAsParams,\n} from \"@zama-fhe/sdk/query\";\n\n/**\n * Batch decrypt confidential balances as a delegate across multiple tokens.\n *\n * @param tokens - {@link Token} instances to decrypt balances for.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const batchDecryptAs = useBatchDecryptBalancesAs(tokens);\n * batchDecryptAs.mutate({\n * delegatorAddress: \"0xDelegator\",\n * });\n * // batchDecryptAs.data => Map { \"0xTokenA\" => 100n, \"0xTokenB\" => 200n }\n * ```\n */\nexport function useBatchDecryptBalancesAs(\n tokens: Token[],\n options?: UseMutationOptions<Map<Address, bigint>, Error, BatchDecryptBalancesAsParams>,\n) {\n return useMutation<Map<Address, bigint>, Error, BatchDecryptBalancesAsParams>({\n ...batchDecryptBalancesAsMutationOptions(tokens),\n ...options,\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n approveUnderlyingMutationOptions,\n invalidateAfterApproveUnderlying,\n type ApproveUnderlyingParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Approve the wrapper contract to spend the underlying ERC-20.\n * Defaults to max uint256. Resets to zero first if there's an existing\n * non-zero allowance (required by tokens like USDT).\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — approval transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const approve = useApproveUnderlying(\"0xWrapper\");\n * approve.mutate({}); // max approval\n * approve.mutate({ amount: 1000n }); // exact amount\n * ```\n */\nexport function useApproveUnderlying(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ApproveUnderlyingParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, ApproveUnderlyingParams, Address>({\n ...approveUnderlyingMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterApproveUnderlying(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { isConfidentialQueryOptions, isWrapperQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport { isConfidentialQueryOptions, isWrapperQueryOptions };\n\n/**\n * Check if a token supports the ERC-7984 confidential interface via ERC-165.\n * Result is cached indefinitely since interface support does not change.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isConfidential } = useIsConfidential(\"0xToken\");\n * ```\n */\nexport function useIsConfidential(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<boolean>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n\n return useQuery<boolean>({\n ...isConfidentialQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useIsConfidential}.\n * Suspends rendering until the ERC-165 check resolves.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @returns Suspense query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isConfidential } = useIsConfidentialSuspense(\"0xToken\");\n * ```\n */\nexport function useIsConfidentialSuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<boolean>(isConfidentialQueryOptions(sdk, tokenAddress));\n}\n\n/**\n * Check if a token supports the ERC-7984 wrapper interface via ERC-165.\n * Result is cached indefinitely since interface support does not change.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isWrapper } = useIsWrapper(\"0xToken\");\n * ```\n */\nexport function useIsWrapper(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<boolean>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n\n return useQuery<boolean>({\n ...isWrapperQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useIsWrapper}.\n * Suspends rendering until the ERC-165 check resolves.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @returns Suspense query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isWrapper } = useIsWrapperSuspense(\"0xToken\");\n * ```\n */\nexport function useIsWrapperSuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<boolean>(isWrapperQueryOptions(sdk, tokenAddress));\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { totalSupplyQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport { totalSupplyQueryOptions };\n\n/**\n * Read the total supply of a token.\n * Stale after 30 seconds to balance freshness and RPC cost.\n *\n * @param tokenAddress - Address of the token contract.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: bigint`.\n * Uses ERC-165 to call `inferredTotalSupply()` on upgraded wrappers and\n * legacy `totalSupply()` on pre-upgrade wrappers.\n *\n * @example\n * ```tsx\n * const { data: totalSupply } = useTotalSupply(\"0xToken\");\n * ```\n */\nexport function useTotalSupply(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<bigint>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n\n return useQuery<bigint>({\n ...totalSupplyQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useTotalSupply}.\n * Suspends rendering until the total supply is loaded.\n *\n * @param tokenAddress - Address of the token contract.\n * @returns Suspense query result with `data: bigint`.\n * Uses ERC-165 to call `inferredTotalSupply()` on upgraded wrappers and\n * legacy `totalSupply()` on pre-upgrade wrappers.\n *\n * @example\n * ```tsx\n * const { data: totalSupply } = useTotalSupplySuspense(\"0xToken\");\n * ```\n */\nexport function useTotalSupplySuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<bigint>(totalSupplyQueryOptions(sdk, tokenAddress));\n}\n","\"use client\";\n\nimport type { TokenWrapperPair } from \"@zama-fhe/sdk\";\nimport { tokenPairsQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches all token wrapper pairs from the ConfidentialTokenWrappersRegistry\n * contract on the current chain.\n */\nexport function useTokenPairsRegistry() {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly TokenWrapperPair[]>(\n tokenPairsQueryOptions(sdk, {\n registryAddress,\n }),\n );\n}\n","\"use client\";\n\nimport { tokenPairsLengthQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Returns the total number of token wrapper pairs in the registry.\n */\nexport function useTokenPairsLength() {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<bigint>(\n tokenPairsLengthQueryOptions(sdk, {\n registryAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { TokenWrapperPair } from \"@zama-fhe/sdk\";\nimport { tokenPairsSliceQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches a range of token wrapper pairs from the registry (paginated).\n *\n * @param fromIndex - Start index (inclusive). Pass `undefined` to disable.\n * @param toIndex - End index (exclusive). Pass `undefined` to disable.\n */\nexport function useTokenPairsSlice({\n fromIndex,\n toIndex,\n}: {\n fromIndex: bigint | undefined;\n toIndex: bigint | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly TokenWrapperPair[]>(\n tokenPairsSliceQueryOptions(sdk, {\n registryAddress,\n fromIndex,\n toIndex,\n }),\n );\n}\n","\"use client\";\n\nimport type { TokenWrapperPair } from \"@zama-fhe/sdk\";\nimport { tokenPairQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches a single token wrapper pair by index from the registry.\n *\n * @param index - Zero-based pair index. Pass `undefined` to disable.\n */\nexport function useTokenPair({ index }: { index: bigint | undefined }) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<TokenWrapperPair>(\n tokenPairQueryOptions(sdk, {\n registryAddress,\n index,\n }),\n );\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { confidentialTokenAddressQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Looks up the confidential token address for a given plain token address.\n */\nexport function useConfidentialTokenAddress({\n tokenAddress,\n}: {\n tokenAddress: Address | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly [boolean, Address]>(\n confidentialTokenAddressQueryOptions(sdk, {\n registryAddress,\n tokenAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { tokenAddressQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Looks up the plain token address for a given confidential token address.\n */\nexport function useTokenAddress({\n confidentialTokenAddress,\n}: {\n confidentialTokenAddress: Address | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly [boolean, Address]>(\n tokenAddressQueryOptions(sdk, {\n registryAddress,\n confidentialTokenAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { isConfidentialTokenValidQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Checks whether a confidential token is registered and valid in the\n * on-chain wrappers registry.\n *\n * @param confidentialTokenAddress - The confidential token to check. Pass `undefined` to disable.\n */\nexport function useIsConfidentialTokenValid({\n confidentialTokenAddress,\n}: {\n confidentialTokenAddress: Address | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<boolean>(\n isConfidentialTokenValidQueryOptions(sdk, {\n registryAddress,\n confidentialTokenAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type {\n TokenWrapperPair,\n TokenWrapperPairWithMetadata,\n PaginatedResult,\n} from \"@zama-fhe/sdk\";\nimport { listPairsQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches paginated token wrapper pairs from the registry.\n *\n * @param options - Query options: `page` (1-indexed, default `1`), `pageSize` (default `100`), `metadata` (fetch on-chain metadata for both tokens, default `false`).\n *\n * @example\n * ```tsx\n * const { data, isLoading } = useListPairs({ page: 1, pageSize: 20 });\n * if (data) {\n * console.log(`${data.total} pairs, showing page ${data.page}`);\n * }\n * ```\n */\nexport function useListPairs({\n page = 1,\n pageSize = 100,\n metadata = false,\n}: {\n page?: number;\n pageSize?: number;\n metadata?: boolean;\n} = {}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n // Pass sdk.registry (a lazy singleton) so the class-level TTL cache is shared\n // across all queryFn executions — rather than constructing a new instance each time.\n return useQuery<PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>>(\n listPairsQueryOptions(sdk.registry, {\n registryAddress,\n page,\n pageSize,\n metadata,\n }),\n );\n}\n"],"mappings":"gtEAqBA,MAAM,EAAiB,GAA8B,KAAK,CAY1D,SAAgB,GAAa,CAAE,WAAU,UAA6B,CACpE,IAAM,EAAc,GAAgB,CAG9B,EAAa,GAAO,EAAO,QAAQ,CAEzC,MAAgB,CACd,EAAW,QAAU,EAAO,SAC5B,CAEF,IAAM,EAAM,MAAc,IAAI,EAAQ,CAAE,GAAG,EAAQ,QAAS,EAAW,QAAS,CAAC,CAAE,CAAC,EAAO,CAAC,CAkB5F,OAdA,MAEI,EAAI,uBAAuB,CAAE,cAAe,CACtC,GACF,EAAiC,EAAY,EAE/C,CACJ,CAAC,EAAK,EAAY,CACnB,CAID,UAAsB,EAAI,SAAS,CAAE,CAAC,EAAI,CAAC,CAEpC,GAAC,EAAe,SAAhB,CAAyB,MAAO,EAAM,WAAmC,CAAA,CAalF,SAAgB,GAAsB,CACpC,IAAM,EAAU,GAAW,EAAe,CAE1C,GAAI,CAAC,EACH,MAAU,MACR,0HAED,CAEH,OAAO,EC7DT,SAAgB,IAAa,CAE3B,OAAO,EAAiD,GAD5C,GACsE,CAAC,CAAC,CCctF,SAAgBA,EACd,EAC+B,CAC/B,OAAOC,GAAkB,CACvB,GAAG,EACH,eAAgB,EACjB,CAAC,CAGJ,SAAgBC,EACd,EACuC,CACvC,OAAOC,GAA0B,CAC/B,GAAG,EACH,eAAgB,EACjB,CAAC,CChDJ,SAAgB,EAAiB,EAAyC,CACxE,OAAO,GACJ,GAAa,EAAI,sBAAsB,EAAS,KAC3C,EAAI,QAAQ,cAAc,aAAa,KACvC,IAAA,GACP,CCGH,SAAgB,GACd,EACA,EACA,CACA,IAAM,EAAM,GAAY,CAElB,EAAY,EAAwB,EAAK,EAAQ,CAAE,cADnC,EAAiB,EAC+B,CAAE,CAAC,CACzE,OAAOC,EAAwB,CAC7B,GAAG,EACH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,IAKT,EAAE,CAAE,CACN,IAAM,EAAM,GAAY,CAClB,EAAkB,GAA4B,CAIpD,OAAOC,EACL,GAAsB,EAAI,SAAU,CAClC,kBACA,OACA,WACA,WACD,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useQuery","tanstack_useQuery","useSuspenseQuery","tanstack_useSuspenseQuery","useQuery","useQuery","useQuery","useQuery","typed","useQuery","useSuspenseQuery","useQuery","useSuspenseQuery","useQuery","useQuery","useSuspenseQuery","useQuery","useSuspenseQuery","useQuery","useQuery","useSuspenseQuery","useQuery","useSuspenseQuery","useQuery","useQuery","useQuery","useQuery","useQuery","useQuery","useQuery","useQuery"],"sources":["../src/provider.tsx","../src/relayer/use-encrypt.ts","../src/utils/query.ts","../src/utils/wallet-account.ts","../src/decrypt/use-user-decrypt.ts","../src/decrypt/use-public-decrypt.ts","../src/decrypt/use-delegated-decrypt.ts","../src/permits/use-grant-permit.ts","../src/permits/use-has-permit.ts","../src/permits/use-revoke-permits.ts","../src/permits/use-clear-credentials.ts","../src/token/use-token.ts","../src/token/use-wrapped-token.ts","../src/balance/use-confidential-balance.ts","../src/balance/use-confidential-balances.ts","../src/balance/optimistic-balance-update.ts","../src/transfer/use-confidential-transfer.ts","../src/transfer/use-confidential-transfer-from.ts","../src/operator/use-confidential-set-operator.ts","../src/operator/use-confidential-is-operator.ts","../src/shield/use-shield.ts","../src/unwrap/use-unwrap.ts","../src/unwrap/use-unwrap-all.ts","../src/unwrap/use-finalize-unwrap.ts","../src/unshield/use-unshield.ts","../src/unshield/use-unshield-all.ts","../src/unshield/use-resume-unshield.ts","../src/shield/use-underlying-allowance.ts","../src/wrappers-registry/use-wrappers-registry-address.ts","../src/token/use-wrapper-discovery.ts","../src/token/use-metadata.ts","../src/delegations/use-delegate-decryption.ts","../src/delegations/use-revoke-delegation.ts","../src/delegations/use-delegation-status.ts","../src/delegations/use-decrypt-balance-as.ts","../src/delegations/use-batch-decrypt-balances-as.ts","../src/shield/use-approve-underlying.ts","../src/token/use-is-confidential.ts","../src/token/use-total-supply.ts","../src/wrappers-registry/use-token-pairs-registry.ts","../src/wrappers-registry/use-token-pairs-length.ts","../src/wrappers-registry/use-token-pairs-slice.ts","../src/wrappers-registry/use-token-pair.ts","../src/wrappers-registry/use-confidential-token-address.ts","../src/wrappers-registry/use-token-address.ts","../src/wrappers-registry/use-is-confidential-token-valid.ts","../src/wrappers-registry/use-list-pairs.ts"],"sourcesContent":["\"use client\";\n\nimport type { ZamaConfig } from \"@zama-fhe/sdk\";\nimport { ZamaSDK } from \"@zama-fhe/sdk\";\nimport { invalidateWalletLifecycleQueries } from \"@zama-fhe/sdk/query\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport {\n createContext,\n type PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\n\n/** Props for {@link ZamaProvider}. */\nexport interface ZamaProviderProps extends PropsWithChildren {\n /** Configuration object created by {@link createConfig}. */\n config: ZamaConfig;\n}\n\nconst ZamaSDKContext = createContext<ZamaSDK | null>(null);\n\n/**\n * Provides a {@link ZamaSDK} instance to all descendant hooks.\n *\n * @example\n * ```tsx\n * <ZamaProvider config={zamaConfig}>\n * <App />\n * </ZamaProvider>\n * ```\n */\nexport function ZamaProvider({ children, config }: ZamaProviderProps) {\n const queryClient = useQueryClient();\n\n // Stabilize onEvent so an inline arrow doesn't recreate the SDK every render.\n const onEventRef = useRef(config.onEvent);\n\n useEffect(() => {\n onEventRef.current = config.onEvent;\n });\n\n const sdk = useMemo(() => new ZamaSDK({ ...config, onEvent: onEventRef.current }), [config]);\n\n // SDK internally does credential/cache cleanup. React layer clears the\n // wallet-lifecycle query state.\n useEffect(\n () =>\n sdk.onWalletAccountChange(({ previous }) => {\n if (previous) {\n invalidateWalletLifecycleQueries(queryClient);\n }\n }),\n [sdk, queryClient],\n );\n\n // Clean up SDK-owned signer subscriptions on unmount without terminating\n // the caller-owned relayer. dispose() is idempotent.\n useEffect(() => () => sdk.dispose(), [sdk]);\n\n return <ZamaSDKContext.Provider value={sdk}>{children}</ZamaSDKContext.Provider>;\n}\n\n/**\n * Access the {@link ZamaSDK} instance from context.\n * Throws if called outside a {@link ZamaProvider}.\n *\n * @example\n * ```tsx\n * const sdk = useZamaSDK();\n * const token = sdk.createToken(\"0x...\");\n * ```\n */\nexport function useZamaSDK(): ZamaSDK {\n const context = useContext(ZamaSDKContext);\n\n if (!context) {\n throw new Error(\n \"useZamaSDK must be used within a <ZamaProvider>. \" +\n \"Wrap your component tree in <ZamaProvider config={createConfig(...)}>.\",\n );\n }\n return context;\n}\n","\"use client\";\n\nimport type { EncryptParams, EncryptResult } from \"@zama-fhe/sdk\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { encryptMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Encrypt a plaintext value using FHE.\n * Calls the relayer's `encrypt` method via a mutation.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link EncryptionFailedError} — FHE encryption failed\n *\n * @returns A mutation whose `mutate` accepts {@link EncryptParams}.\n *\n * @example\n * ```tsx\n * const encrypt = useEncrypt();\n * encrypt.mutate({ values: [{ value: 1000n, type: \"euint64\" }], contractAddress: \"0x...\", userAddress: \"0x...\" });\n * ```\n */\nexport function useEncrypt() {\n const sdk = useZamaSDK();\n return useMutation<EncryptResult, Error, EncryptParams>(encryptMutationOptions(sdk));\n}\n","import {\n type DefaultError,\n type QueriesOptions,\n type QueriesResults,\n useQueries as tanstack_useQueries,\n useQuery as tanstack_useQuery,\n useSuspenseQuery as tanstack_useSuspenseQuery,\n type UseQueryOptions,\n type UseQueryResult,\n type UseSuspenseQueryOptions,\n type UseSuspenseQueryResult,\n} from \"@tanstack/react-query\";\nimport { hashFn } from \"@zama-fhe/sdk/query\";\n\n/**\n * Thin wrapper around TanStack's useQuery that injects our custom queryKeyHashFn.\n * Mirrors the wagmi pattern — the type safety boundary is at the factory and hook levels.\n *\n * Callers typically specify only `<TData>` (e.g. `useQuery<PublicKeyData>(...)`) while\n * factory options carry specific tuple keys (e.g. `readonly [\"zama.publicKey\"]`).\n * We erase the QueryKey param via `AnyKeyQueryOptions` so callers don't need to\n * spell out the key type — any QueryKey subtype is accepted.\n */\ntype AnyKeyQueryOptions<TData, TError> = UseQueryOptions<\n TData,\n TError,\n TData,\n // oxlint-disable-next-line typescript/no-explicit-any\n any\n>;\ntype AnyKeySuspenseOptions<TData, TError> = UseSuspenseQueryOptions<\n TData,\n TError,\n TData,\n // oxlint-disable-next-line typescript/no-explicit-any\n any\n>;\n\nexport function useQuery<TData = unknown, TError = DefaultError>(\n options: AnyKeyQueryOptions<TData, TError>,\n): UseQueryResult<TData, TError> {\n return tanstack_useQuery({\n ...options,\n queryKeyHashFn: hashFn,\n });\n}\n\nexport function useSuspenseQuery<TData = unknown, TError = DefaultError>(\n options: AnyKeySuspenseOptions<TData, TError>,\n): UseSuspenseQueryResult<TData, TError> {\n return tanstack_useSuspenseQuery({\n ...options,\n queryKeyHashFn: hashFn,\n });\n}\n\n/**\n * Thin wrapper around TanStack's useQueries that injects our custom queryKeyHashFn\n * on every query in the array.\n */\nexport function useQueries<\n // oxlint-disable-next-line typescript/no-explicit-any\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>({\n queries,\n ...options\n}: {\n queries: readonly [...QueriesOptions<T>];\n combine?: (result: QueriesResults<T>) => TCombinedResult;\n subscribed?: boolean;\n}): TCombinedResult {\n return tanstack_useQueries({\n ...options,\n queries: queries.map((q) => ({\n ...q,\n queryKeyHashFn: hashFn,\n })) as [...QueriesOptions<T>],\n });\n}\n","\"use client\";\n\nimport { useSyncExternalStore } from \"react\";\nimport type { WalletAccount, ZamaSDK } from \"@zama-fhe/sdk\";\n\nexport function useWalletAccount(sdk: ZamaSDK): WalletAccount | undefined {\n return useSyncExternalStore(\n (listener) => sdk.onWalletAccountChange(listener),\n () => sdk.signer?.walletAccount.getSnapshot(),\n () => undefined,\n );\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { DecryptResult } from \"@zama-fhe/sdk/query\";\nimport { userDecryptQueryOptions } from \"@zama-fhe/sdk/query\";\nimport type { EncryptedInput } from \"@zama-fhe/sdk/query/user-decrypt\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\n/**\n * React hook for FHE user decryption. Thin wrapper around\n * `userDecryptQueryOptions` with `useQuery` semantics.\n */\nexport function useUserDecrypt(\n encryptedInputs: EncryptedInput[],\n options?: Omit<UseQueryOptions<DecryptResult>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n const walletAccount = useWalletAccount(sdk);\n const queryOpts = userDecryptQueryOptions(sdk, encryptedInputs, {\n walletAccount,\n });\n return useQuery<DecryptResult>({\n ...queryOpts,\n ...options,\n enabled: queryOpts.enabled && (options?.enabled ?? false),\n });\n}\n\n/** Return type of {@link useUserDecrypt}. */\nexport type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;\n","\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { EncryptedValue, PublicDecryptResult } from \"@zama-fhe/sdk\";\nimport { publicDecryptMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Decrypt FHE ciphertext handles using the network public key (no credential needed).\n * On success, results are available via `data.clearValues` and written to the\n * persistent decrypt cache.\n *\n * @returns A mutation whose `mutate` accepts an array of handle strings.\n *\n * @example\n * ```tsx\n * const publicDecrypt = usePublicDecrypt();\n * publicDecrypt.mutate([\"0xHandle1\", \"0xHandle2\"]);\n * // publicDecrypt.data?.clearValues => { \"0xHandle1\": 500n, ... }\n * ```\n */\nexport function usePublicDecrypt() {\n const sdk = useZamaSDK();\n return useMutation<PublicDecryptResult, Error, EncryptedValue[]>(\n publicDecryptMutationOptions(sdk),\n );\n}\n","\"use client\";\n\nimport type { ClearValue, EncryptedValue } from \"@zama-fhe/sdk\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport {\n delegatedDecryptMutationOptions,\n type DelegatedDecryptMutationParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Decrypt FHE ciphertext handles using delegated user credentials.\n * Returns a map of handle → plaintext bigint.\n *\n * @returns A mutation whose `mutate` accepts {@link DelegatedDecryptMutationParams}.\n *\n * @example\n * ```tsx\n * const decrypt = useDelegatedDecrypt();\n * decrypt.mutate({ encryptedInputs: [{ encryptedValue: \"0xHandle1\", contractAddress: \"0x...\" }], delegatorAddress: \"0x...\" });\n * // decrypt.data => { \"0xHandle1\": 1000n }\n * ```\n */\nexport function useDelegatedDecrypt() {\n const sdk = useZamaSDK();\n return useMutation<Record<EncryptedValue, ClearValue>, Error, DelegatedDecryptMutationParams>(\n delegatedDecryptMutationOptions(sdk),\n );\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { grantPermitMutationOptions, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Sign an EIP-712 message authorizing decryption of confidential handles\n * for a list of contract addresses. This is not token-specific — any\n * contract that uses FHE-encrypted values (tokens, DeFi vaults, games, etc.)\n * can be authorized in a single wallet signature. Subsequent decrypt\n * operations on any of these contracts reuse cached credentials.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link KeypairExpiredError} — the re-encryption keypair has expired\n *\n * @example\n * ```tsx\n * const { mutateAsync: grantPermit, isPending } = useGrantPermit();\n *\n * // Authorize decryption for any contracts with encrypted state:\n * // confidential tokens, auction contracts, governance contracts, etc.\n * await grantPermit([tokenAddress, auctionAddress, governanceAddress]);\n * ```\n */\nexport function useGrantPermit(options?: UseMutationOptions<void, Error, Address[]>) {\n const sdk = useZamaSDK();\n\n return useMutation<void, Error, Address[]>({\n ...grantPermitMutationOptions(sdk),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n context.client.removeQueries({ queryKey: zamaQueryKeys.hasPermit.all });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery } from \"../utils/query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { hasPermitQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\n/** Configuration for {@link useHasPermit}. */\nexport interface UseHasPermitConfig {\n /** Contract addresses to check credentials against (at least one required). */\n contractAddresses: [Address, ...Address[]];\n}\n\n/**\n * Check whether stored permits cover the given contract addresses for the\n * connected signer. Returns `true` if decrypt operations can proceed without\n * a wallet prompt.\n *\n * @returns Query result with `data: boolean` — `true` if a stored permit covers\n * every entry in `contractAddresses`. The query auto-disables when no signer is configured\n * (`data` stays `undefined`, `status` stays `\"pending\"`).\n * @throws if the query runs without a signer configured (the `enabled` guard normally\n * prevents this; only reachable if the caller forces `query: { enabled: true }`). {@link SignerNotConfiguredError}\n *\n * @example\n * ```tsx\n * const { data: hasPermit } = useHasPermit({ contractAddresses: [\"0xToken\"] });\n * ```\n */\nexport function useHasPermit(config: UseHasPermitConfig) {\n const sdk = useZamaSDK();\n const walletAccount = useWalletAccount(sdk);\n return useQuery<boolean>(hasPermitQueryOptions(sdk, config, { walletAccount }));\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { revokePermitsMutationOptions, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Revoke FHE permits for the current signer.\n *\n * - Called with no arguments: every permit is removed across all chains and\n * delegators. The keypair survives — use {@link useClearCredentials} to also\n * wipe the keypair.\n * - Called with a contract list: only direct-decrypt permits on the current\n * chain whose payload touches a listed address are removed. Delegated\n * permits are not touched in this mode.\n *\n * @example\n * ```tsx\n * const { mutate: revokePermits } = useRevokePermits();\n * revokePermits([tokenAddress]); // direct-decrypt scope, current chain\n * revokePermits(); // every permit, all chains, all delegators\n * ```\n */\nexport function useRevokePermits(options?: UseMutationOptions<void, Error, Address[] | void>) {\n const sdk = useZamaSDK();\n\n return useMutation<void, Error, Address[] | void>({\n ...revokePermitsMutationOptions(sdk),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n context.client.removeQueries({ queryKey: zamaQueryKeys.hasPermit.all });\n context.client.removeQueries({ queryKey: zamaQueryKeys.decryption.all });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport { clearCredentialsMutationOptions, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Wipe the keypair for the current signer and cascade-delete every permit\n * (across chains and delegators) referencing it. Useful for \"log out\"\n * handlers that should leave no trace.\n *\n * @example\n * ```tsx\n * const { mutate: clearCredentials } = useClearCredentials();\n * clearCredentials();\n * ```\n */\nexport function useClearCredentials(options?: UseMutationOptions<void>) {\n const sdk = useZamaSDK();\n\n return useMutation<void>({\n ...clearCredentialsMutationOptions(sdk),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n context.client.removeQueries({ queryKey: zamaQueryKeys.hasPermit.all });\n context.client.removeQueries({ queryKey: zamaQueryKeys.decryption.all });\n },\n });\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport type { Address, Token } from \"@zama-fhe/sdk\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Get a {@link Token} instance for an ERC-7984 confidential token, memoized by address.\n * Supports balance queries, transfers, and operator approval.\n *\n * For ERC-7984 wrappers (shield/unshield), use {@link useWrappedToken} instead.\n *\n * @param address - The confidential token contract address.\n * @returns A memoized `Token` instance.\n *\n * @example\n * ```tsx\n * const token = useToken(\"0xToken\");\n * // token.balanceOf(), token.confidentialTransfer(), etc.\n * ```\n */\nexport function useToken(address: Address): Token {\n const sdk = useZamaSDK();\n return useMemo<Token>(() => sdk.createToken(address), [sdk, address]);\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport type { Address, WrappedToken } from \"@zama-fhe/sdk\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Get a {@link WrappedToken} instance for an ERC-7984 ERC-20 wrapper,\n * memoized by address. Adds wrapper-specific operations (shield, unshield,\n * underlying, allowance) on top of the base {@link useToken} API.\n *\n * The address is the wrapper contract address itself — the wrapper IS the\n * confidential token.\n *\n * @param address - The confidential wrapper contract address.\n * @returns A memoized `WrappedToken` instance.\n *\n * @example\n * ```tsx\n * const wrapped = useWrappedToken(\"0xWrapper\");\n * // wrapped.shield(1000n), wrapped.unshield(500n), etc.\n * ```\n */\nexport function useWrappedToken(address: Address): WrappedToken {\n const sdk = useZamaSDK();\n return useMemo<WrappedToken>(() => sdk.createWrappedToken(address), [sdk, address]);\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { confidentialBalanceQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\nimport { useQuery } from \"../utils/query\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\nexport interface UseConfidentialBalanceConfig {\n /** Address of the confidential token contract. */\n address: Address;\n /** Account to fetch balance for. The query is disabled while `undefined`. */\n account: Address | undefined;\n}\n\nexport interface UseConfidentialBalanceOptions extends Omit<\n UseQueryOptions<bigint>,\n \"queryKey\" | \"queryFn\" | \"enabled\"\n> {\n /** Set this to `false` to disable this query from automatically running. */\n enabled?: boolean;\n}\n\n/**\n * Hook for fetching a confidential token balance. Reads the on-chain encrypted\n * value and decrypts via the SDK; cached clear values are returned instantly\n * and the relayer is only hit when the encrypted value changes.\n *\n * @example\n * ```tsx\n * const { data: balance } = useConfidentialBalance({\n * address: \"0xToken\",\n * account: \"0xAccount\",\n * });\n * ```\n */\nexport function useConfidentialBalance(\n config: UseConfidentialBalanceConfig,\n options?: UseConfidentialBalanceOptions,\n) {\n const { address, account } = config;\n const { enabled = true } = options ?? {};\n const token = useToken(address);\n const walletAccount = useWalletAccount(token.sdk);\n\n const baseOptions = confidentialBalanceQueryOptions(\n token,\n {\n tokenAddress: address,\n account,\n },\n { walletAccount },\n );\n\n return useQuery<bigint>({\n ...baseOptions,\n ...options,\n enabled: Boolean(baseOptions.enabled) && enabled,\n });\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport { useQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address, BatchBalancesResult } from \"@zama-fhe/sdk\";\nimport { confidentialBalancesQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useWalletAccount } from \"../utils/wallet-account\";\n\nexport interface UseConfidentialBalancesConfig {\n /** Addresses of the confidential token contracts to batch-query. The query is disabled while empty. */\n addresses: Address[];\n /** Account to fetch balances for. The query is disabled while `undefined`. */\n account: Address | undefined;\n}\n\nexport interface UseConfidentialBalancesOptions extends Omit<\n UseQueryOptions<BatchBalancesResult>,\n \"queryKey\" | \"queryFn\" | \"enabled\"\n> {\n /** Set this to `false` to disable this query from automatically running. */\n enabled?: boolean;\n}\n\n/**\n * Hook for fetching multiple confidential token balances in batch. Returns\n * partial results when some tokens fail — successful balances are available\n * alongside per-token error information.\n *\n * @param config - Token addresses configuration.\n * @param options - React Query options forwarded to the balance query.\n * @returns The balance query result.\n *\n * @example\n * ```tsx\n * const { data } = useConfidentialBalances({\n * addresses: [\"0xTokenA\", \"0xTokenB\"],\n * account: \"0xAccount\",\n * });\n * const balance = data?.results.get(\"0xTokenA\");\n * if (data && data.errors.size > 0) {\n * // some tokens failed — check data.errors\n * }\n * ```\n */\nexport function useConfidentialBalances(\n config: UseConfidentialBalancesConfig,\n options?: UseConfidentialBalancesOptions,\n) {\n const { addresses, account } = config;\n const { enabled = true } = options ?? {};\n const sdk = useZamaSDK();\n const walletAccount = useWalletAccount(sdk);\n\n const tokens = useMemo(() => addresses.map((addr) => sdk.createToken(addr)), [sdk, addresses]);\n\n const baseOptions = confidentialBalancesQueryOptions(\n tokens,\n {\n account,\n },\n { walletAccount },\n );\n\n return useQuery<BatchBalancesResult>({\n ...baseOptions,\n ...options,\n enabled: Boolean(baseOptions.enabled) && enabled,\n });\n}\n","import type { QueryClient, QueryKey, UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport { invalidateAfterShield, zamaQueryKeys } from \"@zama-fhe/sdk/query\";\n\ntype BalanceDeltaMode = \"add\" | \"subtract\";\nexport type OptimisticBalanceSnapshot = [QueryKey, bigint | undefined][];\n\n/** Combined context returned by optimistic `onMutate`. */\nexport interface OptimisticMutateContext {\n snapshot: OptimisticBalanceSnapshot;\n callerContext?: unknown;\n}\n\nexport function unwrapOptimisticCallerContext(\n optimistic: boolean | undefined,\n rawContext: unknown,\n): {\n wrappedContext: OptimisticMutateContext | undefined;\n callerContext: OptimisticMutateContext | undefined;\n} {\n const typed = rawContext as OptimisticMutateContext | undefined;\n const wrappedContext = optimistic ? typed : undefined;\n const callerContext = (optimistic ? wrappedContext?.callerContext : rawContext) as\n | OptimisticMutateContext\n | undefined;\n return { wrappedContext, callerContext };\n}\n\nexport async function applyOptimisticBalanceDelta({\n queryClient,\n tokenAddress,\n amount,\n mode,\n}: {\n queryClient: QueryClient;\n tokenAddress: Address;\n amount: bigint;\n mode: BalanceDeltaMode;\n}): Promise<OptimisticBalanceSnapshot> {\n const balanceKey = zamaQueryKeys.confidentialBalance.token(tokenAddress);\n await queryClient.cancelQueries({ queryKey: balanceKey });\n const previous = queryClient.getQueriesData<bigint>({ queryKey: balanceKey });\n for (const [key, value] of previous) {\n if (value === undefined) {\n continue;\n }\n // Temporary optimistic underflow (`amount > value`) is acceptable because\n // settlement invalidates and rewrites this cache entry.\n queryClient.setQueryData(key, mode === \"add\" ? value + amount : value - amount);\n }\n return previous;\n}\n\nexport function rollbackOptimisticBalanceDelta(\n queryClient: QueryClient,\n snapshot: OptimisticBalanceSnapshot,\n) {\n for (const [key, value] of snapshot) {\n queryClient.setQueryData(key, value);\n }\n}\n\n/**\n * Build optimistic mutation callbacks for shield operations.\n * Wraps the caller's `onMutate`/`onError`/`onSuccess`/`onSettled` with snapshot/rollback logic\n * and returns overrides ready to spread into `useMutation`.\n */\nexport function optimisticBalanceCallbacks<TParams extends { amount: bigint }>({\n optimistic,\n tokenAddress,\n queryClient,\n options,\n}: {\n optimistic: boolean | undefined;\n tokenAddress: Address;\n queryClient: QueryClient;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n options: UseMutationOptions<TransactionResult, Error, TParams, any> | undefined;\n}): Pick<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n UseMutationOptions<TransactionResult, Error, TParams, any>,\n \"onMutate\" | \"onError\" | \"onSuccess\" | \"onSettled\"\n> {\n return {\n onMutate: optimistic\n ? async (variables, mutationContext) => {\n const snapshot = await applyOptimisticBalanceDelta({\n queryClient,\n tokenAddress,\n amount: variables.amount,\n mode: \"add\",\n });\n const callerContext = await options?.onMutate?.(variables, mutationContext);\n return { snapshot, callerContext };\n }\n : options?.onMutate,\n onError: (error, variables, rawContext, context) => {\n const { wrappedContext, callerContext } = unwrapOptimisticCallerContext(\n optimistic,\n rawContext,\n );\n try {\n if (wrappedContext) {\n rollbackOptimisticBalanceDelta(queryClient, wrappedContext.snapshot);\n }\n } finally {\n options?.onError?.(error, variables, callerContext, context);\n }\n },\n onSuccess: (data, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(optimistic, rawContext);\n options?.onSuccess?.(data, variables, callerContext, context);\n invalidateAfterShield(context.client, tokenAddress);\n },\n onSettled: (data, error, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(optimistic, rawContext);\n options?.onSettled?.(data, error, variables, callerContext, context);\n },\n };\n}\n","\"use client\";\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n type UseMutationResult,\n} from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n confidentialTransferMutationOptions,\n invalidateAfterTransfer,\n type ConfidentialTransferParams,\n} from \"@zama-fhe/sdk/query\";\nimport {\n applyOptimisticBalanceDelta,\n rollbackOptimisticBalanceDelta,\n unwrapOptimisticCallerContext,\n} from \"../balance/optimistic-balance-update\";\nimport { useToken } from \"../token/use-token\";\n\n/** Configuration for {@link useConfidentialTransfer}. */\nexport interface UseConfidentialTransferConfig {\n /** Address of the confidential token contract. */\n address: Address;\n /**\n * When `true`, optimistically subtracts the transfer amount from cached balance\n * before the transaction confirms. Rolls back on error.\n * @defaultValue false\n */\n optimistic?: boolean;\n}\n\n/**\n * Encrypt and send a confidential transfer. Invalidates balance caches on success.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption failed\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param config - Token address (and optional wrapper) identifying the token.\n * Set `optimistic: true` to subtract the amount from the cached balance immediately.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const transfer = useConfidentialTransfer({\n * address: \"0xToken\",\n * optimistic: true,\n * });\n * transfer.mutate(\n * { to: \"0xRecipient\", amount: 1000n },\n * {\n * onError: (error) => {\n * if (error instanceof SigningRejectedError) {\n * // user cancelled — no action needed\n * }\n * },\n * },\n * );\n * ```\n */\nexport function useConfidentialTransfer<TContext = unknown>(\n config: UseConfidentialTransferConfig,\n options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferParams, TContext>,\n): UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, TContext> {\n const token = useToken(config.address);\n const queryClient = useQueryClient();\n\n // Internal mutation uses `any` for TContext because optimistic mode wraps\n // the caller's context in OptimisticMutateContext; the public return type\n // is cast back to the caller's TContext.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return useMutation<TransactionResult, Error, ConfidentialTransferParams, any>({\n ...confidentialTransferMutationOptions(token),\n ...options,\n onMutate: config.optimistic\n ? async (variables, mutationContext) => {\n const snapshot = await applyOptimisticBalanceDelta({\n queryClient,\n tokenAddress: token.address,\n amount: variables.amount,\n mode: \"subtract\",\n });\n const callerContext = await options?.onMutate?.(variables, mutationContext);\n return { snapshot, callerContext };\n }\n : options?.onMutate,\n onError: (error, variables, rawContext, context) => {\n const { wrappedContext, callerContext } = unwrapOptimisticCallerContext(\n config.optimistic,\n rawContext,\n );\n try {\n if (wrappedContext) {\n rollbackOptimisticBalanceDelta(queryClient, wrappedContext.snapshot);\n }\n } finally {\n options?.onError?.(error, variables, callerContext as TContext, context);\n }\n },\n onSuccess: (data, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(config.optimistic, rawContext);\n options?.onSuccess?.(data, variables, callerContext as TContext, context);\n invalidateAfterTransfer(context.client, token.address);\n },\n onSettled: (data, error, variables, rawContext, context) => {\n const { callerContext } = unwrapOptimisticCallerContext(config.optimistic, rawContext);\n options?.onSettled?.(data, error, variables, callerContext as TContext, context);\n },\n }) as UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, TContext>;\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n confidentialTransferFromMutationOptions,\n invalidateAfterTransfer,\n type ConfidentialTransferFromParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\n\n/**\n * Operator transfer on behalf of another address. Caller must be an approved operator.\n * Invalidates balance caches on success.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption of the transfer amount failed\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential token contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const transferFrom = useConfidentialTransferFrom(\"0xToken\");\n * transferFrom.mutate({ from: \"0xOwner\", to: \"0xRecipient\", amount: 500n });\n * ```\n */\nexport function useConfidentialTransferFrom(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferFromParams, Address>,\n) {\n const token = useToken(address);\n\n return useMutation<TransactionResult, Error, ConfidentialTransferFromParams, Address>({\n ...confidentialTransferFromMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterTransfer(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n confidentialSetOperatorMutationOptions,\n invalidateAfterSetOperator,\n type ConfidentialSetOperatorParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\n\n/**\n * Set operator approval for a confidential token. Defaults to 1 hour.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential token contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const setOperator = useConfidentialSetOperator(\"0xToken\");\n * setOperator.mutate({ operator: \"0xOperator\" });\n * ```\n */\nexport function useConfidentialSetOperator(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ConfidentialSetOperatorParams, Address>,\n) {\n const token = useToken(address);\n\n return useMutation<TransactionResult, Error, ConfidentialSetOperatorParams, Address>({\n ...confidentialSetOperatorMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterSetOperator(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { confidentialIsOperatorQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport interface UseConfidentialIsOperatorConfig {\n /** Address of the confidential token contract. The query is disabled while `undefined`. */\n address: Address | undefined;\n /** Address to check operator status for. The query is disabled while `undefined`. */\n spender: Address | undefined;\n /** Token holder address. The query is disabled while `undefined`. */\n holder: Address | undefined;\n}\n\nexport interface UseConfidentialIsOperatorSuspenseConfig {\n /** Address of the confidential token contract. */\n address: Address;\n /** Address to check operator status for. */\n spender: Address;\n /** Token holder address. */\n holder: Address;\n}\n\n/**\n * Check if a spender is an approved operator for a holder.\n *\n * @param config - Token address, spender, and holder to check.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isOperator } = useConfidentialIsOperator({\n * address: \"0xToken\",\n * spender: \"0xSpender\",\n * holder: \"0xHolder\",\n * });\n * ```\n */\nexport function useConfidentialIsOperator(\n config: UseConfidentialIsOperatorConfig,\n options?: Omit<UseQueryOptions<boolean>, \"queryKey\" | \"queryFn\">,\n) {\n const { address, spender, holder } = config;\n const sdk = useZamaSDK();\n const baseOpts = confidentialIsOperatorQueryOptions(sdk, address, {\n holder,\n spender,\n });\n\n return useQuery({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n\n/**\n * Suspense variant of {@link useConfidentialIsOperator}. Suspends rendering\n * until the operator check resolves.\n *\n * @example\n * ```tsx\n * const { data: isOperator } = useConfidentialIsOperatorSuspense({\n * address: \"0xToken\",\n * spender: \"0xSpender\",\n * holder: \"0xHolder\",\n * });\n * ```\n */\nexport function useConfidentialIsOperatorSuspense(config: UseConfidentialIsOperatorSuspenseConfig) {\n const { spender, holder, address } = config;\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<boolean>(\n confidentialIsOperatorQueryOptions(sdk, address, {\n holder,\n spender,\n }),\n );\n}\n","\"use client\";\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n type UseMutationResult,\n} from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport { shieldMutationOptions, type ShieldParams } from \"@zama-fhe/sdk/query\";\nimport { optimisticBalanceCallbacks } from \"../balance/optimistic-balance-update\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/** Configuration for {@link useShield}. */\nexport interface UseShieldConfig {\n /** Address of the confidential wrapper contract. */\n address: Address;\n /**\n * When `true`, optimistically adds the wrap amount to the cached confidential balance\n * before the transaction confirms. Rolls back on error.\n * @defaultValue false\n */\n optimistic?: boolean;\n}\n\n/**\n * Shield public ERC-20 tokens into confidential tokens.\n * Handles ERC-20 approval automatically. Invalidates balance caches on success.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — approval or shield transaction reverted\n *\n * @param config - Wrapper address (and optional `optimistic` flag).\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const shield = useShield({ address: \"0xWrapper\", optimistic: true });\n * shield.mutate({ amount: 1000n });\n * ```\n */\nexport function useShield<TContext = unknown>(\n config: UseShieldConfig,\n options?: UseMutationOptions<TransactionResult, Error, ShieldParams, TContext>,\n): UseMutationResult<TransactionResult, Error, ShieldParams, TContext> {\n const token = useWrappedToken(config.address);\n const queryClient = useQueryClient();\n\n return useMutation({\n ...shieldMutationOptions(token),\n ...options,\n ...optimisticBalanceCallbacks({\n optimistic: config.optimistic,\n tokenAddress: token.address,\n queryClient,\n options,\n }),\n }) as UseMutationResult<TransactionResult, Error, ShieldParams, TContext>;\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnwrap,\n type UnwrapParams,\n unwrapMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Request an unwrap for a specific amount. Encrypts the amount first.\n * Call {@link useFinalizeUnwrap} after the request is processed on-chain,\n * or use {@link useUnshield} for a single-call orchestration.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption of the unwrap amount failed\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unwrap = useUnwrap(\"0xWrapper\");\n * unwrap.mutate({ amount: 500n });\n * ```\n */\nexport function useUnwrap(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, UnwrapParams, Address>({\n ...unwrapMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnwrap(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport { invalidateAfterUnwrap, unwrapAllMutationOptions } from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Request an unwrap for the entire confidential balance.\n * Uses the on-chain balance handle directly (no encryption needed).\n * Call {@link useFinalizeUnwrap} after processing, or use {@link useUnshieldAll} for single-call orchestration.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unwrapAll = useUnwrapAll(\"0xWrapper\");\n * unwrapAll.mutate();\n * ```\n */\nexport function useUnwrapAll(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, void, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, void, Address>({\n ...unwrapAllMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnwrap(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n finalizeUnwrapMutationOptions,\n invalidateAfterUnshield,\n type FinalizeUnwrapParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Complete an unwrap by providing the public decryption proof.\n * Call this after an unwrap request has been processed on-chain.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link DecryptionFailedError} — public decryption of the burn amount failed\n * - {@link TransactionRevertedError} — on-chain finalize transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const finalize = useFinalizeUnwrap(\"0xWrapper\");\n * const event = findUnwrapRequested(receipt.logs);\n * // Pass unwrapRequestId from upgraded events, or fall back to encryptedAmount for legacy ones.\n * finalize.mutate(\n * event.unwrapRequestId\n * ? { unwrapRequestId: event.unwrapRequestId }\n * : { burnAmountHandle: event.encryptedAmount },\n * );\n * ```\n */\nexport function useFinalizeUnwrap(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, FinalizeUnwrapParams, Address>({\n ...finalizeUnwrapMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnshield,\n type UnshieldParams,\n unshieldMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Unshield a specific amount and finalize in one call.\n * Orchestrates: unwrap → wait for receipt → parse event → finalize.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link EncryptionFailedError} — FHE encryption failed during unwrap\n * - {@link DecryptionFailedError} — public decryption failed during finalize\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unshield = useUnshield(\"0xWrapper\");\n * unshield.mutate({ amount: 500n });\n * ```\n */\nexport function useUnshield(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, UnshieldParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, UnshieldParams, Address>({\n ...unshieldMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnshield,\n type UnshieldAllParams,\n unshieldAllMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Unshield the entire balance and finalize in one call.\n * Orchestrates: unwrapAll → wait for receipt → parse event → finalize.\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link DecryptionFailedError} — public decryption failed during finalize\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const unshieldAll = useUnshieldAll(\"0xWrapper\");\n * unshieldAll.mutate();\n * ```\n */\nexport function useUnshieldAll(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, UnshieldAllParams | void, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, UnshieldAllParams | void, Address>({\n ...unshieldAllMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n invalidateAfterUnshield,\n type ResumeUnshieldParams,\n resumeUnshieldMutationOptions,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Resume an interrupted unshield from an existing unwrap tx hash.\n * Useful when the user submitted the unwrap but the finalize step was\n * interrupted (e.g. page reload, network error).\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link DecryptionFailedError} — public decryption failed during finalize\n * - {@link TransactionRevertedError} — on-chain transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const resumeUnshield = useResumeUnshield(\"0xWrapper\");\n * resumeUnshield.mutate({ unwrapTxHash: \"0xabc...\" });\n * ```\n */\nexport function useResumeUnshield(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ResumeUnshieldParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, ResumeUnshieldParams, Address>({\n ...resumeUnshieldMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterUnshield(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { underlyingAllowanceQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport { underlyingAllowanceQueryOptions };\n\nexport interface UseUnderlyingAllowanceConfig {\n /** Address of the confidential wrapper contract. */\n address: Address;\n /** Owner to fetch allowance for. The query is disabled while `undefined`. */\n owner: Address | undefined;\n}\n\nexport interface UseUnderlyingAllowanceSuspenseConfig {\n /** Address of the confidential wrapper contract. */\n address: Address;\n /** Owner to fetch allowance for. */\n owner: Address;\n}\n\n/**\n * Hook for fetching the underlying ERC-20 allowance granted to the wrapper\n * contract. Useful to check if an approval is needed before shielding.\n *\n * @example\n * ```tsx\n * const { data: allowance } = useUnderlyingAllowance({\n * address: \"0xWrapper\",\n * owner: \"0xOwner\",\n * });\n * ```\n */\nexport function useUnderlyingAllowance(\n config: UseUnderlyingAllowanceConfig,\n options?: Omit<UseQueryOptions<bigint>, \"queryKey\" | \"queryFn\">,\n) {\n const { address, owner } = config;\n const sdk = useZamaSDK();\n\n const baseOpts = underlyingAllowanceQueryOptions(sdk, address, { owner });\n\n return useQuery<bigint>({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n\n/**\n * Suspense variant of {@link useUnderlyingAllowance}. Suspends rendering until\n * the allowance resolves.\n *\n * @example\n * ```tsx\n * const { data: allowance } = useUnderlyingAllowanceSuspense({\n * address: \"0xWrapper\",\n * owner: \"0xOwner\",\n * });\n * ```\n */\nexport function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceSuspenseConfig) {\n const { address, owner } = config;\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<bigint>(underlyingAllowanceQueryOptions(sdk, address, { owner }));\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { zamaQueryKeys } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\n\n/**\n * Resolves the wrappers registry address for the current chain.\n * Uses the registry addresses from `sdk.registry` (built-in defaults from chain configs).\n *\n * Returns `undefined` when the chain ID hasn't been fetched yet\n * or when no registry is configured for the connected chain.\n *\n * The chain ID is cached for 30 seconds (`staleTime`), so chain\n * switches may take up to 30s to reflect.\n */\nexport function useWrappersRegistryAddress(): Address | undefined {\n const sdk = useZamaSDK();\n\n const { data: chainId } = useQuery<number>({\n queryKey: zamaQueryKeys.wrappersRegistry.chainId(),\n queryFn: () => sdk.provider.getChainId(),\n staleTime: 30_000,\n });\n\n return chainId !== undefined ? sdk.registry.getAddress(chainId) : undefined;\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { wrapperDiscoveryQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"../wrappers-registry/use-wrappers-registry-address\";\n\nexport { wrapperDiscoveryQueryOptions };\n\n/** Configuration for {@link useWrapperDiscovery}. */\nexport interface UseWrapperDiscoveryConfig {\n /**\n * Address of any confidential token you control.\n * Used only to derive the signer context and to scope the query cache key —\n * it does not affect which wrapper the registry returns.\n */\n tokenAddress: Address;\n /** ERC-20 address to discover the wrapper for. Pass `undefined` to disable the query. */\n erc20Address: Address | undefined;\n}\n\n/** Configuration for {@link useWrapperDiscoverySuspense}. */\nexport interface UseWrapperDiscoverySuspenseConfig {\n /**\n * Address of any confidential token you control.\n * Used only to derive the signer context and to scope the query cache key —\n * it does not affect which wrapper the registry returns.\n */\n tokenAddress: Address;\n /** ERC-20 address to discover the wrapper for. */\n erc20Address: Address;\n}\n\n/**\n * Discover the confidential wrapper for an ERC-20 token via the on-chain registry.\n * Returns the wrapper address if one exists, or `null` if not.\n * Cached indefinitely since wrapper mappings are immutable.\n *\n * @param config - Token and ERC-20 addresses.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: Address | null`.\n *\n * @example\n * ```tsx\n * const { data: wrapperAddress } = useWrapperDiscovery({\n * tokenAddress: \"0xConfidentialToken\",\n * erc20Address: \"0xUSDC\",\n * });\n * ```\n */\nexport function useWrapperDiscovery(\n config: UseWrapperDiscoveryConfig,\n options?: Omit<UseQueryOptions<Address | null>, \"queryKey\" | \"queryFn\">,\n) {\n const { tokenAddress, erc20Address } = config;\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n const baseOpts = wrapperDiscoveryQueryOptions(sdk.registry, {\n tokenAddress,\n erc20Address,\n registryAddress,\n });\n\n return useQuery<Address | null>({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n\n/**\n * Suspense variant of {@link useWrapperDiscovery}.\n * Suspends rendering until the wrapper address is resolved.\n *\n * @param config - Token and ERC-20 addresses.\n * @returns Suspense query result with `data: Address | null`.\n *\n * @example\n * ```tsx\n * const { data: wrapperAddress } = useWrapperDiscoverySuspense({\n * tokenAddress: \"0xConfidentialToken\",\n * erc20Address: \"0xUSDC\",\n * });\n * ```\n */\nexport function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig) {\n const { tokenAddress, erc20Address } = config;\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useSuspenseQuery<Address | null>(\n wrapperDiscoveryQueryOptions(sdk.registry, {\n tokenAddress,\n erc20Address,\n registryAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { tokenMetadataQueryOptions, type TokenMetadata } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\n\n/**\n * Read ERC-20 token metadata (name, symbol, decimals).\n * Fetches all three in parallel. Cached indefinitely since metadata is immutable.\n *\n * @param tokenAddress - Address of the token contract.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: TokenMetadata`.\n *\n * @example\n * ```tsx\n * const { data: metadata } = useMetadata(\"0xToken\");\n * // metadata?.name, metadata?.symbol, metadata?.decimals\n * ```\n */\nexport function useMetadata(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<TokenMetadata>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n return useQuery<TokenMetadata>({\n ...tokenMetadataQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useMetadata}.\n * Suspends rendering until metadata is loaded.\n *\n * @param tokenAddress - Address of the token contract.\n * @returns Suspense query result with `data: TokenMetadata`.\n *\n * @example\n * ```tsx\n * const { data: metadata } = useMetadataSuspense(\"0xToken\");\n * ```\n */\nexport function useMetadataSuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n return useSuspenseQuery<TokenMetadata>(tokenMetadataQueryOptions(sdk, tokenAddress));\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n delegateDecryptionMutationOptions,\n zamaQueryKeys,\n type DelegateDecryptionParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Delegate FHE decryption rights for a confidential contract to another address\n * via the on-chain ACL.\n *\n * @param address - Confidential contract address to delegate on.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const delegate = useDelegateDecryption(\"0xToken\");\n * delegate.mutate({ delegateAddress: \"0xDelegate\" });\n * ```\n */\nexport function useDelegateDecryption(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, DelegateDecryptionParams>,\n) {\n const sdk = useZamaSDK();\n\n return useMutation<TransactionResult, Error, DelegateDecryptionParams>({\n ...delegateDecryptionMutationOptions(sdk, address),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n try {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n } finally {\n void context.client.invalidateQueries({ queryKey: zamaQueryKeys.delegationStatus.all });\n }\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n revokeDelegationMutationOptions,\n zamaQueryKeys,\n type RevokeDelegationParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\n/**\n * Revoke FHE decryption delegation for a confidential contract from a delegate address.\n *\n * @param address - Confidential contract address to revoke delegation on.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const revoke = useRevokeDelegation(\"0xToken\");\n * revoke.mutate({ delegateAddress: \"0xDelegate\" });\n * ```\n */\nexport function useRevokeDelegation(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, RevokeDelegationParams>,\n) {\n const sdk = useZamaSDK();\n\n return useMutation<TransactionResult, Error, RevokeDelegationParams>({\n ...revokeDelegationMutationOptions(sdk, address),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n try {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n } finally {\n void context.client.invalidateQueries({ queryKey: zamaQueryKeys.delegationStatus.all });\n }\n },\n });\n}\n","\"use client\";\n\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { delegationStatusQueryOptions, type DelegationStatusData } from \"@zama-fhe/sdk/query\";\nimport { useQuery } from \"../utils/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport interface UseDelegationStatusConfig {\n /** Address of the confidential contract. Pass `undefined` to disable the query. */\n contractAddress: Address | undefined;\n /** The address that granted the delegation. */\n delegatorAddress?: Address;\n /** The address that received delegation rights. */\n delegateAddress?: Address;\n}\n\n/**\n * Query delegation status between a delegator and delegate for a token.\n *\n * @param config - Token address, delegator, and delegate addresses.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns `{ isActive, expiryTimestamp, isLoading, error }`.\n *\n * @example\n * ```tsx\n * const { data } = useDelegationStatus({\n * contractAddress: \"0xToken\",\n * delegatorAddress: \"0xDelegator\",\n * delegateAddress: \"0xDelegate\",\n * });\n * // data?.isActive, data?.expiryTimestamp\n * ```\n */\nexport function useDelegationStatus(\n config: UseDelegationStatusConfig,\n options?: Omit<UseQueryOptions<DelegationStatusData>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n const baseOpts = delegationStatusQueryOptions(sdk, config);\n\n return useQuery<DelegationStatusData>({\n ...baseOpts,\n ...options,\n enabled: (baseOpts.enabled ?? true) && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { decryptBalanceAsMutationOptions, type DecryptBalanceAsParams } from \"@zama-fhe/sdk/query\";\nimport { useToken } from \"../token/use-token\";\n\n/**\n * Decrypt another user's confidential balance as a delegate.\n *\n * @param address - Address of the confidential token contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const decryptAs = useDecryptBalanceAs(\"0xToken\");\n * decryptAs.mutate({ delegatorAddress: \"0xDelegator\" });\n * // decryptAs.data => 1000n\n * ```\n */\nexport function useDecryptBalanceAs(\n address: Address,\n options?: UseMutationOptions<bigint, Error, DecryptBalanceAsParams>,\n) {\n const token = useToken(address);\n\n return useMutation<bigint, Error, DecryptBalanceAsParams>({\n ...decryptBalanceAsMutationOptions(token),\n ...options,\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationOptions } from \"@tanstack/react-query\";\nimport type { Address, Token } from \"@zama-fhe/sdk\";\nimport {\n batchDecryptBalancesAsMutationOptions,\n type BatchDecryptBalancesAsParams,\n} from \"@zama-fhe/sdk/query\";\n\n/**\n * Batch decrypt confidential balances as a delegate across multiple tokens.\n *\n * @param tokens - {@link Token} instances to decrypt balances for.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const batchDecryptAs = useBatchDecryptBalancesAs(tokens);\n * batchDecryptAs.mutate({\n * delegatorAddress: \"0xDelegator\",\n * });\n * // batchDecryptAs.data => Map { \"0xTokenA\" => 100n, \"0xTokenB\" => 200n }\n * ```\n */\nexport function useBatchDecryptBalancesAs(\n tokens: Token[],\n options?: UseMutationOptions<Map<Address, bigint>, Error, BatchDecryptBalancesAsParams>,\n) {\n return useMutation<Map<Address, bigint>, Error, BatchDecryptBalancesAsParams>({\n ...batchDecryptBalancesAsMutationOptions(tokens),\n ...options,\n });\n}\n","\"use client\";\n\nimport type { UseMutationOptions } from \"@tanstack/react-query\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { Address, TransactionResult } from \"@zama-fhe/sdk\";\nimport {\n approveUnderlyingMutationOptions,\n invalidateAfterApproveUnderlying,\n type ApproveUnderlyingParams,\n} from \"@zama-fhe/sdk/query\";\nimport { useWrappedToken } from \"../token/use-wrapped-token\";\n\n/**\n * Approve the wrapper contract to spend the underlying ERC-20.\n * Defaults to max uint256. Resets to zero first if there's an existing\n * non-zero allowance (required by tokens like USDT).\n *\n * Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:\n * - {@link SigningRejectedError} — user rejected the wallet prompt\n * - {@link TransactionRevertedError} — approval transaction reverted\n *\n * @param address - Address of the confidential wrapper contract.\n * @param options - React Query mutation options.\n *\n * @example\n * ```tsx\n * const approve = useApproveUnderlying(\"0xWrapper\");\n * approve.mutate({}); // max approval\n * approve.mutate({ amount: 1000n }); // exact amount\n * ```\n */\nexport function useApproveUnderlying(\n address: Address,\n options?: UseMutationOptions<TransactionResult, Error, ApproveUnderlyingParams, Address>,\n) {\n const token = useWrappedToken(address);\n\n return useMutation<TransactionResult, Error, ApproveUnderlyingParams, Address>({\n ...approveUnderlyingMutationOptions(token),\n ...options,\n onSuccess: (data, variables, onMutateResult, context) => {\n options?.onSuccess?.(data, variables, onMutateResult, context);\n invalidateAfterApproveUnderlying(context.client, token.address);\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { isConfidentialQueryOptions, isWrapperQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport { isConfidentialQueryOptions, isWrapperQueryOptions };\n\n/**\n * Check if a token supports the ERC-7984 confidential interface via ERC-165.\n * Result is cached indefinitely since interface support does not change.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isConfidential } = useIsConfidential(\"0xToken\");\n * ```\n */\nexport function useIsConfidential(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<boolean>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n\n return useQuery<boolean>({\n ...isConfidentialQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useIsConfidential}.\n * Suspends rendering until the ERC-165 check resolves.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @returns Suspense query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isConfidential } = useIsConfidentialSuspense(\"0xToken\");\n * ```\n */\nexport function useIsConfidentialSuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<boolean>(isConfidentialQueryOptions(sdk, tokenAddress));\n}\n\n/**\n * Check if a token supports the ERC-7984 wrapper interface via ERC-165.\n * Result is cached indefinitely since interface support does not change.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isWrapper } = useIsWrapper(\"0xToken\");\n * ```\n */\nexport function useIsWrapper(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<boolean>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n\n return useQuery<boolean>({\n ...isWrapperQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useIsWrapper}.\n * Suspends rendering until the ERC-165 check resolves.\n *\n * @param tokenAddress - Address of the token contract to check.\n * @returns Suspense query result with `data: boolean`.\n *\n * @example\n * ```tsx\n * const { data: isWrapper } = useIsWrapperSuspense(\"0xToken\");\n * ```\n */\nexport function useIsWrapperSuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<boolean>(isWrapperQueryOptions(sdk, tokenAddress));\n}\n","\"use client\";\n\nimport { useQuery, useSuspenseQuery } from \"../utils/query\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { totalSupplyQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\n\nexport { totalSupplyQueryOptions };\n\n/**\n * Read the total supply of a token.\n * Stale after 30 seconds to balance freshness and RPC cost.\n *\n * @param tokenAddress - Address of the token contract.\n * @param options - React Query options (forwarded to `useQuery`).\n * @returns Query result with `data: bigint`.\n * Uses ERC-165 to call `inferredTotalSupply()` on upgraded wrappers and\n * legacy `totalSupply()` on pre-upgrade wrappers.\n *\n * @example\n * ```tsx\n * const { data: totalSupply } = useTotalSupply(\"0xToken\");\n * ```\n */\nexport function useTotalSupply(\n tokenAddress: Address,\n options?: Omit<UseQueryOptions<bigint>, \"queryKey\" | \"queryFn\">,\n) {\n const sdk = useZamaSDK();\n\n return useQuery<bigint>({\n ...totalSupplyQueryOptions(sdk, tokenAddress),\n ...options,\n });\n}\n\n/**\n * Suspense variant of {@link useTotalSupply}.\n * Suspends rendering until the total supply is loaded.\n *\n * @param tokenAddress - Address of the token contract.\n * @returns Suspense query result with `data: bigint`.\n * Uses ERC-165 to call `inferredTotalSupply()` on upgraded wrappers and\n * legacy `totalSupply()` on pre-upgrade wrappers.\n *\n * @example\n * ```tsx\n * const { data: totalSupply } = useTotalSupplySuspense(\"0xToken\");\n * ```\n */\nexport function useTotalSupplySuspense(tokenAddress: Address) {\n const sdk = useZamaSDK();\n\n return useSuspenseQuery<bigint>(totalSupplyQueryOptions(sdk, tokenAddress));\n}\n","\"use client\";\n\nimport type { TokenWrapperPair } from \"@zama-fhe/sdk\";\nimport { tokenPairsQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches all token wrapper pairs from the ConfidentialTokenWrappersRegistry\n * contract on the current chain.\n */\nexport function useTokenPairsRegistry() {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly TokenWrapperPair[]>(\n tokenPairsQueryOptions(sdk, {\n registryAddress,\n }),\n );\n}\n","\"use client\";\n\nimport { tokenPairsLengthQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Returns the total number of token wrapper pairs in the registry.\n */\nexport function useTokenPairsLength() {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<bigint>(\n tokenPairsLengthQueryOptions(sdk, {\n registryAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { TokenWrapperPair } from \"@zama-fhe/sdk\";\nimport { tokenPairsSliceQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches a range of token wrapper pairs from the registry (paginated).\n *\n * @param fromIndex - Start index (inclusive). Pass `undefined` to disable.\n * @param toIndex - End index (exclusive). Pass `undefined` to disable.\n */\nexport function useTokenPairsSlice({\n fromIndex,\n toIndex,\n}: {\n fromIndex: bigint | undefined;\n toIndex: bigint | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly TokenWrapperPair[]>(\n tokenPairsSliceQueryOptions(sdk, {\n registryAddress,\n fromIndex,\n toIndex,\n }),\n );\n}\n","\"use client\";\n\nimport type { TokenWrapperPair } from \"@zama-fhe/sdk\";\nimport { tokenPairQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches a single token wrapper pair by index from the registry.\n *\n * @param index - Zero-based pair index. Pass `undefined` to disable.\n */\nexport function useTokenPair({ index }: { index: bigint | undefined }) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<TokenWrapperPair>(\n tokenPairQueryOptions(sdk, {\n registryAddress,\n index,\n }),\n );\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { confidentialTokenAddressQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Looks up the confidential token address for a given plain token address.\n */\nexport function useConfidentialTokenAddress({\n tokenAddress,\n}: {\n tokenAddress: Address | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly [boolean, Address]>(\n confidentialTokenAddressQueryOptions(sdk, {\n registryAddress,\n tokenAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { tokenAddressQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Looks up the plain token address for a given confidential token address.\n */\nexport function useTokenAddress({\n confidentialTokenAddress,\n}: {\n confidentialTokenAddress: Address | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<readonly [boolean, Address]>(\n tokenAddressQueryOptions(sdk, {\n registryAddress,\n confidentialTokenAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type { Address } from \"@zama-fhe/sdk\";\nimport { isConfidentialTokenValidQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Checks whether a confidential token is registered and valid in the\n * on-chain wrappers registry.\n *\n * @param confidentialTokenAddress - The confidential token to check. Pass `undefined` to disable.\n */\nexport function useIsConfidentialTokenValid({\n confidentialTokenAddress,\n}: {\n confidentialTokenAddress: Address | undefined;\n}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n return useQuery<boolean>(\n isConfidentialTokenValidQueryOptions(sdk, {\n registryAddress,\n confidentialTokenAddress,\n }),\n );\n}\n","\"use client\";\n\nimport type {\n TokenWrapperPair,\n TokenWrapperPairWithMetadata,\n PaginatedResult,\n} from \"@zama-fhe/sdk\";\nimport { listPairsQueryOptions } from \"@zama-fhe/sdk/query\";\nimport { useZamaSDK } from \"../provider\";\nimport { useQuery } from \"../utils/query\";\nimport { useWrappersRegistryAddress } from \"./use-wrappers-registry-address\";\n\n/**\n * Fetches paginated token wrapper pairs from the registry.\n *\n * @param options - Query options: `page` (1-indexed, default `1`), `pageSize` (default `100`), `metadata` (fetch on-chain metadata for both tokens, default `false`).\n *\n * @example\n * ```tsx\n * const { data, isLoading } = useListPairs({ page: 1, pageSize: 20 });\n * if (data) {\n * console.log(`${data.total} pairs, showing page ${data.page}`);\n * }\n * ```\n */\nexport function useListPairs({\n page = 1,\n pageSize = 100,\n metadata = false,\n}: {\n page?: number;\n pageSize?: number;\n metadata?: boolean;\n} = {}) {\n const sdk = useZamaSDK();\n const registryAddress = useWrappersRegistryAddress();\n\n // Pass sdk.registry (a lazy singleton) so the class-level TTL cache is shared\n // across all queryFn executions — rather than constructing a new instance each time.\n return useQuery<PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>>(\n listPairsQueryOptions(sdk.registry, {\n registryAddress,\n page,\n pageSize,\n metadata,\n }),\n );\n}\n"],"mappings":"w+DAqBA,MAAM,EAAiB,GAA8B,KAAK,CAY1D,SAAgB,GAAa,CAAE,WAAU,UAA6B,CACpE,IAAM,EAAc,GAAgB,CAG9B,EAAa,GAAO,EAAO,QAAQ,CAEzC,MAAgB,CACd,EAAW,QAAU,EAAO,SAC5B,CAEF,IAAM,EAAM,MAAc,IAAI,EAAQ,CAAE,GAAG,EAAQ,QAAS,EAAW,QAAS,CAAC,CAAE,CAAC,EAAO,CAAC,CAkB5F,OAdA,MAEI,EAAI,uBAAuB,CAAE,cAAe,CACtC,GACF,EAAiC,EAAY,EAE/C,CACJ,CAAC,EAAK,EAAY,CACnB,CAID,UAAsB,EAAI,SAAS,CAAE,CAAC,EAAI,CAAC,CAEpC,GAAC,EAAe,SAAhB,CAA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,EACL,GAJU,GAIkB,CAAE,CAC5B,gBAJoB,GAIL,CACf,2BACD,CAAC,CACH,CCVH,SAAgB,GAA4B,CAC1C,4BAGC,CAID,OAAOC,EACL,EAJU,GAI8B,CAAE,CACxC,gBAJoB,GAIL,CACf,2BACD,CAAC,CACH,CCFH,SAAgB,GAAa,CAC3B,OAAO,EACP,WAAW,IACX,WAAW,IAKT,EAAE,CAAE,CACN,IAAM,EAAM,GAAY,CAClB,EAAkB,GAA4B,CAIpD,OAAOC,EACL,GAAsB,EAAI,SAAU,CAClC,kBACA,OACA,WACA,WACD,CAAC,CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zama-fhe/react-sdk",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.42",
|
|
4
4
|
"description": "React hooks for Zama SDK",
|
|
5
5
|
"license": "BSD-3-Clause-Clear",
|
|
6
6
|
"author": "Zama",
|
|
@@ -58,15 +58,13 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@zama-fhe/sdk": "workspace:*",
|
|
61
|
-
"rolldown": "1.0.0",
|
|
62
|
-
"rolldown-plugin-dts": "^0.25.0",
|
|
63
61
|
"viem": "^2.47.12"
|
|
64
62
|
},
|
|
65
63
|
"peerDependencies": {
|
|
66
64
|
"@tanstack/react-query": ">=5",
|
|
67
|
-
"@zama-fhe/sdk": "^3.0.0-alpha.
|
|
65
|
+
"@zama-fhe/sdk": "^3.0.0-alpha.42",
|
|
68
66
|
"react": ">=18",
|
|
69
|
-
"viem": "
|
|
67
|
+
"viem": ">=2",
|
|
70
68
|
"wagmi": ">=2"
|
|
71
69
|
},
|
|
72
70
|
"sideEffects": false,
|