@tokenops/sdk 2.0.0-alpha.1 → 2.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.
Files changed (145) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +5 -5
  3. package/dist/{chunk-JZLGCTGK.cjs → chunk-3YHBO2DL.cjs} +2 -2
  4. package/dist/{chunk-H5POPGOZ.js → chunk-44YJPMQC.js} +1 -1
  5. package/dist/{chunk-DZHYSUGY.js → chunk-A4DCEE33.js} +11 -5
  6. package/dist/{chunk-M4IT6DNJ.cjs → chunk-AREQJHKA.cjs} +108 -3
  7. package/dist/chunk-EBLBPUPI.cjs +255 -0
  8. package/dist/chunk-EYDA6Q6C.js +245 -0
  9. package/dist/{chunk-XAYGD4E4.cjs → chunk-FEDX7B6T.cjs} +3 -3
  10. package/dist/{chunk-JQYC66TO.cjs → chunk-FHWSBGWE.cjs} +5 -5
  11. package/dist/{chunk-5576FRT3.cjs → chunk-FT5H2Q7Y.cjs} +11 -5
  12. package/dist/{chunk-456VDDA3.js → chunk-GADGBQJO.js} +78 -25
  13. package/dist/{chunk-6NAVMWZQ.js → chunk-IGO5XSPS.js} +2 -2
  14. package/dist/{chunk-CTED3MTR.cjs → chunk-IUKKNJ2R.cjs} +82 -29
  15. package/dist/{chunk-FGEB7RMY.cjs → chunk-MM5BV5CS.cjs} +4 -4
  16. package/dist/{chunk-335Z2W67.js → chunk-PYYSB5ZN.js} +1 -1
  17. package/dist/{chunk-PUX5VXDB.cjs → chunk-PZZK3O3S.cjs} +1040 -42
  18. package/dist/{chunk-74QFZ5MK.js → chunk-SPLNGUFF.js} +1 -1
  19. package/dist/{chunk-6PXXGACR.cjs → chunk-UHHMVBLU.cjs} +2 -2
  20. package/dist/{chunk-O5676ZWY.js → chunk-VW356KR3.js} +108 -5
  21. package/dist/{chunk-EAJ7SYHE.js → chunk-WJMEBBU7.js} +1 -1
  22. package/dist/{chunk-GKKDAW44.js → chunk-X7WBPCEU.js} +1026 -32
  23. package/dist/core/addresses.d.ts +4 -4
  24. package/dist/core/errors.d.ts +1 -1
  25. package/dist/fhe/types.d.ts +2 -2
  26. package/dist/fhe-airdrop/abis/merkle.d.ts +24 -12
  27. package/dist/fhe-airdrop/advanced/index.cjs +4 -4
  28. package/dist/fhe-airdrop/advanced/index.js +1 -1
  29. package/dist/fhe-airdrop/advanced/react/index.cjs +590 -9
  30. package/dist/fhe-airdrop/advanced/react/index.d.cts +34 -0
  31. package/dist/fhe-airdrop/advanced/react/index.d.ts +34 -0
  32. package/dist/fhe-airdrop/advanced/react/index.js +561 -7
  33. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
  34. package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
  35. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +25 -0
  36. package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
  37. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
  38. package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
  39. package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
  40. package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
  41. package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
  42. package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
  43. package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +36 -0
  44. package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +35 -0
  45. package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
  46. package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +47 -0
  47. package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
  48. package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
  49. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
  50. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
  51. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
  52. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +28 -0
  53. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
  54. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +28 -0
  55. package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
  56. package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
  57. package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
  58. package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
  59. package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
  60. package/dist/fhe-airdrop/airdrop-base.d.ts +8 -0
  61. package/dist/fhe-airdrop/campaign.d.ts +61 -20
  62. package/dist/fhe-airdrop/constants.d.ts +1 -1
  63. package/dist/fhe-airdrop/errors.d.ts +28 -0
  64. package/dist/fhe-airdrop/guards.d.ts +46 -2
  65. package/dist/fhe-airdrop/index.cjs +74 -971
  66. package/dist/fhe-airdrop/index.d.cts +2 -2
  67. package/dist/fhe-airdrop/index.d.ts +2 -2
  68. package/dist/fhe-airdrop/index.js +8 -927
  69. package/dist/fhe-airdrop/merkle-tree.d.ts +32 -38
  70. package/dist/fhe-airdrop/merkle.d.ts +52 -31
  71. package/dist/fhe-airdrop/react/_shared.d.ts +13 -0
  72. package/dist/fhe-airdrop/react/index.cjs +934 -84
  73. package/dist/fhe-airdrop/react/index.d.cts +49 -3
  74. package/dist/fhe-airdrop/react/index.d.ts +49 -3
  75. package/dist/fhe-airdrop/react/index.js +825 -22
  76. package/dist/fhe-airdrop/react/keys.d.ts +90 -0
  77. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
  78. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
  79. package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
  80. package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
  81. package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
  82. package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
  83. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
  84. package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
  85. package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +35 -0
  86. package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
  87. package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +33 -0
  88. package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
  89. package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
  90. package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
  91. package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
  92. package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
  93. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
  94. package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
  95. package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
  96. package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
  97. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
  98. package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
  99. package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
  100. package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
  101. package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
  102. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
  103. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
  104. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
  105. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +4 -3
  106. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
  107. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
  108. package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
  109. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
  110. package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
  111. package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
  112. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
  113. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +7 -19
  114. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
  115. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
  116. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
  117. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +67 -0
  118. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
  119. package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
  120. package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
  121. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
  122. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +42 -0
  123. package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
  124. package/dist/fhe-airdrop/types.d.ts +14 -1
  125. package/dist/fhe-disperse/index.cjs +21 -21
  126. package/dist/fhe-disperse/index.js +2 -2
  127. package/dist/fhe-disperse/react/index.cjs +22 -22
  128. package/dist/fhe-disperse/react/index.js +3 -3
  129. package/dist/fhe-vesting/advanced/index.cjs +5 -5
  130. package/dist/fhe-vesting/advanced/index.js +3 -3
  131. package/dist/fhe-vesting/advanced/react/index.cjs +7 -7
  132. package/dist/fhe-vesting/advanced/react/index.js +4 -4
  133. package/dist/fhe-vesting/index.cjs +8 -8
  134. package/dist/fhe-vesting/index.js +2 -2
  135. package/dist/fhe-vesting/react/index.cjs +114 -114
  136. package/dist/fhe-vesting/react/index.js +3 -3
  137. package/dist/index.cjs +18 -18
  138. package/dist/index.js +1 -1
  139. package/dist/testnet-faucet/index.cjs +14 -14
  140. package/dist/testnet-faucet/index.js +2 -2
  141. package/dist/testnet-faucet/react/index.cjs +8 -8
  142. package/dist/testnet-faucet/react/index.js +3 -3
  143. package/package.json +1 -1
  144. package/dist/chunk-NCVX3K2N.cjs +0 -161
  145. package/dist/chunk-VP2B4WM2.js +0 -154
@@ -1,19 +1,22 @@
1
- import { grantInstanceRoles } from '../../chunk-456VDDA3.js';
2
- export { buildMerkleCampaign, buildMerkleTree, encryptCampaignAmounts, grantInstanceRoles, leafOf, planInstanceRoleSplit, planMerkleCampaign, rotateMerkleRoot, validateCampaignRecipients } from '../../chunk-456VDDA3.js';
3
- import { useMemoAirdropBaseClient, airdropQueryKey, useMemoMerkleAirdropClient, useMemoAirdropFactoryClient, airdropQueryKeyPrefix, useMemoEcdsaAirdropClient } from '../../chunk-VP2B4WM2.js';
4
- export { airdropQueryKey, airdropQueryKeyPrefix } from '../../chunk-VP2B4WM2.js';
5
- export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-GKKDAW44.js';
6
- export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, DedupIdConsumedError, FeeCollectorSelfAdministeredError, MerkleUupsUnsupportedError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UpgradeabilityNotAllowedError, preflightClaim, preflightCreate } from '../../chunk-O5676ZWY.js';
1
+ import { grantInstanceRoles, buildMerkleCampaign, encryptCampaignAmounts, planMerkleCampaign, rotateMerkleRoot } from '../../chunk-GADGBQJO.js';
2
+ export { buildMerkleCampaign, buildMerkleTree, encryptCampaignAmounts, grantInstanceRoles, leafOf, planInstanceRoleSplit, planMerkleCampaign, rotateMerkleRoot, validateCampaignRecipients } from '../../chunk-GADGBQJO.js';
3
+ import { useMemoAirdropBaseClient, airdropQueryKey, useMemoMerkleAirdropClient, useMemoAirdropFactoryClient, airdropKeys, useMemoEcdsaAirdropClient, useMemoComplianceManagerClient, AIRDROP_FN, airdropQueryKeyPrefix } from '../../chunk-EYDA6Q6C.js';
4
+ export { airdropQueryKey, airdropQueryKeyPrefix } from '../../chunk-EYDA6Q6C.js';
5
+ import { resolveEncryptor, signClaimAuthorization } from '../../chunk-X7WBPCEU.js';
6
+ export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-X7WBPCEU.js';
7
+ import { preflightClaim, preflightCreate } from '../../chunk-VW356KR3.js';
8
+ export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, DedupIdConsumedError, FeeCollectorSelfAdministeredError, MerkleUupsUnsupportedError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UnauthorizedRedirectError, UpgradeabilityNotAllowedError, preflightClaim, preflightCreate } from '../../chunk-VW356KR3.js';
7
9
  import '../../chunk-ZWXJTBZO.js';
8
10
  import '../../chunk-NWFMBLSQ.js';
9
11
  import '../../chunk-4RAAATVY.js';
10
- import '../../chunk-DZHYSUGY.js';
12
+ import '../../chunk-A4DCEE33.js';
11
13
  import '../../chunk-ZA673I3O.js';
12
14
  import '../../chunk-KWFFIJYX.js';
13
- import { MissingClientError } from '../../chunk-QBJ7O2B4.js';
15
+ import { MissingClientError, MissingWalletClientError } from '../../chunk-QBJ7O2B4.js';
14
16
  export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-QBJ7O2B4.js';
15
17
  import '../../chunk-Q2GP5UDC.js';
16
18
  import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
19
+ import { useRef } from 'react';
17
20
 
18
21
  function useAirdropToken(args) {
19
22
  const { client, chainId } = useMemoAirdropBaseClient(args);
@@ -164,6 +167,358 @@ function useEffectiveUpgradeable(args = {}) {
164
167
  enabled: Boolean(client && creator && (args.query?.enabled ?? true))
165
168
  });
166
169
  }
170
+ function useAirdropConfig(args) {
171
+ const { client, chainId } = useMemoAirdropBaseClient(args);
172
+ return useQuery({
173
+ staleTime: Infinity,
174
+ ...args.query,
175
+ queryKey: airdropKeys.config({ chainId, address: args.address }),
176
+ queryFn: async () => {
177
+ const [token, airdropType, unwrappable, complianceManager, gasFee] = await Promise.all([
178
+ client.token(),
179
+ client.airdropType(),
180
+ client.unwrappable(),
181
+ client.complianceManager(),
182
+ client.gasFee()
183
+ ]);
184
+ return {
185
+ token,
186
+ airdropType,
187
+ variant: airdropType === 1 ? "merkle" : "ecdsa",
188
+ unwrappable,
189
+ complianceManager,
190
+ gasFee
191
+ };
192
+ },
193
+ enabled: Boolean(client && (args.query?.enabled ?? true))
194
+ });
195
+ }
196
+ function useAirdropDeploymentMode(args) {
197
+ const { client, chainId } = useMemoAirdropBaseClient(args);
198
+ return useQuery({
199
+ staleTime: Infinity,
200
+ ...args.query,
201
+ queryKey: airdropQueryKey({
202
+ chainId,
203
+ address: args.address,
204
+ fn: "deploymentMode",
205
+ args: []
206
+ }),
207
+ queryFn: () => client.deploymentMode(),
208
+ enabled: Boolean(client && (args.query?.enabled ?? true))
209
+ });
210
+ }
211
+ function useAirdropRoleAdmin(args) {
212
+ const { role, ...base } = args;
213
+ const { client, chainId } = useMemoAirdropBaseClient(base);
214
+ return useQuery({
215
+ // A default, not a lock: `query.staleTime` still wins.
216
+ staleTime: Infinity,
217
+ ...args.query,
218
+ queryKey: airdropQueryKey({
219
+ chainId,
220
+ address: args.address,
221
+ fn: "getRoleAdmin",
222
+ args: [role]
223
+ }),
224
+ queryFn: () => client.getRoleAdmin(role),
225
+ enabled: Boolean(client && role && (args.query?.enabled ?? true))
226
+ });
227
+ }
228
+ function useAirdropRoleConstants(args) {
229
+ const { variant, dedupMode, ...base } = args;
230
+ const { client, chainId } = useMemoAirdropBaseClient(base);
231
+ const { client: merkleClient } = useMemoMerkleAirdropClient(base);
232
+ const { client: ecdsaClient } = useMemoEcdsaAirdropClient({
233
+ ...base,
234
+ dedupMode: dedupMode ?? "none"
235
+ });
236
+ return useQuery({
237
+ // A default, not a lock: `query.staleTime` still wins if a consumer wants refetching.
238
+ staleTime: Infinity,
239
+ ...args.query,
240
+ // `variant` is in the key because it changes the SHAPE of the result -
241
+ // the merkle and ecdsa responses must not share a cache slot.
242
+ queryKey: airdropQueryKey({
243
+ chainId,
244
+ address: args.address,
245
+ fn: "roleConstants",
246
+ args: [variant]
247
+ }),
248
+ queryFn: async () => {
249
+ const [
250
+ PAUSER_ROLE,
251
+ WINDOW_ADMIN_ROLE,
252
+ TREASURY_ROLE,
253
+ RESCUER_ROLE,
254
+ FEE_COLLECTOR_ROLE,
255
+ UPGRADER_ROLE,
256
+ DISCLOSURE_ADMIN_ROLE,
257
+ DEFAULT_ADMIN_ROLE,
258
+ variantRole
259
+ ] = await Promise.all([
260
+ client.PAUSER_ROLE(),
261
+ client.WINDOW_ADMIN_ROLE(),
262
+ client.TREASURY_ROLE(),
263
+ client.RESCUER_ROLE(),
264
+ client.FEE_COLLECTOR_ROLE(),
265
+ client.UPGRADER_ROLE(),
266
+ client.DISCLOSURE_ADMIN_ROLE(),
267
+ client.DEFAULT_ADMIN_ROLE(),
268
+ variant === "merkle" ? merkleClient.MERKLE_ADMIN_ROLE() : variant === "ecdsa" ? ecdsaClient.SIGNER_ROLE() : Promise.resolve(void 0)
269
+ ]);
270
+ return {
271
+ PAUSER_ROLE,
272
+ WINDOW_ADMIN_ROLE,
273
+ TREASURY_ROLE,
274
+ RESCUER_ROLE,
275
+ FEE_COLLECTOR_ROLE,
276
+ UPGRADER_ROLE,
277
+ DISCLOSURE_ADMIN_ROLE,
278
+ DEFAULT_ADMIN_ROLE,
279
+ ...variant === "merkle" && variantRole ? { MERKLE_ADMIN_ROLE: variantRole } : {},
280
+ ...variant === "ecdsa" && variantRole ? { SIGNER_ROLE: variantRole } : {}
281
+ };
282
+ },
283
+ enabled: Boolean(client && (args.query?.enabled ?? true))
284
+ });
285
+ }
286
+ function useAirdropRoleMembers(args) {
287
+ const { role, ...base } = args;
288
+ const { client, chainId } = useMemoAirdropBaseClient(base);
289
+ return useQuery({
290
+ ...args.query,
291
+ queryKey: airdropKeys.roleMembers({ chainId, address: args.address }, role),
292
+ queryFn: async () => {
293
+ const [members, count] = await Promise.all([
294
+ client.getRoleMembers(role),
295
+ client.getRoleMemberCount(role)
296
+ ]);
297
+ return { members, count };
298
+ },
299
+ enabled: Boolean(client && role && (args.query?.enabled ?? true))
300
+ });
301
+ }
302
+ function useComplianceHasRole(args) {
303
+ const { role, holder, ...base } = args;
304
+ const { client, chainId } = useMemoComplianceManagerClient(base);
305
+ return useQuery({
306
+ ...args.query,
307
+ queryKey: airdropKeys.complianceHasRole({ chainId, address: args.address }, role, holder),
308
+ queryFn: () => client.hasRole({ role, holder }),
309
+ enabled: Boolean(client && role && holder && (args.query?.enabled ?? true))
310
+ });
311
+ }
312
+ function useComplianceInfo(args) {
313
+ const { client, chainId } = useMemoComplianceManagerClient(args);
314
+ return useQuery({
315
+ ...args.query,
316
+ queryKey: airdropKeys.complianceInfo({ chainId, address: args.address }),
317
+ queryFn: async () => {
318
+ const [airdrop, platformDelegate, clientDelegates] = await Promise.all([
319
+ client.airdrop(),
320
+ client.complianceDelegate(),
321
+ client.clientDelegates()
322
+ ]);
323
+ return { airdrop, platformDelegate, clientDelegates };
324
+ },
325
+ enabled: Boolean(client && (args.query?.enabled ?? true))
326
+ });
327
+ }
328
+ function useComplianceManagerOf(args = {}) {
329
+ const { airdrop, ...base } = args;
330
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
331
+ return useQuery({
332
+ staleTime: Infinity,
333
+ ...args.query,
334
+ queryKey: airdropQueryKey({
335
+ chainId,
336
+ address: resolvedAddress,
337
+ fn: "complianceManagerOf",
338
+ args: [airdrop]
339
+ }),
340
+ queryFn: () => client.complianceManagerOf(airdrop),
341
+ enabled: Boolean(client && airdrop && (args.query?.enabled ?? true))
342
+ });
343
+ }
344
+ function useComplianceRoleConstants(args) {
345
+ const { client, chainId } = useMemoComplianceManagerClient(args);
346
+ return useQuery({
347
+ // A default, not a lock: `query.staleTime` still wins.
348
+ staleTime: Infinity,
349
+ ...args.query,
350
+ queryKey: airdropQueryKey({
351
+ chainId,
352
+ address: args.address,
353
+ fn: "complianceRoleConstants",
354
+ args: []
355
+ }),
356
+ queryFn: async () => {
357
+ const [DELEGATION_ADMIN_ROLE, DEFAULT_ADMIN_ROLE] = await Promise.all([
358
+ client.DELEGATION_ADMIN_ROLE(),
359
+ client.DEFAULT_ADMIN_ROLE()
360
+ ]);
361
+ return { DELEGATION_ADMIN_ROLE, DEFAULT_ADMIN_ROLE };
362
+ },
363
+ enabled: Boolean(client && (args.query?.enabled ?? true))
364
+ });
365
+ }
366
+ function useComplianceRoleMembers(args) {
367
+ const { role, ...base } = args;
368
+ const { client, chainId } = useMemoComplianceManagerClient(base);
369
+ return useQuery({
370
+ ...args.query,
371
+ queryKey: airdropKeys.complianceRoleMembers({ chainId, address: args.address }, role),
372
+ queryFn: async () => {
373
+ const [members, count] = await Promise.all([
374
+ client.getRoleMembers(role),
375
+ client.getRoleMemberCount(role)
376
+ ]);
377
+ return { members, count };
378
+ },
379
+ enabled: Boolean(client && role && (args.query?.enabled ?? true))
380
+ });
381
+ }
382
+ function useEcdsaDomain(args) {
383
+ const { client, chainId } = useMemoEcdsaAirdropClient(args);
384
+ return useQuery({
385
+ staleTime: Infinity,
386
+ ...args.query,
387
+ // `dedupMode` is a client-construction concern only; it moves no value
388
+ // read here, so it stays out of the key.
389
+ queryKey: airdropQueryKey({ chainId, address: args.address, fn: "ecdsaDomain", args: [] }),
390
+ queryFn: async () => {
391
+ const [claimTypehash, domainSeparator, domain] = await Promise.all([
392
+ client.claimTypehash(),
393
+ client.domainSeparator(),
394
+ client.eip712Domain()
395
+ ]);
396
+ return { claimTypehash, domainSeparator, domain };
397
+ },
398
+ enabled: Boolean(client && (args.query?.enabled ?? true))
399
+ });
400
+ }
401
+ function useEffectiveDelegateToCompliance(args = {}) {
402
+ const { creator, ...base } = args;
403
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
404
+ return useQuery({
405
+ ...args.query,
406
+ queryKey: airdropQueryKey({
407
+ chainId,
408
+ address: resolvedAddress,
409
+ fn: "effectiveDelegateToCompliance",
410
+ args: [creator]
411
+ }),
412
+ queryFn: () => client.effectiveDelegateToCompliance(creator),
413
+ enabled: Boolean(client && creator && (args.query?.enabled ?? true))
414
+ });
415
+ }
416
+ function useIsActiveDelegate(args) {
417
+ const { delegate, ...base } = args;
418
+ const { client, chainId } = useMemoComplianceManagerClient(base);
419
+ return useQuery({
420
+ ...args.query,
421
+ queryKey: airdropKeys.activeDelegate({ chainId, address: args.address }, delegate),
422
+ queryFn: () => client.isActiveDelegate(delegate),
423
+ enabled: Boolean(client && delegate && (args.query?.enabled ?? true))
424
+ });
425
+ }
426
+ function useIsMerkleRootMutable(args) {
427
+ const { client, chainId } = useMemoMerkleAirdropClient(args);
428
+ return useQuery({
429
+ // Before the spread so a consumer can still opt into refetching.
430
+ staleTime: Infinity,
431
+ ...args.query,
432
+ queryKey: airdropKeys.merkleRootMutable({ chainId, address: args.address }),
433
+ queryFn: () => client.isMerkleRootMutable(),
434
+ enabled: Boolean(client && (args.query?.enabled ?? true))
435
+ });
436
+ }
437
+ function useIsSignatureValid(args) {
438
+ const { recipient, encryptedAmountHandle, dedupId, deadline, signer, signature, ...base } = args;
439
+ const { client, chainId } = useMemoEcdsaAirdropClient(base);
440
+ return useQuery({
441
+ ...args.query,
442
+ queryKey: airdropQueryKey({
443
+ chainId,
444
+ address: args.address,
445
+ fn: AIRDROP_FN.isSignatureValid,
446
+ args: [recipient, encryptedAmountHandle, dedupId, deadline, signer, signature]
447
+ }),
448
+ queryFn: () => client.isSignatureValid({
449
+ recipient,
450
+ encryptedAmountHandle,
451
+ dedupId,
452
+ deadline,
453
+ signer,
454
+ signature
455
+ }),
456
+ enabled: Boolean(
457
+ client && recipient && encryptedAmountHandle && dedupId && deadline !== void 0 && signer && signature && (args.query?.enabled ?? true)
458
+ )
459
+ });
460
+ }
461
+ function usePreflightClaim(args) {
462
+ const { variant, dedupMode, claimant, account, to, entrypoint, signature, ...base } = args;
463
+ const { client: merkleClient, chainId } = useMemoMerkleAirdropClient(base);
464
+ const { client: ecdsaClient } = useMemoEcdsaAirdropClient({
465
+ ...base,
466
+ dedupMode: dedupMode ?? "none"
467
+ });
468
+ const client = variant === "ecdsa" ? ecdsaClient : merkleClient;
469
+ return useQuery({
470
+ ...args.query,
471
+ queryKey: airdropQueryKey({
472
+ chainId,
473
+ address: args.address,
474
+ fn: "preflightClaim",
475
+ args: [variant, claimant, account, to, entrypoint, signature]
476
+ }),
477
+ queryFn: () => preflightClaim({
478
+ airdrop: client,
479
+ claimant,
480
+ account,
481
+ to,
482
+ entrypoint,
483
+ signature
484
+ }),
485
+ enabled: Boolean(client && claimant && (args.query?.enabled ?? true))
486
+ });
487
+ }
488
+ function usePreflightCreateAirdrop(args = {}) {
489
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
490
+ return useQuery({
491
+ ...args.query,
492
+ queryKey: airdropQueryKey({
493
+ chainId,
494
+ address: resolvedAddress,
495
+ fn: AIRDROP_FN.preflightCreate,
496
+ args: [
497
+ args.variant,
498
+ args.mode,
499
+ args.creator,
500
+ args.userSalt,
501
+ args.expectedInitCodeHash,
502
+ // `params` IS key-affecting here, unlike in the predict hooks: the
503
+ // stock-wrapper probe reads `common.token` / `common.unwrappable`.
504
+ args.params
505
+ ]
506
+ }),
507
+ queryFn: () => {
508
+ const common = {
509
+ factory: client,
510
+ mode: args.mode,
511
+ creator: args.creator,
512
+ userSalt: args.userSalt,
513
+ expectedInitCodeHash: args.expectedInitCodeHash
514
+ };
515
+ return args.variant === "merkle" ? preflightCreate({ ...common, variant: "merkle", params: args.params }) : preflightCreate({ ...common, variant: "ecdsa", params: args.params });
516
+ },
517
+ enabled: Boolean(
518
+ client && args.variant && args.params && args.mode && args.creator && args.userSalt && (args.query?.enabled ?? true)
519
+ )
520
+ });
521
+ }
167
522
  function useCreateEcdsaAirdrop(options = {}) {
168
523
  const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
169
524
  const queryClient = useQueryClient();
@@ -210,18 +565,24 @@ function useFundAirdrop(options = {}) {
210
565
  });
211
566
  }
212
567
  function useEcdsaClaim(options) {
213
- const { client } = useMemoEcdsaAirdropClient(options);
568
+ const { client, chainId } = useMemoEcdsaAirdropClient(options);
569
+ const queryClient = useQueryClient();
214
570
  return useMutation({
215
571
  mutationFn: async (args) => {
216
572
  if (!client) {
217
573
  throw new MissingClientError("useEcdsaClaim", "ecdsa-airdrop");
218
574
  }
219
575
  return client.claim(args);
576
+ },
577
+ onSuccess: () => {
578
+ void queryClient.invalidateQueries({
579
+ queryKey: airdropKeys.isSignatureValidAll({ chainId, address: options.address })
580
+ });
220
581
  }
221
582
  });
222
583
  }
223
584
  function useMerkleClaim(options) {
224
- const { client, chainId, walletClient } = useMemoMerkleAirdropClient(options);
585
+ const { client, chainId } = useMemoMerkleAirdropClient(options);
225
586
  const queryClient = useQueryClient();
226
587
  return useMutation({
227
588
  mutationFn: async (args) => {
@@ -230,20 +591,15 @@ function useMerkleClaim(options) {
230
591
  }
231
592
  return client.claim(args);
232
593
  },
233
- onMutate: (variables) => {
234
- const account = variables.account ?? walletClient?.account;
235
- return {
236
- claimant: account ? typeof account === "string" ? account : account.address : void 0
237
- };
238
- },
594
+ onMutate: (variables) => ({ account: variables.entry.account }),
239
595
  onSuccess: (_hash, _variables, context) => {
240
- if (!context?.claimant) return;
596
+ if (!context?.account) return;
241
597
  void queryClient.invalidateQueries({
242
598
  queryKey: airdropQueryKey({
243
599
  chainId,
244
600
  address: options.address,
245
601
  fn: "getClaimedAmount",
246
- args: [context.claimant]
602
+ args: [context.account]
247
603
  })
248
604
  });
249
605
  }
@@ -286,9 +642,9 @@ function useGrantInstanceRoles(options) {
286
642
  });
287
643
  },
288
644
  onSuccess: () => {
289
- void queryClient.invalidateQueries({
290
- queryKey: airdropQueryKeyPrefix({ chainId, address: options.address, fn: "hasRole" })
291
- });
645
+ const scope = { chainId, address: options.address };
646
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.hasRoleAll(scope) });
647
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.roleMembersAll(scope) });
292
648
  }
293
649
  });
294
650
  }
@@ -340,5 +696,452 @@ function useWithdrawConfidential(options) {
340
696
  }
341
697
  });
342
698
  }
699
+ function useAddComplianceDelegate(options) {
700
+ const { client, chainId } = useMemoComplianceManagerClient(options);
701
+ const queryClient = useQueryClient();
702
+ return useMutation({
703
+ mutationFn: async (args) => {
704
+ if (!client) {
705
+ throw new MissingClientError("useAddComplianceDelegate", "compliance-manager");
706
+ }
707
+ return client.addDelegate(args);
708
+ },
709
+ onSuccess: (_hash, variables) => {
710
+ const scope = { chainId, address: options.address };
711
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.complianceInfo(scope) });
712
+ void queryClient.invalidateQueries({
713
+ queryKey: airdropKeys.activeDelegate(scope, variables.delegate)
714
+ });
715
+ }
716
+ });
717
+ }
718
+ function useAirdropGrantRole(options) {
719
+ const { client, chainId } = useMemoAirdropBaseClient(options);
720
+ const queryClient = useQueryClient();
721
+ return useMutation({
722
+ mutationFn: async (args) => {
723
+ if (!client) {
724
+ throw new MissingClientError("useAirdropGrantRole", "airdrop-base");
725
+ }
726
+ return client.grantRole(args);
727
+ },
728
+ onSuccess: (_hash, variables) => {
729
+ const scope = { chainId, address: options.address };
730
+ void queryClient.invalidateQueries({
731
+ queryKey: airdropKeys.hasRole(scope, variables.role, variables.holder)
732
+ });
733
+ void queryClient.invalidateQueries({
734
+ queryKey: airdropKeys.roleMembers(scope, variables.role)
735
+ });
736
+ }
737
+ });
738
+ }
739
+ function useAirdropRenounceRole(options) {
740
+ const { client, chainId } = useMemoAirdropBaseClient(options);
741
+ const queryClient = useQueryClient();
742
+ return useMutation({
743
+ mutationFn: async (args) => {
744
+ if (!client) {
745
+ throw new MissingClientError("useAirdropRenounceRole", "airdrop-base");
746
+ }
747
+ return client.renounceRole(args);
748
+ },
749
+ onSuccess: (_hash, variables) => {
750
+ const scope = { chainId, address: options.address };
751
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.hasRoleAll(scope) });
752
+ void queryClient.invalidateQueries({
753
+ queryKey: airdropKeys.roleMembers(scope, variables.role)
754
+ });
755
+ }
756
+ });
757
+ }
758
+ function useAirdropRevokeRole(options) {
759
+ const { client, chainId } = useMemoAirdropBaseClient(options);
760
+ const queryClient = useQueryClient();
761
+ return useMutation({
762
+ mutationFn: async (args) => {
763
+ if (!client) {
764
+ throw new MissingClientError("useAirdropRevokeRole", "airdrop-base");
765
+ }
766
+ return client.revokeRole(args);
767
+ },
768
+ onSuccess: (_hash, variables) => {
769
+ const scope = { chainId, address: options.address };
770
+ void queryClient.invalidateQueries({
771
+ queryKey: airdropKeys.hasRole(scope, variables.role, variables.holder)
772
+ });
773
+ void queryClient.invalidateQueries({
774
+ queryKey: airdropKeys.roleMembers(scope, variables.role)
775
+ });
776
+ }
777
+ });
778
+ }
779
+ function useAirdropUpgradeToAndCall(options) {
780
+ const { client } = useMemoAirdropBaseClient(options);
781
+ return useMutation({
782
+ mutationFn: async (args) => {
783
+ if (!client) {
784
+ throw new MissingClientError("useAirdropUpgradeToAndCall", "airdrop-base");
785
+ }
786
+ return client.upgradeToAndCall(args);
787
+ }
788
+ });
789
+ }
790
+ function useBatchDiscloseHandlesToParty(options) {
791
+ const { client } = useMemoAirdropBaseClient(options);
792
+ return useMutation({
793
+ mutationFn: async (args) => {
794
+ if (!client) {
795
+ throw new MissingClientError("useBatchDiscloseHandlesToParty", "airdrop-base");
796
+ }
797
+ return client.batchDiscloseHandlesToParty(args);
798
+ }
799
+ });
800
+ }
801
+ function useBuildMerkleCampaign(options = {}) {
802
+ const encryptorSourceRef = useRef(options.encryptor);
803
+ encryptorSourceRef.current = options.encryptor;
804
+ return useMutation({
805
+ mutationFn: async (args) => buildMerkleCampaign({
806
+ instance: args.instance,
807
+ recipients: args.recipients,
808
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current),
809
+ ...args.submitter !== void 0 ? { submitter: args.submitter } : {}
810
+ })
811
+ });
812
+ }
813
+ function useComplianceGrantRole(options) {
814
+ const { client, chainId } = useMemoComplianceManagerClient(options);
815
+ const queryClient = useQueryClient();
816
+ return useMutation({
817
+ mutationFn: async (args) => {
818
+ if (!client) {
819
+ throw new MissingClientError("useComplianceGrantRole", "compliance-manager");
820
+ }
821
+ return client.grantRole(args);
822
+ },
823
+ onSuccess: (_hash, variables) => {
824
+ const scope = { chainId, address: options.address };
825
+ void queryClient.invalidateQueries({
826
+ queryKey: airdropKeys.complianceHasRole(scope, variables.role, variables.holder)
827
+ });
828
+ void queryClient.invalidateQueries({
829
+ queryKey: airdropKeys.complianceRoleMembers(scope, variables.role)
830
+ });
831
+ }
832
+ });
833
+ }
834
+ function useComplianceRenounceRole(options) {
835
+ const { client, chainId } = useMemoComplianceManagerClient(options);
836
+ const queryClient = useQueryClient();
837
+ return useMutation({
838
+ mutationFn: async (args) => {
839
+ if (!client) {
840
+ throw new MissingClientError("useComplianceRenounceRole", "compliance-manager");
841
+ }
842
+ return client.renounceRole(args);
843
+ },
844
+ onSuccess: (_hash, variables) => {
845
+ const scope = { chainId, address: options.address };
846
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.complianceHasRoleAll(scope) });
847
+ void queryClient.invalidateQueries({
848
+ queryKey: airdropKeys.complianceRoleMembers(scope, variables.role)
849
+ });
850
+ }
851
+ });
852
+ }
853
+ function useComplianceRevokeRole(options) {
854
+ const { client, chainId } = useMemoComplianceManagerClient(options);
855
+ const queryClient = useQueryClient();
856
+ return useMutation({
857
+ mutationFn: async (args) => {
858
+ if (!client) {
859
+ throw new MissingClientError("useComplianceRevokeRole", "compliance-manager");
860
+ }
861
+ return client.revokeRole(args);
862
+ },
863
+ onSuccess: (_hash, variables) => {
864
+ const scope = { chainId, address: options.address };
865
+ void queryClient.invalidateQueries({
866
+ queryKey: airdropKeys.complianceHasRole(scope, variables.role, variables.holder)
867
+ });
868
+ void queryClient.invalidateQueries({
869
+ queryKey: airdropKeys.complianceRoleMembers(scope, variables.role)
870
+ });
871
+ }
872
+ });
873
+ }
874
+ function useCreateAndFundEcdsaAirdrop(options = {}) {
875
+ const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
876
+ const queryClient = useQueryClient();
877
+ return useMutation({
878
+ mutationFn: async (args) => {
879
+ if (!client) {
880
+ throw resolutionError ?? new MissingClientError("useCreateAndFundEcdsaAirdrop", "factory");
881
+ }
882
+ return client.createAndFundEcdsaAirdrop(args);
883
+ },
884
+ onSuccess: () => {
885
+ void queryClient.invalidateQueries({
886
+ queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
887
+ });
888
+ }
889
+ });
890
+ }
891
+ function useCreateAndFundMerkleAirdrop(options = {}) {
892
+ const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
893
+ const queryClient = useQueryClient();
894
+ return useMutation({
895
+ mutationFn: async (args) => {
896
+ if (!client) {
897
+ throw resolutionError ?? new MissingClientError("useCreateAndFundMerkleAirdrop", "factory");
898
+ }
899
+ return client.createAndFundMerkleAirdrop(args);
900
+ },
901
+ onSuccess: () => {
902
+ void queryClient.invalidateQueries({
903
+ queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
904
+ });
905
+ }
906
+ });
907
+ }
908
+ function useDiscloseHandleToParty(options) {
909
+ const { client } = useMemoAirdropBaseClient(options);
910
+ return useMutation({
911
+ mutationFn: async (args) => {
912
+ if (!client) {
913
+ throw new MissingClientError("useDiscloseHandleToParty", "airdrop-base");
914
+ }
915
+ return client.discloseHandleToParty(args);
916
+ }
917
+ });
918
+ }
919
+ function useEcdsaClaimAndUnwrap(options) {
920
+ const { client, chainId } = useMemoEcdsaAirdropClient(options);
921
+ const queryClient = useQueryClient();
922
+ return useMutation({
923
+ mutationFn: async (args) => {
924
+ if (!client) {
925
+ throw new MissingClientError("useEcdsaClaimAndUnwrap", "ecdsa-airdrop");
926
+ }
927
+ return client.claimAndUnwrap(args);
928
+ },
929
+ onSuccess: () => {
930
+ void queryClient.invalidateQueries({
931
+ queryKey: airdropKeys.isSignatureValidAll({ chainId, address: options.address })
932
+ });
933
+ }
934
+ });
935
+ }
936
+ function useEncryptCampaignAmounts(options = {}) {
937
+ const encryptorSourceRef = useRef(options.encryptor);
938
+ encryptorSourceRef.current = options.encryptor;
939
+ return useMutation({
940
+ mutationFn: async (args) => encryptCampaignAmounts({
941
+ instance: args.instance,
942
+ recipients: args.recipients,
943
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current),
944
+ ...args.submitter !== void 0 ? { submitter: args.submitter } : {}
945
+ })
946
+ });
947
+ }
948
+ function useMerkleClaimAndUnwrap(options) {
949
+ const { client, walletClient, chainId } = useMemoMerkleAirdropClient(options);
950
+ const queryClient = useQueryClient();
951
+ return useMutation({
952
+ mutationFn: async (args) => {
953
+ if (!client) {
954
+ throw new MissingClientError("useMerkleClaimAndUnwrap", "merkle-airdrop");
955
+ }
956
+ return client.claimAndUnwrap(args);
957
+ },
958
+ // Resolved here rather than in `onSuccess`: a mutation outlives several
959
+ // re-renders of its own component and `useWalletClient().data` can read back
960
+ // transiently empty across them, which would silently skip the invalidation.
961
+ onMutate: (variables) => {
962
+ const account = variables.account ?? walletClient?.account;
963
+ if (!account) return {};
964
+ return { sender: typeof account === "string" ? account : account.address };
965
+ },
966
+ onSuccess: (_hash, _variables, context) => {
967
+ if (!context?.sender) return;
968
+ void queryClient.invalidateQueries({
969
+ queryKey: airdropKeys.claimedAmount({ chainId, address: options.address }, context.sender)
970
+ });
971
+ }
972
+ });
973
+ }
974
+ function usePlanMerkleCampaign(options = {}) {
975
+ const { client, resolutionError } = useMemoAirdropFactoryClient(options);
976
+ const encryptorSourceRef = useRef(options.encryptor);
977
+ encryptorSourceRef.current = options.encryptor;
978
+ return useMutation({
979
+ mutationFn: async (args) => {
980
+ if (!client) {
981
+ throw resolutionError ?? new MissingClientError("usePlanMerkleCampaign", "factory");
982
+ }
983
+ return planMerkleCampaign({
984
+ factory: client,
985
+ ...args,
986
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current)
987
+ });
988
+ }
989
+ });
990
+ }
991
+ function useRescueERC20(options) {
992
+ const { client } = useMemoAirdropBaseClient(options);
993
+ return useMutation({
994
+ mutationFn: async (args) => {
995
+ if (!client) {
996
+ throw new MissingClientError("useRescueERC20", "airdrop-base");
997
+ }
998
+ return client.rescueERC20(args);
999
+ }
1000
+ });
1001
+ }
1002
+ function useRescueOtherConfidentialToken(options) {
1003
+ const { client } = useMemoAirdropBaseClient(options);
1004
+ return useMutation({
1005
+ mutationFn: async (args) => {
1006
+ if (!client) {
1007
+ throw new MissingClientError("useRescueOtherConfidentialToken", "airdrop-base");
1008
+ }
1009
+ return client.rescueOtherConfidentialToken(args);
1010
+ }
1011
+ });
1012
+ }
1013
+ function useRevokeComplianceDelegate(options) {
1014
+ const { client, chainId } = useMemoComplianceManagerClient(options);
1015
+ const queryClient = useQueryClient();
1016
+ return useMutation({
1017
+ mutationFn: async (args) => {
1018
+ if (!client) {
1019
+ throw new MissingClientError("useRevokeComplianceDelegate", "compliance-manager");
1020
+ }
1021
+ return client.revokeDelegate(args);
1022
+ },
1023
+ onSuccess: (_hash, variables) => {
1024
+ const scope = { chainId, address: options.address };
1025
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.complianceInfo(scope) });
1026
+ void queryClient.invalidateQueries({
1027
+ queryKey: airdropKeys.activeDelegate(scope, variables.delegate)
1028
+ });
1029
+ }
1030
+ });
1031
+ }
1032
+ function useRotateMerkleRoot(options) {
1033
+ const { client, chainId } = useMemoMerkleAirdropClient(options);
1034
+ const encryptorSourceRef = useRef(options.encryptor);
1035
+ encryptorSourceRef.current = options.encryptor;
1036
+ const queryClient = useQueryClient();
1037
+ return useMutation({
1038
+ mutationFn: async (args) => {
1039
+ if (!client) {
1040
+ throw new MissingClientError("useRotateMerkleRoot", "merkle-airdrop");
1041
+ }
1042
+ return rotateMerkleRoot({
1043
+ airdrop: client,
1044
+ recipients: args.recipients,
1045
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current),
1046
+ ...args.submitter !== void 0 ? { submitter: args.submitter } : {},
1047
+ ...args.account !== void 0 ? { account: args.account } : {}
1048
+ });
1049
+ },
1050
+ onSuccess: () => {
1051
+ void queryClient.invalidateQueries({
1052
+ queryKey: airdropKeys.merkleRoot({ chainId, address: options.address })
1053
+ });
1054
+ }
1055
+ });
1056
+ }
1057
+ function useSignClaimAuthorization(options) {
1058
+ const { walletClient, chainId } = useMemoAirdropBaseClient(options);
1059
+ return useMutation({
1060
+ mutationFn: async (args) => {
1061
+ if (!walletClient) {
1062
+ throw new MissingWalletClientError("useSignClaimAuthorization");
1063
+ }
1064
+ if (chainId === void 0) {
1065
+ throw new MissingClientError("useSignClaimAuthorization", "airdrop-base");
1066
+ }
1067
+ return signClaimAuthorization({
1068
+ walletClient,
1069
+ airdrop: options.address,
1070
+ chainId,
1071
+ recipient: args.recipient,
1072
+ encryptedAmountHandle: args.encryptedAmountHandle,
1073
+ dedupId: args.dedupId,
1074
+ deadline: args.deadline,
1075
+ account: args.account
1076
+ });
1077
+ }
1078
+ });
1079
+ }
1080
+ function useWithdrawGasFee(options) {
1081
+ const { client } = useMemoAirdropBaseClient(options);
1082
+ return useMutation({
1083
+ mutationFn: async (args) => {
1084
+ if (!client) {
1085
+ throw new MissingClientError("useWithdrawGasFee", "airdrop-base");
1086
+ }
1087
+ return client.withdrawGasFee(args);
1088
+ }
1089
+ });
1090
+ }
1091
+ function useAdminBatchDiscloseBalanceToParties(options) {
1092
+ const { client } = useMemoAirdropBaseClient(options);
1093
+ return useMutation({
1094
+ mutationFn: async (args) => {
1095
+ if (!client) {
1096
+ throw new MissingClientError("useAdminBatchDiscloseBalanceToParties", "airdrop-base");
1097
+ }
1098
+ return client.adminBatchDiscloseBalanceToParties(args);
1099
+ }
1100
+ });
1101
+ }
1102
+ function useAdminDiscloseBalanceToParty(options) {
1103
+ const { client } = useMemoAirdropBaseClient(options);
1104
+ return useMutation({
1105
+ mutationFn: async (args) => {
1106
+ if (!client) {
1107
+ throw new MissingClientError("useAdminDiscloseBalanceToParty", "airdrop-base");
1108
+ }
1109
+ return client.adminDiscloseBalanceToParty(args);
1110
+ }
1111
+ });
1112
+ }
1113
+ function useAdminGetCurrentBalance(options) {
1114
+ const { client } = useMemoAirdropBaseClient(options);
1115
+ return useMutation({
1116
+ mutationFn: async (args) => {
1117
+ if (!client) {
1118
+ throw new MissingClientError("useAdminGetCurrentBalance", "airdrop-base");
1119
+ }
1120
+ return client.adminGetCurrentBalance(args ?? {});
1121
+ }
1122
+ });
1123
+ }
1124
+ function useAccessEcdsaClaimAmount(options) {
1125
+ const { client } = useMemoEcdsaAirdropClient(options);
1126
+ return useMutation({
1127
+ mutationFn: async (args) => {
1128
+ if (!client) {
1129
+ throw new MissingClientError("useAccessEcdsaClaimAmount", "ecdsa-airdrop");
1130
+ }
1131
+ return client.getClaimAmount(args);
1132
+ }
1133
+ });
1134
+ }
1135
+ function useAccessMerkleClaimAmount(options) {
1136
+ const { client } = useMemoMerkleAirdropClient(options);
1137
+ return useMutation({
1138
+ mutationFn: async (args) => {
1139
+ if (!client) {
1140
+ throw new MissingClientError("useAccessMerkleClaimAmount", "merkle-airdrop");
1141
+ }
1142
+ return client.getClaimAmount(args);
1143
+ }
1144
+ });
1145
+ }
343
1146
 
344
- export { useAirdropGasFee, useAirdropHasRole, useAirdropPause, useAirdropPaused, useAirdropToken, useAirdropWindow, useClaimedAmount, useComplianceManager, useCreateEcdsaAirdrop, useCreateMerkleAirdrop, useEcdsaClaim, useEffectiveUpgradeable, useExtendClaimWindow, useFactoryFees, useFactoryRegistry, useFundAirdrop, useGrantInstanceRoles, useMerkleClaim, useMerkleRoot, useSetMerkleRoot, useWithdrawConfidential };
1147
+ export { useAccessEcdsaClaimAmount, useAccessMerkleClaimAmount, useAddComplianceDelegate, useAdminBatchDiscloseBalanceToParties, useAdminDiscloseBalanceToParty, useAdminGetCurrentBalance, useAirdropConfig, useAirdropDeploymentMode, useAirdropGasFee, useAirdropGrantRole, useAirdropHasRole, useAirdropPause, useAirdropPaused, useAirdropRenounceRole, useAirdropRevokeRole, useAirdropRoleAdmin, useAirdropRoleConstants, useAirdropRoleMembers, useAirdropToken, useAirdropUpgradeToAndCall, useAirdropWindow, useBatchDiscloseHandlesToParty, useBuildMerkleCampaign, useClaimedAmount, useComplianceGrantRole, useComplianceHasRole, useComplianceInfo, useComplianceManager, useComplianceManagerOf, useComplianceRenounceRole, useComplianceRevokeRole, useComplianceRoleConstants, useComplianceRoleMembers, useCreateAndFundEcdsaAirdrop, useCreateAndFundMerkleAirdrop, useCreateEcdsaAirdrop, useCreateMerkleAirdrop, useDiscloseHandleToParty, useEcdsaClaim, useEcdsaClaimAndUnwrap, useEcdsaDomain, useEffectiveDelegateToCompliance, useEffectiveUpgradeable, useEncryptCampaignAmounts, useExtendClaimWindow, useFactoryFees, useFactoryRegistry, useFundAirdrop, useGrantInstanceRoles, useIsActiveDelegate, useIsMerkleRootMutable, useIsSignatureValid, useMerkleClaim, useMerkleClaimAndUnwrap, useMerkleRoot, usePlanMerkleCampaign, usePreflightClaim, usePreflightCreateAirdrop, useRescueERC20, useRescueOtherConfidentialToken, useRevokeComplianceDelegate, useRotateMerkleRoot, useSetMerkleRoot, useSignClaimAuthorization, useWithdrawConfidential, useWithdrawGasFee };