@zama-fhe/react-sdk 3.0.1 → 3.1.0-alpha.2
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 +94 -918
- package/dist/index.d.ts +256 -461
- 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 +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,86 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import * as _$_tanstack_react_query0 from "@tanstack/react-query";
|
|
7
|
-
import { QueryKey, UseMutationOptions, UseMutationResult, UseQueryOptions } 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";
|
|
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}. */
|
|
14
11
|
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;
|
|
12
|
+
/** Configuration object created by {@link createConfig}. */
|
|
13
|
+
config: ZamaConfig;
|
|
50
14
|
}
|
|
51
15
|
/**
|
|
52
16
|
* Provides a {@link ZamaSDK} instance to all descendant hooks.
|
|
53
17
|
*
|
|
54
18
|
* @example
|
|
55
19
|
* ```tsx
|
|
56
|
-
* <ZamaProvider
|
|
20
|
+
* <ZamaProvider config={zamaConfig}>
|
|
57
21
|
* <App />
|
|
58
22
|
* </ZamaProvider>
|
|
59
23
|
* ```
|
|
60
24
|
*/
|
|
61
25
|
declare function ZamaProvider({
|
|
62
26
|
children,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
storage,
|
|
66
|
-
sessionStorage,
|
|
67
|
-
keypairTTL,
|
|
68
|
-
sessionTTL,
|
|
69
|
-
registryAddresses,
|
|
70
|
-
registryTTL,
|
|
71
|
-
onEvent
|
|
72
|
-
}: ZamaProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
27
|
+
config
|
|
28
|
+
}: ZamaProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
73
29
|
/**
|
|
74
30
|
* Access the {@link ZamaSDK} instance from context.
|
|
75
|
-
* Throws if called outside a {@link ZamaProvider}
|
|
31
|
+
* Throws if called outside a {@link ZamaProvider}.
|
|
76
32
|
*
|
|
77
33
|
* @example
|
|
78
34
|
* ```tsx
|
|
79
35
|
* const sdk = useZamaSDK();
|
|
80
|
-
* const token = sdk.
|
|
36
|
+
* const token = sdk.createToken("0x...");
|
|
81
37
|
* ```
|
|
82
38
|
*/
|
|
83
|
-
declare function useZamaSDK(): ZamaSDK
|
|
39
|
+
declare function useZamaSDK(): ZamaSDK;
|
|
84
40
|
//#endregion
|
|
85
41
|
//#region src/relayer/use-encrypt.d.ts
|
|
86
42
|
/**
|
|
@@ -98,18 +54,21 @@ declare function useZamaSDK(): ZamaSDK$1;
|
|
|
98
54
|
* encrypt.mutate({ values: [{ value: 1000n, type: "euint64" }], contractAddress: "0x...", userAddress: "0x..." });
|
|
99
55
|
* ```
|
|
100
56
|
*/
|
|
101
|
-
declare function useEncrypt():
|
|
57
|
+
declare function useEncrypt(): import("@tanstack/react-query").UseMutationResult<Readonly<{
|
|
58
|
+
handles: Uint8Array[];
|
|
59
|
+
inputProof: Uint8Array;
|
|
60
|
+
}>, Error, EncryptParams, unknown>;
|
|
102
61
|
//#endregion
|
|
103
|
-
//#region src/
|
|
62
|
+
//#region src/decrypt/use-user-decrypt.d.ts
|
|
104
63
|
/**
|
|
105
64
|
* React hook for FHE user decryption. Thin wrapper around
|
|
106
65
|
* `userDecryptQueryOptions` with `useQuery` semantics.
|
|
107
66
|
*/
|
|
108
|
-
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>;
|
|
109
68
|
/** Return type of {@link useUserDecrypt}. */
|
|
110
69
|
type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;
|
|
111
70
|
//#endregion
|
|
112
|
-
//#region src/
|
|
71
|
+
//#region src/decrypt/use-public-decrypt.d.ts
|
|
113
72
|
/**
|
|
114
73
|
* Decrypt FHE ciphertext handles using the network public key (no credential needed).
|
|
115
74
|
* On success, results are available via `data.clearValues` and written to the
|
|
@@ -124,152 +83,29 @@ type UseUserDecryptResult = ReturnType<typeof useUserDecrypt>;
|
|
|
124
83
|
* // publicDecrypt.data?.clearValues => { "0xHandle1": 500n, ... }
|
|
125
84
|
* ```
|
|
126
85
|
*/
|
|
127
|
-
declare function usePublicDecrypt():
|
|
86
|
+
declare function usePublicDecrypt(): import("@tanstack/react-query").UseMutationResult<Readonly<{
|
|
87
|
+
clearValues: import("@zama-fhe/relayer-sdk/web").ClearValues;
|
|
88
|
+
abiEncodedClearValues: `0x${string}`;
|
|
89
|
+
decryptionProof: `0x${string}`;
|
|
90
|
+
}>, Error, `0x${string}`[], unknown>;
|
|
128
91
|
//#endregion
|
|
129
|
-
//#region src/
|
|
130
|
-
/**
|
|
131
|
-
* Generate an FHE keypair via the relayer.
|
|
132
|
-
* Returns a public/private key pair for use in decrypt authorization.
|
|
133
|
-
*
|
|
134
|
-
* Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
|
|
135
|
-
* - {@link RelayerRequestFailedError} — relayer keypair generation request failed
|
|
136
|
-
*
|
|
137
|
-
* @returns A mutation whose `mutate` takes no parameters.
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* ```tsx
|
|
141
|
-
* const generateKeypair = useGenerateKeypair();
|
|
142
|
-
* generateKeypair.mutate();
|
|
143
|
-
* // generateKeypair.data?.publicKey, generateKeypair.data?.privateKey
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
declare function useGenerateKeypair(): _$_tanstack_react_query0.UseMutationResult<_$_zama_fhe_sdk0.KeypairType<`0x${string}`>, Error, void, unknown>;
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region src/relayer/use-create-eip712.d.ts
|
|
149
|
-
/**
|
|
150
|
-
* Create EIP-712 typed data for signing an FHE decrypt credential.
|
|
151
|
-
* The returned typed data is signed by the wallet to authorize decryption.
|
|
152
|
-
*
|
|
153
|
-
* @returns A mutation whose `mutate` accepts {@link CreateEIP712Params}.
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```tsx
|
|
157
|
-
* const createEIP712 = useCreateEIP712();
|
|
158
|
-
* createEIP712.mutate({
|
|
159
|
-
* publicKey: keypair.publicKey,
|
|
160
|
-
* contractAddresses: ["0xToken"],
|
|
161
|
-
* startTimestamp: Math.floor(Date.now() / 1000),
|
|
162
|
-
* });
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
declare function useCreateEIP712(): _$_tanstack_react_query0.UseMutationResult<EIP712TypedData$1, Error, CreateEIP712Params, unknown>;
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/relayer/use-create-delegated-user-decrypt-eip712.d.ts
|
|
168
|
-
/**
|
|
169
|
-
* Create EIP-712 typed data for a delegated user decrypt credential.
|
|
170
|
-
* Used when one wallet authorizes another to decrypt on its behalf.
|
|
171
|
-
*
|
|
172
|
-
* @returns A mutation whose `mutate` accepts {@link CreateDelegatedUserDecryptEIP712Params}.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* ```tsx
|
|
176
|
-
* const createEIP712 = useCreateDelegatedUserDecryptEIP712();
|
|
177
|
-
* createEIP712.mutate({
|
|
178
|
-
* publicKey: keypair.publicKey,
|
|
179
|
-
* contractAddresses: ["0xToken"],
|
|
180
|
-
* delegatorAddress: "0xDelegator",
|
|
181
|
-
* startTimestamp: Math.floor(Date.now() / 1000),
|
|
182
|
-
* });
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
185
|
-
declare function useCreateDelegatedUserDecryptEIP712(): _$_tanstack_react_query0.UseMutationResult<Readonly<{
|
|
186
|
-
types: _$_zama_fhe_relayer_sdk_web0.KmsDelegatedUserDecryptEIP712TypesType;
|
|
187
|
-
primaryType: "DelegatedUserDecryptRequestVerification";
|
|
188
|
-
domain: _$_zama_fhe_relayer_sdk_web0.KmsEIP712DomainType;
|
|
189
|
-
message: _$_zama_fhe_relayer_sdk_web0.KmsDelegatedUserDecryptEIP712MessageType;
|
|
190
|
-
}>, Error, CreateDelegatedUserDecryptEIP712Params, unknown>;
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/relayer/use-delegated-user-decrypt.d.ts
|
|
92
|
+
//#region src/decrypt/use-delegated-decrypt.d.ts
|
|
193
93
|
/**
|
|
194
94
|
* Decrypt FHE ciphertext handles using delegated user credentials.
|
|
195
95
|
* Returns a map of handle → plaintext bigint.
|
|
196
96
|
*
|
|
197
|
-
* @returns A mutation whose `mutate` accepts {@link
|
|
97
|
+
* @returns A mutation whose `mutate` accepts {@link DelegatedDecryptMutationParams}.
|
|
198
98
|
*
|
|
199
99
|
* @example
|
|
200
100
|
* ```tsx
|
|
201
|
-
* const decrypt =
|
|
202
|
-
* decrypt.mutate({
|
|
101
|
+
* const decrypt = useDelegatedDecrypt();
|
|
102
|
+
* decrypt.mutate({ encryptedInputs: [{ encryptedValue: "0xHandle1", contractAddress: "0x..." }], delegatorAddress: "0x..." });
|
|
203
103
|
* // decrypt.data => { "0xHandle1": 1000n }
|
|
204
104
|
* ```
|
|
205
105
|
*/
|
|
206
|
-
declare function
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region src/relayer/use-request-zk-proof-verification.d.ts
|
|
209
|
-
/**
|
|
210
|
-
* Submit a ZK proof for on-chain verification.
|
|
211
|
-
* Returns the input proof bytes for use in contract calls.
|
|
212
|
-
*
|
|
213
|
-
* @returns A mutation whose `mutate` accepts a {@link ZKProofLike}.
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```tsx
|
|
217
|
-
* const verify = useRequestZKProofVerification();
|
|
218
|
-
* verify.mutate(zkProof);
|
|
219
|
-
* // verify.data => Uint8Array (input proof bytes)
|
|
220
|
-
* ```
|
|
221
|
-
*/
|
|
222
|
-
declare function useRequestZKProofVerification(): _$_tanstack_react_query0.UseMutationResult<Readonly<{
|
|
223
|
-
handles: Uint8Array[];
|
|
224
|
-
inputProof: Uint8Array;
|
|
225
|
-
}>, Error, ZKProofLike$1, unknown>;
|
|
226
|
-
//#endregion
|
|
227
|
-
//#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
|
-
/**
|
|
236
|
-
* Fetch the FHE network public key from the relayer.
|
|
237
|
-
* Cached indefinitely since the key does not change during a session.
|
|
238
|
-
*
|
|
239
|
-
* @returns Query result with `data: PublicKeyData | null`.
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* ```tsx
|
|
243
|
-
* const { data: publicKey } = usePublicKey();
|
|
244
|
-
* // publicKey?.publicKeyId, publicKey?.publicKey
|
|
245
|
-
* ```
|
|
246
|
-
*/
|
|
247
|
-
declare function usePublicKey(): _$_tanstack_react_query0.UseQueryResult<PublicKeyData | null, Error>;
|
|
106
|
+
declare function useDelegatedDecrypt(): import("@tanstack/react-query").UseMutationResult<Record<`0x${string}`, import("@zama-fhe/relayer-sdk/web").ClearValueType>, Error, DelegatedDecryptMutationParams, unknown>;
|
|
248
107
|
//#endregion
|
|
249
|
-
//#region src/
|
|
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
|
-
/**
|
|
258
|
-
* Fetch FHE public parameters for a given bit size from the relayer.
|
|
259
|
-
* Cached indefinitely since parameters do not change during a session.
|
|
260
|
-
*
|
|
261
|
-
* @param bits - The FHE bit size to fetch parameters for (e.g. 2048).
|
|
262
|
-
* @returns Query result with `data: PublicParamsData | null`.
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* ```tsx
|
|
266
|
-
* const { data: params } = usePublicParams(2048);
|
|
267
|
-
* // params?.publicParams, params?.publicParamsId
|
|
268
|
-
* ```
|
|
269
|
-
*/
|
|
270
|
-
declare function usePublicParams(bits: number): _$_tanstack_react_query0.UseQueryResult<PublicParamsData | null, Error>;
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region src/authorization/use-allow.d.ts
|
|
108
|
+
//#region src/permits/use-grant-permit.d.ts
|
|
273
109
|
/**
|
|
274
110
|
* Sign an EIP-712 message authorizing decryption of confidential handles
|
|
275
111
|
* for a list of contract addresses. This is not token-specific — any
|
|
@@ -283,151 +119,152 @@ declare function usePublicParams(bits: number): _$_tanstack_react_query0.UseQuer
|
|
|
283
119
|
*
|
|
284
120
|
* @example
|
|
285
121
|
* ```tsx
|
|
286
|
-
* const { mutateAsync:
|
|
122
|
+
* const { mutateAsync: grantPermit, isPending } = useGrantPermit();
|
|
287
123
|
*
|
|
288
124
|
* // Authorize decryption for any contracts with encrypted state:
|
|
289
125
|
* // confidential tokens, auction contracts, governance contracts, etc.
|
|
290
|
-
* await
|
|
126
|
+
* await grantPermit([tokenAddress, auctionAddress, governanceAddress]);
|
|
291
127
|
* ```
|
|
292
128
|
*/
|
|
293
|
-
declare function
|
|
129
|
+
declare function useGrantPermit(options?: UseMutationOptions<void, Error, Address[]>): import("@tanstack/react-query").UseMutationResult<void, Error, `0x${string}`[], unknown>;
|
|
294
130
|
//#endregion
|
|
295
|
-
//#region src/
|
|
296
|
-
/** Configuration for {@link
|
|
297
|
-
interface
|
|
131
|
+
//#region src/permits/use-has-permit.d.ts
|
|
132
|
+
/** Configuration for {@link useHasPermit}. */
|
|
133
|
+
interface UseHasPermitConfig {
|
|
298
134
|
/** Contract addresses to check credentials against (at least one required). */
|
|
299
|
-
contractAddresses: [Address
|
|
135
|
+
contractAddresses: [Address, ...Address[]];
|
|
300
136
|
}
|
|
301
137
|
/**
|
|
302
|
-
* Check whether
|
|
303
|
-
*
|
|
304
|
-
*
|
|
138
|
+
* Check whether stored permits cover the given contract addresses for the
|
|
139
|
+
* connected signer. Returns `true` if decrypt operations can proceed without
|
|
140
|
+
* a wallet prompt.
|
|
141
|
+
*
|
|
142
|
+
* @returns Query result with `data: boolean` — `true` if a stored permit covers
|
|
143
|
+
* every entry in `contractAddresses`. The query auto-disables when no signer is configured
|
|
144
|
+
* (`data` stays `undefined`, `status` stays `"pending"`).
|
|
145
|
+
* @throws if the query runs without a signer configured (the `enabled` guard normally
|
|
146
|
+
* prevents this; only reachable if the caller forces `query: { enabled: true }`). {@link SignerNotConfiguredError}
|
|
305
147
|
*
|
|
306
148
|
* @example
|
|
307
149
|
* ```tsx
|
|
308
|
-
* const { data:
|
|
150
|
+
* const { data: hasPermit } = useHasPermit({ contractAddresses: ["0xToken"] });
|
|
309
151
|
* ```
|
|
310
152
|
*/
|
|
311
|
-
declare function
|
|
153
|
+
declare function useHasPermit(config: UseHasPermitConfig): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
312
154
|
//#endregion
|
|
313
|
-
//#region src/
|
|
155
|
+
//#region src/permits/use-revoke-permits.d.ts
|
|
314
156
|
/**
|
|
315
|
-
* Revoke
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
157
|
+
* Revoke FHE permits for the current signer.
|
|
158
|
+
*
|
|
159
|
+
* - Called with no arguments: every permit is removed across all chains and
|
|
160
|
+
* delegators. The keypair survives — use {@link useClearCredentials} to also
|
|
161
|
+
* wipe the keypair.
|
|
162
|
+
* - Called with a contract list: only direct-decrypt permits on the current
|
|
163
|
+
* chain whose payload touches a listed address are removed. Delegated
|
|
164
|
+
* permits are not touched in this mode.
|
|
319
165
|
*
|
|
320
166
|
* @example
|
|
321
167
|
* ```tsx
|
|
322
|
-
* const { mutate:
|
|
323
|
-
*
|
|
324
|
-
* //
|
|
325
|
-
* revoke([tokenAddress, auctionAddress]);
|
|
168
|
+
* const { mutate: revokePermits } = useRevokePermits();
|
|
169
|
+
* revokePermits([tokenAddress]); // direct-decrypt scope, current chain
|
|
170
|
+
* revokePermits(); // every permit, all chains, all delegators
|
|
326
171
|
* ```
|
|
327
172
|
*/
|
|
328
|
-
declare function
|
|
173
|
+
declare function useRevokePermits(options?: UseMutationOptions<void, Error, Address[] | void>): import("@tanstack/react-query").UseMutationResult<void, Error, void | `0x${string}`[], unknown>;
|
|
329
174
|
//#endregion
|
|
330
|
-
//#region src/
|
|
175
|
+
//#region src/permits/use-clear-credentials.d.ts
|
|
331
176
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
177
|
+
* Wipe the keypair for the current signer and cascade-delete every permit
|
|
178
|
+
* (across chains and delegators) referencing it. Useful for "log out"
|
|
179
|
+
* handlers that should leave no trace.
|
|
334
180
|
*
|
|
335
181
|
* @example
|
|
336
182
|
* ```tsx
|
|
337
|
-
* const { mutate:
|
|
338
|
-
*
|
|
183
|
+
* const { mutate: clearCredentials } = useClearCredentials();
|
|
184
|
+
* clearCredentials();
|
|
339
185
|
* ```
|
|
340
186
|
*/
|
|
341
|
-
declare function
|
|
187
|
+
declare function useClearCredentials(options?: UseMutationOptions<void>): import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
|
|
342
188
|
//#endregion
|
|
343
189
|
//#region src/token/use-token.d.ts
|
|
344
|
-
/** Base configuration shared by all mutation hooks that need a Token instance. */
|
|
345
|
-
interface UseZamaConfig {
|
|
346
|
-
/** Address of the confidential token contract. */
|
|
347
|
-
tokenAddress: Address$1;
|
|
348
|
-
/** Address of the wrapper contract (required for shield/unshield operations). */
|
|
349
|
-
wrapperAddress?: Address$1;
|
|
350
|
-
}
|
|
351
190
|
/**
|
|
352
|
-
* Get a {@link Token} instance, memoized by address
|
|
353
|
-
*
|
|
191
|
+
* Get a {@link Token} instance for an ERC-7984 confidential token, memoized by address.
|
|
192
|
+
* Supports balance queries, transfers, and operator approval.
|
|
354
193
|
*
|
|
355
|
-
*
|
|
194
|
+
* For ERC-7984 wrappers (shield/unshield), use {@link useWrappedToken} instead.
|
|
195
|
+
*
|
|
196
|
+
* @param address - The confidential token contract address.
|
|
356
197
|
* @returns A memoized `Token` instance.
|
|
357
198
|
*
|
|
358
199
|
* @example
|
|
359
200
|
* ```tsx
|
|
360
|
-
* const token = useToken(
|
|
201
|
+
* const token = useToken("0xToken");
|
|
202
|
+
* // token.balanceOf(), token.confidentialTransfer(), etc.
|
|
361
203
|
* ```
|
|
362
204
|
*/
|
|
363
|
-
declare function useToken(
|
|
205
|
+
declare function useToken(address: Address): Token;
|
|
364
206
|
//#endregion
|
|
365
|
-
//#region src/token/use-
|
|
207
|
+
//#region src/token/use-wrapped-token.d.ts
|
|
366
208
|
/**
|
|
367
|
-
* Get a {@link
|
|
368
|
-
*
|
|
369
|
-
*
|
|
209
|
+
* Get a {@link WrappedToken} instance for an ERC-7984 ERC-20 wrapper,
|
|
210
|
+
* memoized by address. Adds wrapper-specific operations (shield, unshield,
|
|
211
|
+
* underlying, allowance) on top of the base {@link useToken} API.
|
|
370
212
|
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
213
|
+
* The address is the wrapper contract address itself — the wrapper IS the
|
|
214
|
+
* confidential token.
|
|
215
|
+
*
|
|
216
|
+
* @param address - The confidential wrapper contract address.
|
|
217
|
+
* @returns A memoized `WrappedToken` instance.
|
|
373
218
|
*
|
|
374
219
|
* @example
|
|
375
220
|
* ```tsx
|
|
376
|
-
* const
|
|
377
|
-
* //
|
|
221
|
+
* const wrapped = useWrappedToken("0xWrapper");
|
|
222
|
+
* // wrapped.shield(1000n), wrapped.unshield(500n), etc.
|
|
378
223
|
* ```
|
|
379
224
|
*/
|
|
380
|
-
declare function
|
|
225
|
+
declare function useWrappedToken(address: Address): WrappedToken;
|
|
381
226
|
//#endregion
|
|
382
227
|
//#region src/balance/use-confidential-balance.d.ts
|
|
383
|
-
/** Configuration for {@link useConfidentialBalance}. */
|
|
384
228
|
interface UseConfidentialBalanceConfig {
|
|
385
229
|
/** Address of the confidential token contract. */
|
|
386
|
-
|
|
230
|
+
address: Address;
|
|
231
|
+
/** Account to fetch balance for. The query is disabled while `undefined`. */
|
|
232
|
+
account: Address | undefined;
|
|
387
233
|
}
|
|
388
|
-
/** Query options for {@link useConfidentialBalance}. */
|
|
389
234
|
interface UseConfidentialBalanceOptions extends Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn" | "enabled"> {
|
|
390
|
-
/**
|
|
235
|
+
/** Set this to `false` to disable this query from automatically running. */
|
|
391
236
|
enabled?: boolean;
|
|
392
237
|
}
|
|
393
238
|
/**
|
|
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.
|
|
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.
|
|
402
242
|
*
|
|
403
243
|
* @example
|
|
404
244
|
* ```tsx
|
|
405
|
-
* const { data: balance
|
|
406
|
-
*
|
|
245
|
+
* const { data: balance } = useConfidentialBalance({
|
|
246
|
+
* address: "0xToken",
|
|
247
|
+
* account: "0xAccount",
|
|
407
248
|
* });
|
|
408
249
|
* ```
|
|
409
250
|
*/
|
|
410
|
-
declare function useConfidentialBalance(config: UseConfidentialBalanceConfig, options?: UseConfidentialBalanceOptions):
|
|
251
|
+
declare function useConfidentialBalance(config: UseConfidentialBalanceConfig, options?: UseConfidentialBalanceOptions): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
411
252
|
//#endregion
|
|
412
253
|
//#region src/balance/use-confidential-balances.d.ts
|
|
413
|
-
/** Configuration for {@link useConfidentialBalances}. */
|
|
414
254
|
interface UseConfidentialBalancesConfig {
|
|
415
|
-
/** Addresses of the confidential token contracts to batch-query. */
|
|
416
|
-
|
|
255
|
+
/** Addresses of the confidential token contracts to batch-query. The query is disabled while empty. */
|
|
256
|
+
addresses: Address[];
|
|
257
|
+
/** Account to fetch balances for. The query is disabled while `undefined`. */
|
|
258
|
+
account: Address | undefined;
|
|
417
259
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
/** Whether the query is enabled. Callback form is not supported in composite hooks. */
|
|
260
|
+
interface UseConfidentialBalancesOptions extends Omit<UseQueryOptions<BatchBalancesResult>, "queryKey" | "queryFn" | "enabled"> {
|
|
261
|
+
/** Set this to `false` to disable this query from automatically running. */
|
|
421
262
|
enabled?: boolean;
|
|
422
263
|
}
|
|
423
264
|
/**
|
|
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.
|
|
265
|
+
* Hook for fetching multiple confidential token balances in batch. Returns
|
|
266
|
+
* partial results when some tokens fail — successful balances are available
|
|
267
|
+
* alongside per-token error information.
|
|
431
268
|
*
|
|
432
269
|
* @param config - Token addresses configuration.
|
|
433
270
|
* @param options - React Query options forwarded to the balance query.
|
|
@@ -436,7 +273,8 @@ interface UseConfidentialBalancesOptions extends Omit<UseQueryOptions<BatchBalan
|
|
|
436
273
|
* @example
|
|
437
274
|
* ```tsx
|
|
438
275
|
* const { data } = useConfidentialBalances({
|
|
439
|
-
*
|
|
276
|
+
* addresses: ["0xTokenA", "0xTokenB"],
|
|
277
|
+
* account: "0xAccount",
|
|
440
278
|
* });
|
|
441
279
|
* const balance = data?.results.get("0xTokenA");
|
|
442
280
|
* if (data && data.errors.size > 0) {
|
|
@@ -444,11 +282,13 @@ interface UseConfidentialBalancesOptions extends Omit<UseQueryOptions<BatchBalan
|
|
|
444
282
|
* }
|
|
445
283
|
* ```
|
|
446
284
|
*/
|
|
447
|
-
declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions):
|
|
285
|
+
declare function useConfidentialBalances(config: UseConfidentialBalancesConfig, options?: UseConfidentialBalancesOptions): import("@tanstack/react-query").UseQueryResult<BatchBalancesResult, Error>;
|
|
448
286
|
//#endregion
|
|
449
287
|
//#region src/transfer/use-confidential-transfer.d.ts
|
|
450
288
|
/** Configuration for {@link useConfidentialTransfer}. */
|
|
451
|
-
interface UseConfidentialTransferConfig
|
|
289
|
+
interface UseConfidentialTransferConfig {
|
|
290
|
+
/** Address of the confidential token contract. */
|
|
291
|
+
address: Address;
|
|
452
292
|
/**
|
|
453
293
|
* When `true`, optimistically subtracts the transfer amount from cached balance
|
|
454
294
|
* before the transaction confirms. Rolls back on error.
|
|
@@ -471,7 +311,7 @@ interface UseConfidentialTransferConfig extends UseZamaConfig {
|
|
|
471
311
|
* @example
|
|
472
312
|
* ```tsx
|
|
473
313
|
* const transfer = useConfidentialTransfer({
|
|
474
|
-
*
|
|
314
|
+
* address: "0xToken",
|
|
475
315
|
* optimistic: true,
|
|
476
316
|
* });
|
|
477
317
|
* transfer.mutate(
|
|
@@ -486,7 +326,7 @@ interface UseConfidentialTransferConfig extends UseZamaConfig {
|
|
|
486
326
|
* );
|
|
487
327
|
* ```
|
|
488
328
|
*/
|
|
489
|
-
declare function useConfidentialTransfer<TContext = unknown>(config: UseConfidentialTransferConfig, options?: UseMutationOptions<TransactionResult
|
|
329
|
+
declare function useConfidentialTransfer<TContext = unknown>(config: UseConfidentialTransferConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferParams, TContext>): UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, TContext>;
|
|
490
330
|
//#endregion
|
|
491
331
|
//#region src/transfer/use-confidential-transfer-from.d.ts
|
|
492
332
|
/**
|
|
@@ -498,18 +338,18 @@ declare function useConfidentialTransfer<TContext = unknown>(config: UseConfiden
|
|
|
498
338
|
* - {@link EncryptionFailedError} — FHE encryption of the transfer amount failed
|
|
499
339
|
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
500
340
|
*
|
|
501
|
-
* @param
|
|
341
|
+
* @param address - Address of the confidential token contract.
|
|
502
342
|
* @param options - React Query mutation options.
|
|
503
343
|
*
|
|
504
344
|
* @example
|
|
505
345
|
* ```tsx
|
|
506
|
-
* const transferFrom = useConfidentialTransferFrom(
|
|
346
|
+
* const transferFrom = useConfidentialTransferFrom("0xToken");
|
|
507
347
|
* transferFrom.mutate({ from: "0xOwner", to: "0xRecipient", amount: 500n });
|
|
508
348
|
* ```
|
|
509
349
|
*/
|
|
510
|
-
declare function useConfidentialTransferFrom(
|
|
350
|
+
declare function useConfidentialTransferFrom(address: Address, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferFromParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ConfidentialTransferFromParams, `0x${string}`>;
|
|
511
351
|
//#endregion
|
|
512
|
-
//#region src/
|
|
352
|
+
//#region src/operator/use-confidential-set-operator.d.ts
|
|
513
353
|
/**
|
|
514
354
|
* Set operator approval for a confidential token. Defaults to 1 hour.
|
|
515
355
|
*
|
|
@@ -517,72 +357,71 @@ declare function useConfidentialTransferFrom(config: UseZamaConfig, options?: Us
|
|
|
517
357
|
* - {@link SigningRejectedError} — user rejected the wallet prompt
|
|
518
358
|
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
519
359
|
*
|
|
520
|
-
* @param
|
|
360
|
+
* @param address - Address of the confidential token contract.
|
|
521
361
|
* @param options - React Query mutation options.
|
|
522
362
|
*
|
|
523
363
|
* @example
|
|
524
364
|
* ```tsx
|
|
525
|
-
* const
|
|
526
|
-
*
|
|
365
|
+
* const setOperator = useConfidentialSetOperator("0xToken");
|
|
366
|
+
* setOperator.mutate({ operator: "0xOperator" });
|
|
527
367
|
* ```
|
|
528
368
|
*/
|
|
529
|
-
declare function
|
|
369
|
+
declare function useConfidentialSetOperator(address: Address, options?: UseMutationOptions<TransactionResult, Error, ConfidentialSetOperatorParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ConfidentialSetOperatorParams, `0x${string}`>;
|
|
530
370
|
//#endregion
|
|
531
|
-
//#region src/
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
holder?: Address$1;
|
|
371
|
+
//#region src/operator/use-confidential-is-operator.d.ts
|
|
372
|
+
interface UseConfidentialIsOperatorConfig {
|
|
373
|
+
/** Address of the confidential token contract. The query is disabled while `undefined`. */
|
|
374
|
+
address: Address | undefined;
|
|
375
|
+
/** Address to check operator status for. The query is disabled while `undefined`. */
|
|
376
|
+
spender: Address | undefined;
|
|
377
|
+
/** Token holder address. The query is disabled while `undefined`. */
|
|
378
|
+
holder: Address | undefined;
|
|
540
379
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
holder
|
|
380
|
+
interface UseConfidentialIsOperatorSuspenseConfig {
|
|
381
|
+
/** Address of the confidential token contract. */
|
|
382
|
+
address: Address;
|
|
383
|
+
/** Address to check operator status for. */
|
|
384
|
+
spender: Address;
|
|
385
|
+
/** Token holder address. */
|
|
386
|
+
holder: Address;
|
|
547
387
|
}
|
|
548
388
|
/**
|
|
549
|
-
* Check if a spender is an approved operator for a
|
|
389
|
+
* Check if a spender is an approved operator for a holder.
|
|
550
390
|
*
|
|
551
|
-
* @param config - Token address, spender, and
|
|
391
|
+
* @param config - Token address, spender, and holder to check.
|
|
552
392
|
* @param options - React Query options (forwarded to `useQuery`).
|
|
553
393
|
* @returns Query result with `data: boolean`.
|
|
554
394
|
*
|
|
555
395
|
* @example
|
|
556
396
|
* ```tsx
|
|
557
|
-
* const { data:
|
|
558
|
-
*
|
|
397
|
+
* const { data: isOperator } = useConfidentialIsOperator({
|
|
398
|
+
* address: "0xToken",
|
|
559
399
|
* spender: "0xSpender",
|
|
560
|
-
* holder: "0xHolder",
|
|
400
|
+
* holder: "0xHolder",
|
|
561
401
|
* });
|
|
562
402
|
* ```
|
|
563
403
|
*/
|
|
564
|
-
declare function
|
|
404
|
+
declare function useConfidentialIsOperator(config: UseConfidentialIsOperatorConfig, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
565
405
|
/**
|
|
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`.
|
|
406
|
+
* Suspense variant of {@link useConfidentialIsOperator}. Suspends rendering
|
|
407
|
+
* until the operator check resolves.
|
|
571
408
|
*
|
|
572
409
|
* @example
|
|
573
410
|
* ```tsx
|
|
574
|
-
* const { data:
|
|
575
|
-
*
|
|
411
|
+
* const { data: isOperator } = useConfidentialIsOperatorSuspense({
|
|
412
|
+
* address: "0xToken",
|
|
576
413
|
* spender: "0xSpender",
|
|
577
|
-
* holder: "0xHolder",
|
|
414
|
+
* holder: "0xHolder",
|
|
578
415
|
* });
|
|
579
416
|
* ```
|
|
580
417
|
*/
|
|
581
|
-
declare function
|
|
418
|
+
declare function useConfidentialIsOperatorSuspense(config: UseConfidentialIsOperatorSuspenseConfig): import("@tanstack/react-query").UseSuspenseQueryResult<boolean, Error>;
|
|
582
419
|
//#endregion
|
|
583
420
|
//#region src/shield/use-shield.d.ts
|
|
584
421
|
/** Configuration for {@link useShield}. */
|
|
585
|
-
interface UseShieldConfig
|
|
422
|
+
interface UseShieldConfig {
|
|
423
|
+
/** Address of the confidential wrapper contract. */
|
|
424
|
+
address: Address;
|
|
586
425
|
/**
|
|
587
426
|
* When `true`, optimistically adds the wrap amount to the cached confidential balance
|
|
588
427
|
* before the transaction confirms. Rolls back on error.
|
|
@@ -596,20 +435,18 @@ interface UseShieldConfig extends UseZamaConfig {
|
|
|
596
435
|
*
|
|
597
436
|
* Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
|
|
598
437
|
* - {@link SigningRejectedError} — user rejected the wallet prompt
|
|
599
|
-
* - {@link
|
|
600
|
-
* - {@link TransactionRevertedError} — shield transaction reverted
|
|
438
|
+
* - {@link TransactionRevertedError} — approval or shield transaction reverted
|
|
601
439
|
*
|
|
602
|
-
* @param config -
|
|
603
|
-
* Set `optimistic: true` to add the amount to the cached balance immediately.
|
|
440
|
+
* @param config - Wrapper address (and optional `optimistic` flag).
|
|
604
441
|
* @param options - React Query mutation options.
|
|
605
442
|
*
|
|
606
443
|
* @example
|
|
607
444
|
* ```tsx
|
|
608
|
-
* const shield = useShield({
|
|
445
|
+
* const shield = useShield({ address: "0xWrapper", optimistic: true });
|
|
609
446
|
* shield.mutate({ amount: 1000n });
|
|
610
447
|
* ```
|
|
611
448
|
*/
|
|
612
|
-
declare function useShield<TContext = unknown>(config: UseShieldConfig, options?: UseMutationOptions<TransactionResult
|
|
449
|
+
declare function useShield<TContext = unknown>(config: UseShieldConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldParams, TContext>): UseMutationResult<TransactionResult, Error, ShieldParams, TContext>;
|
|
613
450
|
//#endregion
|
|
614
451
|
//#region src/unwrap/use-unwrap.d.ts
|
|
615
452
|
/**
|
|
@@ -622,16 +459,16 @@ declare function useShield<TContext = unknown>(config: UseShieldConfig, options?
|
|
|
622
459
|
* - {@link EncryptionFailedError} — FHE encryption of the unwrap amount failed
|
|
623
460
|
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
624
461
|
*
|
|
625
|
-
* @param
|
|
462
|
+
* @param address - Address of the confidential wrapper contract.
|
|
626
463
|
* @param options - React Query mutation options.
|
|
627
464
|
*
|
|
628
465
|
* @example
|
|
629
466
|
* ```tsx
|
|
630
|
-
* const unwrap = useUnwrap(
|
|
467
|
+
* const unwrap = useUnwrap("0xWrapper");
|
|
631
468
|
* unwrap.mutate({ amount: 500n });
|
|
632
469
|
* ```
|
|
633
470
|
*/
|
|
634
|
-
declare function useUnwrap(
|
|
471
|
+
declare function useUnwrap(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, UnwrapParams, `0x${string}`>;
|
|
635
472
|
//#endregion
|
|
636
473
|
//#region src/unwrap/use-unwrap-all.d.ts
|
|
637
474
|
/**
|
|
@@ -643,16 +480,16 @@ declare function useUnwrap(config: UseZamaConfig, options?: UseMutationOptions<T
|
|
|
643
480
|
* - {@link SigningRejectedError} — user rejected the wallet prompt
|
|
644
481
|
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
645
482
|
*
|
|
646
|
-
* @param
|
|
483
|
+
* @param address - Address of the confidential wrapper contract.
|
|
647
484
|
* @param options - React Query mutation options.
|
|
648
485
|
*
|
|
649
486
|
* @example
|
|
650
487
|
* ```tsx
|
|
651
|
-
* const unwrapAll = useUnwrapAll(
|
|
488
|
+
* const unwrapAll = useUnwrapAll("0xWrapper");
|
|
652
489
|
* unwrapAll.mutate();
|
|
653
490
|
* ```
|
|
654
491
|
*/
|
|
655
|
-
declare function useUnwrapAll(
|
|
492
|
+
declare function useUnwrapAll(address: Address, options?: UseMutationOptions<TransactionResult, Error, void, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, void, `0x${string}`>;
|
|
656
493
|
//#endregion
|
|
657
494
|
//#region src/unwrap/use-finalize-unwrap.d.ts
|
|
658
495
|
/**
|
|
@@ -664,16 +501,18 @@ declare function useUnwrapAll(config: UseZamaConfig, options?: UseMutationOption
|
|
|
664
501
|
* - {@link DecryptionFailedError} — public decryption of the burn amount failed
|
|
665
502
|
* - {@link TransactionRevertedError} — on-chain finalize transaction reverted
|
|
666
503
|
*
|
|
667
|
-
* @param
|
|
504
|
+
* @param address - Address of the confidential wrapper contract.
|
|
668
505
|
* @param options - React Query mutation options.
|
|
669
506
|
*
|
|
670
507
|
* @example
|
|
671
508
|
* ```tsx
|
|
672
|
-
* const finalize = useFinalizeUnwrap(
|
|
673
|
-
*
|
|
509
|
+
* const finalize = useFinalizeUnwrap("0xWrapper");
|
|
510
|
+
* const event = findUnwrapRequested(receipt.logs);
|
|
511
|
+
* if (!event?.unwrapRequestId) throw new Error("UnwrapRequested event missing");
|
|
512
|
+
* finalize.mutate({ unwrapRequestId: event.unwrapRequestId });
|
|
674
513
|
* ```
|
|
675
514
|
*/
|
|
676
|
-
declare function useFinalizeUnwrap(
|
|
515
|
+
declare function useFinalizeUnwrap(address: Address, options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, FinalizeUnwrapParams, `0x${string}`>;
|
|
677
516
|
//#endregion
|
|
678
517
|
//#region src/unshield/use-unshield.d.ts
|
|
679
518
|
/**
|
|
@@ -686,16 +525,16 @@ declare function useFinalizeUnwrap(config: UseZamaConfig, options?: UseMutationO
|
|
|
686
525
|
* - {@link DecryptionFailedError} — public decryption failed during finalize
|
|
687
526
|
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
688
527
|
*
|
|
689
|
-
* @param
|
|
528
|
+
* @param address - Address of the confidential wrapper contract.
|
|
690
529
|
* @param options - React Query mutation options.
|
|
691
530
|
*
|
|
692
531
|
* @example
|
|
693
532
|
* ```tsx
|
|
694
|
-
* const unshield = useUnshield(
|
|
533
|
+
* const unshield = useUnshield("0xWrapper");
|
|
695
534
|
* unshield.mutate({ amount: 500n });
|
|
696
535
|
* ```
|
|
697
536
|
*/
|
|
698
|
-
declare function useUnshield(
|
|
537
|
+
declare function useUnshield(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnshieldParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, UnshieldParams, `0x${string}`>;
|
|
699
538
|
//#endregion
|
|
700
539
|
//#region src/unshield/use-unshield-all.d.ts
|
|
701
540
|
/**
|
|
@@ -707,16 +546,16 @@ declare function useUnshield(config: UseZamaConfig, options?: UseMutationOptions
|
|
|
707
546
|
* - {@link DecryptionFailedError} — public decryption failed during finalize
|
|
708
547
|
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
709
548
|
*
|
|
710
|
-
* @param
|
|
549
|
+
* @param address - Address of the confidential wrapper contract.
|
|
711
550
|
* @param options - React Query mutation options.
|
|
712
551
|
*
|
|
713
552
|
* @example
|
|
714
553
|
* ```tsx
|
|
715
|
-
* const unshieldAll = useUnshieldAll(
|
|
554
|
+
* const unshieldAll = useUnshieldAll("0xWrapper");
|
|
716
555
|
* unshieldAll.mutate();
|
|
717
556
|
* ```
|
|
718
557
|
*/
|
|
719
|
-
declare function useUnshieldAll(
|
|
558
|
+
declare function useUnshieldAll(address: Address, options?: UseMutationOptions<TransactionResult, Error, UnshieldAllParams | void, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, void | UnshieldAllParams, `0x${string}`>;
|
|
720
559
|
//#endregion
|
|
721
560
|
//#region src/unshield/use-resume-unshield.d.ts
|
|
722
561
|
/**
|
|
@@ -728,58 +567,56 @@ declare function useUnshieldAll(config: UseZamaConfig, options?: UseMutationOpti
|
|
|
728
567
|
* - {@link DecryptionFailedError} — public decryption failed during finalize
|
|
729
568
|
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
730
569
|
*
|
|
731
|
-
* @param
|
|
570
|
+
* @param address - Address of the confidential wrapper contract.
|
|
732
571
|
* @param options - React Query mutation options.
|
|
733
572
|
*
|
|
734
573
|
* @example
|
|
735
574
|
* ```tsx
|
|
736
|
-
* const resumeUnshield = useResumeUnshield(
|
|
575
|
+
* const resumeUnshield = useResumeUnshield("0xWrapper");
|
|
737
576
|
* resumeUnshield.mutate({ unwrapTxHash: "0xabc..." });
|
|
738
577
|
* ```
|
|
739
578
|
*/
|
|
740
|
-
declare function useResumeUnshield(
|
|
579
|
+
declare function useResumeUnshield(address: Address, options?: UseMutationOptions<TransactionResult, Error, ResumeUnshieldParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ResumeUnshieldParams, `0x${string}`>;
|
|
741
580
|
//#endregion
|
|
742
581
|
//#region src/shield/use-underlying-allowance.d.ts
|
|
743
|
-
/** Configuration for {@link useUnderlyingAllowance}. */
|
|
744
582
|
interface UseUnderlyingAllowanceConfig {
|
|
745
|
-
/** Address of the confidential
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
|
|
583
|
+
/** Address of the confidential wrapper contract. */
|
|
584
|
+
address: Address;
|
|
585
|
+
/** Owner to fetch allowance for. The query is disabled while `undefined`. */
|
|
586
|
+
owner: Address | undefined;
|
|
587
|
+
}
|
|
588
|
+
interface UseUnderlyingAllowanceSuspenseConfig {
|
|
589
|
+
/** Address of the confidential wrapper contract. */
|
|
590
|
+
address: Address;
|
|
591
|
+
/** Owner to fetch allowance for. */
|
|
592
|
+
owner: Address;
|
|
749
593
|
}
|
|
750
594
|
/**
|
|
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).
|
|
595
|
+
* Hook for fetching the underlying ERC-20 allowance granted to the wrapper
|
|
596
|
+
* contract. Useful to check if an approval is needed before shielding.
|
|
757
597
|
*
|
|
758
598
|
* @example
|
|
759
599
|
* ```tsx
|
|
760
600
|
* const { data: allowance } = useUnderlyingAllowance({
|
|
761
|
-
*
|
|
762
|
-
*
|
|
601
|
+
* address: "0xWrapper",
|
|
602
|
+
* owner: "0xOwner",
|
|
763
603
|
* });
|
|
764
604
|
* ```
|
|
765
605
|
*/
|
|
766
|
-
declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">):
|
|
606
|
+
declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
767
607
|
/**
|
|
768
|
-
* Suspense variant of {@link useUnderlyingAllowance}.
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
* @param config - Token and wrapper addresses.
|
|
772
|
-
* @returns Suspense query result with `data: bigint`.
|
|
608
|
+
* Suspense variant of {@link useUnderlyingAllowance}. Suspends rendering until
|
|
609
|
+
* the allowance resolves.
|
|
773
610
|
*
|
|
774
611
|
* @example
|
|
775
612
|
* ```tsx
|
|
776
613
|
* const { data: allowance } = useUnderlyingAllowanceSuspense({
|
|
777
|
-
*
|
|
778
|
-
*
|
|
614
|
+
* address: "0xWrapper",
|
|
615
|
+
* owner: "0xOwner",
|
|
779
616
|
* });
|
|
780
617
|
* ```
|
|
781
618
|
*/
|
|
782
|
-
declare function useUnderlyingAllowanceSuspense(config:
|
|
619
|
+
declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceSuspenseConfig): import("@tanstack/react-query").UseSuspenseQueryResult<bigint, Error>;
|
|
783
620
|
//#endregion
|
|
784
621
|
//#region src/token/use-wrapper-discovery.d.ts
|
|
785
622
|
/** Configuration for {@link useWrapperDiscovery}. */
|
|
@@ -789,9 +626,9 @@ interface UseWrapperDiscoveryConfig {
|
|
|
789
626
|
* Used only to derive the signer context and to scope the query cache key —
|
|
790
627
|
* it does not affect which wrapper the registry returns.
|
|
791
628
|
*/
|
|
792
|
-
tokenAddress: Address
|
|
629
|
+
tokenAddress: Address;
|
|
793
630
|
/** ERC-20 address to discover the wrapper for. Pass `undefined` to disable the query. */
|
|
794
|
-
erc20Address: Address
|
|
631
|
+
erc20Address: Address | undefined;
|
|
795
632
|
}
|
|
796
633
|
/** Configuration for {@link useWrapperDiscoverySuspense}. */
|
|
797
634
|
interface UseWrapperDiscoverySuspenseConfig {
|
|
@@ -800,9 +637,9 @@ interface UseWrapperDiscoverySuspenseConfig {
|
|
|
800
637
|
* Used only to derive the signer context and to scope the query cache key —
|
|
801
638
|
* it does not affect which wrapper the registry returns.
|
|
802
639
|
*/
|
|
803
|
-
tokenAddress: Address
|
|
640
|
+
tokenAddress: Address;
|
|
804
641
|
/** ERC-20 address to discover the wrapper for. */
|
|
805
|
-
erc20Address: Address
|
|
642
|
+
erc20Address: Address;
|
|
806
643
|
}
|
|
807
644
|
/**
|
|
808
645
|
* Discover the confidential wrapper for an ERC-20 token via the on-chain registry.
|
|
@@ -821,7 +658,7 @@ interface UseWrapperDiscoverySuspenseConfig {
|
|
|
821
658
|
* });
|
|
822
659
|
* ```
|
|
823
660
|
*/
|
|
824
|
-
declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address
|
|
661
|
+
declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address | null>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<`0x${string}` | null, Error>;
|
|
825
662
|
/**
|
|
826
663
|
* Suspense variant of {@link useWrapperDiscovery}.
|
|
827
664
|
* Suspends rendering until the wrapper address is resolved.
|
|
@@ -837,7 +674,7 @@ declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?
|
|
|
837
674
|
* });
|
|
838
675
|
* ```
|
|
839
676
|
*/
|
|
840
|
-
declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig):
|
|
677
|
+
declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig): import("@tanstack/react-query").UseSuspenseQueryResult<`0x${string}` | null, Error>;
|
|
841
678
|
//#endregion
|
|
842
679
|
//#region src/token/use-metadata.d.ts
|
|
843
680
|
/**
|
|
@@ -854,7 +691,7 @@ declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspense
|
|
|
854
691
|
* // metadata?.name, metadata?.symbol, metadata?.decimals
|
|
855
692
|
* ```
|
|
856
693
|
*/
|
|
857
|
-
declare function useMetadata(tokenAddress: Address
|
|
694
|
+
declare function useMetadata(tokenAddress: Address, options?: Omit<UseQueryOptions<TokenMetadata>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<TokenMetadata, Error>;
|
|
858
695
|
/**
|
|
859
696
|
* Suspense variant of {@link useMetadata}.
|
|
860
697
|
* Suspends rendering until metadata is loaded.
|
|
@@ -867,105 +704,72 @@ declare function useMetadata(tokenAddress: Address$1, options?: Omit<UseQueryOpt
|
|
|
867
704
|
* const { data: metadata } = useMetadataSuspense("0xToken");
|
|
868
705
|
* ```
|
|
869
706
|
*/
|
|
870
|
-
declare function useMetadataSuspense(tokenAddress: Address
|
|
871
|
-
//#endregion
|
|
872
|
-
//#region src/balance/use-activity-feed.d.ts
|
|
873
|
-
/** Configuration for {@link useActivityFeed}. */
|
|
874
|
-
interface UseActivityFeedConfig {
|
|
875
|
-
/** Address of the confidential token contract. */
|
|
876
|
-
tokenAddress: Address$1;
|
|
877
|
-
/** Connected wallet address. Pass `undefined` to disable the query. */
|
|
878
|
-
userAddress: Address$1 | undefined;
|
|
879
|
-
/** Raw event logs from the provider (viem, ethers, etc.). Pass `undefined` to disable. */
|
|
880
|
-
logs: readonly (RawLog$1 & Partial<ActivityLogMetadata$1>)[] | undefined;
|
|
881
|
-
/** Whether to batch-decrypt encrypted transfer amounts. Default: `true`. */
|
|
882
|
-
decrypt?: boolean;
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
* Two-phase activity feed hook.
|
|
886
|
-
* Phase 1: Instantly parses raw logs into classified {@link ActivityItem}s (sync, cheap).
|
|
887
|
-
* Phase 2: Batch-decrypts encrypted transfer amounts via the relayer (async).
|
|
888
|
-
*
|
|
889
|
-
* The wallet provides logs (from its own provider — viem, ethers, etc.)
|
|
890
|
-
* and this hook normalizes + decrypts them.
|
|
891
|
-
*
|
|
892
|
-
* @param config - Token address, user address, raw logs, and decrypt option.
|
|
893
|
-
* @returns Query result with `data: ActivityItem[]`.
|
|
894
|
-
*
|
|
895
|
-
* @example
|
|
896
|
-
* ```tsx
|
|
897
|
-
* const { data: activity } = useActivityFeed({
|
|
898
|
-
* tokenAddress: "0xToken",
|
|
899
|
-
* userAddress: "0xUser",
|
|
900
|
-
* logs: rawLogs,
|
|
901
|
-
* });
|
|
902
|
-
* ```
|
|
903
|
-
*/
|
|
904
|
-
declare function useActivityFeed(config: UseActivityFeedConfig): _$_tanstack_react_query0.UseQueryResult<ActivityItem$1[], Error>;
|
|
707
|
+
declare function useMetadataSuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<TokenMetadata, Error>;
|
|
905
708
|
//#endregion
|
|
906
|
-
//#region src/
|
|
709
|
+
//#region src/delegations/use-delegate-decryption.d.ts
|
|
907
710
|
/**
|
|
908
|
-
* Delegate FHE decryption rights for a
|
|
711
|
+
* Delegate FHE decryption rights for a confidential contract to another address
|
|
712
|
+
* via the on-chain ACL.
|
|
909
713
|
*
|
|
910
|
-
* @param
|
|
714
|
+
* @param address - Confidential contract address to delegate on.
|
|
911
715
|
* @param options - React Query mutation options.
|
|
912
716
|
*
|
|
913
717
|
* @example
|
|
914
718
|
* ```tsx
|
|
915
|
-
* const delegate = useDelegateDecryption(
|
|
719
|
+
* const delegate = useDelegateDecryption("0xToken");
|
|
916
720
|
* delegate.mutate({ delegateAddress: "0xDelegate" });
|
|
917
721
|
* ```
|
|
918
722
|
*/
|
|
919
|
-
declare function useDelegateDecryption(
|
|
723
|
+
declare function useDelegateDecryption(address: Address, options?: UseMutationOptions<TransactionResult, Error, DelegateDecryptionParams>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, DelegateDecryptionParams, unknown>;
|
|
920
724
|
//#endregion
|
|
921
|
-
//#region src/
|
|
725
|
+
//#region src/delegations/use-revoke-delegation.d.ts
|
|
922
726
|
/**
|
|
923
|
-
* Revoke FHE decryption delegation for a
|
|
727
|
+
* Revoke FHE decryption delegation for a confidential contract from a delegate address.
|
|
924
728
|
*
|
|
925
|
-
* @param
|
|
729
|
+
* @param address - Confidential contract address to revoke delegation on.
|
|
926
730
|
* @param options - React Query mutation options.
|
|
927
731
|
*
|
|
928
732
|
* @example
|
|
929
733
|
* ```tsx
|
|
930
|
-
* const revoke = useRevokeDelegation(
|
|
734
|
+
* const revoke = useRevokeDelegation("0xToken");
|
|
931
735
|
* revoke.mutate({ delegateAddress: "0xDelegate" });
|
|
932
736
|
* ```
|
|
933
737
|
*/
|
|
934
|
-
declare function useRevokeDelegation(
|
|
738
|
+
declare function useRevokeDelegation(address: Address, options?: UseMutationOptions<TransactionResult, Error, RevokeDelegationParams>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, RevokeDelegationParams, unknown>;
|
|
935
739
|
//#endregion
|
|
936
|
-
//#region src/
|
|
740
|
+
//#region src/delegations/use-delegation-status.d.ts
|
|
937
741
|
interface UseDelegationStatusConfig {
|
|
938
|
-
/** Address of the confidential
|
|
939
|
-
|
|
742
|
+
/** Address of the confidential contract. Pass `undefined` to disable the query. */
|
|
743
|
+
contractAddress: Address | undefined;
|
|
940
744
|
/** The address that granted the delegation. */
|
|
941
|
-
delegatorAddress?: Address
|
|
745
|
+
delegatorAddress?: Address;
|
|
942
746
|
/** The address that received delegation rights. */
|
|
943
|
-
delegateAddress?: Address
|
|
747
|
+
delegateAddress?: Address;
|
|
944
748
|
}
|
|
945
749
|
/**
|
|
946
750
|
* Query delegation status between a delegator and delegate for a token.
|
|
947
751
|
*
|
|
948
752
|
* @param config - Token address, delegator, and delegate addresses.
|
|
949
753
|
* @param options - React Query options (forwarded to `useQuery`).
|
|
950
|
-
* @returns `{
|
|
754
|
+
* @returns `{ isActive, expiryTimestamp, isLoading, error }`.
|
|
951
755
|
*
|
|
952
756
|
* @example
|
|
953
757
|
* ```tsx
|
|
954
758
|
* const { data } = useDelegationStatus({
|
|
955
|
-
*
|
|
759
|
+
* contractAddress: "0xToken",
|
|
956
760
|
* delegatorAddress: "0xDelegator",
|
|
957
761
|
* delegateAddress: "0xDelegate",
|
|
958
762
|
* });
|
|
959
|
-
* // data?.
|
|
763
|
+
* // data?.isActive, data?.expiryTimestamp
|
|
960
764
|
* ```
|
|
961
765
|
*/
|
|
962
|
-
declare function useDelegationStatus(config: UseDelegationStatusConfig, options?: Omit<UseQueryOptions<DelegationStatusData
|
|
766
|
+
declare function useDelegationStatus(config: UseDelegationStatusConfig, options?: Omit<UseQueryOptions<DelegationStatusData>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<DelegationStatusData, Error>;
|
|
963
767
|
//#endregion
|
|
964
|
-
//#region src/
|
|
768
|
+
//#region src/delegations/use-decrypt-balance-as.d.ts
|
|
965
769
|
/**
|
|
966
770
|
* Decrypt another user's confidential balance as a delegate.
|
|
967
771
|
*
|
|
968
|
-
* @param
|
|
772
|
+
* @param address - Address of the confidential token contract.
|
|
969
773
|
* @param options - React Query mutation options.
|
|
970
774
|
*
|
|
971
775
|
* @example
|
|
@@ -975,13 +779,13 @@ declare function useDelegationStatus(config: UseDelegationStatusConfig, options?
|
|
|
975
779
|
* // decryptAs.data => 1000n
|
|
976
780
|
* ```
|
|
977
781
|
*/
|
|
978
|
-
declare function useDecryptBalanceAs(
|
|
782
|
+
declare function useDecryptBalanceAs(address: Address, options?: UseMutationOptions<bigint, Error, DecryptBalanceAsParams>): import("@tanstack/react-query").UseMutationResult<bigint, Error, DecryptBalanceAsParams, unknown>;
|
|
979
783
|
//#endregion
|
|
980
|
-
//#region src/
|
|
784
|
+
//#region src/delegations/use-batch-decrypt-balances-as.d.ts
|
|
981
785
|
/**
|
|
982
786
|
* Batch decrypt confidential balances as a delegate across multiple tokens.
|
|
983
787
|
*
|
|
984
|
-
* @param tokens -
|
|
788
|
+
* @param tokens - {@link Token} instances to decrypt balances for.
|
|
985
789
|
* @param options - React Query mutation options.
|
|
986
790
|
*
|
|
987
791
|
* @example
|
|
@@ -993,7 +797,7 @@ declare function useDecryptBalanceAs(tokenAddress: Address$1, options?: UseMutat
|
|
|
993
797
|
* // batchDecryptAs.data => Map { "0xTokenA" => 100n, "0xTokenB" => 200n }
|
|
994
798
|
* ```
|
|
995
799
|
*/
|
|
996
|
-
declare function useBatchDecryptBalancesAs(tokens:
|
|
800
|
+
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>;
|
|
997
801
|
//#endregion
|
|
998
802
|
//#region src/shield/use-approve-underlying.d.ts
|
|
999
803
|
/**
|
|
@@ -1005,17 +809,17 @@ declare function useBatchDecryptBalancesAs(tokens: ReadonlyToken$1[], options?:
|
|
|
1005
809
|
* - {@link SigningRejectedError} — user rejected the wallet prompt
|
|
1006
810
|
* - {@link TransactionRevertedError} — approval transaction reverted
|
|
1007
811
|
*
|
|
1008
|
-
* @param
|
|
812
|
+
* @param address - Address of the confidential wrapper contract.
|
|
1009
813
|
* @param options - React Query mutation options.
|
|
1010
814
|
*
|
|
1011
815
|
* @example
|
|
1012
816
|
* ```tsx
|
|
1013
|
-
* const approve = useApproveUnderlying(
|
|
817
|
+
* const approve = useApproveUnderlying("0xWrapper");
|
|
1014
818
|
* approve.mutate({}); // max approval
|
|
1015
819
|
* approve.mutate({ amount: 1000n }); // exact amount
|
|
1016
820
|
* ```
|
|
1017
821
|
*/
|
|
1018
|
-
declare function useApproveUnderlying(
|
|
822
|
+
declare function useApproveUnderlying(address: Address, options?: UseMutationOptions<TransactionResult, Error, ApproveUnderlyingParams, Address>): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, ApproveUnderlyingParams, `0x${string}`>;
|
|
1019
823
|
//#endregion
|
|
1020
824
|
//#region src/token/use-is-confidential.d.ts
|
|
1021
825
|
/**
|
|
@@ -1031,7 +835,7 @@ declare function useApproveUnderlying(config: UseZamaConfig, options?: UseMutati
|
|
|
1031
835
|
* const { data: isConfidential } = useIsConfidential("0xToken");
|
|
1032
836
|
* ```
|
|
1033
837
|
*/
|
|
1034
|
-
declare function useIsConfidential(tokenAddress: Address
|
|
838
|
+
declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
1035
839
|
/**
|
|
1036
840
|
* Suspense variant of {@link useIsConfidential}.
|
|
1037
841
|
* Suspends rendering until the ERC-165 check resolves.
|
|
@@ -1044,7 +848,7 @@ declare function useIsConfidential(tokenAddress: Address$1, options?: Omit<UseQu
|
|
|
1044
848
|
* const { data: isConfidential } = useIsConfidentialSuspense("0xToken");
|
|
1045
849
|
* ```
|
|
1046
850
|
*/
|
|
1047
|
-
declare function useIsConfidentialSuspense(tokenAddress: Address
|
|
851
|
+
declare function useIsConfidentialSuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<boolean, Error>;
|
|
1048
852
|
/**
|
|
1049
853
|
* Check if a token supports the ERC-7984 wrapper interface via ERC-165.
|
|
1050
854
|
* Result is cached indefinitely since interface support does not change.
|
|
@@ -1058,7 +862,7 @@ declare function useIsConfidentialSuspense(tokenAddress: Address$1): _$_tanstack
|
|
|
1058
862
|
* const { data: isWrapper } = useIsWrapper("0xToken");
|
|
1059
863
|
* ```
|
|
1060
864
|
*/
|
|
1061
|
-
declare function useIsWrapper(tokenAddress: Address
|
|
865
|
+
declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
1062
866
|
/**
|
|
1063
867
|
* Suspense variant of {@link useIsWrapper}.
|
|
1064
868
|
* Suspends rendering until the ERC-165 check resolves.
|
|
@@ -1071,7 +875,7 @@ declare function useIsWrapper(tokenAddress: Address$1, options?: Omit<UseQueryOp
|
|
|
1071
875
|
* const { data: isWrapper } = useIsWrapperSuspense("0xToken");
|
|
1072
876
|
* ```
|
|
1073
877
|
*/
|
|
1074
|
-
declare function useIsWrapperSuspense(tokenAddress: Address
|
|
878
|
+
declare function useIsWrapperSuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<boolean, Error>;
|
|
1075
879
|
//#endregion
|
|
1076
880
|
//#region src/token/use-total-supply.d.ts
|
|
1077
881
|
/**
|
|
@@ -1087,7 +891,7 @@ declare function useIsWrapperSuspense(tokenAddress: Address$1): _$_tanstack_reac
|
|
|
1087
891
|
* const { data: totalSupply } = useTotalSupply("0xToken");
|
|
1088
892
|
* ```
|
|
1089
893
|
*/
|
|
1090
|
-
declare function useTotalSupply(tokenAddress: Address
|
|
894
|
+
declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOptions<bigint>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
1091
895
|
/**
|
|
1092
896
|
* Suspense variant of {@link useTotalSupply}.
|
|
1093
897
|
* Suspends rendering until the total supply is loaded.
|
|
@@ -1100,13 +904,12 @@ declare function useTotalSupply(tokenAddress: Address$1, options?: Omit<UseQuery
|
|
|
1100
904
|
* const { data: totalSupply } = useTotalSupplySuspense("0xToken");
|
|
1101
905
|
* ```
|
|
1102
906
|
*/
|
|
1103
|
-
declare function useTotalSupplySuspense(tokenAddress: Address
|
|
907
|
+
declare function useTotalSupplySuspense(tokenAddress: Address): import("@tanstack/react-query").UseSuspenseQueryResult<bigint, Error>;
|
|
1104
908
|
//#endregion
|
|
1105
909
|
//#region src/wrappers-registry/use-wrappers-registry-address.d.ts
|
|
1106
910
|
/**
|
|
1107
911
|
* Resolves the wrappers registry address for the current chain.
|
|
1108
|
-
* Uses the
|
|
1109
|
-
* plus any `registryAddresses` overrides passed to `ZamaSDKConfig`).
|
|
912
|
+
* Uses the registry addresses from `sdk.registry` (built-in defaults from chain configs).
|
|
1110
913
|
*
|
|
1111
914
|
* Returns `undefined` when the chain ID hasn't been fetched yet
|
|
1112
915
|
* or when no registry is configured for the connected chain.
|
|
@@ -1114,20 +917,20 @@ declare function useTotalSupplySuspense(tokenAddress: Address$1): _$_tanstack_re
|
|
|
1114
917
|
* The chain ID is cached for 30 seconds (`staleTime`), so chain
|
|
1115
918
|
* switches may take up to 30s to reflect.
|
|
1116
919
|
*/
|
|
1117
|
-
declare function useWrappersRegistryAddress(): Address
|
|
920
|
+
declare function useWrappersRegistryAddress(): Address | undefined;
|
|
1118
921
|
//#endregion
|
|
1119
922
|
//#region src/wrappers-registry/use-token-pairs-registry.d.ts
|
|
1120
923
|
/**
|
|
1121
924
|
* Fetches all token wrapper pairs from the ConfidentialTokenWrappersRegistry
|
|
1122
925
|
* contract on the current chain.
|
|
1123
926
|
*/
|
|
1124
|
-
declare function useTokenPairsRegistry():
|
|
927
|
+
declare function useTokenPairsRegistry(): import("@tanstack/react-query").UseQueryResult<readonly TokenWrapperPair[], Error>;
|
|
1125
928
|
//#endregion
|
|
1126
929
|
//#region src/wrappers-registry/use-token-pairs-length.d.ts
|
|
1127
930
|
/**
|
|
1128
931
|
* Returns the total number of token wrapper pairs in the registry.
|
|
1129
932
|
*/
|
|
1130
|
-
declare function useTokenPairsLength():
|
|
933
|
+
declare function useTokenPairsLength(): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
1131
934
|
//#endregion
|
|
1132
935
|
//#region src/wrappers-registry/use-token-pairs-slice.d.ts
|
|
1133
936
|
/**
|
|
@@ -1142,7 +945,7 @@ declare function useTokenPairsSlice({
|
|
|
1142
945
|
}: {
|
|
1143
946
|
fromIndex: bigint | undefined;
|
|
1144
947
|
toIndex: bigint | undefined;
|
|
1145
|
-
}):
|
|
948
|
+
}): import("@tanstack/react-query").UseQueryResult<readonly TokenWrapperPair[], Error>;
|
|
1146
949
|
//#endregion
|
|
1147
950
|
//#region src/wrappers-registry/use-token-pair.d.ts
|
|
1148
951
|
/**
|
|
@@ -1154,7 +957,7 @@ declare function useTokenPair({
|
|
|
1154
957
|
index
|
|
1155
958
|
}: {
|
|
1156
959
|
index: bigint | undefined;
|
|
1157
|
-
}):
|
|
960
|
+
}): import("@tanstack/react-query").UseQueryResult<TokenWrapperPair, Error>;
|
|
1158
961
|
//#endregion
|
|
1159
962
|
//#region src/wrappers-registry/use-confidential-token-address.d.ts
|
|
1160
963
|
/**
|
|
@@ -1163,8 +966,8 @@ declare function useTokenPair({
|
|
|
1163
966
|
declare function useConfidentialTokenAddress({
|
|
1164
967
|
tokenAddress
|
|
1165
968
|
}: {
|
|
1166
|
-
tokenAddress: Address
|
|
1167
|
-
}):
|
|
969
|
+
tokenAddress: Address | undefined;
|
|
970
|
+
}): import("@tanstack/react-query").UseQueryResult<readonly [boolean, `0x${string}`], Error>;
|
|
1168
971
|
//#endregion
|
|
1169
972
|
//#region src/wrappers-registry/use-token-address.d.ts
|
|
1170
973
|
/**
|
|
@@ -1173,8 +976,8 @@ declare function useConfidentialTokenAddress({
|
|
|
1173
976
|
declare function useTokenAddress({
|
|
1174
977
|
confidentialTokenAddress
|
|
1175
978
|
}: {
|
|
1176
|
-
confidentialTokenAddress: Address
|
|
1177
|
-
}):
|
|
979
|
+
confidentialTokenAddress: Address | undefined;
|
|
980
|
+
}): import("@tanstack/react-query").UseQueryResult<readonly [boolean, `0x${string}`], Error>;
|
|
1178
981
|
//#endregion
|
|
1179
982
|
//#region src/wrappers-registry/use-is-confidential-token-valid.d.ts
|
|
1180
983
|
/**
|
|
@@ -1186,8 +989,8 @@ declare function useTokenAddress({
|
|
|
1186
989
|
declare function useIsConfidentialTokenValid({
|
|
1187
990
|
confidentialTokenAddress
|
|
1188
991
|
}: {
|
|
1189
|
-
confidentialTokenAddress: Address
|
|
1190
|
-
}):
|
|
992
|
+
confidentialTokenAddress: Address | undefined;
|
|
993
|
+
}): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
1191
994
|
//#endregion
|
|
1192
995
|
//#region src/wrappers-registry/use-list-pairs.d.ts
|
|
1193
996
|
/**
|
|
@@ -1211,15 +1014,7 @@ declare function useListPairs({
|
|
|
1211
1014
|
page?: number;
|
|
1212
1015
|
pageSize?: number;
|
|
1213
1016
|
metadata?: boolean;
|
|
1214
|
-
}):
|
|
1215
|
-
//#endregion
|
|
1216
|
-
//#region src/balance/optimistic-balance-update.d.ts
|
|
1217
|
-
type OptimisticBalanceSnapshot = [QueryKey, bigint | undefined][];
|
|
1218
|
-
/** Combined context returned by optimistic `onMutate`. */
|
|
1219
|
-
interface OptimisticMutateContext {
|
|
1220
|
-
snapshot: OptimisticBalanceSnapshot;
|
|
1221
|
-
callerContext?: unknown;
|
|
1222
|
-
}
|
|
1017
|
+
}): import("@tanstack/react-query").UseQueryResult<PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>, Error>;
|
|
1223
1018
|
//#endregion
|
|
1224
|
-
export {
|
|
1019
|
+
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 };
|
|
1225
1020
|
//# sourceMappingURL=index.d.ts.map
|