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