@tokenops/sdk 1.0.0

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 (371) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/CONTRIBUTING.md +113 -0
  3. package/LICENSE +32 -0
  4. package/README.md +677 -0
  5. package/SECURITY.md +59 -0
  6. package/dist/chunk-52TC6BF7.js +2755 -0
  7. package/dist/chunk-56UI7LUR.cjs +516 -0
  8. package/dist/chunk-5SA2HF2W.cjs +1635 -0
  9. package/dist/chunk-5SGMJADP.cjs +139 -0
  10. package/dist/chunk-62DF53UQ.cjs +749 -0
  11. package/dist/chunk-66IHPTOK.cjs +20 -0
  12. package/dist/chunk-6ECAHP5O.cjs +1496 -0
  13. package/dist/chunk-72YGZEQE.js +742 -0
  14. package/dist/chunk-7VELUOMI.js +35 -0
  15. package/dist/chunk-BE2AIZ3K.js +23 -0
  16. package/dist/chunk-CMRETRZO.js +46 -0
  17. package/dist/chunk-COPFW5Z4.js +82 -0
  18. package/dist/chunk-CQIPRNS7.cjs +25 -0
  19. package/dist/chunk-ECT3NL2L.js +124 -0
  20. package/dist/chunk-FWHYQZ5E.cjs +37 -0
  21. package/dist/chunk-FYQ2UW4T.js +37 -0
  22. package/dist/chunk-HGXNRR25.js +105 -0
  23. package/dist/chunk-HTOMTEA3.cjs +3406 -0
  24. package/dist/chunk-ITQ7WKVC.cjs +101 -0
  25. package/dist/chunk-IVE3QEGD.js +478 -0
  26. package/dist/chunk-JFLEEXKP.js +325 -0
  27. package/dist/chunk-JFR5J4FL.cjs +128 -0
  28. package/dist/chunk-K6MFFDBJ.cjs +109 -0
  29. package/dist/chunk-KWFFIJYX.js +11 -0
  30. package/dist/chunk-NS44KBV5.cjs +89 -0
  31. package/dist/chunk-OLDGMKW2.cjs +93 -0
  32. package/dist/chunk-Q2GP5UDC.js +29 -0
  33. package/dist/chunk-Q7ARQSUH.cjs +42 -0
  34. package/dist/chunk-QCA7O2Q5.cjs +49 -0
  35. package/dist/chunk-QIHZVLIK.js +3388 -0
  36. package/dist/chunk-SUOG3BQS.cjs +2772 -0
  37. package/dist/chunk-T5LVV3KY.cjs +44 -0
  38. package/dist/chunk-UOG4PJL5.js +1488 -0
  39. package/dist/chunk-VDXVNZCO.cjs +329 -0
  40. package/dist/chunk-VJKZWYYJ.cjs +32 -0
  41. package/dist/chunk-WRCUDSUJ.js +96 -0
  42. package/dist/chunk-XSNLAS5M.js +135 -0
  43. package/dist/chunk-XXXDQSHE.js +1628 -0
  44. package/dist/chunk-ZHFLRKFY.js +41 -0
  45. package/dist/chunk-ZXCOJY2Z.js +87 -0
  46. package/dist/core/addresses.d.ts +59 -0
  47. package/dist/core/brands.d.ts +87 -0
  48. package/dist/core/chains.d.ts +102 -0
  49. package/dist/core/errors.d.ts +687 -0
  50. package/dist/core/index.d.ts +7 -0
  51. package/dist/core/normalise.d.ts +27 -0
  52. package/dist/core/preflight.d.ts +25 -0
  53. package/dist/core/revert-mapper.d.ts +74 -0
  54. package/dist/core/telemetry.d.ts +50 -0
  55. package/dist/core/types.d.ts +10 -0
  56. package/dist/core/version.d.ts +15 -0
  57. package/dist/core/zama-error-mapper.d.ts +27 -0
  58. package/dist/fhe/acl.d.ts +73 -0
  59. package/dist/fhe/erc7984-abi.d.ts +53 -0
  60. package/dist/fhe/index.cjs +599 -0
  61. package/dist/fhe/index.d.cts +11 -0
  62. package/dist/fhe/index.d.ts +11 -0
  63. package/dist/fhe/index.js +394 -0
  64. package/dist/fhe/mock-encryptor.d.ts +90 -0
  65. package/dist/fhe/mock-erc7984.d.ts +134 -0
  66. package/dist/fhe/operators.d.ts +190 -0
  67. package/dist/fhe/react/index.cjs +102 -0
  68. package/dist/fhe/react/index.d.cts +10 -0
  69. package/dist/fhe/react/index.d.ts +10 -0
  70. package/dist/fhe/react/index.js +85 -0
  71. package/dist/fhe/react/use-decrypted-handle.d.ts +102 -0
  72. package/dist/fhe/scale-ratio.d.ts +168 -0
  73. package/dist/fhe/sepolia-encryptor-web.d.ts +101 -0
  74. package/dist/fhe/sepolia-encryptor.d.ts +132 -0
  75. package/dist/fhe/types.d.ts +62 -0
  76. package/dist/fhe-airdrop/abis/cloneable.d.ts +781 -0
  77. package/dist/fhe-airdrop/abis/factory.d.ts +714 -0
  78. package/dist/fhe-airdrop/abis/index.d.ts +2 -0
  79. package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +53 -0
  80. package/dist/fhe-airdrop/advanced/index.cjs +21 -0
  81. package/dist/fhe-airdrop/advanced/index.d.cts +13 -0
  82. package/dist/fhe-airdrop/advanced/index.d.ts +13 -0
  83. package/dist/fhe-airdrop/advanced/index.js +8 -0
  84. package/dist/fhe-airdrop/advanced/react/index.cjs +61 -0
  85. package/dist/fhe-airdrop/advanced/react/index.d.cts +5 -0
  86. package/dist/fhe-airdrop/advanced/react/index.d.ts +5 -0
  87. package/dist/fhe-airdrop/advanced/react/index.js +59 -0
  88. package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +49 -0
  89. package/dist/fhe-airdrop/airdrop.d.ts +308 -0
  90. package/dist/fhe-airdrop/encryption.d.ts +109 -0
  91. package/dist/fhe-airdrop/errors.d.ts +60 -0
  92. package/dist/fhe-airdrop/factory.d.ts +281 -0
  93. package/dist/fhe-airdrop/index.cjs +227 -0
  94. package/dist/fhe-airdrop/index.d.cts +10 -0
  95. package/dist/fhe-airdrop/index.d.ts +10 -0
  96. package/dist/fhe-airdrop/index.js +10 -0
  97. package/dist/fhe-airdrop/react/_shared.d.ts +107 -0
  98. package/dist/fhe-airdrop/react/index.cjs +638 -0
  99. package/dist/fhe-airdrop/react/index.d.cts +90 -0
  100. package/dist/fhe-airdrop/react/index.d.ts +90 -0
  101. package/dist/fhe-airdrop/react/index.js +430 -0
  102. package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +31 -0
  103. package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +7 -0
  104. package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +25 -0
  105. package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +10 -0
  106. package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +16 -0
  107. package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +6 -0
  108. package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +8 -0
  109. package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +10 -0
  110. package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +17 -0
  111. package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +10 -0
  112. package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +15 -0
  113. package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +11 -0
  114. package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +17 -0
  115. package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +17 -0
  116. package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +16 -0
  117. package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +15 -0
  118. package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +11 -0
  119. package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +16 -0
  120. package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +7 -0
  121. package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +7 -0
  122. package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +14 -0
  123. package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +9 -0
  124. package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +8 -0
  125. package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +22 -0
  126. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +50 -0
  127. package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +15 -0
  128. package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +10 -0
  129. package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -0
  130. package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +15 -0
  131. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +14 -0
  132. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +14 -0
  133. package/dist/fhe-airdrop/react/useClaim.d.ts +29 -0
  134. package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +11 -0
  135. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +33 -0
  136. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +40 -0
  137. package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +29 -0
  138. package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +31 -0
  139. package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +14 -0
  140. package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +16 -0
  141. package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +17 -0
  142. package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +10 -0
  143. package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +11 -0
  144. package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +17 -0
  145. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +25 -0
  146. package/dist/fhe-airdrop/react/useGetClaimAmount.d.ts +30 -0
  147. package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +16 -0
  148. package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +15 -0
  149. package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +14 -0
  150. package/dist/fhe-airdrop/react/useSetPaused.d.ts +14 -0
  151. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +31 -0
  152. package/dist/fhe-airdrop/react/useWithdraw.d.ts +12 -0
  153. package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +13 -0
  154. package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +13 -0
  155. package/dist/fhe-airdrop/types.d.ts +21 -0
  156. package/dist/fhe-disperse/abis/index.d.ts +2 -0
  157. package/dist/fhe-disperse/abis/singleton.d.ts +1297 -0
  158. package/dist/fhe-disperse/abis/wallet.d.ts +111 -0
  159. package/dist/fhe-disperse/encryption.d.ts +77 -0
  160. package/dist/fhe-disperse/errors.d.ts +39 -0
  161. package/dist/fhe-disperse/index.cjs +248 -0
  162. package/dist/fhe-disperse/index.d.cts +14 -0
  163. package/dist/fhe-disperse/index.d.ts +14 -0
  164. package/dist/fhe-disperse/index.js +11 -0
  165. package/dist/fhe-disperse/react/_shared.d.ts +104 -0
  166. package/dist/fhe-disperse/react/index.cjs +752 -0
  167. package/dist/fhe-disperse/react/index.d.cts +82 -0
  168. package/dist/fhe-disperse/react/index.d.ts +82 -0
  169. package/dist/fhe-disperse/react/index.js +522 -0
  170. package/dist/fhe-disperse/react/useAccessEncryptedFeeReserve.d.ts +35 -0
  171. package/dist/fhe-disperse/react/useApproveTokenOnWallets.d.ts +25 -0
  172. package/dist/fhe-disperse/react/useBatchDiscloseHandlesToParty.d.ts +16 -0
  173. package/dist/fhe-disperse/react/useCalculateFee.d.ts +26 -0
  174. package/dist/fhe-disperse/react/useDeploymentBlockNumber.d.ts +11 -0
  175. package/dist/fhe-disperse/react/useDisableCustomFee.d.ts +20 -0
  176. package/dist/fhe-disperse/react/useDiscloseHandleToParty.d.ts +20 -0
  177. package/dist/fhe-disperse/react/useDisperse.d.ts +28 -0
  178. package/dist/fhe-disperse/react/useGetBatchLimits.d.ts +12 -0
  179. package/dist/fhe-disperse/react/useGetFeeConfig.d.ts +15 -0
  180. package/dist/fhe-disperse/react/useGetFees.d.ts +19 -0
  181. package/dist/fhe-disperse/react/useGetWallets.d.ts +19 -0
  182. package/dist/fhe-disperse/react/useGrantRole.d.ts +24 -0
  183. package/dist/fhe-disperse/react/useHasApprovedSubwallets.d.ts +25 -0
  184. package/dist/fhe-disperse/react/useHasRole.d.ts +22 -0
  185. package/dist/fhe-disperse/react/useIsPaused.d.ts +11 -0
  186. package/dist/fhe-disperse/react/useIsRegistered.d.ts +15 -0
  187. package/dist/fhe-disperse/react/usePause.d.ts +18 -0
  188. package/dist/fhe-disperse/react/usePredictWallets.d.ts +19 -0
  189. package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +37 -0
  190. package/dist/fhe-disperse/react/useRecoverERC20FromWallets.d.ts +21 -0
  191. package/dist/fhe-disperse/react/useRecoverFromWallets.d.ts +21 -0
  192. package/dist/fhe-disperse/react/useRegister.d.ts +40 -0
  193. package/dist/fhe-disperse/react/useRescueConfidentialTokens.d.ts +21 -0
  194. package/dist/fhe-disperse/react/useRescueERC20.d.ts +21 -0
  195. package/dist/fhe-disperse/react/useRevokeRole.d.ts +24 -0
  196. package/dist/fhe-disperse/react/useRevokeTokenOnWallets.d.ts +24 -0
  197. package/dist/fhe-disperse/react/useSetCustomFee.d.ts +24 -0
  198. package/dist/fhe-disperse/react/useSetFeeConfig.d.ts +23 -0
  199. package/dist/fhe-disperse/react/useSetMaxBatchSizeDirect.d.ts +20 -0
  200. package/dist/fhe-disperse/react/useSetMaxBatchSizeHolding.d.ts +20 -0
  201. package/dist/fhe-disperse/react/useSetMaxBatchSizeTokenFee.d.ts +20 -0
  202. package/dist/fhe-disperse/react/useSingletonBatchDiscloseHandlesToParty.d.ts +13 -0
  203. package/dist/fhe-disperse/react/useSingletonBatchLimits.d.ts +12 -0
  204. package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +26 -0
  205. package/dist/fhe-disperse/react/useSingletonDeploymentBlockNumber.d.ts +11 -0
  206. package/dist/fhe-disperse/react/useSingletonDisableCustomFee.d.ts +21 -0
  207. package/dist/fhe-disperse/react/useSingletonDiscloseHandleToParty.d.ts +17 -0
  208. package/dist/fhe-disperse/react/useSingletonFees.d.ts +19 -0
  209. package/dist/fhe-disperse/react/useSingletonGrantRole.d.ts +26 -0
  210. package/dist/fhe-disperse/react/useSingletonHasApprovedSubwallets.d.ts +25 -0
  211. package/dist/fhe-disperse/react/useSingletonHasRole.d.ts +23 -0
  212. package/dist/fhe-disperse/react/useSingletonIsPaused.d.ts +11 -0
  213. package/dist/fhe-disperse/react/useSingletonIsRegistered.d.ts +15 -0
  214. package/dist/fhe-disperse/react/useSingletonPause.d.ts +19 -0
  215. package/dist/fhe-disperse/react/useSingletonPredictWallets.d.ts +19 -0
  216. package/dist/fhe-disperse/react/useSingletonRevokeRole.d.ts +26 -0
  217. package/dist/fhe-disperse/react/useSingletonSetCustomFee.d.ts +25 -0
  218. package/dist/fhe-disperse/react/useSingletonUnpause.d.ts +18 -0
  219. package/dist/fhe-disperse/react/useSingletonWalletImplementation.d.ts +12 -0
  220. package/dist/fhe-disperse/react/useSingletonWallets.d.ts +19 -0
  221. package/dist/fhe-disperse/react/useSingletonWithdrawGasFee.d.ts +21 -0
  222. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +50 -0
  223. package/dist/fhe-disperse/react/useUnpause.d.ts +17 -0
  224. package/dist/fhe-disperse/react/useWalletImplementation.d.ts +12 -0
  225. package/dist/fhe-disperse/react/useWithdrawGasFee.d.ts +26 -0
  226. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +70 -0
  227. package/dist/fhe-disperse/singleton.d.ts +442 -0
  228. package/dist/fhe-disperse/subtotals.d.ts +14 -0
  229. package/dist/fhe-disperse/types.d.ts +332 -0
  230. package/dist/fhe-disperse/validate.d.ts +78 -0
  231. package/dist/fhe-vesting/abis/factory.d.ts +676 -0
  232. package/dist/fhe-vesting/abis/index.d.ts +3 -0
  233. package/dist/fhe-vesting/abis/manager.d.ts +1797 -0
  234. package/dist/fhe-vesting/advanced/factory-advanced.d.ts +52 -0
  235. package/dist/fhe-vesting/advanced/index.cjs +21 -0
  236. package/dist/fhe-vesting/advanced/index.d.cts +12 -0
  237. package/dist/fhe-vesting/advanced/index.d.ts +12 -0
  238. package/dist/fhe-vesting/advanced/index.js +8 -0
  239. package/dist/fhe-vesting/advanced/react/index.cjs +75 -0
  240. package/dist/fhe-vesting/advanced/react/index.d.cts +5 -0
  241. package/dist/fhe-vesting/advanced/react/index.d.ts +5 -0
  242. package/dist/fhe-vesting/advanced/react/index.js +73 -0
  243. package/dist/fhe-vesting/advanced/react/usePredictManagerAddress.d.ts +41 -0
  244. package/dist/fhe-vesting/encryption.d.ts +104 -0
  245. package/dist/fhe-vesting/errors.d.ts +183 -0
  246. package/dist/fhe-vesting/factory.d.ts +207 -0
  247. package/dist/fhe-vesting/index.cjs +269 -0
  248. package/dist/fhe-vesting/index.d.cts +9 -0
  249. package/dist/fhe-vesting/index.d.ts +9 -0
  250. package/dist/fhe-vesting/index.js +12 -0
  251. package/dist/fhe-vesting/manager.d.ts +808 -0
  252. package/dist/fhe-vesting/react/_shared.d.ts +122 -0
  253. package/dist/fhe-vesting/react/index.cjs +1054 -0
  254. package/dist/fhe-vesting/react/index.d.cts +123 -0
  255. package/dist/fhe-vesting/react/index.d.ts +123 -0
  256. package/dist/fhe-vesting/react/index.js +771 -0
  257. package/dist/fhe-vesting/react/useAcceptVestingTransfer.d.ts +12 -0
  258. package/dist/fhe-vesting/react/useAccessClaimableAmount.d.ts +14 -0
  259. package/dist/fhe-vesting/react/useAccessSettledAmount.d.ts +15 -0
  260. package/dist/fhe-vesting/react/useAccessTotalAllocation.d.ts +14 -0
  261. package/dist/fhe-vesting/react/useAccessVestedAmount.d.ts +26 -0
  262. package/dist/fhe-vesting/react/useAdminBatchDiscloseToParty.d.ts +16 -0
  263. package/dist/fhe-vesting/react/useAdminClaim.d.ts +9 -0
  264. package/dist/fhe-vesting/react/useAdminDiscloseToParty.d.ts +8 -0
  265. package/dist/fhe-vesting/react/useAdminGetClaimableAmount.d.ts +13 -0
  266. package/dist/fhe-vesting/react/useAdminGetSettledAmount.d.ts +13 -0
  267. package/dist/fhe-vesting/react/useAdminGetTokenBalance.d.ts +13 -0
  268. package/dist/fhe-vesting/react/useAdminGetTotalAllocation.d.ts +13 -0
  269. package/dist/fhe-vesting/react/useAdminGetVestedAmount.d.ts +15 -0
  270. package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +8 -0
  271. package/dist/fhe-vesting/react/useAllRecipients.d.ts +8 -0
  272. package/dist/fhe-vesting/react/useAllRecipientsLength.d.ts +6 -0
  273. package/dist/fhe-vesting/react/useAllRecipientsSliced.d.ts +13 -0
  274. package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +24 -0
  275. package/dist/fhe-vesting/react/useBatchDiscloseHandlesToParty.d.ts +13 -0
  276. package/dist/fhe-vesting/react/useBatchDiscloseToParty.d.ts +18 -0
  277. package/dist/fhe-vesting/react/useBatchRevokeVesting.d.ts +12 -0
  278. package/dist/fhe-vesting/react/useCancelVestingTransfer.d.ts +12 -0
  279. package/dist/fhe-vesting/react/useClaim.d.ts +19 -0
  280. package/dist/fhe-vesting/react/useConfidentialVestingFactoryImplementation.d.ts +11 -0
  281. package/dist/fhe-vesting/react/useCreateManager.d.ts +32 -0
  282. package/dist/fhe-vesting/react/useCreateManagerAndGetAddress.d.ts +31 -0
  283. package/dist/fhe-vesting/react/useCreateVesting.d.ts +38 -0
  284. package/dist/fhe-vesting/react/useDirectVestingTransfer.d.ts +13 -0
  285. package/dist/fhe-vesting/react/useDisableCustomFee.d.ts +14 -0
  286. package/dist/fhe-vesting/react/useDiscloseHandleToParty.d.ts +14 -0
  287. package/dist/fhe-vesting/react/useDiscloseToParty.d.ts +14 -0
  288. package/dist/fhe-vesting/react/useFactoryCustomFee.d.ts +17 -0
  289. package/dist/fhe-vesting/react/useFactoryDefaultFeeType.d.ts +11 -0
  290. package/dist/fhe-vesting/react/useFactoryDefaultGasFee.d.ts +10 -0
  291. package/dist/fhe-vesting/react/useFactoryDefaultTokenFee.d.ts +10 -0
  292. package/dist/fhe-vesting/react/useFactoryFeeCollector.d.ts +10 -0
  293. package/dist/fhe-vesting/react/useFactoryInitCodeHash.d.ts +18 -0
  294. package/dist/fhe-vesting/react/useGetClaimableAmount.d.ts +13 -0
  295. package/dist/fhe-vesting/react/useGetSettledAmount.d.ts +14 -0
  296. package/dist/fhe-vesting/react/useGetTotalAllocation.d.ts +13 -0
  297. package/dist/fhe-vesting/react/useGetVestedAmount.d.ts +25 -0
  298. package/dist/fhe-vesting/react/useGrantRole.d.ts +15 -0
  299. package/dist/fhe-vesting/react/useHasRole.d.ts +14 -0
  300. package/dist/fhe-vesting/react/useInitiateVestingTransfer.d.ts +12 -0
  301. package/dist/fhe-vesting/react/useIsRecipient.d.ts +10 -0
  302. package/dist/fhe-vesting/react/useManagerBatchDiscloseHandlesToParty.d.ts +15 -0
  303. package/dist/fhe-vesting/react/useManagerDeploymentBlockNumber.d.ts +7 -0
  304. package/dist/fhe-vesting/react/useManagerDiscloseHandleToParty.d.ts +16 -0
  305. package/dist/fhe-vesting/react/useManagerFactoryCustomFee.d.ts +17 -0
  306. package/dist/fhe-vesting/react/useManagerFactoryDefaultGasFee.d.ts +10 -0
  307. package/dist/fhe-vesting/react/useManagerFactoryDisableCustomFee.d.ts +15 -0
  308. package/dist/fhe-vesting/react/useManagerFactoryFeeCollector.d.ts +10 -0
  309. package/dist/fhe-vesting/react/useManagerFactoryInitCodeHash.d.ts +18 -0
  310. package/dist/fhe-vesting/react/useManagerFactorySetCustomFee.d.ts +19 -0
  311. package/dist/fhe-vesting/react/useManagerFactorySetDefaultGasFee.d.ts +13 -0
  312. package/dist/fhe-vesting/react/useManagerFactorySetFeeCollector.d.ts +14 -0
  313. package/dist/fhe-vesting/react/useManagerFee.d.ts +7 -0
  314. package/dist/fhe-vesting/react/useManagerFeeInfo.d.ts +18 -0
  315. package/dist/fhe-vesting/react/useManagerFeeType.d.ts +7 -0
  316. package/dist/fhe-vesting/react/useManagerGrantRole.d.ts +17 -0
  317. package/dist/fhe-vesting/react/useManagerHasRole.d.ts +15 -0
  318. package/dist/fhe-vesting/react/useManagerIsPausable.d.ts +6 -0
  319. package/dist/fhe-vesting/react/useManagerIsSplitEnabled.d.ts +6 -0
  320. package/dist/fhe-vesting/react/useManagerMaxBatchSize.d.ts +6 -0
  321. package/dist/fhe-vesting/react/useManagerMaxRevokeBatchSize.d.ts +6 -0
  322. package/dist/fhe-vesting/react/useManagerPause.d.ts +13 -0
  323. package/dist/fhe-vesting/react/useManagerPaused.d.ts +6 -0
  324. package/dist/fhe-vesting/react/useManagerRevokeRole.d.ts +17 -0
  325. package/dist/fhe-vesting/react/useManagerToken.d.ts +11 -0
  326. package/dist/fhe-vesting/react/useManagerUnpause.d.ts +12 -0
  327. package/dist/fhe-vesting/react/useManagerWithdrawGasFee.d.ts +14 -0
  328. package/dist/fhe-vesting/react/useManagerWithdrawOtherConfidentialToken.d.ts +14 -0
  329. package/dist/fhe-vesting/react/useManagerWithdrawOtherToken.d.ts +14 -0
  330. package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +11 -0
  331. package/dist/fhe-vesting/react/usePartialClaim.d.ts +15 -0
  332. package/dist/fhe-vesting/react/usePause.d.ts +12 -0
  333. package/dist/fhe-vesting/react/usePendingVestingTransfer.d.ts +20 -0
  334. package/dist/fhe-vesting/react/useRecipientVestings.d.ts +11 -0
  335. package/dist/fhe-vesting/react/useRecipientVestingsLength.d.ts +10 -0
  336. package/dist/fhe-vesting/react/useRecipientVestingsSliced.d.ts +12 -0
  337. package/dist/fhe-vesting/react/useRenounceRole.d.ts +16 -0
  338. package/dist/fhe-vesting/react/useResetGasFee.d.ts +10 -0
  339. package/dist/fhe-vesting/react/useResetTokenFee.d.ts +10 -0
  340. package/dist/fhe-vesting/react/useRevokeRole.d.ts +15 -0
  341. package/dist/fhe-vesting/react/useRevokeVesting.d.ts +15 -0
  342. package/dist/fhe-vesting/react/useRoleConstants.d.ts +19 -0
  343. package/dist/fhe-vesting/react/useSetCustomFee.d.ts +18 -0
  344. package/dist/fhe-vesting/react/useSetDefaultFeeType.d.ts +14 -0
  345. package/dist/fhe-vesting/react/useSetDefaultGasFee.d.ts +12 -0
  346. package/dist/fhe-vesting/react/useSetDefaultTokenFee.d.ts +13 -0
  347. package/dist/fhe-vesting/react/useSetFeeCollector.d.ts +13 -0
  348. package/dist/fhe-vesting/react/useSetMaxBatchSize.d.ts +12 -0
  349. package/dist/fhe-vesting/react/useSetMaxRevokeBatchSize.d.ts +12 -0
  350. package/dist/fhe-vesting/react/useSplitVesting.d.ts +28 -0
  351. package/dist/fhe-vesting/react/useTransferFeeCollectorRole.d.ts +12 -0
  352. package/dist/fhe-vesting/react/useUnpause.d.ts +11 -0
  353. package/dist/fhe-vesting/react/useVestingClaim.d.ts +19 -0
  354. package/dist/fhe-vesting/react/useVestingInfo.d.ts +25 -0
  355. package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +17 -0
  356. package/dist/fhe-vesting/react/useWithdrawGasFee.d.ts +13 -0
  357. package/dist/fhe-vesting/react/useWithdrawOtherConfidentialToken.d.ts +13 -0
  358. package/dist/fhe-vesting/react/useWithdrawOtherToken.d.ts +13 -0
  359. package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +18 -0
  360. package/dist/fhe-vesting/types.d.ts +72 -0
  361. package/dist/index.cjs +237 -0
  362. package/dist/index.d.cts +3 -0
  363. package/dist/index.d.ts +3 -0
  364. package/dist/index.js +14 -0
  365. package/dist/telemetry/console.d.ts +29 -0
  366. package/dist/telemetry/index.cjs +113 -0
  367. package/dist/telemetry/index.d.cts +3 -0
  368. package/dist/telemetry/index.d.ts +3 -0
  369. package/dist/telemetry/index.js +102 -0
  370. package/dist/telemetry/tokenops.d.ts +15 -0
  371. package/package.json +316 -0
@@ -0,0 +1,1488 @@
1
+ import { SDK_VERSION, mapContractRevert, isContractRevert } from './chunk-JFLEEXKP.js';
2
+ import { getFheAirdropFactoryAddress } from './chunk-COPFW5Z4.js';
3
+ import { normaliseAddress } from './chunk-BE2AIZ3K.js';
4
+ import { withTelemetry } from './chunk-Q2GP5UDC.js';
5
+ import { asExternalInputProof, asEncryptedHandle, asSignature, asTxHash } from './chunk-KWFFIJYX.js';
6
+ import { InvalidArgumentError, TokenOpsSdkError, MissingAccountError, DeploymentAddressUnavailableError, MissingWalletClientError, MissingEncryptorError } from './chunk-IVE3QEGD.js';
7
+ import { bytesToHex, parseEventLogs } from 'viem';
8
+
9
+ // src/fhe-airdrop/abis/factory.ts
10
+ var confidentialAirdropFactoryAbi = [
11
+ {
12
+ inputs: [
13
+ {
14
+ internalType: "address",
15
+ name: "implementation_",
16
+ type: "address"
17
+ },
18
+ {
19
+ internalType: "address",
20
+ name: "feeCollector_",
21
+ type: "address"
22
+ },
23
+ {
24
+ internalType: "uint256",
25
+ name: "defaultGasFee_",
26
+ type: "uint256"
27
+ },
28
+ {
29
+ internalType: "address",
30
+ name: "admin",
31
+ type: "address"
32
+ }
33
+ ],
34
+ stateMutability: "nonpayable",
35
+ type: "constructor"
36
+ },
37
+ {
38
+ inputs: [],
39
+ name: "AccessControlBadConfirmation",
40
+ type: "error"
41
+ },
42
+ {
43
+ inputs: [
44
+ {
45
+ internalType: "address",
46
+ name: "account",
47
+ type: "address"
48
+ },
49
+ {
50
+ internalType: "bytes32",
51
+ name: "neededRole",
52
+ type: "bytes32"
53
+ }
54
+ ],
55
+ name: "AccessControlUnauthorizedAccount",
56
+ type: "error"
57
+ },
58
+ {
59
+ inputs: [],
60
+ name: "EndTimeInPast",
61
+ type: "error"
62
+ },
63
+ {
64
+ inputs: [],
65
+ name: "InvalidAddress",
66
+ type: "error"
67
+ },
68
+ {
69
+ inputs: [],
70
+ name: "InvalidDuration",
71
+ type: "error"
72
+ },
73
+ {
74
+ inputs: [],
75
+ name: "InvalidStartTime",
76
+ type: "error"
77
+ },
78
+ {
79
+ inputs: [
80
+ {
81
+ internalType: "bytes32",
82
+ name: "handle",
83
+ type: "bytes32"
84
+ },
85
+ {
86
+ internalType: "address",
87
+ name: "sender",
88
+ type: "address"
89
+ }
90
+ ],
91
+ name: "SenderNotAllowedToUseHandle",
92
+ type: "error"
93
+ },
94
+ {
95
+ inputs: [
96
+ {
97
+ internalType: "address",
98
+ name: "sender",
99
+ type: "address"
100
+ }
101
+ ],
102
+ name: "SenderNotAllowed",
103
+ type: "error"
104
+ },
105
+ {
106
+ inputs: [],
107
+ name: "ZamaProtocolUnsupported",
108
+ type: "error"
109
+ },
110
+ {
111
+ anonymous: false,
112
+ inputs: [
113
+ {
114
+ indexed: true,
115
+ internalType: "address",
116
+ name: "airdrop",
117
+ type: "address"
118
+ },
119
+ {
120
+ indexed: true,
121
+ internalType: "address",
122
+ name: "token",
123
+ type: "address"
124
+ },
125
+ {
126
+ indexed: true,
127
+ internalType: "address",
128
+ name: "admin",
129
+ type: "address"
130
+ },
131
+ {
132
+ indexed: false,
133
+ internalType: "address",
134
+ name: "feeCollector",
135
+ type: "address"
136
+ },
137
+ {
138
+ indexed: false,
139
+ internalType: "uint256",
140
+ name: "gasFee",
141
+ type: "uint256"
142
+ },
143
+ {
144
+ indexed: false,
145
+ internalType: "uint32",
146
+ name: "startTime",
147
+ type: "uint32"
148
+ },
149
+ {
150
+ indexed: false,
151
+ internalType: "uint32",
152
+ name: "endTime",
153
+ type: "uint32"
154
+ },
155
+ {
156
+ indexed: false,
157
+ internalType: "bool",
158
+ name: "canExtendClaimWindow",
159
+ type: "bool"
160
+ },
161
+ {
162
+ indexed: false,
163
+ internalType: "address",
164
+ name: "creator",
165
+ type: "address"
166
+ },
167
+ {
168
+ indexed: false,
169
+ internalType: "bytes32",
170
+ name: "userSalt",
171
+ type: "bytes32"
172
+ }
173
+ ],
174
+ name: "ConfidentialAirdropCreated",
175
+ type: "event"
176
+ },
177
+ {
178
+ anonymous: false,
179
+ inputs: [
180
+ {
181
+ indexed: true,
182
+ internalType: "address",
183
+ name: "airdrop",
184
+ type: "address"
185
+ },
186
+ {
187
+ indexed: true,
188
+ internalType: "address",
189
+ name: "token",
190
+ type: "address"
191
+ },
192
+ {
193
+ indexed: false,
194
+ internalType: "euint64",
195
+ name: "transferredAmount",
196
+ type: "bytes32"
197
+ }
198
+ ],
199
+ name: "ConfidentialAirdropFunded",
200
+ type: "event"
201
+ },
202
+ {
203
+ anonymous: false,
204
+ inputs: [
205
+ {
206
+ indexed: true,
207
+ internalType: "address",
208
+ name: "admin",
209
+ type: "address"
210
+ },
211
+ {
212
+ indexed: true,
213
+ internalType: "address",
214
+ name: "newFeeCollector",
215
+ type: "address"
216
+ }
217
+ ],
218
+ name: "FeeCollectorSet",
219
+ type: "event"
220
+ },
221
+ {
222
+ anonymous: false,
223
+ inputs: [
224
+ {
225
+ indexed: true,
226
+ internalType: "bytes32",
227
+ name: "role",
228
+ type: "bytes32"
229
+ },
230
+ {
231
+ indexed: true,
232
+ internalType: "bytes32",
233
+ name: "previousAdminRole",
234
+ type: "bytes32"
235
+ },
236
+ {
237
+ indexed: true,
238
+ internalType: "bytes32",
239
+ name: "newAdminRole",
240
+ type: "bytes32"
241
+ }
242
+ ],
243
+ name: "RoleAdminChanged",
244
+ type: "event"
245
+ },
246
+ {
247
+ anonymous: false,
248
+ inputs: [
249
+ {
250
+ indexed: true,
251
+ internalType: "bytes32",
252
+ name: "role",
253
+ type: "bytes32"
254
+ },
255
+ {
256
+ indexed: true,
257
+ internalType: "address",
258
+ name: "account",
259
+ type: "address"
260
+ },
261
+ {
262
+ indexed: true,
263
+ internalType: "address",
264
+ name: "sender",
265
+ type: "address"
266
+ }
267
+ ],
268
+ name: "RoleGranted",
269
+ type: "event"
270
+ },
271
+ {
272
+ anonymous: false,
273
+ inputs: [
274
+ {
275
+ indexed: true,
276
+ internalType: "bytes32",
277
+ name: "role",
278
+ type: "bytes32"
279
+ },
280
+ {
281
+ indexed: true,
282
+ internalType: "address",
283
+ name: "account",
284
+ type: "address"
285
+ },
286
+ {
287
+ indexed: true,
288
+ internalType: "address",
289
+ name: "sender",
290
+ type: "address"
291
+ }
292
+ ],
293
+ name: "RoleRevoked",
294
+ type: "event"
295
+ },
296
+ {
297
+ anonymous: false,
298
+ inputs: [
299
+ {
300
+ indexed: true,
301
+ internalType: "address",
302
+ name: "admin",
303
+ type: "address"
304
+ },
305
+ {
306
+ indexed: false,
307
+ internalType: "bool",
308
+ name: "enabled",
309
+ type: "bool"
310
+ },
311
+ {
312
+ indexed: true,
313
+ internalType: "address",
314
+ name: "campaignCreator",
315
+ type: "address"
316
+ },
317
+ {
318
+ indexed: false,
319
+ internalType: "uint256",
320
+ name: "gasFee",
321
+ type: "uint256"
322
+ }
323
+ ],
324
+ name: "SetCustomFee",
325
+ type: "event"
326
+ },
327
+ {
328
+ anonymous: false,
329
+ inputs: [
330
+ {
331
+ indexed: true,
332
+ internalType: "address",
333
+ name: "admin",
334
+ type: "address"
335
+ },
336
+ {
337
+ indexed: false,
338
+ internalType: "uint256",
339
+ name: "oldGasFee",
340
+ type: "uint256"
341
+ },
342
+ {
343
+ indexed: false,
344
+ internalType: "uint256",
345
+ name: "newGasFee",
346
+ type: "uint256"
347
+ }
348
+ ],
349
+ name: "SetDefaultGasFee",
350
+ type: "event"
351
+ },
352
+ {
353
+ inputs: [],
354
+ name: "DEFAULT_ADMIN_ROLE",
355
+ outputs: [
356
+ {
357
+ internalType: "bytes32",
358
+ name: "",
359
+ type: "bytes32"
360
+ }
361
+ ],
362
+ stateMutability: "view",
363
+ type: "function"
364
+ },
365
+ {
366
+ inputs: [],
367
+ name: "FEE_MANAGER_ROLE",
368
+ outputs: [
369
+ {
370
+ internalType: "bytes32",
371
+ name: "",
372
+ type: "bytes32"
373
+ }
374
+ ],
375
+ stateMutability: "view",
376
+ type: "function"
377
+ },
378
+ {
379
+ inputs: [],
380
+ name: "confidentialProtocolId",
381
+ outputs: [
382
+ {
383
+ internalType: "uint256",
384
+ name: "",
385
+ type: "uint256"
386
+ }
387
+ ],
388
+ stateMutability: "view",
389
+ type: "function"
390
+ },
391
+ {
392
+ inputs: [
393
+ {
394
+ components: [
395
+ {
396
+ internalType: "address",
397
+ name: "token",
398
+ type: "address"
399
+ },
400
+ {
401
+ internalType: "uint32",
402
+ name: "startTime",
403
+ type: "uint32"
404
+ },
405
+ {
406
+ internalType: "uint32",
407
+ name: "endTime",
408
+ type: "uint32"
409
+ },
410
+ {
411
+ internalType: "bool",
412
+ name: "canExtendClaimWindow",
413
+ type: "bool"
414
+ },
415
+ {
416
+ internalType: "address",
417
+ name: "admin",
418
+ type: "address"
419
+ }
420
+ ],
421
+ internalType: "struct IConfidentialAirdropFactory.AirdropParams",
422
+ name: "params",
423
+ type: "tuple"
424
+ },
425
+ {
426
+ internalType: "bytes32",
427
+ name: "userSalt",
428
+ type: "bytes32"
429
+ },
430
+ {
431
+ internalType: "externalEuint64",
432
+ name: "encryptedAmount",
433
+ type: "bytes32"
434
+ },
435
+ {
436
+ internalType: "bytes",
437
+ name: "inputProof",
438
+ type: "bytes"
439
+ }
440
+ ],
441
+ name: "createAndFundConfidentialAirdrop",
442
+ outputs: [
443
+ {
444
+ internalType: "address",
445
+ name: "airdrop",
446
+ type: "address"
447
+ }
448
+ ],
449
+ stateMutability: "nonpayable",
450
+ type: "function"
451
+ },
452
+ {
453
+ inputs: [
454
+ {
455
+ components: [
456
+ {
457
+ internalType: "address",
458
+ name: "token",
459
+ type: "address"
460
+ },
461
+ {
462
+ internalType: "uint32",
463
+ name: "startTime",
464
+ type: "uint32"
465
+ },
466
+ {
467
+ internalType: "uint32",
468
+ name: "endTime",
469
+ type: "uint32"
470
+ },
471
+ {
472
+ internalType: "bool",
473
+ name: "canExtendClaimWindow",
474
+ type: "bool"
475
+ },
476
+ {
477
+ internalType: "address",
478
+ name: "admin",
479
+ type: "address"
480
+ }
481
+ ],
482
+ internalType: "struct IConfidentialAirdropFactory.AirdropParams",
483
+ name: "params",
484
+ type: "tuple"
485
+ },
486
+ {
487
+ internalType: "bytes32",
488
+ name: "userSalt",
489
+ type: "bytes32"
490
+ }
491
+ ],
492
+ name: "createConfidentialAirdrop",
493
+ outputs: [
494
+ {
495
+ internalType: "address",
496
+ name: "airdrop",
497
+ type: "address"
498
+ }
499
+ ],
500
+ stateMutability: "nonpayable",
501
+ type: "function"
502
+ },
503
+ {
504
+ inputs: [],
505
+ name: "defaultGasFee",
506
+ outputs: [
507
+ {
508
+ internalType: "uint256",
509
+ name: "",
510
+ type: "uint256"
511
+ }
512
+ ],
513
+ stateMutability: "view",
514
+ type: "function"
515
+ },
516
+ {
517
+ inputs: [
518
+ {
519
+ internalType: "address",
520
+ name: "campaignCreator",
521
+ type: "address"
522
+ }
523
+ ],
524
+ name: "disableCustomFee",
525
+ outputs: [],
526
+ stateMutability: "nonpayable",
527
+ type: "function"
528
+ },
529
+ {
530
+ inputs: [],
531
+ name: "feeCollector",
532
+ outputs: [
533
+ {
534
+ internalType: "address",
535
+ name: "",
536
+ type: "address"
537
+ }
538
+ ],
539
+ stateMutability: "view",
540
+ type: "function"
541
+ },
542
+ {
543
+ inputs: [
544
+ {
545
+ internalType: "address",
546
+ name: "token",
547
+ type: "address"
548
+ },
549
+ {
550
+ components: [
551
+ {
552
+ internalType: "address",
553
+ name: "token",
554
+ type: "address"
555
+ },
556
+ {
557
+ internalType: "uint32",
558
+ name: "startTime",
559
+ type: "uint32"
560
+ },
561
+ {
562
+ internalType: "uint32",
563
+ name: "endTime",
564
+ type: "uint32"
565
+ },
566
+ {
567
+ internalType: "bool",
568
+ name: "canExtendClaimWindow",
569
+ type: "bool"
570
+ },
571
+ {
572
+ internalType: "address",
573
+ name: "admin",
574
+ type: "address"
575
+ }
576
+ ],
577
+ internalType: "struct IConfidentialAirdropFactory.AirdropParams",
578
+ name: "params",
579
+ type: "tuple"
580
+ },
581
+ {
582
+ internalType: "bytes32",
583
+ name: "userSalt",
584
+ type: "bytes32"
585
+ },
586
+ {
587
+ internalType: "address",
588
+ name: "deployer",
589
+ type: "address"
590
+ },
591
+ {
592
+ internalType: "uint256",
593
+ name: "gasFee",
594
+ type: "uint256"
595
+ },
596
+ {
597
+ internalType: "externalEuint64",
598
+ name: "encryptedAmount",
599
+ type: "bytes32"
600
+ },
601
+ {
602
+ internalType: "bytes",
603
+ name: "inputProof",
604
+ type: "bytes"
605
+ }
606
+ ],
607
+ name: "fundConfidentialAirdrop",
608
+ outputs: [],
609
+ stateMutability: "nonpayable",
610
+ type: "function"
611
+ },
612
+ {
613
+ inputs: [
614
+ {
615
+ internalType: "address",
616
+ name: "campaignCreator",
617
+ type: "address"
618
+ }
619
+ ],
620
+ name: "getCustomFee",
621
+ outputs: [
622
+ {
623
+ components: [
624
+ {
625
+ internalType: "bool",
626
+ name: "enabled",
627
+ type: "bool"
628
+ },
629
+ {
630
+ internalType: "uint256",
631
+ name: "gasFee",
632
+ type: "uint256"
633
+ }
634
+ ],
635
+ internalType: "struct IConfidentialAirdropFactory.CustomFee",
636
+ name: "",
637
+ type: "tuple"
638
+ }
639
+ ],
640
+ stateMutability: "view",
641
+ type: "function"
642
+ },
643
+ {
644
+ inputs: [
645
+ {
646
+ components: [
647
+ {
648
+ internalType: "address",
649
+ name: "token",
650
+ type: "address"
651
+ },
652
+ {
653
+ internalType: "uint32",
654
+ name: "startTime",
655
+ type: "uint32"
656
+ },
657
+ {
658
+ internalType: "uint32",
659
+ name: "endTime",
660
+ type: "uint32"
661
+ },
662
+ {
663
+ internalType: "bool",
664
+ name: "canExtendClaimWindow",
665
+ type: "bool"
666
+ },
667
+ {
668
+ internalType: "address",
669
+ name: "admin",
670
+ type: "address"
671
+ }
672
+ ],
673
+ internalType: "struct IConfidentialAirdropFactory.AirdropParams",
674
+ name: "params",
675
+ type: "tuple"
676
+ },
677
+ {
678
+ internalType: "uint256",
679
+ name: "gasFee",
680
+ type: "uint256"
681
+ }
682
+ ],
683
+ name: "getInitCodeHash",
684
+ outputs: [
685
+ {
686
+ internalType: "bytes32",
687
+ name: "hash",
688
+ type: "bytes32"
689
+ }
690
+ ],
691
+ stateMutability: "view",
692
+ type: "function"
693
+ },
694
+ {
695
+ inputs: [
696
+ {
697
+ internalType: "bytes32",
698
+ name: "role",
699
+ type: "bytes32"
700
+ }
701
+ ],
702
+ name: "getRoleAdmin",
703
+ outputs: [
704
+ {
705
+ internalType: "bytes32",
706
+ name: "",
707
+ type: "bytes32"
708
+ }
709
+ ],
710
+ stateMutability: "view",
711
+ type: "function"
712
+ },
713
+ {
714
+ inputs: [
715
+ {
716
+ internalType: "bytes32",
717
+ name: "role",
718
+ type: "bytes32"
719
+ },
720
+ {
721
+ internalType: "address",
722
+ name: "account",
723
+ type: "address"
724
+ }
725
+ ],
726
+ name: "grantRole",
727
+ outputs: [],
728
+ stateMutability: "nonpayable",
729
+ type: "function"
730
+ },
731
+ {
732
+ inputs: [
733
+ {
734
+ internalType: "bytes32",
735
+ name: "role",
736
+ type: "bytes32"
737
+ },
738
+ {
739
+ internalType: "address",
740
+ name: "account",
741
+ type: "address"
742
+ }
743
+ ],
744
+ name: "hasRole",
745
+ outputs: [
746
+ {
747
+ internalType: "bool",
748
+ name: "",
749
+ type: "bool"
750
+ }
751
+ ],
752
+ stateMutability: "view",
753
+ type: "function"
754
+ },
755
+ {
756
+ inputs: [],
757
+ name: "implementation",
758
+ outputs: [
759
+ {
760
+ internalType: "address",
761
+ name: "",
762
+ type: "address"
763
+ }
764
+ ],
765
+ stateMutability: "view",
766
+ type: "function"
767
+ },
768
+ {
769
+ inputs: [
770
+ {
771
+ components: [
772
+ {
773
+ internalType: "address",
774
+ name: "token",
775
+ type: "address"
776
+ },
777
+ {
778
+ internalType: "uint32",
779
+ name: "startTime",
780
+ type: "uint32"
781
+ },
782
+ {
783
+ internalType: "uint32",
784
+ name: "endTime",
785
+ type: "uint32"
786
+ },
787
+ {
788
+ internalType: "bool",
789
+ name: "canExtendClaimWindow",
790
+ type: "bool"
791
+ },
792
+ {
793
+ internalType: "address",
794
+ name: "admin",
795
+ type: "address"
796
+ }
797
+ ],
798
+ internalType: "struct IConfidentialAirdropFactory.AirdropParams",
799
+ name: "params",
800
+ type: "tuple"
801
+ },
802
+ {
803
+ internalType: "bytes32",
804
+ name: "userSalt",
805
+ type: "bytes32"
806
+ },
807
+ {
808
+ internalType: "address",
809
+ name: "deployer",
810
+ type: "address"
811
+ },
812
+ {
813
+ internalType: "uint256",
814
+ name: "gasFee",
815
+ type: "uint256"
816
+ }
817
+ ],
818
+ name: "predictAirdropAddress",
819
+ outputs: [
820
+ {
821
+ internalType: "address",
822
+ name: "predicted",
823
+ type: "address"
824
+ }
825
+ ],
826
+ stateMutability: "view",
827
+ type: "function"
828
+ },
829
+ {
830
+ inputs: [
831
+ {
832
+ internalType: "bytes32",
833
+ name: "role",
834
+ type: "bytes32"
835
+ },
836
+ {
837
+ internalType: "address",
838
+ name: "callerConfirmation",
839
+ type: "address"
840
+ }
841
+ ],
842
+ name: "renounceRole",
843
+ outputs: [],
844
+ stateMutability: "nonpayable",
845
+ type: "function"
846
+ },
847
+ {
848
+ inputs: [
849
+ {
850
+ internalType: "bytes32",
851
+ name: "role",
852
+ type: "bytes32"
853
+ },
854
+ {
855
+ internalType: "address",
856
+ name: "account",
857
+ type: "address"
858
+ }
859
+ ],
860
+ name: "revokeRole",
861
+ outputs: [],
862
+ stateMutability: "nonpayable",
863
+ type: "function"
864
+ },
865
+ {
866
+ inputs: [
867
+ {
868
+ internalType: "address",
869
+ name: "campaignCreator",
870
+ type: "address"
871
+ },
872
+ {
873
+ internalType: "uint256",
874
+ name: "gasFee",
875
+ type: "uint256"
876
+ }
877
+ ],
878
+ name: "setCustomFee",
879
+ outputs: [],
880
+ stateMutability: "nonpayable",
881
+ type: "function"
882
+ },
883
+ {
884
+ inputs: [
885
+ {
886
+ internalType: "uint256",
887
+ name: "newGasFee",
888
+ type: "uint256"
889
+ }
890
+ ],
891
+ name: "setDefaultGasFee",
892
+ outputs: [],
893
+ stateMutability: "nonpayable",
894
+ type: "function"
895
+ },
896
+ {
897
+ inputs: [
898
+ {
899
+ internalType: "address",
900
+ name: "newFeeCollector",
901
+ type: "address"
902
+ }
903
+ ],
904
+ name: "setFeeCollector",
905
+ outputs: [],
906
+ stateMutability: "nonpayable",
907
+ type: "function"
908
+ },
909
+ {
910
+ inputs: [
911
+ {
912
+ internalType: "bytes4",
913
+ name: "interfaceId",
914
+ type: "bytes4"
915
+ }
916
+ ],
917
+ name: "supportsInterface",
918
+ outputs: [
919
+ {
920
+ internalType: "bool",
921
+ name: "",
922
+ type: "bool"
923
+ }
924
+ ],
925
+ stateMutability: "view",
926
+ type: "function"
927
+ }
928
+ ];
929
+ function resolveEncryptor(source) {
930
+ if (source === void 0) return void 0;
931
+ return typeof source === "function" ? source() : source;
932
+ }
933
+ var MAX_UINT64 = (1n << 64n) - 1n;
934
+ function assertUint64(value, label) {
935
+ if (value < 0n || value > MAX_UINT64) {
936
+ throw new InvalidArgumentError({
937
+ method: "encryptUint64",
938
+ argument: label,
939
+ reason: "exceeds uint64 range (0..2^64-1)",
940
+ value
941
+ });
942
+ }
943
+ }
944
+ async function encryptUint64({
945
+ encryptor,
946
+ contractAddress,
947
+ userAddress,
948
+ value
949
+ }) {
950
+ assertUint64(value, "value");
951
+ const { handles, inputProof } = await encryptor.encrypt({
952
+ values: [{ value, type: "euint64" }],
953
+ contractAddress,
954
+ userAddress
955
+ });
956
+ if (handles.length !== 1) {
957
+ throw new InvalidArgumentError({
958
+ method: "encryptUint64",
959
+ argument: "handles",
960
+ reason: `expected 1 handle, got ${handles.length}`,
961
+ value: handles.length
962
+ });
963
+ }
964
+ return {
965
+ handle: asEncryptedHandle(bytesToHex(handles[0])),
966
+ inputProof: asExternalInputProof(bytesToHex(inputProof))
967
+ };
968
+ }
969
+ async function encryptUint64Batch({
970
+ encryptor,
971
+ contractAddress,
972
+ userAddress,
973
+ values
974
+ }) {
975
+ if (values.length === 0) {
976
+ throw new InvalidArgumentError({
977
+ method: "encryptUint64Batch",
978
+ argument: "values",
979
+ reason: "must be non-empty"
980
+ });
981
+ }
982
+ values.forEach((v, i) => assertUint64(v, `values[${i}]`));
983
+ const { handles, inputProof } = await encryptor.encrypt({
984
+ values: values.map((value) => ({ value, type: "euint64" })),
985
+ contractAddress,
986
+ userAddress
987
+ });
988
+ if (handles.length !== values.length) {
989
+ throw new InvalidArgumentError({
990
+ method: "encryptUint64Batch",
991
+ argument: "handles",
992
+ reason: `expected ${values.length} handles, got ${handles.length}`,
993
+ value: handles.length
994
+ });
995
+ }
996
+ return {
997
+ handles: handles.map((h) => asEncryptedHandle(bytesToHex(h))),
998
+ inputProof: asExternalInputProof(bytesToHex(inputProof))
999
+ };
1000
+ }
1001
+ async function signClaimAuthorization(args) {
1002
+ if (args.encryptedAmountHandle.length !== 66) {
1003
+ throw new TokenOpsSdkError(
1004
+ `signClaimAuthorization: encryptedAmountHandle must be a 32-byte hex string (0x + 64 chars), got length ${args.encryptedAmountHandle.length}`
1005
+ );
1006
+ }
1007
+ const account = args.walletClient.account;
1008
+ if (!account) {
1009
+ throw new MissingAccountError("signClaimAuthorization");
1010
+ }
1011
+ const chainId = args.walletClient.chain?.id;
1012
+ if (!chainId) {
1013
+ throw new InvalidArgumentError({
1014
+ method: "signClaimAuthorization",
1015
+ argument: "walletClient.chain.id",
1016
+ reason: "required for EIP712 chainId binding; pass a walletClient constructed with a known chain (e.g. `createWalletClient({ chain: sepolia, ... })`)."
1017
+ });
1018
+ }
1019
+ const sig = await args.walletClient.signTypedData({
1020
+ account,
1021
+ domain: {
1022
+ name: "ConfidentialAirdrop",
1023
+ version: "1",
1024
+ chainId,
1025
+ verifyingContract: args.airdropAddress
1026
+ },
1027
+ types: {
1028
+ Claim: [
1029
+ { name: "recipient", type: "address" },
1030
+ { name: "encryptedAmount", type: "bytes32" }
1031
+ ]
1032
+ },
1033
+ primaryType: "Claim",
1034
+ message: {
1035
+ recipient: args.recipient,
1036
+ encryptedAmount: args.encryptedAmountHandle
1037
+ }
1038
+ });
1039
+ return asSignature(sig);
1040
+ }
1041
+ var airdropFactoryProductMapper = () => void 0;
1042
+ var ConfidentialAirdropFactoryClient = class {
1043
+ publicClient;
1044
+ walletClient;
1045
+ address;
1046
+ encryptor;
1047
+ #telemetry;
1048
+ constructor(config) {
1049
+ this.publicClient = config.publicClient;
1050
+ this.walletClient = config.walletClient;
1051
+ this.encryptor = config.encryptor;
1052
+ const chainId = config.chainId ?? config.publicClient.chain?.id;
1053
+ const addressOverride = config.address ? normaliseAddress(config.address) : void 0;
1054
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : getFheAirdropFactoryAddress(chainId));
1055
+ if (!resolved) {
1056
+ throw new DeploymentAddressUnavailableError({
1057
+ reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
1058
+ product: "fheAirdrop",
1059
+ contract: "confidentialAirdropFactory",
1060
+ chainId,
1061
+ clientLabel: "ConfidentialAirdropFactoryClient"
1062
+ });
1063
+ }
1064
+ this.address = resolved;
1065
+ this.#telemetry = config.telemetry;
1066
+ this.#telemetry?.event("fhe-airdrop.client.init", {
1067
+ surface: "factory",
1068
+ chainId: chainId ?? null,
1069
+ hasWallet: !!this.walletClient,
1070
+ aclResolved: true,
1071
+ // factory has no ACL dependency; constant for funnel-shape parity with client.
1072
+ sdkVersion: SDK_VERSION
1073
+ });
1074
+ }
1075
+ // ----------------------- writes -----------------------
1076
+ /**
1077
+ * Deploy a new airdrop clone via the factory and return its address, parsed
1078
+ * from the `ConfidentialAirdropCreated` event in the tx receipt.
1079
+ *
1080
+ * **This is the headline factory entry point.** R02 ADR P-1 collapses the
1081
+ * old hash-only + `…AndGetAddress` pair down to one rich-return method —
1082
+ * 90 %+ of consumers want the deployed address back, and the SDK already
1083
+ * waits + parses the event, so there's no reason to make consumers do it
1084
+ * themselves.
1085
+ *
1086
+ * Internally: `writeContract` → {@link PublicClient.waitForTransactionReceipt} →
1087
+ * `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
1088
+ *
1089
+ * For genuine pre-mine prediction (rare), import
1090
+ * `ConfidentialAirdropFactoryAdvancedClient` from
1091
+ * `@tokenops/sdk/fhe-airdrop/advanced` and call `predictAirdropAddress`.
1092
+ *
1093
+ * @example
1094
+ * const { hash, airdrop } = await factory.createConfidentialAirdrop({
1095
+ * params, userSalt,
1096
+ * });
1097
+ */
1098
+ async createConfidentialAirdrop(args) {
1099
+ return withTelemetry(
1100
+ this.#telemetry,
1101
+ "fhe-airdrop.factory.createConfidentialAirdrop",
1102
+ async () => {
1103
+ const hash = await this.#write(
1104
+ "createConfidentialAirdrop",
1105
+ [toAbiParams(args.params), args.userSalt],
1106
+ args.account
1107
+ );
1108
+ return this.#resolveAirdropFromReceipt(hash, "createConfidentialAirdrop");
1109
+ }
1110
+ );
1111
+ }
1112
+ /**
1113
+ * Deploy and fund a new airdrop in a single transaction, and return its
1114
+ * address. The SDK encrypts `amount` into an `externalEuint64` before
1115
+ * passing to the contract.
1116
+ *
1117
+ * Prerequisites: caller must have set this factory as an operator on the
1118
+ * token: `token.setOperator(factoryAddress, deadline)`.
1119
+ *
1120
+ * Symmetric with {@link ConfidentialAirdropFactoryClient.createConfidentialAirdrop}
1121
+ * — both return `{ hash, airdrop }` parsed from the
1122
+ * `ConfidentialAirdropCreated` event (R02 ADR P-1).
1123
+ *
1124
+ * @example
1125
+ * const { hash, airdrop } = await factory.createAndFundConfidentialAirdrop({
1126
+ * params, userSalt, amount: 1_000_000n,
1127
+ * });
1128
+ */
1129
+ async createAndFundConfidentialAirdrop(args) {
1130
+ return withTelemetry(
1131
+ this.#telemetry,
1132
+ "fhe-airdrop.factory.createAndFundConfidentialAirdrop",
1133
+ async () => {
1134
+ const wallet = this.#requireWallet("createAndFundConfidentialAirdrop");
1135
+ const account = this.#resolveAccount(
1136
+ wallet,
1137
+ args.account,
1138
+ "createAndFundConfidentialAirdrop"
1139
+ );
1140
+ const encrypted = await this.#encryptAmount(
1141
+ args.amount,
1142
+ args.encryptor,
1143
+ args.encryptedInput,
1144
+ account,
1145
+ "createAndFundConfidentialAirdrop"
1146
+ );
1147
+ const writeArgs = [
1148
+ toAbiParams(args.params),
1149
+ args.userSalt,
1150
+ encrypted.handle,
1151
+ encrypted.inputProof
1152
+ ];
1153
+ await this.#preflightWrite(
1154
+ "createAndFundConfidentialAirdrop",
1155
+ "createAndFundConfidentialAirdrop",
1156
+ writeArgs,
1157
+ account
1158
+ );
1159
+ let hash;
1160
+ try {
1161
+ hash = await wallet.writeContract({
1162
+ address: this.address,
1163
+ abi: confidentialAirdropFactoryAbi,
1164
+ functionName: "createAndFundConfidentialAirdrop",
1165
+ args: writeArgs,
1166
+ account,
1167
+ chain: wallet.chain
1168
+ });
1169
+ } catch (err) {
1170
+ throw this.#mapRevert("createAndFundConfidentialAirdrop", err, accountAddress(account));
1171
+ }
1172
+ return this.#resolveAirdropFromReceipt(hash, "createAndFundConfidentialAirdrop");
1173
+ }
1174
+ );
1175
+ }
1176
+ /**
1177
+ * Fund an existing (or not-yet-deployed) airdrop with encrypted tokens.
1178
+ *
1179
+ * Prerequisites: caller must have set this factory as an operator on the token:
1180
+ * `token.setOperator(factoryAddress, deadline)`
1181
+ *
1182
+ * @returns Transaction hash.
1183
+ */
1184
+ async fundConfidentialAirdrop(args) {
1185
+ const wallet = this.#requireWallet("fundConfidentialAirdrop");
1186
+ const account = this.#resolveAccount(wallet, args.account, "fundConfidentialAirdrop");
1187
+ const encrypted = await this.#encryptAmount(
1188
+ args.amount,
1189
+ args.encryptor,
1190
+ args.encryptedInput,
1191
+ account,
1192
+ "fundConfidentialAirdrop"
1193
+ );
1194
+ const writeArgs = [
1195
+ args.token,
1196
+ toAbiParams(args.params),
1197
+ args.userSalt,
1198
+ args.deployer,
1199
+ args.gasFee,
1200
+ encrypted.handle,
1201
+ encrypted.inputProof
1202
+ ];
1203
+ await this.#preflightWrite(
1204
+ "fundConfidentialAirdrop",
1205
+ "fundConfidentialAirdrop",
1206
+ writeArgs,
1207
+ account
1208
+ );
1209
+ try {
1210
+ return await wallet.writeContract({
1211
+ address: this.address,
1212
+ abi: confidentialAirdropFactoryAbi,
1213
+ functionName: "fundConfidentialAirdrop",
1214
+ args: writeArgs,
1215
+ account,
1216
+ chain: wallet.chain
1217
+ });
1218
+ } catch (err) {
1219
+ throw this.#mapRevert("fundConfidentialAirdrop", err, accountAddress(account));
1220
+ }
1221
+ }
1222
+ /**
1223
+ * Deploy a new airdrop clone and return its address, parsed from the
1224
+ * `ConfidentialAirdropCreated` event in the tx receipt.
1225
+ *
1226
+ * Symmetry helper with the fhe-vesting client. Use this when you want a
1227
+ * one-call "deploy and use" shape; otherwise call
1228
+ * {@link ConfidentialAirdropFactoryClient.createConfidentialAirdrop} and parse
1229
+ * the receipt yourself, or call
1230
+ * {@link ConfidentialAirdropFactoryClient.predictAirdropAddress} before mining.
1231
+ *
1232
+ * Internally: {@link ConfidentialAirdropFactoryClient.createConfidentialAirdrop} →
1233
+ * {@link PublicClient.waitForTransactionReceipt} →
1234
+ * `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
1235
+ *
1236
+ * @example
1237
+ * const { hash, airdrop } = await factory.createConfidentialAirdropAndGetAddress({
1238
+ * params, userSalt,
1239
+ * });
1240
+ */
1241
+ async createConfidentialAirdropAndGetAddress(args) {
1242
+ return this.createConfidentialAirdrop(args);
1243
+ }
1244
+ /**
1245
+ * Deploy AND fund a new airdrop clone in one tx, returning its address parsed
1246
+ * from the `ConfidentialAirdropCreated` event in the receipt.
1247
+ *
1248
+ * Symmetry with {@link ConfidentialAirdropFactoryClient.createConfidentialAirdropAndGetAddress}
1249
+ * — use this when you also need to seed the pool in the same transaction.
1250
+ *
1251
+ * Internally: {@link ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdrop} →
1252
+ * {@link PublicClient.waitForTransactionReceipt} →
1253
+ * `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
1254
+ *
1255
+ * @example
1256
+ * const { hash, airdrop } = await factory.createAndFundConfidentialAirdropAndGetAddress({
1257
+ * params, userSalt, amount, encryptor,
1258
+ * });
1259
+ */
1260
+ async createAndFundConfidentialAirdropAndGetAddress(args) {
1261
+ return this.createAndFundConfidentialAirdrop(args);
1262
+ }
1263
+ // ----------------------- fee management (FEE_MANAGER_ROLE) -----------------------
1264
+ /** Change the fee collector address. FEE_MANAGER_ROLE only. */
1265
+ async setFeeCollector(newFeeCollector, account) {
1266
+ return withTelemetry(this.#telemetry, "fhe-airdrop.factory.setFeeCollector", async () => {
1267
+ return this.#write("setFeeCollector", [newFeeCollector], account);
1268
+ });
1269
+ }
1270
+ /** Change the default per-claim gas fee in wei. FEE_MANAGER_ROLE only. */
1271
+ async setDefaultGasFee(newGasFee, account) {
1272
+ return withTelemetry(this.#telemetry, "fhe-airdrop.factory.setDefaultGasFee", async () => {
1273
+ return this.#write("setDefaultGasFee", [newGasFee], account);
1274
+ });
1275
+ }
1276
+ /** Set a per-creator gas fee override. FEE_MANAGER_ROLE only. */
1277
+ async setCustomFee(campaignCreator, gasFee, account) {
1278
+ return withTelemetry(this.#telemetry, "fhe-airdrop.factory.setCustomFee", async () => {
1279
+ return this.#write("setCustomFee", [campaignCreator, gasFee], account);
1280
+ });
1281
+ }
1282
+ /** Remove a per-creator fee override, reverting to `defaultGasFee`. FEE_MANAGER_ROLE only. */
1283
+ async disableCustomFee(campaignCreator, account) {
1284
+ return withTelemetry(this.#telemetry, "fhe-airdrop.factory.disableCustomFee", async () => {
1285
+ return this.#write("disableCustomFee", [campaignCreator], account);
1286
+ });
1287
+ }
1288
+ // ----------------------- reads -----------------------
1289
+ /** Current LibClone implementation address. */
1290
+ async implementation() {
1291
+ return this.#read("implementation");
1292
+ }
1293
+ /**
1294
+ * Alias for {@link ConfidentialAirdropFactoryClient.implementation} that matches
1295
+ * the contract's storage field name (`_airdropImplementation`).
1296
+ *
1297
+ * Shipped proactively in R17 for parity with `fhe-vesting`'s
1298
+ * `managerImplementation()` alias (commit 6f6d7bc, closing
1299
+ * backend-integrator-r14 minor). The airdrop factory has the same
1300
+ * LibClone shape mirroring `_airdropImplementation` storage, so server
1301
+ * devs reading the Solidity first reach for `factory.airdropImplementation()`
1302
+ * via autocomplete and would otherwise hit a TS2551 on the SDK's
1303
+ * `implementation()` shape. The canonical `implementation()` method is
1304
+ * retained for backwards-compat and cross-factory uniformity.
1305
+ */
1306
+ async airdropImplementation() {
1307
+ return this.implementation();
1308
+ }
1309
+ /** Default per-claim gas fee in wei. Used when no custom fee is set for the campaign creator. */
1310
+ async defaultGasFee() {
1311
+ return this.#read("defaultGasFee");
1312
+ }
1313
+ /** Address authorized to collect gas fees from airdrop clones. */
1314
+ async feeCollector() {
1315
+ return this.#read("feeCollector");
1316
+ }
1317
+ /** Per-creator custom fee override. `enabled` is `false` when no override is set. */
1318
+ async getCustomFee(campaignCreator) {
1319
+ const raw = await this.#read("getCustomFee", [
1320
+ campaignCreator
1321
+ ]);
1322
+ return { enabled: raw.enabled, gasFee: raw.gasFee };
1323
+ }
1324
+ /**
1325
+ * Compute the CREATE2 init-code hash for a given set of params and gas fee.
1326
+ * Useful for deriving the clone address off-chain. Use `predictAirdropAddress` from
1327
+ * `@tokenops/sdk/fhe-airdrop/advanced` for the full address derivation.
1328
+ * @param args `{ params, gasFee }` — must match the values used at deploy time.
1329
+ * @returns `bytes32` init-code hash.
1330
+ */
1331
+ async getInitCodeHash(args) {
1332
+ return this.#read("getInitCodeHash", [toAbiParams(args.params), args.gasFee]);
1333
+ }
1334
+ // ----------------------- internals -----------------------
1335
+ /**
1336
+ * Wait for the receipt of a clone-deploy tx and parse the
1337
+ * `ConfidentialAirdropCreated` event to extract the deployed airdrop
1338
+ * address. Branded result; throws `TokenOpsSdkError` if zero or >1 events
1339
+ * match this factory address.
1340
+ */
1341
+ async #resolveAirdropFromReceipt(hash, method) {
1342
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
1343
+ const events = parseEventLogs({
1344
+ abi: confidentialAirdropFactoryAbi,
1345
+ eventName: "ConfidentialAirdropCreated",
1346
+ logs: receipt.logs
1347
+ });
1348
+ const ours = events.filter((ev) => ev.address.toLowerCase() === this.address.toLowerCase());
1349
+ if (ours.length === 0) {
1350
+ throw new TokenOpsSdkError(
1351
+ `${method}: no ConfidentialAirdropCreated event from factory ${this.address} in tx ${hash}`
1352
+ );
1353
+ }
1354
+ if (ours.length > 1) {
1355
+ throw new TokenOpsSdkError(
1356
+ `${method}: ${ours.length} ConfidentialAirdropCreated events from factory ${this.address} in tx ${hash}; ambiguous result`
1357
+ );
1358
+ }
1359
+ return { hash: asTxHash(hash), airdrop: ours[0].args.airdrop };
1360
+ }
1361
+ #requireWallet(method) {
1362
+ if (!this.walletClient) {
1363
+ throw new MissingWalletClientError(method);
1364
+ }
1365
+ return this.walletClient;
1366
+ }
1367
+ #resolveAccount(wallet, override, method) {
1368
+ const acct = override ?? wallet.account;
1369
+ if (!acct) {
1370
+ throw new MissingAccountError(method);
1371
+ }
1372
+ return acct;
1373
+ }
1374
+ /**
1375
+ * Resolve the encrypted-amount payload for a fund-style write. Enforces
1376
+ * **exactly one** of `amount` / `encryptedInput` so a caller who hands the
1377
+ * SDK a pre-encrypted handle cannot also pass a stale plaintext that drifts
1378
+ * from the on-chain ciphertext.
1379
+ */
1380
+ async #encryptAmount(amount, encryptor, preEncrypted, account, method) {
1381
+ const hasAmount = amount !== void 0;
1382
+ const hasInput = preEncrypted !== void 0;
1383
+ if (hasAmount && hasInput) {
1384
+ throw new InvalidArgumentError({
1385
+ method,
1386
+ argument: "amount/encryptedInput",
1387
+ reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
1388
+ });
1389
+ }
1390
+ if (!hasAmount && !hasInput) {
1391
+ throw new InvalidArgumentError({
1392
+ method,
1393
+ argument: "amount/encryptedInput",
1394
+ reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
1395
+ });
1396
+ }
1397
+ if (hasInput) return preEncrypted;
1398
+ const enc = encryptor ?? resolveEncryptor(this.encryptor);
1399
+ if (!enc) {
1400
+ throw new MissingEncryptorError("encryptAmount", {
1401
+ hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
1402
+ });
1403
+ }
1404
+ return encryptUint64({
1405
+ encryptor: enc,
1406
+ contractAddress: this.address,
1407
+ userAddress: accountAddress(account),
1408
+ value: amount
1409
+ });
1410
+ }
1411
+ async #write(functionName, args, account) {
1412
+ const wallet = this.#requireWallet(functionName);
1413
+ const acct = this.#resolveAccount(wallet, account, functionName);
1414
+ await this.#preflightWrite(functionName, functionName, args, acct);
1415
+ try {
1416
+ return await wallet.writeContract({
1417
+ address: this.address,
1418
+ abi: confidentialAirdropFactoryAbi,
1419
+ functionName,
1420
+ args,
1421
+ account: acct,
1422
+ chain: wallet.chain
1423
+ });
1424
+ } catch (err) {
1425
+ throw this.#mapRevert(functionName, err, accountAddress(acct));
1426
+ }
1427
+ }
1428
+ #mapRevert(method, err, account) {
1429
+ return mapContractRevert(err, {
1430
+ method,
1431
+ contractAddress: this.address,
1432
+ abi: confidentialAirdropFactoryAbi,
1433
+ productMapper: airdropFactoryProductMapper,
1434
+ account
1435
+ });
1436
+ }
1437
+ /**
1438
+ * Pre-flight a write via `simulateContract` purely to surface typed reverts.
1439
+ *
1440
+ * The simulate's *return value* is discarded — FHE writes still need
1441
+ * `writeContract` + receipt parsing because simulated FHE op handles diverge
1442
+ * from the executed-tx handles (CLAUDE.md Pitfall #1). The only purpose of
1443
+ * this call is to let viem decode any revert against the ABI and produce a
1444
+ * `ContractFunctionRevertedError` frame the revert-mapper can classify.
1445
+ */
1446
+ async #preflightWrite(method, functionName, args, account, value) {
1447
+ try {
1448
+ await this.publicClient.simulateContract({
1449
+ address: this.address,
1450
+ abi: confidentialAirdropFactoryAbi,
1451
+ functionName,
1452
+ args,
1453
+ account,
1454
+ ...value !== void 0 ? { value } : {}
1455
+ });
1456
+ } catch (err) {
1457
+ if (isContractRevert(err)) {
1458
+ throw this.#mapRevert(method, err, accountAddress(account));
1459
+ }
1460
+ }
1461
+ }
1462
+ async #read(functionName, args = []) {
1463
+ const result = await this.publicClient.readContract({
1464
+ address: this.address,
1465
+ abi: confidentialAirdropFactoryAbi,
1466
+ functionName,
1467
+ args
1468
+ });
1469
+ return result;
1470
+ }
1471
+ };
1472
+ function createConfidentialAirdropFactoryClient(config) {
1473
+ return new ConfidentialAirdropFactoryClient(config);
1474
+ }
1475
+ function accountAddress(account) {
1476
+ return typeof account === "string" ? account : account.address;
1477
+ }
1478
+ function toAbiParams(params) {
1479
+ return {
1480
+ token: params.token,
1481
+ startTime: params.startTimestamp,
1482
+ endTime: params.endTimestamp,
1483
+ canExtendClaimWindow: params.canExtendClaimWindow,
1484
+ admin: params.admin
1485
+ };
1486
+ }
1487
+
1488
+ export { ConfidentialAirdropFactoryClient, confidentialAirdropFactoryAbi, createConfidentialAirdropFactoryClient, encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization };