@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,109 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkSPGSO5SO_cjs = require('./chunk-SPGSO5SO.cjs');
4
- var chunkLBWRFZR3_cjs = require('./chunk-LBWRFZR3.cjs');
5
- var chunkWUXUWTFW_cjs = require('./chunk-WUXUWTFW.cjs');
6
- var chunk2RNW4MIJ_cjs = require('./chunk-2RNW4MIJ.cjs');
7
- var react = require('react');
8
- var wagmi = require('wagmi');
9
-
10
- var FHE_AIRDROP_KEY = "tokenops-sdk";
11
- var FHE_AIRDROP_NAMESPACE = "fhe-airdrop";
12
- function tryResolveFactoryAddress(override, chainId) {
13
- if (override) return override;
14
- if (chainId === void 0) return void 0;
15
- return chunkWUXUWTFW_cjs.getFheAirdropFactoryAddress(chainId);
16
- }
17
- function useMemoFactoryClient(opts = {}) {
18
- const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
19
- const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
20
- const chainId = opts.chainId ?? publicClient?.chain?.id;
21
- const resolvedAddress = tryResolveFactoryAddress(opts.address, chainId);
22
- const resolutionError = computeFactoryResolutionError(opts.address, chainId);
23
- const encryptorSourceRef = react.useRef(opts.encryptor);
24
- encryptorSourceRef.current = opts.encryptor;
25
- const client = react.useMemo(() => {
26
- if (!publicClient) return void 0;
27
- if (!resolvedAddress) return void 0;
28
- return chunkLBWRFZR3_cjs.createConfidentialAirdropFactoryClient({
29
- publicClient,
30
- ...walletClient ? { walletClient } : {},
31
- address: resolvedAddress,
32
- ...chainId !== void 0 ? { chainId } : {},
33
- // Lazy — invoked per-encryption inside the headless client. Picks up
34
- // whichever EncryptorSource the consumer last passed in.
35
- encryptor: () => chunkLBWRFZR3_cjs.resolveEncryptor(encryptorSourceRef.current)
36
- });
37
- }, [publicClient, walletClient, resolvedAddress, chainId]);
38
- return {
39
- client,
40
- resolutionError,
41
- publicClient,
42
- walletClient: walletClient ?? void 0,
43
- chainId,
44
- resolvedAddress
45
- };
46
- }
47
- function computeFactoryResolutionError(override, chainId) {
48
- if (override) return void 0;
49
- if (chainId === void 0) {
50
- return new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
51
- reason: "chain-id-missing",
52
- product: "fheAirdrop",
53
- contract: "confidentialAirdropFactory",
54
- clientLabel: "ConfidentialAirdropFactoryClient"
55
- });
56
- }
57
- const resolved = chunkWUXUWTFW_cjs.getFheAirdropFactoryAddress(chainId);
58
- if (!resolved) {
59
- return new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
60
- reason: "registry-not-deployed",
61
- product: "fheAirdrop",
62
- contract: "confidentialAirdropFactory",
63
- chainId,
64
- clientLabel: "ConfidentialAirdropFactoryClient"
65
- });
66
- }
67
- return void 0;
68
- }
69
- function useMemoAirdropClient(opts) {
70
- const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
71
- const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
72
- const chainId = opts.chainId ?? publicClient?.chain?.id;
73
- const client = react.useMemo(() => {
74
- if (!publicClient) return void 0;
75
- if (!opts.address) return void 0;
76
- return chunkSPGSO5SO_cjs.createConfidentialAirdropClient({
77
- publicClient,
78
- ...walletClient ? { walletClient } : {},
79
- address: opts.address,
80
- ...opts.aclAddress ? { aclAddress: opts.aclAddress } : {}
81
- });
82
- }, [publicClient, walletClient, opts.address, opts.aclAddress]);
83
- return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
84
- }
85
- function buildQueryKey(method, chainId, address, ...args) {
86
- return [
87
- FHE_AIRDROP_KEY,
88
- FHE_AIRDROP_NAMESPACE,
89
- method,
90
- chainId ?? null,
91
- address ? address.toLowerCase() : null,
92
- ...args.map(normalizeKeyArg)
93
- ];
94
- }
95
- function normalizeKeyArg(value) {
96
- if (typeof value === "bigint") return value.toString();
97
- if (Array.isArray(value)) return value.map(normalizeKeyArg);
98
- if (value && typeof value === "object") {
99
- return Object.fromEntries(
100
- Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
101
- );
102
- }
103
- if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
104
- return value;
105
- }
106
-
107
- exports.buildQueryKey = buildQueryKey;
108
- exports.useMemoAirdropClient = useMemoAirdropClient;
109
- exports.useMemoFactoryClient = useMemoFactoryClient;
@@ -1,53 +0,0 @@
1
- import type { Address } from "viem";
2
- import { ConfidentialAirdropFactoryClient, type ConfidentialAirdropFactoryClientConfig, type PredictAirdropArgs } from "../factory.js";
3
- /**
4
- * Advanced extension of {@link ConfidentialAirdropFactoryClient} that re-exposes
5
- * the CREATE2 address prediction read.
6
- *
7
- * **Why this is "advanced" surface.** Most consumers want one call back —
8
- * `createConfidentialAirdrop` (rich-return, `{ hash, airdrop }`). The factory
9
- * still emits
10
- * `ConfidentialAirdropCreated`, the SDK still parses it, so consumers never
11
- * need to ask "what address will this deploy to before mining?" Hoisting
12
- * `predictAirdropAddress` onto the headline client surface gave consumers a
13
- * footgun: pass the wrong `gasFee` and you predict an address that won't
14
- * match the deployed clone.
15
- *
16
- * For the genuinely-advanced cases — historical address recovery, same-tx
17
- * pre-confirmation flows — import this subclass from `@tokenops/sdk/fhe-airdrop/advanced`
18
- * and call it explicitly. The headline factory does not include this method.
19
- *
20
- * @example
21
- * import { createConfidentialAirdropFactoryAdvancedClient } from "@tokenops/sdk/fhe-airdrop/advanced";
22
- *
23
- * const factory = createConfidentialAirdropFactoryAdvancedClient({ publicClient });
24
- * const predicted = await factory.predictAirdropAddress({
25
- * params, userSalt, deployer, gasFee: customGasFee,
26
- * });
27
- */
28
- export declare class ConfidentialAirdropFactoryAdvancedClient extends ConfidentialAirdropFactoryClient {
29
- /**
30
- * Compute the deterministic CREATE2 address for an airdrop clone without
31
- * deploying it.
32
- *
33
- * Note: `gasFee` must match what the factory would charge the deployer at
34
- * deploy time (custom fee if set, otherwise `defaultGasFee`). Use
35
- * `getCustomFee(deployer)` and `defaultGasFee()` to resolve it correctly —
36
- * a mismatch silently targets the wrong address.
37
- *
38
- * For the common "deploy a clone and learn its address" flow, use the
39
- * headline `factory.createConfidentialAirdrop` instead — it parses the
40
- * address from the tx receipt's `ConfidentialAirdropCreated` event without
41
- * any `gasFee` guessing.
42
- */
43
- predictAirdropAddress(args: PredictAirdropArgs): Promise<Address>;
44
- }
45
- /**
46
- * Create a {@link ConfidentialAirdropFactoryAdvancedClient}. Mirrors viem's
47
- * `create*` convention.
48
- *
49
- * @example
50
- * const factory = createConfidentialAirdropFactoryAdvancedClient({ publicClient, walletClient, encryptor });
51
- * const predicted = await factory.predictAirdropAddress({ params, userSalt, deployer, gasFee });
52
- */
53
- export declare function createConfidentialAirdropFactoryAdvancedClient(config: ConfidentialAirdropFactoryClientConfig): ConfidentialAirdropFactoryAdvancedClient;
@@ -1,49 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import type { Address, Hex, PublicClient } from "viem";
3
- import { type EncryptorSource } from "../../encryption.js";
4
- import { type AirdropParams } from "../../types.js";
5
- export interface UsePredictAirdropAddressArgs {
6
- params?: AirdropParams;
7
- userSalt?: Hex;
8
- deployer?: Address;
9
- /**
10
- * Gas fee in wei to embed into the CREATE2 salt computation. Must match the
11
- * fee that will be (or was) active for `deployer` at deploy time:
12
- * custom fee if `getCustomFee(deployer).enabled`, otherwise `defaultGasFee`.
13
- *
14
- * Passing the wrong value produces a different address than the deployed
15
- * clone — use `useAirdropFactoryCustomFee` and `useAirdropFactoryDefaultGasFee`
16
- * from the headline `@tokenops/sdk/fhe-airdrop/react` subpath to resolve it
17
- * correctly.
18
- */
19
- gasFee?: bigint;
20
- /** Override the on-chain factory address. Defaults to {@link DEPLOYED_ADDRESSES}. */
21
- address?: Address | undefined;
22
- /** Override the chain id used for default address resolution. Defaults to `usePublicClient().chain?.id`. */
23
- chainId?: number | undefined;
24
- /** Override the viem `PublicClient` — bypasses the wagmi context. */
25
- publicClient?: PublicClient | undefined;
26
- /** Lazy or eager encryptor source. Not required for predict reads, accepted for client-construction symmetry. */
27
- encryptor?: EncryptorSource;
28
- }
29
- /**
30
- * Compute the deterministic CREATE2 address the factory would produce for an
31
- * airdrop clone without deploying it.
32
- *
33
- * **Advanced surface.** This hook lives on the advanced subpath because the
34
- * common "deploy and learn the address" flow is better served by
35
- * `useCreateConfidentialAirdropAndGetAddress` on the headline React subpath —
36
- * which parses the address from the `ConfidentialAirdropCreated` event and
37
- * never has to guess the `gasFee` that was active at deploy time.
38
- *
39
- * The hook is disabled until all four of `params`, `userSalt`, `deployer`, and
40
- * `gasFee` are set.
41
- *
42
- * @example
43
- * import { usePredictAirdropAddress } from "@tokenops/sdk/fhe-airdrop/advanced/react";
44
- *
45
- * const { data: predictedAddress } = usePredictAirdropAddress({
46
- * params, userSalt, deployer, gasFee: defaultGasFee,
47
- * });
48
- */
49
- export declare function usePredictAirdropAddress(args?: UsePredictAirdropAddressArgs): UseQueryResult<Address, Error>;
@@ -1,317 +0,0 @@
1
- import type { Account, Address, Hex, PublicClient, WalletClient } from "viem";
2
- import type { EncryptedHandle, Role, TxHash } from "../core/brands.js";
3
- import { type PreflightResult } from "../core/preflight.js";
4
- import { type SdkTelemetry } from "../core/telemetry.js";
5
- import type { EncryptedInput, EncryptedViewResult } from "./types.js";
6
- export type { EncryptedViewResult } from "./types.js";
7
- export interface ConfidentialAirdropClientConfig {
8
- publicClient: PublicClient;
9
- walletClient?: WalletClient | undefined;
10
- /** Deployed airdrop clone address. */
11
- address: Address;
12
- /**
13
- * FHEVM ACL contract address override. When omitted, resolved from
14
- * `publicClient.chain?.id` via the SDK's chain registry; the constructor
15
- * throws `DeploymentAddressUnavailableError` if neither is available.
16
- * Required because `getClaimAmount` filters the receipt for ACL grants
17
- * to extract the returned handle.
18
- */
19
- aclAddress?: Address | undefined;
20
- /**
21
- * Optional telemetry sink. When provided, the SDK emits a `fhe-airdrop.client.init`
22
- * event on construction and brackets public write methods with named spans
23
- * (`fhe-airdrop.client.claim`, `…getClaimAmount`, …). Defaults to a no-op —
24
- * zero overhead, zero leakage of consumer-side identifiers.
25
- *
26
- * The shape is structurally compatible with `NoopTelemetry` / `ConsoleTelemetry` /
27
- * `TokenOpsTelemetry` exported from `@tokenops/sdk/telemetry`.
28
- */
29
- telemetry?: SdkTelemetry | undefined;
30
- }
31
- /**
32
- * Args for `claim()` / `getClaimAmount()`.
33
- *
34
- * The admin produces `{ encryptedInput, signature }` off-chain (typically
35
- * server-side) by encrypting the allocation with `userAddress: recipient`
36
- * (the Zama input proof MUST be bound to the recipient — the contract's
37
- * `FHE.fromExternal` rejects proofs bound to any other address) and then
38
- * signing the resulting handle with {@link signClaimAuthorization}. The
39
- * recipient submits exactly that pair — the SDK does not re-encrypt.
40
- *
41
- * The signature commits to a specific `bytes32` handle via EIP-712, so
42
- * re-encrypting the same plaintext locally would produce a different handle
43
- * and the signature would no longer match. That is why `encryptedInput` is
44
- * required and there is no plaintext `amount` field on this type.
45
- */
46
- export interface ClaimArgs {
47
- /** Pre-encrypted external `euint64` input — must match the handle the admin signed. */
48
- encryptedInput: EncryptedInput;
49
- /** EIP-712 signature from an address with DEFAULT_ADMIN_ROLE on this clone. */
50
- signature: Hex;
51
- /**
52
- * ETH value (in wei) to attach as `msg.value`. Defaults to `gasFee()` fetched
53
- * live if omitted.
54
- *
55
- * Pre-fetch and cache with `await airdrop.gasFee()` when displaying the fee in
56
- * the UI before the user clicks submit — this avoids an extra RPC round-trip and
57
- * lets you present the exact cost upfront.
58
- */
59
- value?: bigint;
60
- /** Override the submitting account. Defaults to `walletClient.account`. */
61
- account?: Account | Address;
62
- }
63
- /** Args for {@link ConfidentialAirdropClient.getClaimAmount} — same shape as {@link ClaimArgs} minus `value` (the contract is not payable). */
64
- export interface GetClaimAmountArgs {
65
- /** Pre-encrypted external `euint64` input — must match the handle the admin signed. */
66
- encryptedInput: EncryptedInput;
67
- /** EIP-712 signature from an address with DEFAULT_ADMIN_ROLE on this clone. */
68
- signature: Hex;
69
- /** Override the submitting account. Defaults to `walletClient.account`. */
70
- account?: Account | Address;
71
- }
72
- /** Args for {@link ConfidentialAirdropClient.isSignatureValid}. */
73
- export interface IsSignatureValidArgs {
74
- /** `externalEuint64` handle bytes32 — the same handle the admin signed. */
75
- encryptedAmountHandle: Hex;
76
- /** EIP-712 admin signature over `Claim(address recipient, bytes32 encryptedAmount)`. */
77
- signature: Hex;
78
- /**
79
- * Address the contract will treat as `msg.sender` during the call.
80
- * The on-chain check recomputes the struct hash over `(msg.sender, encryptedAmount)`,
81
- * so the result varies per-caller — typically the wallet that intends to claim.
82
- */
83
- caller: Address;
84
- }
85
- /**
86
- * Typed wrapper around a deployed `ConfidentialAirdropCloneable` clone.
87
- *
88
- * The admin issues claims by encrypting the allocation **bound to the
89
- * recipient address** (Zama input proofs are bound to `(contractAddress,
90
- * userAddress)` — the contract's `FHE.fromExternal` will reject any other
91
- * binding) and signing the handle. The recipient calls
92
- * {@link ConfidentialAirdropClient.claim} with exactly that `{ encryptedInput,
93
- * signature }` pair; the SDK never re-encrypts on the recipient side because
94
- * the signature commits to a specific handle.
95
- *
96
- * @example
97
- * const airdrop = createConfidentialAirdropClient({
98
- * publicClient, walletClient,
99
- * address: airdropAddress,
100
- * });
101
- * await airdrop.claim({ encryptedInput, signature });
102
- */
103
- export declare class ConfidentialAirdropClient {
104
- #private;
105
- readonly publicClient: PublicClient;
106
- readonly walletClient?: WalletClient;
107
- readonly address: Address;
108
- constructor(config: ConfidentialAirdropClientConfig);
109
- /**
110
- * The FHEVM ACL contract address used by encrypted-view methods to parse
111
- * `ACL.Allowed` events. Resolved lazily on first access; throws
112
- * `DeploymentAddressUnavailableError` if no override was passed and the
113
- * SDK does not have an ACL deployed for the connected chain.
114
- */
115
- get aclAddress(): Address;
116
- /** ERC-7984 confidential token this airdrop was deployed for. Immutable arg. */
117
- token(): Promise<Address>;
118
- /** Per-claim gas fee in wei. Immutable arg. Attached as `msg.value` by `claim()` automatically. */
119
- gasFee(): Promise<bigint>;
120
- /** Unix timestamp when claims become available. Immutable arg. */
121
- startTime(): Promise<number>;
122
- /** Whether the admin can extend the claim window past `endTime`. Immutable arg. */
123
- canExtendClaimWindow(): Promise<boolean>;
124
- /** Unix timestamp when claims end. Mutable — can be extended by admin if `canExtendClaimWindow`. */
125
- endTime(): Promise<number>;
126
- /** Whether claims are currently paused by the admin. */
127
- isPaused(): Promise<boolean>;
128
- /** Block number at which this clone was deployed. */
129
- deploymentBlockNumber(): Promise<bigint>;
130
- /**
131
- * Check whether a pre-computed signature hash has been consumed.
132
- *
133
- * The contract keys claim replay-protection on
134
- * `keccak256(abi.encode(CLAIM_TYPEHASH, recipient, bytes32(encryptedAmountHandle)))`.
135
- * Use this when you already hold the struct hash (e.g. you computed it server-side
136
- * while building the claim payload). For the more common case where you hold the
137
- * user address and the encrypted handle, use {@link isSignatureClaimed} instead —
138
- * it computes the hash for you.
139
- *
140
- * @param signatureHash `bytes32` storage key — the EIP-712 struct hash of the Claim.
141
- */
142
- claimedSignatures(signatureHash: Hex): Promise<boolean>;
143
- /** `true` if within the claim time window and not paused. Free read — no gas. */
144
- isClaimWindowActive(): Promise<boolean>;
145
- /** `true` if the current timestamp is past `START_TIME`. */
146
- hasClaimStarted(): Promise<boolean>;
147
- /** `true` if the current timestamp is past `endTime`. */
148
- hasClaimEnded(): Promise<boolean>;
149
- /** EIP-712 domain separator for the clone. Useful for off-chain signing tools. */
150
- domainSeparator(): Promise<Hex>;
151
- /**
152
- * EIP-712 type hash for the `Claim(address recipient, bytes32 encryptedAmount)`
153
- * struct. Off-chain signers that don't use {@link signClaimAuthorization}
154
- * (e.g. custom HSM-backed signers, ledger flows) need this to assemble the
155
- * typed-data payload manually.
156
- */
157
- claimTypehash(): Promise<Hex>;
158
- /**
159
- * Check whether a claim has been consumed, given the user address and encrypted amount handle.
160
- *
161
- * This is the method most frontend developers want. Pass the same `user` and
162
- * `encryptedAmountHandle` that appear in the admin-issued claim payload; the contract
163
- * recomputes the struct hash internally and looks it up in storage.
164
- *
165
- * Prefer this over {@link claimedSignatures} unless you already hold the pre-computed
166
- * `bytes32` struct hash (e.g. from a server-side indexer).
167
- *
168
- * @param user Recipient address from the claim authorization.
169
- * @param encryptedAmountHandle The `externalEuint64` handle (as `Hex`) from the claim payload.
170
- */
171
- isSignatureClaimed(user: Address, encryptedAmountHandle: EncryptedHandle): Promise<boolean>;
172
- /**
173
- * Check whether an admin-issued claim authorization is valid for a specific caller,
174
- * without consuming it.
175
- *
176
- * Returns `false` (not a revert) when the signature is **structurally valid** but
177
- * fails one of the on-chain checks: already-claimed, claim window inactive, or the
178
- * signer lacks `DEFAULT_ADMIN_ROLE`. The on-chain implementation recomputes the
179
- * EIP-712 struct hash over `(msg.sender, encryptedAmount)`, so the result is
180
- * caller-specific: a signature issued for recipient A is invalid when checked
181
- * against caller B. Pass the address that will actually submit the claim.
182
- *
183
- * **Throws** {@link InvalidSignatureError} (code `TOKENOPS_INVALID_SIGNATURE`)
184
- * when the signature bytes are **structurally malformed** — wrong length, invalid
185
- * `s`-value range, or unparseable. The on-chain `ECDSA.recover` reverts before
186
- * the boolean logic runs in that case, so consumer code must catch this
187
- * separately from the `false` return:
188
- *
189
- * ```ts
190
- * try {
191
- * const ok = await airdrop.isSignatureValid({ encryptedAmountHandle, signature, caller });
192
- * if (!ok) { /* signed by non-admin, window closed, or already claimed *\/ }
193
- * } catch (err) {
194
- * if (err instanceof InvalidSignatureError) { /* malformed signature bytes *\/ }
195
- * }
196
- * ```
197
- *
198
- * Use this to show a pre-claim validation state in the UI before asking the user to
199
- * pay gas.
200
- */
201
- isSignatureValid(args: IsSignatureValidArgs): Promise<boolean>;
202
- /**
203
- * Read-only preflight for {@link claim}. Runs the deterministic-from-off-chain
204
- * checks in parallel and reports any blockers as typed {@link TokenOpsSdkError}s.
205
- * Returns `{ ready: true, blockers: [] }` when the claim is safe to submit.
206
- *
207
- * Preflight is **opt-in**. Consumers who have already validated state can
208
- * skip this call and invoke `claim` directly — they'll receive the same
209
- * typed errors at write time via the revert mapper.
210
- *
211
- * Checks performed (all read-only, no gas):
212
- * - Claim window started (`block.timestamp ≥ START_TIME`).
213
- * - Claim window not closed (`block.timestamp ≤ endTime`).
214
- * - Claims not paused.
215
- * - Signature not already redeemed by this caller.
216
- * - ETH balance covers `GAS_FEE()` (the `msg.value` the claim must attach).
217
- *
218
- * The EIP-712 admin-signature check is **not** preflight-detectable — the
219
- * SDK cannot verify the signer's role without the contract round-trip — and
220
- * will still surface as {@link InvalidSignatureError} at write time.
221
- *
222
- * Pool balance is also **not** preflight-detectable: the clone's confidential
223
- * balance is an encrypted `euint64` handle that the SDK cannot read in
224
- * plaintext. An unfunded clone will pass preflight and revert on-chain with
225
- * {@link FheHandleNotAllowedError} (the FHEVM ACL rejects `FHE.allowTransient`
226
- * on an uninitialized handle). Confirm the pool has been funded before
227
- * showing `ready: true`.
228
- *
229
- * @returns `{ ready, blockers }` — same `code` shape the write would throw.
230
- */
231
- preflightClaim(args: {
232
- caller: Address;
233
- encryptedAmountHandle: Hex;
234
- }): Promise<PreflightResult>;
235
- /**
236
- * Claim tokens using an EIP-712 admin signature. Sends `GAS_FEE()` ETH with the tx.
237
- *
238
- * The `encryptedInput` must be the exact handle the admin signed in
239
- * {@link signClaimAuthorization}. The signature commits to that handle, so the SDK
240
- * does NOT re-encrypt — submit the admin-issued payload as-is.
241
- *
242
- * **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
243
- *
244
- * **An unfunded pool is the opposite case — it reverts loudly.** Do not
245
- * generalize the silent-zero rule above to a clone whose pool was never
246
- * funded: that claim throws {@link FheHandleNotAllowedError} (the FHEVM ACL
247
- * rejects `FHE.allowTransient` on an uninitialized handle), and
248
- * {@link preflightClaim} cannot detect it because the pool balance is an
249
- * encrypted `euint64` the SDK cannot read in plaintext.
250
- *
251
- * @returns Transaction hash.
252
- * @example
253
- * const fee = await airdrop.gasFee();
254
- * const hash = await airdrop.claim({ encryptedInput, signature });
255
- */
256
- claim(args: ClaimArgs): Promise<Hex>;
257
- /**
258
- * **This is a write transaction, not a free view. It costs gas.**
259
- *
260
- * Verify the admin-signed claim allocation and grant the caller decrypt access
261
- * to the encrypted amount. Budget gas and `await` the receipt before calling
262
- * the Zama relayer's `userDecrypt` — the handle is only valid after the tx lands.
263
- *
264
- * Internally the contract calls `FHE.allow(handle, msg.sender)`, which persists
265
- * the ACL grant on-chain. The handle is extracted from the receipt's ACL `Allowed`
266
- * event — `simulateContract` would return a divergent handle and break decryption.
267
- *
268
- * Does **not** consume the claim (the `claimedSignatures` bit is not set). Call
269
- * {@link claim} when the user is ready to transfer tokens.
270
- *
271
- * @returns `{ handle, hash }` — `handle` is a `euint64` granted to the caller;
272
- * pass it to the Zama relayer's `userDecrypt` to obtain the plaintext amount.
273
- */
274
- getClaimAmount(args: GetClaimAmountArgs): Promise<EncryptedViewResult>;
275
- /**
276
- * Withdraw all confidential tokens to `recipient`. `DEFAULT_ADMIN_ROLE` only.
277
- *
278
- * Calling on a clone whose pool was **never funded** throws
279
- * {@link FheHandleNotAllowedError} (code `TOKENOPS_FHE_HANDLE_NOT_ALLOWED`).
280
- * The contract calls `FHE.allowTransient` on the confidential balance handle;
281
- * when the handle is uninitialized, the FHEVM ACL contract reverts with
282
- * `SenderNotAllowed(address)`. Confirm the pool has been funded (e.g. via the
283
- * factory's `createAndFund...` variant or a follow-up `confidentialTransfer`)
284
- * before calling.
285
- */
286
- withdraw(recipient: Address, account?: Account | Address): Promise<Hex>;
287
- /** Pause or unpause claims. DEFAULT_ADMIN_ROLE only. */
288
- setPaused(paused: boolean, account?: Account | Address): Promise<TxHash>;
289
- /**
290
- * Extend the claim window end time. DEFAULT_ADMIN_ROLE only.
291
- * Requires `CAN_EXTEND_CLAIM_WINDOW == true` or the contract reverts.
292
- */
293
- extendClaimWindow(newEndTime: number, account?: Account | Address): Promise<TxHash>;
294
- /** Rescue accidentally sent ERC20 tokens. DEFAULT_ADMIN_ROLE only. */
295
- withdrawOtherToken(tokenAddress: Address, recipient: Address, account?: Account | Address): Promise<Hex>;
296
- /** Rescue accidentally sent ERC7984 confidential tokens. DEFAULT_ADMIN_ROLE only. */
297
- withdrawOtherConfidentialToken(tokenAddress: Address, recipient: Address, account?: Account | Address): Promise<Hex>;
298
- /**
299
- * Withdraw collected ETH gas fees. FEE_COLLECTOR_ROLE only.
300
- * Pass `amount = 0n` to withdraw the entire balance.
301
- */
302
- withdrawGasFee(recipient: Address, amount: bigint, account?: Account | Address): Promise<Hex>;
303
- hasRole(role: Role, account: Address): Promise<boolean>;
304
- grantRole(role: Role, accountTarget: Address, account?: Account | Address): Promise<TxHash>;
305
- revokeRole(role: Role, accountTarget: Address, account?: Account | Address): Promise<TxHash>;
306
- }
307
- /**
308
- * Create a {@link ConfidentialAirdropClient}. Mirrors viem's `create*` convention.
309
- *
310
- * @example
311
- * const airdrop = createConfidentialAirdropClient({
312
- * publicClient, walletClient,
313
- * address: "0xYourAirdropClone",
314
- * encryptor,
315
- * });
316
- */
317
- export declare function createConfidentialAirdropClient(config: ConfidentialAirdropClientConfig): ConfidentialAirdropClient;
@@ -1,37 +0,0 @@
1
- import { type UseMutationResult } from "@tanstack/react-query";
2
- import type { EncryptedViewResult, GetClaimAmountArgs } from "../airdrop.js";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- /**
5
- * **Submits a transaction (costs gas) to grant the caller decrypt access to
6
- * the claim amount as an `euint64` handle.** The handle is granted persistent
7
- * ACL on-chain via `FHE.allow(handle, msg.sender)`; the SDK extracts it from
8
- * the receipt's `ACL.Allowed` event (NOT from simulation — that returns a
9
- * divergent, ACL-less handle; see CLAUDE.md Pitfall #1).
10
- *
11
- * Pass `data.handle` to the Zama relayer's `userDecrypt` to obtain the
12
- * plaintext amount. The handle is only valid after the tx lands.
13
- *
14
- * Does **not** consume the claim (the `claimedSignatures` bit is not set).
15
- * Call {@link useClaim} when the user is ready to transfer tokens.
16
- *
17
- * Submits the admin-issued `{ encryptedInput, signature }` pair verbatim. The
18
- * SDK does NOT re-encrypt — the signature commits to the exact handle.
19
- *
20
- * @example
21
- * // `encryptedInput` + `signature` are the admin-issued payload delivered to
22
- * // the recipient (same pair the recipient passes to `useClaim`). Sourced
23
- * // from your server API or, for admin-dashboard flows, by combining
24
- * // `encryptUint64({ userAddress: recipient, ... })` with
25
- * // `useSignClaimAuthorization`.
26
- * const view = useAccessClaimAmount({ address: airdropAddress });
27
- * view.mutate({ encryptedInput, signature });
28
- * // view.data → { handle: "0x...", hash: "0x..." }
29
- */
30
- export declare function useAccessClaimAmount(options: AirdropHookOptions): UseMutationResult<EncryptedViewResult, Error, GetClaimAmountArgs>;
31
- /**
32
- * @deprecated Renamed to {@link useAccessClaimAmount}. Both submit a transaction, and the
33
- * `useGet*` name reads as a free query — which misled bounty builders. This
34
- * is the same function object, not a wrapper: behavior, argument types and
35
- * thrown errors are identical. Removed in the next major.
36
- */
37
- export declare const useGetClaimAmount: typeof useAccessClaimAmount;
@@ -1,7 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import { type AirdropHookOptions } from "./_shared.js";
3
- /**
4
- * Read whether the admin can extend the claim window past `endTime` on this
5
- * airdrop clone. Immutable arg — set at deployment, never changes.
6
- */
7
- export declare function useAirdropCanExtendClaimWindow(options: AirdropHookOptions): UseQueryResult<boolean, Error>;
@@ -1,10 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import type { Hex } from "viem";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- /**
5
- * Read the EIP-712 type hash for `Claim(address recipient, bytes32 encryptedAmount)`.
6
- * Useful for off-chain signers that assemble the typed-data payload manually
7
- * (custom HSM-backed signers, ledger flows) instead of calling
8
- * {@link signClaimAuthorization}.
9
- */
10
- export declare function useAirdropClaimTypehash(options: AirdropHookOptions): UseQueryResult<Hex, Error>;
@@ -1,16 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import type { Hex } from "viem";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- export interface UseAirdropClaimedSignaturesArgs extends AirdropHookOptions {
5
- /** EIP-712 struct hash of a `Claim`. Hook is disabled until set. */
6
- signatureHash?: Hex;
7
- }
8
- /**
9
- * Check whether a pre-computed claim struct hash has been consumed on this
10
- * airdrop clone.
11
- *
12
- * Prefer {@link useAirdropIsSignatureClaimed} unless you already hold the
13
- * pre-computed `bytes32` struct hash — that hook takes the more common
14
- * `(user, encryptedAmountHandle)` shape and computes the hash for you.
15
- */
16
- export declare function useAirdropClaimedSignatures(args: UseAirdropClaimedSignaturesArgs): UseQueryResult<boolean, Error>;
@@ -1,6 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import { type AirdropHookOptions } from "./_shared.js";
3
- /**
4
- * Read the block number at which this airdrop clone was deployed.
5
- */
6
- export declare function useAirdropDeploymentBlockNumber(options: AirdropHookOptions): UseQueryResult<bigint, Error>;
@@ -1,8 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import type { Hex } from "viem";
3
- import { type AirdropHookOptions } from "./_shared.js";
4
- /**
5
- * Read the EIP-712 domain separator for this airdrop clone. Useful for
6
- * off-chain signing tools that build claim authorizations server-side.
7
- */
8
- export declare function useAirdropDomainSeparator(options: AirdropHookOptions): UseQueryResult<Hex, Error>;
@@ -1,10 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import { type AirdropHookOptions } from "./_shared.js";
3
- /**
4
- * Read the airdrop clone's `endTime` — the unix timestamp when claims close.
5
- * Mutable: the admin can extend it via `useExtendClaimWindow` when
6
- * `canExtendClaimWindow()` is `true`.
7
- *
8
- * After a successful `useExtendClaimWindow`, invalidate this query.
9
- */
10
- export declare function useAirdropEndTime(options: AirdropHookOptions): UseQueryResult<number, Error>;
@@ -1,17 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import type { Address } from "viem";
3
- import { type CustomFee } from "../types.js";
4
- import { type BaseHookOptions } from "./_shared.js";
5
- export interface UseAirdropFactoryCustomFeeArgs extends BaseHookOptions {
6
- /** Address whose per-creator fee override to read. Hook is disabled until set. */
7
- creator?: Address;
8
- }
9
- /**
10
- * Read the per-creator fee override set on the factory for `creator`. Returns
11
- * `{ enabled: false, gasFee: 0n }` when no override exists.
12
- *
13
- * @example
14
- * const { data: customFee } = useAirdropFactoryCustomFee({ creator });
15
- * if (customFee?.enabled) { ... use customFee.gasFee ... }
16
- */
17
- export declare function useAirdropFactoryCustomFee(args?: UseAirdropFactoryCustomFeeArgs): UseQueryResult<CustomFee, Error>;
@@ -1,10 +0,0 @@
1
- import { type UseQueryResult } from "@tanstack/react-query";
2
- import { type BaseHookOptions } from "./_shared.js";
3
- /**
4
- * Read the factory-wide default per-claim gas fee (in wei) — applied to new
5
- * airdrop clones at deployment when the creator has no custom override.
6
- *
7
- * @example
8
- * const { data: defaultGasFee } = useAirdropFactoryDefaultGasFee();
9
- */
10
- export declare function useAirdropFactoryDefaultGasFee(options?: BaseHookOptions): UseQueryResult<bigint, Error>;