@tokenops/sdk 1.6.0 → 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 (263) hide show
  1. package/CHANGELOG.md +77 -8
  2. package/CONTRIBUTING.md +4 -2
  3. package/README.md +146 -90
  4. package/SUPPORT.md +47 -0
  5. package/dist/{chunk-BD4LZBVF.cjs → chunk-3QHNYEQD.cjs} +18 -17
  6. package/dist/{chunk-YFIWCYHC.cjs → chunk-3YHBO2DL.cjs} +56 -54
  7. package/dist/{chunk-QET3Q4JP.js → chunk-44YJPMQC.js} +8 -6
  8. package/dist/{chunk-6WSNS3UV.js → chunk-4RAAATVY.js} +2 -4
  9. package/dist/{chunk-4KJ66YRH.js → chunk-4TSDNZQ3.js} +2 -2
  10. package/dist/chunk-66IHPTOK.cjs +20 -0
  11. package/dist/{chunk-2RNW4MIJ.cjs → chunk-67OV5CX2.cjs} +0 -18
  12. package/dist/{chunk-PD7ME2BT.js → chunk-6GNR22OV.js} +2 -1
  13. package/dist/{chunk-WOEETTH7.cjs → chunk-7AFPOE7N.cjs} +6 -6
  14. package/dist/{chunk-QKKBBH7I.js → chunk-A4DCEE33.js} +34 -7
  15. package/dist/chunk-AREQJHKA.cjs +713 -0
  16. package/dist/{chunk-U57COLUE.js → chunk-AXIPOR3C.js} +2 -2
  17. package/dist/chunk-EBLBPUPI.cjs +255 -0
  18. package/dist/chunk-EYDA6Q6C.js +245 -0
  19. package/dist/{chunk-SYHNZSZZ.cjs → chunk-FAXIIH5R.cjs} +3 -3
  20. package/dist/{chunk-AYGRYDBX.cjs → chunk-FEDX7B6T.cjs} +37 -35
  21. package/dist/{chunk-CBRL2PJA.cjs → chunk-FHWSBGWE.cjs} +12 -12
  22. package/dist/{chunk-WUXUWTFW.cjs → chunk-FT5H2Q7Y.cjs} +37 -7
  23. package/dist/chunk-GADGBQJO.js +423 -0
  24. package/dist/{chunk-VHSNYUYV.js → chunk-IGO5XSPS.js} +5 -5
  25. package/dist/chunk-IUKKNJ2R.cjs +433 -0
  26. package/dist/{chunk-VR3FREBX.cjs → chunk-JK4XMMKM.cjs} +3 -3
  27. package/dist/{chunk-4ZCXK4VI.cjs → chunk-KFRDLKMA.cjs} +14 -14
  28. package/dist/chunk-KWFFIJYX.js +11 -0
  29. package/dist/{chunk-7G7UOQV4.cjs → chunk-MM5BV5CS.cjs} +4 -4
  30. package/dist/{chunk-43RFBQ73.cjs → chunk-MVDQMV25.cjs} +29 -32
  31. package/dist/chunk-NWFMBLSQ.js +4 -0
  32. package/dist/{chunk-HETNKZEE.js → chunk-PYYSB5ZN.js} +1 -1
  33. package/dist/chunk-PZZK3O3S.cjs +9843 -0
  34. package/dist/{chunk-DRSPMIZ7.js → chunk-QBJ7O2B4.js} +1 -11
  35. package/dist/{chunk-WTK6JDSI.js → chunk-SPLNGUFF.js} +6 -4
  36. package/dist/{chunk-UJS4N2XM.cjs → chunk-TEBM66WA.cjs} +12 -12
  37. package/dist/{chunk-TN65XNTI.js → chunk-TWT3STIX.js} +8 -6
  38. package/dist/chunk-UG5RKLU2.cjs +6 -0
  39. package/dist/{chunk-EUKPOXWR.cjs → chunk-UHHMVBLU.cjs} +17 -15
  40. package/dist/chunk-VW356KR3.js +688 -0
  41. package/dist/{chunk-BK7YIVLK.cjs → chunk-WJLECC22.cjs} +75 -73
  42. package/dist/{chunk-V5D7BHW3.js → chunk-WJMEBBU7.js} +6 -4
  43. package/dist/{chunk-NFW7AUEX.js → chunk-WMACINXO.js} +1 -1
  44. package/dist/chunk-X7WBPCEU.js +9817 -0
  45. package/dist/{chunk-46T67CE2.js → chunk-ZA673I3O.js} +1 -1
  46. package/dist/{chunk-YPYCWLYP.js → chunk-ZWXJTBZO.js} +1 -1
  47. package/dist/core/addresses.d.ts +14 -2
  48. package/dist/core/brands.d.ts +8 -2
  49. package/dist/core/errors.d.ts +71 -10
  50. package/dist/core/preflight.d.ts +1 -0
  51. package/dist/fhe/erc7984-abi.d.ts +1 -0
  52. package/dist/fhe/index.cjs +64 -63
  53. package/dist/fhe/index.js +7 -6
  54. package/dist/fhe/operators.d.ts +22 -5
  55. package/dist/fhe/react/index.cjs +13 -12
  56. package/dist/fhe/react/index.js +6 -5
  57. package/dist/fhe/types.d.ts +8 -2
  58. package/dist/fhe-airdrop/abis/{cloneable.d.ts → airdrop-base.d.ts} +254 -396
  59. package/dist/fhe-airdrop/abis/compliance.d.ts +422 -0
  60. package/dist/fhe-airdrop/abis/ecdsa.d.ts +1316 -0
  61. package/dist/fhe-airdrop/abis/factory.d.ts +1319 -190
  62. package/dist/fhe-airdrop/abis/index.d.ts +5 -2
  63. package/dist/fhe-airdrop/abis/merkle.d.ts +1250 -0
  64. package/dist/fhe-airdrop/advanced/index.cjs +11 -12
  65. package/dist/fhe-airdrop/advanced/index.d.cts +34 -11
  66. package/dist/fhe-airdrop/advanced/index.d.ts +34 -11
  67. package/dist/fhe-airdrop/advanced/index.js +3 -8
  68. package/dist/fhe-airdrop/advanced/react/index.cjs +619 -51
  69. package/dist/fhe-airdrop/advanced/react/index.d.cts +43 -3
  70. package/dist/fhe-airdrop/advanced/react/index.d.ts +43 -3
  71. package/dist/fhe-airdrop/advanced/react/index.js +592 -52
  72. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
  73. package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
  74. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +25 -0
  75. package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
  76. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
  77. package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
  78. package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
  79. package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
  80. package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
  81. package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
  82. package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +36 -0
  83. package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +35 -0
  84. package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
  85. package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +47 -0
  86. package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
  87. package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
  88. package/dist/fhe-airdrop/advanced/react/usePredictEcdsaAirdropAddress.d.ts +33 -0
  89. package/dist/fhe-airdrop/advanced/react/usePredictMerkleAirdropAddress.d.ts +27 -0
  90. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
  91. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
  92. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
  93. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +28 -0
  94. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
  95. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +28 -0
  96. package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
  97. package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
  98. package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
  99. package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
  100. package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
  101. package/dist/fhe-airdrop/airdrop-base.d.ts +608 -0
  102. package/dist/fhe-airdrop/campaign.d.ts +338 -0
  103. package/dist/fhe-airdrop/compliance.d.ts +302 -0
  104. package/dist/fhe-airdrop/constants.d.ts +33 -0
  105. package/dist/fhe-airdrop/ecdsa.d.ts +263 -0
  106. package/dist/fhe-airdrop/encryption.d.ts +92 -14
  107. package/dist/fhe-airdrop/errors.d.ts +273 -15
  108. package/dist/fhe-airdrop/factory.d.ts +533 -274
  109. package/dist/fhe-airdrop/guards.d.ts +317 -0
  110. package/dist/fhe-airdrop/index.cjs +233 -73
  111. package/dist/fhe-airdrop/index.d.cts +46 -8
  112. package/dist/fhe-airdrop/index.d.ts +46 -8
  113. package/dist/fhe-airdrop/index.js +11 -7
  114. package/dist/fhe-airdrop/merkle-tree.d.ts +97 -0
  115. package/dist/fhe-airdrop/merkle.d.ts +201 -0
  116. package/dist/fhe-airdrop/react/_shared.d.ts +156 -70
  117. package/dist/fhe-airdrop/react/index.cjs +1174 -384
  118. package/dist/fhe-airdrop/react/index.d.cts +99 -74
  119. package/dist/fhe-airdrop/react/index.d.ts +99 -74
  120. package/dist/fhe-airdrop/react/index.js +993 -303
  121. package/dist/fhe-airdrop/react/keys.d.ts +90 -0
  122. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
  123. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
  124. package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
  125. package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
  126. package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
  127. package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
  128. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
  129. package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
  130. package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +10 -5
  131. package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +29 -10
  132. package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +15 -6
  133. package/dist/fhe-airdrop/react/useAirdropPause.d.ts +30 -0
  134. package/dist/fhe-airdrop/react/useAirdropPaused.d.ts +17 -0
  135. package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
  136. package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +27 -9
  137. package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
  138. package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
  139. package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
  140. package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -4
  141. package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
  142. package/dist/fhe-airdrop/react/useAirdropWindow.d.ts +37 -0
  143. package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
  144. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
  145. package/dist/fhe-airdrop/react/useClaimedAmount.d.ts +29 -0
  146. package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
  147. package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
  148. package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
  149. package/dist/fhe-airdrop/react/useComplianceManager.d.ts +16 -0
  150. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
  151. package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
  152. package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
  153. package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
  154. package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
  155. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
  156. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
  157. package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +28 -0
  158. package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +25 -0
  159. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
  160. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +24 -0
  161. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
  162. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
  163. package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
  164. package/dist/fhe-airdrop/react/useEffectiveUpgradeable.d.ts +20 -0
  165. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
  166. package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +17 -12
  167. package/dist/fhe-airdrop/react/useFactoryFees.d.ts +28 -0
  168. package/dist/fhe-airdrop/react/useFactoryRegistry.d.ts +35 -0
  169. package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +35 -0
  170. package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +35 -0
  171. package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
  172. package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
  173. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
  174. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +22 -0
  175. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
  176. package/dist/fhe-airdrop/react/useMerkleRoot.d.ts +15 -0
  177. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
  178. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
  179. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -35
  180. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
  181. package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
  182. package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
  183. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
  184. package/dist/fhe-airdrop/react/useSetMerkleRoot.d.ts +22 -0
  185. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +32 -21
  186. package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +23 -0
  187. package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
  188. package/dist/fhe-airdrop/roles.d.ts +147 -0
  189. package/dist/fhe-airdrop/types.d.ts +78 -63
  190. package/dist/fhe-disperse/index.cjs +70 -68
  191. package/dist/fhe-disperse/index.js +10 -8
  192. package/dist/fhe-disperse/react/index.cjs +94 -92
  193. package/dist/fhe-disperse/react/index.js +13 -11
  194. package/dist/fhe-vesting/advanced/index.cjs +10 -8
  195. package/dist/fhe-vesting/advanced/index.js +8 -6
  196. package/dist/fhe-vesting/advanced/react/index.cjs +16 -14
  197. package/dist/fhe-vesting/advanced/react/index.js +13 -11
  198. package/dist/fhe-vesting/index.cjs +74 -72
  199. package/dist/fhe-vesting/index.js +11 -9
  200. package/dist/fhe-vesting/react/index.cjs +228 -226
  201. package/dist/fhe-vesting/react/index.js +15 -13
  202. package/dist/index.cjs +100 -87
  203. package/dist/index.js +3 -2
  204. package/dist/testnet-faucet/index.cjs +57 -55
  205. package/dist/testnet-faucet/index.js +7 -5
  206. package/dist/testnet-faucet/react/index.cjs +55 -53
  207. package/dist/testnet-faucet/react/index.js +9 -7
  208. package/package.json +6 -2
  209. package/dist/chunk-CNP4L3GF.js +0 -105
  210. package/dist/chunk-KSDSXJ34.js +0 -41
  211. package/dist/chunk-LBWRFZR3.cjs +0 -1681
  212. package/dist/chunk-OL6SHN3D.cjs +0 -44
  213. package/dist/chunk-S2XD75JM.js +0 -1637
  214. package/dist/chunk-SPGSO5SO.cjs +0 -1644
  215. package/dist/chunk-UE5XK2SY.js +0 -1673
  216. package/dist/chunk-WO72UBQD.cjs +0 -109
  217. package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +0 -53
  218. package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +0 -49
  219. package/dist/fhe-airdrop/airdrop.d.ts +0 -317
  220. package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +0 -37
  221. package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +0 -7
  222. package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +0 -10
  223. package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +0 -16
  224. package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +0 -6
  225. package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +0 -8
  226. package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +0 -10
  227. package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +0 -17
  228. package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +0 -10
  229. package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +0 -15
  230. package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +0 -11
  231. package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +0 -17
  232. package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +0 -17
  233. package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +0 -16
  234. package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +0 -15
  235. package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +0 -7
  236. package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +0 -7
  237. package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +0 -9
  238. package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +0 -8
  239. package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +0 -22
  240. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +0 -51
  241. package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +0 -10
  242. package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +0 -15
  243. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +0 -14
  244. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +0 -14
  245. package/dist/fhe-airdrop/react/useClaim.d.ts +0 -39
  246. package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +0 -11
  247. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +0 -41
  248. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +0 -48
  249. package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +0 -29
  250. package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +0 -31
  251. package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +0 -14
  252. package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +0 -17
  253. package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +0 -10
  254. package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +0 -11
  255. package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +0 -17
  256. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +0 -33
  257. package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +0 -16
  258. package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +0 -15
  259. package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +0 -14
  260. package/dist/fhe-airdrop/react/useSetPaused.d.ts +0 -14
  261. package/dist/fhe-airdrop/react/useWithdraw.d.ts +0 -12
  262. package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +0 -13
  263. package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +0 -13
@@ -1,457 +1,1147 @@
1
- import { useMemoFactoryClient, buildQueryKey, useMemoAirdropClient } from '../../chunk-CNP4L3GF.js';
2
- export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from '../../chunk-S2XD75JM.js';
3
- import { signClaimAuthorization } from '../../chunk-UE5XK2SY.js';
4
- export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-UE5XK2SY.js';
5
- export { useEnsureOperator, useIsOperator } from '../../chunk-U57COLUE.js';
6
- import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
7
- import '../../chunk-4KJ66YRH.js';
8
- import '../../chunk-YPYCWLYP.js';
9
- import '../../chunk-7VELUOMI.js';
10
- import '../../chunk-6WSNS3UV.js';
11
- import '../../chunk-QKKBBH7I.js';
12
- import '../../chunk-46T67CE2.js';
13
- import { MissingClientError, MissingWalletClientError } from '../../chunk-DRSPMIZ7.js';
14
- 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-DRSPMIZ7.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';
9
+ import '../../chunk-ZWXJTBZO.js';
10
+ import '../../chunk-NWFMBLSQ.js';
11
+ import '../../chunk-4RAAATVY.js';
12
+ import '../../chunk-A4DCEE33.js';
13
+ import '../../chunk-ZA673I3O.js';
14
+ import '../../chunk-KWFFIJYX.js';
15
+ import { MissingClientError, MissingWalletClientError } from '../../chunk-QBJ7O2B4.js';
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
- import { useQuery, useMutation } from '@tanstack/react-query';
17
- import { useWalletClient } from 'wagmi';
18
+ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
19
+ import { useRef } from 'react';
18
20
 
19
- function useConfidentialAirdropFactoryImplementation(options = {}) {
20
- const { client, chainId, resolvedAddress } = useMemoFactoryClient(options);
21
+ function useAirdropToken(args) {
22
+ const { client, chainId } = useMemoAirdropBaseClient(args);
21
23
  return useQuery({
22
- queryKey: buildQueryKey("factory:implementation", chainId, resolvedAddress),
23
- queryFn: () => client.implementation(),
24
- enabled: !!client,
25
- staleTime: 0
24
+ ...args.query,
25
+ queryKey: airdropQueryKey({ chainId, address: args.address, fn: "token", args: [] }),
26
+ queryFn: () => client.token(),
27
+ enabled: Boolean(client && (args.query?.enabled ?? true))
28
+ });
29
+ }
30
+ function useAirdropWindow(args) {
31
+ const { client, chainId } = useMemoAirdropBaseClient(args);
32
+ return useQuery({
33
+ ...args.query,
34
+ queryKey: airdropQueryKey({ chainId, address: args.address, fn: "window", args: [] }),
35
+ queryFn: async () => {
36
+ const [startTime, endTime, hasStarted, hasEnded, isActive] = await Promise.all([
37
+ client.startTime(),
38
+ client.endTime(),
39
+ client.hasClaimStarted(),
40
+ client.hasClaimEnded(),
41
+ client.isClaimWindowActive()
42
+ ]);
43
+ return { startTime, endTime, hasStarted, hasEnded, isActive };
44
+ },
45
+ enabled: Boolean(client && (args.query?.enabled ?? true))
46
+ });
47
+ }
48
+ function useAirdropPaused(args) {
49
+ const { client, chainId } = useMemoAirdropBaseClient(args);
50
+ return useQuery({
51
+ ...args.query,
52
+ queryKey: airdropQueryKey({ chainId, address: args.address, fn: "paused", args: [] }),
53
+ queryFn: () => client.paused(),
54
+ enabled: Boolean(client && (args.query?.enabled ?? true))
55
+ });
56
+ }
57
+ function useAirdropGasFee(args) {
58
+ const { client, chainId } = useMemoAirdropBaseClient(args);
59
+ return useQuery({
60
+ ...args.query,
61
+ queryKey: airdropQueryKey({ chainId, address: args.address, fn: "gasFee", args: [] }),
62
+ queryFn: () => client.gasFee(),
63
+ enabled: Boolean(client && (args.query?.enabled ?? true))
64
+ });
65
+ }
66
+ function useAirdropHasRole(args) {
67
+ const { role, holder, ...base } = args;
68
+ const { client, chainId } = useMemoAirdropBaseClient(base);
69
+ return useQuery({
70
+ ...args.query,
71
+ queryKey: airdropQueryKey({
72
+ chainId,
73
+ address: args.address,
74
+ fn: "hasRole",
75
+ args: [role, holder]
76
+ }),
77
+ queryFn: () => client.hasRole({ role, holder }),
78
+ enabled: Boolean(client && role && holder && (args.query?.enabled ?? true))
79
+ });
80
+ }
81
+ function useMerkleRoot(args) {
82
+ const { client, chainId } = useMemoMerkleAirdropClient(args);
83
+ return useQuery({
84
+ ...args.query,
85
+ queryKey: airdropQueryKey({ chainId, address: args.address, fn: "merkleRoot", args: [] }),
86
+ queryFn: () => client.merkleRoot(),
87
+ enabled: Boolean(client && (args.query?.enabled ?? true))
88
+ });
89
+ }
90
+ function useClaimedAmount(args) {
91
+ const { account, ...base } = args;
92
+ const { client, chainId } = useMemoMerkleAirdropClient(base);
93
+ return useQuery({
94
+ ...args.query,
95
+ queryKey: airdropQueryKey({
96
+ chainId,
97
+ address: args.address,
98
+ fn: "getClaimedAmount",
99
+ args: [account]
100
+ }),
101
+ queryFn: () => client.getClaimedAmount(account),
102
+ enabled: Boolean(client && account && (args.query?.enabled ?? true))
103
+ });
104
+ }
105
+ function useComplianceManager(args) {
106
+ const { client, chainId } = useMemoAirdropBaseClient(args);
107
+ return useQuery({
108
+ ...args.query,
109
+ queryKey: airdropQueryKey({
110
+ chainId,
111
+ address: args.address,
112
+ fn: "complianceManager",
113
+ args: []
114
+ }),
115
+ queryFn: () => client.complianceManager(),
116
+ enabled: Boolean(client && (args.query?.enabled ?? true))
117
+ });
118
+ }
119
+ function useFactoryFees(args = {}) {
120
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
121
+ return useQuery({
122
+ ...args.query,
123
+ queryKey: airdropQueryKey({ chainId, address: resolvedAddress, fn: "fees", args: [] }),
124
+ queryFn: async () => {
125
+ const [feeCollector, defaultGasFee] = await Promise.all([
126
+ client.feeCollector(),
127
+ client.defaultGasFee()
128
+ ]);
129
+ return { feeCollector, defaultGasFee };
130
+ },
131
+ enabled: Boolean(client && (args.query?.enabled ?? true))
132
+ });
133
+ }
134
+ function useFactoryRegistry(args = {}) {
135
+ const { offset = 0n, limit = 50n, ...base } = args;
136
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
137
+ return useQuery({
138
+ ...args.query,
139
+ queryKey: airdropQueryKey({
140
+ chainId,
141
+ address: resolvedAddress,
142
+ fn: "registry",
143
+ args: [offset, limit]
144
+ }),
145
+ queryFn: async () => {
146
+ const [count, items] = await Promise.all([
147
+ client.airdropCount(),
148
+ client.airdrops(offset, limit)
149
+ ]);
150
+ return { count, items };
151
+ },
152
+ enabled: Boolean(client && (args.query?.enabled ?? true))
153
+ });
154
+ }
155
+ function useEffectiveUpgradeable(args = {}) {
156
+ const { creator, ...base } = args;
157
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
158
+ return useQuery({
159
+ ...args.query,
160
+ queryKey: airdropQueryKey({
161
+ chainId,
162
+ address: resolvedAddress,
163
+ fn: "effectiveUpgradeable",
164
+ args: [creator]
165
+ }),
166
+ queryFn: () => client.effectiveUpgradeable(creator),
167
+ enabled: Boolean(client && creator && (args.query?.enabled ?? true))
168
+ });
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))
26
342
  });
27
343
  }
28
- function useFactoryDefaultGasFee(options = {}) {
29
- const { client, chainId, resolvedAddress } = useMemoFactoryClient(options);
344
+ function useComplianceRoleConstants(args) {
345
+ const { client, chainId } = useMemoComplianceManagerClient(args);
30
346
  return useQuery({
31
- queryKey: buildQueryKey("factory:defaultGasFee", chainId, resolvedAddress),
32
- queryFn: () => client.defaultGasFee(),
33
- enabled: !!client,
34
- staleTime: 0
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))
35
380
  });
36
381
  }
37
- function useFactoryFeeCollector(options = {}) {
38
- const { client, chainId, resolvedAddress } = useMemoFactoryClient(options);
382
+ function useEcdsaDomain(args) {
383
+ const { client, chainId } = useMemoEcdsaAirdropClient(args);
39
384
  return useQuery({
40
- queryKey: buildQueryKey("factory:feeCollector", chainId, resolvedAddress),
41
- queryFn: () => client.feeCollector(),
42
- enabled: !!client,
43
- staleTime: 0
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))
44
399
  });
45
400
  }
46
- function useFactoryCustomFee(args = {}) {
401
+ function useEffectiveDelegateToCompliance(args = {}) {
47
402
  const { creator, ...base } = args;
48
- const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
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);
49
419
  return useQuery({
50
- queryKey: buildQueryKey("factory:getCustomFee", chainId, resolvedAddress, creator),
51
- queryFn: () => client.getCustomFee(creator),
52
- enabled: !!client && !!creator,
53
- staleTime: 0
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))
54
424
  });
55
425
  }
56
- function useFactoryInitCodeHash(args = {}) {
57
- const { params, gasFee, ...base } = args;
58
- const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
426
+ function useIsMerkleRootMutable(args) {
427
+ const { client, chainId } = useMemoMerkleAirdropClient(args);
59
428
  return useQuery({
60
- queryKey: buildQueryKey("factory:getInitCodeHash", chainId, resolvedAddress, params, gasFee),
61
- queryFn: () => client.getInitCodeHash({ params, gasFee }),
62
- enabled: !!client && !!params && gasFee !== void 0,
63
- staleTime: 0
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))
64
486
  });
65
487
  }
66
488
  function usePreflightCreateAirdrop(args = {}) {
67
- const { params, creator, userSalt, funding, ...base } = args;
68
- const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
489
+ const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
69
490
  return useQuery({
70
- queryKey: buildQueryKey(
71
- "factory:preflightCreateAirdrop",
491
+ ...args.query,
492
+ queryKey: airdropQueryKey({
72
493
  chainId,
73
- resolvedAddress,
74
- creator,
75
- params,
76
- userSalt,
77
- funding
78
- ),
79
- queryFn: () => client.preflightCreateAirdrop({
80
- params,
81
- creator,
82
- ...userSalt !== void 0 ? { userSalt } : {},
83
- ...funding !== void 0 ? { funding } : {}
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
+ ]
84
506
  }),
85
- enabled: !!client && !!params && !!creator,
86
- staleTime: 0
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
+ )
87
520
  });
88
521
  }
89
- function useCreateConfidentialAirdropAndGetAddress(options = {}) {
90
- const { client, resolutionError } = useMemoFactoryClient(options);
522
+ function useCreateEcdsaAirdrop(options = {}) {
523
+ const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
524
+ const queryClient = useQueryClient();
91
525
  return useMutation({
92
526
  mutationFn: async (args) => {
93
527
  if (!client) {
94
- throw resolutionError ?? new MissingClientError("useCreateConfidentialAirdropAndGetAddress", "factory");
528
+ throw resolutionError ?? new MissingClientError("useCreateEcdsaAirdrop", "factory");
95
529
  }
96
- return client.createConfidentialAirdropAndGetAddress(args);
530
+ return client.createEcdsaAirdrop(args);
531
+ },
532
+ onSuccess: () => {
533
+ void queryClient.invalidateQueries({
534
+ queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
535
+ });
97
536
  }
98
537
  });
99
538
  }
100
- function useCreateConfidentialAirdrop(options = {}) {
101
- const { client, resolutionError } = useMemoFactoryClient(options);
539
+ function useCreateMerkleAirdrop(options = {}) {
540
+ const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
541
+ const queryClient = useQueryClient();
102
542
  return useMutation({
103
543
  mutationFn: async (args) => {
104
544
  if (!client) {
105
- throw resolutionError ?? new MissingClientError("useCreateConfidentialAirdrop", "factory");
545
+ throw resolutionError ?? new MissingClientError("useCreateMerkleAirdrop", "factory");
106
546
  }
107
- return client.createConfidentialAirdrop(args);
547
+ return client.createMerkleAirdrop(args);
548
+ },
549
+ onSuccess: () => {
550
+ void queryClient.invalidateQueries({
551
+ queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
552
+ });
108
553
  }
109
554
  });
110
555
  }
111
- function useCreateAndFundConfidentialAirdrop(options = {}) {
112
- const { client, resolutionError } = useMemoFactoryClient(options);
556
+ function useFundAirdrop(options = {}) {
557
+ const { client, resolutionError } = useMemoAirdropFactoryClient(options);
113
558
  return useMutation({
114
559
  mutationFn: async (args) => {
115
560
  if (!client) {
116
- throw resolutionError ?? new MissingClientError("useCreateAndFundConfidentialAirdrop", "factory");
561
+ throw resolutionError ?? new MissingClientError("useFundAirdrop", "factory");
117
562
  }
118
- return client.createAndFundConfidentialAirdrop(args);
563
+ return client.fundAirdrop(args);
119
564
  }
120
565
  });
121
566
  }
122
- function useCreateAndFundConfidentialAirdropAndGetAddress(options = {}) {
123
- const { client, resolutionError } = useMemoFactoryClient(options);
567
+ function useEcdsaClaim(options) {
568
+ const { client, chainId } = useMemoEcdsaAirdropClient(options);
569
+ const queryClient = useQueryClient();
124
570
  return useMutation({
125
571
  mutationFn: async (args) => {
126
572
  if (!client) {
127
- throw resolutionError ?? new MissingClientError("useCreateAndFundConfidentialAirdropAndGetAddress", "factory");
573
+ throw new MissingClientError("useEcdsaClaim", "ecdsa-airdrop");
128
574
  }
129
- return client.createAndFundConfidentialAirdropAndGetAddress(args);
575
+ return client.claim(args);
576
+ },
577
+ onSuccess: () => {
578
+ void queryClient.invalidateQueries({
579
+ queryKey: airdropKeys.isSignatureValidAll({ chainId, address: options.address })
580
+ });
130
581
  }
131
582
  });
132
583
  }
133
- function useFundConfidentialAirdrop(options = {}) {
134
- const { client, resolutionError } = useMemoFactoryClient(options);
584
+ function useMerkleClaim(options) {
585
+ const { client, chainId } = useMemoMerkleAirdropClient(options);
586
+ const queryClient = useQueryClient();
135
587
  return useMutation({
136
588
  mutationFn: async (args) => {
137
589
  if (!client) {
138
- throw resolutionError ?? new MissingClientError("useFundConfidentialAirdrop", "factory");
590
+ throw new MissingClientError("useMerkleClaim", "merkle-airdrop");
139
591
  }
140
- return client.fundConfidentialAirdrop(args);
592
+ return client.claim(args);
593
+ },
594
+ onMutate: (variables) => ({ account: variables.entry.account }),
595
+ onSuccess: (_hash, _variables, context) => {
596
+ if (!context?.account) return;
597
+ void queryClient.invalidateQueries({
598
+ queryKey: airdropQueryKey({
599
+ chainId,
600
+ address: options.address,
601
+ fn: "getClaimedAmount",
602
+ args: [context.account]
603
+ })
604
+ });
141
605
  }
142
606
  });
143
607
  }
144
- function useSetFeeCollector(options = {}) {
145
- const { client, resolutionError } = useMemoFactoryClient(options);
608
+ function useSetMerkleRoot(options) {
609
+ const { client, chainId } = useMemoMerkleAirdropClient(options);
610
+ const queryClient = useQueryClient();
146
611
  return useMutation({
147
- mutationFn: async ({ newFeeCollector, account }) => {
148
- if (!client) throw resolutionError ?? new MissingClientError("useSetFeeCollector", "factory");
149
- return client.setFeeCollector(newFeeCollector, account);
612
+ mutationFn: async (args) => {
613
+ if (!client) {
614
+ throw new MissingClientError("useSetMerkleRoot", "merkle-airdrop");
615
+ }
616
+ return client.setMerkleRoot(args);
617
+ },
618
+ onSuccess: () => {
619
+ void queryClient.invalidateQueries({
620
+ queryKey: airdropQueryKey({
621
+ chainId,
622
+ address: options.address,
623
+ fn: "merkleRoot",
624
+ args: []
625
+ })
626
+ });
150
627
  }
151
628
  });
152
629
  }
153
- function useSetDefaultGasFee(options = {}) {
154
- const { client, resolutionError } = useMemoFactoryClient(options);
630
+ function useGrantInstanceRoles(options) {
631
+ const { client, chainId } = useMemoAirdropBaseClient(options);
632
+ const queryClient = useQueryClient();
155
633
  return useMutation({
156
- mutationFn: async ({ newGasFee, account }) => {
157
- if (!client)
158
- throw resolutionError ?? new MissingClientError("useSetDefaultGasFee", "factory");
159
- return client.setDefaultGasFee(newGasFee, account);
634
+ mutationFn: async (args) => {
635
+ if (!client) {
636
+ throw new MissingClientError("useGrantInstanceRoles", "airdrop-base");
637
+ }
638
+ return grantInstanceRoles({
639
+ airdrop: client,
640
+ assignment: args.assignment,
641
+ ...args.revokeFromCreator !== void 0 ? { revokeFromCreator: args.revokeFromCreator } : {}
642
+ });
643
+ },
644
+ onSuccess: () => {
645
+ const scope = { chainId, address: options.address };
646
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.hasRoleAll(scope) });
647
+ void queryClient.invalidateQueries({ queryKey: airdropKeys.roleMembersAll(scope) });
160
648
  }
161
649
  });
162
650
  }
163
- function useSetCustomFee(options = {}) {
164
- const { client, resolutionError } = useMemoFactoryClient(options);
651
+ function useAirdropPause(options) {
652
+ const { client, chainId } = useMemoAirdropBaseClient(options);
653
+ const queryClient = useQueryClient();
165
654
  return useMutation({
166
- mutationFn: async ({ campaignCreator, gasFee, account }) => {
167
- if (!client) throw resolutionError ?? new MissingClientError("useSetCustomFee", "factory");
168
- return client.setCustomFee(campaignCreator, gasFee, account);
655
+ mutationFn: async ({ paused, ...rest }) => {
656
+ if (!client) {
657
+ throw new MissingClientError("useAirdropPause", "airdrop-base");
658
+ }
659
+ return paused ? client.pause(rest) : client.unpause(rest);
660
+ },
661
+ onSuccess: () => {
662
+ void queryClient.invalidateQueries({
663
+ queryKey: airdropQueryKey({ chainId, address: options.address, fn: "paused", args: [] })
664
+ });
665
+ void queryClient.invalidateQueries({
666
+ queryKey: airdropQueryKey({ chainId, address: options.address, fn: "window", args: [] })
667
+ });
169
668
  }
170
669
  });
171
670
  }
172
- function useDisableCustomFee(options = {}) {
173
- const { client, resolutionError } = useMemoFactoryClient(options);
671
+ function useExtendClaimWindow(options) {
672
+ const { client, chainId } = useMemoAirdropBaseClient(options);
673
+ const queryClient = useQueryClient();
174
674
  return useMutation({
175
- mutationFn: async ({ campaignCreator, account }) => {
176
- if (!client)
177
- throw resolutionError ?? new MissingClientError("useDisableCustomFee", "factory");
178
- return client.disableCustomFee(campaignCreator, account);
675
+ mutationFn: async (args) => {
676
+ if (!client) {
677
+ throw new MissingClientError("useExtendClaimWindow", "airdrop-base");
678
+ }
679
+ return client.extendClaimWindow(args);
680
+ },
681
+ onSuccess: () => {
682
+ void queryClient.invalidateQueries({
683
+ queryKey: airdropQueryKey({ chainId, address: options.address, fn: "window", args: [] })
684
+ });
179
685
  }
180
686
  });
181
687
  }
182
- function useAirdropToken(options) {
183
- const { client, chainId } = useMemoAirdropClient(options);
184
- return useQuery({
185
- queryKey: buildQueryKey("airdrop:TOKEN", chainId, options.address),
186
- queryFn: () => client.token(),
187
- enabled: !!client,
188
- staleTime: 0
688
+ function useWithdrawConfidential(options) {
689
+ const { client } = useMemoAirdropBaseClient(options);
690
+ return useMutation({
691
+ mutationFn: async (args) => {
692
+ if (!client) {
693
+ throw new MissingClientError("useWithdrawConfidential", "airdrop-base");
694
+ }
695
+ return client.withdrawConfidential(args);
696
+ }
189
697
  });
190
698
  }
191
- function useAirdropGasFee(options) {
192
- const { client, chainId } = useMemoAirdropClient(options);
193
- return useQuery({
194
- queryKey: buildQueryKey("airdrop:GAS_FEE", chainId, options.address),
195
- queryFn: () => client.gasFee(),
196
- enabled: !!client,
197
- staleTime: 0
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
+ }
198
716
  });
199
717
  }
200
- function useAirdropStartTime(options) {
201
- const { client, chainId } = useMemoAirdropClient(options);
202
- return useQuery({
203
- queryKey: buildQueryKey("airdrop:START_TIME", chainId, options.address),
204
- queryFn: () => client.startTime(),
205
- enabled: !!client,
206
- staleTime: 0
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
+ }
207
737
  });
208
738
  }
209
- function useAirdropCanExtendClaimWindow(options) {
210
- const { client, chainId } = useMemoAirdropClient(options);
211
- return useQuery({
212
- queryKey: buildQueryKey("airdrop:CAN_EXTEND_CLAIM_WINDOW", chainId, options.address),
213
- queryFn: () => client.canExtendClaimWindow(),
214
- enabled: !!client,
215
- staleTime: 0
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
+ }
216
756
  });
217
757
  }
218
- function useAirdropEndTime(options) {
219
- const { client, chainId } = useMemoAirdropClient(options);
220
- return useQuery({
221
- queryKey: buildQueryKey("airdrop:endTime", chainId, options.address),
222
- queryFn: () => client.endTime(),
223
- enabled: !!client,
224
- staleTime: 0
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
+ }
225
777
  });
226
778
  }
227
- function useAirdropIsPaused(options) {
228
- const { client, chainId } = useMemoAirdropClient(options);
229
- return useQuery({
230
- queryKey: buildQueryKey("airdrop:isPaused", chainId, options.address),
231
- queryFn: () => client.isPaused(),
232
- enabled: !!client,
233
- staleTime: 0
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
+ }
234
788
  });
235
789
  }
236
- function useAirdropDeploymentBlockNumber(options) {
237
- const { client, chainId } = useMemoAirdropClient(options);
238
- return useQuery({
239
- queryKey: buildQueryKey("airdrop:deploymentBlockNumber", chainId, options.address),
240
- queryFn: () => client.deploymentBlockNumber(),
241
- enabled: !!client,
242
- staleTime: 0
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
+ }
243
799
  });
244
800
  }
245
- function useAirdropDomainSeparator(options) {
246
- const { client, chainId } = useMemoAirdropClient(options);
247
- return useQuery({
248
- queryKey: buildQueryKey("airdrop:DOMAIN_SEPARATOR", chainId, options.address),
249
- queryFn: () => client.domainSeparator(),
250
- enabled: !!client,
251
- staleTime: 0
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
+ })
252
811
  });
253
812
  }
254
- function useAirdropClaimTypehash(options) {
255
- const { client, chainId } = useMemoAirdropClient(options);
256
- return useQuery({
257
- queryKey: buildQueryKey("airdrop:CLAIM_TYPEHASH", chainId, options.address),
258
- queryFn: () => client.claimTypehash(),
259
- enabled: !!client,
260
- staleTime: 0
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
+ }
261
832
  });
262
833
  }
263
- function useAirdropIsClaimWindowActive(options) {
264
- const { client, chainId } = useMemoAirdropClient(options);
265
- return useQuery({
266
- queryKey: buildQueryKey("airdrop:isClaimWindowActive", chainId, options.address),
267
- queryFn: () => client.isClaimWindowActive(),
268
- enabled: !!client,
269
- staleTime: 0
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
+ }
270
851
  });
271
852
  }
272
- function useAirdropHasClaimStarted(options) {
273
- const { client, chainId } = useMemoAirdropClient(options);
274
- return useQuery({
275
- queryKey: buildQueryKey("airdrop:hasClaimStarted", chainId, options.address),
276
- queryFn: () => client.hasClaimStarted(),
277
- enabled: !!client,
278
- staleTime: 0
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
+ }
279
872
  });
280
873
  }
281
- function useAirdropHasClaimEnded(options) {
282
- const { client, chainId } = useMemoAirdropClient(options);
283
- return useQuery({
284
- queryKey: buildQueryKey("airdrop:hasClaimEnded", chainId, options.address),
285
- queryFn: () => client.hasClaimEnded(),
286
- enabled: !!client,
287
- staleTime: 0
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
+ }
288
889
  });
289
890
  }
290
- function useAirdropClaimedSignatures(args) {
291
- const { signatureHash, ...base } = args;
292
- const { client, chainId } = useMemoAirdropClient(base);
293
- return useQuery({
294
- queryKey: buildQueryKey("airdrop:claimedSignatures", chainId, base.address, signatureHash),
295
- queryFn: () => client.claimedSignatures(signatureHash),
296
- enabled: !!client && !!signatureHash,
297
- staleTime: 0
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
+ }
298
906
  });
299
907
  }
300
- function useAirdropIsSignatureClaimed(args) {
301
- const { user, encryptedAmountHandle, ...base } = args;
302
- const { client, chainId } = useMemoAirdropClient(base);
303
- return useQuery({
304
- queryKey: buildQueryKey(
305
- "airdrop:isSignatureClaimed",
306
- chainId,
307
- base.address,
308
- user,
309
- encryptedAmountHandle
310
- ),
311
- queryFn: () => client.isSignatureClaimed(user, encryptedAmountHandle),
312
- enabled: !!client && !!user && !!encryptedAmountHandle,
313
- staleTime: 0
314
- });
315
- }
316
- function useAirdropIsSignatureValid(args) {
317
- const { encryptedAmountHandle, signature, caller, ...base } = args;
318
- const { client, chainId } = useMemoAirdropClient(base);
319
- const { address: connectedAddress } = useWagmiAccount();
320
- const resolvedCaller = caller ?? connectedAddress;
321
- return useQuery({
322
- queryKey: buildQueryKey(
323
- "airdrop:isSignatureValid",
324
- chainId,
325
- base.address,
326
- encryptedAmountHandle,
327
- signature,
328
- resolvedCaller
329
- ),
330
- queryFn: () => client.isSignatureValid({
331
- encryptedAmountHandle,
332
- signature,
333
- caller: resolvedCaller
334
- }),
335
- enabled: !!client && !!encryptedAmountHandle && !!signature && !!resolvedCaller,
336
- staleTime: 0
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
+ }
337
917
  });
338
918
  }
339
- function useAirdropHasRole(args) {
340
- const { role, account, ...base } = args;
341
- const { client, chainId } = useMemoAirdropClient(base);
342
- return useQuery({
343
- queryKey: buildQueryKey("airdrop:hasRole", chainId, base.address, role, account),
344
- queryFn: () => client.hasRole(role, account),
345
- enabled: !!client && !!role && !!account,
346
- staleTime: 0
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
+ }
347
934
  });
348
935
  }
349
- function useClaim(options) {
350
- const { client } = useMemoAirdropClient(options);
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();
351
951
  return useMutation({
352
952
  mutationFn: async (args) => {
353
- if (!client) throw new MissingClientError("useClaim", "airdrop");
354
- return client.claim(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
+ });
355
971
  }
356
972
  });
357
973
  }
358
- function useAccessClaimAmount(options) {
359
- const { client } = useMemoAirdropClient(options);
974
+ function usePlanMerkleCampaign(options = {}) {
975
+ const { client, resolutionError } = useMemoAirdropFactoryClient(options);
976
+ const encryptorSourceRef = useRef(options.encryptor);
977
+ encryptorSourceRef.current = options.encryptor;
360
978
  return useMutation({
361
979
  mutationFn: async (args) => {
362
- if (!client) throw new MissingClientError("useAccessClaimAmount", "airdrop");
363
- return client.getClaimAmount(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);
364
999
  }
365
1000
  });
366
1001
  }
367
- var useGetClaimAmount = useAccessClaimAmount;
368
- function useWithdraw(options) {
369
- const { client } = useMemoAirdropClient(options);
1002
+ function useRescueOtherConfidentialToken(options) {
1003
+ const { client } = useMemoAirdropBaseClient(options);
370
1004
  return useMutation({
371
- mutationFn: async ({ recipient, account }) => {
372
- if (!client) throw new MissingClientError("useWithdraw", "airdrop");
373
- return client.withdraw(recipient, account);
1005
+ mutationFn: async (args) => {
1006
+ if (!client) {
1007
+ throw new MissingClientError("useRescueOtherConfidentialToken", "airdrop-base");
1008
+ }
1009
+ return client.rescueOtherConfidentialToken(args);
374
1010
  }
375
1011
  });
376
1012
  }
377
- function useSetPaused(options) {
378
- const { client } = useMemoAirdropClient(options);
1013
+ function useRevokeComplianceDelegate(options) {
1014
+ const { client, chainId } = useMemoComplianceManagerClient(options);
1015
+ const queryClient = useQueryClient();
379
1016
  return useMutation({
380
- mutationFn: async ({ paused, account }) => {
381
- if (!client) throw new MissingClientError("useSetPaused", "airdrop");
382
- return client.setPaused(paused, account);
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
+ });
383
1029
  }
384
1030
  });
385
1031
  }
386
- function useExtendClaimWindow(options) {
387
- const { client } = useMemoAirdropClient(options);
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);
388
1059
  return useMutation({
389
- mutationFn: async ({ newEndTime, account }) => {
390
- if (!client) throw new MissingClientError("useExtendClaimWindow", "airdrop");
391
- return client.extendClaimWindow(newEndTime, account);
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
+ });
392
1077
  }
393
1078
  });
394
1079
  }
395
- function useWithdrawOtherToken(options) {
396
- const { client } = useMemoAirdropClient(options);
1080
+ function useWithdrawGasFee(options) {
1081
+ const { client } = useMemoAirdropBaseClient(options);
397
1082
  return useMutation({
398
- mutationFn: async ({ tokenAddress, recipient, account }) => {
399
- if (!client) throw new MissingClientError("useWithdrawOtherToken", "airdrop");
400
- return client.withdrawOtherToken(tokenAddress, recipient, account);
1083
+ mutationFn: async (args) => {
1084
+ if (!client) {
1085
+ throw new MissingClientError("useWithdrawGasFee", "airdrop-base");
1086
+ }
1087
+ return client.withdrawGasFee(args);
401
1088
  }
402
1089
  });
403
1090
  }
404
- function useWithdrawOtherConfidentialToken(options) {
405
- const { client } = useMemoAirdropClient(options);
1091
+ function useAdminBatchDiscloseBalanceToParties(options) {
1092
+ const { client } = useMemoAirdropBaseClient(options);
406
1093
  return useMutation({
407
- mutationFn: async ({ tokenAddress, recipient, account }) => {
408
- if (!client) throw new MissingClientError("useWithdrawOtherConfidentialToken", "airdrop");
409
- return client.withdrawOtherConfidentialToken(tokenAddress, recipient, account);
1094
+ mutationFn: async (args) => {
1095
+ if (!client) {
1096
+ throw new MissingClientError("useAdminBatchDiscloseBalanceToParties", "airdrop-base");
1097
+ }
1098
+ return client.adminBatchDiscloseBalanceToParties(args);
410
1099
  }
411
1100
  });
412
1101
  }
413
- function useAirdropWithdrawGasFee(options) {
414
- const { client } = useMemoAirdropClient(options);
1102
+ function useAdminDiscloseBalanceToParty(options) {
1103
+ const { client } = useMemoAirdropBaseClient(options);
415
1104
  return useMutation({
416
- mutationFn: async ({ recipient, amount, account }) => {
417
- if (!client) throw new MissingClientError("useAirdropWithdrawGasFee", "airdrop");
418
- return client.withdrawGasFee(recipient, amount, account);
1105
+ mutationFn: async (args) => {
1106
+ if (!client) {
1107
+ throw new MissingClientError("useAdminDiscloseBalanceToParty", "airdrop-base");
1108
+ }
1109
+ return client.adminDiscloseBalanceToParty(args);
419
1110
  }
420
1111
  });
421
1112
  }
422
- function useAirdropGrantRole(options) {
423
- const { client } = useMemoAirdropClient(options);
1113
+ function useAdminGetCurrentBalance(options) {
1114
+ const { client } = useMemoAirdropBaseClient(options);
424
1115
  return useMutation({
425
- mutationFn: async ({ role, accountTarget, account }) => {
426
- if (!client) throw new MissingClientError("useAirdropGrantRole", "airdrop");
427
- return client.grantRole(role, accountTarget, account);
1116
+ mutationFn: async (args) => {
1117
+ if (!client) {
1118
+ throw new MissingClientError("useAdminGetCurrentBalance", "airdrop-base");
1119
+ }
1120
+ return client.adminGetCurrentBalance(args ?? {});
428
1121
  }
429
1122
  });
430
1123
  }
431
- function useAirdropRevokeRole(options) {
432
- const { client } = useMemoAirdropClient(options);
1124
+ function useAccessEcdsaClaimAmount(options) {
1125
+ const { client } = useMemoEcdsaAirdropClient(options);
433
1126
  return useMutation({
434
- mutationFn: async ({ role, accountTarget, account }) => {
435
- if (!client) throw new MissingClientError("useAirdropRevokeRole", "airdrop");
436
- return client.revokeRole(role, accountTarget, account);
1127
+ mutationFn: async (args) => {
1128
+ if (!client) {
1129
+ throw new MissingClientError("useAccessEcdsaClaimAmount", "ecdsa-airdrop");
1130
+ }
1131
+ return client.getClaimAmount(args);
437
1132
  }
438
1133
  });
439
1134
  }
440
- function useSignClaimAuthorization(options = {}) {
441
- const { data: walletClient } = useWalletClient({ chainId: options.chainId });
1135
+ function useAccessMerkleClaimAmount(options) {
1136
+ const { client } = useMemoMerkleAirdropClient(options);
442
1137
  return useMutation({
443
1138
  mutationFn: async (args) => {
444
- if (!walletClient) {
445
- throw new MissingWalletClientError("useSignClaimAuthorization");
1139
+ if (!client) {
1140
+ throw new MissingClientError("useAccessMerkleClaimAmount", "merkle-airdrop");
446
1141
  }
447
- return signClaimAuthorization({
448
- walletClient,
449
- airdropAddress: args.airdropAddress,
450
- recipient: args.recipient,
451
- encryptedAmountHandle: args.encryptedAmountHandle
452
- });
1142
+ return client.getClaimAmount(args);
453
1143
  }
454
1144
  });
455
1145
  }
456
1146
 
457
- export { useAccessClaimAmount, useAirdropCanExtendClaimWindow, useAirdropClaimTypehash, useAirdropClaimedSignatures, useAirdropDeploymentBlockNumber, useAirdropDomainSeparator, useAirdropEndTime, useAirdropGasFee, useAirdropGrantRole, useAirdropHasClaimEnded, useAirdropHasClaimStarted, useAirdropHasRole, useAirdropIsClaimWindowActive, useAirdropIsPaused, useAirdropIsSignatureClaimed, useAirdropIsSignatureValid, useAirdropRevokeRole, useAirdropStartTime, useAirdropToken, useAirdropWithdrawGasFee, useClaim, useConfidentialAirdropFactoryImplementation, useCreateAndFundConfidentialAirdrop, useCreateAndFundConfidentialAirdropAndGetAddress, useCreateConfidentialAirdrop, useCreateConfidentialAirdropAndGetAddress, useDisableCustomFee, useExtendClaimWindow, useFactoryCustomFee, useFactoryDefaultGasFee, useFactoryFeeCollector, useFactoryInitCodeHash, useFundConfidentialAirdrop, useGetClaimAmount, usePreflightCreateAirdrop, useSetCustomFee, useSetDefaultGasFee, useSetFeeCollector, useSetPaused, useSignClaimAuthorization, useWithdraw, useWithdrawOtherConfidentialToken, useWithdrawOtherToken };
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 };