@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,2772 @@
1
+ 'use strict';
2
+
3
+ var chunkNS44KBV5_cjs = require('./chunk-NS44KBV5.cjs');
4
+ var chunk5SGMJADP_cjs = require('./chunk-5SGMJADP.cjs');
5
+ var chunkQ7ARQSUH_cjs = require('./chunk-Q7ARQSUH.cjs');
6
+ var chunkVDXVNZCO_cjs = require('./chunk-VDXVNZCO.cjs');
7
+ var chunkCQIPRNS7_cjs = require('./chunk-CQIPRNS7.cjs');
8
+ var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
9
+ var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
10
+ var chunk56UI7LUR_cjs = require('./chunk-56UI7LUR.cjs');
11
+ var viem = require('viem');
12
+
13
+ // src/fhe-vesting/abis/manager.ts
14
+ var confidentialVestingManagerAbi = [
15
+ {
16
+ inputs: [{ internalType: "address", name: "_extension", type: "address" }],
17
+ stateMutability: "nonpayable",
18
+ type: "constructor"
19
+ },
20
+ { inputs: [], name: "AccessControlBadConfirmation", type: "error" },
21
+ {
22
+ inputs: [
23
+ { internalType: "address", name: "account", type: "address" },
24
+ { internalType: "bytes32", name: "neededRole", type: "bytes32" }
25
+ ],
26
+ name: "AccessControlUnauthorizedAccount",
27
+ type: "error"
28
+ },
29
+ { inputs: [], name: "ArrayLengthMismatch", type: "error" },
30
+ { inputs: [], name: "BatchTooLarge", type: "error" },
31
+ { inputs: [], name: "CannotTransferToSelf", type: "error" },
32
+ { inputs: [], name: "CannotTransferToZero", type: "error" },
33
+ { inputs: [], name: "ClaimLocked", type: "error" },
34
+ { inputs: [], name: "CliffExceedsDuration", type: "error" },
35
+ { inputs: [], name: "EmptyBatch", type: "error" },
36
+ { inputs: [], name: "EnforcedPause", type: "error" },
37
+ { inputs: [], name: "ExpectedPause", type: "error" },
38
+ { inputs: [], name: "HandleNotAllowed", type: "error" },
39
+ { inputs: [], name: "InsufficientGasFee", type: "error" },
40
+ { inputs: [], name: "InvalidAdmin", type: "error" },
41
+ { inputs: [], name: "InvalidBps", type: "error" },
42
+ { inputs: [], name: "InvalidFeeCollector", type: "error" },
43
+ { inputs: [], name: "InvalidInitialization", type: "error" },
44
+ { inputs: [], name: "InvalidMaxBatchSize", type: "error" },
45
+ { inputs: [], name: "InvalidParty", type: "error" },
46
+ { inputs: [], name: "InvalidRecipient", type: "error" },
47
+ { inputs: [], name: "InvalidSplitDenominator", type: "error" },
48
+ { inputs: [], name: "InvalidTimestamps", type: "error" },
49
+ { inputs: [], name: "InvalidTransferDuration", type: "error" },
50
+ { inputs: [], name: "NoPendingTransfer", type: "error" },
51
+ { inputs: [], name: "NotInitializing", type: "error" },
52
+ { inputs: [], name: "NotPendingRecipient", type: "error" },
53
+ { inputs: [], name: "NotRecipient", type: "error" },
54
+ { inputs: [], name: "PausableDisabled", type: "error" },
55
+ { inputs: [], name: "RecipientIndexMismatch", type: "error" },
56
+ { inputs: [], name: "RedundantRoleTransfer", type: "error" },
57
+ { inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
58
+ { inputs: [], name: "SameToken", type: "error" },
59
+ {
60
+ inputs: [
61
+ { internalType: "bytes32", name: "handle", type: "bytes32" },
62
+ { internalType: "address", name: "sender", type: "address" }
63
+ ],
64
+ name: "SenderNotAllowedToUseHandle",
65
+ type: "error"
66
+ },
67
+ {
68
+ inputs: [{ internalType: "address", name: "sender", type: "address" }],
69
+ name: "SenderNotAllowed",
70
+ type: "error"
71
+ },
72
+ { inputs: [], name: "SplitDisabled", type: "error" },
73
+ { inputs: [], name: "TimelockOverflow", type: "error" },
74
+ { inputs: [], name: "TransferAlreadyPending", type: "error" },
75
+ { inputs: [], name: "TransferExpired", type: "error" },
76
+ { inputs: [], name: "TransferFailed", type: "error" },
77
+ { inputs: [], name: "UnexpectedETH", type: "error" },
78
+ { inputs: [], name: "VestingAlreadyRevoked", type: "error" },
79
+ { inputs: [], name: "VestingEnded", type: "error" },
80
+ { inputs: [], name: "VestingIdsNotStrictlyAsc", type: "error" },
81
+ { inputs: [], name: "VestingNotFound", type: "error" },
82
+ { inputs: [], name: "VestingNotRevocable", type: "error" },
83
+ { inputs: [], name: "ZamaProtocolUnsupported", type: "error" },
84
+ {
85
+ anonymous: false,
86
+ inputs: [
87
+ { indexed: true, internalType: "address", name: "to", type: "address" },
88
+ { indexed: false, internalType: "euint64", name: "amount", type: "bytes32" }
89
+ ],
90
+ name: "AdminWithdrawal",
91
+ type: "event"
92
+ },
93
+ {
94
+ anonymous: false,
95
+ inputs: [
96
+ { indexed: true, internalType: "bytes32", name: "vestingId", type: "bytes32" },
97
+ { indexed: true, internalType: "address", name: "discloser", type: "address" },
98
+ { indexed: true, internalType: "address", name: "party", type: "address" },
99
+ {
100
+ indexed: false,
101
+ internalType: "enum IConfidentialVestingManagerTypes.DisclosureType",
102
+ name: "disclosureType",
103
+ type: "uint8"
104
+ },
105
+ { indexed: false, internalType: "euint128", name: "encryptedAmount", type: "bytes32" }
106
+ ],
107
+ name: "AmountDisclosed",
108
+ type: "event"
109
+ },
110
+ {
111
+ anonymous: false,
112
+ inputs: [
113
+ { indexed: true, internalType: "address", name: "to", type: "address" },
114
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }
115
+ ],
116
+ name: "GasFeeWithdrawal",
117
+ type: "event"
118
+ },
119
+ {
120
+ anonymous: false,
121
+ inputs: [
122
+ { indexed: true, internalType: "address", name: "discloser", type: "address" },
123
+ { indexed: true, internalType: "address", name: "party", type: "address" },
124
+ { indexed: false, internalType: "euint128", name: "encryptedAmount", type: "bytes32" }
125
+ ],
126
+ name: "HandleDisclosedToParty",
127
+ type: "event"
128
+ },
129
+ {
130
+ anonymous: false,
131
+ inputs: [{ indexed: false, internalType: "uint64", name: "version", type: "uint64" }],
132
+ name: "Initialized",
133
+ type: "event"
134
+ },
135
+ {
136
+ anonymous: false,
137
+ inputs: [
138
+ { indexed: false, internalType: "uint256", name: "oldMax", type: "uint256" },
139
+ { indexed: false, internalType: "uint256", name: "newMax", type: "uint256" }
140
+ ],
141
+ name: "MaxBatchSizeUpdated",
142
+ type: "event"
143
+ },
144
+ {
145
+ anonymous: false,
146
+ inputs: [
147
+ { indexed: false, internalType: "uint256", name: "oldMax", type: "uint256" },
148
+ { indexed: false, internalType: "uint256", name: "newMax", type: "uint256" }
149
+ ],
150
+ name: "MaxRevokeBatchSizeUpdated",
151
+ type: "event"
152
+ },
153
+ {
154
+ anonymous: false,
155
+ inputs: [
156
+ { indexed: true, internalType: "address", name: "token", type: "address" },
157
+ { indexed: true, internalType: "address", name: "to", type: "address" },
158
+ { indexed: false, internalType: "euint64", name: "amount", type: "bytes32" }
159
+ ],
160
+ name: "OtherConfidentialTokenWithdrawal",
161
+ type: "event"
162
+ },
163
+ {
164
+ anonymous: false,
165
+ inputs: [
166
+ { indexed: true, internalType: "address", name: "token", type: "address" },
167
+ { indexed: true, internalType: "address", name: "to", type: "address" },
168
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }
169
+ ],
170
+ name: "OtherTokenWithdrawal",
171
+ type: "event"
172
+ },
173
+ {
174
+ anonymous: false,
175
+ inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
176
+ name: "Paused",
177
+ type: "event"
178
+ },
179
+ {
180
+ anonymous: false,
181
+ inputs: [
182
+ { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
183
+ { indexed: true, internalType: "bytes32", name: "previousAdminRole", type: "bytes32" },
184
+ { indexed: true, internalType: "bytes32", name: "newAdminRole", type: "bytes32" }
185
+ ],
186
+ name: "RoleAdminChanged",
187
+ type: "event"
188
+ },
189
+ {
190
+ anonymous: false,
191
+ inputs: [
192
+ { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
193
+ { indexed: true, internalType: "address", name: "account", type: "address" },
194
+ { indexed: true, internalType: "address", name: "sender", type: "address" }
195
+ ],
196
+ name: "RoleGranted",
197
+ type: "event"
198
+ },
199
+ {
200
+ anonymous: false,
201
+ inputs: [
202
+ { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
203
+ { indexed: true, internalType: "address", name: "account", type: "address" },
204
+ { indexed: true, internalType: "address", name: "sender", type: "address" }
205
+ ],
206
+ name: "RoleRevoked",
207
+ type: "event"
208
+ },
209
+ {
210
+ anonymous: false,
211
+ inputs: [
212
+ { indexed: true, internalType: "address", name: "to", type: "address" },
213
+ { indexed: false, internalType: "euint64", name: "amount", type: "bytes32" }
214
+ ],
215
+ name: "TokenFeeWithdrawal",
216
+ type: "event"
217
+ },
218
+ {
219
+ anonymous: false,
220
+ inputs: [
221
+ { indexed: true, internalType: "bytes32", name: "vestingId", type: "bytes32" },
222
+ { indexed: true, internalType: "address", name: "recipient", type: "address" },
223
+ { indexed: false, internalType: "euint64", name: "amount", type: "bytes32" }
224
+ ],
225
+ name: "TokensClaimed",
226
+ type: "event"
227
+ },
228
+ {
229
+ anonymous: false,
230
+ inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
231
+ name: "Unpaused",
232
+ type: "event"
233
+ },
234
+ {
235
+ anonymous: false,
236
+ inputs: [
237
+ { indexed: true, internalType: "bytes32", name: "vestingId", type: "bytes32" },
238
+ { indexed: true, internalType: "address", name: "recipient", type: "address" },
239
+ { indexed: false, internalType: "uint32", name: "startTimestamp", type: "uint32" },
240
+ { indexed: false, internalType: "uint32", name: "endTimestamp", type: "uint32" },
241
+ { indexed: false, internalType: "uint32", name: "cliffReleaseTimestamp", type: "uint32" },
242
+ { indexed: false, internalType: "euint128", name: "encryptedAmount", type: "bytes32" }
243
+ ],
244
+ name: "VestingCreated",
245
+ type: "event"
246
+ },
247
+ {
248
+ anonymous: false,
249
+ inputs: [
250
+ { indexed: true, internalType: "address", name: "admin", type: "address" },
251
+ { indexed: true, internalType: "address", name: "feeCollector", type: "address" },
252
+ { indexed: false, internalType: "uint256", name: "blockNumber", type: "uint256" }
253
+ ],
254
+ name: "VestingManagerInitialized",
255
+ type: "event"
256
+ },
257
+ {
258
+ anonymous: false,
259
+ inputs: [
260
+ { indexed: true, internalType: "bytes32", name: "vestingId", type: "bytes32" },
261
+ { indexed: false, internalType: "uint32", name: "revokeTimestamp", type: "uint32" }
262
+ ],
263
+ name: "VestingRevoked",
264
+ type: "event"
265
+ },
266
+ {
267
+ anonymous: false,
268
+ inputs: [
269
+ { indexed: true, internalType: "bytes32", name: "originalVestingId", type: "bytes32" },
270
+ { indexed: true, internalType: "bytes32", name: "newVestingId", type: "bytes32" },
271
+ { indexed: true, internalType: "address", name: "newRecipient", type: "address" },
272
+ { indexed: false, internalType: "euint128", name: "origAllocation", type: "bytes32" },
273
+ { indexed: false, internalType: "euint128", name: "newAllocation", type: "bytes32" }
274
+ ],
275
+ name: "VestingSplit",
276
+ type: "event"
277
+ },
278
+ {
279
+ anonymous: false,
280
+ inputs: [
281
+ { indexed: true, internalType: "bytes32", name: "vestingId", type: "bytes32" },
282
+ { indexed: true, internalType: "address", name: "oldRecipient", type: "address" },
283
+ { indexed: true, internalType: "address", name: "newRecipient", type: "address" }
284
+ ],
285
+ name: "VestingTransferAccepted",
286
+ type: "event"
287
+ },
288
+ {
289
+ anonymous: false,
290
+ inputs: [{ indexed: true, internalType: "bytes32", name: "vestingId", type: "bytes32" }],
291
+ name: "VestingTransferCancelled",
292
+ type: "event"
293
+ },
294
+ {
295
+ anonymous: false,
296
+ inputs: [
297
+ { indexed: true, internalType: "bytes32", name: "vestingId", type: "bytes32" },
298
+ { indexed: true, internalType: "address", name: "from", type: "address" },
299
+ { indexed: true, internalType: "address", name: "to", type: "address" }
300
+ ],
301
+ name: "VestingTransferInitiated",
302
+ type: "event"
303
+ },
304
+ { stateMutability: "payable", type: "fallback" },
305
+ {
306
+ inputs: [],
307
+ name: "CLAIMER_ROLE",
308
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
309
+ stateMutability: "view",
310
+ type: "function"
311
+ },
312
+ {
313
+ inputs: [],
314
+ name: "DEFAULT_ADMIN_ROLE",
315
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
316
+ stateMutability: "view",
317
+ type: "function"
318
+ },
319
+ {
320
+ inputs: [],
321
+ name: "DEPLOYMENT_BLOCK_NUMBER",
322
+ outputs: [{ internalType: "uint256", name: "blockNumber", type: "uint256" }],
323
+ stateMutability: "view",
324
+ type: "function"
325
+ },
326
+ {
327
+ inputs: [],
328
+ name: "DISCLOSURE_ADMIN_ROLE",
329
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
330
+ stateMutability: "view",
331
+ type: "function"
332
+ },
333
+ {
334
+ inputs: [],
335
+ name: "FEE",
336
+ outputs: [{ internalType: "uint256", name: "fee", type: "uint256" }],
337
+ stateMutability: "view",
338
+ type: "function"
339
+ },
340
+ {
341
+ inputs: [],
342
+ name: "FEE_COLLECTOR_ROLE",
343
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
344
+ stateMutability: "view",
345
+ type: "function"
346
+ },
347
+ {
348
+ inputs: [],
349
+ name: "FEE_TYPE",
350
+ outputs: [{ internalType: "uint8", name: "feeType", type: "uint8" }],
351
+ stateMutability: "view",
352
+ type: "function"
353
+ },
354
+ {
355
+ inputs: [],
356
+ name: "PAUSER_ROLE",
357
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
358
+ stateMutability: "view",
359
+ type: "function"
360
+ },
361
+ {
362
+ inputs: [],
363
+ name: "REVOKER_ROLE",
364
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
365
+ stateMutability: "view",
366
+ type: "function"
367
+ },
368
+ {
369
+ inputs: [],
370
+ name: "TOKEN_ADDRESS",
371
+ outputs: [{ internalType: "address", name: "token", type: "address" }],
372
+ stateMutability: "view",
373
+ type: "function"
374
+ },
375
+ {
376
+ inputs: [],
377
+ name: "VESTING_CREATOR_ROLE",
378
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
379
+ stateMutability: "view",
380
+ type: "function"
381
+ },
382
+ {
383
+ inputs: [],
384
+ name: "WITHDRAWER_ROLE",
385
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
386
+ stateMutability: "view",
387
+ type: "function"
388
+ },
389
+ {
390
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
391
+ name: "adminClaim",
392
+ outputs: [],
393
+ stateMutability: "payable",
394
+ type: "function"
395
+ },
396
+ {
397
+ inputs: [
398
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
399
+ { internalType: "externalEuint64", name: "encryptedAmount", type: "bytes32" },
400
+ { internalType: "bytes", name: "inputProof", type: "bytes" }
401
+ ],
402
+ name: "adminPartialClaim",
403
+ outputs: [],
404
+ stateMutability: "payable",
405
+ type: "function"
406
+ },
407
+ {
408
+ inputs: [
409
+ {
410
+ components: [
411
+ { internalType: "address", name: "recipient", type: "address" },
412
+ { internalType: "uint32", name: "startTimestamp", type: "uint32" },
413
+ { internalType: "uint32", name: "endTimestamp", type: "uint32" },
414
+ { internalType: "uint32", name: "cliffSeconds", type: "uint32" },
415
+ { internalType: "uint32", name: "releaseIntervalSecs", type: "uint32" },
416
+ { internalType: "uint32", name: "timelockSeconds", type: "uint32" },
417
+ { internalType: "uint16", name: "initialUnlockBps", type: "uint16" },
418
+ { internalType: "uint16", name: "cliffAmountBps", type: "uint16" },
419
+ { internalType: "bool", name: "isRevocable", type: "bool" }
420
+ ],
421
+ internalType: "struct IConfidentialVestingManagerTypes.VestingParams[]",
422
+ name: "params",
423
+ type: "tuple[]"
424
+ },
425
+ { internalType: "externalEuint64[]", name: "encryptedAmounts", type: "bytes32[]" },
426
+ { internalType: "bytes", name: "inputProof", type: "bytes" }
427
+ ],
428
+ name: "batchCreateVesting",
429
+ outputs: [{ internalType: "bytes32[]", name: "vestingIds", type: "bytes32[]" }],
430
+ stateMutability: "nonpayable",
431
+ type: "function"
432
+ },
433
+ {
434
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
435
+ name: "claim",
436
+ outputs: [],
437
+ stateMutability: "payable",
438
+ type: "function"
439
+ },
440
+ {
441
+ inputs: [
442
+ {
443
+ components: [
444
+ { internalType: "address", name: "recipient", type: "address" },
445
+ { internalType: "uint32", name: "startTimestamp", type: "uint32" },
446
+ { internalType: "uint32", name: "endTimestamp", type: "uint32" },
447
+ { internalType: "uint32", name: "cliffSeconds", type: "uint32" },
448
+ { internalType: "uint32", name: "releaseIntervalSecs", type: "uint32" },
449
+ { internalType: "uint32", name: "timelockSeconds", type: "uint32" },
450
+ { internalType: "uint16", name: "initialUnlockBps", type: "uint16" },
451
+ { internalType: "uint16", name: "cliffAmountBps", type: "uint16" },
452
+ { internalType: "bool", name: "isRevocable", type: "bool" }
453
+ ],
454
+ internalType: "struct IConfidentialVestingManagerTypes.VestingParams",
455
+ name: "params",
456
+ type: "tuple"
457
+ },
458
+ { internalType: "externalEuint64", name: "encryptedAmount", type: "bytes32" },
459
+ { internalType: "bytes", name: "inputProof", type: "bytes" }
460
+ ],
461
+ name: "createVesting",
462
+ outputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
463
+ stateMutability: "nonpayable",
464
+ type: "function"
465
+ },
466
+ {
467
+ inputs: [],
468
+ name: "extensionAddress",
469
+ outputs: [{ internalType: "address", name: "", type: "address" }],
470
+ stateMutability: "view",
471
+ type: "function"
472
+ },
473
+ {
474
+ inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
475
+ name: "getRoleAdmin",
476
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
477
+ stateMutability: "view",
478
+ type: "function"
479
+ },
480
+ {
481
+ inputs: [
482
+ { internalType: "bytes32", name: "role", type: "bytes32" },
483
+ { internalType: "uint256", name: "index", type: "uint256" }
484
+ ],
485
+ name: "getRoleMember",
486
+ outputs: [{ internalType: "address", name: "", type: "address" }],
487
+ stateMutability: "view",
488
+ type: "function"
489
+ },
490
+ {
491
+ inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
492
+ name: "getRoleMemberCount",
493
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
494
+ stateMutability: "view",
495
+ type: "function"
496
+ },
497
+ {
498
+ inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
499
+ name: "getRoleMembers",
500
+ outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
501
+ stateMutability: "view",
502
+ type: "function"
503
+ },
504
+ {
505
+ inputs: [
506
+ { internalType: "bytes32", name: "role", type: "bytes32" },
507
+ { internalType: "address", name: "account", type: "address" }
508
+ ],
509
+ name: "grantRole",
510
+ outputs: [],
511
+ stateMutability: "nonpayable",
512
+ type: "function"
513
+ },
514
+ {
515
+ inputs: [
516
+ { internalType: "bytes32", name: "role", type: "bytes32" },
517
+ { internalType: "address", name: "account", type: "address" }
518
+ ],
519
+ name: "hasRole",
520
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
521
+ stateMutability: "view",
522
+ type: "function"
523
+ },
524
+ {
525
+ inputs: [
526
+ { internalType: "address", name: "admin", type: "address" },
527
+ { internalType: "address", name: "feeCollector", type: "address" }
528
+ ],
529
+ name: "initialize",
530
+ outputs: [],
531
+ stateMutability: "nonpayable",
532
+ type: "function"
533
+ },
534
+ {
535
+ inputs: [
536
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
537
+ { internalType: "externalEuint64", name: "encryptedAmount", type: "bytes32" },
538
+ { internalType: "bytes", name: "inputProof", type: "bytes" }
539
+ ],
540
+ name: "partialClaim",
541
+ outputs: [],
542
+ stateMutability: "payable",
543
+ type: "function"
544
+ },
545
+ {
546
+ inputs: [],
547
+ name: "paused",
548
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
549
+ stateMutability: "view",
550
+ type: "function"
551
+ },
552
+ {
553
+ inputs: [
554
+ { internalType: "bytes32", name: "role", type: "bytes32" },
555
+ { internalType: "address", name: "callerConfirmation", type: "address" }
556
+ ],
557
+ name: "renounceRole",
558
+ outputs: [],
559
+ stateMutability: "nonpayable",
560
+ type: "function"
561
+ },
562
+ {
563
+ inputs: [
564
+ { internalType: "bytes32", name: "role", type: "bytes32" },
565
+ { internalType: "address", name: "account", type: "address" }
566
+ ],
567
+ name: "revokeRole",
568
+ outputs: [],
569
+ stateMutability: "nonpayable",
570
+ type: "function"
571
+ },
572
+ {
573
+ inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
574
+ name: "supportsInterface",
575
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
576
+ stateMutability: "view",
577
+ type: "function"
578
+ },
579
+ { stateMutability: "payable", type: "receive" },
580
+ {
581
+ inputs: [{ internalType: "address", name: "token", type: "address" }],
582
+ name: "SafeERC20FailedOperation",
583
+ type: "error"
584
+ },
585
+ {
586
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
587
+ name: "acceptVestingTransfer",
588
+ outputs: [],
589
+ stateMutability: "nonpayable",
590
+ type: "function"
591
+ },
592
+ {
593
+ inputs: [
594
+ { internalType: "bytes32[]", name: "vestingIds", type: "bytes32[]" },
595
+ {
596
+ internalType: "enum IConfidentialVestingManagerTypes.DisclosureType[]",
597
+ name: "disclosureTypes",
598
+ type: "uint8[]"
599
+ },
600
+ { internalType: "address", name: "party", type: "address" }
601
+ ],
602
+ name: "adminBatchDiscloseToParty",
603
+ outputs: [{ internalType: "euint128[]", name: "", type: "bytes32[]" }],
604
+ stateMutability: "nonpayable",
605
+ type: "function"
606
+ },
607
+ {
608
+ inputs: [
609
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
610
+ { internalType: "address", name: "party", type: "address" },
611
+ {
612
+ internalType: "enum IConfidentialVestingManagerTypes.DisclosureType",
613
+ name: "disclosureType",
614
+ type: "uint8"
615
+ }
616
+ ],
617
+ name: "adminDiscloseToParty",
618
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
619
+ stateMutability: "nonpayable",
620
+ type: "function"
621
+ },
622
+ {
623
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
624
+ name: "adminGetClaimableAmount",
625
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
626
+ stateMutability: "nonpayable",
627
+ type: "function"
628
+ },
629
+ {
630
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
631
+ name: "adminGetSettledAmount",
632
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
633
+ stateMutability: "nonpayable",
634
+ type: "function"
635
+ },
636
+ {
637
+ inputs: [],
638
+ name: "adminGetTokenBalance",
639
+ outputs: [{ internalType: "euint64", name: "", type: "bytes32" }],
640
+ stateMutability: "nonpayable",
641
+ type: "function"
642
+ },
643
+ {
644
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
645
+ name: "adminGetTotalAllocation",
646
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
647
+ stateMutability: "nonpayable",
648
+ type: "function"
649
+ },
650
+ {
651
+ inputs: [
652
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
653
+ { internalType: "uint48", name: "timestamp", type: "uint48" }
654
+ ],
655
+ name: "adminGetVestedAmount",
656
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
657
+ stateMutability: "nonpayable",
658
+ type: "function"
659
+ },
660
+ {
661
+ inputs: [
662
+ { internalType: "euint128[]", name: "handles", type: "bytes32[]" },
663
+ { internalType: "address", name: "party", type: "address" }
664
+ ],
665
+ name: "batchDiscloseHandlesToParty",
666
+ outputs: [],
667
+ stateMutability: "nonpayable",
668
+ type: "function"
669
+ },
670
+ {
671
+ inputs: [
672
+ { internalType: "bytes32[]", name: "vestingIds", type: "bytes32[]" },
673
+ {
674
+ internalType: "enum IConfidentialVestingManagerTypes.DisclosureType[]",
675
+ name: "disclosureTypes",
676
+ type: "uint8[]"
677
+ },
678
+ { internalType: "address", name: "party", type: "address" }
679
+ ],
680
+ name: "batchDiscloseToParty",
681
+ outputs: [{ internalType: "euint128[]", name: "", type: "bytes32[]" }],
682
+ stateMutability: "nonpayable",
683
+ type: "function"
684
+ },
685
+ {
686
+ inputs: [{ internalType: "bytes32[]", name: "vestingIds", type: "bytes32[]" }],
687
+ name: "batchRevokeVesting",
688
+ outputs: [],
689
+ stateMutability: "nonpayable",
690
+ type: "function"
691
+ },
692
+ {
693
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
694
+ name: "cancelVestingTransfer",
695
+ outputs: [],
696
+ stateMutability: "nonpayable",
697
+ type: "function"
698
+ },
699
+ {
700
+ inputs: [
701
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
702
+ { internalType: "address", name: "newOwner", type: "address" }
703
+ ],
704
+ name: "directVestingTransfer",
705
+ outputs: [],
706
+ stateMutability: "nonpayable",
707
+ type: "function"
708
+ },
709
+ {
710
+ inputs: [
711
+ { internalType: "euint128", name: "handle", type: "bytes32" },
712
+ { internalType: "address", name: "party", type: "address" }
713
+ ],
714
+ name: "discloseHandleToParty",
715
+ outputs: [],
716
+ stateMutability: "nonpayable",
717
+ type: "function"
718
+ },
719
+ {
720
+ inputs: [
721
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
722
+ { internalType: "address", name: "party", type: "address" },
723
+ {
724
+ internalType: "enum IConfidentialVestingManagerTypes.DisclosureType",
725
+ name: "disclosureType",
726
+ type: "uint8"
727
+ }
728
+ ],
729
+ name: "discloseToParty",
730
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
731
+ stateMutability: "nonpayable",
732
+ type: "function"
733
+ },
734
+ {
735
+ inputs: [{ internalType: "address", name: "recipient", type: "address" }],
736
+ name: "getAllRecipientVestings",
737
+ outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }],
738
+ stateMutability: "view",
739
+ type: "function"
740
+ },
741
+ {
742
+ inputs: [{ internalType: "address", name: "recipient", type: "address" }],
743
+ name: "getAllRecipientVestingsLength",
744
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
745
+ stateMutability: "view",
746
+ type: "function"
747
+ },
748
+ {
749
+ inputs: [
750
+ { internalType: "address", name: "recipient", type: "address" },
751
+ { internalType: "uint256", name: "start", type: "uint256" },
752
+ { internalType: "uint256", name: "end", type: "uint256" }
753
+ ],
754
+ name: "getAllRecipientVestingsSliced",
755
+ outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }],
756
+ stateMutability: "view",
757
+ type: "function"
758
+ },
759
+ {
760
+ inputs: [],
761
+ name: "getAllRecipients",
762
+ outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
763
+ stateMutability: "view",
764
+ type: "function"
765
+ },
766
+ {
767
+ inputs: [],
768
+ name: "getAllRecipientsLength",
769
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
770
+ stateMutability: "view",
771
+ type: "function"
772
+ },
773
+ {
774
+ inputs: [
775
+ { internalType: "uint256", name: "start", type: "uint256" },
776
+ { internalType: "uint256", name: "end", type: "uint256" }
777
+ ],
778
+ name: "getAllRecipientsSliced",
779
+ outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
780
+ stateMutability: "view",
781
+ type: "function"
782
+ },
783
+ {
784
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
785
+ name: "getClaimableAmount",
786
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
787
+ stateMutability: "nonpayable",
788
+ type: "function"
789
+ },
790
+ {
791
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
792
+ name: "getPendingVestingTransfer",
793
+ outputs: [
794
+ { internalType: "address", name: "newRecipient", type: "address" },
795
+ { internalType: "uint48", name: "initiatedAt", type: "uint48" },
796
+ { internalType: "uint48", name: "expiresAt", type: "uint48" }
797
+ ],
798
+ stateMutability: "view",
799
+ type: "function"
800
+ },
801
+ {
802
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
803
+ name: "getSettledAmount",
804
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
805
+ stateMutability: "nonpayable",
806
+ type: "function"
807
+ },
808
+ {
809
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
810
+ name: "getTotalAllocation",
811
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
812
+ stateMutability: "nonpayable",
813
+ type: "function"
814
+ },
815
+ {
816
+ inputs: [
817
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
818
+ { internalType: "uint48", name: "timestamp", type: "uint48" }
819
+ ],
820
+ name: "getVestedAmount",
821
+ outputs: [{ internalType: "euint128", name: "", type: "bytes32" }],
822
+ stateMutability: "nonpayable",
823
+ type: "function"
824
+ },
825
+ {
826
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
827
+ name: "getVestingInfo",
828
+ outputs: [
829
+ {
830
+ components: [
831
+ { internalType: "address", name: "recipient", type: "address" },
832
+ { internalType: "uint32", name: "startTimestamp", type: "uint32" },
833
+ { internalType: "uint32", name: "endTimestamp", type: "uint32" },
834
+ { internalType: "uint32", name: "revokeTimestamp", type: "uint32" },
835
+ { internalType: "uint32", name: "cliffReleaseTimestamp", type: "uint32" },
836
+ { internalType: "uint32", name: "releaseIntervalSecs", type: "uint32" },
837
+ { internalType: "uint32", name: "timelock", type: "uint32" },
838
+ { internalType: "uint16", name: "initialUnlockBps", type: "uint16" },
839
+ { internalType: "uint16", name: "cliffAmountBps", type: "uint16" },
840
+ { internalType: "bool", name: "isRevocable", type: "bool" }
841
+ ],
842
+ internalType: "struct IConfidentialVestingManagerTypes.VestingInfo",
843
+ name: "",
844
+ type: "tuple"
845
+ }
846
+ ],
847
+ stateMutability: "view",
848
+ type: "function"
849
+ },
850
+ {
851
+ inputs: [
852
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
853
+ { internalType: "address", name: "newRecipient", type: "address" },
854
+ { internalType: "uint48", name: "transferDurationSeconds", type: "uint48" }
855
+ ],
856
+ name: "initiateVestingTransfer",
857
+ outputs: [],
858
+ stateMutability: "nonpayable",
859
+ type: "function"
860
+ },
861
+ {
862
+ inputs: [],
863
+ name: "isPausable",
864
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
865
+ stateMutability: "view",
866
+ type: "function"
867
+ },
868
+ {
869
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
870
+ name: "isRecipient",
871
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
872
+ stateMutability: "view",
873
+ type: "function"
874
+ },
875
+ {
876
+ inputs: [],
877
+ name: "isSplitEnabled",
878
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
879
+ stateMutability: "view",
880
+ type: "function"
881
+ },
882
+ {
883
+ inputs: [],
884
+ name: "maxBatchSize",
885
+ outputs: [{ internalType: "uint64", name: "", type: "uint64" }],
886
+ stateMutability: "view",
887
+ type: "function"
888
+ },
889
+ {
890
+ inputs: [],
891
+ name: "maxRevokeBatchSize",
892
+ outputs: [{ internalType: "uint64", name: "", type: "uint64" }],
893
+ stateMutability: "view",
894
+ type: "function"
895
+ },
896
+ { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" },
897
+ {
898
+ inputs: [{ internalType: "bytes32", name: "vestingId", type: "bytes32" }],
899
+ name: "revokeVesting",
900
+ outputs: [],
901
+ stateMutability: "nonpayable",
902
+ type: "function"
903
+ },
904
+ {
905
+ inputs: [{ internalType: "uint64", name: "newMax", type: "uint64" }],
906
+ name: "setMaxBatchSize",
907
+ outputs: [],
908
+ stateMutability: "nonpayable",
909
+ type: "function"
910
+ },
911
+ {
912
+ inputs: [{ internalType: "uint64", name: "newMax", type: "uint64" }],
913
+ name: "setMaxRevokeBatchSize",
914
+ outputs: [],
915
+ stateMutability: "nonpayable",
916
+ type: "function"
917
+ },
918
+ {
919
+ inputs: [
920
+ { internalType: "bytes32", name: "vestingId", type: "bytes32" },
921
+ { internalType: "externalEuint64", name: "encryptedNumerator", type: "bytes32" },
922
+ { internalType: "bytes", name: "inputProof", type: "bytes" },
923
+ { internalType: "uint128", name: "denominator", type: "uint128" },
924
+ { internalType: "address", name: "newRecipient", type: "address" }
925
+ ],
926
+ name: "splitVesting",
927
+ outputs: [{ internalType: "bytes32", name: "newVestingId", type: "bytes32" }],
928
+ stateMutability: "nonpayable",
929
+ type: "function"
930
+ },
931
+ {
932
+ inputs: [{ internalType: "address", name: "newCollector", type: "address" }],
933
+ name: "transferFeeCollectorRole",
934
+ outputs: [],
935
+ stateMutability: "nonpayable",
936
+ type: "function"
937
+ },
938
+ { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" },
939
+ {
940
+ inputs: [
941
+ { internalType: "externalEuint64", name: "encryptedAmount", type: "bytes32" },
942
+ { internalType: "bytes", name: "inputProof", type: "bytes" }
943
+ ],
944
+ name: "withdrawAdmin",
945
+ outputs: [],
946
+ stateMutability: "nonpayable",
947
+ type: "function"
948
+ },
949
+ {
950
+ inputs: [
951
+ { internalType: "address", name: "to", type: "address" },
952
+ { internalType: "uint256", name: "amount", type: "uint256" }
953
+ ],
954
+ name: "withdrawGasFee",
955
+ outputs: [],
956
+ stateMutability: "nonpayable",
957
+ type: "function"
958
+ },
959
+ {
960
+ inputs: [
961
+ { internalType: "address", name: "token", type: "address" },
962
+ { internalType: "address", name: "to", type: "address" }
963
+ ],
964
+ name: "withdrawOtherConfidentialToken",
965
+ outputs: [],
966
+ stateMutability: "nonpayable",
967
+ type: "function"
968
+ },
969
+ {
970
+ inputs: [
971
+ { internalType: "address", name: "token", type: "address" },
972
+ { internalType: "address", name: "to", type: "address" }
973
+ ],
974
+ name: "withdrawOtherToken",
975
+ outputs: [],
976
+ stateMutability: "nonpayable",
977
+ type: "function"
978
+ },
979
+ {
980
+ inputs: [
981
+ { internalType: "address", name: "to", type: "address" },
982
+ { internalType: "externalEuint64", name: "encryptedAmount", type: "bytes32" },
983
+ { internalType: "bytes", name: "inputProof", type: "bytes" }
984
+ ],
985
+ name: "withdrawTokenFee",
986
+ outputs: [],
987
+ stateMutability: "nonpayable",
988
+ type: "function"
989
+ }
990
+ ];
991
+ function resolveEncryptor(source) {
992
+ if (source === void 0) return void 0;
993
+ return typeof source === "function" ? source() : source;
994
+ }
995
+ var MAX_UINT64 = (1n << 64n) - 1n;
996
+ function assertUint64(value, label) {
997
+ if (value < 0n || value > MAX_UINT64) {
998
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
999
+ method: "encryptUint64",
1000
+ argument: label,
1001
+ reason: `does not fit in uint64 (0..2^64-1)`,
1002
+ value
1003
+ });
1004
+ }
1005
+ }
1006
+ async function encryptUint64({
1007
+ encryptor,
1008
+ contractAddress,
1009
+ userAddress,
1010
+ value
1011
+ }) {
1012
+ assertUint64(value, "value");
1013
+ const { handles, inputProof } = await encryptor.encrypt({
1014
+ values: [{ value, type: "euint64" }],
1015
+ contractAddress,
1016
+ userAddress
1017
+ });
1018
+ if (handles.length !== 1) {
1019
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1020
+ method: "encryptUint64",
1021
+ argument: "handles",
1022
+ reason: `expected 1 handle, got ${handles.length}`,
1023
+ value: handles.length
1024
+ });
1025
+ }
1026
+ return {
1027
+ handle: chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(handles[0])),
1028
+ inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
1029
+ };
1030
+ }
1031
+ async function encryptUint64Batch({
1032
+ encryptor,
1033
+ contractAddress,
1034
+ userAddress,
1035
+ values
1036
+ }) {
1037
+ if (values.length === 0) {
1038
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1039
+ method: "encryptUint64Batch",
1040
+ argument: "values",
1041
+ reason: "must be non-empty"
1042
+ });
1043
+ }
1044
+ values.forEach((v, i) => assertUint64(v, `values[${i}]`));
1045
+ const { handles, inputProof } = await encryptor.encrypt({
1046
+ values: values.map((value) => ({ value, type: "euint64" })),
1047
+ contractAddress,
1048
+ userAddress
1049
+ });
1050
+ if (handles.length !== values.length) {
1051
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1052
+ method: "encryptUint64Batch",
1053
+ argument: "handles",
1054
+ reason: `expected ${values.length} handles, got ${handles.length}`,
1055
+ value: handles.length
1056
+ });
1057
+ }
1058
+ return {
1059
+ handles: handles.map((h) => chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(h))),
1060
+ inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
1061
+ };
1062
+ }
1063
+
1064
+ // src/fhe-vesting/errors.ts
1065
+ var VestingNotFoundError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1066
+ name = "VestingNotFoundError";
1067
+ constructor(args) {
1068
+ super(`${args.method}: no vesting schedule found for ${args.vestingId}.`, {
1069
+ code: "TOKENOPS_VESTING_NOT_FOUND",
1070
+ cause: args.cause,
1071
+ context: {
1072
+ method: args.method,
1073
+ contractAddress: args.contractAddress,
1074
+ vestingId: args.vestingId
1075
+ }
1076
+ });
1077
+ }
1078
+ };
1079
+ var NotVestingRecipientError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1080
+ name = "NotVestingRecipientError";
1081
+ constructor(args) {
1082
+ super(`${args.method}: caller is not the recipient of vesting ${args.vestingId}.`, {
1083
+ code: "TOKENOPS_NOT_RECIPIENT",
1084
+ cause: args.cause,
1085
+ context: {
1086
+ method: args.method,
1087
+ contractAddress: args.contractAddress,
1088
+ vestingId: args.vestingId,
1089
+ caller: args.caller,
1090
+ expectedRecipient: args.expectedRecipient
1091
+ }
1092
+ });
1093
+ }
1094
+ };
1095
+ var ClaimLockedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1096
+ name = "ClaimLockedError";
1097
+ constructor(args) {
1098
+ const detail = args.unlocksAt !== void 0 ? ` Unlocks at unix timestamp ${args.unlocksAt}.` : "";
1099
+ super(`${args.method}: vesting ${args.vestingId} is timelocked.${detail}`, {
1100
+ code: "TOKENOPS_CLAIM_LOCKED",
1101
+ cause: args.cause,
1102
+ context: {
1103
+ method: args.method,
1104
+ contractAddress: args.contractAddress,
1105
+ vestingId: args.vestingId,
1106
+ unlocksAt: args.unlocksAt
1107
+ }
1108
+ });
1109
+ }
1110
+ };
1111
+ var VestingRevokedError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1112
+ name = "VestingRevokedError";
1113
+ constructor(args) {
1114
+ const detail = args.revokedAt !== void 0 ? ` at unix timestamp ${args.revokedAt}` : "";
1115
+ super(`${args.method}: vesting ${args.vestingId} has already been revoked${detail}.`, {
1116
+ code: "TOKENOPS_VESTING_REVOKED",
1117
+ cause: args.cause,
1118
+ context: {
1119
+ method: args.method,
1120
+ contractAddress: args.contractAddress,
1121
+ vestingId: args.vestingId,
1122
+ revokedAt: args.revokedAt
1123
+ }
1124
+ });
1125
+ }
1126
+ };
1127
+ var VestingNotRevocableError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1128
+ name = "VestingNotRevocableError";
1129
+ constructor(args) {
1130
+ super(`${args.method}: vesting ${args.vestingId} was created as non-revocable.`, {
1131
+ code: "TOKENOPS_NOT_REVOCABLE",
1132
+ cause: args.cause,
1133
+ context: {
1134
+ method: args.method,
1135
+ contractAddress: args.contractAddress,
1136
+ vestingId: args.vestingId
1137
+ }
1138
+ });
1139
+ }
1140
+ };
1141
+ var VestingExpiredError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1142
+ name = "VestingExpiredError";
1143
+ constructor(args) {
1144
+ super(`${args.method}: vesting ${args.vestingId} has already ended.`, {
1145
+ code: "TOKENOPS_VESTING_EXPIRED",
1146
+ cause: args.cause,
1147
+ context: {
1148
+ method: args.method,
1149
+ contractAddress: args.contractAddress,
1150
+ vestingId: args.vestingId,
1151
+ endedAt: args.endedAt
1152
+ }
1153
+ });
1154
+ }
1155
+ };
1156
+ var TransferAlreadyPendingError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1157
+ name = "TransferAlreadyPendingError";
1158
+ constructor(args) {
1159
+ super(`${args.method}: a transfer is already pending for vesting ${args.vestingId}.`, {
1160
+ code: "TOKENOPS_TRANSFER_ALREADY_PENDING",
1161
+ cause: args.cause,
1162
+ context: {
1163
+ method: args.method,
1164
+ contractAddress: args.contractAddress,
1165
+ vestingId: args.vestingId,
1166
+ pendingRecipient: args.pendingRecipient,
1167
+ expiresAt: args.expiresAt
1168
+ }
1169
+ });
1170
+ }
1171
+ };
1172
+ var NoPendingTransferError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1173
+ name = "NoPendingTransferError";
1174
+ constructor(args) {
1175
+ super(`${args.method}: no pending transfer for vesting ${args.vestingId}.`, {
1176
+ code: "TOKENOPS_NO_PENDING_TRANSFER",
1177
+ cause: args.cause,
1178
+ context: {
1179
+ method: args.method,
1180
+ contractAddress: args.contractAddress,
1181
+ vestingId: args.vestingId
1182
+ }
1183
+ });
1184
+ }
1185
+ };
1186
+ var NotPendingRecipientError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1187
+ name = "NotPendingRecipientError";
1188
+ constructor(args) {
1189
+ super(`${args.method}: caller is not the pending recipient of vesting ${args.vestingId}.`, {
1190
+ code: "TOKENOPS_NOT_PENDING_RECIPIENT",
1191
+ cause: args.cause,
1192
+ context: {
1193
+ method: args.method,
1194
+ contractAddress: args.contractAddress,
1195
+ vestingId: args.vestingId,
1196
+ caller: args.caller,
1197
+ expectedRecipient: args.expectedRecipient
1198
+ }
1199
+ });
1200
+ }
1201
+ };
1202
+ var TransferExpiredError = class extends chunk56UI7LUR_cjs.TokenOpsSdkError {
1203
+ name = "TransferExpiredError";
1204
+ constructor(args) {
1205
+ super(`${args.method}: pending transfer for vesting ${args.vestingId} has expired.`, {
1206
+ code: "TOKENOPS_TRANSFER_EXPIRED",
1207
+ cause: args.cause,
1208
+ context: {
1209
+ method: args.method,
1210
+ contractAddress: args.contractAddress,
1211
+ vestingId: args.vestingId,
1212
+ expiredAt: args.expiredAt
1213
+ }
1214
+ });
1215
+ }
1216
+ };
1217
+ var vestingProductMapper = (name, _args, ctx) => {
1218
+ const vestingId = ctx.productContext?.["vestingId"] ?? "0x";
1219
+ switch (name) {
1220
+ case "VestingNotFound":
1221
+ return new VestingNotFoundError({ ...ctx, vestingId });
1222
+ case "NotRecipient":
1223
+ return new NotVestingRecipientError({ ...ctx, vestingId });
1224
+ case "ClaimLocked":
1225
+ return new ClaimLockedError({ ...ctx, vestingId });
1226
+ case "VestingAlreadyRevoked":
1227
+ return new VestingRevokedError({ ...ctx, vestingId });
1228
+ case "VestingNotRevocable":
1229
+ return new VestingNotRevocableError({ ...ctx, vestingId });
1230
+ case "VestingEnded":
1231
+ return new VestingExpiredError({ ...ctx, vestingId });
1232
+ case "TransferAlreadyPending":
1233
+ return new TransferAlreadyPendingError({ ...ctx, vestingId });
1234
+ case "NoPendingTransfer":
1235
+ return new NoPendingTransferError({ ...ctx, vestingId });
1236
+ case "NotPendingRecipient":
1237
+ return new NotPendingRecipientError({ ...ctx, vestingId });
1238
+ case "TransferExpired":
1239
+ return new TransferExpiredError({ ...ctx, vestingId });
1240
+ default:
1241
+ return void 0;
1242
+ }
1243
+ };
1244
+ var ConfidentialVestingManagerClient = class {
1245
+ publicClient;
1246
+ walletClient;
1247
+ address;
1248
+ encryptor;
1249
+ #aclAddressOverride;
1250
+ #telemetry;
1251
+ #cachedAclAddress;
1252
+ constructor(config) {
1253
+ this.publicClient = config.publicClient;
1254
+ this.walletClient = config.walletClient;
1255
+ this.address = chunkCQIPRNS7_cjs.normaliseAddress(config.address);
1256
+ this.encryptor = config.encryptor;
1257
+ this.#telemetry = config.telemetry;
1258
+ this.#aclAddressOverride = config.aclAddress;
1259
+ const chainIdForInit = config.publicClient.chain?.id;
1260
+ this.#telemetry?.event("fhe-vesting.client.init", {
1261
+ surface: "manager",
1262
+ chainId: chainIdForInit ?? null,
1263
+ hasWallet: !!this.walletClient,
1264
+ aclResolved: !!config.aclAddress || chainIdForInit !== void 0 && !!chunkQ7ARQSUH_cjs.getFhevmAclAddress(chainIdForInit),
1265
+ sdkVersion: chunkVDXVNZCO_cjs.SDK_VERSION
1266
+ });
1267
+ }
1268
+ /**
1269
+ * The FHEVM ACL contract address used by encrypted-view methods to parse
1270
+ * `ACL.Allowed` events. Resolved lazily on first access; throws
1271
+ * `DeploymentAddressUnavailableError` if no override was passed and the
1272
+ * SDK does not have an ACL deployed for the connected chain.
1273
+ */
1274
+ get aclAddress() {
1275
+ if (this.#cachedAclAddress) return this.#cachedAclAddress;
1276
+ this.#cachedAclAddress = this.#aclAddressOverride ?? chunkQ7ARQSUH_cjs.requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialVestingManagerClient");
1277
+ return this.#cachedAclAddress;
1278
+ }
1279
+ // ============================================================
1280
+ // IMMUTABLE READS
1281
+ // ============================================================
1282
+ /**
1283
+ * Return the ERC-7984 token address this manager clone is bound to.
1284
+ * @returns Checksummed token address.
1285
+ */
1286
+ async token() {
1287
+ return this.#read("TOKEN_ADDRESS");
1288
+ }
1289
+ /**
1290
+ * Return the fee model baked into this clone's immutable args.
1291
+ * @returns `FeeType.Gas` (0) or `FeeType.DistributionToken` (1).
1292
+ */
1293
+ async feeType() {
1294
+ const raw = await this.#read("FEE_TYPE");
1295
+ return raw;
1296
+ }
1297
+ /**
1298
+ * Return the raw fee value baked into this clone's immutable args.
1299
+ * Interpretation depends on `feeType`: wei for `Gas`, basis points for `DistributionToken`.
1300
+ * @returns Fee amount in the unit appropriate for `feeType`.
1301
+ */
1302
+ async fee() {
1303
+ return this.#read("FEE");
1304
+ }
1305
+ /**
1306
+ * Read the manager's fee configuration in one call.
1307
+ *
1308
+ * Both fields are immutable (baked into the clone's bytecode at deploy time), so
1309
+ * consumers should memoize the result for the manager's lifetime.
1310
+ *
1311
+ * @returns `{ feeType, fee }` — feed both into the discriminated
1312
+ * {@link ClaimArgs} union to construct the correct claim shape.
1313
+ * @example
1314
+ * const { feeType, fee } = await manager.getFeeInfo();
1315
+ * await manager.claim(
1316
+ * feeType === FeeType.Gas
1317
+ * ? { feeType, vestingId, value: fee }
1318
+ * : { feeType, vestingId },
1319
+ * );
1320
+ */
1321
+ async getFeeInfo() {
1322
+ const [feeType, fee] = await Promise.all([this.feeType(), this.fee()]);
1323
+ return { feeType, fee };
1324
+ }
1325
+ /**
1326
+ * Return the block number at which this clone was deployed.
1327
+ * Used for event log scanning — start from this block to avoid scanning from genesis.
1328
+ * @returns Block number as `bigint`.
1329
+ */
1330
+ async deploymentBlockNumber() {
1331
+ return this.#read("DEPLOYMENT_BLOCK_NUMBER");
1332
+ }
1333
+ /**
1334
+ * Return whether `splitVesting` is enabled on this clone.
1335
+ * @returns `true` if the split feature is enabled.
1336
+ */
1337
+ async isSplitEnabled() {
1338
+ return this.#read("isSplitEnabled");
1339
+ }
1340
+ /**
1341
+ * Return whether this clone supports pause/unpause.
1342
+ * @returns `true` if the clone is pausable.
1343
+ */
1344
+ async isPausable() {
1345
+ return this.#read("isPausable");
1346
+ }
1347
+ /**
1348
+ * Return the current pause state. Always `false` for non-pausable clones.
1349
+ * @returns `true` if the manager is paused and claims are blocked.
1350
+ */
1351
+ async paused() {
1352
+ return this.#read("paused");
1353
+ }
1354
+ /**
1355
+ * Return the maximum number of vesting schedules allowed in a single `batchCreateVesting` call.
1356
+ * @returns Batch size limit as `bigint`.
1357
+ */
1358
+ async maxBatchSize() {
1359
+ return this.#read("maxBatchSize");
1360
+ }
1361
+ /**
1362
+ * Return the maximum number of vesting ids allowed in a single `batchRevokeVesting` call.
1363
+ * @returns Revoke batch size limit as `bigint`.
1364
+ */
1365
+ async maxRevokeBatchSize() {
1366
+ return this.#read("maxRevokeBatchSize");
1367
+ }
1368
+ // ============================================================
1369
+ // VESTING VIEWS
1370
+ // ============================================================
1371
+ /**
1372
+ * Return metadata for a vesting schedule. Returns a zero-struct when `vestingId` does not exist.
1373
+ * @param vestingId The `bytes32` vesting schedule ID from the `VestingCreated` event.
1374
+ * @returns `VestingInfo` struct; `startTimestamp === 0` means the schedule does not exist.
1375
+ * @example
1376
+ * const info = await manager.getVestingInfo(vestingId);
1377
+ * if (info.startTimestamp === 0) throw new Error("vesting not found");
1378
+ */
1379
+ async getVestingInfo(vestingId) {
1380
+ const raw = await this.#read("getVestingInfo", [vestingId]);
1381
+ return raw;
1382
+ }
1383
+ /**
1384
+ * Return all recipient addresses that have at least one vesting schedule on this manager.
1385
+ * @returns Array of checksummed addresses; may be large — use `getAllRecipientsSliced` for pagination.
1386
+ */
1387
+ async getAllRecipients() {
1388
+ return this.#read("getAllRecipients");
1389
+ }
1390
+ /**
1391
+ * Return the total number of unique recipients on this manager.
1392
+ * @returns Count as `bigint`.
1393
+ */
1394
+ async getAllRecipientsLength() {
1395
+ return this.#read("getAllRecipientsLength");
1396
+ }
1397
+ /**
1398
+ * Slice of `getAllRecipients`, half-open `[start, end)`.
1399
+ *
1400
+ * Accepts `bigint | number` for `start` / `end` for ergonomics on read paths
1401
+ * — CI scripts typically derive these from `Number(process.env.X)` and
1402
+ * forcing bigint coercion at the call site is a pure paper cut. The
1403
+ * underlying contract reads through unchanged (viem coerces). R22
1404
+ * devops-integrator MINOR-4; R25 close.
1405
+ */
1406
+ async getAllRecipientsSliced(start, end) {
1407
+ return this.#read("getAllRecipientsSliced", [BigInt(start), BigInt(end)]);
1408
+ }
1409
+ /**
1410
+ * Return whether `account` has at least one vesting schedule on this manager.
1411
+ * @param account Address to check.
1412
+ * @returns `true` if the account is a known recipient.
1413
+ */
1414
+ async isRecipient(account) {
1415
+ return this.#read("isRecipient", [account]);
1416
+ }
1417
+ /**
1418
+ * Return all vesting schedule IDs for `recipient`.
1419
+ * @param recipient Address of the vesting recipient.
1420
+ * @returns Array of `bytes32` vesting IDs; may be large — use `getAllRecipientVestingsSliced` for pagination.
1421
+ */
1422
+ async getAllRecipientVestings(recipient) {
1423
+ return this.#read("getAllRecipientVestings", [recipient]);
1424
+ }
1425
+ /**
1426
+ * Return the number of vesting schedules for `recipient`.
1427
+ * @param recipient Address of the vesting recipient.
1428
+ * @returns Count as `bigint`.
1429
+ */
1430
+ async getAllRecipientVestingsLength(recipient) {
1431
+ return this.#read("getAllRecipientVestingsLength", [recipient]);
1432
+ }
1433
+ /**
1434
+ * Slice of `getAllRecipientVestings(recipient)`, half-open `[start, end)`.
1435
+ * See {@link getAllRecipientsSliced} for the bigint-permissiveness rationale.
1436
+ */
1437
+ async getAllRecipientVestingsSliced(recipient, start, end) {
1438
+ return this.#read("getAllRecipientVestingsSliced", [recipient, BigInt(start), BigInt(end)]);
1439
+ }
1440
+ /**
1441
+ * Return the pending transfer details for a vesting schedule.
1442
+ * @param vestingId The `bytes32` vesting schedule ID.
1443
+ * @returns `{ newRecipient, initiatedAt, expiresAt }` — all zero if no transfer is pending.
1444
+ */
1445
+ async getPendingVestingTransfer(vestingId) {
1446
+ const [newRecipient, initiatedAt, expiresAt] = await this.#read(
1447
+ "getPendingVestingTransfer",
1448
+ [vestingId]
1449
+ );
1450
+ return { newRecipient, initiatedAt, expiresAt };
1451
+ }
1452
+ // ============================================================
1453
+ // PREFLIGHT
1454
+ // ============================================================
1455
+ /**
1456
+ * Read-only preflight for {@link claim}. Runs the deterministic-from-off-chain
1457
+ * checks in parallel and reports any blockers as typed {@link TokenOpsSdkError}s.
1458
+ * Returns `{ ready: true, blockers: [] }` when the claim is safe to submit.
1459
+ *
1460
+ * Preflight is **opt-in**. Consumers who have already validated state can
1461
+ * skip this call and invoke `claim` directly — they'll receive the same
1462
+ * typed errors at write time via the revert mapper.
1463
+ *
1464
+ * Checks performed (all read-only, no gas):
1465
+ * - Recipient match: `vestingInfo.recipient === caller`.
1466
+ * - Schedule exists: `getVestingInfo` returns a non-zero startTimestamp.
1467
+ * - Timelock elapsed: `block.timestamp ≥ startTimestamp + timelock`.
1468
+ * - Manager is not paused (only when the clone has pause enabled).
1469
+ * - ETH balance covers the gas fee (only when `feeType === FeeType.Gas`).
1470
+ *
1471
+ * Stochastic failures (FHE handle invalidation between read and write, ACL
1472
+ * race conditions) cannot be detected off-chain and still surface as
1473
+ * typed errors via the revert mapper.
1474
+ *
1475
+ * @returns `{ ready, blockers }` — same `code` shape as the write would throw.
1476
+ */
1477
+ async preflightClaim(args) {
1478
+ const blockers = [];
1479
+ const [info, isPausable, currentBlock, feeInfo, callerBalance] = await Promise.all([
1480
+ this.getVestingInfo(args.vestingId),
1481
+ this.isPausable(),
1482
+ this.publicClient.getBlock(),
1483
+ this.getFeeInfo(),
1484
+ this.publicClient.getBalance({ address: args.caller })
1485
+ ]);
1486
+ const paused = isPausable ? await this.paused() : false;
1487
+ if (info.startTimestamp === 0) {
1488
+ blockers.push(
1489
+ new VestingNotFoundError({
1490
+ method: "claim",
1491
+ contractAddress: this.address,
1492
+ vestingId: args.vestingId
1493
+ })
1494
+ );
1495
+ return { ready: false, blockers };
1496
+ }
1497
+ if (info.recipient.toLowerCase() !== args.caller.toLowerCase()) {
1498
+ blockers.push(
1499
+ new NotVestingRecipientError({
1500
+ method: "claim",
1501
+ contractAddress: this.address,
1502
+ vestingId: args.vestingId,
1503
+ caller: args.caller,
1504
+ expectedRecipient: info.recipient
1505
+ })
1506
+ );
1507
+ }
1508
+ const unlocksAt = info.startTimestamp + info.timelock;
1509
+ if (Number(currentBlock.timestamp) < unlocksAt) {
1510
+ blockers.push(
1511
+ new ClaimLockedError({
1512
+ method: "claim",
1513
+ contractAddress: this.address,
1514
+ vestingId: args.vestingId,
1515
+ unlocksAt
1516
+ })
1517
+ );
1518
+ }
1519
+ if (paused) {
1520
+ blockers.push(new chunk56UI7LUR_cjs.PausedError({ method: "claim", contractAddress: this.address }));
1521
+ }
1522
+ if (feeInfo.feeType === 0 /* Gas */ && callerBalance < feeInfo.fee) {
1523
+ blockers.push(
1524
+ new chunk56UI7LUR_cjs.InsufficientFeeError({
1525
+ method: "claim",
1526
+ contractAddress: this.address,
1527
+ feeKind: "gas",
1528
+ required: feeInfo.fee,
1529
+ provided: callerBalance
1530
+ })
1531
+ );
1532
+ }
1533
+ return { ready: blockers.length === 0, blockers };
1534
+ }
1535
+ // ============================================================
1536
+ // ENCRYPTED VIEWS (TX)
1537
+ // ============================================================
1538
+ //
1539
+ // These contract functions perform `FHE.allow(handle, msg.sender)` so they
1540
+ // mutate ACL state and must run as transactions. We simulate first to lift
1541
+ // the returned handle out of calldata, then submit the tx to persist ACL.
1542
+ /**
1543
+ * Get the vested amount at a given timestamp as an encrypted handle.
1544
+ *
1545
+ * Submits a transaction that calls `FHE.allow(handle, msg.sender)` — the handle
1546
+ * is extracted from the receipt's ACL `Allowed` event, not from simulation. Pass
1547
+ * `handle` to the Zama relayer's `userDecrypt` to obtain the plaintext.
1548
+ *
1549
+ * @param args.timestamp Unix timestamp to evaluate vesting at (use `Date.now() / 1000` for current).
1550
+ * @returns `{ handle, hash }` — `handle` is a `euint128` granted to the caller.
1551
+ */
1552
+ async getVestedAmount(args) {
1553
+ return this.#encryptedView("getVestedAmount", [args.vestingId, args.timestamp], args.account);
1554
+ }
1555
+ /**
1556
+ * Get the currently claimable token amount as an encrypted handle.
1557
+ *
1558
+ * Like all encrypted view methods, this submits a transaction. Pass `handle`
1559
+ * to the Zama relayer's `userDecrypt` to obtain the plaintext.
1560
+ *
1561
+ * @returns `{ handle, hash }` — `handle` is a `euint128` granted to the caller.
1562
+ */
1563
+ async getClaimableAmount(args) {
1564
+ return this.#encryptedView("getClaimableAmount", [args.vestingId], args.account);
1565
+ }
1566
+ async getTotalAllocation(args) {
1567
+ return this.#encryptedView("getTotalAllocation", [args.vestingId], args.account);
1568
+ }
1569
+ async getSettledAmount(args) {
1570
+ return this.#encryptedView("getSettledAmount", [args.vestingId], args.account);
1571
+ }
1572
+ async adminGetVestedAmount(args) {
1573
+ return this.#encryptedView(
1574
+ "adminGetVestedAmount",
1575
+ [args.vestingId, args.timestamp],
1576
+ args.account
1577
+ );
1578
+ }
1579
+ async adminGetClaimableAmount(args) {
1580
+ return this.#encryptedView("adminGetClaimableAmount", [args.vestingId], args.account);
1581
+ }
1582
+ async adminGetTotalAllocation(args) {
1583
+ return this.#encryptedView("adminGetTotalAllocation", [args.vestingId], args.account);
1584
+ }
1585
+ async adminGetSettledAmount(args) {
1586
+ return this.#encryptedView("adminGetSettledAmount", [args.vestingId], args.account);
1587
+ }
1588
+ async adminGetTokenBalance(args) {
1589
+ return this.#encryptedView("adminGetTokenBalance", [], args?.account);
1590
+ }
1591
+ // ============================================================
1592
+ // VESTING WRITES
1593
+ // ============================================================
1594
+ /**
1595
+ * Create a single vesting schedule. The SDK encrypts `amount` into an
1596
+ * `externalEuint64` and submits it as the input proof — callers pass plaintext.
1597
+ *
1598
+ * Pass `encryptedInput` to bypass the encryptor when you manage encryption yourself.
1599
+ *
1600
+ * @returns Transaction hash. Parse the `VestingCreated` event to extract the `vestingId`.
1601
+ * @example
1602
+ * const hash = await manager.createVesting({
1603
+ * params: { recipient, startTimestamp, endTimestamp, cliffSeconds: 0,
1604
+ * releaseIntervalSecs: 86400, timelockSeconds: 0,
1605
+ * initialUnlockBps: 0, cliffAmountBps: 0, isRevocable: false },
1606
+ * amount: 1_000_000n,
1607
+ * });
1608
+ */
1609
+ async createVesting(args) {
1610
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.createVesting", async () => {
1611
+ const wallet = this.#requireWallet("createVesting");
1612
+ const account = this.#resolveAccount(wallet, args.account, "createVesting");
1613
+ this.#validateVestingParams(args.params, "createVesting");
1614
+ const encrypted = await this.#resolveEncryptedAmount({
1615
+ amount: args.amount,
1616
+ encryptedInput: args.encryptedInput,
1617
+ encryptor: args.encryptor,
1618
+ method: "createVesting",
1619
+ account
1620
+ });
1621
+ try {
1622
+ return await wallet.writeContract({
1623
+ address: this.address,
1624
+ abi: confidentialVestingManagerAbi,
1625
+ functionName: "createVesting",
1626
+ args: [args.params, encrypted.handle, encrypted.inputProof],
1627
+ account,
1628
+ chain: wallet.chain
1629
+ });
1630
+ } catch (err) {
1631
+ throw this.#mapRevert("createVesting", err, void 0, accountAddress(account));
1632
+ }
1633
+ });
1634
+ }
1635
+ /**
1636
+ * Batch-create vesting schedules. All amounts are encrypted together under a
1637
+ * single input proof, saving gas vs. multiple `createVesting` calls.
1638
+ *
1639
+ * Respects `maxBatchSize` — check before calling on large lists.
1640
+ *
1641
+ * @returns Transaction hash.
1642
+ */
1643
+ async batchCreateVesting(args) {
1644
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.batchCreateVesting", async () => {
1645
+ if (args.items.length === 0) {
1646
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1647
+ method: "batchCreateVesting",
1648
+ argument: "items",
1649
+ reason: "must be non-empty"
1650
+ });
1651
+ }
1652
+ args.items.forEach(
1653
+ (it, i) => this.#validateVestingParams(it.params, `batchCreateVesting.items[${i}].params`)
1654
+ );
1655
+ const wallet = this.#requireWallet("batchCreateVesting");
1656
+ const account = this.#resolveAccount(wallet, args.account, "batchCreateVesting");
1657
+ const encryptor = args.encryptor ?? resolveEncryptor(this.encryptor);
1658
+ if (!encryptor) {
1659
+ throw new chunk56UI7LUR_cjs.MissingEncryptorError("batchCreateVesting");
1660
+ }
1661
+ const userAddress = accountAddress(account);
1662
+ let batch;
1663
+ try {
1664
+ batch = await encryptUint64Batch({
1665
+ encryptor,
1666
+ contractAddress: this.address,
1667
+ userAddress,
1668
+ values: args.items.map((it) => it.amount)
1669
+ });
1670
+ } catch (err) {
1671
+ throw chunkNS44KBV5_cjs.mapZamaError(err, { method: "batchCreateVesting", operation: "encrypt" });
1672
+ }
1673
+ try {
1674
+ return await wallet.writeContract({
1675
+ address: this.address,
1676
+ abi: confidentialVestingManagerAbi,
1677
+ functionName: "batchCreateVesting",
1678
+ // handles[i] corresponds to items[i] — order must be preserved
1679
+ args: [args.items.map((it) => it.params), batch.handles, batch.inputProof],
1680
+ account,
1681
+ chain: wallet.chain
1682
+ });
1683
+ } catch (err) {
1684
+ throw this.#mapRevert("batchCreateVesting", err, void 0, userAddress);
1685
+ }
1686
+ });
1687
+ }
1688
+ /**
1689
+ * Claim all currently vested tokens for `vestingId`.
1690
+ * For `FeeType.Gas` managers, pass `value` (gas fee in wei from `getFeeInfo()`).
1691
+ * @param args Discriminated by `feeType`: pass `{ feeType, vestingId, value }` for Gas, `{ feeType, vestingId }` for DistributionToken.
1692
+ * @returns Transaction hash.
1693
+ * @example
1694
+ * const { feeType, fee } = await manager.getFeeInfo();
1695
+ * const hash = await manager.claim(
1696
+ * feeType === FeeType.Gas ? { feeType, vestingId, value: fee } : { feeType, vestingId },
1697
+ * );
1698
+ */
1699
+ async claim(args) {
1700
+ const wallet = this.#requireWallet("claim");
1701
+ const account = this.#resolveAccount(wallet, args.account, "claim");
1702
+ try {
1703
+ return await wallet.writeContract({
1704
+ address: this.address,
1705
+ abi: confidentialVestingManagerAbi,
1706
+ functionName: "claim",
1707
+ args: [args.vestingId],
1708
+ account,
1709
+ chain: wallet.chain,
1710
+ value: args.value
1711
+ });
1712
+ } catch (err) {
1713
+ throw this.#mapRevert("claim", err, { vestingId: args.vestingId }, accountAddress(account));
1714
+ }
1715
+ }
1716
+ /**
1717
+ * Admin variant of `claim` — callable by the manager admin on behalf of any recipient.
1718
+ * Useful for gas-sponsored claim flows. Same fee rules as `claim`.
1719
+ * @param args Same discriminated union as `claim`.
1720
+ * @returns Transaction hash.
1721
+ */
1722
+ async adminClaim(args) {
1723
+ const wallet = this.#requireWallet("adminClaim");
1724
+ const account = this.#resolveAccount(wallet, args.account, "adminClaim");
1725
+ try {
1726
+ return await wallet.writeContract({
1727
+ address: this.address,
1728
+ abi: confidentialVestingManagerAbi,
1729
+ functionName: "adminClaim",
1730
+ args: [args.vestingId],
1731
+ account,
1732
+ chain: wallet.chain,
1733
+ value: args.value
1734
+ });
1735
+ } catch (err) {
1736
+ throw this.#mapRevert(
1737
+ "adminClaim",
1738
+ err,
1739
+ { vestingId: args.vestingId },
1740
+ accountAddress(account)
1741
+ );
1742
+ }
1743
+ }
1744
+ /**
1745
+ * Claim a specific encrypted amount from a vesting schedule rather than the full claimable balance.
1746
+ * The SDK encrypts `amount` — pass plaintext. Alternatively pass `encryptedInput` to bypass encryption.
1747
+ * @param args Includes `vestingId`, `amount` or `encryptedInput`, and optional `value` for Gas-fee managers.
1748
+ * @returns Transaction hash.
1749
+ */
1750
+ async partialClaim(args) {
1751
+ const wallet = this.#requireWallet("partialClaim");
1752
+ const account = this.#resolveAccount(wallet, args.account, "partialClaim");
1753
+ const encrypted = await this.#resolveEncryptedAmount({
1754
+ amount: args.amount,
1755
+ encryptedInput: args.encryptedInput,
1756
+ encryptor: args.encryptor,
1757
+ method: "partialClaim",
1758
+ account
1759
+ });
1760
+ try {
1761
+ return await wallet.writeContract({
1762
+ address: this.address,
1763
+ abi: confidentialVestingManagerAbi,
1764
+ functionName: "partialClaim",
1765
+ args: [args.vestingId, encrypted.handle, encrypted.inputProof],
1766
+ account,
1767
+ chain: wallet.chain,
1768
+ value: args.value
1769
+ });
1770
+ } catch (err) {
1771
+ throw this.#mapRevert(
1772
+ "partialClaim",
1773
+ err,
1774
+ { vestingId: args.vestingId },
1775
+ accountAddress(account)
1776
+ );
1777
+ }
1778
+ }
1779
+ /**
1780
+ * Admin variant of `partialClaim` — callable by the manager admin on behalf of any recipient.
1781
+ * @param args Same as `partialClaim`.
1782
+ * @returns Transaction hash.
1783
+ */
1784
+ async adminPartialClaim(args) {
1785
+ const wallet = this.#requireWallet("adminPartialClaim");
1786
+ const account = this.#resolveAccount(wallet, args.account, "adminPartialClaim");
1787
+ const encrypted = await this.#resolveEncryptedAmount({
1788
+ amount: args.amount,
1789
+ encryptedInput: args.encryptedInput,
1790
+ encryptor: args.encryptor,
1791
+ method: "adminPartialClaim",
1792
+ account
1793
+ });
1794
+ try {
1795
+ return await wallet.writeContract({
1796
+ address: this.address,
1797
+ abi: confidentialVestingManagerAbi,
1798
+ functionName: "adminPartialClaim",
1799
+ args: [args.vestingId, encrypted.handle, encrypted.inputProof],
1800
+ account,
1801
+ chain: wallet.chain,
1802
+ value: args.value
1803
+ });
1804
+ } catch (err) {
1805
+ throw this.#mapRevert(
1806
+ "adminPartialClaim",
1807
+ err,
1808
+ { vestingId: args.vestingId },
1809
+ accountAddress(account)
1810
+ );
1811
+ }
1812
+ }
1813
+ /**
1814
+ * Revoke a vesting schedule. Callable only when the schedule was created with `isRevocable: true`.
1815
+ * The unvested remainder is returned to the manager admin.
1816
+ * @param vestingId The `bytes32` vesting schedule ID to revoke.
1817
+ * @returns Transaction hash.
1818
+ */
1819
+ async revokeVesting(vestingId, account) {
1820
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.revokeVesting", async () => {
1821
+ return this.#simpleWrite("revokeVesting", [vestingId], account, { vestingId });
1822
+ });
1823
+ }
1824
+ /**
1825
+ * Revoke multiple vesting schedules in one transaction. Respects `maxRevokeBatchSize`.
1826
+ * @param vestingIds Array of `bytes32` vesting schedule IDs to revoke.
1827
+ * @returns Transaction hash.
1828
+ */
1829
+ async batchRevokeVesting(vestingIds, account) {
1830
+ if (vestingIds.length === 0) {
1831
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1832
+ method: "batchRevokeVesting",
1833
+ argument: "vestingIds",
1834
+ reason: "must be non-empty"
1835
+ });
1836
+ }
1837
+ return this.#simpleWrite("batchRevokeVesting", [vestingIds], account);
1838
+ }
1839
+ /**
1840
+ * Split a vesting into two positions.
1841
+ *
1842
+ * The `numerator/denominator` ratio is auto-scaled via `scaleRatio` to the
1843
+ * universal split constant `FHE_SPLIT_DENOMINATOR` (`90_090_000` =
1844
+ * LCM(1..16, 10_000)) unless `args.preScaled` is set. Every confidential
1845
+ * split lands on the same plaintext denominator so the constant itself
1846
+ * leaks no information about the split's shape; only the encrypted
1847
+ * numerator carries the share. `90_090_000` is well above the contract's
1848
+ * `MIN_SPLIT_DENOMINATOR` (10_000) floor. The SDK encrypts `numerator` —
1849
+ * pass plaintext.
1850
+ *
1851
+ * Two natural input shapes both produce exact integer numerators against
1852
+ * the universal denominator:
1853
+ * - `n/m` with `m ∈ 1..16` (halves, thirds, …, sixteenths)
1854
+ * - `bps/10_000` (basis points)
1855
+ *
1856
+ * Use the {@link share} builder to construct them without manual math:
1857
+ * `share.fraction(1, 7)` or `share.basisPoints(250)` → pass the returned
1858
+ * `{ numerator, denominator }` with `preScaled: true`.
1859
+ *
1860
+ * @param args.numerator Plaintext share numerator (kept confidential on-chain).
1861
+ * @param args.denominator Plaintext denominator — auto-scaled to 90_090_000.
1862
+ * @param args.newRecipient Recipient address for the split-off position.
1863
+ * @returns `{ hash, newVestingId }` — the receipt-derived id of the
1864
+ * newly-created vesting position, required for any follow-up call
1865
+ * (claim, transfer, disclose) on the split-off position.
1866
+ * @example
1867
+ * const { newVestingId } = await manager.splitVesting({
1868
+ * vestingId,
1869
+ * numerator: 1n, denominator: 2n, // 50% split; SDK scales to 45_045_000 / 90_090_000
1870
+ * newRecipient: "0xNewRecipient",
1871
+ * });
1872
+ *
1873
+ * @example
1874
+ * // Basis-point style via the guided builder:
1875
+ * const ratio = share.basisPoints(250); // 2.5%
1876
+ * const { newVestingId } = await manager.splitVesting({
1877
+ * vestingId,
1878
+ * numerator: ratio.numerator,
1879
+ * denominator: ratio.denominator,
1880
+ * preScaled: true,
1881
+ * newRecipient: "0xNewRecipient",
1882
+ * });
1883
+ */
1884
+ async splitVesting(args) {
1885
+ const wallet = this.#requireWallet("splitVesting");
1886
+ const account = this.#resolveAccount(wallet, args.account, "splitVesting");
1887
+ const { numerator, denominator } = args.preScaled ? { numerator: args.numerator, denominator: args.denominator } : chunk5SGMJADP_cjs.scaleRatio({
1888
+ numerator: args.numerator,
1889
+ denominator: args.denominator,
1890
+ // The encrypted numerator is submitted via `encryptUint64`, so
1891
+ // bound `scaleRatio`'s validator to that width. Out-of-range
1892
+ // inputs surface as `InvalidArgumentError` on `numerator`
1893
+ // instead of a downstream `EncryptionFailedError`.
1894
+ width: "uint64"
1895
+ });
1896
+ if (denominator < 10000n) {
1897
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1898
+ method: "splitVesting",
1899
+ argument: "denominator",
1900
+ reason: "must be \u2265 10000 (the contract's MIN_SPLIT_DENOMINATOR floor)",
1901
+ value: denominator
1902
+ });
1903
+ }
1904
+ if (args.newRecipient === ZERO_ADDRESS) {
1905
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1906
+ method: "splitVesting",
1907
+ argument: "newRecipient",
1908
+ reason: "must not be the zero address"
1909
+ });
1910
+ }
1911
+ const encrypted = await this.#encryptUint64(numerator, args.encryptor, account);
1912
+ let hash;
1913
+ try {
1914
+ hash = await wallet.writeContract({
1915
+ address: this.address,
1916
+ abi: confidentialVestingManagerAbi,
1917
+ functionName: "splitVesting",
1918
+ args: [
1919
+ args.vestingId,
1920
+ encrypted.handle,
1921
+ encrypted.inputProof,
1922
+ denominator,
1923
+ args.newRecipient
1924
+ ],
1925
+ account,
1926
+ chain: wallet.chain
1927
+ });
1928
+ } catch (err) {
1929
+ throw this.#mapRevert(
1930
+ "splitVesting",
1931
+ err,
1932
+ { vestingId: args.vestingId },
1933
+ accountAddress(account)
1934
+ );
1935
+ }
1936
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
1937
+ const ours = receipt.logs.filter(
1938
+ (log) => log.address.toLowerCase() === this.address.toLowerCase()
1939
+ );
1940
+ const events = viem.parseEventLogs({ abi: confidentialVestingManagerAbi, eventName: "VestingSplit", logs: ours });
1941
+ const matches = events.filter(
1942
+ (ev) => ev.args.originalVestingId.toLowerCase() === args.vestingId.toLowerCase() && ev.args.newRecipient.toLowerCase() === args.newRecipient.toLowerCase()
1943
+ );
1944
+ if (matches.length === 0) {
1945
+ throw new chunk56UI7LUR_cjs.ReceiptEventNotFoundError({
1946
+ method: "splitVesting",
1947
+ eventName: "VestingSplit",
1948
+ contractAddress: this.address,
1949
+ txHash: hash,
1950
+ hint: `Expected VestingSplit for original ${args.vestingId} \u2192 recipient ${args.newRecipient}; the contract did not emit one.`
1951
+ });
1952
+ }
1953
+ if (matches.length > 1) {
1954
+ throw new chunk56UI7LUR_cjs.ReceiptEventAmbiguousError({
1955
+ method: "splitVesting",
1956
+ eventName: "VestingSplit",
1957
+ contractAddress: this.address,
1958
+ txHash: hash,
1959
+ count: matches.length
1960
+ });
1961
+ }
1962
+ return { hash, newVestingId: matches[0].args.newVestingId };
1963
+ }
1964
+ // ============================================================
1965
+ // TRANSFER FLOW
1966
+ // ============================================================
1967
+ /**
1968
+ * Initiate a vesting schedule transfer to a new recipient.
1969
+ * The new recipient has `transferDurationSeconds` to accept before the offer expires.
1970
+ * @param args `{ vestingId, newRecipient, transferDurationSeconds }`.
1971
+ * @returns Transaction hash.
1972
+ */
1973
+ async initiateVestingTransfer(args) {
1974
+ if (!viem.isAddress(args.newRecipient, { strict: true })) {
1975
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1976
+ method: "initiateVestingTransfer",
1977
+ argument: "newRecipient",
1978
+ reason: "must be a valid EIP-55 checksummed address",
1979
+ value: args.newRecipient
1980
+ });
1981
+ }
1982
+ if (args.newRecipient === ZERO_ADDRESS) {
1983
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1984
+ method: "initiateVestingTransfer",
1985
+ argument: "newRecipient",
1986
+ reason: "must not be the zero address"
1987
+ });
1988
+ }
1989
+ if (args.transferDurationSeconds <= 0) {
1990
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
1991
+ method: "initiateVestingTransfer",
1992
+ argument: "transferDurationSeconds",
1993
+ reason: "must be > 0",
1994
+ value: args.transferDurationSeconds
1995
+ });
1996
+ }
1997
+ return this.#simpleWrite(
1998
+ "initiateVestingTransfer",
1999
+ [args.vestingId, args.newRecipient, args.transferDurationSeconds],
2000
+ args.account,
2001
+ { vestingId: args.vestingId }
2002
+ );
2003
+ }
2004
+ /**
2005
+ * Accept a pending vesting transfer. Called by the `newRecipient` named in `initiateVestingTransfer`.
2006
+ * @param vestingId The `bytes32` vesting schedule ID being transferred.
2007
+ * @returns Transaction hash.
2008
+ */
2009
+ async acceptVestingTransfer(vestingId, account) {
2010
+ return this.#simpleWrite("acceptVestingTransfer", [vestingId], account, { vestingId });
2011
+ }
2012
+ /**
2013
+ * Cancel a pending vesting transfer. Callable by either the original or new recipient.
2014
+ * @param vestingId The `bytes32` vesting schedule ID with a pending transfer.
2015
+ * @returns Transaction hash.
2016
+ */
2017
+ async cancelVestingTransfer(vestingId, account) {
2018
+ return this.#simpleWrite("cancelVestingTransfer", [vestingId], account, { vestingId });
2019
+ }
2020
+ /**
2021
+ * Transfer ownership of a vesting schedule directly to `newOwner` without a time-locked acceptance window.
2022
+ * Callable only by the manager admin.
2023
+ * @param vestingId The `bytes32` vesting schedule ID to transfer.
2024
+ * @param newOwner Address that will become the new recipient.
2025
+ * @returns Transaction hash.
2026
+ */
2027
+ async directVestingTransfer(vestingId, newOwner, account) {
2028
+ if (!viem.isAddress(newOwner, { strict: true })) {
2029
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2030
+ method: "directVestingTransfer",
2031
+ argument: "newOwner",
2032
+ reason: "must be a valid EIP-55 checksummed address",
2033
+ value: newOwner
2034
+ });
2035
+ }
2036
+ if (newOwner === ZERO_ADDRESS) {
2037
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2038
+ method: "directVestingTransfer",
2039
+ argument: "newOwner",
2040
+ reason: "must not be the zero address"
2041
+ });
2042
+ }
2043
+ return this.#simpleWrite("directVestingTransfer", [vestingId, newOwner], account, {
2044
+ vestingId
2045
+ });
2046
+ }
2047
+ // ============================================================
2048
+ // DISCLOSURE
2049
+ // ============================================================
2050
+ /**
2051
+ * Disclose a single vesting amount to `party`, granting them persistent FHE
2052
+ * ACL on the corresponding `euint128` handle. The handle is parsed from the
2053
+ * `AmountDisclosed` event filtered by the indexed
2054
+ * `(vestingId, discloser=caller, party)` tuple — exactly one match expected.
2055
+ *
2056
+ * @returns `{ hash, handle }` — pass `handle` to the Zama relayer's
2057
+ * `userDecrypt` (from the `party` side) to obtain the plaintext.
2058
+ */
2059
+ async discloseToParty(args) {
2060
+ return this.#discloseSingleWithReceipt({
2061
+ functionName: "discloseToParty",
2062
+ vestingId: args.vestingId,
2063
+ party: args.party,
2064
+ writeArgs: [args.vestingId, args.party, args.disclosureType],
2065
+ account: args.account
2066
+ });
2067
+ }
2068
+ /**
2069
+ * Disclose multiple vesting amounts to one `party` in a single tx. Handles
2070
+ * are parsed from the matching `AmountDisclosed` events and returned in the
2071
+ * same order as `args.vestingIds` (one handle per input id).
2072
+ *
2073
+ * @returns `{ hash, handles }` — `handles[i]` corresponds to `vestingIds[i]`.
2074
+ */
2075
+ async batchDiscloseToParty(args) {
2076
+ if (args.vestingIds.length === 0) {
2077
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2078
+ method: "batchDiscloseToParty",
2079
+ argument: "vestingIds",
2080
+ reason: "must be non-empty"
2081
+ });
2082
+ }
2083
+ if (args.vestingIds.length !== args.disclosureTypes.length) {
2084
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2085
+ method: "batchDiscloseToParty",
2086
+ argument: "disclosureTypes",
2087
+ reason: `length mismatch: vestingIds=${args.vestingIds.length}, disclosureTypes=${args.disclosureTypes.length}`
2088
+ });
2089
+ }
2090
+ return this.#discloseBatchWithReceipt({
2091
+ functionName: "batchDiscloseToParty",
2092
+ vestingIds: args.vestingIds,
2093
+ party: args.party,
2094
+ writeArgs: [args.vestingIds, args.disclosureTypes, args.party],
2095
+ account: args.account
2096
+ });
2097
+ }
2098
+ /**
2099
+ * Admin-only counterpart to {@link discloseToParty}. Same receipt-parsing
2100
+ * semantics — returns the granted `euint128` handle from the
2101
+ * `AmountDisclosed` event.
2102
+ */
2103
+ async adminDiscloseToParty(args) {
2104
+ return this.#discloseSingleWithReceipt({
2105
+ functionName: "adminDiscloseToParty",
2106
+ vestingId: args.vestingId,
2107
+ party: args.party,
2108
+ writeArgs: [args.vestingId, args.party, args.disclosureType],
2109
+ account: args.account
2110
+ });
2111
+ }
2112
+ /**
2113
+ * Admin-only counterpart to {@link batchDiscloseToParty}. Same return shape.
2114
+ */
2115
+ async adminBatchDiscloseToParty(args) {
2116
+ if (args.vestingIds.length === 0) {
2117
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2118
+ method: "adminBatchDiscloseToParty",
2119
+ argument: "vestingIds",
2120
+ reason: "must be non-empty"
2121
+ });
2122
+ }
2123
+ if (args.vestingIds.length !== args.disclosureTypes.length) {
2124
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2125
+ method: "adminBatchDiscloseToParty",
2126
+ argument: "disclosureTypes",
2127
+ reason: `length mismatch: vestingIds=${args.vestingIds.length}, disclosureTypes=${args.disclosureTypes.length}`
2128
+ });
2129
+ }
2130
+ return this.#discloseBatchWithReceipt({
2131
+ functionName: "adminBatchDiscloseToParty",
2132
+ vestingIds: args.vestingIds,
2133
+ party: args.party,
2134
+ writeArgs: [args.vestingIds, args.disclosureTypes, args.party],
2135
+ account: args.account
2136
+ });
2137
+ }
2138
+ /**
2139
+ * Grant `party` persistent FHE ACL on an already-obtained encrypted handle.
2140
+ * Use this when you hold a handle from a previous call and want to share it with another address.
2141
+ * @param handle The `euint128` encrypted handle to disclose.
2142
+ * @param party Address to grant ACL on the handle.
2143
+ * @returns Transaction hash.
2144
+ */
2145
+ async discloseHandleToParty(handle, party, account) {
2146
+ return this.#simpleWrite("discloseHandleToParty", [handle, party], account);
2147
+ }
2148
+ /**
2149
+ * Grant `party` persistent FHE ACL on multiple encrypted handles in one transaction.
2150
+ * @param handles Array of `euint128` handles to disclose.
2151
+ * @param party Address to grant ACL on all handles.
2152
+ * @returns Transaction hash.
2153
+ */
2154
+ async batchDiscloseHandlesToParty(handles, party, account) {
2155
+ if (handles.length === 0) {
2156
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2157
+ method: "batchDiscloseHandlesToParty",
2158
+ argument: "handles",
2159
+ reason: "must be non-empty"
2160
+ });
2161
+ }
2162
+ return this.#simpleWrite("batchDiscloseHandlesToParty", [handles, party], account);
2163
+ }
2164
+ // ============================================================
2165
+ // ADMIN WRITES
2166
+ // ============================================================
2167
+ /**
2168
+ * Withdraw a confidential token amount from the manager's balance back to the admin.
2169
+ * The SDK encrypts `amount` — pass plaintext. Alternatively pass `encryptedInput`.
2170
+ * @param args `{ amount }` (plaintext, SDK encrypts) or `{ encryptedInput }` (pre-encrypted).
2171
+ * @returns Transaction hash.
2172
+ */
2173
+ async withdrawAdmin(args) {
2174
+ const wallet = this.#requireWallet("withdrawAdmin");
2175
+ const account = this.#resolveAccount(wallet, args.account, "withdrawAdmin");
2176
+ const encrypted = await this.#resolveEncryptedAmount({
2177
+ amount: args.amount,
2178
+ encryptedInput: args.encryptedInput,
2179
+ encryptor: args.encryptor,
2180
+ method: "withdrawAdmin",
2181
+ account
2182
+ });
2183
+ try {
2184
+ return await wallet.writeContract({
2185
+ address: this.address,
2186
+ abi: confidentialVestingManagerAbi,
2187
+ functionName: "withdrawAdmin",
2188
+ args: [encrypted.handle, encrypted.inputProof],
2189
+ account,
2190
+ chain: wallet.chain
2191
+ });
2192
+ } catch (err) {
2193
+ throw this.#mapRevert("withdrawAdmin", err, void 0, accountAddress(account));
2194
+ }
2195
+ }
2196
+ /**
2197
+ * Recover a plain ERC-20 token accidentally sent to this manager. Admin only.
2198
+ * @param token ERC-20 token address to recover.
2199
+ * @param to Recipient address for the recovered tokens.
2200
+ * @returns Transaction hash.
2201
+ */
2202
+ async withdrawOtherToken(token, to, account) {
2203
+ return this.#simpleWrite("withdrawOtherToken", [token, to], account);
2204
+ }
2205
+ /**
2206
+ * Recover a confidential ERC-7984 token accidentally sent to this manager. Admin only.
2207
+ * @param token ERC-7984 token address to recover.
2208
+ * @param to Recipient address for the recovered tokens.
2209
+ * @returns Transaction hash.
2210
+ */
2211
+ async withdrawOtherConfidentialToken(token, to, account) {
2212
+ return this.#simpleWrite("withdrawOtherConfidentialToken", [token, to], account);
2213
+ }
2214
+ /**
2215
+ * Withdraw accumulated ETH gas fees from the manager to `to`. Admin only.
2216
+ * @param to Recipient address.
2217
+ * @param amount Amount in wei.
2218
+ * @returns Transaction hash.
2219
+ */
2220
+ async withdrawGasFee(to, amount, account) {
2221
+ return this.#simpleWrite("withdrawGasFee", [to, amount], account);
2222
+ }
2223
+ /**
2224
+ * Withdraw accumulated token fees from a `FeeType.DistributionToken` manager. Admin only.
2225
+ * The SDK encrypts `amount` — pass plaintext. Alternatively pass `encryptedInput`.
2226
+ * @param args `{ to, amount }` (plaintext, SDK encrypts) or `{ to, encryptedInput }` (pre-encrypted).
2227
+ * @returns Transaction hash.
2228
+ */
2229
+ async withdrawTokenFee(args) {
2230
+ if (args.to === ZERO_ADDRESS) {
2231
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2232
+ method: "withdrawTokenFee",
2233
+ argument: "to",
2234
+ reason: "must not be the zero address"
2235
+ });
2236
+ }
2237
+ const wallet = this.#requireWallet("withdrawTokenFee");
2238
+ const account = this.#resolveAccount(wallet, args.account, "withdrawTokenFee");
2239
+ const encrypted = await this.#resolveEncryptedAmount({
2240
+ amount: args.amount,
2241
+ encryptedInput: args.encryptedInput,
2242
+ encryptor: args.encryptor,
2243
+ method: "withdrawTokenFee",
2244
+ account
2245
+ });
2246
+ try {
2247
+ return await wallet.writeContract({
2248
+ address: this.address,
2249
+ abi: confidentialVestingManagerAbi,
2250
+ functionName: "withdrawTokenFee",
2251
+ args: [args.to, encrypted.handle, encrypted.inputProof],
2252
+ account,
2253
+ chain: wallet.chain
2254
+ });
2255
+ } catch (err) {
2256
+ throw this.#mapRevert("withdrawTokenFee", err, void 0, accountAddress(account));
2257
+ }
2258
+ }
2259
+ /**
2260
+ * Update the maximum number of vestings allowed in a single `batchCreateVesting` call. Admin only.
2261
+ * @param newMax New batch size limit.
2262
+ * @returns Transaction hash.
2263
+ */
2264
+ async setMaxBatchSize(newMax, account) {
2265
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.setMaxBatchSize", async () => {
2266
+ return this.#simpleWrite("setMaxBatchSize", [newMax], account);
2267
+ });
2268
+ }
2269
+ /**
2270
+ * Update the maximum number of vestings allowed in a single `batchRevokeVesting` call. Admin only.
2271
+ * @param newMax New revoke batch size limit.
2272
+ * @returns Transaction hash.
2273
+ */
2274
+ async setMaxRevokeBatchSize(newMax, account) {
2275
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.setMaxRevokeBatchSize", async () => {
2276
+ return this.#simpleWrite("setMaxRevokeBatchSize", [BigInt(newMax)], account);
2277
+ });
2278
+ }
2279
+ /**
2280
+ * Transfer the fee-collector role to a new address. Callable by the current fee collector.
2281
+ * @param newCollector Address to assign the fee-collector role.
2282
+ * @returns Transaction hash.
2283
+ */
2284
+ async transferFeeCollectorRole(newCollector, account) {
2285
+ return this.#simpleWrite("transferFeeCollectorRole", [newCollector], account);
2286
+ }
2287
+ // ============================================================
2288
+ // PAUSE
2289
+ // ============================================================
2290
+ /**
2291
+ * Pause the manager, blocking all claim operations. Requires `isPausable() === true`. PAUSER_ROLE only.
2292
+ * @returns Transaction hash.
2293
+ */
2294
+ async pause(account) {
2295
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.pause", async () => {
2296
+ return this.#simpleWrite("pause", [], account);
2297
+ });
2298
+ }
2299
+ /**
2300
+ * Resume a paused manager, re-enabling claim operations. PAUSER_ROLE only.
2301
+ * @returns Transaction hash.
2302
+ */
2303
+ async unpause(account) {
2304
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.unpause", async () => {
2305
+ return this.#simpleWrite("unpause", [], account);
2306
+ });
2307
+ }
2308
+ // ============================================================
2309
+ // ROLES
2310
+ // ============================================================
2311
+ /**
2312
+ * Check whether `account` holds `role` on this manager.
2313
+ * @param role `bytes32` role identifier — use the `roleConstants()` helper or the SDK's exported role constants.
2314
+ * @param account Address to check.
2315
+ * @returns `true` if the account holds the role.
2316
+ */
2317
+ async hasRole(role, account) {
2318
+ return this.#read("hasRole", [role, account]);
2319
+ }
2320
+ /**
2321
+ * Grant `role` to `accountTarget`. Requires DEFAULT_ADMIN_ROLE.
2322
+ * @param role `bytes32` role identifier.
2323
+ * @param accountTarget Address to grant the role to.
2324
+ * @returns Transaction hash.
2325
+ */
2326
+ async grantRole(role, accountTarget, account) {
2327
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.grantRole", async () => {
2328
+ return this.#simpleWrite("grantRole", [role, accountTarget], account);
2329
+ });
2330
+ }
2331
+ /**
2332
+ * Revoke `role` from `accountTarget`. Requires DEFAULT_ADMIN_ROLE.
2333
+ * @param role `bytes32` role identifier.
2334
+ * @param accountTarget Address to revoke the role from.
2335
+ * @returns Transaction hash.
2336
+ */
2337
+ async revokeRole(role, accountTarget, account) {
2338
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.revokeRole", async () => {
2339
+ return this.#simpleWrite("revokeRole", [role, accountTarget], account);
2340
+ });
2341
+ }
2342
+ /**
2343
+ * Renounce a role held by the caller. `callerConfirm` must equal `msg.sender` (OpenZeppelin guard).
2344
+ * @param role `bytes32` role identifier to renounce.
2345
+ * @param callerConfirm Must equal the calling account address.
2346
+ * @returns Transaction hash.
2347
+ */
2348
+ async renounceRole(role, callerConfirm, account) {
2349
+ return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.manager.renounceRole", async () => {
2350
+ return this.#simpleWrite("renounceRole", [role, callerConfirm], account);
2351
+ });
2352
+ }
2353
+ /**
2354
+ * Read all role identifiers from the contract in one multicall.
2355
+ * @returns Object mapping role name to its `bytes32` identifier.
2356
+ * @example
2357
+ * const { VESTING_CREATOR_ROLE } = await manager.roleConstants();
2358
+ * await manager.grantRole(VESTING_CREATOR_ROLE, creatorAddress);
2359
+ */
2360
+ async roleConstants() {
2361
+ const [
2362
+ DEFAULT_ADMIN_ROLE,
2363
+ VESTING_CREATOR_ROLE,
2364
+ REVOKER_ROLE,
2365
+ WITHDRAWER_ROLE,
2366
+ CLAIMER_ROLE,
2367
+ FEE_COLLECTOR_ROLE,
2368
+ PAUSER_ROLE,
2369
+ DISCLOSURE_ADMIN_ROLE
2370
+ ] = await Promise.all([
2371
+ this.#read("DEFAULT_ADMIN_ROLE"),
2372
+ this.#read("VESTING_CREATOR_ROLE"),
2373
+ this.#read("REVOKER_ROLE"),
2374
+ this.#read("WITHDRAWER_ROLE"),
2375
+ this.#read("CLAIMER_ROLE"),
2376
+ this.#read("FEE_COLLECTOR_ROLE"),
2377
+ this.#read("PAUSER_ROLE"),
2378
+ this.#read("DISCLOSURE_ADMIN_ROLE")
2379
+ ]);
2380
+ return {
2381
+ DEFAULT_ADMIN_ROLE,
2382
+ VESTING_CREATOR_ROLE,
2383
+ REVOKER_ROLE,
2384
+ WITHDRAWER_ROLE,
2385
+ CLAIMER_ROLE,
2386
+ FEE_COLLECTOR_ROLE,
2387
+ PAUSER_ROLE,
2388
+ DISCLOSURE_ADMIN_ROLE
2389
+ };
2390
+ }
2391
+ // ============================================================
2392
+ // INTERNALS
2393
+ // ============================================================
2394
+ #requireWallet(method) {
2395
+ if (!this.walletClient) {
2396
+ throw new chunk56UI7LUR_cjs.MissingWalletClientError(method);
2397
+ }
2398
+ return this.walletClient;
2399
+ }
2400
+ #resolveAccount(wallet, override, method) {
2401
+ const acct = override ?? wallet.account;
2402
+ if (!acct) {
2403
+ throw new chunk56UI7LUR_cjs.MissingAccountError(method);
2404
+ }
2405
+ return acct;
2406
+ }
2407
+ async #encryptUint64(value, encryptor, account) {
2408
+ const enc = encryptor ?? resolveEncryptor(this.encryptor);
2409
+ if (!enc) {
2410
+ throw new chunk56UI7LUR_cjs.MissingEncryptorError("encryptUint64", {
2411
+ hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
2412
+ });
2413
+ }
2414
+ try {
2415
+ return await encryptUint64({
2416
+ encryptor: enc,
2417
+ contractAddress: this.address,
2418
+ userAddress: accountAddress(account),
2419
+ value
2420
+ });
2421
+ } catch (err) {
2422
+ throw chunkNS44KBV5_cjs.mapZamaError(err, { method: "encryptUint64", operation: "encrypt" });
2423
+ }
2424
+ }
2425
+ /**
2426
+ * Resolve the encrypted-input payload for a write that takes either a plaintext
2427
+ * `amount` (which the SDK encrypts) or a pre-built `encryptedInput`. Enforces
2428
+ * the **exactly-one-of** contract — neither path silently wins if both are
2429
+ * supplied, which would let plaintext metadata drift from the on-chain
2430
+ * ciphertext. Pre-encrypted callers can omit `amount` entirely.
2431
+ */
2432
+ async #resolveEncryptedAmount(args) {
2433
+ const hasAmount = args.amount !== void 0;
2434
+ const hasInput = args.encryptedInput !== void 0;
2435
+ if (hasAmount && hasInput) {
2436
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2437
+ method: args.method,
2438
+ argument: "amount/encryptedInput",
2439
+ reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
2440
+ });
2441
+ }
2442
+ if (!hasAmount && !hasInput) {
2443
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2444
+ method: args.method,
2445
+ argument: "amount/encryptedInput",
2446
+ reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
2447
+ });
2448
+ }
2449
+ if (hasInput) return args.encryptedInput;
2450
+ return this.#encryptUint64(args.amount, args.encryptor, args.account);
2451
+ }
2452
+ /**
2453
+ * Translate any error from a vesting `writeContract` / `readContract` /
2454
+ * `simulateContract` call into a typed {@link TokenOpsSdkError}. Pass
2455
+ * `productContext.vestingId` so the resulting vesting-typed error carries
2456
+ * the offending schedule id in its context.
2457
+ */
2458
+ #mapRevert(method, err, productContext, account) {
2459
+ return chunkVDXVNZCO_cjs.mapContractRevert(err, {
2460
+ method,
2461
+ contractAddress: this.address,
2462
+ abi: confidentialVestingManagerAbi,
2463
+ productMapper: vestingProductMapper,
2464
+ productContext,
2465
+ account
2466
+ });
2467
+ }
2468
+ async #simpleWrite(functionName, args, account, productContext) {
2469
+ const wallet = this.#requireWallet(functionName);
2470
+ const acct = this.#resolveAccount(wallet, account, functionName);
2471
+ await this.#preflightWrite(functionName, functionName, args, acct, productContext);
2472
+ try {
2473
+ return await wallet.writeContract({
2474
+ address: this.address,
2475
+ abi: confidentialVestingManagerAbi,
2476
+ functionName,
2477
+ args,
2478
+ account: acct,
2479
+ chain: wallet.chain
2480
+ });
2481
+ } catch (err) {
2482
+ throw this.#mapRevert(functionName, err, productContext, accountAddress(acct));
2483
+ }
2484
+ }
2485
+ /**
2486
+ * Pre-flight a write via `simulateContract` purely to surface typed reverts.
2487
+ *
2488
+ * The simulate's *return value* is discarded — FHE writes still need
2489
+ * `writeContract` + receipt parsing because simulated FHE op handles diverge
2490
+ * from the executed-tx handles (CLAUDE.md Pitfall #1). The only purpose of
2491
+ * this call is to let viem decode any revert against the ABI and produce a
2492
+ * `ContractFunctionRevertedError` frame the revert-mapper can classify.
2493
+ */
2494
+ async #preflightWrite(method, functionName, args, account, productContext, value) {
2495
+ try {
2496
+ await this.publicClient.simulateContract({
2497
+ address: this.address,
2498
+ abi: confidentialVestingManagerAbi,
2499
+ functionName,
2500
+ args,
2501
+ account,
2502
+ ...value !== void 0 ? { value } : {}
2503
+ });
2504
+ } catch (err) {
2505
+ if (chunkVDXVNZCO_cjs.isContractRevert(err)) {
2506
+ throw this.#mapRevert(method, err, productContext, accountAddress(account));
2507
+ }
2508
+ }
2509
+ }
2510
+ /**
2511
+ * Submit a single-vesting disclosure write and parse the `AmountDisclosed`
2512
+ * event for the granted `euint128` handle. The event has
2513
+ * `(vestingId, discloser, party)` indexed — all three are known at call
2514
+ * time, so the filter is exact.
2515
+ */
2516
+ async #discloseSingleWithReceipt(input) {
2517
+ if (!viem.isAddress(input.party, { strict: true })) {
2518
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2519
+ method: input.functionName,
2520
+ argument: "party",
2521
+ reason: "must be a valid EIP-55 checksummed address",
2522
+ value: input.party
2523
+ });
2524
+ }
2525
+ const wallet = this.#requireWallet(input.functionName);
2526
+ const acct = this.#resolveAccount(wallet, input.account, input.functionName);
2527
+ let hash;
2528
+ try {
2529
+ hash = await wallet.writeContract({
2530
+ address: this.address,
2531
+ abi: confidentialVestingManagerAbi,
2532
+ functionName: input.functionName,
2533
+ args: input.writeArgs,
2534
+ account: acct,
2535
+ chain: wallet.chain
2536
+ });
2537
+ } catch (err) {
2538
+ throw this.#mapRevert(
2539
+ input.functionName,
2540
+ err,
2541
+ { vestingId: input.vestingId },
2542
+ accountAddress(acct)
2543
+ );
2544
+ }
2545
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2546
+ const ours = receipt.logs.filter(
2547
+ (log) => log.address.toLowerCase() === this.address.toLowerCase()
2548
+ );
2549
+ const events = viem.parseEventLogs({ abi: confidentialVestingManagerAbi, eventName: "AmountDisclosed", logs: ours });
2550
+ const callerAddress = accountAddress(acct).toLowerCase();
2551
+ const matches = events.filter(
2552
+ (ev) => ev.args.vestingId.toLowerCase() === input.vestingId.toLowerCase() && ev.args.discloser.toLowerCase() === callerAddress && ev.args.party.toLowerCase() === input.party.toLowerCase()
2553
+ );
2554
+ if (matches.length === 0) {
2555
+ throw new chunk56UI7LUR_cjs.ReceiptEventNotFoundError({
2556
+ method: input.functionName,
2557
+ eventName: "AmountDisclosed",
2558
+ contractAddress: this.address,
2559
+ txHash: hash,
2560
+ hint: `Expected AmountDisclosed for vestingId ${input.vestingId} \u2192 party ${input.party}; the contract did not emit one.`
2561
+ });
2562
+ }
2563
+ if (matches.length > 1) {
2564
+ throw new chunk56UI7LUR_cjs.ReceiptEventAmbiguousError({
2565
+ method: input.functionName,
2566
+ eventName: "AmountDisclosed",
2567
+ contractAddress: this.address,
2568
+ txHash: hash,
2569
+ count: matches.length
2570
+ });
2571
+ }
2572
+ return { hash, handle: matches[0].args.encryptedAmount };
2573
+ }
2574
+ /**
2575
+ * Submit a batch-disclosure write and parse one `AmountDisclosed` event per
2576
+ * input `vestingId`. Handles are returned in input order (each `handles[i]`
2577
+ * corresponds to `vestingIds[i]`).
2578
+ */
2579
+ async #discloseBatchWithReceipt(input) {
2580
+ if (!viem.isAddress(input.party, { strict: true })) {
2581
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2582
+ method: input.functionName,
2583
+ argument: "party",
2584
+ reason: "must be a valid EIP-55 checksummed address",
2585
+ value: input.party
2586
+ });
2587
+ }
2588
+ const wallet = this.#requireWallet(input.functionName);
2589
+ const acct = this.#resolveAccount(wallet, input.account, input.functionName);
2590
+ let hash;
2591
+ try {
2592
+ hash = await wallet.writeContract({
2593
+ address: this.address,
2594
+ abi: confidentialVestingManagerAbi,
2595
+ functionName: input.functionName,
2596
+ args: input.writeArgs,
2597
+ account: acct,
2598
+ chain: wallet.chain
2599
+ });
2600
+ } catch (err) {
2601
+ throw this.#mapRevert(input.functionName, err, void 0, accountAddress(acct));
2602
+ }
2603
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2604
+ const ours = receipt.logs.filter(
2605
+ (log) => log.address.toLowerCase() === this.address.toLowerCase()
2606
+ );
2607
+ const events = viem.parseEventLogs({ abi: confidentialVestingManagerAbi, eventName: "AmountDisclosed", logs: ours });
2608
+ const callerAddress = accountAddress(acct).toLowerCase();
2609
+ const partyLower = input.party.toLowerCase();
2610
+ const byVestingId = /* @__PURE__ */ new Map();
2611
+ for (const ev of events) {
2612
+ if (ev.args.discloser.toLowerCase() === callerAddress && ev.args.party.toLowerCase() === partyLower) {
2613
+ byVestingId.set(ev.args.vestingId.toLowerCase(), ev.args.encryptedAmount);
2614
+ }
2615
+ }
2616
+ const handles = [];
2617
+ for (const id of input.vestingIds) {
2618
+ const handle = byVestingId.get(id.toLowerCase());
2619
+ if (handle === void 0) {
2620
+ throw new chunk56UI7LUR_cjs.ReceiptEventNotFoundError({
2621
+ method: input.functionName,
2622
+ eventName: "AmountDisclosed",
2623
+ contractAddress: this.address,
2624
+ txHash: hash,
2625
+ hint: `Missing AmountDisclosed for vestingId ${id}; the batch did not produce a handle for every input id.`
2626
+ });
2627
+ }
2628
+ handles.push(handle);
2629
+ }
2630
+ return { hash, handles };
2631
+ }
2632
+ /**
2633
+ * Cheap structural validation that mirrors the contract-side
2634
+ * `_validateVestingParams` invariants. Throws `InvalidArgumentError` with a
2635
+ * specific `argument` field so UIs can highlight the offending input rather
2636
+ * than wait for the on-chain revert.
2637
+ */
2638
+ #validateVestingParams(params, where) {
2639
+ if (!viem.isAddress(params.recipient, { strict: true })) {
2640
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2641
+ method: where,
2642
+ argument: "recipient",
2643
+ reason: "must be a valid EIP-55 checksummed address",
2644
+ value: params.recipient
2645
+ });
2646
+ }
2647
+ if (params.recipient === ZERO_ADDRESS) {
2648
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2649
+ method: where,
2650
+ argument: "recipient",
2651
+ reason: "must not be the zero address"
2652
+ });
2653
+ }
2654
+ if (params.startTimestamp >= params.endTimestamp) {
2655
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2656
+ method: where,
2657
+ argument: "startTimestamp/endTimestamp",
2658
+ reason: "startTimestamp must be strictly less than endTimestamp",
2659
+ value: { startTimestamp: params.startTimestamp, endTimestamp: params.endTimestamp }
2660
+ });
2661
+ }
2662
+ if (params.startTimestamp + params.cliffSeconds > params.endTimestamp) {
2663
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2664
+ method: where,
2665
+ argument: "cliffSeconds",
2666
+ reason: "cliff cannot extend past endTimestamp",
2667
+ value: params.cliffSeconds
2668
+ });
2669
+ }
2670
+ if (params.initialUnlockBps + params.cliffAmountBps > 1e4) {
2671
+ throw new chunk56UI7LUR_cjs.InvalidArgumentError({
2672
+ method: where,
2673
+ argument: "initialUnlockBps + cliffAmountBps",
2674
+ reason: "must be \u2264 10000 (100%)",
2675
+ value: { initialUnlockBps: params.initialUnlockBps, cliffAmountBps: params.cliffAmountBps }
2676
+ });
2677
+ }
2678
+ }
2679
+ async #read(functionName, args = []) {
2680
+ const result = await this.publicClient.readContract({
2681
+ address: this.address,
2682
+ abi: confidentialVestingManagerAbi,
2683
+ functionName,
2684
+ args
2685
+ });
2686
+ return result;
2687
+ }
2688
+ /**
2689
+ * Submit a tx for a function that performs `FHE.allow(handle, msg.sender)` and
2690
+ * extract the granted handle from the receipt's ACL `Allowed` events. The
2691
+ * "simulate first to get the return value" pattern would lie: when the
2692
+ * function does FHE ops (`FHE.add` / `mul` / `sub` / …), each op produces a
2693
+ * fresh handle bound to the *tx context*, so the simulate result diverges
2694
+ * from what actually lands in ACL. Reading the event log is canonical.
2695
+ */
2696
+ async #encryptedView(functionName, args, accountOverride) {
2697
+ const wallet = this.#requireWallet(functionName);
2698
+ const account = this.#resolveAccount(wallet, accountOverride, functionName);
2699
+ const vestingId = args[0];
2700
+ let hash;
2701
+ try {
2702
+ hash = await wallet.writeContract({
2703
+ address: this.address,
2704
+ abi: confidentialVestingManagerAbi,
2705
+ functionName,
2706
+ args,
2707
+ account,
2708
+ chain: wallet.chain
2709
+ });
2710
+ } catch (err) {
2711
+ throw this.#mapRevert(
2712
+ functionName,
2713
+ err,
2714
+ vestingId ? { vestingId } : void 0,
2715
+ accountAddress(account)
2716
+ );
2717
+ }
2718
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2719
+ const callerAddress = accountAddress(account).toLowerCase();
2720
+ const aclLogs = receipt.logs.filter(
2721
+ (log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
2722
+ );
2723
+ const events = viem.parseEventLogs({ abi: [chunkQ7ARQSUH_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
2724
+ const granted = events.filter(
2725
+ (ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
2726
+ );
2727
+ if (granted.length === 0) {
2728
+ throw new chunk56UI7LUR_cjs.ReceiptEventNotFoundError({
2729
+ method: functionName,
2730
+ eventName: "Allowed",
2731
+ contractAddress: this.aclAddress,
2732
+ txHash: hash,
2733
+ hint: `Expected ACL grant from manager ${this.address} to caller ${callerAddress}; the contract did not grant decrypt access.`
2734
+ });
2735
+ }
2736
+ if (granted.length > 1) {
2737
+ throw new chunk56UI7LUR_cjs.ReceiptEventAmbiguousError({
2738
+ method: functionName,
2739
+ eventName: "Allowed",
2740
+ contractAddress: this.aclAddress,
2741
+ txHash: hash,
2742
+ count: granted.length
2743
+ });
2744
+ }
2745
+ const handle = chunk66IHPTOK_cjs.asEncryptedHandle(granted[0].args.handle);
2746
+ return { handle, hash: chunk66IHPTOK_cjs.asTxHash(hash) };
2747
+ }
2748
+ };
2749
+ function createConfidentialVestingManagerClient(config) {
2750
+ return new ConfidentialVestingManagerClient(config);
2751
+ }
2752
+ function accountAddress(account) {
2753
+ return typeof account === "string" ? account : account.address;
2754
+ }
2755
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
2756
+
2757
+ exports.ClaimLockedError = ClaimLockedError;
2758
+ exports.ConfidentialVestingManagerClient = ConfidentialVestingManagerClient;
2759
+ exports.NoPendingTransferError = NoPendingTransferError;
2760
+ exports.NotPendingRecipientError = NotPendingRecipientError;
2761
+ exports.NotVestingRecipientError = NotVestingRecipientError;
2762
+ exports.TransferAlreadyPendingError = TransferAlreadyPendingError;
2763
+ exports.TransferExpiredError = TransferExpiredError;
2764
+ exports.VestingExpiredError = VestingExpiredError;
2765
+ exports.VestingNotFoundError = VestingNotFoundError;
2766
+ exports.VestingNotRevocableError = VestingNotRevocableError;
2767
+ exports.VestingRevokedError = VestingRevokedError;
2768
+ exports.confidentialVestingManagerAbi = confidentialVestingManagerAbi;
2769
+ exports.createConfidentialVestingManagerClient = createConfidentialVestingManagerClient;
2770
+ exports.encryptUint64 = encryptUint64;
2771
+ exports.encryptUint64Batch = encryptUint64Batch;
2772
+ exports.resolveEncryptor = resolveEncryptor;