@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
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Query-key factories shared by the reads and the writes that invalidate them.
3
+ *
4
+ * Internal: neither barrel re-exports this. Consumers who want to invalidate by hand
5
+ * use the exported {@link airdropQueryKey} / {@link airdropQueryKeyPrefix} builders.
6
+ *
7
+ * It exists because a write hook has to rebuild its read's key exactly — same `fn`
8
+ * label, same `args` order — and a read and a write living in different files with
9
+ * hand-copied literals is the one drift hazard that no test catches: the write
10
+ * succeeds, the invalidation silently misses, and the UI shows a stale value. Every
11
+ * key referenced from more than one file is defined here once.
12
+ *
13
+ * A `fn` label used by exactly one hook stays inline in that hook.
14
+ */
15
+ import type { Address, Hex } from "viem";
16
+ /** Chain + contract scope every key below is built against. */
17
+ interface Scope {
18
+ chainId: number | undefined;
19
+ address: Address | undefined;
20
+ }
21
+ /** `fn` labels. Shared so a read and its invalidating write cannot spell one differently. */
22
+ export declare const AIRDROP_FN: {
23
+ readonly claimedAmount: "getClaimedAmount";
24
+ readonly paused: "paused";
25
+ readonly window: "window";
26
+ readonly config: "config";
27
+ readonly merkleRoot: "merkleRoot";
28
+ readonly merkleRootMutable: "isMerkleRootMutable";
29
+ readonly hasRole: "hasRole";
30
+ readonly roleMembers: "roleMembers";
31
+ readonly gasFee: "gasFee";
32
+ readonly preflightCreate: "preflightCreate";
33
+ readonly isSignatureValid: "isSignatureValid";
34
+ readonly fees: "fees";
35
+ readonly registry: "registry";
36
+ readonly customFee: "customFee";
37
+ readonly implementations: "implementations";
38
+ readonly compliancePolicy: "compliancePolicy";
39
+ readonly upgradeabilityPolicy: "upgradeabilityPolicy";
40
+ readonly factoryHasRole: "factoryHasRole";
41
+ readonly factoryRoleMembers: "factoryRoleMembers";
42
+ readonly complianceInfo: "complianceInfo";
43
+ readonly activeDelegate: "isActiveDelegate";
44
+ readonly clientDelegates: "clientDelegates";
45
+ readonly complianceHasRole: "complianceHasRole";
46
+ readonly complianceRoleMembers: "complianceRoleMembers";
47
+ };
48
+ export declare const airdropKeys: {
49
+ /** One account's cumulative delivered total. Keyed on the CLAIM IDENTITY, never the sender. */
50
+ readonly claimedAmount: (s: Scope, account: Address | undefined) => unknown[];
51
+ readonly paused: (s: Scope) => unknown[];
52
+ readonly window: (s: Scope) => unknown[];
53
+ readonly config: (s: Scope) => unknown[];
54
+ readonly gasFee: (s: Scope) => unknown[];
55
+ readonly merkleRoot: (s: Scope) => unknown[];
56
+ readonly merkleRootMutable: (s: Scope) => unknown[];
57
+ readonly hasRole: (s: Scope, role: Hex | undefined, holder: Address | undefined) => unknown[];
58
+ /** Every cached `hasRole` for this instance, whatever role/holder pair was queried. */
59
+ readonly hasRoleAll: (s: Scope) => unknown[];
60
+ readonly roleMembers: (s: Scope, role: Hex | undefined) => unknown[];
61
+ readonly roleMembersAll: (s: Scope) => unknown[];
62
+ /** Every cached create-preflight, whatever params/mode/salt combination was queried. */
63
+ readonly preflightCreateAll: (s: Scope) => unknown[];
64
+ /** Every cached signature check on this instance; a claim consumes a digest and flips it. */
65
+ readonly isSignatureValidAll: (s: Scope) => unknown[];
66
+ readonly fees: (s: Scope) => unknown[];
67
+ readonly customFee: (s: Scope, creator: Address | undefined) => unknown[];
68
+ readonly customFeeAll: (s: Scope) => unknown[];
69
+ /** Every registry page, whatever offset/limit was queried. */
70
+ readonly registryAll: (s: Scope) => unknown[];
71
+ readonly implementations: (s: Scope) => unknown[];
72
+ readonly compliancePolicy: (s: Scope, creator: Address | undefined) => unknown[];
73
+ readonly compliancePolicyAll: (s: Scope) => unknown[];
74
+ readonly upgradeabilityPolicy: (s: Scope, creator: Address | undefined) => unknown[];
75
+ readonly upgradeabilityPolicyAll: (s: Scope) => unknown[];
76
+ readonly factoryHasRole: (s: Scope, role: Hex | undefined, holder: Address | undefined) => unknown[];
77
+ readonly factoryHasRoleAll: (s: Scope) => unknown[];
78
+ readonly factoryRoleMembers: (s: Scope, role: Hex | undefined) => unknown[];
79
+ readonly factoryRoleMembersAll: (s: Scope) => unknown[];
80
+ readonly complianceInfo: (s: Scope) => unknown[];
81
+ readonly activeDelegate: (s: Scope, delegate: Address | undefined) => unknown[];
82
+ readonly activeDelegateAll: (s: Scope) => unknown[];
83
+ readonly clientDelegates: (s: Scope, index: bigint | undefined) => unknown[];
84
+ readonly clientDelegatesAll: (s: Scope) => unknown[];
85
+ readonly complianceHasRole: (s: Scope, role: Hex | undefined, holder: Address | undefined) => unknown[];
86
+ readonly complianceHasRoleAll: (s: Scope) => unknown[];
87
+ readonly complianceRoleMembers: (s: Scope, role: Hex | undefined) => unknown[];
88
+ readonly complianceRoleMembersAll: (s: Scope) => unknown[];
89
+ };
90
+ export {};
@@ -0,0 +1,26 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { EncryptedViewResult } from "../../fhe/types.js";
3
+ import type { GetClaimAmountArgs as EcdsaGetClaimAmountArgs } from "../ecdsa.js";
4
+ import { type EcdsaAirdropInstanceClientOptions } from "./_shared.js";
5
+ /**
6
+ * **Submits a transaction.** Previews a signed encrypted allocation as an encrypted
7
+ * handle. Pass `data.handle` to the Zama relayer's `userDecrypt`.
8
+ *
9
+ * **The submitter can decrypt what it previews here.** The contract grants the amount
10
+ * with `FHE.allow(amount, msg.sender)`, unlike {@link useAccessMerkleClaimAmount}, whose
11
+ * grantee is the entry's claim identity rather than the caller.
12
+ *
13
+ * `dedupMode` must be supplied - the contract has no on-chain getter for it; pass the
14
+ * same value used at `createEcdsaAirdrop` time.
15
+ *
16
+ * **Invalidates:** nothing. The preview consumes neither replay guard nor the EIP-712
17
+ * digest, so the same input is still claimable for real afterwards and no cached read
18
+ * changes value.
19
+ *
20
+ * @example
21
+ * const preview = useAccessEcdsaClaimAmount({ address: airdropAddress, dedupMode: "perAddress" });
22
+ * const { handle } = await preview.mutateAsync({ encryptedInput, dedupId, deadline, signer, signature });
23
+ *
24
+ * @alpha
25
+ */
26
+ export declare function useAccessEcdsaClaimAmount(options: EcdsaAirdropInstanceClientOptions): UseMutationResult<EncryptedViewResult, Error, EcdsaGetClaimAmountArgs>;
@@ -0,0 +1,27 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { EncryptedViewResult } from "../../fhe/types.js";
3
+ import type { GetClaimAmountArgs } from "../merkle.js";
4
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
5
+ /**
6
+ * **Submits a transaction.** Previews the outstanding amount for a proof-bearing Merkle
7
+ * entry as an encrypted handle. Pass `data.handle` to the Zama relayer's `userDecrypt`.
8
+ *
9
+ * `entry.boundTo` must be the sending account (the coprocessor verifies the input proof
10
+ * against the literal caller); `entry.account` selects the leaf.
11
+ *
12
+ * **`entry.account` is the only party that can decrypt the result, not the submitter.**
13
+ * The contract grants the outstanding handle with `_outstandingOf(account, account, …)`,
14
+ * so a third-party submitter gets back a valid handle it learns nothing from - never
15
+ * offer it a `userDecrypt` action. This is the opposite of
16
+ * {@link useAccessEcdsaClaimAmount}, whose preview is ACL'd to `msg.sender`.
17
+ *
18
+ * **Invalidates:** nothing. The preview consumes no accounting and no per-leaf state, so
19
+ * no cached read changes value - the same entry still pays the same amount afterwards.
20
+ *
21
+ * @example
22
+ * const preview = useAccessMerkleClaimAmount({ address: airdropAddress });
23
+ * const { handle } = await preview.mutateAsync({ entry });
24
+ *
25
+ * @alpha
26
+ */
27
+ export declare function useAccessMerkleClaimAmount(options: AirdropInstanceClientOptions): UseMutationResult<EncryptedViewResult, Error, GetClaimAmountArgs>;
@@ -0,0 +1,37 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { Address, Hex } from "viem";
3
+ import type { WriteAccountOverride } from "../airdrop-base.js";
4
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
5
+ /** @alpha */
6
+ export interface AddComplianceDelegateArgs extends WriteAccountOverride {
7
+ /** The account to grant never-expiring user-decryption delegation to. */
8
+ delegate: Address;
9
+ }
10
+ /**
11
+ * Grant `delegate` permanent user-decryption delegation over this compliance
12
+ * clone's airdrop. `options.address` is the CLONE. Requires
13
+ * `DELEGATION_ADMIN_ROLE` on it (check with {@link useComplianceHasRole}).
14
+ *
15
+ * **The gateway lag is this hook's headline.** The delegation is live in the
16
+ * ACL the instant the transaction lands, but the Zama gateway learns about it
17
+ * out of band - the SDK's own guidance is 1-2 minutes. Do not tell the user
18
+ * delegated decryption is ready on success; classify the first delegated
19
+ * reads' failures with `isAclPropagationError` and retry with backoff.
20
+ *
21
+ * **Invalidates:** this clone's {@link useComplianceInfo} entry (the
22
+ * client-delegate set grew) and its {@link useIsActiveDelegate} entry for
23
+ * exactly `delegate`. Both keyed on the clone address - the airdrop instance
24
+ * is a different contract with its own cache namespace and is untouched.
25
+ *
26
+ * @remarks
27
+ * Do not send this and {@link useRevokeComplianceDelegate} for the same
28
+ * delegate in one block: the FHEVM ACL rejects the pair with an opaque revert
29
+ * that names neither the delegate nor the cause.
30
+ *
31
+ * @example
32
+ * const add = useAddComplianceDelegate({ address: managerAddress });
33
+ * await add.mutateAsync({ delegate: complianceOfficer });
34
+ *
35
+ * @alpha
36
+ */
37
+ export declare function useAddComplianceDelegate(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, AddComplianceDelegateArgs>;
@@ -0,0 +1,36 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ import type { EncryptedViewResult } from "../../fhe/types.js";
4
+ import type { WriteAccountOverride } from "../airdrop-base.js";
5
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
6
+ /** @alpha */
7
+ export interface UseAdminBatchDiscloseBalanceToPartiesArgs extends WriteAccountOverride {
8
+ /**
9
+ * Every address to grant. Must be non-empty and contain no zero address;
10
+ * duplicates are wasteful but legal on-chain and are not rejected.
11
+ */
12
+ parties: readonly Address[];
13
+ }
14
+ /**
15
+ * **Submits a transaction.** Discloses the instance's confidential pool
16
+ * balance to several parties at once. Requires `DISCLOSURE_ADMIN_ROLE`.
17
+ *
18
+ * One handle covers the whole batch: the contract reads the balance once and
19
+ * fans the same handle out, so `data.handle` (recovered from the grant naming
20
+ * `parties[0]`) is what *every* listed party decrypts. The caller is not a
21
+ * grantee unless it is in the list.
22
+ *
23
+ * An empty list and a zero-address party are rejected client-side as
24
+ * `InvalidArgumentError` before any gas is spent. Both are decidable from a
25
+ * form's own state, so validate the rows and show field errors rather than
26
+ * routing these through `onError`.
27
+ *
28
+ * **Invalidates:** nothing. ACL is append-only and no read hook caches grants.
29
+ *
30
+ * @example
31
+ * const disclose = useAdminBatchDiscloseBalanceToParties({ address: airdropAddress });
32
+ * const { handle } = await disclose.mutateAsync({ parties: [auditor, regulator] });
33
+ *
34
+ * @alpha
35
+ */
36
+ export declare function useAdminBatchDiscloseBalanceToParties(options: AirdropInstanceClientOptions): UseMutationResult<EncryptedViewResult, Error, UseAdminBatchDiscloseBalanceToPartiesArgs>;
@@ -0,0 +1,31 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ import type { EncryptedViewResult } from "../../fhe/types.js";
4
+ import type { WriteAccountOverride } from "../airdrop-base.js";
5
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
6
+ /** @alpha */
7
+ export interface UseAdminDiscloseBalanceToPartyArgs extends WriteAccountOverride {
8
+ /** The address granted decrypt access - and the only address that can use the returned handle. */
9
+ party: Address;
10
+ }
11
+ /**
12
+ * **Submits a transaction.** Discloses the instance's confidential pool
13
+ * balance to `party`. Requires `DISCLOSURE_ADMIN_ROLE`.
14
+ *
15
+ * **The grantee is `party`, not the caller.** The handle is recovered from the
16
+ * ACL `Allowed` event naming `party`, so unless the caller is also `party` the
17
+ * returned `data.handle` is one it cannot decrypt - hand it to `party` rather
18
+ * than to your own `userDecrypt`, or the relayer rejects it with "not
19
+ * authorized to decrypt". As with every encrypted view here, the handle comes
20
+ * from the receipt and never from a simulation (CLAUDE.md Pitfall #1).
21
+ *
22
+ * **Invalidates:** nothing. ACL is append-only and no read hook in this
23
+ * subpath caches who is allowed on a handle.
24
+ *
25
+ * @example
26
+ * const disclose = useAdminDiscloseBalanceToParty({ address: airdropAddress });
27
+ * const { handle } = await disclose.mutateAsync({ party: auditorAddress });
28
+ *
29
+ * @alpha
30
+ */
31
+ export declare function useAdminDiscloseBalanceToParty(options: AirdropInstanceClientOptions): UseMutationResult<EncryptedViewResult, Error, UseAdminDiscloseBalanceToPartyArgs>;
@@ -0,0 +1,27 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { EncryptedViewResult } from "../../fhe/types.js";
3
+ import type { WriteAccountOverride } from "../airdrop-base.js";
4
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
5
+ /**
6
+ * **Submits a transaction.** Reads the instance's remaining confidential pool
7
+ * balance as an `euint64` handle the caller may decrypt - pass `data.handle`
8
+ * to the Zama relayer's `userDecrypt`. Requires `DISCLOSURE_ADMIN_ROLE`.
9
+ *
10
+ * The name reads like a getter but the entrypoint calls `FHE.allow`, so it is
11
+ * `nonpayable` and its handle comes from the receipt's ACL `Allowed` event -
12
+ * never from a simulation, whose handle would carry no grant (CLAUDE.md
13
+ * Pitfall #1). That is why this is a mutation and not a query.
14
+ *
15
+ * **Invalidates:** nothing. It grants ACL and reads no cached state. Note the
16
+ * converse too: funding and withdrawing move the balance this returns, but a
17
+ * mutation result is not a cache entry, so no write can refresh it - re-run
18
+ * this hook after `useFundAirdrop` or `useWithdrawConfidential` to see the
19
+ * new value.
20
+ *
21
+ * @example
22
+ * const balance = useAdminGetCurrentBalance({ address: airdropAddress });
23
+ * const { handle } = await balance.mutateAsync();
24
+ *
25
+ * @alpha
26
+ */
27
+ export declare function useAdminGetCurrentBalance(options: AirdropInstanceClientOptions): UseMutationResult<EncryptedViewResult, Error, WriteAccountOverride | void>;
@@ -0,0 +1,49 @@
1
+ import { type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Address } from "viem";
3
+ import type { AirdropVariant } from "../errors.js";
4
+ import { type AirdropInstanceHookOptions } from "./_shared.js";
5
+ /**
6
+ * Create-time-immutable instance configuration - combines five `AirdropBaseClient`
7
+ * reads into one.
8
+ *
9
+ * @alpha
10
+ */
11
+ export interface AirdropConfig {
12
+ /** The ERC-7984 token this campaign distributes. */
13
+ token: Address;
14
+ /** The raw variant ordinal from the contract enum: `0` = ECDSA, `1` = Merkle. */
15
+ airdropType: number;
16
+ /** {@link airdropType} as a name, so a consumer can pick which variant hook set to mount. */
17
+ variant: AirdropVariant;
18
+ /** Whether claimants may unwrap to the underlying ERC-20 as part of a claim. */
19
+ unwrappable: boolean;
20
+ /** The instance's own compliance-manager clone. */
21
+ complianceManager: Address;
22
+ /** Per-claim ETH fee in wei; `0` on a fee-free campaign. */
23
+ gasFee: bigint;
24
+ }
25
+ /** @alpha */
26
+ export type UseAirdropConfigArgs = AirdropInstanceHookOptions<AirdropConfig>;
27
+ /**
28
+ * Read an airdrop instance's immutable configuration in one round trip.
29
+ *
30
+ * Bundles `token` / `airdropType` / `unwrappable` / `complianceManager` / `gasFee` -
31
+ * what a UI needs before it can render anything else about a campaign, and how
32
+ * `airdropType` and `unwrappable` get covered without shipping two more one-line hooks
33
+ * nobody would call separately. `variant` is derived from the ordinal so a consumer can
34
+ * branch to the ECDSA or Merkle hook set without decoding the enum itself.
35
+ *
36
+ * Defaults to `staleTime: Infinity` - none of these values is mutable after create. Pass
37
+ * `query: { staleTime: 0 }` to override.
38
+ *
39
+ * The existing {@link useAirdropToken}, {@link useAirdropGasFee} and
40
+ * {@link useComplianceManager} overlap this bundle and stay: they are one `eth_call`
41
+ * rather than five, which is cheaper for a UI that needs exactly one value.
42
+ *
43
+ * @example
44
+ * const { data: config } = useAirdropConfig({ address: airdropAddress });
45
+ * if (config?.variant === "merkle") { ... }
46
+ *
47
+ * @alpha
48
+ */
49
+ export declare function useAirdropConfig(args: UseAirdropConfigArgs): UseQueryResult<AirdropConfig, Error>;
@@ -0,0 +1,28 @@
1
+ import { type UseQueryResult } from "@tanstack/react-query";
2
+ import type { DeploymentMode } from "../constants.js";
3
+ import { type AirdropInstanceHookOptions } from "./_shared.js";
4
+ /** @alpha */
5
+ export type UseAirdropDeploymentModeArgs = AirdropInstanceHookOptions<DeploymentMode>;
6
+ /**
7
+ * Read which deployment shell an airdrop instance is: a minimal-proxy
8
+ * `"clone"`, or a `"uups"` ERC-1967 proxy that
9
+ * {@link useAirdropUpgradeToAndCall} can actually move. Gate any upgrade UI
10
+ * on this.
11
+ *
12
+ * One `eth_getStorageAt` against the ERC-1967 implementation slot, no ABI
13
+ * involved. It is the only reliable discriminator: `proxiableUUID` reverts on
14
+ * both shells when called at an instance address, and
15
+ * `UPGRADE_INTERFACE_VERSION` answers `"5.0.0"` for both.
16
+ *
17
+ * @remarks
18
+ * Defaults to `staleTime: Infinity` — a clone never becomes a proxy, and an
19
+ * upgrade swaps the implementation without changing the shell. Override via
20
+ * `query.staleTime` if you need a refetch anyway.
21
+ *
22
+ * @example
23
+ * const { data: mode } = useAirdropDeploymentMode({ address: airdropAddress });
24
+ * const canUpgrade = mode === "uups";
25
+ *
26
+ * @alpha
27
+ */
28
+ export declare function useAirdropDeploymentMode(args: UseAirdropDeploymentModeArgs): UseQueryResult<DeploymentMode, Error>;
@@ -1,11 +1,16 @@
1
1
  import { type UseQueryResult } from "@tanstack/react-query";
2
- import { type AirdropHookOptions } from "./_shared.js";
2
+ import { type AirdropInstanceHookOptions } from "./_shared.js";
3
+ /** @alpha */
4
+ export type UseAirdropGasFeeArgs = AirdropInstanceHookOptions<bigint>;
3
5
  /**
4
- * Read the airdrop clone's immutable per-claim gas fee (in wei). Attached as
5
- * `msg.value` by `claim()` automatically when the consumer doesn't pass
6
- * `value` explicitly.
6
+ * Read the per-claim ETH fee (wei) an instance charges; `0n` on a fee-free
7
+ * campaign. Every claim entrypoint (`useEcdsaClaim` / `useMerkleClaim`)
8
+ * reads this itself and attaches it as `value` — this hook is for a UI that
9
+ * wants to display the fee before the claimant submits.
7
10
  *
8
11
  * @example
9
12
  * const { data: gasFee } = useAirdropGasFee({ address: airdropAddress });
13
+ *
14
+ * @alpha
10
15
  */
11
- export declare function useAirdropGasFee(options: AirdropHookOptions): UseQueryResult<bigint, Error>;
16
+ export declare function useAirdropGasFee(args: UseAirdropGasFeeArgs): UseQueryResult<bigint, Error>;
@@ -1,16 +1,35 @@
1
1
  import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { Account, Address, Hex } from "viem";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- export interface UseAirdropGrantRoleArgs {
2
+ import type { Address, Hex } from "viem";
3
+ import type { WriteAccountOverride } from "../airdrop-base.js";
4
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
5
+ /** @alpha */
6
+ export interface AirdropGrantRoleArgs extends WriteAccountOverride {
7
+ /** A `bytes32` role identifier - read it from {@link useAirdropRoleConstants}, never hand-hashed. */
5
8
  role: Hex;
6
- accountTarget: Address;
7
- account?: Account | Address;
9
+ /** The account receiving the role. Distinct from `account`, which is who sends the transaction. */
10
+ holder: Address;
8
11
  }
9
12
  /**
10
- * AccessControl: grant `role` to `accountTarget` on this airdrop clone.
11
- * Caller must be a member of the role's admin role (typically
12
- * `DEFAULT_ADMIN_ROLE`).
13
+ * Grant one role on one airdrop instance.
13
14
  *
14
- * After success, invalidate `useAirdropHasRole({ role, account: accountTarget })`.
15
+ * Requires the role's admin role, which is `DEFAULT_ADMIN_ROLE` for every role
16
+ * the instance sets up at `initialize` except `FEE_COLLECTOR_ROLE` - that one
17
+ * administers itself, so only a current fee collector can add another. Confirm
18
+ * with {@link useAirdropRoleAdmin} before offering the grant in a UI.
19
+ *
20
+ * **Invalidates:** this instance's `useAirdropHasRole` entry for exactly
21
+ * `(role, holder)`, and its `useAirdropRoleMembers` entry for `role` (the
22
+ * member list and the count both move). Scoped to this instance - other
23
+ * campaigns' role caches and other role/holder pairs are untouched.
24
+ *
25
+ * For a multi-role split right after create, prefer {@link useGrantInstanceRoles}:
26
+ * it orders the creator's admin revoke last so the key issuing the grants never
27
+ * locks itself out mid-sequence.
28
+ *
29
+ * @example
30
+ * const grant = useAirdropGrantRole({ address: airdropAddress });
31
+ * await grant.mutateAsync({ role: roles.PAUSER_ROLE, holder: opsAddress });
32
+ *
33
+ * @alpha
15
34
  */
16
- export declare function useAirdropGrantRole(options: AirdropHookOptions): UseMutationResult<Hex, Error, UseAirdropGrantRoleArgs>;
35
+ export declare function useAirdropGrantRole(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, AirdropGrantRoleArgs>;
@@ -1,14 +1,23 @@
1
1
  import { type UseQueryResult } from "@tanstack/react-query";
2
2
  import type { Address, Hex } from "viem";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- export interface UseAirdropHasRoleArgs extends AirdropHookOptions {
3
+ import { type AirdropInstanceHookOptions } from "./_shared.js";
4
+ /** @alpha */
5
+ export interface UseAirdropHasRoleArgs extends AirdropInstanceHookOptions<boolean> {
6
+ /** A `bytes32` role identifier — read it from the headless client's role getters (`PAUSER_ROLE()`, etc.), not hand-hashed. */
5
7
  role?: Hex;
6
- account?: Address;
8
+ /** The account to check. */
9
+ holder?: Address;
7
10
  }
8
11
  /**
9
- * Read AccessControl: is `account` a member of `role` on this airdrop clone?
12
+ * Whether `holder` holds `role` on an airdrop instance.
10
13
  *
11
- * The role hashes are stable across deployments (DEFAULT_ADMIN_ROLE,
12
- * FEE_COLLECTOR_ROLE, etc.).
14
+ * Stays disabled (no request fired) until both `role` and `holder` are
15
+ * defined — a UI can call this unconditionally while a form is still being
16
+ * filled in, with no manual `enabled` guard.
17
+ *
18
+ * @example
19
+ * const { data: isPauser } = useAirdropHasRole({ address, role: pauserRole, holder: account });
20
+ *
21
+ * @alpha
13
22
  */
14
23
  export declare function useAirdropHasRole(args: UseAirdropHasRoleArgs): UseQueryResult<boolean, Error>;
@@ -0,0 +1,30 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { Hex } from "viem";
3
+ import type { WriteAccountOverride } from "../airdrop-base.js";
4
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
5
+ /** @alpha */
6
+ export interface AirdropPauseArgs extends WriteAccountOverride {
7
+ /** `true` calls `pause()`, `false` calls `unpause()`. Both require `PAUSER_ROLE`. */
8
+ paused: boolean;
9
+ }
10
+ /**
11
+ * Set an airdrop instance's pause flag. One hook covers both directions —
12
+ * `paused: true` submits `pause()`, `paused: false` submits `unpause()` —
13
+ * rather than shipping two near-identical hooks for what is one UI toggle.
14
+ *
15
+ * Pausing does not stop the clock: `endTime` still passes while paused. Pair
16
+ * with `useExtendClaimWindow` when the campaign is meant to survive the
17
+ * pause.
18
+ *
19
+ * **Invalidates:** this instance's `useAirdropPaused` entry, and its
20
+ * `useAirdropWindow` entry — `isClaimWindowActive` ANDs the pause flag into
21
+ * `window.isActive`, so a mounted `useAirdropWindow` consumer would otherwise
22
+ * keep showing a stale `isActive` after a pause/unpause.
23
+ *
24
+ * @example
25
+ * const setPause = useAirdropPause({ address: airdropAddress });
26
+ * await setPause.mutateAsync({ paused: true });
27
+ *
28
+ * @alpha
29
+ */
30
+ export declare function useAirdropPause(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, AirdropPauseArgs>;
@@ -0,0 +1,17 @@
1
+ import { type UseQueryResult } from "@tanstack/react-query";
2
+ import { type AirdropInstanceHookOptions } from "./_shared.js";
3
+ /** @alpha */
4
+ export type UseAirdropPausedArgs = AirdropInstanceHookOptions<boolean>;
5
+ /**
6
+ * Whether claiming is currently halted (`PausableUpgradeable.paused()`).
7
+ *
8
+ * Distinct from {@link useAirdropWindow}'s `isActive`: this is the pause flag
9
+ * alone, independent of the claim-window timestamps. Use `isActive` for "can
10
+ * a claim succeed right now" and this hook for "did an admin explicitly pause".
11
+ *
12
+ * @example
13
+ * const { data: paused } = useAirdropPaused({ address: airdropAddress });
14
+ *
15
+ * @alpha
16
+ */
17
+ export declare function useAirdropPaused(args: UseAirdropPausedArgs): UseQueryResult<boolean, Error>;
@@ -0,0 +1,36 @@
1
+ import { type UseMutationResult } from "@tanstack/react-query";
2
+ import type { Hex } from "viem";
3
+ import type { WriteAccountOverride } from "../airdrop-base.js";
4
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
5
+ /** @alpha */
6
+ export interface AirdropRenounceRoleArgs extends WriteAccountOverride {
7
+ /** A `bytes32` role identifier - read it from {@link useAirdropRoleConstants}, never hand-hashed. */
8
+ role: Hex;
9
+ }
10
+ /**
11
+ * Give up a role on an airdrop instance yourself.
12
+ *
13
+ * Self-only by construction: the contract's `renounceRole(role, callerConfirmation)`
14
+ * reverts `AccessControlBadConfirmation` unless the confirmation is the sender,
15
+ * so there is no holder to pass - the headless client fills it from the
16
+ * resolved sending account. To remove a role from somebody else use
17
+ * {@link useAirdropRevokeRole}.
18
+ *
19
+ * Renouncing runs the same on-chain floors as a revoke, so it is not an escape
20
+ * hatch from them: the sole remaining `DEFAULT_ADMIN_ROLE` holder cannot
21
+ * renounce (`LastAdmin`). Grant a successor first.
22
+ *
23
+ * **Invalidates:** every `useAirdropHasRole` entry for this instance (prefix,
24
+ * all role/holder pairs), plus its `useAirdropRoleMembers` entry for `role`.
25
+ * The prefix is deliberate - the holder here is whichever account the wallet
26
+ * client resolves at submit time, which need not match any `(role, holder)`
27
+ * pair a component happens to have cached, and a narrower key would invalidate
28
+ * nothing while throwing nothing. Still scoped to this instance.
29
+ *
30
+ * @example
31
+ * const renounce = useAirdropRenounceRole({ address: airdropAddress });
32
+ * await renounce.mutateAsync({ role: roles.DEFAULT_ADMIN_ROLE });
33
+ *
34
+ * @alpha
35
+ */
36
+ export declare function useAirdropRenounceRole(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, AirdropRenounceRoleArgs>;
@@ -1,15 +1,33 @@
1
1
  import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { Account, Address, Hex } from "viem";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- export interface UseAirdropRevokeRoleArgs {
2
+ import type { Address, Hex } from "viem";
3
+ import type { WriteAccountOverride } from "../airdrop-base.js";
4
+ import { type AirdropInstanceClientOptions } from "./_shared.js";
5
+ /** @alpha */
6
+ export interface AirdropRevokeRoleArgs extends WriteAccountOverride {
7
+ /** A `bytes32` role identifier - read it from {@link useAirdropRoleConstants}, never hand-hashed. */
5
8
  role: Hex;
6
- accountTarget: Address;
7
- account?: Account | Address;
9
+ /** The account losing the role. Distinct from `account`, which is who sends the transaction. */
10
+ holder: Address;
8
11
  }
9
12
  /**
10
- * AccessControl: revoke `role` from `accountTarget` on this airdrop clone.
11
- * Caller must be a member of the role's admin role.
13
+ * Revoke one role from one holder on one airdrop instance.
12
14
  *
13
- * After success, invalidate `useAirdropHasRole({ role, account: accountTarget })`.
15
+ * Requires the role's admin role (see {@link useAirdropRoleAdmin};
16
+ * `FEE_COLLECTOR_ROLE` administers itself).
17
+ *
18
+ * Two revocations the contract refuses outright, both pre-checkable with
19
+ * {@link useAirdropRoleMembers}'s `count`: the last `DEFAULT_ADMIN_ROLE` member
20
+ * (`LastAdmin`), and the last `FEE_COLLECTOR_ROLE` member of a fee-charging
21
+ * campaign (`LastFeeCollector`). Grant the successor first, then revoke.
22
+ *
23
+ * **Invalidates:** this instance's `useAirdropHasRole` entry for exactly
24
+ * `(role, holder)`, and its `useAirdropRoleMembers` entry for `role`. Scoped to
25
+ * this instance only.
26
+ *
27
+ * @example
28
+ * const revoke = useAirdropRevokeRole({ address: airdropAddress });
29
+ * await revoke.mutateAsync({ role: roles.PAUSER_ROLE, holder: formerOpsAddress });
30
+ *
31
+ * @alpha
14
32
  */
15
- export declare function useAirdropRevokeRole(options: AirdropHookOptions): UseMutationResult<Hex, Error, UseAirdropRevokeRoleArgs>;
33
+ export declare function useAirdropRevokeRole(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, AirdropRevokeRoleArgs>;
@@ -0,0 +1,28 @@
1
+ import { type UseQueryResult } from "@tanstack/react-query";
2
+ import type { Hex } from "viem";
3
+ import { type AirdropInstanceHookOptions } from "./_shared.js";
4
+ /** @alpha */
5
+ export interface UseAirdropRoleAdminArgs extends AirdropInstanceHookOptions<Hex> {
6
+ /** The role whose administrator to read - from {@link useAirdropRoleConstants}, not hand-hashed. */
7
+ role?: Hex;
8
+ }
9
+ /**
10
+ * Which role's holders may grant and revoke `role` on an airdrop instance.
11
+ *
12
+ * `DEFAULT_ADMIN_ROLE` for everything the instance wires up at `initialize`,
13
+ * with one exception the instance is alone in this module in having:
14
+ * `FEE_COLLECTOR_ROLE` is re-parented to itself, so only a current fee
15
+ * collector can add or remove another. This read is how a UI confirms that
16
+ * before it lets an admin key attempt a fee-collector grant that
17
+ * `planInstanceRoleSplit` already refuses to plan.
18
+ *
19
+ * Stays idle until `role` is defined, so a component can call it while a form
20
+ * is still filling in. Set once at initialize, hence `staleTime: Infinity` by
21
+ * default (overridable through `query`).
22
+ *
23
+ * @example
24
+ * const { data: admin } = useAirdropRoleAdmin({ address, role: roles?.FEE_COLLECTOR_ROLE });
25
+ *
26
+ * @alpha
27
+ */
28
+ export declare function useAirdropRoleAdmin(args: UseAirdropRoleAdminArgs): UseQueryResult<Hex, Error>;