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