@zama-fhe/react-sdk 3.0.0-alpha.3 → 3.0.0-alpha.31
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/README.md +89 -883
- package/dist/index.d.ts +184 -227
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/wagmi/index.d.ts +9 -27
- package/dist/wagmi/index.js +1 -1
- package/dist/wagmi/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as _$_zama_fhe_sdk0 from "@zama-fhe/sdk";
|
|
4
|
-
import {
|
|
5
|
-
import { ApproveUnderlyingParams,
|
|
4
|
+
import { Address, BatchBalancesResult, ClearValueType, EIP712TypedData, EncryptParams, PaginatedResult, PublicKeyData, ReadonlyToken, Token, TokenWrapperPair, TokenWrapperPairWithMetadata, TransactionResult, ZKProofLike, ZamaConfig, ZamaSDK } from "@zama-fhe/sdk";
|
|
5
|
+
import { ApproveUnderlyingParams, BatchDecryptBalancesAsParams, ConfidentialSetOperatorParams, ConfidentialTransferFromParams, ConfidentialTransferParams, CreateDelegatedUserDecryptEIP712Params, CreateEIP712Params, DecryptBalanceAsParams, DecryptResult, DelegateDecryptionParams, DelegatedUserDecryptMutationParams, DelegationStatusData, FinalizeUnwrapParams, ResumeUnshieldParams, RevokeDelegationParams, ShieldParams, TokenMetadata, UnshieldAllParams, UnshieldParams, UnwrapParams, UserDecryptQueryConfig } from "@zama-fhe/sdk/query";
|
|
6
6
|
import * as _$_tanstack_react_query0 from "@tanstack/react-query";
|
|
7
|
-
import {
|
|
7
|
+
import { UseMutationOptions, UseMutationResult, UseQueryOptions } from "@tanstack/react-query";
|
|
8
8
|
import { PropsWithChildren } from "react";
|
|
9
9
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
10
10
|
import * as _$_zama_fhe_relayer_sdk_web0 from "@zama-fhe/relayer-sdk/web";
|
|
@@ -12,75 +12,34 @@ import * as _$_zama_fhe_relayer_sdk_web0 from "@zama-fhe/relayer-sdk/web";
|
|
|
12
12
|
//#region src/provider.d.ts
|
|
13
13
|
/** Props for {@link ZamaProvider}. */
|
|
14
14
|
interface ZamaProviderProps extends PropsWithChildren {
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/** Wallet signer (`ViemSigner`, `EthersSigner`, or custom {@link GenericSigner}). */
|
|
18
|
-
signer: GenericSigner$1;
|
|
19
|
-
/** Credential storage backend (IndexedDBStorage for browser, MemoryStorage for tests). */
|
|
20
|
-
storage: GenericStorage$1;
|
|
21
|
-
/**
|
|
22
|
-
* Session storage for wallet signatures. Defaults to in-memory (lost on reload).
|
|
23
|
-
* Pass a `chrome.storage.session`-backed store for web extensions.
|
|
24
|
-
*/
|
|
25
|
-
sessionStorage?: GenericStorage$1;
|
|
26
|
-
/**
|
|
27
|
-
* How long the ML-KEM re-encryption keypair remains valid, in seconds.
|
|
28
|
-
* Default: `86400` (1 day). Must be positive — `0` is rejected.
|
|
29
|
-
*/
|
|
30
|
-
keypairTTL?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Controls how long session signatures (EIP-712 wallet signatures) remain valid, in seconds.
|
|
33
|
-
* Default: `2592000` (30 days).
|
|
34
|
-
* - `0`: never persist — every operation triggers a signing prompt (high-security mode).
|
|
35
|
-
* - Positive number: seconds until the session signature expires and requires re-authentication.
|
|
36
|
-
*/
|
|
37
|
-
sessionTTL?: number;
|
|
38
|
-
/**
|
|
39
|
-
* Per-chain wrappers registry address overrides, merged on top of built-in defaults.
|
|
40
|
-
* Use this for custom or local chains (e.g. Hardhat) where no default registry exists.
|
|
41
|
-
*/
|
|
42
|
-
registryAddresses?: Record<number, Address$1>;
|
|
43
|
-
/**
|
|
44
|
-
* How long cached registry results remain valid, in seconds.
|
|
45
|
-
* Default: `86400` (24 hours).
|
|
46
|
-
*/
|
|
47
|
-
registryTTL?: number;
|
|
48
|
-
/** Callback invoked on SDK lifecycle events. */
|
|
49
|
-
onEvent?: ZamaSDKEventListener$1;
|
|
15
|
+
/** Configuration object created by {@link createConfig}. */
|
|
16
|
+
config: ZamaConfig;
|
|
50
17
|
}
|
|
51
18
|
/**
|
|
52
19
|
* Provides a {@link ZamaSDK} instance to all descendant hooks.
|
|
53
20
|
*
|
|
54
21
|
* @example
|
|
55
22
|
* ```tsx
|
|
56
|
-
* <ZamaProvider
|
|
23
|
+
* <ZamaProvider config={zamaConfig}>
|
|
57
24
|
* <App />
|
|
58
25
|
* </ZamaProvider>
|
|
59
26
|
* ```
|
|
60
27
|
*/
|
|
61
28
|
declare function ZamaProvider({
|
|
62
29
|
children,
|
|
63
|
-
|
|
64
|
-
signer,
|
|
65
|
-
storage,
|
|
66
|
-
sessionStorage,
|
|
67
|
-
keypairTTL,
|
|
68
|
-
sessionTTL,
|
|
69
|
-
registryAddresses,
|
|
70
|
-
registryTTL,
|
|
71
|
-
onEvent
|
|
30
|
+
config
|
|
72
31
|
}: ZamaProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
73
32
|
/**
|
|
74
33
|
* Access the {@link ZamaSDK} instance from context.
|
|
75
|
-
* Throws if called outside a {@link ZamaProvider}
|
|
34
|
+
* Throws if called outside a {@link ZamaProvider}.
|
|
76
35
|
*
|
|
77
36
|
* @example
|
|
78
37
|
* ```tsx
|
|
79
38
|
* const sdk = useZamaSDK();
|
|
80
|
-
* const token = sdk.
|
|
39
|
+
* const token = sdk.createToken("0x...", "0x...");
|
|
81
40
|
* ```
|
|
82
41
|
*/
|
|
83
|
-
declare function useZamaSDK(): ZamaSDK
|
|
42
|
+
declare function useZamaSDK(): ZamaSDK;
|
|
84
43
|
//#endregion
|
|
85
44
|
//#region src/relayer/use-encrypt.d.ts
|
|
86
45
|
/**
|
|
@@ -98,14 +57,17 @@ declare function useZamaSDK(): ZamaSDK$1;
|
|
|
98
57
|
* encrypt.mutate({ values: [{ value: 1000n, type: "euint64" }], contractAddress: "0x...", userAddress: "0x..." });
|
|
99
58
|
* ```
|
|
100
59
|
*/
|
|
101
|
-
declare function useEncrypt(): _$_tanstack_react_query0.UseMutationResult<
|
|
60
|
+
declare function useEncrypt(): _$_tanstack_react_query0.UseMutationResult<Readonly<{
|
|
61
|
+
handles: Uint8Array[];
|
|
62
|
+
inputProof: Uint8Array;
|
|
63
|
+
}>, Error, EncryptParams, unknown>;
|
|
102
64
|
//#endregion
|
|
103
65
|
//#region src/relayer/use-user-decrypt.d.ts
|
|
104
66
|
/**
|
|
105
67
|
* React hook for FHE user decryption. Thin wrapper around
|
|
106
68
|
* `userDecryptQueryOptions` with `useQuery` semantics.
|
|
107
69
|
*/
|
|
108
|
-
declare function useUserDecrypt(config: UserDecryptQueryConfig
|
|
70
|
+
declare function useUserDecrypt(config: UserDecryptQueryConfig, options?: Omit<UseQueryOptions<DecryptResult>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<Readonly<Record<`0x${string}`, _$_zama_fhe_sdk0.ClearValueType>>, Error>;
|
|
109
71
|
/** Return type of {@link useUserDecrypt}. */
|
|
110
72
|
type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;
|
|
111
73
|
//#endregion
|
|
@@ -124,7 +86,11 @@ type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;
|
|
|
124
86
|
* // publicDecrypt.data?.clearValues => { "0xHandle1": 500n, ... }
|
|
125
87
|
* ```
|
|
126
88
|
*/
|
|
127
|
-
declare function usePublicDecrypt(): _$_tanstack_react_query0.UseMutationResult<
|
|
89
|
+
declare function usePublicDecrypt(): _$_tanstack_react_query0.UseMutationResult<Readonly<{
|
|
90
|
+
clearValues: _$_zama_fhe_relayer_sdk_web0.ClearValues;
|
|
91
|
+
abiEncodedClearValues: `0x${string}`;
|
|
92
|
+
decryptionProof: `0x${string}`;
|
|
93
|
+
}>, Error, `0x${string}`[], unknown>;
|
|
128
94
|
//#endregion
|
|
129
95
|
//#region src/relayer/use-generate-keypair.d.ts
|
|
130
96
|
/**
|
|
@@ -162,7 +128,7 @@ declare function useGenerateKeypair(): _$_tanstack_react_query0.UseMutationResul
|
|
|
162
128
|
* });
|
|
163
129
|
* ```
|
|
164
130
|
*/
|
|
165
|
-
declare function useCreateEIP712(): _$_tanstack_react_query0.UseMutationResult<EIP712TypedData
|
|
131
|
+
declare function useCreateEIP712(): _$_tanstack_react_query0.UseMutationResult<EIP712TypedData, Error, CreateEIP712Params, unknown>;
|
|
166
132
|
//#endregion
|
|
167
133
|
//#region src/relayer/use-create-delegated-user-decrypt-eip712.d.ts
|
|
168
134
|
/**
|
|
@@ -194,16 +160,16 @@ declare function useCreateDelegatedUserDecryptEIP712(): _$_tanstack_react_query0
|
|
|
194
160
|
* Decrypt FHE ciphertext handles using delegated user credentials.
|
|
195
161
|
* Returns a map of handle → plaintext bigint.
|
|
196
162
|
*
|
|
197
|
-
* @returns A mutation whose `mutate` accepts {@link
|
|
163
|
+
* @returns A mutation whose `mutate` accepts {@link DelegatedUserDecryptMutationParams}.
|
|
198
164
|
*
|
|
199
165
|
* @example
|
|
200
166
|
* ```tsx
|
|
201
167
|
* const decrypt = useDelegatedUserDecrypt();
|
|
202
|
-
* decrypt.mutate({ handles: ["0xHandle1"], ...
|
|
168
|
+
* decrypt.mutate({ handles: [{ handle: "0xHandle1", contractAddress: "0x..." }], delegatorAddress: "0x..." });
|
|
203
169
|
* // decrypt.data => { "0xHandle1": 1000n }
|
|
204
170
|
* ```
|
|
205
171
|
*/
|
|
206
|
-
declare function useDelegatedUserDecrypt(): _$_tanstack_react_query0.UseMutationResult<Record<`0x${string}`, ClearValueType
|
|
172
|
+
declare function useDelegatedUserDecrypt(): _$_tanstack_react_query0.UseMutationResult<Record<`0x${string}`, ClearValueType>, Error, DelegatedUserDecryptMutationParams, unknown>;
|
|
207
173
|
//#endregion
|
|
208
174
|
//#region src/relayer/use-request-zk-proof-verification.d.ts
|
|
209
175
|
/**
|
|
@@ -222,16 +188,9 @@ declare function useDelegatedUserDecrypt(): _$_tanstack_react_query0.UseMutation
|
|
|
222
188
|
declare function useRequestZKProofVerification(): _$_tanstack_react_query0.UseMutationResult<Readonly<{
|
|
223
189
|
handles: Uint8Array[];
|
|
224
190
|
inputProof: Uint8Array;
|
|
225
|
-
}>, Error, ZKProofLike
|
|
191
|
+
}>, Error, ZKProofLike, unknown>;
|
|
226
192
|
//#endregion
|
|
227
193
|
//#region src/relayer/use-public-key.d.ts
|
|
228
|
-
/** Shape of the FHE public key data returned by the relayer. */
|
|
229
|
-
interface PublicKeyData {
|
|
230
|
-
/** Unique identifier for this public key version. */
|
|
231
|
-
publicKeyId: string;
|
|
232
|
-
/** The raw FHE public key bytes. */
|
|
233
|
-
publicKey: Uint8Array;
|
|
234
|
-
}
|
|
235
194
|
/**
|
|
236
195
|
* Fetch the FHE network public key from the relayer.
|
|
237
196
|
* Cached indefinitely since the key does not change during a session.
|
|
@@ -247,13 +206,6 @@ interface PublicKeyData {
|
|
|
247
206
|
declare function usePublicKey(): _$_tanstack_react_query0.UseQueryResult<PublicKeyData | null, Error>;
|
|
248
207
|
//#endregion
|
|
249
208
|
//#region src/relayer/use-public-params.d.ts
|
|
250
|
-
/** Shape of the FHE public parameters returned by the relayer. */
|
|
251
|
-
interface PublicParamsData {
|
|
252
|
-
/** The raw public parameters bytes (WASM-ready). */
|
|
253
|
-
publicParams: Uint8Array;
|
|
254
|
-
/** Unique identifier for this public params version. */
|
|
255
|
-
publicParamsId: string;
|
|
256
|
-
}
|
|
257
209
|
/**
|
|
258
210
|
* Fetch FHE public parameters for a given bit size from the relayer.
|
|
259
211
|
* Cached indefinitely since parameters do not change during a session.
|
|
@@ -267,7 +219,10 @@ interface PublicParamsData {
|
|
|
267
219
|
* // params?.publicParams, params?.publicParamsId
|
|
268
220
|
* ```
|
|
269
221
|
*/
|
|
270
|
-
declare function usePublicParams(bits: number): _$_tanstack_react_query0.UseQueryResult<
|
|
222
|
+
declare function usePublicParams(bits: number): _$_tanstack_react_query0.UseQueryResult<{
|
|
223
|
+
publicParams: Uint8Array<ArrayBufferLike>;
|
|
224
|
+
publicParamsId: string;
|
|
225
|
+
} | null, Error>;
|
|
271
226
|
//#endregion
|
|
272
227
|
//#region src/authorization/use-allow.d.ts
|
|
273
228
|
/**
|
|
@@ -290,18 +245,24 @@ declare function usePublicParams(bits: number): _$_tanstack_react_query0.UseQuer
|
|
|
290
245
|
* await allow([tokenAddress, auctionAddress, governanceAddress]);
|
|
291
246
|
* ```
|
|
292
247
|
*/
|
|
293
|
-
declare function useAllow(options?: UseMutationOptions<void, Error, Address
|
|
248
|
+
declare function useAllow(options?: UseMutationOptions<void, Error, Address[]>): _$_tanstack_react_query0.UseMutationResult<void, Error, `0x${string}`[], unknown>;
|
|
294
249
|
//#endregion
|
|
295
250
|
//#region src/authorization/use-is-allowed.d.ts
|
|
296
251
|
/** Configuration for {@link useIsAllowed}. */
|
|
297
252
|
interface UseIsAllowedConfig {
|
|
298
253
|
/** Contract addresses to check credentials against (at least one required). */
|
|
299
|
-
contractAddresses: [Address
|
|
254
|
+
contractAddresses: [Address, ...Address[]];
|
|
300
255
|
}
|
|
301
256
|
/**
|
|
302
|
-
* Check whether
|
|
303
|
-
*
|
|
304
|
-
*
|
|
257
|
+
* Check whether stored permits cover the given contract addresses for the
|
|
258
|
+
* connected signer. Returns `true` if decrypt operations can proceed without
|
|
259
|
+
* a wallet prompt.
|
|
260
|
+
*
|
|
261
|
+
* @returns Query result with `data: boolean` — `true` if a stored permit covers
|
|
262
|
+
* every entry in `contractAddresses`. The query auto-disables when no signer is configured
|
|
263
|
+
* (`data` stays `undefined`, `status` stays `"pending"`).
|
|
264
|
+
* @throws {@link SignerNotConfiguredError} if the query runs without a signer configured
|
|
265
|
+
* (the `enabled` guard normally prevents this; only reachable if the caller forces `query: { enabled: true }`).
|
|
305
266
|
*
|
|
306
267
|
* @example
|
|
307
268
|
* ```tsx
|
|
@@ -310,47 +271,50 @@ interface UseIsAllowedConfig {
|
|
|
310
271
|
*/
|
|
311
272
|
declare function useIsAllowed(config: UseIsAllowedConfig): _$_tanstack_react_query0.UseQueryResult<boolean, Error>;
|
|
312
273
|
//#endregion
|
|
313
|
-
//#region src/authorization/use-revoke.d.ts
|
|
274
|
+
//#region src/authorization/use-revoke-permits.d.ts
|
|
314
275
|
/**
|
|
315
|
-
* Revoke
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
276
|
+
* Revoke FHE permits for the current signer.
|
|
277
|
+
*
|
|
278
|
+
* - Called with no arguments: every permit is removed across all chains and
|
|
279
|
+
* delegators. The keypair survives — use {@link useClearCredentials} to also
|
|
280
|
+
* wipe the keypair.
|
|
281
|
+
* - Called with a contract list: only direct-decrypt permits on the current
|
|
282
|
+
* chain whose payload touches a listed address are removed. Delegated
|
|
283
|
+
* permits are not touched in this mode.
|
|
319
284
|
*
|
|
320
285
|
* @example
|
|
321
286
|
* ```tsx
|
|
322
|
-
* const { mutate:
|
|
323
|
-
*
|
|
324
|
-
* //
|
|
325
|
-
* revoke([tokenAddress, auctionAddress]);
|
|
287
|
+
* const { mutate: revokePermits } = useRevokePermits();
|
|
288
|
+
* revokePermits([tokenAddress]); // direct-decrypt scope, current chain
|
|
289
|
+
* revokePermits(); // every permit, all chains, all delegators
|
|
326
290
|
* ```
|
|
327
291
|
*/
|
|
328
|
-
declare function
|
|
292
|
+
declare function useRevokePermits(options?: UseMutationOptions<void, Error, Address[] | void>): _$_tanstack_react_query0.UseMutationResult<void, Error, void | `0x${string}`[], unknown>;
|
|
329
293
|
//#endregion
|
|
330
|
-
//#region src/authorization/use-
|
|
294
|
+
//#region src/authorization/use-clear-credentials.d.ts
|
|
331
295
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
296
|
+
* Wipe the keypair for the current signer and cascade-delete every permit
|
|
297
|
+
* (across chains and delegators) referencing it. Useful for "log out"
|
|
298
|
+
* handlers that should leave no trace.
|
|
334
299
|
*
|
|
335
300
|
* @example
|
|
336
301
|
* ```tsx
|
|
337
|
-
* const { mutate:
|
|
338
|
-
*
|
|
302
|
+
* const { mutate: clearCredentials } = useClearCredentials();
|
|
303
|
+
* clearCredentials();
|
|
339
304
|
* ```
|
|
340
305
|
*/
|
|
341
|
-
declare function
|
|
306
|
+
declare function useClearCredentials(options?: UseMutationOptions<void>): _$_tanstack_react_query0.UseMutationResult<void, Error, void, unknown>;
|
|
342
307
|
//#endregion
|
|
343
308
|
//#region src/token/use-token.d.ts
|
|
344
309
|
/** Base configuration shared by all mutation hooks that need a Token instance. */
|
|
345
310
|
interface UseZamaConfig {
|
|
346
311
|
/** Address of the confidential token contract. */
|
|
347
|
-
tokenAddress: Address
|
|
312
|
+
tokenAddress: Address;
|
|
348
313
|
/** Address of the wrapper contract (required for shield/unshield operations). */
|
|
349
|
-
wrapperAddress?: Address
|
|
314
|
+
wrapperAddress?: Address;
|
|
350
315
|
}
|
|
351
316
|
/**
|
|
352
317
|
* Get a {@link Token} instance, memoized by address pair.
|
|
353
|
-
* Reads signer and storage from the nearest {@link ZamaProvider}.
|
|
354
318
|
*
|
|
355
319
|
* @param config - Token and optional wrapper addresses.
|
|
356
320
|
* @returns A memoized `Token` instance.
|
|
@@ -360,7 +324,7 @@ interface UseZamaConfig {
|
|
|
360
324
|
* const token = useToken({ tokenAddress: "0xToken", wrapperAddress: "0xWrapper" });
|
|
361
325
|
* ```
|
|
362
326
|
*/
|
|
363
|
-
declare function useToken(config: UseZamaConfig):
|
|
327
|
+
declare function useToken(config: UseZamaConfig): Token;
|
|
364
328
|
//#endregion
|
|
365
329
|
//#region src/token/use-readonly-token.d.ts
|
|
366
330
|
/**
|
|
@@ -377,58 +341,49 @@ declare function useToken(config: UseZamaConfig): _$_zama_fhe_sdk0.Token;
|
|
|
377
341
|
* // token.balanceOf(), token.isConfidential(), etc.
|
|
378
342
|
* ```
|
|
379
343
|
*/
|
|
380
|
-
declare function useReadonlyToken(address: Address
|
|
344
|
+
declare function useReadonlyToken(address: Address): _$_zama_fhe_sdk0.ReadonlyToken;
|
|
381
345
|
//#endregion
|
|
382
346
|
//#region src/balance/use-confidential-balance.d.ts
|
|
383
|
-
/** Configuration for {@link useConfidentialBalance}. */
|
|
384
347
|
interface UseConfidentialBalanceConfig {
|
|
385
348
|
/** Address of the confidential token contract. */
|
|
386
|
-
tokenAddress: Address
|
|
349
|
+
tokenAddress: Address;
|
|
350
|
+
/** Account to fetch balance for. The query is disabled while `undefined`. */
|
|
351
|
+
account: Address | undefined;
|
|
387
352
|
}
|
|
388
|
-
/** Query options for {@link useConfidentialBalance}. */
|
|
389
353
|
interface UseConfidentialBalanceOptions extends Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn" | "enabled"> {
|
|
390
|
-
/**
|
|
354
|
+
/** Set this to `false` to disable this query from automatically running. */
|
|
391
355
|
enabled?: boolean;
|
|
392
356
|
}
|
|
393
357
|
/**
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* when the handle changes.
|
|
398
|
-
*
|
|
399
|
-
* @param config - Token address configuration.
|
|
400
|
-
* @param options - React Query options forwarded to the balance query.
|
|
401
|
-
* @returns The balance query result.
|
|
358
|
+
* Hook for fetching a confidential token balance. Reads the on-chain handle and
|
|
359
|
+
* decrypts via the SDK; cached values are returned instantly and the relayer is
|
|
360
|
+
* only hit when the handle changes.
|
|
402
361
|
*
|
|
403
362
|
* @example
|
|
404
363
|
* ```tsx
|
|
405
|
-
* const { data: balance
|
|
406
|
-
* tokenAddress: "
|
|
364
|
+
* const { data: balance } = useConfidentialBalance({
|
|
365
|
+
* tokenAddress: "0xToken",
|
|
366
|
+
* account: "0xAccount",
|
|
407
367
|
* });
|
|
408
368
|
* ```
|
|
409
369
|
*/
|
|
410
370
|
declare function useConfidentialBalance(config: UseConfidentialBalanceConfig, options?: UseConfidentialBalanceOptions): _$_tanstack_react_query0.UseQueryResult<bigint, Error>;
|
|
411
371
|
//#endregion
|
|
412
372
|
//#region src/balance/use-confidential-balances.d.ts
|
|
413
|
-
/** Configuration for {@link useConfidentialBalances}. */
|
|
414
373
|
interface UseConfidentialBalancesConfig {
|
|
415
|
-
/** Addresses of the confidential token contracts to batch-query. */
|
|
416
|
-
tokenAddresses: Address
|
|
374
|
+
/** Addresses of the confidential token contracts to batch-query. The query is disabled while empty. */
|
|
375
|
+
tokenAddresses: Address[];
|
|
376
|
+
/** Account to fetch balances for. The query is disabled while `undefined`. */
|
|
377
|
+
account: Address | undefined;
|
|
417
378
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
/** Whether the query is enabled. Callback form is not supported in composite hooks. */
|
|
379
|
+
interface UseConfidentialBalancesOptions extends Omit<UseQueryOptions<BatchBalancesResult>, "queryKey" | "queryFn" | "enabled"> {
|
|
380
|
+
/** Set this to `false` to disable this query from automatically running. */
|
|
421
381
|
enabled?: boolean;
|
|
422
382
|
}
|
|
423
383
|
/**
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* changed handles.
|
|
428
|
-
*
|
|
429
|
-
* Returns partial results when some tokens fail — successful balances are
|
|
430
|
-
* always returned alongside per-token error information.
|
|
431
|
-
*
|
|
384
|
+
* Hook for fetching multiple confidential token balances in batch. Returns
|
|
385
|
+
* partial results when some tokens fail — successful balances are available
|
|
386
|
+
* alongside per-token error information.
|
|
432
387
|
* @param config - Token addresses configuration.
|
|
433
388
|
* @param options - React Query options forwarded to the balance query.
|
|
434
389
|
* @returns The balance query result.
|
|
@@ -437,6 +392,7 @@ interface UseConfidentialBalancesOptions extends Omit<UseQueryOptions<BatchBalan
|
|
|
437
392
|
* ```tsx
|
|
438
393
|
* const { data } = useConfidentialBalances({
|
|
439
394
|
* tokenAddresses: ["0xTokenA", "0xTokenB"],
|
|
395
|
+
* account: "0xAccount",
|
|
440
396
|
* });
|
|
441
397
|
* const balance = data?.results.get("0xTokenA");
|
|
442
398
|
* if (data && data.errors.size > 0) {
|
|
@@ -444,7 +400,7 @@ interface UseConfidentialBalancesOptions extends Omit<UseQueryOptions<BatchBalan
|
|
|
444
400
|
* }
|
|
445
401
|
* ```
|
|
446
402
|
*/
|
|
447
|
-
declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions): _$_tanstack_react_query0.UseQueryResult<BatchBalancesResult
|
|
403
|
+
declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions): _$_tanstack_react_query0.UseQueryResult<BatchBalancesResult, Error>;
|
|
448
404
|
//#endregion
|
|
449
405
|
//#region src/transfer/use-confidential-transfer.d.ts
|
|
450
406
|
/** Configuration for {@link useConfidentialTransfer}. */
|
|
@@ -486,7 +442,7 @@ interface UseConfidentialTransferConfig extends UseZamaConfig {
|
|
|
486
442
|
* );
|
|
487
443
|
* ```
|
|
488
444
|
*/
|
|
489
|
-
declare function useConfidentialTransfer<TContext = unknown>(config: UseConfidentialTransferConfig, options?: UseMutationOptions<TransactionResult
|
|
445
|
+
declare function useConfidentialTransfer<TContext = unknown>(config: UseConfidentialTransferConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferParams, TContext>): UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, TContext>;
|
|
490
446
|
//#endregion
|
|
491
447
|
//#region src/transfer/use-confidential-transfer-from.d.ts
|
|
492
448
|
/**
|
|
@@ -507,9 +463,9 @@ declare function useConfidentialTransfer<TContext = unknown>(config: UseConfiden
|
|
|
507
463
|
* transferFrom.mutate({ from: "0xOwner", to: "0xRecipient", amount: 500n });
|
|
508
464
|
* ```
|
|
509
465
|
*/
|
|
510
|
-
declare function useConfidentialTransferFrom(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
466
|
+
declare function useConfidentialTransferFrom(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferFromParams, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, ConfidentialTransferFromParams, `0x${string}`>;
|
|
511
467
|
//#endregion
|
|
512
|
-
//#region src/
|
|
468
|
+
//#region src/operator/use-confidential-set-operator.d.ts
|
|
513
469
|
/**
|
|
514
470
|
* Set operator approval for a confidential token. Defaults to 1 hour.
|
|
515
471
|
*
|
|
@@ -522,63 +478,59 @@ declare function useConfidentialTransferFrom(config: UseZamaConfig, options?: Us
|
|
|
522
478
|
*
|
|
523
479
|
* @example
|
|
524
480
|
* ```tsx
|
|
525
|
-
* const
|
|
526
|
-
*
|
|
481
|
+
* const setOperator = useConfidentialSetOperator({ tokenAddress: "0x..." });
|
|
482
|
+
* setOperator.mutate({ operator: "0xOperator" });
|
|
527
483
|
* ```
|
|
528
484
|
*/
|
|
529
|
-
declare function
|
|
485
|
+
declare function useConfidentialSetOperator(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialSetOperatorParams, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, ConfidentialSetOperatorParams, `0x${string}`>;
|
|
530
486
|
//#endregion
|
|
531
|
-
//#region src/
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
holder?: Address$1;
|
|
487
|
+
//#region src/operator/use-confidential-is-operator.d.ts
|
|
488
|
+
interface UseConfidentialIsOperatorConfig {
|
|
489
|
+
/** Address of the confidential token contract. The query is disabled while `undefined`. */
|
|
490
|
+
tokenAddress: Address | undefined;
|
|
491
|
+
/** Address to check operator status for. The query is disabled while `undefined`. */
|
|
492
|
+
spender: Address | undefined;
|
|
493
|
+
/** Token holder address. The query is disabled while `undefined`. */
|
|
494
|
+
holder: Address | undefined;
|
|
540
495
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
holder
|
|
496
|
+
interface UseConfidentialIsOperatorSuspenseConfig {
|
|
497
|
+
/** Address of the confidential token contract. */
|
|
498
|
+
tokenAddress: Address;
|
|
499
|
+
/** Address to check operator status for. */
|
|
500
|
+
spender: Address;
|
|
501
|
+
/** Token holder address. */
|
|
502
|
+
holder: Address;
|
|
547
503
|
}
|
|
548
504
|
/**
|
|
549
|
-
* Check if a spender is an approved operator for a
|
|
550
|
-
*
|
|
505
|
+
* Check if a spender is an approved operator for a holder.
|
|
551
506
|
* @param config - Token address, spender, and optional holder to check.
|
|
552
507
|
* @param options - React Query options (forwarded to `useQuery`).
|
|
553
508
|
* @returns Query result with `data: boolean`.
|
|
554
509
|
*
|
|
555
510
|
* @example
|
|
556
511
|
* ```tsx
|
|
557
|
-
* const { data:
|
|
512
|
+
* const { data: isOperator } = useConfidentialIsOperator({
|
|
558
513
|
* tokenAddress: "0xToken",
|
|
559
514
|
* spender: "0xSpender",
|
|
560
|
-
* holder: "0xHolder",
|
|
515
|
+
* holder: "0xHolder",
|
|
561
516
|
* });
|
|
562
517
|
* ```
|
|
563
518
|
*/
|
|
564
|
-
declare function
|
|
519
|
+
declare function useConfidentialIsOperator(config: UseConfidentialIsOperatorConfig, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<boolean, Error>;
|
|
565
520
|
/**
|
|
566
|
-
* Suspense variant of {@link
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
* @param config - Token address, spender, and optional holder to check.
|
|
570
|
-
* @returns Suspense query result with `data: boolean`.
|
|
521
|
+
* Suspense variant of {@link useConfidentialIsOperator}. Suspends rendering
|
|
522
|
+
* until the operator check resolves.
|
|
571
523
|
*
|
|
572
524
|
* @example
|
|
573
525
|
* ```tsx
|
|
574
|
-
* const { data:
|
|
526
|
+
* const { data: isOperator } = useConfidentialIsOperatorSuspense({
|
|
575
527
|
* tokenAddress: "0xToken",
|
|
576
528
|
* spender: "0xSpender",
|
|
577
|
-
* holder: "0xHolder",
|
|
529
|
+
* holder: "0xHolder",
|
|
578
530
|
* });
|
|
579
531
|
* ```
|
|
580
532
|
*/
|
|
581
|
-
declare function
|
|
533
|
+
declare function useConfidentialIsOperatorSuspense(config: UseConfidentialIsOperatorSuspenseConfig): _$_tanstack_react_query0.UseSuspenseQueryResult<boolean, Error>;
|
|
582
534
|
//#endregion
|
|
583
535
|
//#region src/shield/use-shield.d.ts
|
|
584
536
|
/** Configuration for {@link useShield}. */
|
|
@@ -609,7 +561,7 @@ interface UseShieldConfig extends UseZamaConfig {
|
|
|
609
561
|
* shield.mutate({ amount: 1000n });
|
|
610
562
|
* ```
|
|
611
563
|
*/
|
|
612
|
-
declare function useShield<TContext = unknown>(config: UseShieldConfig, options?: UseMutationOptions<TransactionResult
|
|
564
|
+
declare function useShield<TContext = unknown>(config: UseShieldConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldParams, TContext>): UseMutationResult<TransactionResult, Error, ShieldParams, TContext>;
|
|
613
565
|
//#endregion
|
|
614
566
|
//#region src/unwrap/use-unwrap.d.ts
|
|
615
567
|
/**
|
|
@@ -631,7 +583,7 @@ declare function useShield<TContext = unknown>(config: UseShieldConfig, options?
|
|
|
631
583
|
* unwrap.mutate({ amount: 500n });
|
|
632
584
|
* ```
|
|
633
585
|
*/
|
|
634
|
-
declare function useUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
586
|
+
declare function useUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, UnwrapParams, `0x${string}`>;
|
|
635
587
|
//#endregion
|
|
636
588
|
//#region src/unwrap/use-unwrap-all.d.ts
|
|
637
589
|
/**
|
|
@@ -652,7 +604,7 @@ declare function useUnwrap(config: UseZamaConfig, options?: UseMutationOptions<T
|
|
|
652
604
|
* unwrapAll.mutate();
|
|
653
605
|
* ```
|
|
654
606
|
*/
|
|
655
|
-
declare function useUnwrapAll(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
607
|
+
declare function useUnwrapAll(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, void, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, void, `0x${string}`>;
|
|
656
608
|
//#endregion
|
|
657
609
|
//#region src/unwrap/use-finalize-unwrap.d.ts
|
|
658
610
|
/**
|
|
@@ -670,10 +622,16 @@ declare function useUnwrapAll(config: UseZamaConfig, options?: UseMutationOption
|
|
|
670
622
|
* @example
|
|
671
623
|
* ```tsx
|
|
672
624
|
* const finalize = useFinalizeUnwrap({ tokenAddress: "0x..." });
|
|
673
|
-
*
|
|
625
|
+
* const event = findUnwrapRequested(receipt.logs);
|
|
626
|
+
* // Pass unwrapRequestId from upgraded events, or fall back to encryptedAmount for legacy ones.
|
|
627
|
+
* finalize.mutate(
|
|
628
|
+
* event.unwrapRequestId
|
|
629
|
+
* ? { unwrapRequestId: event.unwrapRequestId }
|
|
630
|
+
* : { burnAmountHandle: event.encryptedAmount },
|
|
631
|
+
* );
|
|
674
632
|
* ```
|
|
675
633
|
*/
|
|
676
|
-
declare function useFinalizeUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
634
|
+
declare function useFinalizeUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, FinalizeUnwrapParams, `0x${string}`>;
|
|
677
635
|
//#endregion
|
|
678
636
|
//#region src/unshield/use-unshield.d.ts
|
|
679
637
|
/**
|
|
@@ -695,7 +653,7 @@ declare function useFinalizeUnwrap(config: UseZamaConfig, options?: UseMutationO
|
|
|
695
653
|
* unshield.mutate({ amount: 500n });
|
|
696
654
|
* ```
|
|
697
655
|
*/
|
|
698
|
-
declare function useUnshield(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
656
|
+
declare function useUnshield(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnshieldParams, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, UnshieldParams, `0x${string}`>;
|
|
699
657
|
//#endregion
|
|
700
658
|
//#region src/unshield/use-unshield-all.d.ts
|
|
701
659
|
/**
|
|
@@ -716,7 +674,7 @@ declare function useUnshield(config: UseZamaConfig, options?: UseMutationOptions
|
|
|
716
674
|
* unshieldAll.mutate();
|
|
717
675
|
* ```
|
|
718
676
|
*/
|
|
719
|
-
declare function useUnshieldAll(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
677
|
+
declare function useUnshieldAll(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnshieldAllParams | void, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, void | UnshieldAllParams, `0x${string}`>;
|
|
720
678
|
//#endregion
|
|
721
679
|
//#region src/unshield/use-resume-unshield.d.ts
|
|
722
680
|
/**
|
|
@@ -737,49 +695,53 @@ declare function useUnshieldAll(config: UseZamaConfig, options?: UseMutationOpti
|
|
|
737
695
|
* resumeUnshield.mutate({ unwrapTxHash: "0xabc..." });
|
|
738
696
|
* ```
|
|
739
697
|
*/
|
|
740
|
-
declare function useResumeUnshield(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
698
|
+
declare function useResumeUnshield(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ResumeUnshieldParams, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, ResumeUnshieldParams, `0x${string}`>;
|
|
741
699
|
//#endregion
|
|
742
700
|
//#region src/shield/use-underlying-allowance.d.ts
|
|
743
|
-
/** Configuration for {@link useUnderlyingAllowance}. */
|
|
744
701
|
interface UseUnderlyingAllowanceConfig {
|
|
745
702
|
/** Address of the confidential token contract used to scope the query cache. */
|
|
746
|
-
tokenAddress: Address
|
|
703
|
+
tokenAddress: Address;
|
|
747
704
|
/** Address of the wrapper contract whose underlying ERC-20 allowance is checked. */
|
|
748
|
-
wrapperAddress: Address
|
|
705
|
+
wrapperAddress: Address;
|
|
706
|
+
/** Owner to fetch allowance for. The query is disabled while `undefined`. */
|
|
707
|
+
owner: Address | undefined;
|
|
708
|
+
}
|
|
709
|
+
interface UseUnderlyingAllowanceSuspenseConfig {
|
|
710
|
+
/** Address of the confidential token contract used to scope the query cache. */
|
|
711
|
+
tokenAddress: Address;
|
|
712
|
+
/** Address of the wrapper contract whose underlying ERC-20 allowance is checked. */
|
|
713
|
+
wrapperAddress: Address;
|
|
714
|
+
/** Owner to fetch allowance for. */
|
|
715
|
+
owner: Address;
|
|
749
716
|
}
|
|
750
717
|
/**
|
|
751
|
-
*
|
|
752
|
-
* Useful to check if an approval is needed before shielding.
|
|
753
|
-
*
|
|
754
|
-
* @param config - Token and wrapper addresses.
|
|
755
|
-
* @param options - React Query options (forwarded to `useQuery`).
|
|
756
|
-
* @returns Query result with `data: bigint` (current allowance).
|
|
718
|
+
* Hook for fetching the underlying ERC-20 allowance granted to the wrapper
|
|
719
|
+
* contract. Useful to check if an approval is needed before shielding.
|
|
757
720
|
*
|
|
758
721
|
* @example
|
|
759
722
|
* ```tsx
|
|
760
723
|
* const { data: allowance } = useUnderlyingAllowance({
|
|
761
724
|
* tokenAddress: "0xConfidentialToken",
|
|
762
725
|
* wrapperAddress: "0xWrapper",
|
|
726
|
+
* owner: "0xOwner",
|
|
763
727
|
* });
|
|
764
728
|
* ```
|
|
765
729
|
*/
|
|
766
730
|
declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<bigint, Error>;
|
|
767
731
|
/**
|
|
768
|
-
* Suspense variant of {@link useUnderlyingAllowance}.
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
* @param config - Token and wrapper addresses.
|
|
772
|
-
* @returns Suspense query result with `data: bigint`.
|
|
732
|
+
* Suspense variant of {@link useUnderlyingAllowance}. Suspends rendering until
|
|
733
|
+
* the allowance resolves.
|
|
773
734
|
*
|
|
774
735
|
* @example
|
|
775
736
|
* ```tsx
|
|
776
737
|
* const { data: allowance } = useUnderlyingAllowanceSuspense({
|
|
777
738
|
* tokenAddress: "0xConfidentialToken",
|
|
778
739
|
* wrapperAddress: "0xWrapper",
|
|
740
|
+
* owner: "0xOwner",
|
|
779
741
|
* });
|
|
780
742
|
* ```
|
|
781
743
|
*/
|
|
782
|
-
declare function useUnderlyingAllowanceSuspense(config:
|
|
744
|
+
declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceSuspenseConfig): _$_tanstack_react_query0.UseSuspenseQueryResult<bigint, Error>;
|
|
783
745
|
//#endregion
|
|
784
746
|
//#region src/token/use-wrapper-discovery.d.ts
|
|
785
747
|
/** Configuration for {@link useWrapperDiscovery}. */
|
|
@@ -789,9 +751,9 @@ interface UseWrapperDiscoveryConfig {
|
|
|
789
751
|
* Used only to derive the signer context and to scope the query cache key —
|
|
790
752
|
* it does not affect which wrapper the registry returns.
|
|
791
753
|
*/
|
|
792
|
-
tokenAddress: Address
|
|
754
|
+
tokenAddress: Address;
|
|
793
755
|
/** ERC-20 address to discover the wrapper for. Pass `undefined` to disable the query. */
|
|
794
|
-
erc20Address: Address
|
|
756
|
+
erc20Address: Address | undefined;
|
|
795
757
|
}
|
|
796
758
|
/** Configuration for {@link useWrapperDiscoverySuspense}. */
|
|
797
759
|
interface UseWrapperDiscoverySuspenseConfig {
|
|
@@ -800,9 +762,9 @@ interface UseWrapperDiscoverySuspenseConfig {
|
|
|
800
762
|
* Used only to derive the signer context and to scope the query cache key —
|
|
801
763
|
* it does not affect which wrapper the registry returns.
|
|
802
764
|
*/
|
|
803
|
-
tokenAddress: Address
|
|
765
|
+
tokenAddress: Address;
|
|
804
766
|
/** ERC-20 address to discover the wrapper for. */
|
|
805
|
-
erc20Address: Address
|
|
767
|
+
erc20Address: Address;
|
|
806
768
|
}
|
|
807
769
|
/**
|
|
808
770
|
* Discover the confidential wrapper for an ERC-20 token via the on-chain registry.
|
|
@@ -821,7 +783,7 @@ interface UseWrapperDiscoverySuspenseConfig {
|
|
|
821
783
|
* });
|
|
822
784
|
* ```
|
|
823
785
|
*/
|
|
824
|
-
declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address
|
|
786
|
+
declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address | null>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<`0x${string}` | null, Error>;
|
|
825
787
|
/**
|
|
826
788
|
* Suspense variant of {@link useWrapperDiscovery}.
|
|
827
789
|
* Suspends rendering until the wrapper address is resolved.
|
|
@@ -854,7 +816,7 @@ declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspense
|
|
|
854
816
|
* // metadata?.name, metadata?.symbol, metadata?.decimals
|
|
855
817
|
* ```
|
|
856
818
|
*/
|
|
857
|
-
declare function useMetadata(tokenAddress: Address
|
|
819
|
+
declare function useMetadata(tokenAddress: Address, options?: Omit<UseQueryOptions<TokenMetadata>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<TokenMetadata, Error>;
|
|
858
820
|
/**
|
|
859
821
|
* Suspense variant of {@link useMetadata}.
|
|
860
822
|
* Suspends rendering until metadata is loaded.
|
|
@@ -867,7 +829,7 @@ declare function useMetadata(tokenAddress: Address$1, options?: Omit<UseQueryOpt
|
|
|
867
829
|
* const { data: metadata } = useMetadataSuspense("0xToken");
|
|
868
830
|
* ```
|
|
869
831
|
*/
|
|
870
|
-
declare function useMetadataSuspense(tokenAddress: Address
|
|
832
|
+
declare function useMetadataSuspense(tokenAddress: Address): _$_tanstack_react_query0.UseSuspenseQueryResult<TokenMetadata, Error>;
|
|
871
833
|
//#endregion
|
|
872
834
|
//#region src/delegation/use-delegate-decryption.d.ts
|
|
873
835
|
/**
|
|
@@ -882,7 +844,7 @@ declare function useMetadataSuspense(tokenAddress: Address$1): _$_tanstack_react
|
|
|
882
844
|
* delegate.mutate({ delegateAddress: "0xDelegate" });
|
|
883
845
|
* ```
|
|
884
846
|
*/
|
|
885
|
-
declare function useDelegateDecryption(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
847
|
+
declare function useDelegateDecryption(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, DelegateDecryptionParams>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, DelegateDecryptionParams, unknown>;
|
|
886
848
|
//#endregion
|
|
887
849
|
//#region src/delegation/use-revoke-delegation.d.ts
|
|
888
850
|
/**
|
|
@@ -897,16 +859,16 @@ declare function useDelegateDecryption(config: UseZamaConfig, options?: UseMutat
|
|
|
897
859
|
* revoke.mutate({ delegateAddress: "0xDelegate" });
|
|
898
860
|
* ```
|
|
899
861
|
*/
|
|
900
|
-
declare function useRevokeDelegation(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
862
|
+
declare function useRevokeDelegation(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, RevokeDelegationParams>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, RevokeDelegationParams, unknown>;
|
|
901
863
|
//#endregion
|
|
902
864
|
//#region src/delegation/use-delegation-status.d.ts
|
|
903
865
|
interface UseDelegationStatusConfig {
|
|
904
866
|
/** Address of the confidential token contract. Pass `undefined` to disable the query. */
|
|
905
|
-
tokenAddress: Address
|
|
867
|
+
tokenAddress: Address | undefined;
|
|
906
868
|
/** The address that granted the delegation. */
|
|
907
|
-
delegatorAddress?: Address
|
|
869
|
+
delegatorAddress?: Address;
|
|
908
870
|
/** The address that received delegation rights. */
|
|
909
|
-
delegateAddress?: Address
|
|
871
|
+
delegateAddress?: Address;
|
|
910
872
|
}
|
|
911
873
|
/**
|
|
912
874
|
* Query delegation status between a delegator and delegate for a token.
|
|
@@ -925,7 +887,7 @@ interface UseDelegationStatusConfig {
|
|
|
925
887
|
* // data?.isDelegated, data?.expiryTimestamp
|
|
926
888
|
* ```
|
|
927
889
|
*/
|
|
928
|
-
declare function useDelegationStatus(config: UseDelegationStatusConfig, options?: Omit<UseQueryOptions<DelegationStatusData
|
|
890
|
+
declare function useDelegationStatus(config: UseDelegationStatusConfig, options?: Omit<UseQueryOptions<DelegationStatusData>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<DelegationStatusData, Error>;
|
|
929
891
|
//#endregion
|
|
930
892
|
//#region src/delegation/use-decrypt-balance-as.d.ts
|
|
931
893
|
/**
|
|
@@ -941,7 +903,7 @@ declare function useDelegationStatus(config: UseDelegationStatusConfig, options?
|
|
|
941
903
|
* // decryptAs.data => 1000n
|
|
942
904
|
* ```
|
|
943
905
|
*/
|
|
944
|
-
declare function useDecryptBalanceAs(tokenAddress: Address
|
|
906
|
+
declare function useDecryptBalanceAs(tokenAddress: Address, options?: UseMutationOptions<bigint, Error, DecryptBalanceAsParams>): _$_tanstack_react_query0.UseMutationResult<bigint, Error, DecryptBalanceAsParams, unknown>;
|
|
945
907
|
//#endregion
|
|
946
908
|
//#region src/delegation/use-batch-decrypt-balances-as.d.ts
|
|
947
909
|
/**
|
|
@@ -959,7 +921,7 @@ declare function useDecryptBalanceAs(tokenAddress: Address$1, options?: UseMutat
|
|
|
959
921
|
* // batchDecryptAs.data => Map { "0xTokenA" => 100n, "0xTokenB" => 200n }
|
|
960
922
|
* ```
|
|
961
923
|
*/
|
|
962
|
-
declare function useBatchDecryptBalancesAs(tokens: ReadonlyToken
|
|
924
|
+
declare function useBatchDecryptBalancesAs(tokens: ReadonlyToken[], options?: UseMutationOptions<Map<Address, bigint>, Error, BatchDecryptBalancesAsParams>): _$_tanstack_react_query0.UseMutationResult<Map<`0x${string}`, bigint>, Error, _$_zama_fhe_sdk0.BatchDecryptAsOptions, unknown>;
|
|
963
925
|
//#endregion
|
|
964
926
|
//#region src/shield/use-approve-underlying.d.ts
|
|
965
927
|
/**
|
|
@@ -981,7 +943,7 @@ declare function useBatchDecryptBalancesAs(tokens: ReadonlyToken$1[], options?:
|
|
|
981
943
|
* approve.mutate({ amount: 1000n }); // exact amount
|
|
982
944
|
* ```
|
|
983
945
|
*/
|
|
984
|
-
declare function useApproveUnderlying(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult
|
|
946
|
+
declare function useApproveUnderlying(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ApproveUnderlyingParams, Address>): _$_tanstack_react_query0.UseMutationResult<TransactionResult, Error, ApproveUnderlyingParams, `0x${string}`>;
|
|
985
947
|
//#endregion
|
|
986
948
|
//#region src/token/use-is-confidential.d.ts
|
|
987
949
|
/**
|
|
@@ -997,7 +959,7 @@ declare function useApproveUnderlying(config: UseZamaConfig, options?: UseMutati
|
|
|
997
959
|
* const { data: isConfidential } = useIsConfidential("0xToken");
|
|
998
960
|
* ```
|
|
999
961
|
*/
|
|
1000
|
-
declare function useIsConfidential(tokenAddress: Address
|
|
962
|
+
declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<boolean, Error>;
|
|
1001
963
|
/**
|
|
1002
964
|
* Suspense variant of {@link useIsConfidential}.
|
|
1003
965
|
* Suspends rendering until the ERC-165 check resolves.
|
|
@@ -1010,7 +972,7 @@ declare function useIsConfidential(tokenAddress: Address$1, options?: Omit<UseQu
|
|
|
1010
972
|
* const { data: isConfidential } = useIsConfidentialSuspense("0xToken");
|
|
1011
973
|
* ```
|
|
1012
974
|
*/
|
|
1013
|
-
declare function useIsConfidentialSuspense(tokenAddress: Address
|
|
975
|
+
declare function useIsConfidentialSuspense(tokenAddress: Address): _$_tanstack_react_query0.UseSuspenseQueryResult<boolean, Error>;
|
|
1014
976
|
/**
|
|
1015
977
|
* Check if a token supports the ERC-7984 wrapper interface via ERC-165.
|
|
1016
978
|
* Result is cached indefinitely since interface support does not change.
|
|
@@ -1024,7 +986,7 @@ declare function useIsConfidentialSuspense(tokenAddress: Address$1): _$_tanstack
|
|
|
1024
986
|
* const { data: isWrapper } = useIsWrapper("0xToken");
|
|
1025
987
|
* ```
|
|
1026
988
|
*/
|
|
1027
|
-
declare function useIsWrapper(tokenAddress: Address
|
|
989
|
+
declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<boolean, Error>;
|
|
1028
990
|
/**
|
|
1029
991
|
* Suspense variant of {@link useIsWrapper}.
|
|
1030
992
|
* Suspends rendering until the ERC-165 check resolves.
|
|
@@ -1037,7 +999,7 @@ declare function useIsWrapper(tokenAddress: Address$1, options?: Omit<UseQueryOp
|
|
|
1037
999
|
* const { data: isWrapper } = useIsWrapperSuspense("0xToken");
|
|
1038
1000
|
* ```
|
|
1039
1001
|
*/
|
|
1040
|
-
declare function useIsWrapperSuspense(tokenAddress: Address
|
|
1002
|
+
declare function useIsWrapperSuspense(tokenAddress: Address): _$_tanstack_react_query0.UseSuspenseQueryResult<boolean, Error>;
|
|
1041
1003
|
//#endregion
|
|
1042
1004
|
//#region src/token/use-total-supply.d.ts
|
|
1043
1005
|
/**
|
|
@@ -1047,32 +1009,35 @@ declare function useIsWrapperSuspense(tokenAddress: Address$1): _$_tanstack_reac
|
|
|
1047
1009
|
* @param tokenAddress - Address of the token contract.
|
|
1048
1010
|
* @param options - React Query options (forwarded to `useQuery`).
|
|
1049
1011
|
* @returns Query result with `data: bigint`.
|
|
1012
|
+
* Uses ERC-165 to call `inferredTotalSupply()` on upgraded wrappers and
|
|
1013
|
+
* legacy `totalSupply()` on pre-upgrade wrappers.
|
|
1050
1014
|
*
|
|
1051
1015
|
* @example
|
|
1052
1016
|
* ```tsx
|
|
1053
1017
|
* const { data: totalSupply } = useTotalSupply("0xToken");
|
|
1054
1018
|
* ```
|
|
1055
1019
|
*/
|
|
1056
|
-
declare function useTotalSupply(tokenAddress: Address
|
|
1020
|
+
declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">): _$_tanstack_react_query0.UseQueryResult<bigint, Error>;
|
|
1057
1021
|
/**
|
|
1058
1022
|
* Suspense variant of {@link useTotalSupply}.
|
|
1059
1023
|
* Suspends rendering until the total supply is loaded.
|
|
1060
1024
|
*
|
|
1061
1025
|
* @param tokenAddress - Address of the token contract.
|
|
1062
1026
|
* @returns Suspense query result with `data: bigint`.
|
|
1027
|
+
* Uses ERC-165 to call `inferredTotalSupply()` on upgraded wrappers and
|
|
1028
|
+
* legacy `totalSupply()` on pre-upgrade wrappers.
|
|
1063
1029
|
*
|
|
1064
1030
|
* @example
|
|
1065
1031
|
* ```tsx
|
|
1066
1032
|
* const { data: totalSupply } = useTotalSupplySuspense("0xToken");
|
|
1067
1033
|
* ```
|
|
1068
1034
|
*/
|
|
1069
|
-
declare function useTotalSupplySuspense(tokenAddress: Address
|
|
1035
|
+
declare function useTotalSupplySuspense(tokenAddress: Address): _$_tanstack_react_query0.UseSuspenseQueryResult<bigint, Error>;
|
|
1070
1036
|
//#endregion
|
|
1071
1037
|
//#region src/wrappers-registry/use-wrappers-registry-address.d.ts
|
|
1072
1038
|
/**
|
|
1073
1039
|
* Resolves the wrappers registry address for the current chain.
|
|
1074
|
-
* Uses the
|
|
1075
|
-
* plus any `registryAddresses` overrides passed to `ZamaSDKConfig`).
|
|
1040
|
+
* Uses the registry addresses from `sdk.registry` (built-in defaults from chain configs).
|
|
1076
1041
|
*
|
|
1077
1042
|
* Returns `undefined` when the chain ID hasn't been fetched yet
|
|
1078
1043
|
* or when no registry is configured for the connected chain.
|
|
@@ -1080,14 +1045,14 @@ declare function useTotalSupplySuspense(tokenAddress: Address$1): _$_tanstack_re
|
|
|
1080
1045
|
* The chain ID is cached for 30 seconds (`staleTime`), so chain
|
|
1081
1046
|
* switches may take up to 30s to reflect.
|
|
1082
1047
|
*/
|
|
1083
|
-
declare function useWrappersRegistryAddress(): Address
|
|
1048
|
+
declare function useWrappersRegistryAddress(): Address | undefined;
|
|
1084
1049
|
//#endregion
|
|
1085
1050
|
//#region src/wrappers-registry/use-token-pairs-registry.d.ts
|
|
1086
1051
|
/**
|
|
1087
1052
|
* Fetches all token wrapper pairs from the ConfidentialTokenWrappersRegistry
|
|
1088
1053
|
* contract on the current chain.
|
|
1089
1054
|
*/
|
|
1090
|
-
declare function useTokenPairsRegistry(): _$_tanstack_react_query0.UseQueryResult<readonly TokenWrapperPair
|
|
1055
|
+
declare function useTokenPairsRegistry(): _$_tanstack_react_query0.UseQueryResult<readonly TokenWrapperPair[], Error>;
|
|
1091
1056
|
//#endregion
|
|
1092
1057
|
//#region src/wrappers-registry/use-token-pairs-length.d.ts
|
|
1093
1058
|
/**
|
|
@@ -1108,7 +1073,7 @@ declare function useTokenPairsSlice({
|
|
|
1108
1073
|
}: {
|
|
1109
1074
|
fromIndex: bigint | undefined;
|
|
1110
1075
|
toIndex: bigint | undefined;
|
|
1111
|
-
}): _$_tanstack_react_query0.UseQueryResult<readonly TokenWrapperPair
|
|
1076
|
+
}): _$_tanstack_react_query0.UseQueryResult<readonly TokenWrapperPair[], Error>;
|
|
1112
1077
|
//#endregion
|
|
1113
1078
|
//#region src/wrappers-registry/use-token-pair.d.ts
|
|
1114
1079
|
/**
|
|
@@ -1120,7 +1085,7 @@ declare function useTokenPair({
|
|
|
1120
1085
|
index
|
|
1121
1086
|
}: {
|
|
1122
1087
|
index: bigint | undefined;
|
|
1123
|
-
}): _$_tanstack_react_query0.UseQueryResult<TokenWrapperPair
|
|
1088
|
+
}): _$_tanstack_react_query0.UseQueryResult<TokenWrapperPair, Error>;
|
|
1124
1089
|
//#endregion
|
|
1125
1090
|
//#region src/wrappers-registry/use-confidential-token-address.d.ts
|
|
1126
1091
|
/**
|
|
@@ -1129,7 +1094,7 @@ declare function useTokenPair({
|
|
|
1129
1094
|
declare function useConfidentialTokenAddress({
|
|
1130
1095
|
tokenAddress
|
|
1131
1096
|
}: {
|
|
1132
|
-
tokenAddress: Address
|
|
1097
|
+
tokenAddress: Address | undefined;
|
|
1133
1098
|
}): _$_tanstack_react_query0.UseQueryResult<readonly [boolean, `0x${string}`], Error>;
|
|
1134
1099
|
//#endregion
|
|
1135
1100
|
//#region src/wrappers-registry/use-token-address.d.ts
|
|
@@ -1139,7 +1104,7 @@ declare function useConfidentialTokenAddress({
|
|
|
1139
1104
|
declare function useTokenAddress({
|
|
1140
1105
|
confidentialTokenAddress
|
|
1141
1106
|
}: {
|
|
1142
|
-
confidentialTokenAddress: Address
|
|
1107
|
+
confidentialTokenAddress: Address | undefined;
|
|
1143
1108
|
}): _$_tanstack_react_query0.UseQueryResult<readonly [boolean, `0x${string}`], Error>;
|
|
1144
1109
|
//#endregion
|
|
1145
1110
|
//#region src/wrappers-registry/use-is-confidential-token-valid.d.ts
|
|
@@ -1152,7 +1117,7 @@ declare function useTokenAddress({
|
|
|
1152
1117
|
declare function useIsConfidentialTokenValid({
|
|
1153
1118
|
confidentialTokenAddress
|
|
1154
1119
|
}: {
|
|
1155
|
-
confidentialTokenAddress: Address
|
|
1120
|
+
confidentialTokenAddress: Address | undefined;
|
|
1156
1121
|
}): _$_tanstack_react_query0.UseQueryResult<boolean, Error>;
|
|
1157
1122
|
//#endregion
|
|
1158
1123
|
//#region src/wrappers-registry/use-list-pairs.d.ts
|
|
@@ -1177,15 +1142,7 @@ declare function useListPairs({
|
|
|
1177
1142
|
page?: number;
|
|
1178
1143
|
pageSize?: number;
|
|
1179
1144
|
metadata?: boolean;
|
|
1180
|
-
}): _$_tanstack_react_query0.UseQueryResult<PaginatedResult
|
|
1181
|
-
//#endregion
|
|
1182
|
-
//#region src/balance/optimistic-balance-update.d.ts
|
|
1183
|
-
type OptimisticBalanceSnapshot = [QueryKey, bigint | undefined][];
|
|
1184
|
-
/** Combined context returned by optimistic `onMutate`. */
|
|
1185
|
-
interface OptimisticMutateContext {
|
|
1186
|
-
snapshot: OptimisticBalanceSnapshot;
|
|
1187
|
-
callerContext?: unknown;
|
|
1188
|
-
}
|
|
1145
|
+
}): _$_tanstack_react_query0.UseQueryResult<PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>, Error>;
|
|
1189
1146
|
//#endregion
|
|
1190
|
-
export {
|
|
1147
|
+
export { type UseConfidentialBalanceConfig, type UseConfidentialBalanceOptions, type UseConfidentialBalancesConfig, type UseConfidentialBalancesOptions, type UseConfidentialIsOperatorConfig, type UseConfidentialIsOperatorSuspenseConfig, type UseConfidentialTransferConfig, type UseDelegationStatusConfig, type UseIsAllowedConfig, type UseShieldConfig, type UseUnderlyingAllowanceConfig, type UseUnderlyingAllowanceSuspenseConfig, type UseUserDecryptResult, type UseWrapperDiscoveryConfig, type UseWrapperDiscoverySuspenseConfig, type UseZamaConfig, ZamaProvider, type ZamaProviderProps, useAllow, useApproveUnderlying, useBatchDecryptBalancesAs, useClearCredentials, useConfidentialBalance, useConfidentialBalances, useConfidentialIsOperator, useConfidentialIsOperatorSuspense, useConfidentialSetOperator, useConfidentialTokenAddress, useConfidentialTransfer, useConfidentialTransferFrom, useCreateDelegatedUserDecryptEIP712, useCreateEIP712, useDecryptBalanceAs, useDelegateDecryption, useDelegatedUserDecrypt, useDelegationStatus, useEncrypt, useFinalizeUnwrap, useGenerateKeypair, useIsAllowed, useIsConfidential, useIsConfidentialSuspense, useIsConfidentialTokenValid, useIsWrapper, useIsWrapperSuspense, useListPairs, useMetadata, useMetadataSuspense, usePublicDecrypt, usePublicKey, usePublicParams, useReadonlyToken, useRequestZKProofVerification, useResumeUnshield, useRevokeDelegation, useRevokePermits, useShield, useToken, useTokenAddress, useTokenPair, useTokenPairsLength, useTokenPairsRegistry, useTokenPairsSlice, useTotalSupply, useTotalSupplySuspense, useUnderlyingAllowance, useUnderlyingAllowanceSuspense, useUnshield, useUnshieldAll, useUnwrap, useUnwrapAll, useUserDecrypt, useWrapperDiscovery, useWrapperDiscoverySuspense, useWrappersRegistryAddress, useZamaSDK };
|
|
1191
1148
|
//# sourceMappingURL=index.d.ts.map
|