@zama-fhe/react-sdk 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/README.md +990 -0
- package/dist/chunk-463DUSLG.js +1005 -0
- package/dist/chunk-463DUSLG.js.map +1 -0
- package/dist/ethers/index.d.ts +142 -0
- package/dist/ethers/index.js +173 -0
- package/dist/ethers/index.js.map +1 -0
- package/dist/index.d.ts +1082 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/use-approve-underlying-DAkxWhfm.d.ts +784 -0
- package/dist/viem/index.d.ts +142 -0
- package/dist/viem/index.js +173 -0
- package/dist/viem/index.js.map +1 -0
- package/dist/wagmi/index.d.ts +7139 -0
- package/dist/wagmi/index.js +280 -0
- package/dist/wagmi/index.js.map +1 -0
- package/package.json +91 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1082 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as _zama_fhe_sdk from '@zama-fhe/sdk';
|
|
3
|
+
import { RelayerSDK, GenericSigner, GenericStringStorage, ZamaSDKEventListener, ZamaSDK, EncryptParams, EncryptResult, UserDecryptParams, PublicDecryptResult, FHEKeypair, EIP712TypedData, Address, DelegatedUserDecryptParams, ZKProofLike, Token, TransactionResult, ReadonlyToken } from '@zama-fhe/sdk';
|
|
4
|
+
export { ActivityAmount, ActivityDirection, ActivityItem, ActivityLogMetadata, ActivityType, Address, ApprovalFailedError, ApproveSubmittedEvent, ApproveUnderlyingSubmittedEvent, BATCH_SWAP_ABI, BatchDecryptOptions, BatchTransferData, ConfidentialTransferEvent, ContractCallConfig, CredentialExpiredError, CredentialsCachedEvent, CredentialsCreatedEvent, CredentialsCreatingEvent, CredentialsExpiredEvent, CredentialsLoadingEvent, CredentialsManager, DEPLOYMENT_COORDINATOR_ABI, DecryptEndEvent, DecryptErrorEvent, DecryptStartEvent, DecryptionFailedError, DelegatedUserDecryptParams, EIP712TypedData, ENCRYPTION_ABI, ERC165_ABI, ERC20_ABI, ERC20_METADATA_ABI, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, EncryptEndEvent, EncryptErrorEvent, EncryptParams, EncryptResult, EncryptStartEvent, EncryptionFailedError, FEE_MANAGER_ABI, FHEKeypair, FhevmInstanceConfig, FinalizeUnwrapSubmittedEvent, GenericSigner, GenericStringStorage, HardhatConfig, Hex, IndexedDBStorage, InputProofBytesType, InvalidCredentialsError, KmsDelegatedUserDecryptEIP712Type, MainnetConfig, MemoryStorage, NetworkType, NoCiphertextError, OnChainEvent, PublicDecryptResult, RawLog, ReadonlyToken, ReadonlyTokenConfig, RelayerRequestFailedError, RelayerSDK, RelayerSDKStatus, RelayerWeb, RelayerWebConfig, SepoliaConfig, ShieldSubmittedEvent, SigningFailedError, SigningRejectedError, StoredCredentials, TOKEN_TOPICS, TRANSFER_BATCHER_ABI, Token, TokenConfig, Topics, TransactionErrorEvent, TransactionReceipt, TransactionResult, TransactionRevertedError, TransferFromSubmittedEvent, TransferSubmittedEvent, UnshieldCallbacks, UnshieldPhase1SubmittedEvent, UnshieldPhase2StartedEvent, UnshieldPhase2SubmittedEvent, UnwrapRequestedEvent, UnwrapSubmittedEvent, UnwrappedFinalizedEvent, UnwrappedStartedEvent, UserDecryptParams, WRAPPER_ABI, WrappedEvent, ZERO_HANDLE, ZKProofLike, ZamaError, ZamaErrorCode, ZamaSDK, ZamaSDKConfig, ZamaSDKEvent, ZamaSDKEventInput, ZamaSDKEventListener, ZamaSDKEventType, ZamaSDKEvents, allowanceContract, applyDecryptedValues, approveContract, balanceOfContract, clearPendingUnshield, confidentialBalanceOfContract, confidentialBatchTransferContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, decimalsContract, decodeConfidentialTransfer, decodeOnChainEvent, decodeOnChainEvents, decodeUnwrapRequested, decodeUnwrappedFinalized, decodeUnwrappedStarted, decodeWrapped, deploymentCoordinatorContract, extractEncryptedHandles, finalizeUnwrapContract, findUnwrapRequested, findWrapped, getBatchTransferFeeContract, getFeeRecipientContract, getUnwrapFeeContract, getWrapFeeContract, getWrapperContract, indexedDBStorage, isConfidentialTokenContract, isConfidentialWrapperContract, isFinalizeUnwrapOperatorContract, isOperatorContract, loadPendingUnshield, matchZamaError, nameContract, parseActivityFeed, rateContract, savePendingUnshield, setFinalizeUnwrapOperatorContract, setOperatorContract, sortByBlockNumber, supportsInterfaceContract, symbolContract, totalSupplyContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract, wrapETHContract, wrapperExistsContract } from '@zama-fhe/sdk';
|
|
5
|
+
import { PropsWithChildren } from 'react';
|
|
6
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
7
|
+
import { UseMutationOptions, UseQueryOptions, UseQueryResult, UseSuspenseQueryResult } from '@tanstack/react-query';
|
|
8
|
+
import * as _zama_fhe_relayer_sdk_web from '@zama-fhe/relayer-sdk/web';
|
|
9
|
+
import { U as UseZamaConfig } from './use-approve-underlying-DAkxWhfm.js';
|
|
10
|
+
export { A as ApproveUnderlyingParams, C as ConfidentialApproveParams, a as ConfidentialTransferFromParams, R as ResumeUnshieldParams, T as TokenMetadata, b as UnshieldAllParams, c as UnshieldParams, d as UseActivityFeedConfig, e as UseConfidentialBalanceConfig, f as UseConfidentialBalanceOptions, g as UseConfidentialBalancesConfig, h as UseConfidentialBalancesOptions, i as activityFeedQueryKeys, j as approveUnderlyingMutationOptions, k as authorizeAllMutationOptions, l as confidentialApproveMutationOptions, m as confidentialTransferFromMutationOptions, r as resumeUnshieldMutationOptions, t as tokenMetadataQueryKeys, n as tokenMetadataQueryOptions, u as unshieldAllMutationOptions, o as unshieldMutationOptions, p as unwrapAllMutationOptions, q as useActivityFeed, s as useApproveUnderlying, v as useAuthorizeAll, w as useConfidentialApprove, x as useConfidentialBalance, y as useConfidentialBalances, z as useConfidentialTransferFrom, B as useResumeUnshield, D as useToken, E as useTokenMetadata, F as useTokenMetadataSuspense, G as useUnshield, H as useUnshieldAll, I as useUnwrapAll } from './use-approve-underlying-DAkxWhfm.js';
|
|
11
|
+
|
|
12
|
+
/** Props for {@link ZamaProvider}. */
|
|
13
|
+
interface ZamaProviderProps extends PropsWithChildren {
|
|
14
|
+
/** FHE relayer backend (RelayerWeb for browser, RelayerNode for server). */
|
|
15
|
+
relayer: RelayerSDK;
|
|
16
|
+
/** Wallet signer (ViemSigner, EthersSigner, or custom GenericSigner). */
|
|
17
|
+
signer: GenericSigner;
|
|
18
|
+
/** Credential storage backend (IndexedDBStorage for browser, MemoryStorage for tests). */
|
|
19
|
+
storage: GenericStringStorage;
|
|
20
|
+
/** Number of days credentials remain valid (default: relayer default). */
|
|
21
|
+
credentialDurationDays?: number;
|
|
22
|
+
/** Callback invoked on SDK lifecycle events. */
|
|
23
|
+
onEvent?: ZamaSDKEventListener;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Provides a {@link ZamaSDK} instance to all descendant hooks.
|
|
27
|
+
* Terminates the relayer on unmount.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <ZamaProvider relayer={relayer} signer={signer} storage={storage}>
|
|
32
|
+
* <App />
|
|
33
|
+
* </ZamaProvider>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function ZamaProvider({ children, relayer, signer, storage, credentialDurationDays, onEvent, }: ZamaProviderProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Access the {@link ZamaSDK} instance from context.
|
|
39
|
+
* Must be used within a {@link ZamaProvider}.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* const sdk = useZamaSDK();
|
|
44
|
+
* const token = sdk.createReadonlyToken("0x...");
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function useZamaSDK(): ZamaSDK;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* TanStack Query mutation options factory for FHE encrypt.
|
|
51
|
+
*
|
|
52
|
+
* @param sdk - A `ZamaSDK` instance.
|
|
53
|
+
* @returns Mutation options with `mutationKey` and `mutationFn`.
|
|
54
|
+
*/
|
|
55
|
+
declare function encryptMutationOptions(sdk: ZamaSDK): {
|
|
56
|
+
mutationKey: readonly ["encrypt"];
|
|
57
|
+
mutationFn: (params: EncryptParams) => Promise<EncryptResult>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Encrypt a plaintext value using FHE.
|
|
61
|
+
* Calls the relayer's `encrypt` method via a mutation.
|
|
62
|
+
*
|
|
63
|
+
* @returns A mutation whose `mutate` accepts {@link EncryptParams}.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* const encrypt = useEncrypt();
|
|
68
|
+
* encrypt.mutate({ values: [1000n], bits: [64] });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare function useEncrypt(): _tanstack_react_query.UseMutationResult<EncryptResult, Error, EncryptParams, unknown>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Thin wrapper around sdk.userDecrypt().
|
|
75
|
+
* Caller is responsible for providing all params (keypair, signature, etc.).
|
|
76
|
+
* For the full orchestration (signature management, EIP712 signing),
|
|
77
|
+
* see the app-level useUserDecryptFlow hook.
|
|
78
|
+
*
|
|
79
|
+
* On success, populates the decryption cache so useUserDecryptedValue/useUserDecryptedValues
|
|
80
|
+
* can read the results.
|
|
81
|
+
*/
|
|
82
|
+
declare function useUserDecrypt(): _tanstack_react_query.UseMutationResult<Record<string, bigint>, Error, UserDecryptParams, unknown>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Decrypt FHE ciphertext handles using the network public key (no credential needed).
|
|
86
|
+
* On success, populates the decryption cache so {@link useUserDecryptedValue} / {@link useUserDecryptedValues}
|
|
87
|
+
* can read the results.
|
|
88
|
+
*
|
|
89
|
+
* @returns A mutation whose `mutate` accepts an array of handle strings.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```tsx
|
|
93
|
+
* const publicDecrypt = usePublicDecrypt();
|
|
94
|
+
* publicDecrypt.mutate(["0xHandle1", "0xHandle2"]);
|
|
95
|
+
* // publicDecrypt.data?.clearValues => { "0xHandle1": 500n, ... }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
declare function usePublicDecrypt(): _tanstack_react_query.UseMutationResult<PublicDecryptResult, Error, string[], unknown>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generate an FHE keypair via the relayer.
|
|
102
|
+
* Returns a public/private key pair for use in decrypt authorization.
|
|
103
|
+
*
|
|
104
|
+
* @returns A mutation whose `mutate` takes no parameters.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* const generateKeypair = useGenerateKeypair();
|
|
109
|
+
* generateKeypair.mutate();
|
|
110
|
+
* // generateKeypair.data?.publicKey, generateKeypair.data?.privateKey
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function useGenerateKeypair(): _tanstack_react_query.UseMutationResult<FHEKeypair, Error, void, unknown>;
|
|
114
|
+
|
|
115
|
+
/** Parameters for {@link useCreateEIP712}. */
|
|
116
|
+
interface CreateEIP712Params {
|
|
117
|
+
/** The FHE public key (hex-encoded). */
|
|
118
|
+
publicKey: string;
|
|
119
|
+
/** Contract addresses the credential authorizes decryption for. */
|
|
120
|
+
contractAddresses: `0x${string}`[];
|
|
121
|
+
/** Unix timestamp (seconds) when the credential becomes valid. */
|
|
122
|
+
startTimestamp: number;
|
|
123
|
+
/** Number of days the credential remains valid. Default: 1. */
|
|
124
|
+
durationDays?: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Create EIP-712 typed data for signing an FHE decrypt credential.
|
|
128
|
+
* The returned typed data is signed by the wallet to authorize decryption.
|
|
129
|
+
*
|
|
130
|
+
* @returns A mutation whose `mutate` accepts {@link CreateEIP712Params}.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* const createEIP712 = useCreateEIP712();
|
|
135
|
+
* createEIP712.mutate({
|
|
136
|
+
* publicKey: keypair.publicKey,
|
|
137
|
+
* contractAddresses: ["0xToken"],
|
|
138
|
+
* startTimestamp: Math.floor(Date.now() / 1000),
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
declare function useCreateEIP712(): _tanstack_react_query.UseMutationResult<EIP712TypedData, Error, CreateEIP712Params, unknown>;
|
|
143
|
+
|
|
144
|
+
/** Parameters for {@link useCreateDelegatedUserDecryptEIP712}. */
|
|
145
|
+
interface CreateDelegatedUserDecryptEIP712Params {
|
|
146
|
+
/** The FHE public key (hex-encoded). */
|
|
147
|
+
publicKey: string;
|
|
148
|
+
/** Contract addresses the credential authorizes decryption for. */
|
|
149
|
+
contractAddresses: Address[];
|
|
150
|
+
/** Address of the wallet that delegated decrypt authority. */
|
|
151
|
+
delegatorAddress: string;
|
|
152
|
+
/** Unix timestamp (seconds) when the credential becomes valid. */
|
|
153
|
+
startTimestamp: number;
|
|
154
|
+
/** Number of days the credential remains valid. Default: 1. */
|
|
155
|
+
durationDays?: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create EIP-712 typed data for a delegated user decrypt credential.
|
|
159
|
+
* Used when one wallet authorizes another to decrypt on its behalf.
|
|
160
|
+
*
|
|
161
|
+
* @returns A mutation whose `mutate` accepts {@link CreateDelegatedUserDecryptEIP712Params}.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* const createEIP712 = useCreateDelegatedUserDecryptEIP712();
|
|
166
|
+
* createEIP712.mutate({
|
|
167
|
+
* publicKey: keypair.publicKey,
|
|
168
|
+
* contractAddresses: ["0xToken"],
|
|
169
|
+
* delegatorAddress: "0xDelegator",
|
|
170
|
+
* startTimestamp: Math.floor(Date.now() / 1000),
|
|
171
|
+
* });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare function useCreateDelegatedUserDecryptEIP712(): _tanstack_react_query.UseMutationResult<Readonly<{
|
|
175
|
+
types: _zama_fhe_relayer_sdk_web.KmsDelegatedUserDecryptEIP712TypesType;
|
|
176
|
+
primaryType: "DelegatedUserDecryptRequestVerification";
|
|
177
|
+
domain: _zama_fhe_relayer_sdk_web.KmsEIP712DomainType;
|
|
178
|
+
message: _zama_fhe_relayer_sdk_web.KmsDelegatedUserDecryptEIP712MessageType;
|
|
179
|
+
}>, Error, CreateDelegatedUserDecryptEIP712Params, unknown>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Decrypt FHE ciphertext handles using delegated user credentials.
|
|
183
|
+
* Returns a map of handle → plaintext bigint.
|
|
184
|
+
*
|
|
185
|
+
* @returns A mutation whose `mutate` accepts {@link DelegatedUserDecryptParams}.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```tsx
|
|
189
|
+
* const decrypt = useDelegatedUserDecrypt();
|
|
190
|
+
* decrypt.mutate({ handles: ["0xHandle1"], ...credentials });
|
|
191
|
+
* // decrypt.data => { "0xHandle1": 1000n }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
declare function useDelegatedUserDecrypt(): _tanstack_react_query.UseMutationResult<Record<string, bigint>, Error, DelegatedUserDecryptParams, unknown>;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Submit a ZK proof for on-chain verification.
|
|
198
|
+
* Returns the input proof bytes for use in contract calls.
|
|
199
|
+
*
|
|
200
|
+
* @returns A mutation whose `mutate` accepts a {@link ZKProofLike}.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```tsx
|
|
204
|
+
* const verify = useRequestZKProofVerification();
|
|
205
|
+
* verify.mutate(zkProof);
|
|
206
|
+
* // verify.data => Uint8Array (input proof bytes)
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
declare function useRequestZKProofVerification(): _tanstack_react_query.UseMutationResult<Readonly<{
|
|
210
|
+
handles: Uint8Array[];
|
|
211
|
+
inputProof: Uint8Array;
|
|
212
|
+
}>, Error, ZKProofLike, unknown>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Query key factory for the FHE public key query.
|
|
216
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
217
|
+
*/
|
|
218
|
+
declare const publicKeyQueryKeys: {
|
|
219
|
+
/** Match the public key query. */
|
|
220
|
+
readonly all: readonly ["publicKey"];
|
|
221
|
+
};
|
|
222
|
+
/** Shape of the FHE public key data returned by the relayer. */
|
|
223
|
+
interface PublicKeyData {
|
|
224
|
+
/** Unique identifier for this public key version. */
|
|
225
|
+
publicKeyId: string;
|
|
226
|
+
/** The raw FHE public key bytes. */
|
|
227
|
+
publicKey: Uint8Array;
|
|
228
|
+
}
|
|
229
|
+
type PublicKeyResult = PublicKeyData | null;
|
|
230
|
+
/**
|
|
231
|
+
* TanStack Query options factory for the FHE public key.
|
|
232
|
+
*
|
|
233
|
+
* @param sdk - A `ZamaSDK` instance.
|
|
234
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
235
|
+
*/
|
|
236
|
+
declare function publicKeyQueryOptions(sdk: ZamaSDK): {
|
|
237
|
+
readonly queryKey: readonly ["publicKey"];
|
|
238
|
+
readonly queryFn: () => Promise<PublicKeyResult>;
|
|
239
|
+
readonly staleTime: number;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Fetch the FHE network public key from the relayer.
|
|
243
|
+
* Cached indefinitely since the key does not change during a session.
|
|
244
|
+
*
|
|
245
|
+
* @returns Query result with `data: PublicKeyData | null`.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```tsx
|
|
249
|
+
* const { data: publicKey } = usePublicKey();
|
|
250
|
+
* // publicKey?.publicKeyId, publicKey?.publicKey
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
declare function usePublicKey(): _tanstack_react_query.UseQueryResult<PublicKeyResult, Error>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Query key factory for FHE public params queries.
|
|
257
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
258
|
+
*/
|
|
259
|
+
declare const publicParamsQueryKeys: {
|
|
260
|
+
/** Match all public params queries. */
|
|
261
|
+
readonly all: readonly ["publicParams"];
|
|
262
|
+
/** Match public params query for a specific bit size. */
|
|
263
|
+
readonly bits: (bits: number) => readonly ["publicParams", number];
|
|
264
|
+
};
|
|
265
|
+
/** Shape of the FHE public parameters returned by the relayer. */
|
|
266
|
+
interface PublicParamsData {
|
|
267
|
+
/** The raw public parameters bytes (WASM-ready). */
|
|
268
|
+
publicParams: Uint8Array;
|
|
269
|
+
/** Unique identifier for this public params version. */
|
|
270
|
+
publicParamsId: string;
|
|
271
|
+
}
|
|
272
|
+
type PublicParamsResult = PublicParamsData | null;
|
|
273
|
+
/**
|
|
274
|
+
* TanStack Query options factory for FHE public parameters.
|
|
275
|
+
*
|
|
276
|
+
* @param sdk - A `ZamaSDK` instance.
|
|
277
|
+
* @param bits - The FHE bit size to fetch parameters for (e.g. 2048).
|
|
278
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
279
|
+
*/
|
|
280
|
+
declare function publicParamsQueryOptions(sdk: ZamaSDK, bits: number): {
|
|
281
|
+
readonly queryKey: readonly ["publicParams", number];
|
|
282
|
+
readonly queryFn: () => Promise<PublicParamsResult>;
|
|
283
|
+
readonly staleTime: number;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Fetch FHE public parameters for a given bit size from the relayer.
|
|
287
|
+
* Cached indefinitely since parameters do not change during a session.
|
|
288
|
+
*
|
|
289
|
+
* @param bits - The FHE bit size to fetch parameters for (e.g. 2048).
|
|
290
|
+
* @returns Query result with `data: PublicParamsData | null`.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```tsx
|
|
294
|
+
* const { data: params } = usePublicParams(2048);
|
|
295
|
+
* // params?.publicParams, params?.publicParamsId
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
declare function usePublicParams(bits: number): _tanstack_react_query.UseQueryResult<PublicParamsResult, Error>;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Look up a single cached decrypted value by its handle.
|
|
302
|
+
* Values are populated automatically when useUserDecrypt or usePublicDecrypt succeed.
|
|
303
|
+
* You can also populate manually via queryClient.setQueryData(decryptionKeys.value(handle), value).
|
|
304
|
+
*/
|
|
305
|
+
declare function useUserDecryptedValue(handle: string | undefined): _tanstack_react_query.UseQueryResult<bigint, Error>;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Look up multiple cached decrypted values by their handles.
|
|
309
|
+
* Values are populated automatically when useUserDecrypt or usePublicDecrypt succeed.
|
|
310
|
+
*/
|
|
311
|
+
declare function useUserDecryptedValues(handles: string[]): {
|
|
312
|
+
data: Record<string, bigint | undefined>;
|
|
313
|
+
results: _tanstack_react_query.UseQueryResult<never, Error>[];
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Query key helpers for the shared decryption cache.
|
|
318
|
+
* Used by useUserDecrypt/usePublicDecrypt to populate,
|
|
319
|
+
* and by useUserDecryptedValue to read.
|
|
320
|
+
*/
|
|
321
|
+
declare const decryptionKeys: {
|
|
322
|
+
value: (handle: string) => readonly ["decryptedValue", string];
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Get a {@link ReadonlyToken} instance, memoized by address.
|
|
327
|
+
* Supports balance queries, ERC-165 checks, and authorization — no wrapper needed.
|
|
328
|
+
* Reads signer and storage from the nearest {@link ZamaProvider}.
|
|
329
|
+
*
|
|
330
|
+
* @param address - Address of the confidential token contract.
|
|
331
|
+
* @returns A memoized `ReadonlyToken` instance.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```tsx
|
|
335
|
+
* const token = useReadonlyToken("0xToken");
|
|
336
|
+
* // token.balanceOf(), token.isConfidential(), etc.
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
declare function useReadonlyToken(address: Address): _zama_fhe_sdk.ReadonlyToken;
|
|
340
|
+
|
|
341
|
+
/** Parameters passed to the `mutate` function of {@link useConfidentialTransfer}. */
|
|
342
|
+
interface ConfidentialTransferParams {
|
|
343
|
+
/** Recipient address. */
|
|
344
|
+
to: Address;
|
|
345
|
+
/** Amount to transfer (plaintext — encrypted automatically). */
|
|
346
|
+
amount: bigint;
|
|
347
|
+
}
|
|
348
|
+
/** Configuration for {@link useConfidentialTransfer}. */
|
|
349
|
+
interface UseConfidentialTransferConfig extends UseZamaConfig {
|
|
350
|
+
/**
|
|
351
|
+
* When `true`, optimistically subtracts the transfer amount from cached balance
|
|
352
|
+
* before the transaction confirms. Rolls back on error.
|
|
353
|
+
* @defaultValue false
|
|
354
|
+
*/
|
|
355
|
+
optimistic?: boolean;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* TanStack Query mutation options factory for confidential transfer.
|
|
359
|
+
*
|
|
360
|
+
* @param token - A `Token` instance.
|
|
361
|
+
* @returns Mutation options with `mutationKey` and `mutationFn`.
|
|
362
|
+
*/
|
|
363
|
+
declare function confidentialTransferMutationOptions(token: Token): {
|
|
364
|
+
mutationKey: readonly ["confidentialTransfer", `0x${string}`];
|
|
365
|
+
mutationFn: ({ to, amount }: ConfidentialTransferParams) => Promise<TransactionResult>;
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* Encrypt and send a confidential transfer. Invalidates balance caches on success.
|
|
369
|
+
*
|
|
370
|
+
* Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
|
|
371
|
+
* - {@link SigningRejectedError} — user rejected the wallet prompt
|
|
372
|
+
* - {@link EncryptionFailedError} — FHE encryption failed
|
|
373
|
+
* - {@link TransactionRevertedError} — on-chain transaction reverted
|
|
374
|
+
*
|
|
375
|
+
* @param config - Token address (and optional wrapper) identifying the token.
|
|
376
|
+
* Set `optimistic: true` to subtract the amount from the cached balance immediately.
|
|
377
|
+
* @param options - React Query mutation options.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```tsx
|
|
381
|
+
* const transfer = useConfidentialTransfer({
|
|
382
|
+
* tokenAddress: "0x...",
|
|
383
|
+
* optimistic: true,
|
|
384
|
+
* });
|
|
385
|
+
* transfer.mutate(
|
|
386
|
+
* { to: "0xRecipient", amount: 1000n },
|
|
387
|
+
* {
|
|
388
|
+
* onError: (error) => {
|
|
389
|
+
* if (error instanceof SigningRejectedError) {
|
|
390
|
+
* // user cancelled — no action needed
|
|
391
|
+
* }
|
|
392
|
+
* },
|
|
393
|
+
* },
|
|
394
|
+
* );
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
declare function useConfidentialTransfer(config: UseConfidentialTransferConfig, options?: UseMutationOptions<TransactionResult, Error, ConfidentialTransferParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ConfidentialTransferParams, `0x${string}`>;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Query key factory for confidential approval queries.
|
|
401
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
402
|
+
*/
|
|
403
|
+
declare const confidentialIsApprovedQueryKeys: {
|
|
404
|
+
/** Match all approval queries. */
|
|
405
|
+
readonly all: readonly ["confidentialIsApproved"];
|
|
406
|
+
/** Match approval queries for a specific token. */
|
|
407
|
+
readonly token: (tokenAddress: string) => readonly ["confidentialIsApproved", string];
|
|
408
|
+
/** Match approval queries for a specific token + spender pair. */
|
|
409
|
+
readonly spender: (tokenAddress: string, spender: string) => readonly ["confidentialIsApproved", string, string];
|
|
410
|
+
};
|
|
411
|
+
/** Configuration for {@link useConfidentialIsApproved}. */
|
|
412
|
+
interface UseConfidentialIsApprovedConfig extends UseZamaConfig {
|
|
413
|
+
/** Address to check approval for. Pass `undefined` to disable the query. */
|
|
414
|
+
spender: Address | undefined;
|
|
415
|
+
}
|
|
416
|
+
/** Configuration for {@link useConfidentialIsApprovedSuspense}. */
|
|
417
|
+
interface UseConfidentialIsApprovedSuspenseConfig extends UseZamaConfig {
|
|
418
|
+
/** Address to check approval for. */
|
|
419
|
+
spender: Address;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* TanStack Query options factory for confidential approval check.
|
|
423
|
+
*
|
|
424
|
+
* @param token - A `Token` instance.
|
|
425
|
+
* @param spender - Address to check approval for.
|
|
426
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
427
|
+
*/
|
|
428
|
+
declare function confidentialIsApprovedQueryOptions(token: Token, spender: Address): {
|
|
429
|
+
readonly queryKey: readonly ["confidentialIsApproved", string, string];
|
|
430
|
+
readonly queryFn: () => Promise<boolean>;
|
|
431
|
+
readonly staleTime: 30000;
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Check if a spender is an approved operator for the connected wallet.
|
|
435
|
+
*
|
|
436
|
+
* @param config - Token address and spender to check.
|
|
437
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
438
|
+
* @returns Query result with `data: boolean`.
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```tsx
|
|
442
|
+
* const { data: isApproved } = useConfidentialIsApproved({
|
|
443
|
+
* tokenAddress: "0xToken",
|
|
444
|
+
* spender: "0xSpender",
|
|
445
|
+
* });
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
declare function useConfidentialIsApproved(config: UseConfidentialIsApprovedConfig, options?: Omit<UseQueryOptions<boolean, Error>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<boolean, Error>;
|
|
449
|
+
/**
|
|
450
|
+
* Suspense variant of {@link useConfidentialIsApproved}.
|
|
451
|
+
* Suspends rendering until the approval check resolves.
|
|
452
|
+
*
|
|
453
|
+
* @param config - Token address and spender to check.
|
|
454
|
+
* @returns Suspense query result with `data: boolean`.
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```tsx
|
|
458
|
+
* const { data: isApproved } = useConfidentialIsApprovedSuspense({
|
|
459
|
+
* tokenAddress: "0xToken",
|
|
460
|
+
* spender: "0xSpender",
|
|
461
|
+
* });
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
declare function useConfidentialIsApprovedSuspense(config: UseConfidentialIsApprovedSuspenseConfig): _tanstack_react_query.UseSuspenseQueryResult<boolean, Error>;
|
|
465
|
+
|
|
466
|
+
/** Parameters passed to the `mutate` function of {@link useShield}. */
|
|
467
|
+
interface ShieldParams {
|
|
468
|
+
/** Amount of underlying ERC-20 tokens to wrap. */
|
|
469
|
+
amount: bigint;
|
|
470
|
+
/** Optional fee amount (for native ETH wrapping with fees). */
|
|
471
|
+
fees?: bigint;
|
|
472
|
+
/** ERC-20 approval strategy: `"exact"` (default), `"max"`, or `"skip"`. */
|
|
473
|
+
approvalStrategy?: "max" | "exact" | "skip";
|
|
474
|
+
}
|
|
475
|
+
/** Configuration for {@link useShield}. */
|
|
476
|
+
interface UseShieldConfig extends UseZamaConfig {
|
|
477
|
+
/**
|
|
478
|
+
* When `true`, optimistically adds the wrap amount to the cached confidential balance
|
|
479
|
+
* before the transaction confirms. Rolls back on error.
|
|
480
|
+
* @defaultValue false
|
|
481
|
+
*/
|
|
482
|
+
optimistic?: boolean;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* TanStack Query mutation options factory for shield.
|
|
486
|
+
*
|
|
487
|
+
* @param token - A `Token` instance.
|
|
488
|
+
* @returns Mutation options with `mutationKey` and `mutationFn`.
|
|
489
|
+
*/
|
|
490
|
+
declare function shieldMutationOptions(token: Token): {
|
|
491
|
+
mutationKey: readonly ["shield", `0x${string}`];
|
|
492
|
+
mutationFn: ({ amount, fees, approvalStrategy }: ShieldParams) => Promise<TransactionResult>;
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Shield public ERC-20 tokens into confidential tokens.
|
|
496
|
+
* Handles ERC-20 approval automatically. Invalidates balance caches on success.
|
|
497
|
+
*
|
|
498
|
+
* Errors are {@link ZamaError} subclasses — use `instanceof` to handle specific failures:
|
|
499
|
+
* - {@link SigningRejectedError} — user rejected the wallet prompt
|
|
500
|
+
* - {@link ApprovalFailedError} — ERC-20 approval transaction failed
|
|
501
|
+
* - {@link TransactionRevertedError} — shield transaction reverted
|
|
502
|
+
*
|
|
503
|
+
* @param config - Token and wrapper addresses.
|
|
504
|
+
* Set `optimistic: true` to add the amount to the cached balance immediately.
|
|
505
|
+
* @param options - React Query mutation options.
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```tsx
|
|
509
|
+
* const shield = useShield({ tokenAddress: "0x...", wrapperAddress: "0x...", optimistic: true });
|
|
510
|
+
* shield.mutate({ amount: 1000n });
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
declare function useShield(config: UseShieldConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ShieldParams, `0x${string}`>;
|
|
514
|
+
|
|
515
|
+
/** Parameters passed to the `mutate` function of {@link useShieldETH}. */
|
|
516
|
+
interface ShieldETHParams {
|
|
517
|
+
/** Amount of ETH to wrap (in wei). */
|
|
518
|
+
amount: bigint;
|
|
519
|
+
/** ETH value to send with the transaction. Defaults to `amount`. */
|
|
520
|
+
value?: bigint;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* TanStack Query mutation options factory for shield ETH.
|
|
524
|
+
*
|
|
525
|
+
* @param token - A `Token` instance.
|
|
526
|
+
* @returns Mutation options with `mutationKey` and `mutationFn`.
|
|
527
|
+
*/
|
|
528
|
+
declare function shieldETHMutationOptions(token: Token): {
|
|
529
|
+
mutationKey: readonly ["shieldETH", `0x${string}`];
|
|
530
|
+
mutationFn: ({ amount, value }: ShieldETHParams) => Promise<TransactionResult>;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* Shield native ETH into confidential tokens.
|
|
534
|
+
* Invalidates balance caches on success.
|
|
535
|
+
*
|
|
536
|
+
* @param config - Token and wrapper addresses.
|
|
537
|
+
* @param options - React Query mutation options.
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* ```tsx
|
|
541
|
+
* const shieldETH = useShieldETH({ tokenAddress: "0x...", wrapperAddress: "0x..." });
|
|
542
|
+
* shieldETH.mutate({ amount: 1000000000000000000n }); // 1 ETH
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
declare function useShieldETH(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, ShieldETHParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, ShieldETHParams, `0x${string}`>;
|
|
546
|
+
|
|
547
|
+
/** Parameters passed to the `mutate` function of {@link useUnwrap}. */
|
|
548
|
+
interface UnwrapParams {
|
|
549
|
+
/** Amount to unwrap (plaintext — encrypted automatically). */
|
|
550
|
+
amount: bigint;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* TanStack Query mutation options factory for unwrap.
|
|
554
|
+
*
|
|
555
|
+
* @param token - A `Token` instance.
|
|
556
|
+
* @returns Mutation options with `mutationKey` and `mutationFn`.
|
|
557
|
+
*/
|
|
558
|
+
declare function unwrapMutationOptions(token: Token): {
|
|
559
|
+
mutationKey: readonly ["unwrap", `0x${string}`];
|
|
560
|
+
mutationFn: ({ amount }: UnwrapParams) => Promise<TransactionResult>;
|
|
561
|
+
};
|
|
562
|
+
/**
|
|
563
|
+
* Request an unwrap for a specific amount. Encrypts the amount first.
|
|
564
|
+
* Call {@link useFinalizeUnwrap} after the request is processed on-chain,
|
|
565
|
+
* or use {@link useUnshield} for a single-call orchestration.
|
|
566
|
+
*
|
|
567
|
+
* @param config - Token address (and optional wrapper) identifying the token.
|
|
568
|
+
* @param options - React Query mutation options.
|
|
569
|
+
*
|
|
570
|
+
* @example
|
|
571
|
+
* ```tsx
|
|
572
|
+
* const unwrap = useUnwrap({ tokenAddress: "0x..." });
|
|
573
|
+
* unwrap.mutate({ amount: 500n });
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
declare function useUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, UnwrapParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, UnwrapParams, `0x${string}`>;
|
|
577
|
+
|
|
578
|
+
/** Parameters passed to the `mutate` function of {@link useFinalizeUnwrap}. */
|
|
579
|
+
interface FinalizeUnwrapParams {
|
|
580
|
+
/** Encrypted amount handle from the UnwrapRequested event. */
|
|
581
|
+
burnAmountHandle: Address;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* TanStack Query mutation options factory for finalize-unwrap.
|
|
585
|
+
*
|
|
586
|
+
* @param token - A `Token` instance.
|
|
587
|
+
* @returns Mutation options with `mutationKey` and `mutationFn`.
|
|
588
|
+
*/
|
|
589
|
+
declare function finalizeUnwrapMutationOptions(token: Token): {
|
|
590
|
+
mutationKey: readonly ["finalizeUnwrap", `0x${string}`];
|
|
591
|
+
mutationFn: ({ burnAmountHandle }: FinalizeUnwrapParams) => Promise<TransactionResult>;
|
|
592
|
+
};
|
|
593
|
+
/**
|
|
594
|
+
* Complete an unwrap by providing the public decryption proof.
|
|
595
|
+
* Call this after an unwrap request has been processed on-chain.
|
|
596
|
+
*
|
|
597
|
+
* @param config - Token address (and optional wrapper) identifying the token.
|
|
598
|
+
* @param options - React Query mutation options.
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* ```tsx
|
|
602
|
+
* const finalize = useFinalizeUnwrap({ tokenAddress: "0x..." });
|
|
603
|
+
* finalize.mutate({ burnAmountHandle: event.encryptedAmount });
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
declare function useFinalizeUnwrap(config: UseZamaConfig, options?: UseMutationOptions<TransactionResult, Error, FinalizeUnwrapParams, Address>): _tanstack_react_query.UseMutationResult<TransactionResult, Error, FinalizeUnwrapParams, `0x${string}`>;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Query key factory for underlying ERC-20 allowance queries.
|
|
610
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
611
|
+
*/
|
|
612
|
+
declare const underlyingAllowanceQueryKeys: {
|
|
613
|
+
/** Match all underlying allowance queries. */
|
|
614
|
+
readonly all: readonly ["underlyingAllowance"];
|
|
615
|
+
/** Match allowance query for a specific token + wrapper pair. */
|
|
616
|
+
readonly token: (tokenAddress: string, wrapper: string) => readonly ["underlyingAllowance", string, string];
|
|
617
|
+
};
|
|
618
|
+
/** Configuration for {@link useUnderlyingAllowance}. */
|
|
619
|
+
interface UseUnderlyingAllowanceConfig {
|
|
620
|
+
/** Address of the underlying ERC-20 token. */
|
|
621
|
+
tokenAddress: Address;
|
|
622
|
+
/** Address of the wrapper contract (the spender). */
|
|
623
|
+
wrapperAddress: Address;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* TanStack Query options factory for underlying ERC-20 allowance.
|
|
627
|
+
*
|
|
628
|
+
* @param token - A `ReadonlyToken` instance.
|
|
629
|
+
* @param wrapperAddress - Address of the wrapper contract (the spender).
|
|
630
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
631
|
+
*/
|
|
632
|
+
declare function underlyingAllowanceQueryOptions(token: ReadonlyToken, wrapperAddress: Address): {
|
|
633
|
+
readonly queryKey: readonly ["underlyingAllowance", string, string];
|
|
634
|
+
readonly queryFn: () => Promise<bigint>;
|
|
635
|
+
readonly staleTime: 30000;
|
|
636
|
+
};
|
|
637
|
+
/**
|
|
638
|
+
* Read the underlying ERC-20 allowance granted to the wrapper contract.
|
|
639
|
+
* Useful to check if an approval is needed before shielding.
|
|
640
|
+
*
|
|
641
|
+
* @param config - Token and wrapper addresses.
|
|
642
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
643
|
+
* @returns Query result with `data: bigint` (current allowance).
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* ```tsx
|
|
647
|
+
* const { data: allowance } = useUnderlyingAllowance({
|
|
648
|
+
* tokenAddress: "0xUnderlying",
|
|
649
|
+
* wrapperAddress: "0xWrapper",
|
|
650
|
+
* });
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
declare function useUnderlyingAllowance(config: UseUnderlyingAllowanceConfig, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<bigint, Error>;
|
|
654
|
+
/**
|
|
655
|
+
* Suspense variant of {@link useUnderlyingAllowance}.
|
|
656
|
+
* Suspends rendering until the allowance is loaded.
|
|
657
|
+
*
|
|
658
|
+
* @param config - Token and wrapper addresses.
|
|
659
|
+
* @returns Suspense query result with `data: bigint`.
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* ```tsx
|
|
663
|
+
* const { data: allowance } = useUnderlyingAllowanceSuspense({
|
|
664
|
+
* tokenAddress: "0xUnderlying",
|
|
665
|
+
* wrapperAddress: "0xWrapper",
|
|
666
|
+
* });
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
declare function useUnderlyingAllowanceSuspense(config: UseUnderlyingAllowanceConfig): _tanstack_react_query.UseSuspenseQueryResult<bigint, Error>;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Query key factories for confidential balance queries.
|
|
673
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()` / `removeQueries()`.
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```ts
|
|
677
|
+
* // Invalidate all balance queries
|
|
678
|
+
* queryClient.invalidateQueries({ queryKey: confidentialBalanceQueryKeys.all });
|
|
679
|
+
*
|
|
680
|
+
* // Reset balance for a specific token + owner
|
|
681
|
+
* queryClient.resetQueries({
|
|
682
|
+
* queryKey: confidentialBalanceQueryKeys.owner("0xToken", "0xOwner"),
|
|
683
|
+
* });
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
declare const confidentialBalanceQueryKeys: {
|
|
687
|
+
/** Match all single-token balance queries. */
|
|
688
|
+
readonly all: readonly ["confidentialBalance"];
|
|
689
|
+
/** Match balance queries for a specific token (any owner). */
|
|
690
|
+
readonly token: (tokenAddress: string) => readonly ["confidentialBalance", string];
|
|
691
|
+
/** Match balance query for a specific token + owner. */
|
|
692
|
+
readonly owner: (tokenAddress: string, owner: string) => readonly ["confidentialBalance", string, string];
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* Query key factory for batch balance queries (multiple tokens).
|
|
696
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
697
|
+
*/
|
|
698
|
+
declare const confidentialBalancesQueryKeys: {
|
|
699
|
+
/** Match all batch balance queries. */
|
|
700
|
+
readonly all: readonly ["confidentialBalances"];
|
|
701
|
+
/** Match batch balance query for a specific token set + owner. */
|
|
702
|
+
readonly tokens: (tokenAddresses: string[], owner: string) => readonly ["confidentialBalances", string[], string];
|
|
703
|
+
};
|
|
704
|
+
/**
|
|
705
|
+
* Query key factory for encrypted handle queries (Phase 1 of two-phase polling).
|
|
706
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
707
|
+
*/
|
|
708
|
+
declare const confidentialHandleQueryKeys: {
|
|
709
|
+
/** Match all single-token handle queries. */
|
|
710
|
+
readonly all: readonly ["confidentialHandle"];
|
|
711
|
+
/** Match handle queries for a specific token (any owner). */
|
|
712
|
+
readonly token: (tokenAddress: string) => readonly ["confidentialHandle", string];
|
|
713
|
+
/** Match handle query for a specific token + owner. */
|
|
714
|
+
readonly owner: (tokenAddress: string, owner: string) => readonly ["confidentialHandle", string, string];
|
|
715
|
+
};
|
|
716
|
+
/**
|
|
717
|
+
* Query key factory for batch encrypted handle queries (Phase 1, multiple tokens).
|
|
718
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
719
|
+
*/
|
|
720
|
+
declare const confidentialHandlesQueryKeys: {
|
|
721
|
+
/** Match all batch handle queries. */
|
|
722
|
+
readonly all: readonly ["confidentialHandles"];
|
|
723
|
+
/** Match batch handle query for a specific token set + owner. */
|
|
724
|
+
readonly tokens: (tokenAddresses: string[], owner: string) => readonly ["confidentialHandles", string[], string];
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Query key factory for wrapper discovery queries.
|
|
729
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
730
|
+
*/
|
|
731
|
+
declare const wrapperDiscoveryQueryKeys: {
|
|
732
|
+
/** Match all wrapper discovery queries. */
|
|
733
|
+
readonly all: readonly ["wrapperDiscovery"];
|
|
734
|
+
/** Match wrapper discovery queries for a specific token. */
|
|
735
|
+
readonly token: (tokenAddress: string) => readonly ["wrapperDiscovery", string];
|
|
736
|
+
/** Match wrapper discovery query for a specific token + coordinator pair. */
|
|
737
|
+
readonly tokenCoordinator: (tokenAddress: string, coordinatorAddress: string) => readonly ["wrapperDiscovery", string, string];
|
|
738
|
+
};
|
|
739
|
+
/** Configuration for {@link useWrapperDiscovery}. */
|
|
740
|
+
interface UseWrapperDiscoveryConfig {
|
|
741
|
+
/** Address of the underlying ERC-20 token. */
|
|
742
|
+
tokenAddress: Address;
|
|
743
|
+
/** Address of the wrapper coordinator. Pass `undefined` to disable the query. */
|
|
744
|
+
coordinatorAddress: Address | undefined;
|
|
745
|
+
}
|
|
746
|
+
/** Configuration for {@link useWrapperDiscoverySuspense}. */
|
|
747
|
+
interface UseWrapperDiscoverySuspenseConfig {
|
|
748
|
+
/** Address of the underlying ERC-20 token. */
|
|
749
|
+
tokenAddress: Address;
|
|
750
|
+
/** Address of the wrapper coordinator. */
|
|
751
|
+
coordinatorAddress: Address;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* TanStack Query options factory for wrapper discovery.
|
|
755
|
+
*
|
|
756
|
+
* @param token - A `ReadonlyToken` instance.
|
|
757
|
+
* @param coordinatorAddress - Address of the wrapper coordinator.
|
|
758
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
759
|
+
*/
|
|
760
|
+
declare function wrapperDiscoveryQueryOptions(token: ReadonlyToken, coordinatorAddress: Address): {
|
|
761
|
+
readonly queryKey: readonly ["wrapperDiscovery", string, string];
|
|
762
|
+
readonly queryFn: () => Promise<`0x${string}` | null>;
|
|
763
|
+
readonly staleTime: number;
|
|
764
|
+
};
|
|
765
|
+
/**
|
|
766
|
+
* Discover the wrapper contract for an ERC-20 token.
|
|
767
|
+
* Returns the wrapper address if one exists, or `null` if not.
|
|
768
|
+
* Cached indefinitely since wrapper mappings are immutable.
|
|
769
|
+
*
|
|
770
|
+
* @param config - Token and coordinator addresses.
|
|
771
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
772
|
+
* @returns Query result with `data: Address | null`.
|
|
773
|
+
*
|
|
774
|
+
* @example
|
|
775
|
+
* ```tsx
|
|
776
|
+
* const { data: wrapperAddress } = useWrapperDiscovery({
|
|
777
|
+
* tokenAddress: "0xUnderlying",
|
|
778
|
+
* coordinatorAddress: "0xCoordinator",
|
|
779
|
+
* });
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
declare function useWrapperDiscovery(config: UseWrapperDiscoveryConfig, options?: Omit<UseQueryOptions<Address | null, Error>, "queryKey" | "queryFn">): UseQueryResult<Address | null, Error>;
|
|
783
|
+
/**
|
|
784
|
+
* Suspense variant of {@link useWrapperDiscovery}.
|
|
785
|
+
* Suspends rendering until the wrapper address is resolved.
|
|
786
|
+
*
|
|
787
|
+
* @param config - Token and coordinator addresses.
|
|
788
|
+
* @returns Suspense query result with `data: Address | null`.
|
|
789
|
+
*
|
|
790
|
+
* @example
|
|
791
|
+
* ```tsx
|
|
792
|
+
* const { data: wrapperAddress } = useWrapperDiscoverySuspense({
|
|
793
|
+
* tokenAddress: "0xUnderlying",
|
|
794
|
+
* coordinatorAddress: "0xCoordinator",
|
|
795
|
+
* });
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
declare function useWrapperDiscoverySuspense(config: UseWrapperDiscoverySuspenseConfig): UseSuspenseQueryResult<Address | null, Error>;
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Query key factory for ERC-165 confidential interface checks.
|
|
802
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
803
|
+
*/
|
|
804
|
+
declare const isConfidentialQueryKeys: {
|
|
805
|
+
/** Match all confidential interface queries. */
|
|
806
|
+
readonly all: readonly ["isConfidential"];
|
|
807
|
+
/** Match confidential interface query for a specific token. */
|
|
808
|
+
readonly token: (tokenAddress: string) => readonly ["isConfidential", string];
|
|
809
|
+
};
|
|
810
|
+
/**
|
|
811
|
+
* Query key factory for ERC-165 wrapper interface checks.
|
|
812
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
813
|
+
*/
|
|
814
|
+
declare const isWrapperQueryKeys: {
|
|
815
|
+
/** Match all wrapper interface queries. */
|
|
816
|
+
readonly all: readonly ["isWrapper"];
|
|
817
|
+
/** Match wrapper interface query for a specific token. */
|
|
818
|
+
readonly token: (tokenAddress: string) => readonly ["isWrapper", string];
|
|
819
|
+
};
|
|
820
|
+
/**
|
|
821
|
+
* TanStack Query options factory for ERC-165 confidential interface check.
|
|
822
|
+
*
|
|
823
|
+
* @param token - A `ReadonlyToken` instance.
|
|
824
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
825
|
+
*/
|
|
826
|
+
declare function isConfidentialQueryOptions(token: ReadonlyToken): {
|
|
827
|
+
readonly queryKey: readonly ["isConfidential", string];
|
|
828
|
+
readonly queryFn: () => Promise<boolean>;
|
|
829
|
+
readonly staleTime: number;
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* TanStack Query options factory for ERC-165 wrapper interface check.
|
|
833
|
+
*
|
|
834
|
+
* @param token - A `ReadonlyToken` instance.
|
|
835
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
836
|
+
*/
|
|
837
|
+
declare function isWrapperQueryOptions(token: ReadonlyToken): {
|
|
838
|
+
readonly queryKey: readonly ["isWrapper", string];
|
|
839
|
+
readonly queryFn: () => Promise<boolean>;
|
|
840
|
+
readonly staleTime: number;
|
|
841
|
+
};
|
|
842
|
+
/**
|
|
843
|
+
* Check if a token supports the ERC-7984 confidential interface via ERC-165.
|
|
844
|
+
* Result is cached indefinitely since interface support does not change.
|
|
845
|
+
*
|
|
846
|
+
* @param tokenAddress - Address of the token contract to check.
|
|
847
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
848
|
+
* @returns Query result with `data: boolean`.
|
|
849
|
+
*
|
|
850
|
+
* @example
|
|
851
|
+
* ```tsx
|
|
852
|
+
* const { data: isConfidential } = useIsConfidential("0xToken");
|
|
853
|
+
* ```
|
|
854
|
+
*/
|
|
855
|
+
declare function useIsConfidential(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean, Error>, "queryKey" | "queryFn">): UseQueryResult<boolean, Error>;
|
|
856
|
+
/**
|
|
857
|
+
* Suspense variant of {@link useIsConfidential}.
|
|
858
|
+
* Suspends rendering until the ERC-165 check resolves.
|
|
859
|
+
*
|
|
860
|
+
* @param tokenAddress - Address of the token contract to check.
|
|
861
|
+
* @returns Suspense query result with `data: boolean`.
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* ```tsx
|
|
865
|
+
* const { data: isConfidential } = useIsConfidentialSuspense("0xToken");
|
|
866
|
+
* ```
|
|
867
|
+
*/
|
|
868
|
+
declare function useIsConfidentialSuspense(tokenAddress: Address): UseSuspenseQueryResult<boolean, Error>;
|
|
869
|
+
/**
|
|
870
|
+
* Check if a token supports the ERC-7984 wrapper interface via ERC-165.
|
|
871
|
+
* Result is cached indefinitely since interface support does not change.
|
|
872
|
+
*
|
|
873
|
+
* @param tokenAddress - Address of the token contract to check.
|
|
874
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
875
|
+
* @returns Query result with `data: boolean`.
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* ```tsx
|
|
879
|
+
* const { data: isWrapper } = useIsWrapper("0xToken");
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
declare function useIsWrapper(tokenAddress: Address, options?: Omit<UseQueryOptions<boolean, Error>, "queryKey" | "queryFn">): UseQueryResult<boolean, Error>;
|
|
883
|
+
/**
|
|
884
|
+
* Suspense variant of {@link useIsWrapper}.
|
|
885
|
+
* Suspends rendering until the ERC-165 check resolves.
|
|
886
|
+
*
|
|
887
|
+
* @param tokenAddress - Address of the token contract to check.
|
|
888
|
+
* @returns Suspense query result with `data: boolean`.
|
|
889
|
+
*
|
|
890
|
+
* @example
|
|
891
|
+
* ```tsx
|
|
892
|
+
* const { data: isWrapper } = useIsWrapperSuspense("0xToken");
|
|
893
|
+
* ```
|
|
894
|
+
*/
|
|
895
|
+
declare function useIsWrapperSuspense(tokenAddress: Address): UseSuspenseQueryResult<boolean, Error>;
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Query key factory for total supply queries.
|
|
899
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
900
|
+
*/
|
|
901
|
+
declare const totalSupplyQueryKeys: {
|
|
902
|
+
/** Match all total supply queries. */
|
|
903
|
+
readonly all: readonly ["totalSupply"];
|
|
904
|
+
/** Match total supply query for a specific token. */
|
|
905
|
+
readonly token: (tokenAddress: string) => readonly ["totalSupply", string];
|
|
906
|
+
};
|
|
907
|
+
/**
|
|
908
|
+
* TanStack Query options factory for total supply.
|
|
909
|
+
*
|
|
910
|
+
* @param token - A `ReadonlyToken` instance.
|
|
911
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
912
|
+
*/
|
|
913
|
+
declare function totalSupplyQueryOptions(token: ReadonlyToken): {
|
|
914
|
+
readonly queryKey: readonly ["totalSupply", string];
|
|
915
|
+
readonly queryFn: () => Promise<bigint>;
|
|
916
|
+
readonly staleTime: 30000;
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* Read the total supply of a token.
|
|
920
|
+
* Stale after 30 seconds to balance freshness and RPC cost.
|
|
921
|
+
*
|
|
922
|
+
* @param tokenAddress - Address of the token contract.
|
|
923
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
924
|
+
* @returns Query result with `data: bigint`.
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```tsx
|
|
928
|
+
* const { data: totalSupply } = useTotalSupply("0xToken");
|
|
929
|
+
* ```
|
|
930
|
+
*/
|
|
931
|
+
declare function useTotalSupply(tokenAddress: Address, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
|
|
932
|
+
/**
|
|
933
|
+
* Suspense variant of {@link useTotalSupply}.
|
|
934
|
+
* Suspends rendering until the total supply is loaded.
|
|
935
|
+
*
|
|
936
|
+
* @param tokenAddress - Address of the token contract.
|
|
937
|
+
* @returns Suspense query result with `data: bigint`.
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```tsx
|
|
941
|
+
* const { data: totalSupply } = useTotalSupplySuspense("0xToken");
|
|
942
|
+
* ```
|
|
943
|
+
*/
|
|
944
|
+
declare function useTotalSupplySuspense(tokenAddress: Address): UseSuspenseQueryResult<bigint, Error>;
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Query key factory for fee-related queries.
|
|
948
|
+
* Use with `queryClient.invalidateQueries()` / `resetQueries()`.
|
|
949
|
+
*/
|
|
950
|
+
declare const feeQueryKeys: {
|
|
951
|
+
/** Match shield fee query for given parameters. */
|
|
952
|
+
readonly shieldFee: (feeManagerAddress: string, amount?: string, from?: string, to?: string) => readonly ["shieldFee", string, ...(string | undefined)[]];
|
|
953
|
+
/** Match unshield fee query for given parameters. */
|
|
954
|
+
readonly unshieldFee: (feeManagerAddress: string, amount?: string, from?: string, to?: string) => readonly ["unshieldFee", string, ...(string | undefined)[]];
|
|
955
|
+
/** Match batch transfer fee query for a specific fee manager. */
|
|
956
|
+
readonly batchTransferFee: (feeManagerAddress: string) => readonly ["batchTransferFee", string];
|
|
957
|
+
/** Match fee recipient query for a specific fee manager. */
|
|
958
|
+
readonly feeRecipient: (feeManagerAddress: string) => readonly ["feeRecipient", string];
|
|
959
|
+
};
|
|
960
|
+
/** Configuration for {@link useShieldFee} and {@link useUnshieldFee}. */
|
|
961
|
+
interface UseFeeConfig {
|
|
962
|
+
/** Address of the fee manager contract. */
|
|
963
|
+
feeManagerAddress: Address;
|
|
964
|
+
/** Amount to calculate the fee for. */
|
|
965
|
+
amount: bigint;
|
|
966
|
+
/** Sender address. */
|
|
967
|
+
from: Address;
|
|
968
|
+
/** Receiver address. */
|
|
969
|
+
to: Address;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* TanStack Query options factory for shield fee.
|
|
973
|
+
*
|
|
974
|
+
* @param signer - A `GenericSigner` instance.
|
|
975
|
+
* @param config - {@link UseFeeConfig} with fee manager address, amount, from, and to.
|
|
976
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
977
|
+
*/
|
|
978
|
+
declare function shieldFeeQueryOptions(signer: GenericSigner, config: UseFeeConfig): {
|
|
979
|
+
readonly queryKey: readonly ["shieldFee", string, ...(string | undefined)[]];
|
|
980
|
+
readonly queryFn: () => Promise<bigint>;
|
|
981
|
+
readonly staleTime: 30000;
|
|
982
|
+
};
|
|
983
|
+
/**
|
|
984
|
+
* TanStack Query options factory for unshield fee.
|
|
985
|
+
*
|
|
986
|
+
* @param signer - A `GenericSigner` instance.
|
|
987
|
+
* @param config - Fee manager address, amount, from, and to.
|
|
988
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
989
|
+
*/
|
|
990
|
+
declare function unshieldFeeQueryOptions(signer: GenericSigner, config: UseFeeConfig): {
|
|
991
|
+
readonly queryKey: readonly ["unshieldFee", string, ...(string | undefined)[]];
|
|
992
|
+
readonly queryFn: () => Promise<bigint>;
|
|
993
|
+
readonly staleTime: 30000;
|
|
994
|
+
};
|
|
995
|
+
/**
|
|
996
|
+
* TanStack Query options factory for batch transfer fee.
|
|
997
|
+
*
|
|
998
|
+
* @param signer - A `GenericSigner` instance.
|
|
999
|
+
* @param feeManagerAddress - Address of the fee manager contract.
|
|
1000
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
1001
|
+
*/
|
|
1002
|
+
declare function batchTransferFeeQueryOptions(signer: GenericSigner, feeManagerAddress: Address): {
|
|
1003
|
+
readonly queryKey: readonly ["batchTransferFee", string];
|
|
1004
|
+
readonly queryFn: () => Promise<bigint>;
|
|
1005
|
+
readonly staleTime: 30000;
|
|
1006
|
+
};
|
|
1007
|
+
/**
|
|
1008
|
+
* TanStack Query options factory for fee recipient.
|
|
1009
|
+
*
|
|
1010
|
+
* @param signer - A `GenericSigner` instance.
|
|
1011
|
+
* @param feeManagerAddress - Address of the fee manager contract.
|
|
1012
|
+
* @returns Query options with `queryKey`, `queryFn`, and `staleTime`.
|
|
1013
|
+
*/
|
|
1014
|
+
declare function feeRecipientQueryOptions(signer: GenericSigner, feeManagerAddress: Address): {
|
|
1015
|
+
readonly queryKey: readonly ["feeRecipient", string];
|
|
1016
|
+
readonly queryFn: () => Promise<`0x${string}`>;
|
|
1017
|
+
readonly staleTime: 30000;
|
|
1018
|
+
};
|
|
1019
|
+
/**
|
|
1020
|
+
* Read the shield fee for a given amount and address pair.
|
|
1021
|
+
*
|
|
1022
|
+
* @param config - Fee manager address, amount, from, and to.
|
|
1023
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
1024
|
+
* @returns Query result with `data: bigint` (the fee amount).
|
|
1025
|
+
*
|
|
1026
|
+
* @example
|
|
1027
|
+
* ```tsx
|
|
1028
|
+
* const { data: fee } = useShieldFee({
|
|
1029
|
+
* feeManagerAddress: "0xFeeManager",
|
|
1030
|
+
* amount: 1000n,
|
|
1031
|
+
* from: "0xSender",
|
|
1032
|
+
* to: "0xReceiver",
|
|
1033
|
+
* });
|
|
1034
|
+
* ```
|
|
1035
|
+
*/
|
|
1036
|
+
declare function useShieldFee(config: UseFeeConfig, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Read the unshield fee for a given amount and address pair.
|
|
1039
|
+
*
|
|
1040
|
+
* @param config - Fee manager address, amount, from, and to.
|
|
1041
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
1042
|
+
* @returns Query result with `data: bigint` (the fee amount).
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```tsx
|
|
1046
|
+
* const { data: fee } = useUnshieldFee({
|
|
1047
|
+
* feeManagerAddress: "0xFeeManager",
|
|
1048
|
+
* amount: 1000n,
|
|
1049
|
+
* from: "0xSender",
|
|
1050
|
+
* to: "0xReceiver",
|
|
1051
|
+
* });
|
|
1052
|
+
* ```
|
|
1053
|
+
*/
|
|
1054
|
+
declare function useUnshieldFee(config: UseFeeConfig, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
|
|
1055
|
+
/**
|
|
1056
|
+
* Read the batch transfer fee from the fee manager.
|
|
1057
|
+
*
|
|
1058
|
+
* @param feeManagerAddress - Address of the fee manager contract.
|
|
1059
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
1060
|
+
* @returns Query result with `data: bigint` (the fee amount).
|
|
1061
|
+
*
|
|
1062
|
+
* @example
|
|
1063
|
+
* ```tsx
|
|
1064
|
+
* const { data: fee } = useBatchTransferFee("0xFeeManager");
|
|
1065
|
+
* ```
|
|
1066
|
+
*/
|
|
1067
|
+
declare function useBatchTransferFee(feeManagerAddress: Address, options?: Omit<UseQueryOptions<bigint, Error>, "queryKey" | "queryFn">): UseQueryResult<bigint, Error>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Read the fee recipient address from the fee manager.
|
|
1070
|
+
*
|
|
1071
|
+
* @param feeManagerAddress - Address of the fee manager contract.
|
|
1072
|
+
* @param options - React Query options (forwarded to `useQuery`).
|
|
1073
|
+
* @returns Query result with `data: Address` (the fee recipient).
|
|
1074
|
+
*
|
|
1075
|
+
* @example
|
|
1076
|
+
* ```tsx
|
|
1077
|
+
* const { data: recipient } = useFeeRecipient("0xFeeManager");
|
|
1078
|
+
* ```
|
|
1079
|
+
*/
|
|
1080
|
+
declare function useFeeRecipient(feeManagerAddress: Address, options?: Omit<UseQueryOptions<Address, Error>, "queryKey" | "queryFn">): UseQueryResult<Address, Error>;
|
|
1081
|
+
|
|
1082
|
+
export { type ConfidentialTransferParams, type CreateDelegatedUserDecryptEIP712Params, type CreateEIP712Params, type FinalizeUnwrapParams, type PublicKeyData, type PublicParamsData, type ShieldETHParams, type ShieldParams, type UnwrapParams, type UseConfidentialIsApprovedConfig, type UseConfidentialIsApprovedSuspenseConfig, type UseConfidentialTransferConfig, type UseFeeConfig, type UseShieldConfig, type UseUnderlyingAllowanceConfig, type UseWrapperDiscoveryConfig, type UseWrapperDiscoverySuspenseConfig, UseZamaConfig, ZamaProvider, batchTransferFeeQueryOptions, confidentialBalanceQueryKeys, confidentialBalancesQueryKeys, confidentialHandleQueryKeys, confidentialHandlesQueryKeys, confidentialIsApprovedQueryKeys, confidentialIsApprovedQueryOptions, confidentialTransferMutationOptions, decryptionKeys, encryptMutationOptions, feeQueryKeys, feeRecipientQueryOptions, finalizeUnwrapMutationOptions, isConfidentialQueryKeys, isConfidentialQueryOptions, isWrapperQueryKeys, isWrapperQueryOptions, publicKeyQueryKeys, publicKeyQueryOptions, publicParamsQueryKeys, publicParamsQueryOptions, shieldETHMutationOptions, shieldFeeQueryOptions, shieldMutationOptions, totalSupplyQueryKeys, totalSupplyQueryOptions, underlyingAllowanceQueryKeys, underlyingAllowanceQueryOptions, unshieldFeeQueryOptions, unwrapMutationOptions, useBatchTransferFee, useConfidentialIsApproved, useConfidentialIsApprovedSuspense, useConfidentialTransfer, useCreateDelegatedUserDecryptEIP712, useCreateEIP712, useDelegatedUserDecrypt, useEncrypt, useFeeRecipient, useFinalizeUnwrap, useGenerateKeypair, useIsConfidential, useIsConfidentialSuspense, useIsWrapper, useIsWrapperSuspense, usePublicDecrypt, usePublicKey, usePublicParams, useReadonlyToken, useRequestZKProofVerification, useShield, useShieldETH, useShieldFee, useTotalSupply, useTotalSupplySuspense, useUnderlyingAllowance, useUnderlyingAllowanceSuspense, useUnshieldFee, useUnwrap, useUserDecrypt, useUserDecryptedValue, useUserDecryptedValues, useWrapperDiscovery, useWrapperDiscoverySuspense, useZamaSDK, wrapperDiscoveryQueryKeys, wrapperDiscoveryQueryOptions };
|