@tokenops/sdk 2.0.0-alpha.1 → 2.0.0-alpha.3

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 (155) hide show
  1. package/CHANGELOG.md +67 -2
  2. package/README.md +14 -8
  3. package/dist/{chunk-PUX5VXDB.cjs → chunk-4AWQJQXY.cjs} +1415 -69
  4. package/dist/{chunk-74QFZ5MK.js → chunk-4IB4IY5Y.js} +1 -1
  5. package/dist/{chunk-DZHYSUGY.js → chunk-6HCT4QIX.js} +12 -5
  6. package/dist/{chunk-FGEB7RMY.cjs → chunk-6XOAYDC6.cjs} +4 -4
  7. package/dist/{chunk-XAYGD4E4.cjs → chunk-AHU2HMNE.cjs} +3 -3
  8. package/dist/{chunk-6NAVMWZQ.js → chunk-BPIVVCSQ.js} +2 -2
  9. package/dist/{chunk-GKKDAW44.js → chunk-BXX5TETM.js} +1401 -59
  10. package/dist/{chunk-456VDDA3.js → chunk-GCJFAY4X.js} +78 -25
  11. package/dist/{chunk-CTED3MTR.cjs → chunk-GKYZQJGP.cjs} +82 -29
  12. package/dist/{chunk-JZLGCTGK.cjs → chunk-IEKTGJ4J.cjs} +2 -2
  13. package/dist/{chunk-6PXXGACR.cjs → chunk-JVNJSDQ4.cjs} +2 -2
  14. package/dist/{chunk-O5676ZWY.js → chunk-LEYYG4RF.js} +232 -6
  15. package/dist/{chunk-335Z2W67.js → chunk-NGU4JYIR.js} +1 -1
  16. package/dist/{chunk-5576FRT3.cjs → chunk-PG3WXT3K.cjs} +12 -5
  17. package/dist/{chunk-H5POPGOZ.js → chunk-PK6Q6J5F.js} +1 -1
  18. package/dist/chunk-TND5NDV7.cjs +263 -0
  19. package/dist/chunk-U3TBQRT7.js +253 -0
  20. package/dist/{chunk-EAJ7SYHE.js → chunk-WRWRA4TN.js} +1 -1
  21. package/dist/{chunk-JQYC66TO.cjs → chunk-YABHXJNH.cjs} +5 -5
  22. package/dist/{chunk-M4IT6DNJ.cjs → chunk-YTIYTV4K.cjs} +236 -4
  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/airdrop-base.d.ts +19 -0
  27. package/dist/fhe-airdrop/abis/ecdsa.d.ts +19 -0
  28. package/dist/fhe-airdrop/abis/factory.d.ts +113 -0
  29. package/dist/fhe-airdrop/abis/merkle.d.ts +43 -12
  30. package/dist/fhe-airdrop/advanced/index.cjs +4 -4
  31. package/dist/fhe-airdrop/advanced/index.js +1 -1
  32. package/dist/fhe-airdrop/advanced/react/index.cjs +620 -9
  33. package/dist/fhe-airdrop/advanced/react/index.d.cts +35 -0
  34. package/dist/fhe-airdrop/advanced/react/index.d.ts +35 -0
  35. package/dist/fhe-airdrop/advanced/react/index.js +590 -7
  36. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
  37. package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
  38. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +26 -0
  39. package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
  40. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
  41. package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
  42. package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
  43. package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
  44. package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
  45. package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
  46. package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +37 -0
  47. package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +37 -0
  48. package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
  49. package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +48 -0
  50. package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
  51. package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
  52. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
  53. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
  54. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
  55. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +29 -0
  56. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
  57. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +30 -0
  58. package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
  59. package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
  60. package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
  61. package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +33 -0
  62. package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
  63. package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
  64. package/dist/fhe-airdrop/airdrop-base.d.ts +55 -8
  65. package/dist/fhe-airdrop/campaign.d.ts +61 -20
  66. package/dist/fhe-airdrop/constants.d.ts +9 -1
  67. package/dist/fhe-airdrop/ecdsa.d.ts +13 -0
  68. package/dist/fhe-airdrop/errors.d.ts +87 -0
  69. package/dist/fhe-airdrop/factory.d.ts +62 -22
  70. package/dist/fhe-airdrop/guards.d.ts +133 -4
  71. package/dist/fhe-airdrop/index.cjs +86 -971
  72. package/dist/fhe-airdrop/index.d.cts +4 -4
  73. package/dist/fhe-airdrop/index.d.ts +4 -4
  74. package/dist/fhe-airdrop/index.js +8 -927
  75. package/dist/fhe-airdrop/merkle-tree.d.ts +32 -38
  76. package/dist/fhe-airdrop/merkle.d.ts +52 -31
  77. package/dist/fhe-airdrop/react/_shared.d.ts +13 -0
  78. package/dist/fhe-airdrop/react/index.cjs +997 -87
  79. package/dist/fhe-airdrop/react/index.d.cts +53 -4
  80. package/dist/fhe-airdrop/react/index.d.ts +53 -4
  81. package/dist/fhe-airdrop/react/index.js +887 -27
  82. package/dist/fhe-airdrop/react/keys.d.ts +98 -0
  83. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
  84. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
  85. package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
  86. package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
  87. package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
  88. package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
  89. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
  90. package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
  91. package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +35 -0
  92. package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
  93. package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +33 -0
  94. package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
  95. package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
  96. package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
  97. package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
  98. package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
  99. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
  100. package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
  101. package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
  102. package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
  103. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
  104. package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
  105. package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
  106. package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
  107. package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
  108. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
  109. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
  110. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
  111. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +4 -3
  112. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
  113. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
  114. package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
  115. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
  116. package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
  117. package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
  118. package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
  119. package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
  120. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
  121. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +7 -19
  122. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
  123. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
  124. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
  125. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +67 -0
  126. package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
  127. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
  128. package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
  129. package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
  130. package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
  131. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
  132. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +42 -0
  133. package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
  134. package/dist/fhe-airdrop/types.d.ts +27 -1
  135. package/dist/fhe-disperse/index.cjs +21 -21
  136. package/dist/fhe-disperse/index.js +2 -2
  137. package/dist/fhe-disperse/react/index.cjs +22 -22
  138. package/dist/fhe-disperse/react/index.js +3 -3
  139. package/dist/fhe-vesting/advanced/index.cjs +5 -5
  140. package/dist/fhe-vesting/advanced/index.js +3 -3
  141. package/dist/fhe-vesting/advanced/react/index.cjs +7 -7
  142. package/dist/fhe-vesting/advanced/react/index.js +4 -4
  143. package/dist/fhe-vesting/index.cjs +8 -8
  144. package/dist/fhe-vesting/index.js +2 -2
  145. package/dist/fhe-vesting/react/index.cjs +114 -114
  146. package/dist/fhe-vesting/react/index.js +3 -3
  147. package/dist/index.cjs +18 -18
  148. package/dist/index.js +1 -1
  149. package/dist/testnet-faucet/index.cjs +14 -14
  150. package/dist/testnet-faucet/index.js +2 -2
  151. package/dist/testnet-faucet/react/index.cjs +8 -8
  152. package/dist/testnet-faucet/react/index.js +3 -3
  153. package/package.json +1 -1
  154. package/dist/chunk-NCVX3K2N.cjs +0 -161
  155. 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-GCJFAY4X.js';
2
+ export { buildMerkleCampaign, buildMerkleTree, encryptCampaignAmounts, grantInstanceRoles, leafOf, planInstanceRoleSplit, planMerkleCampaign, rotateMerkleRoot, validateCampaignRecipients } from '../../chunk-GCJFAY4X.js';
3
+ import { useMemoAirdropBaseClient, airdropQueryKey, useMemoMerkleAirdropClient, useMemoAirdropFactoryClient, AIRDROP_FN, airdropKeys, useMemoEcdsaAirdropClient, useMemoComplianceManagerClient } from '../../chunk-U3TBQRT7.js';
4
+ export { airdropQueryKey, airdropQueryKeyPrefix } from '../../chunk-U3TBQRT7.js';
5
+ import { resolveEncryptor, signClaimAuthorization } from '../../chunk-BXX5TETM.js';
6
+ export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-BXX5TETM.js';
7
+ import { preflightClaim, preflightCreate } from '../../chunk-LEYYG4RF.js';
8
+ export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, DedupIdConsumedError, FeeCollectorSelfAdministeredError, MerkleUupsUnsupportedError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UnauthorizedRedirectError, UpgradeabilityNotAllowedError, preflightClaim, preflightCreate } from '../../chunk-LEYYG4RF.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-6HCT4QIX.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);
@@ -119,15 +122,31 @@ function useFactoryFees(args = {}) {
119
122
  ...args.query,
120
123
  queryKey: airdropQueryKey({ chainId, address: resolvedAddress, fn: "fees", args: [] }),
121
124
  queryFn: async () => {
122
- const [feeCollector, defaultGasFee] = await Promise.all([
125
+ const [feeCollector, defaultGasFee, maxGasFee] = await Promise.all([
123
126
  client.feeCollector(),
124
- client.defaultGasFee()
127
+ client.defaultGasFee(),
128
+ client.maxGasFee()
125
129
  ]);
126
- return { feeCollector, defaultGasFee };
130
+ return { feeCollector, defaultGasFee, maxGasFee };
127
131
  },
128
132
  enabled: Boolean(client && (args.query?.enabled ?? true))
129
133
  });
130
134
  }
135
+ function useResolveGasFee(args = {}) {
136
+ const { creator, ...base } = args;
137
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
138
+ return useQuery({
139
+ ...args.query,
140
+ queryKey: airdropQueryKey({
141
+ chainId,
142
+ address: resolvedAddress,
143
+ fn: AIRDROP_FN.resolvedGasFee,
144
+ args: [creator]
145
+ }),
146
+ queryFn: () => client.resolveGasFee(creator),
147
+ enabled: Boolean(client && creator && (args.query?.enabled ?? true))
148
+ });
149
+ }
131
150
  function useFactoryRegistry(args = {}) {
132
151
  const { offset = 0n, limit = 50n, ...base } = args;
133
152
  const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
@@ -149,6 +168,24 @@ function useFactoryRegistry(args = {}) {
149
168
  enabled: Boolean(client && (args.query?.enabled ?? true))
150
169
  });
151
170
  }
171
+ function useIsAirdrop(args = {}) {
172
+ const { candidate, ...base } = args;
173
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
174
+ return useQuery({
175
+ // Per-result, not blanket: `true` is immutable (append-only registry),
176
+ // `false` is not. See the TSDoc above.
177
+ staleTime: (query) => query.state.data === true ? Infinity : 0,
178
+ ...args.query,
179
+ queryKey: airdropQueryKey({
180
+ chainId,
181
+ address: resolvedAddress,
182
+ fn: AIRDROP_FN.isAirdrop,
183
+ args: [candidate]
184
+ }),
185
+ queryFn: () => client.isAirdrop(candidate),
186
+ enabled: Boolean(client && candidate && (args.query?.enabled ?? true))
187
+ });
188
+ }
152
189
  function useEffectiveUpgradeable(args = {}) {
153
190
  const { creator, ...base } = args;
154
191
  const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
@@ -164,6 +201,358 @@ function useEffectiveUpgradeable(args = {}) {
164
201
  enabled: Boolean(client && creator && (args.query?.enabled ?? true))
165
202
  });
166
203
  }
204
+ function useAirdropConfig(args) {
205
+ const { client, chainId } = useMemoAirdropBaseClient(args);
206
+ return useQuery({
207
+ staleTime: Infinity,
208
+ ...args.query,
209
+ queryKey: airdropKeys.config({ chainId, address: args.address }),
210
+ queryFn: async () => {
211
+ const [token, airdropType, unwrappable, complianceManager, gasFee] = await Promise.all([
212
+ client.token(),
213
+ client.airdropType(),
214
+ client.unwrappable(),
215
+ client.complianceManager(),
216
+ client.gasFee()
217
+ ]);
218
+ return {
219
+ token,
220
+ airdropType,
221
+ variant: airdropType === 1 ? "merkle" : "ecdsa",
222
+ unwrappable,
223
+ complianceManager,
224
+ gasFee
225
+ };
226
+ },
227
+ enabled: Boolean(client && (args.query?.enabled ?? true))
228
+ });
229
+ }
230
+ function useAirdropDeploymentMode(args) {
231
+ const { client, chainId } = useMemoAirdropBaseClient(args);
232
+ return useQuery({
233
+ staleTime: Infinity,
234
+ ...args.query,
235
+ queryKey: airdropQueryKey({
236
+ chainId,
237
+ address: args.address,
238
+ fn: "deploymentMode",
239
+ args: []
240
+ }),
241
+ queryFn: () => client.deploymentMode(),
242
+ enabled: Boolean(client && (args.query?.enabled ?? true))
243
+ });
244
+ }
245
+ function useAirdropRoleAdmin(args) {
246
+ const { role, ...base } = args;
247
+ const { client, chainId } = useMemoAirdropBaseClient(base);
248
+ return useQuery({
249
+ // A default, not a lock: `query.staleTime` still wins.
250
+ staleTime: Infinity,
251
+ ...args.query,
252
+ queryKey: airdropQueryKey({
253
+ chainId,
254
+ address: args.address,
255
+ fn: "getRoleAdmin",
256
+ args: [role]
257
+ }),
258
+ queryFn: () => client.getRoleAdmin(role),
259
+ enabled: Boolean(client && role && (args.query?.enabled ?? true))
260
+ });
261
+ }
262
+ function useAirdropRoleConstants(args) {
263
+ const { variant, dedupMode, ...base } = args;
264
+ const { client, chainId } = useMemoAirdropBaseClient(base);
265
+ const { client: merkleClient } = useMemoMerkleAirdropClient(base);
266
+ const { client: ecdsaClient } = useMemoEcdsaAirdropClient({
267
+ ...base,
268
+ dedupMode: dedupMode ?? "none"
269
+ });
270
+ return useQuery({
271
+ // A default, not a lock: `query.staleTime` still wins if a consumer wants refetching.
272
+ staleTime: Infinity,
273
+ ...args.query,
274
+ // `variant` is in the key because it changes the SHAPE of the result -
275
+ // the merkle and ecdsa responses must not share a cache slot.
276
+ queryKey: airdropQueryKey({
277
+ chainId,
278
+ address: args.address,
279
+ fn: "roleConstants",
280
+ args: [variant]
281
+ }),
282
+ queryFn: async () => {
283
+ const [
284
+ PAUSER_ROLE,
285
+ WINDOW_ADMIN_ROLE,
286
+ TREASURY_ROLE,
287
+ RESCUER_ROLE,
288
+ FEE_COLLECTOR_ROLE,
289
+ UPGRADER_ROLE,
290
+ DISCLOSURE_ADMIN_ROLE,
291
+ DEFAULT_ADMIN_ROLE,
292
+ variantRole
293
+ ] = await Promise.all([
294
+ client.PAUSER_ROLE(),
295
+ client.WINDOW_ADMIN_ROLE(),
296
+ client.TREASURY_ROLE(),
297
+ client.RESCUER_ROLE(),
298
+ client.FEE_COLLECTOR_ROLE(),
299
+ client.UPGRADER_ROLE(),
300
+ client.DISCLOSURE_ADMIN_ROLE(),
301
+ client.DEFAULT_ADMIN_ROLE(),
302
+ variant === "merkle" ? merkleClient.MERKLE_ADMIN_ROLE() : variant === "ecdsa" ? ecdsaClient.SIGNER_ROLE() : Promise.resolve(void 0)
303
+ ]);
304
+ return {
305
+ PAUSER_ROLE,
306
+ WINDOW_ADMIN_ROLE,
307
+ TREASURY_ROLE,
308
+ RESCUER_ROLE,
309
+ FEE_COLLECTOR_ROLE,
310
+ UPGRADER_ROLE,
311
+ DISCLOSURE_ADMIN_ROLE,
312
+ DEFAULT_ADMIN_ROLE,
313
+ ...variant === "merkle" && variantRole ? { MERKLE_ADMIN_ROLE: variantRole } : {},
314
+ ...variant === "ecdsa" && variantRole ? { SIGNER_ROLE: variantRole } : {}
315
+ };
316
+ },
317
+ enabled: Boolean(client && (args.query?.enabled ?? true))
318
+ });
319
+ }
320
+ function useAirdropRoleMembers(args) {
321
+ const { role, ...base } = args;
322
+ const { client, chainId } = useMemoAirdropBaseClient(base);
323
+ return useQuery({
324
+ ...args.query,
325
+ queryKey: airdropKeys.roleMembers({ chainId, address: args.address }, role),
326
+ queryFn: async () => {
327
+ const [members, count] = await Promise.all([
328
+ client.getRoleMembers(role),
329
+ client.getRoleMemberCount(role)
330
+ ]);
331
+ return { members, count };
332
+ },
333
+ enabled: Boolean(client && role && (args.query?.enabled ?? true))
334
+ });
335
+ }
336
+ function useComplianceHasRole(args) {
337
+ const { role, holder, ...base } = args;
338
+ const { client, chainId } = useMemoComplianceManagerClient(base);
339
+ return useQuery({
340
+ ...args.query,
341
+ queryKey: airdropKeys.complianceHasRole({ chainId, address: args.address }, role, holder),
342
+ queryFn: () => client.hasRole({ role, holder }),
343
+ enabled: Boolean(client && role && holder && (args.query?.enabled ?? true))
344
+ });
345
+ }
346
+ function useComplianceInfo(args) {
347
+ const { client, chainId } = useMemoComplianceManagerClient(args);
348
+ return useQuery({
349
+ ...args.query,
350
+ queryKey: airdropKeys.complianceInfo({ chainId, address: args.address }),
351
+ queryFn: async () => {
352
+ const [airdrop, platformDelegate, clientDelegates] = await Promise.all([
353
+ client.airdrop(),
354
+ client.complianceDelegate(),
355
+ client.clientDelegates()
356
+ ]);
357
+ return { airdrop, platformDelegate, clientDelegates };
358
+ },
359
+ enabled: Boolean(client && (args.query?.enabled ?? true))
360
+ });
361
+ }
362
+ function useComplianceManagerOf(args = {}) {
363
+ const { airdrop, ...base } = args;
364
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
365
+ return useQuery({
366
+ staleTime: Infinity,
367
+ ...args.query,
368
+ queryKey: airdropQueryKey({
369
+ chainId,
370
+ address: resolvedAddress,
371
+ fn: "complianceManagerOf",
372
+ args: [airdrop]
373
+ }),
374
+ queryFn: () => client.complianceManagerOf(airdrop),
375
+ enabled: Boolean(client && airdrop && (args.query?.enabled ?? true))
376
+ });
377
+ }
378
+ function useComplianceRoleConstants(args) {
379
+ const { client, chainId } = useMemoComplianceManagerClient(args);
380
+ return useQuery({
381
+ // A default, not a lock: `query.staleTime` still wins.
382
+ staleTime: Infinity,
383
+ ...args.query,
384
+ queryKey: airdropQueryKey({
385
+ chainId,
386
+ address: args.address,
387
+ fn: "complianceRoleConstants",
388
+ args: []
389
+ }),
390
+ queryFn: async () => {
391
+ const [DELEGATION_ADMIN_ROLE, DEFAULT_ADMIN_ROLE] = await Promise.all([
392
+ client.DELEGATION_ADMIN_ROLE(),
393
+ client.DEFAULT_ADMIN_ROLE()
394
+ ]);
395
+ return { DELEGATION_ADMIN_ROLE, DEFAULT_ADMIN_ROLE };
396
+ },
397
+ enabled: Boolean(client && (args.query?.enabled ?? true))
398
+ });
399
+ }
400
+ function useComplianceRoleMembers(args) {
401
+ const { role, ...base } = args;
402
+ const { client, chainId } = useMemoComplianceManagerClient(base);
403
+ return useQuery({
404
+ ...args.query,
405
+ queryKey: airdropKeys.complianceRoleMembers({ chainId, address: args.address }, role),
406
+ queryFn: async () => {
407
+ const [members, count] = await Promise.all([
408
+ client.getRoleMembers(role),
409
+ client.getRoleMemberCount(role)
410
+ ]);
411
+ return { members, count };
412
+ },
413
+ enabled: Boolean(client && role && (args.query?.enabled ?? true))
414
+ });
415
+ }
416
+ function useEcdsaDomain(args) {
417
+ const { client, chainId } = useMemoEcdsaAirdropClient(args);
418
+ return useQuery({
419
+ staleTime: Infinity,
420
+ ...args.query,
421
+ // `dedupMode` is a client-construction concern only; it moves no value
422
+ // read here, so it stays out of the key.
423
+ queryKey: airdropQueryKey({ chainId, address: args.address, fn: "ecdsaDomain", args: [] }),
424
+ queryFn: async () => {
425
+ const [claimTypehash, domainSeparator, domain] = await Promise.all([
426
+ client.claimTypehash(),
427
+ client.domainSeparator(),
428
+ client.eip712Domain()
429
+ ]);
430
+ return { claimTypehash, domainSeparator, domain };
431
+ },
432
+ enabled: Boolean(client && (args.query?.enabled ?? true))
433
+ });
434
+ }
435
+ function useEffectiveDelegateToCompliance(args = {}) {
436
+ const { creator, ...base } = args;
437
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
438
+ return useQuery({
439
+ ...args.query,
440
+ queryKey: airdropQueryKey({
441
+ chainId,
442
+ address: resolvedAddress,
443
+ fn: "effectiveDelegateToCompliance",
444
+ args: [creator]
445
+ }),
446
+ queryFn: () => client.effectiveDelegateToCompliance(creator),
447
+ enabled: Boolean(client && creator && (args.query?.enabled ?? true))
448
+ });
449
+ }
450
+ function useIsActiveDelegate(args) {
451
+ const { delegate, ...base } = args;
452
+ const { client, chainId } = useMemoComplianceManagerClient(base);
453
+ return useQuery({
454
+ ...args.query,
455
+ queryKey: airdropKeys.activeDelegate({ chainId, address: args.address }, delegate),
456
+ queryFn: () => client.isActiveDelegate(delegate),
457
+ enabled: Boolean(client && delegate && (args.query?.enabled ?? true))
458
+ });
459
+ }
460
+ function useIsMerkleRootMutable(args) {
461
+ const { client, chainId } = useMemoMerkleAirdropClient(args);
462
+ return useQuery({
463
+ // Before the spread so a consumer can still opt into refetching.
464
+ staleTime: Infinity,
465
+ ...args.query,
466
+ queryKey: airdropKeys.merkleRootMutable({ chainId, address: args.address }),
467
+ queryFn: () => client.isMerkleRootMutable(),
468
+ enabled: Boolean(client && (args.query?.enabled ?? true))
469
+ });
470
+ }
471
+ function useIsSignatureValid(args) {
472
+ const { recipient, encryptedAmountHandle, dedupId, deadline, signer, signature, ...base } = args;
473
+ const { client, chainId } = useMemoEcdsaAirdropClient(base);
474
+ return useQuery({
475
+ ...args.query,
476
+ queryKey: airdropQueryKey({
477
+ chainId,
478
+ address: args.address,
479
+ fn: AIRDROP_FN.isSignatureValid,
480
+ args: [recipient, encryptedAmountHandle, dedupId, deadline, signer, signature]
481
+ }),
482
+ queryFn: () => client.isSignatureValid({
483
+ recipient,
484
+ encryptedAmountHandle,
485
+ dedupId,
486
+ deadline,
487
+ signer,
488
+ signature
489
+ }),
490
+ enabled: Boolean(
491
+ client && recipient && encryptedAmountHandle && dedupId && deadline !== void 0 && signer && signature && (args.query?.enabled ?? true)
492
+ )
493
+ });
494
+ }
495
+ function usePreflightClaim(args) {
496
+ const { variant, dedupMode, claimant, account, to, entrypoint, signature, ...base } = args;
497
+ const { client: merkleClient, chainId } = useMemoMerkleAirdropClient(base);
498
+ const { client: ecdsaClient } = useMemoEcdsaAirdropClient({
499
+ ...base,
500
+ dedupMode: dedupMode ?? "none"
501
+ });
502
+ const client = variant === "ecdsa" ? ecdsaClient : merkleClient;
503
+ return useQuery({
504
+ ...args.query,
505
+ queryKey: airdropQueryKey({
506
+ chainId,
507
+ address: args.address,
508
+ fn: "preflightClaim",
509
+ args: [variant, claimant, account, to, entrypoint, signature]
510
+ }),
511
+ queryFn: () => preflightClaim({
512
+ airdrop: client,
513
+ claimant,
514
+ account,
515
+ to,
516
+ entrypoint,
517
+ signature
518
+ }),
519
+ enabled: Boolean(client && claimant && (args.query?.enabled ?? true))
520
+ });
521
+ }
522
+ function usePreflightCreateAirdrop(args = {}) {
523
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
524
+ return useQuery({
525
+ ...args.query,
526
+ queryKey: airdropQueryKey({
527
+ chainId,
528
+ address: resolvedAddress,
529
+ fn: AIRDROP_FN.preflightCreate,
530
+ args: [
531
+ args.variant,
532
+ args.mode,
533
+ args.creator,
534
+ args.userSalt,
535
+ args.expectedInitCodeHash,
536
+ // `params` IS key-affecting here, unlike in the predict hooks: the
537
+ // stock-wrapper probe reads `common.token` / `common.unwrappable`.
538
+ args.params
539
+ ]
540
+ }),
541
+ queryFn: () => {
542
+ const common = {
543
+ factory: client,
544
+ mode: args.mode,
545
+ creator: args.creator,
546
+ userSalt: args.userSalt,
547
+ expectedInitCodeHash: args.expectedInitCodeHash
548
+ };
549
+ return args.variant === "merkle" ? preflightCreate({ ...common, variant: "merkle", params: args.params }) : preflightCreate({ ...common, variant: "ecdsa", params: args.params });
550
+ },
551
+ enabled: Boolean(
552
+ client && args.variant && args.params && args.mode && args.creator && args.userSalt && (args.query?.enabled ?? true)
553
+ )
554
+ });
555
+ }
167
556
  function useCreateEcdsaAirdrop(options = {}) {
168
557
  const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
169
558
  const queryClient = useQueryClient();
@@ -176,7 +565,10 @@ function useCreateEcdsaAirdrop(options = {}) {
176
565
  },
177
566
  onSuccess: () => {
178
567
  void queryClient.invalidateQueries({
179
- queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
568
+ queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
569
+ });
570
+ void queryClient.invalidateQueries({
571
+ queryKey: airdropKeys.isAirdropAll({ chainId, address: resolvedAddress })
180
572
  });
181
573
  }
182
574
  });
@@ -193,7 +585,10 @@ function useCreateMerkleAirdrop(options = {}) {
193
585
  },
194
586
  onSuccess: () => {
195
587
  void queryClient.invalidateQueries({
196
- queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
588
+ queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
589
+ });
590
+ void queryClient.invalidateQueries({
591
+ queryKey: airdropKeys.isAirdropAll({ chainId, address: resolvedAddress })
197
592
  });
198
593
  }
199
594
  });
@@ -210,18 +605,24 @@ function useFundAirdrop(options = {}) {
210
605
  });
211
606
  }
212
607
  function useEcdsaClaim(options) {
213
- const { client } = useMemoEcdsaAirdropClient(options);
608
+ const { client, chainId } = useMemoEcdsaAirdropClient(options);
609
+ const queryClient = useQueryClient();
214
610
  return useMutation({
215
611
  mutationFn: async (args) => {
216
612
  if (!client) {
217
613
  throw new MissingClientError("useEcdsaClaim", "ecdsa-airdrop");
218
614
  }
219
615
  return client.claim(args);
616
+ },
617
+ onSuccess: () => {
618
+ void queryClient.invalidateQueries({
619
+ queryKey: airdropKeys.isSignatureValidAll({ chainId, address: options.address })
620
+ });
220
621
  }
221
622
  });
222
623
  }
223
624
  function useMerkleClaim(options) {
224
- const { client, chainId, walletClient } = useMemoMerkleAirdropClient(options);
625
+ const { client, chainId } = useMemoMerkleAirdropClient(options);
225
626
  const queryClient = useQueryClient();
226
627
  return useMutation({
227
628
  mutationFn: async (args) => {
@@ -230,20 +631,15 @@ function useMerkleClaim(options) {
230
631
  }
231
632
  return client.claim(args);
232
633
  },
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
- },
634
+ onMutate: (variables) => ({ account: variables.entry.account }),
239
635
  onSuccess: (_hash, _variables, context) => {
240
- if (!context?.claimant) return;
636
+ if (!context?.account) return;
241
637
  void queryClient.invalidateQueries({
242
638
  queryKey: airdropQueryKey({
243
639
  chainId,
244
640
  address: options.address,
245
641
  fn: "getClaimedAmount",
246
- args: [context.claimant]
642
+ args: [context.account]
247
643
  })
248
644
  });
249
645
  }
@@ -286,9 +682,9 @@ function useGrantInstanceRoles(options) {
286
682
  });
287
683
  },
288
684
  onSuccess: () => {
289
- void queryClient.invalidateQueries({
290
- queryKey: airdropQueryKeyPrefix({ chainId, address: options.address, fn: "hasRole" })
291
- });
685
+ const scope = { chainId, address: options.address };
686
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.hasRoleAll(scope) });
687
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.roleMembersAll(scope) });
292
688
  }
293
689
  });
294
690
  }
@@ -340,5 +736,469 @@ function useWithdrawConfidential(options) {
340
736
  }
341
737
  });
342
738
  }
739
+ function useAddComplianceDelegate(options) {
740
+ const { client, chainId } = useMemoComplianceManagerClient(options);
741
+ const queryClient = useQueryClient();
742
+ return useMutation({
743
+ mutationFn: async (args) => {
744
+ if (!client) {
745
+ throw new MissingClientError("useAddComplianceDelegate", "compliance-manager");
746
+ }
747
+ return client.addDelegate(args);
748
+ },
749
+ onSuccess: (_hash, variables) => {
750
+ const scope = { chainId, address: options.address };
751
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.complianceInfo(scope) });
752
+ void queryClient.invalidateQueries({
753
+ queryKey: airdropKeys.activeDelegate(scope, variables.delegate)
754
+ });
755
+ }
756
+ });
757
+ }
758
+ function useAirdropGrantRole(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("useAirdropGrantRole", "airdrop-base");
765
+ }
766
+ return client.grantRole(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 useAirdropRenounceRole(options) {
780
+ const { client, chainId } = useMemoAirdropBaseClient(options);
781
+ const queryClient = useQueryClient();
782
+ return useMutation({
783
+ mutationFn: async (args) => {
784
+ if (!client) {
785
+ throw new MissingClientError("useAirdropRenounceRole", "airdrop-base");
786
+ }
787
+ return client.renounceRole(args);
788
+ },
789
+ onSuccess: (_hash, variables) => {
790
+ const scope = { chainId, address: options.address };
791
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.hasRoleAll(scope) });
792
+ void queryClient.invalidateQueries({
793
+ queryKey: airdropKeys.roleMembers(scope, variables.role)
794
+ });
795
+ }
796
+ });
797
+ }
798
+ function useAirdropRevokeRole(options) {
799
+ const { client, chainId } = useMemoAirdropBaseClient(options);
800
+ const queryClient = useQueryClient();
801
+ return useMutation({
802
+ mutationFn: async (args) => {
803
+ if (!client) {
804
+ throw new MissingClientError("useAirdropRevokeRole", "airdrop-base");
805
+ }
806
+ return client.revokeRole(args);
807
+ },
808
+ onSuccess: (_hash, variables) => {
809
+ const scope = { chainId, address: options.address };
810
+ void queryClient.invalidateQueries({
811
+ queryKey: airdropKeys.hasRole(scope, variables.role, variables.holder)
812
+ });
813
+ void queryClient.invalidateQueries({
814
+ queryKey: airdropKeys.roleMembers(scope, variables.role)
815
+ });
816
+ }
817
+ });
818
+ }
819
+ function useAirdropUpgradeToAndCall(options) {
820
+ const { client } = useMemoAirdropBaseClient(options);
821
+ return useMutation({
822
+ mutationFn: async (args) => {
823
+ if (!client) {
824
+ throw new MissingClientError("useAirdropUpgradeToAndCall", "airdrop-base");
825
+ }
826
+ return client.upgradeToAndCall(args);
827
+ }
828
+ });
829
+ }
830
+ function useBatchDiscloseHandlesToParty(options) {
831
+ const { client } = useMemoAirdropBaseClient(options);
832
+ return useMutation({
833
+ mutationFn: async (args) => {
834
+ if (!client) {
835
+ throw new MissingClientError("useBatchDiscloseHandlesToParty", "airdrop-base");
836
+ }
837
+ return client.batchDiscloseHandlesToParty(args);
838
+ }
839
+ });
840
+ }
841
+ function useBuildMerkleCampaign(options = {}) {
842
+ const encryptorSourceRef = useRef(options.encryptor);
843
+ encryptorSourceRef.current = options.encryptor;
844
+ return useMutation({
845
+ mutationFn: async (args) => buildMerkleCampaign({
846
+ instance: args.instance,
847
+ recipients: args.recipients,
848
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current),
849
+ ...args.submitter !== void 0 ? { submitter: args.submitter } : {}
850
+ })
851
+ });
852
+ }
853
+ function useComplianceGrantRole(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("useComplianceGrantRole", "compliance-manager");
860
+ }
861
+ return client.grantRole(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 useComplianceRenounceRole(options) {
875
+ const { client, chainId } = useMemoComplianceManagerClient(options);
876
+ const queryClient = useQueryClient();
877
+ return useMutation({
878
+ mutationFn: async (args) => {
879
+ if (!client) {
880
+ throw new MissingClientError("useComplianceRenounceRole", "compliance-manager");
881
+ }
882
+ return client.renounceRole(args);
883
+ },
884
+ onSuccess: (_hash, variables) => {
885
+ const scope = { chainId, address: options.address };
886
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.complianceHasRoleAll(scope) });
887
+ void queryClient.invalidateQueries({
888
+ queryKey: airdropKeys.complianceRoleMembers(scope, variables.role)
889
+ });
890
+ }
891
+ });
892
+ }
893
+ function useComplianceRevokeRole(options) {
894
+ const { client, chainId } = useMemoComplianceManagerClient(options);
895
+ const queryClient = useQueryClient();
896
+ return useMutation({
897
+ mutationFn: async (args) => {
898
+ if (!client) {
899
+ throw new MissingClientError("useComplianceRevokeRole", "compliance-manager");
900
+ }
901
+ return client.revokeRole(args);
902
+ },
903
+ onSuccess: (_hash, variables) => {
904
+ const scope = { chainId, address: options.address };
905
+ void queryClient.invalidateQueries({
906
+ queryKey: airdropKeys.complianceHasRole(scope, variables.role, variables.holder)
907
+ });
908
+ void queryClient.invalidateQueries({
909
+ queryKey: airdropKeys.complianceRoleMembers(scope, variables.role)
910
+ });
911
+ }
912
+ });
913
+ }
914
+ function useCreateAndFundEcdsaAirdrop(options = {}) {
915
+ const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
916
+ const queryClient = useQueryClient();
917
+ return useMutation({
918
+ mutationFn: async (args) => {
919
+ if (!client) {
920
+ throw resolutionError ?? new MissingClientError("useCreateAndFundEcdsaAirdrop", "factory");
921
+ }
922
+ return client.createAndFundEcdsaAirdrop(args);
923
+ },
924
+ onSuccess: () => {
925
+ void queryClient.invalidateQueries({
926
+ queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
927
+ });
928
+ void queryClient.invalidateQueries({
929
+ queryKey: airdropKeys.isAirdropAll({ chainId, address: resolvedAddress })
930
+ });
931
+ }
932
+ });
933
+ }
934
+ function useCreateAndFundMerkleAirdrop(options = {}) {
935
+ const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
936
+ const queryClient = useQueryClient();
937
+ return useMutation({
938
+ mutationFn: async (args) => {
939
+ if (!client) {
940
+ throw resolutionError ?? new MissingClientError("useCreateAndFundMerkleAirdrop", "factory");
941
+ }
942
+ return client.createAndFundMerkleAirdrop(args);
943
+ },
944
+ onSuccess: () => {
945
+ void queryClient.invalidateQueries({
946
+ queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
947
+ });
948
+ void queryClient.invalidateQueries({
949
+ queryKey: airdropKeys.isAirdropAll({ chainId, address: resolvedAddress })
950
+ });
951
+ }
952
+ });
953
+ }
954
+ function useDiscloseHandleToParty(options) {
955
+ const { client } = useMemoAirdropBaseClient(options);
956
+ return useMutation({
957
+ mutationFn: async (args) => {
958
+ if (!client) {
959
+ throw new MissingClientError("useDiscloseHandleToParty", "airdrop-base");
960
+ }
961
+ return client.discloseHandleToParty(args);
962
+ }
963
+ });
964
+ }
965
+ function useEcdsaClaimAndUnwrap(options) {
966
+ const { client, chainId } = useMemoEcdsaAirdropClient(options);
967
+ const queryClient = useQueryClient();
968
+ return useMutation({
969
+ mutationFn: async (args) => {
970
+ if (!client) {
971
+ throw new MissingClientError("useEcdsaClaimAndUnwrap", "ecdsa-airdrop");
972
+ }
973
+ return client.claimAndUnwrap(args);
974
+ },
975
+ onSuccess: () => {
976
+ void queryClient.invalidateQueries({
977
+ queryKey: airdropKeys.isSignatureValidAll({ chainId, address: options.address })
978
+ });
979
+ }
980
+ });
981
+ }
982
+ function useEncryptCampaignAmounts(options = {}) {
983
+ const encryptorSourceRef = useRef(options.encryptor);
984
+ encryptorSourceRef.current = options.encryptor;
985
+ return useMutation({
986
+ mutationFn: async (args) => encryptCampaignAmounts({
987
+ instance: args.instance,
988
+ recipients: args.recipients,
989
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current),
990
+ ...args.submitter !== void 0 ? { submitter: args.submitter } : {}
991
+ })
992
+ });
993
+ }
994
+ function useMerkleClaimAndUnwrap(options) {
995
+ const { client, walletClient, chainId } = useMemoMerkleAirdropClient(options);
996
+ const queryClient = useQueryClient();
997
+ return useMutation({
998
+ mutationFn: async (args) => {
999
+ if (!client) {
1000
+ throw new MissingClientError("useMerkleClaimAndUnwrap", "merkle-airdrop");
1001
+ }
1002
+ return client.claimAndUnwrap(args);
1003
+ },
1004
+ // Resolved here rather than in `onSuccess`: a mutation outlives several
1005
+ // re-renders of its own component and `useWalletClient().data` can read back
1006
+ // transiently empty across them, which would silently skip the invalidation.
1007
+ onMutate: (variables) => {
1008
+ const account = variables.account ?? walletClient?.account;
1009
+ if (!account) return {};
1010
+ return { sender: typeof account === "string" ? account : account.address };
1011
+ },
1012
+ onSuccess: (_hash, _variables, context) => {
1013
+ if (!context?.sender) return;
1014
+ void queryClient.invalidateQueries({
1015
+ queryKey: airdropKeys.claimedAmount({ chainId, address: options.address }, context.sender)
1016
+ });
1017
+ }
1018
+ });
1019
+ }
1020
+ function usePlanMerkleCampaign(options = {}) {
1021
+ const { client, resolutionError } = useMemoAirdropFactoryClient(options);
1022
+ const encryptorSourceRef = useRef(options.encryptor);
1023
+ encryptorSourceRef.current = options.encryptor;
1024
+ return useMutation({
1025
+ mutationFn: async (args) => {
1026
+ if (!client) {
1027
+ throw resolutionError ?? new MissingClientError("usePlanMerkleCampaign", "factory");
1028
+ }
1029
+ return planMerkleCampaign({
1030
+ factory: client,
1031
+ ...args,
1032
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current)
1033
+ });
1034
+ }
1035
+ });
1036
+ }
1037
+ function useRescueERC20(options) {
1038
+ const { client } = useMemoAirdropBaseClient(options);
1039
+ return useMutation({
1040
+ mutationFn: async (args) => {
1041
+ if (!client) {
1042
+ throw new MissingClientError("useRescueERC20", "airdrop-base");
1043
+ }
1044
+ return client.rescueERC20(args);
1045
+ }
1046
+ });
1047
+ }
1048
+ function useRescueOtherConfidentialToken(options) {
1049
+ const { client } = useMemoAirdropBaseClient(options);
1050
+ return useMutation({
1051
+ mutationFn: async (args) => {
1052
+ if (!client) {
1053
+ throw new MissingClientError("useRescueOtherConfidentialToken", "airdrop-base");
1054
+ }
1055
+ return client.rescueOtherConfidentialToken(args);
1056
+ }
1057
+ });
1058
+ }
1059
+ function useRevokeComplianceDelegate(options) {
1060
+ const { client, chainId } = useMemoComplianceManagerClient(options);
1061
+ const queryClient = useQueryClient();
1062
+ return useMutation({
1063
+ mutationFn: async (args) => {
1064
+ if (!client) {
1065
+ throw new MissingClientError("useRevokeComplianceDelegate", "compliance-manager");
1066
+ }
1067
+ return client.revokeDelegate(args);
1068
+ },
1069
+ onSuccess: (_hash, variables) => {
1070
+ const scope = { chainId, address: options.address };
1071
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.complianceInfo(scope) });
1072
+ void queryClient.invalidateQueries({
1073
+ queryKey: airdropKeys.activeDelegate(scope, variables.delegate)
1074
+ });
1075
+ }
1076
+ });
1077
+ }
1078
+ function useRotateMerkleRoot(options) {
1079
+ const { client, chainId } = useMemoMerkleAirdropClient(options);
1080
+ const encryptorSourceRef = useRef(options.encryptor);
1081
+ encryptorSourceRef.current = options.encryptor;
1082
+ const queryClient = useQueryClient();
1083
+ return useMutation({
1084
+ mutationFn: async (args) => {
1085
+ if (!client) {
1086
+ throw new MissingClientError("useRotateMerkleRoot", "merkle-airdrop");
1087
+ }
1088
+ return rotateMerkleRoot({
1089
+ airdrop: client,
1090
+ recipients: args.recipients,
1091
+ encryptor: () => resolveEncryptor(encryptorSourceRef.current),
1092
+ ...args.submitter !== void 0 ? { submitter: args.submitter } : {},
1093
+ ...args.account !== void 0 ? { account: args.account } : {}
1094
+ });
1095
+ },
1096
+ onSuccess: () => {
1097
+ void queryClient.invalidateQueries({
1098
+ queryKey: airdropKeys.merkleRoot({ chainId, address: options.address })
1099
+ });
1100
+ }
1101
+ });
1102
+ }
1103
+ function useSignClaimAuthorization(options) {
1104
+ const { walletClient, chainId } = useMemoAirdropBaseClient(options);
1105
+ return useMutation({
1106
+ mutationFn: async (args) => {
1107
+ if (!walletClient) {
1108
+ throw new MissingWalletClientError("useSignClaimAuthorization");
1109
+ }
1110
+ if (chainId === void 0) {
1111
+ throw new MissingClientError("useSignClaimAuthorization", "airdrop-base");
1112
+ }
1113
+ return signClaimAuthorization({
1114
+ walletClient,
1115
+ airdrop: options.address,
1116
+ chainId,
1117
+ recipient: args.recipient,
1118
+ encryptedAmountHandle: args.encryptedAmountHandle,
1119
+ dedupId: args.dedupId,
1120
+ deadline: args.deadline,
1121
+ account: args.account
1122
+ });
1123
+ }
1124
+ });
1125
+ }
1126
+ function useWithdrawGasFee(options) {
1127
+ const { client } = useMemoAirdropBaseClient(options);
1128
+ return useMutation({
1129
+ mutationFn: async (args) => {
1130
+ if (!client) {
1131
+ throw new MissingClientError("useWithdrawGasFee", "airdrop-base");
1132
+ }
1133
+ return client.withdrawGasFee(args);
1134
+ }
1135
+ });
1136
+ }
1137
+ function useAdminBatchDiscloseBalanceToParties(options) {
1138
+ const { client } = useMemoAirdropBaseClient(options);
1139
+ return useMutation({
1140
+ mutationFn: async (args) => {
1141
+ if (!client) {
1142
+ throw new MissingClientError("useAdminBatchDiscloseBalanceToParties", "airdrop-base");
1143
+ }
1144
+ return client.adminBatchDiscloseBalanceToParties(args);
1145
+ }
1146
+ });
1147
+ }
1148
+ function useAdminDiscloseBalanceToParty(options) {
1149
+ const { client } = useMemoAirdropBaseClient(options);
1150
+ return useMutation({
1151
+ mutationFn: async (args) => {
1152
+ if (!client) {
1153
+ throw new MissingClientError("useAdminDiscloseBalanceToParty", "airdrop-base");
1154
+ }
1155
+ return client.adminDiscloseBalanceToParty(args);
1156
+ }
1157
+ });
1158
+ }
1159
+ function useAdminGetCurrentBalance(options) {
1160
+ const { client } = useMemoAirdropBaseClient(options);
1161
+ return useMutation({
1162
+ mutationFn: async (args) => {
1163
+ if (!client) {
1164
+ throw new MissingClientError("useAdminGetCurrentBalance", "airdrop-base");
1165
+ }
1166
+ return client.adminGetCurrentBalance(args ?? {});
1167
+ }
1168
+ });
1169
+ }
1170
+ function useRefreshComplianceBalance(options) {
1171
+ const { client } = useMemoAirdropBaseClient(options);
1172
+ return useMutation({
1173
+ mutationFn: async (args) => {
1174
+ if (!client) {
1175
+ throw new MissingClientError("useRefreshComplianceBalance", "airdrop-base");
1176
+ }
1177
+ return client.refreshComplianceBalance(args ?? {});
1178
+ }
1179
+ });
1180
+ }
1181
+ function useAccessEcdsaClaimAmount(options) {
1182
+ const { client } = useMemoEcdsaAirdropClient(options);
1183
+ return useMutation({
1184
+ mutationFn: async (args) => {
1185
+ if (!client) {
1186
+ throw new MissingClientError("useAccessEcdsaClaimAmount", "ecdsa-airdrop");
1187
+ }
1188
+ return client.getClaimAmount(args);
1189
+ }
1190
+ });
1191
+ }
1192
+ function useAccessMerkleClaimAmount(options) {
1193
+ const { client } = useMemoMerkleAirdropClient(options);
1194
+ return useMutation({
1195
+ mutationFn: async (args) => {
1196
+ if (!client) {
1197
+ throw new MissingClientError("useAccessMerkleClaimAmount", "merkle-airdrop");
1198
+ }
1199
+ return client.getClaimAmount(args);
1200
+ }
1201
+ });
1202
+ }
343
1203
 
344
- export { useAirdropGasFee, useAirdropHasRole, useAirdropPause, useAirdropPaused, useAirdropToken, useAirdropWindow, useClaimedAmount, useComplianceManager, useCreateEcdsaAirdrop, useCreateMerkleAirdrop, useEcdsaClaim, useEffectiveUpgradeable, useExtendClaimWindow, useFactoryFees, useFactoryRegistry, useFundAirdrop, useGrantInstanceRoles, useMerkleClaim, useMerkleRoot, useSetMerkleRoot, useWithdrawConfidential };
1204
+ 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, useIsAirdrop, useIsMerkleRootMutable, useIsSignatureValid, useMerkleClaim, useMerkleClaimAndUnwrap, useMerkleRoot, usePlanMerkleCampaign, usePreflightClaim, usePreflightCreateAirdrop, useRefreshComplianceBalance, useRescueERC20, useRescueOtherConfidentialToken, useResolveGasFee, useRevokeComplianceDelegate, useRotateMerkleRoot, useSetMerkleRoot, useSignClaimAuthorization, useWithdrawConfidential, useWithdrawGasFee };