@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,3388 @@
1
+ import { mapZamaError } from './chunk-ZXCOJY2Z.js';
2
+ import { getFhevmAclAddress, requireFhevmAclAddress, ACL_ALLOWED_EVENT } from './chunk-FYQ2UW4T.js';
3
+ import { SDK_VERSION, isContractRevert, mapContractRevert } from './chunk-JFLEEXKP.js';
4
+ import { getFheDisperseSingletonAddress } from './chunk-COPFW5Z4.js';
5
+ import { normaliseAddress } from './chunk-BE2AIZ3K.js';
6
+ import { withTelemetry } from './chunk-Q2GP5UDC.js';
7
+ import { asExternalInputProof, asEncryptedHandle } from './chunk-KWFFIJYX.js';
8
+ import { InvalidArgumentError, TokenOpsSdkError, DeploymentAddressUnavailableError, PausedError, InsufficientFeeError, MissingEncryptorError, ReceiptEventAmbiguousError, MissingWalletClientError, MissingAccountError, BatchTooLargeError } from './chunk-IVE3QEGD.js';
9
+ import { bytesToHex, keccak256, encodePacked, parseEventLogs, isAddress, getCreate2Address } from 'viem';
10
+
11
+ // src/fhe-disperse/abis/singleton.ts
12
+ var disperseConfidentialAbi = [
13
+ {
14
+ inputs: [
15
+ {
16
+ internalType: "address",
17
+ name: "admin_",
18
+ type: "address"
19
+ },
20
+ {
21
+ internalType: "address",
22
+ name: "feeCollector_",
23
+ type: "address"
24
+ },
25
+ {
26
+ components: [
27
+ {
28
+ internalType: "bool",
29
+ name: "gasFeeEnabled",
30
+ type: "bool"
31
+ },
32
+ {
33
+ internalType: "bool",
34
+ name: "tokenFeeEnabled",
35
+ type: "bool"
36
+ },
37
+ {
38
+ internalType: "uint96",
39
+ name: "defaultGasFee",
40
+ type: "uint96"
41
+ },
42
+ {
43
+ internalType: "uint16",
44
+ name: "defaultTokenFee",
45
+ type: "uint16"
46
+ }
47
+ ],
48
+ internalType: "struct IDisperseConfidential.FeeConfig",
49
+ name: "config_",
50
+ type: "tuple"
51
+ },
52
+ {
53
+ internalType: "uint256",
54
+ name: "maxBatchSizeHolding_",
55
+ type: "uint256"
56
+ },
57
+ {
58
+ internalType: "uint256",
59
+ name: "maxBatchSizeDirect_",
60
+ type: "uint256"
61
+ },
62
+ {
63
+ internalType: "uint256",
64
+ name: "maxBatchSizeTokenFee_",
65
+ type: "uint256"
66
+ }
67
+ ],
68
+ stateMutability: "nonpayable",
69
+ type: "constructor"
70
+ },
71
+ {
72
+ inputs: [],
73
+ name: "AccessControlBadConfirmation",
74
+ type: "error"
75
+ },
76
+ {
77
+ inputs: [
78
+ {
79
+ internalType: "address",
80
+ name: "account",
81
+ type: "address"
82
+ },
83
+ {
84
+ internalType: "bytes32",
85
+ name: "neededRole",
86
+ type: "bytes32"
87
+ }
88
+ ],
89
+ name: "AccessControlUnauthorizedAccount",
90
+ type: "error"
91
+ },
92
+ {
93
+ inputs: [],
94
+ name: "ArrayLengthMismatch",
95
+ type: "error"
96
+ },
97
+ {
98
+ inputs: [
99
+ {
100
+ internalType: "uint256",
101
+ name: "requested",
102
+ type: "uint256"
103
+ },
104
+ {
105
+ internalType: "uint256",
106
+ name: "max",
107
+ type: "uint256"
108
+ }
109
+ ],
110
+ name: "BatchTooLarge",
111
+ type: "error"
112
+ },
113
+ {
114
+ inputs: [],
115
+ name: "ContractNotAllowed",
116
+ type: "error"
117
+ },
118
+ {
119
+ inputs: [],
120
+ name: "CustomFeeNotSet",
121
+ type: "error"
122
+ },
123
+ {
124
+ inputs: [],
125
+ name: "EmptyBatch",
126
+ type: "error"
127
+ },
128
+ {
129
+ inputs: [],
130
+ name: "EmptyRecipients",
131
+ type: "error"
132
+ },
133
+ {
134
+ inputs: [],
135
+ name: "EnforcedPause",
136
+ type: "error"
137
+ },
138
+ {
139
+ inputs: [],
140
+ name: "ExpectedPause",
141
+ type: "error"
142
+ },
143
+ {
144
+ inputs: [],
145
+ name: "FailedDeployment",
146
+ type: "error"
147
+ },
148
+ {
149
+ inputs: [],
150
+ name: "HandleNotAllowed",
151
+ type: "error"
152
+ },
153
+ {
154
+ inputs: [
155
+ {
156
+ internalType: "uint256",
157
+ name: "sent",
158
+ type: "uint256"
159
+ },
160
+ {
161
+ internalType: "uint256",
162
+ name: "required",
163
+ type: "uint256"
164
+ }
165
+ ],
166
+ name: "InsufficientAmount",
167
+ type: "error"
168
+ },
169
+ {
170
+ inputs: [
171
+ {
172
+ internalType: "uint256",
173
+ name: "balance",
174
+ type: "uint256"
175
+ },
176
+ {
177
+ internalType: "uint256",
178
+ name: "needed",
179
+ type: "uint256"
180
+ }
181
+ ],
182
+ name: "InsufficientBalance",
183
+ type: "error"
184
+ },
185
+ {
186
+ inputs: [],
187
+ name: "InvalidAddress",
188
+ type: "error"
189
+ },
190
+ {
191
+ inputs: [],
192
+ name: "InvalidWalletIndex",
193
+ type: "error"
194
+ },
195
+ {
196
+ inputs: [],
197
+ name: "ReentrancyGuardReentrantCall",
198
+ type: "error"
199
+ },
200
+ {
201
+ inputs: [
202
+ {
203
+ internalType: "address",
204
+ name: "token",
205
+ type: "address"
206
+ }
207
+ ],
208
+ name: "SafeERC20FailedOperation",
209
+ type: "error"
210
+ },
211
+ {
212
+ inputs: [
213
+ {
214
+ internalType: "bytes32",
215
+ name: "handle",
216
+ type: "bytes32"
217
+ },
218
+ {
219
+ internalType: "address",
220
+ name: "sender",
221
+ type: "address"
222
+ }
223
+ ],
224
+ name: "SenderNotAllowedToUseHandle",
225
+ type: "error"
226
+ },
227
+ {
228
+ inputs: [
229
+ {
230
+ internalType: "address",
231
+ name: "sender",
232
+ type: "address"
233
+ }
234
+ ],
235
+ name: "SenderNotAllowed",
236
+ type: "error"
237
+ },
238
+ {
239
+ inputs: [
240
+ {
241
+ internalType: "uint16",
242
+ name: "fee",
243
+ type: "uint16"
244
+ }
245
+ ],
246
+ name: "TokenFeeTooHigh",
247
+ type: "error"
248
+ },
249
+ {
250
+ inputs: [],
251
+ name: "TransferFailed",
252
+ type: "error"
253
+ },
254
+ {
255
+ inputs: [],
256
+ name: "UserAlreadyRegistered",
257
+ type: "error"
258
+ },
259
+ {
260
+ inputs: [],
261
+ name: "UserNotRegistered",
262
+ type: "error"
263
+ },
264
+ {
265
+ inputs: [],
266
+ name: "ZamaProtocolUnsupported",
267
+ type: "error"
268
+ },
269
+ {
270
+ inputs: [],
271
+ name: "ZeroAddressRecipient",
272
+ type: "error"
273
+ },
274
+ {
275
+ anonymous: false,
276
+ inputs: [
277
+ {
278
+ indexed: true,
279
+ internalType: "address",
280
+ name: "token",
281
+ type: "address"
282
+ },
283
+ {
284
+ indexed: true,
285
+ internalType: "address",
286
+ name: "sender",
287
+ type: "address"
288
+ },
289
+ {
290
+ indexed: false,
291
+ internalType: "uint256",
292
+ name: "recipientCount",
293
+ type: "uint256"
294
+ },
295
+ {
296
+ indexed: false,
297
+ internalType: "uint8",
298
+ name: "feeType",
299
+ type: "uint8"
300
+ }
301
+ ],
302
+ name: "ConfidentialTokensDispersed",
303
+ type: "event"
304
+ },
305
+ {
306
+ anonymous: false,
307
+ inputs: [
308
+ {
309
+ indexed: true,
310
+ internalType: "address",
311
+ name: "token",
312
+ type: "address"
313
+ },
314
+ {
315
+ indexed: true,
316
+ internalType: "address",
317
+ name: "to",
318
+ type: "address"
319
+ }
320
+ ],
321
+ name: "ConfidentialTokensRescued",
322
+ type: "event"
323
+ },
324
+ {
325
+ anonymous: false,
326
+ inputs: [
327
+ {
328
+ indexed: true,
329
+ internalType: "address",
330
+ name: "user",
331
+ type: "address"
332
+ }
333
+ ],
334
+ name: "CustomFeeDisabled",
335
+ type: "event"
336
+ },
337
+ {
338
+ anonymous: false,
339
+ inputs: [
340
+ {
341
+ indexed: true,
342
+ internalType: "address",
343
+ name: "user",
344
+ type: "address"
345
+ },
346
+ {
347
+ indexed: false,
348
+ internalType: "uint96",
349
+ name: "gasFee",
350
+ type: "uint96"
351
+ },
352
+ {
353
+ indexed: false,
354
+ internalType: "uint16",
355
+ name: "tokenFee",
356
+ type: "uint16"
357
+ }
358
+ ],
359
+ name: "CustomFeeSet",
360
+ type: "event"
361
+ },
362
+ {
363
+ anonymous: false,
364
+ inputs: [
365
+ {
366
+ indexed: true,
367
+ internalType: "address",
368
+ name: "sender",
369
+ type: "address"
370
+ },
371
+ {
372
+ indexed: false,
373
+ internalType: "address[]",
374
+ name: "recipients",
375
+ type: "address[]"
376
+ },
377
+ {
378
+ indexed: false,
379
+ internalType: "euint64[]",
380
+ name: "requested",
381
+ type: "bytes32[]"
382
+ },
383
+ {
384
+ indexed: false,
385
+ internalType: "euint64[]",
386
+ name: "transferred",
387
+ type: "bytes32[]"
388
+ }
389
+ ],
390
+ name: "DirectDistribution",
391
+ type: "event"
392
+ },
393
+ {
394
+ anonymous: false,
395
+ inputs: [
396
+ {
397
+ indexed: true,
398
+ internalType: "address",
399
+ name: "token",
400
+ type: "address"
401
+ },
402
+ {
403
+ indexed: true,
404
+ internalType: "address",
405
+ name: "to",
406
+ type: "address"
407
+ },
408
+ {
409
+ indexed: false,
410
+ internalType: "uint256",
411
+ name: "amount",
412
+ type: "uint256"
413
+ }
414
+ ],
415
+ name: "ERC20Rescued",
416
+ type: "event"
417
+ },
418
+ {
419
+ anonymous: false,
420
+ inputs: [
421
+ {
422
+ components: [
423
+ {
424
+ internalType: "bool",
425
+ name: "gasFeeEnabled",
426
+ type: "bool"
427
+ },
428
+ {
429
+ internalType: "bool",
430
+ name: "tokenFeeEnabled",
431
+ type: "bool"
432
+ },
433
+ {
434
+ internalType: "uint96",
435
+ name: "defaultGasFee",
436
+ type: "uint96"
437
+ },
438
+ {
439
+ internalType: "uint16",
440
+ name: "defaultTokenFee",
441
+ type: "uint16"
442
+ }
443
+ ],
444
+ indexed: false,
445
+ internalType: "struct IDisperseConfidential.FeeConfig",
446
+ name: "config",
447
+ type: "tuple"
448
+ }
449
+ ],
450
+ name: "FeeConfigUpdated",
451
+ type: "event"
452
+ },
453
+ {
454
+ anonymous: false,
455
+ inputs: [
456
+ {
457
+ indexed: true,
458
+ internalType: "address",
459
+ name: "to",
460
+ type: "address"
461
+ },
462
+ {
463
+ indexed: false,
464
+ internalType: "uint256",
465
+ name: "amount",
466
+ type: "uint256"
467
+ }
468
+ ],
469
+ name: "GasFeeWithdrawn",
470
+ type: "event"
471
+ },
472
+ {
473
+ anonymous: false,
474
+ inputs: [
475
+ {
476
+ indexed: true,
477
+ internalType: "address",
478
+ name: "discloser",
479
+ type: "address"
480
+ },
481
+ {
482
+ indexed: true,
483
+ internalType: "address",
484
+ name: "party",
485
+ type: "address"
486
+ },
487
+ {
488
+ indexed: false,
489
+ internalType: "euint64[]",
490
+ name: "handles",
491
+ type: "bytes32[]"
492
+ }
493
+ ],
494
+ name: "HandlesDisclosedToParty",
495
+ type: "event"
496
+ },
497
+ {
498
+ anonymous: false,
499
+ inputs: [
500
+ {
501
+ indexed: false,
502
+ internalType: "uint256",
503
+ name: "oldSize",
504
+ type: "uint256"
505
+ },
506
+ {
507
+ indexed: false,
508
+ internalType: "uint256",
509
+ name: "newSize",
510
+ type: "uint256"
511
+ }
512
+ ],
513
+ name: "MaxBatchSizeDirectUpdated",
514
+ type: "event"
515
+ },
516
+ {
517
+ anonymous: false,
518
+ inputs: [
519
+ {
520
+ indexed: false,
521
+ internalType: "uint256",
522
+ name: "oldSize",
523
+ type: "uint256"
524
+ },
525
+ {
526
+ indexed: false,
527
+ internalType: "uint256",
528
+ name: "newSize",
529
+ type: "uint256"
530
+ }
531
+ ],
532
+ name: "MaxBatchSizeHoldingUpdated",
533
+ type: "event"
534
+ },
535
+ {
536
+ anonymous: false,
537
+ inputs: [
538
+ {
539
+ indexed: false,
540
+ internalType: "uint256",
541
+ name: "oldSize",
542
+ type: "uint256"
543
+ },
544
+ {
545
+ indexed: false,
546
+ internalType: "uint256",
547
+ name: "newSize",
548
+ type: "uint256"
549
+ }
550
+ ],
551
+ name: "MaxBatchSizeTokenFeeUpdated",
552
+ type: "event"
553
+ },
554
+ {
555
+ anonymous: false,
556
+ inputs: [
557
+ {
558
+ indexed: false,
559
+ internalType: "address",
560
+ name: "account",
561
+ type: "address"
562
+ }
563
+ ],
564
+ name: "Paused",
565
+ type: "event"
566
+ },
567
+ {
568
+ anonymous: false,
569
+ inputs: [
570
+ {
571
+ indexed: true,
572
+ internalType: "bytes32",
573
+ name: "role",
574
+ type: "bytes32"
575
+ },
576
+ {
577
+ indexed: true,
578
+ internalType: "bytes32",
579
+ name: "previousAdminRole",
580
+ type: "bytes32"
581
+ },
582
+ {
583
+ indexed: true,
584
+ internalType: "bytes32",
585
+ name: "newAdminRole",
586
+ type: "bytes32"
587
+ }
588
+ ],
589
+ name: "RoleAdminChanged",
590
+ type: "event"
591
+ },
592
+ {
593
+ anonymous: false,
594
+ inputs: [
595
+ {
596
+ indexed: true,
597
+ internalType: "bytes32",
598
+ name: "role",
599
+ type: "bytes32"
600
+ },
601
+ {
602
+ indexed: true,
603
+ internalType: "address",
604
+ name: "account",
605
+ type: "address"
606
+ },
607
+ {
608
+ indexed: true,
609
+ internalType: "address",
610
+ name: "sender",
611
+ type: "address"
612
+ }
613
+ ],
614
+ name: "RoleGranted",
615
+ type: "event"
616
+ },
617
+ {
618
+ anonymous: false,
619
+ inputs: [
620
+ {
621
+ indexed: true,
622
+ internalType: "bytes32",
623
+ name: "role",
624
+ type: "bytes32"
625
+ },
626
+ {
627
+ indexed: true,
628
+ internalType: "address",
629
+ name: "account",
630
+ type: "address"
631
+ },
632
+ {
633
+ indexed: true,
634
+ internalType: "address",
635
+ name: "sender",
636
+ type: "address"
637
+ }
638
+ ],
639
+ name: "RoleRevoked",
640
+ type: "event"
641
+ },
642
+ {
643
+ anonymous: false,
644
+ inputs: [
645
+ {
646
+ indexed: true,
647
+ internalType: "address",
648
+ name: "token",
649
+ type: "address"
650
+ },
651
+ {
652
+ indexed: true,
653
+ internalType: "address",
654
+ name: "to",
655
+ type: "address"
656
+ },
657
+ {
658
+ indexed: false,
659
+ internalType: "euint64",
660
+ name: "amount",
661
+ type: "bytes32"
662
+ }
663
+ ],
664
+ name: "TokenFeeWithdrawn",
665
+ type: "event"
666
+ },
667
+ {
668
+ anonymous: false,
669
+ inputs: [
670
+ {
671
+ indexed: false,
672
+ internalType: "address",
673
+ name: "account",
674
+ type: "address"
675
+ }
676
+ ],
677
+ name: "Unpaused",
678
+ type: "event"
679
+ },
680
+ {
681
+ anonymous: false,
682
+ inputs: [
683
+ {
684
+ indexed: true,
685
+ internalType: "address",
686
+ name: "user",
687
+ type: "address"
688
+ },
689
+ {
690
+ indexed: false,
691
+ internalType: "address",
692
+ name: "wallet0",
693
+ type: "address"
694
+ },
695
+ {
696
+ indexed: false,
697
+ internalType: "address",
698
+ name: "wallet1",
699
+ type: "address"
700
+ }
701
+ ],
702
+ name: "UserRegistered",
703
+ type: "event"
704
+ },
705
+ {
706
+ anonymous: false,
707
+ inputs: [
708
+ {
709
+ indexed: true,
710
+ internalType: "address",
711
+ name: "sender",
712
+ type: "address"
713
+ },
714
+ {
715
+ indexed: false,
716
+ internalType: "address",
717
+ name: "wallet",
718
+ type: "address"
719
+ },
720
+ {
721
+ indexed: false,
722
+ internalType: "address[]",
723
+ name: "recipients",
724
+ type: "address[]"
725
+ },
726
+ {
727
+ indexed: false,
728
+ internalType: "euint64[]",
729
+ name: "requested",
730
+ type: "bytes32[]"
731
+ },
732
+ {
733
+ indexed: false,
734
+ internalType: "euint64[]",
735
+ name: "transferred",
736
+ type: "bytes32[]"
737
+ }
738
+ ],
739
+ name: "WalletDistribution",
740
+ type: "event"
741
+ },
742
+ {
743
+ inputs: [],
744
+ name: "BASIS_POINTS",
745
+ outputs: [
746
+ {
747
+ internalType: "uint256",
748
+ name: "",
749
+ type: "uint256"
750
+ }
751
+ ],
752
+ stateMutability: "view",
753
+ type: "function"
754
+ },
755
+ {
756
+ inputs: [],
757
+ name: "DEFAULT_ADMIN_ROLE",
758
+ outputs: [
759
+ {
760
+ internalType: "bytes32",
761
+ name: "",
762
+ type: "bytes32"
763
+ }
764
+ ],
765
+ stateMutability: "view",
766
+ type: "function"
767
+ },
768
+ {
769
+ inputs: [],
770
+ name: "DEPLOYMENT_BLOCK_NUMBER",
771
+ outputs: [
772
+ {
773
+ internalType: "uint256",
774
+ name: "",
775
+ type: "uint256"
776
+ }
777
+ ],
778
+ stateMutability: "view",
779
+ type: "function"
780
+ },
781
+ {
782
+ inputs: [],
783
+ name: "FEE_COLLECTOR_ROLE",
784
+ outputs: [
785
+ {
786
+ internalType: "bytes32",
787
+ name: "",
788
+ type: "bytes32"
789
+ }
790
+ ],
791
+ stateMutability: "view",
792
+ type: "function"
793
+ },
794
+ {
795
+ inputs: [],
796
+ name: "FEE_MANAGER_ROLE",
797
+ outputs: [
798
+ {
799
+ internalType: "bytes32",
800
+ name: "",
801
+ type: "bytes32"
802
+ }
803
+ ],
804
+ stateMutability: "view",
805
+ type: "function"
806
+ },
807
+ {
808
+ inputs: [],
809
+ name: "FEE_TYPE_GAS",
810
+ outputs: [
811
+ {
812
+ internalType: "uint8",
813
+ name: "",
814
+ type: "uint8"
815
+ }
816
+ ],
817
+ stateMutability: "view",
818
+ type: "function"
819
+ },
820
+ {
821
+ inputs: [],
822
+ name: "FEE_TYPE_GAS_DIRECT",
823
+ outputs: [
824
+ {
825
+ internalType: "uint8",
826
+ name: "",
827
+ type: "uint8"
828
+ }
829
+ ],
830
+ stateMutability: "view",
831
+ type: "function"
832
+ },
833
+ {
834
+ inputs: [],
835
+ name: "FEE_TYPE_TOKEN",
836
+ outputs: [
837
+ {
838
+ internalType: "uint8",
839
+ name: "",
840
+ type: "uint8"
841
+ }
842
+ ],
843
+ stateMutability: "view",
844
+ type: "function"
845
+ },
846
+ {
847
+ inputs: [],
848
+ name: "PAUSER_ROLE",
849
+ outputs: [
850
+ {
851
+ internalType: "bytes32",
852
+ name: "",
853
+ type: "bytes32"
854
+ }
855
+ ],
856
+ stateMutability: "view",
857
+ type: "function"
858
+ },
859
+ {
860
+ inputs: [],
861
+ name: "WALLET_IMPLEMENTATION",
862
+ outputs: [
863
+ {
864
+ internalType: "address",
865
+ name: "",
866
+ type: "address"
867
+ }
868
+ ],
869
+ stateMutability: "view",
870
+ type: "function"
871
+ },
872
+ {
873
+ inputs: [],
874
+ name: "WITHDRAWER_ROLE",
875
+ outputs: [
876
+ {
877
+ internalType: "bytes32",
878
+ name: "",
879
+ type: "bytes32"
880
+ }
881
+ ],
882
+ stateMutability: "view",
883
+ type: "function"
884
+ },
885
+ {
886
+ inputs: [
887
+ {
888
+ internalType: "address",
889
+ name: "token",
890
+ type: "address"
891
+ }
892
+ ],
893
+ name: "accessEncryptedFeeReserve",
894
+ outputs: [
895
+ {
896
+ internalType: "euint64",
897
+ name: "reserve",
898
+ type: "bytes32"
899
+ }
900
+ ],
901
+ stateMutability: "nonpayable",
902
+ type: "function"
903
+ },
904
+ {
905
+ inputs: [
906
+ {
907
+ internalType: "address",
908
+ name: "token",
909
+ type: "address"
910
+ }
911
+ ],
912
+ name: "approveUserWalletsForToken",
913
+ outputs: [],
914
+ stateMutability: "nonpayable",
915
+ type: "function"
916
+ },
917
+ {
918
+ inputs: [
919
+ {
920
+ internalType: "euint64[]",
921
+ name: "handles",
922
+ type: "bytes32[]"
923
+ },
924
+ {
925
+ internalType: "address",
926
+ name: "party",
927
+ type: "address"
928
+ }
929
+ ],
930
+ name: "batchDiscloseHandlesToParty",
931
+ outputs: [],
932
+ stateMutability: "nonpayable",
933
+ type: "function"
934
+ },
935
+ {
936
+ inputs: [],
937
+ name: "confidentialProtocolId",
938
+ outputs: [
939
+ {
940
+ internalType: "uint256",
941
+ name: "",
942
+ type: "uint256"
943
+ }
944
+ ],
945
+ stateMutability: "view",
946
+ type: "function"
947
+ },
948
+ {
949
+ inputs: [
950
+ {
951
+ internalType: "address",
952
+ name: "user",
953
+ type: "address"
954
+ }
955
+ ],
956
+ name: "disableCustomFee",
957
+ outputs: [],
958
+ stateMutability: "nonpayable",
959
+ type: "function"
960
+ },
961
+ {
962
+ inputs: [
963
+ {
964
+ internalType: "euint64",
965
+ name: "handle",
966
+ type: "bytes32"
967
+ },
968
+ {
969
+ internalType: "address",
970
+ name: "party",
971
+ type: "address"
972
+ }
973
+ ],
974
+ name: "discloseHandleToParty",
975
+ outputs: [],
976
+ stateMutability: "nonpayable",
977
+ type: "function"
978
+ },
979
+ {
980
+ inputs: [
981
+ {
982
+ internalType: "address",
983
+ name: "token",
984
+ type: "address"
985
+ },
986
+ {
987
+ internalType: "address[]",
988
+ name: "recipients",
989
+ type: "address[]"
990
+ },
991
+ {
992
+ internalType: "externalEuint64[]",
993
+ name: "encryptedAmounts",
994
+ type: "bytes32[]"
995
+ },
996
+ {
997
+ internalType: "bytes",
998
+ name: "inputProof",
999
+ type: "bytes"
1000
+ }
1001
+ ],
1002
+ name: "disperseConfidentialTokenDirect",
1003
+ outputs: [],
1004
+ stateMutability: "payable",
1005
+ type: "function"
1006
+ },
1007
+ {
1008
+ inputs: [
1009
+ {
1010
+ internalType: "address",
1011
+ name: "token",
1012
+ type: "address"
1013
+ },
1014
+ {
1015
+ internalType: "address[]",
1016
+ name: "recipients",
1017
+ type: "address[]"
1018
+ },
1019
+ {
1020
+ internalType: "externalEuint64[]",
1021
+ name: "encryptedAmounts",
1022
+ type: "bytes32[]"
1023
+ },
1024
+ {
1025
+ internalType: "externalEuint64[2]",
1026
+ name: "encryptedSubtotals",
1027
+ type: "bytes32[2]"
1028
+ },
1029
+ {
1030
+ internalType: "bytes",
1031
+ name: "inputProof",
1032
+ type: "bytes"
1033
+ }
1034
+ ],
1035
+ name: "disperseConfidentialTokens",
1036
+ outputs: [],
1037
+ stateMutability: "payable",
1038
+ type: "function"
1039
+ },
1040
+ {
1041
+ inputs: [
1042
+ {
1043
+ internalType: "address",
1044
+ name: "token",
1045
+ type: "address"
1046
+ },
1047
+ {
1048
+ internalType: "address[]",
1049
+ name: "recipients",
1050
+ type: "address[]"
1051
+ },
1052
+ {
1053
+ internalType: "externalEuint64[]",
1054
+ name: "encryptedAmounts",
1055
+ type: "bytes32[]"
1056
+ },
1057
+ {
1058
+ internalType: "externalEuint64[2]",
1059
+ name: "encryptedSubtotals",
1060
+ type: "bytes32[2]"
1061
+ },
1062
+ {
1063
+ internalType: "bytes",
1064
+ name: "inputProof",
1065
+ type: "bytes"
1066
+ }
1067
+ ],
1068
+ name: "disperseConfidentialTokensWithTokenFee",
1069
+ outputs: [],
1070
+ stateMutability: "nonpayable",
1071
+ type: "function"
1072
+ },
1073
+ {
1074
+ inputs: [],
1075
+ name: "feeConfig",
1076
+ outputs: [
1077
+ {
1078
+ internalType: "bool",
1079
+ name: "gasFeeEnabled",
1080
+ type: "bool"
1081
+ },
1082
+ {
1083
+ internalType: "bool",
1084
+ name: "tokenFeeEnabled",
1085
+ type: "bool"
1086
+ },
1087
+ {
1088
+ internalType: "uint96",
1089
+ name: "defaultGasFee",
1090
+ type: "uint96"
1091
+ },
1092
+ {
1093
+ internalType: "uint16",
1094
+ name: "defaultTokenFee",
1095
+ type: "uint16"
1096
+ }
1097
+ ],
1098
+ stateMutability: "view",
1099
+ type: "function"
1100
+ },
1101
+ {
1102
+ inputs: [
1103
+ {
1104
+ internalType: "address",
1105
+ name: "user",
1106
+ type: "address"
1107
+ }
1108
+ ],
1109
+ name: "getCustomFee",
1110
+ outputs: [
1111
+ {
1112
+ internalType: "bool",
1113
+ name: "enabled",
1114
+ type: "bool"
1115
+ },
1116
+ {
1117
+ internalType: "uint96",
1118
+ name: "gasFee",
1119
+ type: "uint96"
1120
+ },
1121
+ {
1122
+ internalType: "uint16",
1123
+ name: "tokenFee",
1124
+ type: "uint16"
1125
+ }
1126
+ ],
1127
+ stateMutability: "view",
1128
+ type: "function"
1129
+ },
1130
+ {
1131
+ inputs: [
1132
+ {
1133
+ internalType: "address",
1134
+ name: "user",
1135
+ type: "address"
1136
+ }
1137
+ ],
1138
+ name: "getFeeAmounts",
1139
+ outputs: [
1140
+ {
1141
+ internalType: "bool",
1142
+ name: "isCustomFee",
1143
+ type: "bool"
1144
+ },
1145
+ {
1146
+ internalType: "uint96",
1147
+ name: "gasFee",
1148
+ type: "uint96"
1149
+ },
1150
+ {
1151
+ internalType: "uint16",
1152
+ name: "tokenFee",
1153
+ type: "uint16"
1154
+ }
1155
+ ],
1156
+ stateMutability: "view",
1157
+ type: "function"
1158
+ },
1159
+ {
1160
+ inputs: [
1161
+ {
1162
+ internalType: "address",
1163
+ name: "user",
1164
+ type: "address"
1165
+ }
1166
+ ],
1167
+ name: "getGasFee",
1168
+ outputs: [
1169
+ {
1170
+ internalType: "uint96",
1171
+ name: "",
1172
+ type: "uint96"
1173
+ }
1174
+ ],
1175
+ stateMutability: "view",
1176
+ type: "function"
1177
+ },
1178
+ {
1179
+ inputs: [
1180
+ {
1181
+ internalType: "bytes32",
1182
+ name: "role",
1183
+ type: "bytes32"
1184
+ }
1185
+ ],
1186
+ name: "getRoleAdmin",
1187
+ outputs: [
1188
+ {
1189
+ internalType: "bytes32",
1190
+ name: "",
1191
+ type: "bytes32"
1192
+ }
1193
+ ],
1194
+ stateMutability: "view",
1195
+ type: "function"
1196
+ },
1197
+ {
1198
+ inputs: [
1199
+ {
1200
+ internalType: "address",
1201
+ name: "user",
1202
+ type: "address"
1203
+ }
1204
+ ],
1205
+ name: "getTokenFee",
1206
+ outputs: [
1207
+ {
1208
+ internalType: "uint16",
1209
+ name: "",
1210
+ type: "uint16"
1211
+ }
1212
+ ],
1213
+ stateMutability: "view",
1214
+ type: "function"
1215
+ },
1216
+ {
1217
+ inputs: [
1218
+ {
1219
+ internalType: "address",
1220
+ name: "user",
1221
+ type: "address"
1222
+ },
1223
+ {
1224
+ internalType: "uint256",
1225
+ name: "index",
1226
+ type: "uint256"
1227
+ }
1228
+ ],
1229
+ name: "getUserWallet",
1230
+ outputs: [
1231
+ {
1232
+ internalType: "address",
1233
+ name: "",
1234
+ type: "address"
1235
+ }
1236
+ ],
1237
+ stateMutability: "view",
1238
+ type: "function"
1239
+ },
1240
+ {
1241
+ inputs: [
1242
+ {
1243
+ internalType: "bytes32",
1244
+ name: "role",
1245
+ type: "bytes32"
1246
+ },
1247
+ {
1248
+ internalType: "address",
1249
+ name: "account",
1250
+ type: "address"
1251
+ }
1252
+ ],
1253
+ name: "grantRole",
1254
+ outputs: [],
1255
+ stateMutability: "nonpayable",
1256
+ type: "function"
1257
+ },
1258
+ {
1259
+ inputs: [
1260
+ {
1261
+ internalType: "address",
1262
+ name: "user",
1263
+ type: "address"
1264
+ }
1265
+ ],
1266
+ name: "hasCustomFee",
1267
+ outputs: [
1268
+ {
1269
+ internalType: "bool",
1270
+ name: "",
1271
+ type: "bool"
1272
+ }
1273
+ ],
1274
+ stateMutability: "view",
1275
+ type: "function"
1276
+ },
1277
+ {
1278
+ inputs: [
1279
+ {
1280
+ internalType: "bytes32",
1281
+ name: "role",
1282
+ type: "bytes32"
1283
+ },
1284
+ {
1285
+ internalType: "address",
1286
+ name: "account",
1287
+ type: "address"
1288
+ }
1289
+ ],
1290
+ name: "hasRole",
1291
+ outputs: [
1292
+ {
1293
+ internalType: "bool",
1294
+ name: "",
1295
+ type: "bool"
1296
+ }
1297
+ ],
1298
+ stateMutability: "view",
1299
+ type: "function"
1300
+ },
1301
+ {
1302
+ inputs: [
1303
+ {
1304
+ internalType: "address",
1305
+ name: "user",
1306
+ type: "address"
1307
+ }
1308
+ ],
1309
+ name: "isRegistered",
1310
+ outputs: [
1311
+ {
1312
+ internalType: "bool",
1313
+ name: "",
1314
+ type: "bool"
1315
+ }
1316
+ ],
1317
+ stateMutability: "view",
1318
+ type: "function"
1319
+ },
1320
+ {
1321
+ inputs: [],
1322
+ name: "maxBatchSizeDirect",
1323
+ outputs: [
1324
+ {
1325
+ internalType: "uint256",
1326
+ name: "",
1327
+ type: "uint256"
1328
+ }
1329
+ ],
1330
+ stateMutability: "view",
1331
+ type: "function"
1332
+ },
1333
+ {
1334
+ inputs: [],
1335
+ name: "maxBatchSizeHolding",
1336
+ outputs: [
1337
+ {
1338
+ internalType: "uint256",
1339
+ name: "",
1340
+ type: "uint256"
1341
+ }
1342
+ ],
1343
+ stateMutability: "view",
1344
+ type: "function"
1345
+ },
1346
+ {
1347
+ inputs: [],
1348
+ name: "maxBatchSizeTokenFee",
1349
+ outputs: [
1350
+ {
1351
+ internalType: "uint256",
1352
+ name: "",
1353
+ type: "uint256"
1354
+ }
1355
+ ],
1356
+ stateMutability: "view",
1357
+ type: "function"
1358
+ },
1359
+ {
1360
+ inputs: [],
1361
+ name: "pause",
1362
+ outputs: [],
1363
+ stateMutability: "nonpayable",
1364
+ type: "function"
1365
+ },
1366
+ {
1367
+ inputs: [],
1368
+ name: "paused",
1369
+ outputs: [
1370
+ {
1371
+ internalType: "bool",
1372
+ name: "",
1373
+ type: "bool"
1374
+ }
1375
+ ],
1376
+ stateMutability: "view",
1377
+ type: "function"
1378
+ },
1379
+ {
1380
+ inputs: [
1381
+ {
1382
+ internalType: "address",
1383
+ name: "token",
1384
+ type: "address"
1385
+ },
1386
+ {
1387
+ internalType: "address",
1388
+ name: "to",
1389
+ type: "address"
1390
+ }
1391
+ ],
1392
+ name: "recoverERC20FromWallets",
1393
+ outputs: [],
1394
+ stateMutability: "nonpayable",
1395
+ type: "function"
1396
+ },
1397
+ {
1398
+ inputs: [
1399
+ {
1400
+ internalType: "address",
1401
+ name: "token",
1402
+ type: "address"
1403
+ },
1404
+ {
1405
+ internalType: "address",
1406
+ name: "to",
1407
+ type: "address"
1408
+ }
1409
+ ],
1410
+ name: "recoverFromWallets",
1411
+ outputs: [],
1412
+ stateMutability: "nonpayable",
1413
+ type: "function"
1414
+ },
1415
+ {
1416
+ inputs: [
1417
+ {
1418
+ internalType: "address",
1419
+ name: "token",
1420
+ type: "address"
1421
+ }
1422
+ ],
1423
+ name: "register",
1424
+ outputs: [],
1425
+ stateMutability: "nonpayable",
1426
+ type: "function"
1427
+ },
1428
+ {
1429
+ inputs: [
1430
+ {
1431
+ internalType: "bytes32",
1432
+ name: "role",
1433
+ type: "bytes32"
1434
+ },
1435
+ {
1436
+ internalType: "address",
1437
+ name: "callerConfirmation",
1438
+ type: "address"
1439
+ }
1440
+ ],
1441
+ name: "renounceRole",
1442
+ outputs: [],
1443
+ stateMutability: "nonpayable",
1444
+ type: "function"
1445
+ },
1446
+ {
1447
+ inputs: [
1448
+ {
1449
+ internalType: "address",
1450
+ name: "token",
1451
+ type: "address"
1452
+ },
1453
+ {
1454
+ internalType: "address",
1455
+ name: "to",
1456
+ type: "address"
1457
+ }
1458
+ ],
1459
+ name: "rescueConfidentialTokens",
1460
+ outputs: [],
1461
+ stateMutability: "nonpayable",
1462
+ type: "function"
1463
+ },
1464
+ {
1465
+ inputs: [
1466
+ {
1467
+ internalType: "address",
1468
+ name: "token",
1469
+ type: "address"
1470
+ },
1471
+ {
1472
+ internalType: "address",
1473
+ name: "to",
1474
+ type: "address"
1475
+ }
1476
+ ],
1477
+ name: "rescueERC20",
1478
+ outputs: [],
1479
+ stateMutability: "nonpayable",
1480
+ type: "function"
1481
+ },
1482
+ {
1483
+ inputs: [
1484
+ {
1485
+ internalType: "bytes32",
1486
+ name: "role",
1487
+ type: "bytes32"
1488
+ },
1489
+ {
1490
+ internalType: "address",
1491
+ name: "account",
1492
+ type: "address"
1493
+ }
1494
+ ],
1495
+ name: "revokeRole",
1496
+ outputs: [],
1497
+ stateMutability: "nonpayable",
1498
+ type: "function"
1499
+ },
1500
+ {
1501
+ inputs: [
1502
+ {
1503
+ internalType: "address",
1504
+ name: "token",
1505
+ type: "address"
1506
+ }
1507
+ ],
1508
+ name: "revokeUserWalletsForToken",
1509
+ outputs: [],
1510
+ stateMutability: "nonpayable",
1511
+ type: "function"
1512
+ },
1513
+ {
1514
+ inputs: [
1515
+ {
1516
+ internalType: "address",
1517
+ name: "user",
1518
+ type: "address"
1519
+ },
1520
+ {
1521
+ internalType: "uint96",
1522
+ name: "gasFee",
1523
+ type: "uint96"
1524
+ },
1525
+ {
1526
+ internalType: "uint16",
1527
+ name: "tokenFee",
1528
+ type: "uint16"
1529
+ }
1530
+ ],
1531
+ name: "setCustomFee",
1532
+ outputs: [],
1533
+ stateMutability: "nonpayable",
1534
+ type: "function"
1535
+ },
1536
+ {
1537
+ inputs: [
1538
+ {
1539
+ components: [
1540
+ {
1541
+ internalType: "bool",
1542
+ name: "gasFeeEnabled",
1543
+ type: "bool"
1544
+ },
1545
+ {
1546
+ internalType: "bool",
1547
+ name: "tokenFeeEnabled",
1548
+ type: "bool"
1549
+ },
1550
+ {
1551
+ internalType: "uint96",
1552
+ name: "defaultGasFee",
1553
+ type: "uint96"
1554
+ },
1555
+ {
1556
+ internalType: "uint16",
1557
+ name: "defaultTokenFee",
1558
+ type: "uint16"
1559
+ }
1560
+ ],
1561
+ internalType: "struct IDisperseConfidential.FeeConfig",
1562
+ name: "config",
1563
+ type: "tuple"
1564
+ }
1565
+ ],
1566
+ name: "setFeeConfig",
1567
+ outputs: [],
1568
+ stateMutability: "nonpayable",
1569
+ type: "function"
1570
+ },
1571
+ {
1572
+ inputs: [
1573
+ {
1574
+ internalType: "uint256",
1575
+ name: "size",
1576
+ type: "uint256"
1577
+ }
1578
+ ],
1579
+ name: "setMaxBatchSizeDirect",
1580
+ outputs: [],
1581
+ stateMutability: "nonpayable",
1582
+ type: "function"
1583
+ },
1584
+ {
1585
+ inputs: [
1586
+ {
1587
+ internalType: "uint256",
1588
+ name: "size",
1589
+ type: "uint256"
1590
+ }
1591
+ ],
1592
+ name: "setMaxBatchSizeHolding",
1593
+ outputs: [],
1594
+ stateMutability: "nonpayable",
1595
+ type: "function"
1596
+ },
1597
+ {
1598
+ inputs: [
1599
+ {
1600
+ internalType: "uint256",
1601
+ name: "size",
1602
+ type: "uint256"
1603
+ }
1604
+ ],
1605
+ name: "setMaxBatchSizeTokenFee",
1606
+ outputs: [],
1607
+ stateMutability: "nonpayable",
1608
+ type: "function"
1609
+ },
1610
+ {
1611
+ inputs: [
1612
+ {
1613
+ internalType: "bytes4",
1614
+ name: "interfaceId",
1615
+ type: "bytes4"
1616
+ }
1617
+ ],
1618
+ name: "supportsInterface",
1619
+ outputs: [
1620
+ {
1621
+ internalType: "bool",
1622
+ name: "",
1623
+ type: "bool"
1624
+ }
1625
+ ],
1626
+ stateMutability: "view",
1627
+ type: "function"
1628
+ },
1629
+ {
1630
+ inputs: [],
1631
+ name: "unpause",
1632
+ outputs: [],
1633
+ stateMutability: "nonpayable",
1634
+ type: "function"
1635
+ },
1636
+ {
1637
+ inputs: [
1638
+ {
1639
+ internalType: "address",
1640
+ name: "to",
1641
+ type: "address"
1642
+ },
1643
+ {
1644
+ internalType: "uint256",
1645
+ name: "amount",
1646
+ type: "uint256"
1647
+ }
1648
+ ],
1649
+ name: "withdrawGasFee",
1650
+ outputs: [],
1651
+ stateMutability: "nonpayable",
1652
+ type: "function"
1653
+ },
1654
+ {
1655
+ inputs: [
1656
+ {
1657
+ internalType: "address",
1658
+ name: "token",
1659
+ type: "address"
1660
+ },
1661
+ {
1662
+ internalType: "address",
1663
+ name: "to",
1664
+ type: "address"
1665
+ },
1666
+ {
1667
+ internalType: "externalEuint64",
1668
+ name: "encryptedAmount",
1669
+ type: "bytes32"
1670
+ },
1671
+ {
1672
+ internalType: "bytes",
1673
+ name: "inputProof",
1674
+ type: "bytes"
1675
+ }
1676
+ ],
1677
+ name: "withdrawTokenFee",
1678
+ outputs: [],
1679
+ stateMutability: "nonpayable",
1680
+ type: "function"
1681
+ }
1682
+ ];
1683
+ function resolveEncryptor(source) {
1684
+ if (source === void 0) return void 0;
1685
+ return typeof source === "function" ? source() : source;
1686
+ }
1687
+ var MAX_UINT64 = (1n << 64n) - 1n;
1688
+ function assertUint64(value, label) {
1689
+ if (value < 0n || value > MAX_UINT64) {
1690
+ throw new InvalidArgumentError({
1691
+ method: "encryptUint64",
1692
+ argument: label,
1693
+ reason: "exceeds uint64 range (0..2^64-1)",
1694
+ value
1695
+ });
1696
+ }
1697
+ }
1698
+ async function encryptUint64({
1699
+ encryptor,
1700
+ contractAddress,
1701
+ userAddress,
1702
+ value
1703
+ }) {
1704
+ assertUint64(value, "value");
1705
+ const { handles, inputProof } = await encryptor.encrypt({
1706
+ values: [{ value, type: "euint64" }],
1707
+ contractAddress,
1708
+ userAddress
1709
+ });
1710
+ if (handles.length !== 1) {
1711
+ throw new InvalidArgumentError({
1712
+ method: "encryptUint64",
1713
+ argument: "handles",
1714
+ reason: `expected 1 handle, got ${handles.length}`,
1715
+ value: handles.length
1716
+ });
1717
+ }
1718
+ return {
1719
+ handle: asEncryptedHandle(bytesToHex(handles[0])),
1720
+ inputProof: asExternalInputProof(bytesToHex(inputProof))
1721
+ };
1722
+ }
1723
+ async function encryptUint64Batch({
1724
+ encryptor,
1725
+ contractAddress,
1726
+ userAddress,
1727
+ values
1728
+ }) {
1729
+ if (values.length === 0) {
1730
+ throw new InvalidArgumentError({
1731
+ method: "encryptUint64Batch",
1732
+ argument: "values",
1733
+ reason: "must be non-empty"
1734
+ });
1735
+ }
1736
+ values.forEach((v, i) => assertUint64(v, `values[${i}]`));
1737
+ const { handles, inputProof } = await encryptor.encrypt({
1738
+ values: values.map((value) => ({ value, type: "euint64" })),
1739
+ contractAddress,
1740
+ userAddress
1741
+ });
1742
+ if (handles.length !== values.length) {
1743
+ throw new InvalidArgumentError({
1744
+ method: "encryptUint64Batch",
1745
+ argument: "handles",
1746
+ reason: `expected ${values.length} handles, got ${handles.length}`,
1747
+ value: handles.length
1748
+ });
1749
+ }
1750
+ return {
1751
+ handles: handles.map((h) => asEncryptedHandle(bytesToHex(h))),
1752
+ inputProof: asExternalInputProof(bytesToHex(inputProof))
1753
+ };
1754
+ }
1755
+
1756
+ // src/fhe-disperse/errors.ts
1757
+ var NotRegisteredError = class extends TokenOpsSdkError {
1758
+ name = "NotRegisteredError";
1759
+ constructor(args) {
1760
+ super(
1761
+ `${args.method}: ${args.user} has not registered with the disperse singleton. Call \`register(token)\` first.`,
1762
+ {
1763
+ code: "TOKENOPS_NOT_REGISTERED",
1764
+ cause: args.cause,
1765
+ context: {
1766
+ method: args.method,
1767
+ contractAddress: args.contractAddress,
1768
+ user: args.user
1769
+ }
1770
+ }
1771
+ );
1772
+ }
1773
+ };
1774
+ var AlreadyRegisteredError = class extends TokenOpsSdkError {
1775
+ name = "AlreadyRegisteredError";
1776
+ constructor(args) {
1777
+ super(
1778
+ `${args.method}: ${args.user} is already registered. Use \`approveUserWalletsForToken\` to whitelist additional tokens.`,
1779
+ {
1780
+ code: "TOKENOPS_ALREADY_REGISTERED",
1781
+ cause: args.cause,
1782
+ context: {
1783
+ method: args.method,
1784
+ contractAddress: args.contractAddress,
1785
+ user: args.user
1786
+ }
1787
+ }
1788
+ );
1789
+ }
1790
+ };
1791
+
1792
+ // src/fhe-disperse/subtotals.ts
1793
+ function computeSubtotals(amounts) {
1794
+ const count = amounts.length;
1795
+ const baseSize = Math.floor(count / 2);
1796
+ const remainder = count % 2;
1797
+ const group0Size = baseSize + remainder;
1798
+ let group0 = 0n;
1799
+ let group1 = 0n;
1800
+ for (let i = 0; i < group0Size; i++) group0 += amounts[i];
1801
+ for (let i = group0Size; i < count; i++) group1 += amounts[i];
1802
+ return { group0, group1 };
1803
+ }
1804
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
1805
+ var MAX_UINT642 = (1n << 64n) - 1n;
1806
+ function validateDisperseInputs(args) {
1807
+ const { recipients, amounts, mode, batchLimit, method, contractAddress } = args;
1808
+ const errors = [];
1809
+ if (recipients.length === 0) {
1810
+ errors.push(
1811
+ new InvalidArgumentError({
1812
+ method,
1813
+ argument: "recipients",
1814
+ reason: "must be non-empty"
1815
+ })
1816
+ );
1817
+ }
1818
+ if (amounts.length !== recipients.length) {
1819
+ errors.push(
1820
+ new InvalidArgumentError({
1821
+ method,
1822
+ argument: "amounts",
1823
+ reason: `length mismatch: recipients.length (${recipients.length}) !== amounts.length (${amounts.length})`
1824
+ })
1825
+ );
1826
+ }
1827
+ recipients.forEach((r, i) => {
1828
+ if (!isAddress(r, { strict: true })) {
1829
+ errors.push(
1830
+ new InvalidArgumentError({
1831
+ method,
1832
+ argument: `recipients[${i}]`,
1833
+ reason: "must be a valid EIP-55 checksummed address",
1834
+ value: r
1835
+ })
1836
+ );
1837
+ return;
1838
+ }
1839
+ if (r === ZERO_ADDRESS) {
1840
+ errors.push(
1841
+ new InvalidArgumentError({
1842
+ method,
1843
+ argument: `recipients[${i}]`,
1844
+ reason: "zero address",
1845
+ value: r
1846
+ })
1847
+ );
1848
+ }
1849
+ });
1850
+ amounts.forEach((v, i) => {
1851
+ if (v < 0n || v > MAX_UINT642) {
1852
+ errors.push(
1853
+ new InvalidArgumentError({
1854
+ method,
1855
+ argument: `amounts[${i}]`,
1856
+ reason: "exceeds uint64 range (0..2^64-1)"
1857
+ })
1858
+ );
1859
+ }
1860
+ });
1861
+ const perAmountOk = errors.every((e) => !e.context.argument?.toString().startsWith("amounts["));
1862
+ const lengthsOk = recipients.length > 0 && amounts.length === recipients.length;
1863
+ if (mode !== "direct" && perAmountOk && lengthsOk) {
1864
+ const { group0, group1 } = computeSubtotals([...amounts]);
1865
+ if (group0 > MAX_UINT642) {
1866
+ errors.push(
1867
+ new InvalidArgumentError({
1868
+ method,
1869
+ argument: "amounts",
1870
+ reason: "wallet-mode subtotal exceeds uint64 range"
1871
+ })
1872
+ );
1873
+ }
1874
+ if (group1 > MAX_UINT642) {
1875
+ errors.push(
1876
+ new InvalidArgumentError({
1877
+ method,
1878
+ argument: "amounts",
1879
+ reason: "wallet-mode subtotal exceeds uint64 range"
1880
+ })
1881
+ );
1882
+ }
1883
+ if (group0 <= MAX_UINT642 && group1 <= MAX_UINT642 && group0 + group1 > MAX_UINT642) {
1884
+ errors.push(
1885
+ new InvalidArgumentError({
1886
+ method,
1887
+ argument: "amounts",
1888
+ reason: "wallet-mode subtotals sum exceeds uint64 range (would silently zero on-chain)"
1889
+ })
1890
+ );
1891
+ }
1892
+ }
1893
+ if (batchLimit > 0n && BigInt(recipients.length) > batchLimit) {
1894
+ errors.push(
1895
+ new BatchTooLargeError({
1896
+ method,
1897
+ contractAddress,
1898
+ requested: recipients.length,
1899
+ max: batchLimit
1900
+ })
1901
+ );
1902
+ }
1903
+ return errors;
1904
+ }
1905
+ function assertChecksumAddress(value, argument, method) {
1906
+ if (value === void 0) return;
1907
+ if (!isAddress(value, { strict: true })) {
1908
+ throw new InvalidArgumentError({
1909
+ method,
1910
+ argument,
1911
+ reason: "must be a valid EIP-55 checksummed address \u2014 use viem's getAddress(addr) to fix the checksum",
1912
+ value
1913
+ });
1914
+ }
1915
+ }
1916
+ function assertNonZeroChecksumAddress(value, argument, method) {
1917
+ if (value === void 0) return;
1918
+ assertChecksumAddress(value, argument, method);
1919
+ if (value === ZERO_ADDRESS) {
1920
+ throw new InvalidArgumentError({
1921
+ method,
1922
+ argument,
1923
+ reason: "must not be the zero address",
1924
+ value
1925
+ });
1926
+ }
1927
+ }
1928
+ function batchLimitForMode(mode, limits) {
1929
+ if (mode === "direct") return limits.direct;
1930
+ if (mode === "wallet-token-fee") return limits.tokenFee;
1931
+ return limits.holding;
1932
+ }
1933
+
1934
+ // src/fhe-disperse/types.ts
1935
+ var DisperseSubwalletNotFoundError = class extends TokenOpsSdkError {
1936
+ name = "DisperseSubwalletNotFoundError";
1937
+ constructor(txHash, singletonAddress) {
1938
+ super(
1939
+ `register: no UserRegistered event from singleton ${singletonAddress} in tx ${txHash} \u2014 the registration may have reverted silently.`,
1940
+ {
1941
+ code: "TOKENOPS_RECEIPT_EVENT_NOT_FOUND",
1942
+ context: { txHash, singletonAddress }
1943
+ }
1944
+ );
1945
+ }
1946
+ };
1947
+ var DisperseEncryptedReserveNotGrantedError = class extends TokenOpsSdkError {
1948
+ name = "DisperseEncryptedReserveNotGrantedError";
1949
+ constructor(txHash, callerAddress) {
1950
+ super(
1951
+ `getEncryptedFeeReserve: no ACL Allowed event granting ${callerAddress} access to the fee reserve handle was found in tx ${txHash}. The fee reserve for this token may be uninitialized (no fees have accrued yet).`,
1952
+ {
1953
+ code: "TOKENOPS_RECEIPT_EVENT_NOT_FOUND",
1954
+ context: { txHash, callerAddress }
1955
+ }
1956
+ );
1957
+ }
1958
+ };
1959
+
1960
+ // src/fhe-disperse/singleton.ts
1961
+ var disperseProductMapper = (name, _args, ctx) => {
1962
+ const user = ctx.productContext?.["user"] ?? ZERO_ADDRESS2;
1963
+ switch (name) {
1964
+ case "UserAlreadyRegistered":
1965
+ return new AlreadyRegisteredError({ ...ctx, user });
1966
+ case "UserNotRegistered":
1967
+ return new NotRegisteredError({ ...ctx, user });
1968
+ case "ContractNotAllowed":
1969
+ return new InvalidArgumentError({
1970
+ method: ctx.method,
1971
+ argument: "handle",
1972
+ reason: "the handle's origin contract did not grant this singleton persistent ACL on the handle. ERC-7984 `transferred` handles are scoped to the token contract \u2014 disclose them through the token, not through `DisperseConfidential`."
1973
+ });
1974
+ default:
1975
+ return void 0;
1976
+ }
1977
+ };
1978
+ var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
1979
+ var ERC7984_IS_OPERATOR_ABI = [
1980
+ {
1981
+ inputs: [
1982
+ { name: "holder", type: "address" },
1983
+ { name: "spender", type: "address" }
1984
+ ],
1985
+ name: "isOperator",
1986
+ outputs: [{ name: "", type: "bool" }],
1987
+ stateMutability: "view",
1988
+ type: "function"
1989
+ }
1990
+ ];
1991
+ function predictErc1167Address(implementation, salt, deployer) {
1992
+ const initCode = `0x3d602d80600a3d3981f3363d3d373d3d3d363d73${implementation.slice(2)}5af43d82803e903d91602b57fd5bf3`;
1993
+ return getCreate2Address({
1994
+ from: deployer,
1995
+ salt,
1996
+ bytecodeHash: keccak256(initCode)
1997
+ });
1998
+ }
1999
+ var ConfidentialDisperseClient = class {
2000
+ publicClient;
2001
+ walletClient;
2002
+ address;
2003
+ encryptor;
2004
+ #aclAddressOverride;
2005
+ #telemetry;
2006
+ #cachedAclAddress;
2007
+ constructor(config) {
2008
+ this.publicClient = config.publicClient;
2009
+ this.walletClient = config.walletClient;
2010
+ this.encryptor = config.encryptor;
2011
+ this.#telemetry = config.telemetry;
2012
+ const chainId = config.chainId ?? config.publicClient.chain?.id;
2013
+ const addressOverride = config.address ? normaliseAddress(config.address) : void 0;
2014
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : getFheDisperseSingletonAddress(chainId));
2015
+ if (!resolved) {
2016
+ throw new DeploymentAddressUnavailableError({
2017
+ reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
2018
+ product: "fheDisperse",
2019
+ contract: "disperseConfidentialSingleton",
2020
+ chainId,
2021
+ clientLabel: "ConfidentialDisperseClient"
2022
+ });
2023
+ }
2024
+ this.address = resolved;
2025
+ this.#aclAddressOverride = config.aclAddress;
2026
+ this.#telemetry?.event("fhe-disperse.client.init", {
2027
+ surface: "singleton",
2028
+ chainId: chainId ?? null,
2029
+ hasWallet: !!this.walletClient,
2030
+ aclResolved: !!config.aclAddress || chainId !== void 0 && !!getFhevmAclAddress(chainId),
2031
+ sdkVersion: SDK_VERSION
2032
+ });
2033
+ }
2034
+ /**
2035
+ * The FHEVM ACL contract address used by encrypted-view methods to parse
2036
+ * `ACL.Allowed` events. Resolved lazily on first access; throws
2037
+ * `DeploymentAddressUnavailableError` if no override was passed and the
2038
+ * SDK does not have an ACL deployed for the connected chain.
2039
+ */
2040
+ get aclAddress() {
2041
+ if (this.#cachedAclAddress) return this.#cachedAclAddress;
2042
+ this.#cachedAclAddress = this.#aclAddressOverride ?? requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialDisperseClient");
2043
+ return this.#cachedAclAddress;
2044
+ }
2045
+ // ============================================================
2046
+ // READ METHODS
2047
+ // ============================================================
2048
+ /**
2049
+ * Check whether a user has registered their wallet pair via `register(token)`.
2050
+ */
2051
+ async isRegistered(user) {
2052
+ assertChecksumAddress(user, "user", "isRegistered");
2053
+ return this.#read("isRegistered", [user]);
2054
+ }
2055
+ /**
2056
+ * Return the on-chain wallet pair for a registered user, or `null` if not registered.
2057
+ *
2058
+ * Both wallet addresses are fetched in parallel via `getUserWallet(user, 0|1)`.
2059
+ * For unregistered users, call {@link predictWallets} to get the deterministic
2060
+ * addresses they would get after registration.
2061
+ */
2062
+ async getWallets(user) {
2063
+ assertChecksumAddress(user, "user", "getWallets");
2064
+ const registered = await this.isRegistered(user);
2065
+ if (!registered) return null;
2066
+ const [wallet0, wallet1] = await Promise.all([
2067
+ this.#read("getUserWallet", [user, 0n]),
2068
+ this.#read("getUserWallet", [user, 1n])
2069
+ ]);
2070
+ return [wallet0, wallet1];
2071
+ }
2072
+ /**
2073
+ * Deterministically predict the wallet addresses a user would get after
2074
+ * calling `register()`, even before registration.
2075
+ *
2076
+ * Reads `WALLET_IMPLEMENTATION()` once from chain, then applies the same
2077
+ * `keccak256(abi.encodePacked(user, uint256(0|1)))` salt scheme used in the
2078
+ * contract's `_registerWallets` function.
2079
+ *
2080
+ * Note: `Clones.predictDeterministicAddress(impl, salt)` without an explicit
2081
+ * deployer uses `address(this)` (the singleton) as the deployer — mirrored here.
2082
+ */
2083
+ async predictWallets(user) {
2084
+ assertChecksumAddress(user, "user", "predictWallets");
2085
+ const impl = await this.#read("WALLET_IMPLEMENTATION");
2086
+ const salt0 = keccak256(encodePacked(["address", "uint256"], [user, 0n]));
2087
+ const salt1 = keccak256(encodePacked(["address", "uint256"], [user, 1n]));
2088
+ const w0 = predictErc1167Address(impl, salt0, this.address);
2089
+ const w1 = predictErc1167Address(impl, salt1, this.address);
2090
+ return [w0, w1];
2091
+ }
2092
+ /**
2093
+ * Return consolidated fee information for a user in a single helper.
2094
+ *
2095
+ * Combines `getFeeAmounts(user)` (per-user resolved fees) and `feeConfig()`
2096
+ * (global toggles) in two parallel RPC calls. UI code calls this to render
2097
+ * the fee panel before the user submits.
2098
+ */
2099
+ async getFees(user) {
2100
+ assertChecksumAddress(user, "user", "getFees");
2101
+ const [feeAmounts, cfg] = await Promise.all([
2102
+ this.#read("getFeeAmounts", [user]),
2103
+ this.#read("feeConfig")
2104
+ ]);
2105
+ const [isCustomFee, gasFee, tokenFee] = feeAmounts;
2106
+ const [gasFeeEnabled, tokenFeeEnabled] = cfg;
2107
+ return {
2108
+ isCustom: isCustomFee,
2109
+ gasFeeWei: gasFee,
2110
+ tokenFeeBps: tokenFee,
2111
+ gasFeeEnabled,
2112
+ tokenFeeEnabled
2113
+ };
2114
+ }
2115
+ /**
2116
+ * Read the raw per-user fee override stored on-chain, BEFORE the global
2117
+ * toggles are applied. Returns `{ enabled: false, gasFeeWei: 0n,
2118
+ * tokenFeeBps: 0 }` when no override exists for `user`.
2119
+ *
2120
+ * Use this — not {@link getFees} — when you need to distinguish "no
2121
+ * override set" from "override set but globally disabled". The resolved
2122
+ * shape is in {@link getFees}.
2123
+ */
2124
+ async getCustomFee(user) {
2125
+ assertChecksumAddress(user, "user", "getCustomFee");
2126
+ const [enabled, gasFeeWei, tokenFeeBps] = await this.#read(
2127
+ "getCustomFee",
2128
+ [user]
2129
+ );
2130
+ return { enabled, gasFeeWei, tokenFeeBps };
2131
+ }
2132
+ /**
2133
+ * Return the on-chain global fee configuration.
2134
+ *
2135
+ * Round-trips against {@link setFeeConfig} — pass the result back unchanged
2136
+ * to update one toggle without re-stating the others. Note that ABI outputs
2137
+ * are positional, not named — viem decodes the tuple as an array.
2138
+ */
2139
+ async getFeeConfig() {
2140
+ const [gasFeeEnabled, tokenFeeEnabled, defaultGasFee, defaultTokenFee] = await this.#read("feeConfig");
2141
+ return { gasFeeEnabled, tokenFeeEnabled, defaultGasFee, defaultTokenFee };
2142
+ }
2143
+ /**
2144
+ * Return batch size limits for all three disperse modes.
2145
+ * `0n` means no limit is configured.
2146
+ */
2147
+ async getBatchLimits() {
2148
+ const [holding, direct, tokenFee] = await Promise.all([
2149
+ this.#read("maxBatchSizeHolding"),
2150
+ this.#read("maxBatchSizeDirect"),
2151
+ this.#read("maxBatchSizeTokenFee")
2152
+ ]);
2153
+ return { holding, direct, tokenFee };
2154
+ }
2155
+ /**
2156
+ * Calculate the fee for a specific disperse call without writing to chain.
2157
+ *
2158
+ * Reads live fee data via `getFeeAmounts(user)` and computes:
2159
+ * - `"wallet"` / `"direct"`: `ethValue = recipients * gasFeeWei`, no token fee.
2160
+ * - `"wallet-token-fee"`: `ethValue = 0n`, `tokenFeeAmount = totalTokens * tokenFeeBps / 10000n`.
2161
+ *
2162
+ * **For `"wallet-token-fee"` mode**, the on-chain fee base is the
2163
+ * post-cap subtotal sum (`subtotal0 + subtotal1`), not `sum(amounts[])`.
2164
+ * The two differ only when the caller has independently constructed subtotals
2165
+ * that don't match `sum(amounts)` — pass `totalTokens === subtotal0 +
2166
+ * subtotal1` for the result to match the on-chain computation. Both this
2167
+ * SDK and the contract round the BPS multiplication down (floor division).
2168
+ *
2169
+ * @throws {TokenOpsSdkError} if mode is `"wallet-token-fee"` and `totalTokens` is not provided.
2170
+ */
2171
+ async calculateFee(args) {
2172
+ const fees = await this.getFees(args.user);
2173
+ if (args.mode === "wallet-token-fee") {
2174
+ if (args.totalTokens === void 0) {
2175
+ throw new InvalidArgumentError({
2176
+ method: "calculateFee",
2177
+ argument: "totalTokens",
2178
+ reason: "is required for wallet-token-fee mode"
2179
+ });
2180
+ }
2181
+ const tokenFeeAmount = args.totalTokens * BigInt(fees.tokenFeeBps) / 10000n;
2182
+ return { ethValue: 0n, tokenFeeAmount };
2183
+ }
2184
+ return { ethValue: BigInt(args.recipients) * fees.gasFeeWei };
2185
+ }
2186
+ /**
2187
+ * Check whether a user's registered subwallets have approved the singleton
2188
+ * as an ERC-7984 operator for the given token.
2189
+ *
2190
+ * Calls `isOperator(wallet, singleton)` on the token contract for each wallet.
2191
+ * Both wallets must return `true` for wallet-mode disperses to work.
2192
+ *
2193
+ * Note: this requires the user to already be registered. For unregistered
2194
+ * users, call {@link predictWallets} first and check predicted addresses.
2195
+ */
2196
+ async hasApprovedSubwallets(args) {
2197
+ assertChecksumAddress(args.user, "user", "hasApprovedSubwallets");
2198
+ assertChecksumAddress(args.token, "token", "hasApprovedSubwallets");
2199
+ const wallets = await this.getWallets(args.user);
2200
+ if (!wallets) {
2201
+ return { wallet0: false, wallet1: false, both: false };
2202
+ }
2203
+ const [w0, w1] = wallets;
2204
+ const [ok0, ok1] = await Promise.all([
2205
+ this.publicClient.readContract({
2206
+ address: args.token,
2207
+ abi: ERC7984_IS_OPERATOR_ABI,
2208
+ functionName: "isOperator",
2209
+ args: [w0, this.address]
2210
+ }),
2211
+ this.publicClient.readContract({
2212
+ address: args.token,
2213
+ abi: ERC7984_IS_OPERATOR_ABI,
2214
+ functionName: "isOperator",
2215
+ args: [w1, this.address]
2216
+ })
2217
+ ]);
2218
+ return { wallet0: ok0, wallet1: ok1, both: ok0 && ok1 };
2219
+ }
2220
+ // ============================================================
2221
+ // PRE-FLIGHT HELPER
2222
+ // ============================================================
2223
+ /**
2224
+ * Comprehensive pre-flight report. One call gives a UI everything it needs
2225
+ * to render a "ready to disperse" checklist.
2226
+ *
2227
+ * Internally composes:
2228
+ * - `isRegistered` + `getWallets` / `predictWallets`
2229
+ * - `hasApprovedSubwallets` (wallet modes) or `isOperator(sender, singleton)` (direct mode)
2230
+ * - `calculateFee` / `getBatchLimits`
2231
+ * - Structural recipient + amount validation
2232
+ */
2233
+ async preflightDisperse(args) {
2234
+ const { user, token, recipients, amounts, mode } = args;
2235
+ assertChecksumAddress(user, "user", "preflightDisperse");
2236
+ assertChecksumAddress(token, "token", "preflightDisperse");
2237
+ const [isUserRegistered, predictedWallets, batchLimits, callerBalance, isPaused] = await Promise.all([
2238
+ this.isRegistered(user),
2239
+ this.predictWallets(user),
2240
+ this.getBatchLimits(),
2241
+ this.publicClient.getBalance({ address: user }),
2242
+ this.paused()
2243
+ ]);
2244
+ const wallets = isUserRegistered ? await this.getWallets(user) : null;
2245
+ let hasApprovedSubwallets = {
2246
+ wallet0: false,
2247
+ wallet1: false,
2248
+ both: false
2249
+ };
2250
+ let hasApprovedSingleton = null;
2251
+ if (mode === "direct") {
2252
+ hasApprovedSingleton = await this.publicClient.readContract({
2253
+ address: token,
2254
+ abi: ERC7984_IS_OPERATOR_ABI,
2255
+ functionName: "isOperator",
2256
+ args: [user, this.address]
2257
+ });
2258
+ } else {
2259
+ if (isUserRegistered) {
2260
+ hasApprovedSubwallets = await this.hasApprovedSubwallets({ user, token });
2261
+ } else if (predictedWallets) {
2262
+ const [ok0, ok1] = await Promise.all([
2263
+ this.publicClient.readContract({
2264
+ address: token,
2265
+ abi: ERC7984_IS_OPERATOR_ABI,
2266
+ functionName: "isOperator",
2267
+ args: [predictedWallets[0], this.address]
2268
+ }),
2269
+ this.publicClient.readContract({
2270
+ address: token,
2271
+ abi: ERC7984_IS_OPERATOR_ABI,
2272
+ functionName: "isOperator",
2273
+ args: [predictedWallets[1], this.address]
2274
+ })
2275
+ ]);
2276
+ hasApprovedSubwallets = { wallet0: ok0, wallet1: ok1, both: ok0 && ok1 };
2277
+ }
2278
+ }
2279
+ const totalTokens = amounts.reduce((a, b) => a + b, 0n);
2280
+ const fee = await this.calculateFee({
2281
+ user,
2282
+ mode,
2283
+ recipients: recipients.length,
2284
+ totalTokens: mode === "wallet-token-fee" ? totalTokens : void 0
2285
+ });
2286
+ const limit = batchLimitForMode(mode, batchLimits);
2287
+ const batchOk = limit === 0n || BigInt(recipients.length) <= limit;
2288
+ const recipientChecks = recipients.map((addr) => {
2289
+ if (addr === "0x0000000000000000000000000000000000000000") {
2290
+ return { address: addr, ok: false, reason: "Zero address" };
2291
+ }
2292
+ return { address: addr, ok: true };
2293
+ });
2294
+ const amountsOk = amounts.length === recipients.length && amounts.length > 0;
2295
+ const allAmountsInUint64 = amountsOk && amounts.every((v) => v >= 0n && v < 1n << 64n);
2296
+ let subtotals;
2297
+ if (mode !== "direct" && allAmountsInUint64) {
2298
+ subtotals = computeSubtotals([...amounts]);
2299
+ }
2300
+ const blockers = [];
2301
+ const blockerErrors = [];
2302
+ const deterministicErrors = validateDisperseInputs({
2303
+ recipients,
2304
+ amounts,
2305
+ mode,
2306
+ batchLimit: limit,
2307
+ method: "preflightDisperse",
2308
+ contractAddress: this.address
2309
+ });
2310
+ for (const err of deterministicErrors) {
2311
+ blockerErrors.push(err);
2312
+ blockers.push(err.message);
2313
+ }
2314
+ if (mode !== "direct" && !isUserRegistered) {
2315
+ blockers.push("User is not registered");
2316
+ blockerErrors.push(
2317
+ new NotRegisteredError({
2318
+ method: "preflightDisperse",
2319
+ contractAddress: this.address,
2320
+ user: args.user
2321
+ })
2322
+ );
2323
+ } else if (mode === "wallet" || mode === "wallet-token-fee") {
2324
+ if (!hasApprovedSubwallets.both)
2325
+ blockers.push(
2326
+ `Wallets not fully approved for token \u2014 wallet0: ${hasApprovedSubwallets.wallet0}, wallet1: ${hasApprovedSubwallets.wallet1}`
2327
+ );
2328
+ }
2329
+ if (mode === "direct" && hasApprovedSingleton === false) {
2330
+ blockers.push("Sender has not approved the singleton as operator on the token");
2331
+ }
2332
+ if (isPaused) {
2333
+ blockers.push("Singleton is paused");
2334
+ blockerErrors.push(
2335
+ new PausedError({ method: "preflightDisperse", contractAddress: this.address })
2336
+ );
2337
+ }
2338
+ if (callerBalance < fee.ethValue) {
2339
+ blockerErrors.push(
2340
+ new InsufficientFeeError({
2341
+ method: "preflightDisperse",
2342
+ contractAddress: this.address,
2343
+ feeKind: "gas",
2344
+ required: fee.ethValue,
2345
+ provided: callerBalance
2346
+ })
2347
+ );
2348
+ blockers.push(
2349
+ `User ETH balance (${callerBalance.toString()} wei) is below the required gas fee (${fee.ethValue.toString()} wei)`
2350
+ );
2351
+ }
2352
+ return {
2353
+ isUserRegistered,
2354
+ wallets,
2355
+ predictedWallets,
2356
+ hasApprovedSubwallets,
2357
+ hasApprovedSingleton,
2358
+ feeEth: fee.ethValue,
2359
+ feeTokenAmount: fee.tokenFeeAmount,
2360
+ batchLimit: limit,
2361
+ batchOk,
2362
+ recipientChecks,
2363
+ amountsOk,
2364
+ subtotals,
2365
+ ready: blockers.length === 0,
2366
+ blockers,
2367
+ blockerErrors
2368
+ };
2369
+ }
2370
+ // ============================================================
2371
+ // WRITE METHODS
2372
+ // ============================================================
2373
+ /**
2374
+ * Register the caller's dedicated wallet pair for wallet-mode disperses.
2375
+ *
2376
+ * Deploys two deterministic ERC-1167 wallet clones and approves them for `token`.
2377
+ * Can only be called once per user — subsequent calls revert with `UserAlreadyRegistered`.
2378
+ *
2379
+ * @returns `{ hash, wallets }` — `wallets` is parsed from the `UserRegistered` event.
2380
+ * @throws {DisperseSubwalletNotFoundError} if no `UserRegistered` event matching the singleton is found.
2381
+ */
2382
+ async register(args) {
2383
+ return withTelemetry(this.#telemetry, "fhe-disperse.singleton.register", async () => {
2384
+ assertChecksumAddress(args.token, "token", "register");
2385
+ const wallet = this.#requireWallet("register");
2386
+ const account = this.#resolveAccount(wallet, args.account, "register");
2387
+ const userAddress = accountAddress(account);
2388
+ await this.#preflightWrite("register", "register", [args.token], account, {
2389
+ user: userAddress
2390
+ });
2391
+ let hash;
2392
+ try {
2393
+ hash = await wallet.writeContract({
2394
+ address: this.address,
2395
+ abi: disperseConfidentialAbi,
2396
+ functionName: "register",
2397
+ args: [args.token],
2398
+ account,
2399
+ chain: wallet.chain
2400
+ });
2401
+ } catch (err) {
2402
+ throw this.#mapRevert("register", err, { user: userAddress }, userAddress);
2403
+ }
2404
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2405
+ const events = parseEventLogs({
2406
+ abi: disperseConfidentialAbi,
2407
+ eventName: "UserRegistered",
2408
+ logs: receipt.logs
2409
+ });
2410
+ const ours = events.filter((ev2) => ev2.address.toLowerCase() === this.address.toLowerCase());
2411
+ if (ours.length === 0) {
2412
+ throw new DisperseSubwalletNotFoundError(hash, this.address);
2413
+ }
2414
+ const ev = ours[0];
2415
+ return { hash, wallets: [ev.args.wallet0, ev.args.wallet1] };
2416
+ });
2417
+ }
2418
+ /**
2419
+ * Approve the caller's existing registered wallets as ERC-7984 operators for `token`.
2420
+ *
2421
+ * Required for wallet-mode disperses when using a token different from the one
2422
+ * passed at registration time.
2423
+ */
2424
+ async approveTokenOnWallets(args) {
2425
+ assertChecksumAddress(args.token, "token", "approveTokenOnWallets");
2426
+ const user = this.#userAddressFromOverride(args.account, "approveTokenOnWallets");
2427
+ return this.#write("approveUserWalletsForToken", [args.token], args.account, { user });
2428
+ }
2429
+ /**
2430
+ * Revoke the operator approval on `token` for the caller's wallets.
2431
+ *
2432
+ * The user can re-approve later via `approveTokenOnWallets`.
2433
+ */
2434
+ async revokeTokenOnWallets(args) {
2435
+ assertChecksumAddress(args.token, "token", "revokeTokenOnWallets");
2436
+ const user = this.#userAddressFromOverride(args.account, "revokeTokenOnWallets");
2437
+ return this.#write("revokeUserWalletsForToken", [args.token], args.account, { user });
2438
+ }
2439
+ /**
2440
+ * Recover all residual confidential tokens from the caller's wallets to `to`.
2441
+ *
2442
+ * Use after a wallet-mode disperse where the subtotals were inflated and tokens
2443
+ * remain locked in the wallets. Returns the bare tx hash (not a wrapped result
2444
+ * object) — unlike `disperse()`, this method does not surface any additional
2445
+ * receipt-derived data.
2446
+ */
2447
+ async recoverFromWallets(args) {
2448
+ assertChecksumAddress(args.token, "token", "recoverFromWallets");
2449
+ assertNonZeroChecksumAddress(args.to, "to", "recoverFromWallets");
2450
+ const user = this.#userAddressFromOverride(args.account, "recoverFromWallets");
2451
+ return this.#write("recoverFromWallets", [args.token, args.to], args.account, { user });
2452
+ }
2453
+ /**
2454
+ * Recover ERC-20 tokens accidentally sent to the caller's wallets. Returns the
2455
+ * bare tx hash.
2456
+ */
2457
+ async recoverERC20FromWallets(args) {
2458
+ assertChecksumAddress(args.token, "token", "recoverERC20FromWallets");
2459
+ assertNonZeroChecksumAddress(args.to, "to", "recoverERC20FromWallets");
2460
+ const user = this.#userAddressFromOverride(args.account, "recoverERC20FromWallets");
2461
+ return this.#write("recoverERC20FromWallets", [args.token, args.to], args.account, { user });
2462
+ }
2463
+ /**
2464
+ * Disperse confidential tokens to multiple recipients.
2465
+ *
2466
+ * SDK responsibilities:
2467
+ * 1. Validates input deterministically (lengths, zero addresses, per-amount
2468
+ * uint64 bounds, wallet-mode subtotal overflow, batch-limit for the
2469
+ * selected mode) — using the same {@link validateDisperseInputs} helper
2470
+ * `preflightDisperse` uses, so an oversized or malformed batch is rejected
2471
+ * before any FHE encryption time is spent.
2472
+ * 2. For wallet modes: computes group subtotals using the contract's exact split rule.
2473
+ * 3. Encrypts amounts + subtotals in a single batch call (one input proof).
2474
+ * 4. Computes `msg.value` for gas-fee modes; `0` for token-fee mode.
2475
+ * 5. Dispatches to the correct contract function based on `mode`.
2476
+ *
2477
+ * @throws {TokenOpsSdkError} on input validation failure (first deterministic error).
2478
+ * @throws {TokenOpsSdkError} if no encryptor is available at call time.
2479
+ */
2480
+ async disperse(args) {
2481
+ return withTelemetry(this.#telemetry, "fhe-disperse.singleton.disperse", async () => {
2482
+ const { token, mode, recipients, amounts } = args;
2483
+ assertChecksumAddress(token, "token", "disperse");
2484
+ const wallet = this.#requireWallet("disperse");
2485
+ const account = this.#resolveAccount(wallet, args.account, "disperse");
2486
+ const enc = resolveEncryptor(this.encryptor);
2487
+ if (!enc) {
2488
+ throw new MissingEncryptorError("disperse", {
2489
+ hint: "Pass `encryptor` to the call or the client config."
2490
+ });
2491
+ }
2492
+ const batchLimits = await this.getBatchLimits();
2493
+ const errors = validateDisperseInputs({
2494
+ recipients,
2495
+ amounts,
2496
+ mode,
2497
+ batchLimit: batchLimitForMode(mode, batchLimits),
2498
+ method: "disperse",
2499
+ contractAddress: this.address
2500
+ });
2501
+ if (errors[0]) throw errors[0];
2502
+ const userAddr = accountAddress(account);
2503
+ if (mode === "direct") {
2504
+ return this.#disperseDirect({
2505
+ token,
2506
+ recipients,
2507
+ amounts,
2508
+ account,
2509
+ wallet,
2510
+ userAddr,
2511
+ enc,
2512
+ gasFeeOverride: args.gasFeeOverride
2513
+ });
2514
+ }
2515
+ return this.#disperseWallet({
2516
+ token,
2517
+ mode,
2518
+ recipients,
2519
+ amounts,
2520
+ account,
2521
+ wallet,
2522
+ userAddr,
2523
+ enc,
2524
+ gasFeeOverride: args.gasFeeOverride
2525
+ });
2526
+ });
2527
+ }
2528
+ // ============================================================
2529
+ // ENCRYPTED FEE RESERVE (ADMIN / FEE_COLLECTOR)
2530
+ // ============================================================
2531
+ /**
2532
+ * **This is a write transaction, not a free view. It costs gas.**
2533
+ *
2534
+ * Grant the caller persistent FHE ACL on the encrypted token fee reserve and
2535
+ * return the handle. The handle is extracted from the receipt's ACL `Allowed`
2536
+ * event — using `simulateContract` here would return a divergent handle that
2537
+ * breaks user-decrypt downstream (Pitfall #1).
2538
+ *
2539
+ * If no fees have accrued for `token`, the contract does not emit an ACL event
2540
+ * and this method throws {@link DisperseEncryptedReserveNotGrantedError}.
2541
+ * Check `FHE.isInitialized` off-chain: a zero-hash handle means the reserve
2542
+ * is uninitialised.
2543
+ *
2544
+ * Requires FEE_COLLECTOR_ROLE or DEFAULT_ADMIN_ROLE.
2545
+ *
2546
+ * @throws {DisperseEncryptedReserveNotGrantedError} when no ACL event is found
2547
+ * (i.e., reserve is uninitialised — no fees have accrued).
2548
+ */
2549
+ async getEncryptedFeeReserve(args) {
2550
+ assertChecksumAddress(args.token, "token", "getEncryptedFeeReserve");
2551
+ const wallet = this.#requireWallet("getEncryptedFeeReserve");
2552
+ const account = this.#resolveAccount(wallet, args.account, "getEncryptedFeeReserve");
2553
+ await this.#preflightWrite(
2554
+ "getEncryptedFeeReserve",
2555
+ "accessEncryptedFeeReserve",
2556
+ [args.token],
2557
+ account,
2558
+ { user: accountAddress(account) }
2559
+ );
2560
+ let hash;
2561
+ try {
2562
+ hash = await wallet.writeContract({
2563
+ address: this.address,
2564
+ abi: disperseConfidentialAbi,
2565
+ functionName: "accessEncryptedFeeReserve",
2566
+ args: [args.token],
2567
+ account,
2568
+ chain: wallet.chain
2569
+ });
2570
+ } catch (err) {
2571
+ throw this.#mapRevert(
2572
+ "getEncryptedFeeReserve",
2573
+ err,
2574
+ { user: accountAddress(account) },
2575
+ accountAddress(account)
2576
+ );
2577
+ }
2578
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2579
+ const callerAddress = accountAddress(account).toLowerCase();
2580
+ const aclLogs = receipt.logs.filter(
2581
+ (log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
2582
+ );
2583
+ const events = parseEventLogs({ abi: [ACL_ALLOWED_EVENT], logs: aclLogs });
2584
+ const granted = events.filter(
2585
+ (ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
2586
+ );
2587
+ if (granted.length === 0) {
2588
+ throw new DisperseEncryptedReserveNotGrantedError(hash, accountAddress(account));
2589
+ }
2590
+ if (granted.length > 1) {
2591
+ throw new ReceiptEventAmbiguousError({
2592
+ method: "getEncryptedFeeReserve",
2593
+ eventName: "Allowed",
2594
+ contractAddress: this.aclAddress,
2595
+ count: granted.length,
2596
+ txHash: hash
2597
+ });
2598
+ }
2599
+ const handle = granted[0].args.handle;
2600
+ return { handle, hash };
2601
+ }
2602
+ // ============================================================
2603
+ // DISCLOSURE METHODS
2604
+ // ============================================================
2605
+ /**
2606
+ * Grant `party` persistent FHE ACL on a single `handle`.
2607
+ *
2608
+ * Caller must already hold ACL on `handle`. FHEVM ACL is append-only — the
2609
+ * grant cannot be revoked.
2610
+ *
2611
+ * @returns `{ hash, discloser, party, disclosedHandles }`. The non-`hash`
2612
+ * fields are parsed from the `HandlesDisclosedToParty` event when present;
2613
+ * if the event is absent (anomalous), they fall back to the call's inputs.
2614
+ */
2615
+ async discloseHandleToParty(args) {
2616
+ assertChecksumAddress(args.party, "party", "discloseHandleToParty");
2617
+ const wallet = this.#requireWallet("discloseHandleToParty");
2618
+ const acct = this.#resolveAccount(wallet, args.account, "discloseHandleToParty");
2619
+ const hash = await this.#write(
2620
+ "discloseHandleToParty",
2621
+ [args.handle, args.party],
2622
+ args.account
2623
+ );
2624
+ return this.#parseDisclosure(hash, accountAddress(acct), args.party, [args.handle]);
2625
+ }
2626
+ /**
2627
+ * Batch variant — atomically grant `party` persistent ACL on all `handles`.
2628
+ * Reverts on the first handle that fails caller-ACL or contract-ACL checks.
2629
+ */
2630
+ async batchDiscloseHandlesToParty(args) {
2631
+ assertChecksumAddress(args.party, "party", "batchDiscloseHandlesToParty");
2632
+ const wallet = this.#requireWallet("batchDiscloseHandlesToParty");
2633
+ const acct = this.#resolveAccount(wallet, args.account, "batchDiscloseHandlesToParty");
2634
+ const hash = await this.#write(
2635
+ "batchDiscloseHandlesToParty",
2636
+ [args.handles, args.party],
2637
+ args.account
2638
+ );
2639
+ return this.#parseDisclosure(hash, accountAddress(acct), args.party, args.handles);
2640
+ }
2641
+ /**
2642
+ * Parse a `HandlesDisclosedToParty` event from a disclosure receipt. If the
2643
+ * event is missing (which would indicate a contract or parser anomaly),
2644
+ * fall back to the inputs the caller passed — the tx already succeeded.
2645
+ */
2646
+ async #parseDisclosure(hash, fallbackDiscloser, fallbackParty, fallbackHandles) {
2647
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2648
+ const events = parseEventLogs({
2649
+ abi: disperseConfidentialAbi,
2650
+ eventName: "HandlesDisclosedToParty",
2651
+ logs: receipt.logs.filter((log) => log.address.toLowerCase() === this.address.toLowerCase())
2652
+ });
2653
+ const ev = events[0];
2654
+ if (!ev) {
2655
+ return {
2656
+ hash,
2657
+ discloser: fallbackDiscloser,
2658
+ party: fallbackParty,
2659
+ disclosedHandles: [...fallbackHandles]
2660
+ };
2661
+ }
2662
+ return {
2663
+ hash,
2664
+ discloser: ev.args.discloser,
2665
+ party: ev.args.party,
2666
+ disclosedHandles: [...ev.args.handles]
2667
+ };
2668
+ }
2669
+ // ============================================================
2670
+ // ADMIN / FEE-MANAGER / FEE-COLLECTOR WRITES
2671
+ // ============================================================
2672
+ /**
2673
+ * Pause all disperse operations. Requires PAUSER_ROLE.
2674
+ * @returns Transaction hash.
2675
+ */
2676
+ async pause(account) {
2677
+ return withTelemetry(this.#telemetry, "fhe-disperse.singleton.pause", async () => {
2678
+ return this.#write("pause", [], account);
2679
+ });
2680
+ }
2681
+ /**
2682
+ * Unpause the singleton. Requires PAUSER_ROLE.
2683
+ * @returns Transaction hash.
2684
+ */
2685
+ async unpause(account) {
2686
+ return withTelemetry(this.#telemetry, "fhe-disperse.singleton.unpause", async () => {
2687
+ return this.#write("unpause", [], account);
2688
+ });
2689
+ }
2690
+ /**
2691
+ * Update the global fee configuration: enable/disable gas and token fees, set defaults.
2692
+ * Requires FEE_MANAGER_ROLE.
2693
+ * @returns Transaction hash.
2694
+ */
2695
+ async setFeeConfig(config, account) {
2696
+ return withTelemetry(this.#telemetry, "fhe-disperse.singleton.setFeeConfig", async () => {
2697
+ return this.#write(
2698
+ "setFeeConfig",
2699
+ [
2700
+ {
2701
+ gasFeeEnabled: config.gasFeeEnabled,
2702
+ tokenFeeEnabled: config.tokenFeeEnabled,
2703
+ defaultGasFee: config.defaultGasFee,
2704
+ defaultTokenFee: config.defaultTokenFee
2705
+ }
2706
+ ],
2707
+ account
2708
+ );
2709
+ });
2710
+ }
2711
+ /**
2712
+ * Set a per-user fee override (gas fee in wei, token fee in BPS).
2713
+ * Requires FEE_MANAGER_ROLE.
2714
+ * @returns Transaction hash.
2715
+ */
2716
+ async setCustomFee(user, gasFee, tokenFee, account) {
2717
+ assertChecksumAddress(user, "user", "setCustomFee");
2718
+ return this.#write("setCustomFee", [user, gasFee, tokenFee], account);
2719
+ }
2720
+ /**
2721
+ * Remove a per-user fee override, falling back to the global defaults.
2722
+ * Requires FEE_MANAGER_ROLE. Throws `CustomFeeNotSet` if no override exists.
2723
+ * @returns Transaction hash.
2724
+ */
2725
+ async disableCustomFee(user, account) {
2726
+ assertChecksumAddress(user, "user", "disableCustomFee");
2727
+ return this.#write("disableCustomFee", [user], account, { user });
2728
+ }
2729
+ /**
2730
+ * Set the maximum batch size for `"wallet"` mode disperses. `0n` = no limit.
2731
+ * Requires DEFAULT_ADMIN_ROLE.
2732
+ * @returns Transaction hash.
2733
+ */
2734
+ async setMaxBatchSizeHolding(size, account) {
2735
+ return withTelemetry(
2736
+ this.#telemetry,
2737
+ "fhe-disperse.singleton.setMaxBatchSizeHolding",
2738
+ async () => {
2739
+ return this.#write("setMaxBatchSizeHolding", [size], account);
2740
+ }
2741
+ );
2742
+ }
2743
+ /**
2744
+ * Set the maximum batch size for `"direct"` mode disperses. `0n` = no limit.
2745
+ * Requires DEFAULT_ADMIN_ROLE.
2746
+ * @returns Transaction hash.
2747
+ */
2748
+ async setMaxBatchSizeDirect(size, account) {
2749
+ return withTelemetry(
2750
+ this.#telemetry,
2751
+ "fhe-disperse.singleton.setMaxBatchSizeDirect",
2752
+ async () => {
2753
+ return this.#write("setMaxBatchSizeDirect", [size], account);
2754
+ }
2755
+ );
2756
+ }
2757
+ /**
2758
+ * Set the maximum batch size for `"wallet-token-fee"` mode disperses. `0n` = no limit.
2759
+ * Requires DEFAULT_ADMIN_ROLE.
2760
+ * @returns Transaction hash.
2761
+ */
2762
+ async setMaxBatchSizeTokenFee(size, account) {
2763
+ return withTelemetry(
2764
+ this.#telemetry,
2765
+ "fhe-disperse.singleton.setMaxBatchSizeTokenFee",
2766
+ async () => {
2767
+ return this.#write("setMaxBatchSizeTokenFee", [size], account);
2768
+ }
2769
+ );
2770
+ }
2771
+ /**
2772
+ * Withdraw `amount` wei of accumulated ETH gas fees to `to`. The amount is
2773
+ * not capped on-chain — callers MUST pass an explicit amount. There is no
2774
+ * "drain full balance" sentinel: passing `0n` succeeds with no ETH movement.
2775
+ * Read the singleton's ETH balance with `publicClient.getBalance(singleton)`
2776
+ * to drain.
2777
+ *
2778
+ * Requires FEE_COLLECTOR_ROLE.
2779
+ * @returns Transaction hash.
2780
+ */
2781
+ async withdrawGasFee(to, amount, account) {
2782
+ assertNonZeroChecksumAddress(to, "to", "withdrawGasFee");
2783
+ return this.#write("withdrawGasFee", [to, amount], account);
2784
+ }
2785
+ /**
2786
+ * Withdraw accumulated encrypted token fees.
2787
+ *
2788
+ * The amount is encrypted by the caller — pass plaintext `amount` and an
2789
+ * encryptor, or pass `encryptedInput` directly. The contract caps the
2790
+ * withdrawal at the available reserve via `FHE.min`.
2791
+ *
2792
+ * Returns the tx hash plus the **transferred** handle parsed from the
2793
+ * `TokenFeeWithdrawn` event. Decrypt the handle via Zama's `userDecrypt`
2794
+ * to view the actual amount moved (which can be less than requested when
2795
+ * the reserve was smaller than the request). The caller is granted
2796
+ * persistent ACL on this handle by the contract.
2797
+ *
2798
+ * **`encryptedInput` is bound to (this singleton, this caller).** Zama's
2799
+ * KMSVerifier rejects proofs whose `contractAddress` or `userAddress`
2800
+ * don't match the executing tx. If you pre-encrypt on a different chain's
2801
+ * singleton, or for a different caller, the on-chain submission will
2802
+ * revert with a generic verification failure. The plaintext `amount`
2803
+ * path is safer when the caller / chain isn't fixed yet.
2804
+ */
2805
+ async withdrawTokenFee(args) {
2806
+ assertChecksumAddress(args.token, "token", "withdrawTokenFee");
2807
+ assertNonZeroChecksumAddress(args.to, "to", "withdrawTokenFee");
2808
+ const wallet = this.#requireWallet("withdrawTokenFee");
2809
+ const account = this.#resolveAccount(wallet, args.account, "withdrawTokenFee");
2810
+ const encrypted = await this.#encryptSingle(
2811
+ args.amount,
2812
+ args.encryptor,
2813
+ args.encryptedInput,
2814
+ account,
2815
+ "withdrawTokenFee"
2816
+ );
2817
+ await this.#preflightWrite(
2818
+ "withdrawTokenFee",
2819
+ "withdrawTokenFee",
2820
+ [args.token, args.to, encrypted.handle, encrypted.inputProof],
2821
+ account
2822
+ );
2823
+ let hash;
2824
+ try {
2825
+ hash = await wallet.writeContract({
2826
+ address: this.address,
2827
+ abi: disperseConfidentialAbi,
2828
+ functionName: "withdrawTokenFee",
2829
+ args: [args.token, args.to, encrypted.handle, encrypted.inputProof],
2830
+ account,
2831
+ chain: wallet.chain
2832
+ });
2833
+ } catch (err) {
2834
+ throw this.#mapRevert("withdrawTokenFee", err, void 0, accountAddress(account));
2835
+ }
2836
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2837
+ const events = parseEventLogs({
2838
+ abi: disperseConfidentialAbi,
2839
+ eventName: "TokenFeeWithdrawn",
2840
+ logs: receipt.logs.filter((log) => log.address.toLowerCase() === this.address.toLowerCase())
2841
+ });
2842
+ const transferredHandle = events[0]?.args.amount;
2843
+ return { hash, transferredHandle };
2844
+ }
2845
+ /**
2846
+ * Rescue accidentally-sent ERC-7984 confidential tokens from the singleton.
2847
+ * Requires WITHDRAWER_ROLE.
2848
+ * @returns Transaction hash.
2849
+ */
2850
+ async rescueConfidentialTokens(token, to, account) {
2851
+ assertChecksumAddress(token, "token", "rescueConfidentialTokens");
2852
+ assertNonZeroChecksumAddress(to, "to", "rescueConfidentialTokens");
2853
+ return this.#write("rescueConfidentialTokens", [token, to], account);
2854
+ }
2855
+ /**
2856
+ * Rescue accidentally-sent ERC-20 tokens from the singleton.
2857
+ * Requires WITHDRAWER_ROLE.
2858
+ * @returns Transaction hash.
2859
+ */
2860
+ async rescueERC20(token, to, account) {
2861
+ assertChecksumAddress(token, "token", "rescueERC20");
2862
+ assertNonZeroChecksumAddress(to, "to", "rescueERC20");
2863
+ return this.#write("rescueERC20", [token, to], account);
2864
+ }
2865
+ // ============================================================
2866
+ // ROLE MANAGEMENT
2867
+ // ============================================================
2868
+ /**
2869
+ * Check whether `address` holds `role` on the singleton.
2870
+ * @example
2871
+ * const isAdmin = await client.hasRole("0x0000...0000", account.address);
2872
+ */
2873
+ async hasRole(role, address) {
2874
+ assertChecksumAddress(address, "address", "hasRole");
2875
+ return this.#read("hasRole", [role, address]);
2876
+ }
2877
+ /**
2878
+ * Grant `role` to `accountTarget`. Requires DEFAULT_ADMIN_ROLE.
2879
+ * @returns Transaction hash.
2880
+ */
2881
+ async grantRole(role, accountTarget, account) {
2882
+ assertChecksumAddress(accountTarget, "accountTarget", "grantRole");
2883
+ return this.#write("grantRole", [role, accountTarget], account);
2884
+ }
2885
+ /**
2886
+ * Revoke `role` from `accountTarget`. Requires DEFAULT_ADMIN_ROLE.
2887
+ * @returns Transaction hash.
2888
+ */
2889
+ async revokeRole(role, accountTarget, account) {
2890
+ assertChecksumAddress(accountTarget, "accountTarget", "revokeRole");
2891
+ return this.#write("revokeRole", [role, accountTarget], account);
2892
+ }
2893
+ /**
2894
+ * Voluntarily relinquish `role` from the caller. The contract enforces
2895
+ * `callerConfirmation === msg.sender` (OZ AccessControl) as a guard against
2896
+ * accidental renunciation via a wrapper contract — pass the connected
2897
+ * wallet's address here.
2898
+ *
2899
+ * Use to permanently drop privileges from a fee-collector / withdrawer /
2900
+ * pauser without needing an admin's `revokeRole`. Cannot be undone.
2901
+ *
2902
+ * @returns Transaction hash.
2903
+ */
2904
+ async renounceRole(role, callerConfirmation, account) {
2905
+ assertChecksumAddress(callerConfirmation, "callerConfirmation", "renounceRole");
2906
+ return this.#write("renounceRole", [role, callerConfirmation], account);
2907
+ }
2908
+ // ============================================================
2909
+ // STATE READS
2910
+ // ============================================================
2911
+ /** Whether the singleton is currently paused. */
2912
+ async paused() {
2913
+ return this.#read("paused");
2914
+ }
2915
+ /** Block number at which the singleton was deployed. */
2916
+ async deploymentBlockNumber() {
2917
+ return this.#read("DEPLOYMENT_BLOCK_NUMBER");
2918
+ }
2919
+ /** The ERC-1167 `WALLET_IMPLEMENTATION` address used by `Clones.cloneDeterministic`. */
2920
+ async walletImplementation() {
2921
+ return this.#read("WALLET_IMPLEMENTATION");
2922
+ }
2923
+ // ============================================================
2924
+ // INTERNAL HELPERS
2925
+ // ============================================================
2926
+ async #disperseDirect(args) {
2927
+ const { token, recipients, amounts, account, wallet, userAddr, enc, gasFeeOverride } = args;
2928
+ let encrypted;
2929
+ try {
2930
+ encrypted = await encryptUint64Batch({
2931
+ encryptor: enc,
2932
+ contractAddress: this.address,
2933
+ userAddress: userAddr,
2934
+ values: amounts
2935
+ });
2936
+ } catch (err) {
2937
+ throw mapZamaError(err, { method: "disperse[direct]", operation: "encrypt" });
2938
+ }
2939
+ let ethValue = gasFeeOverride;
2940
+ if (ethValue === void 0) {
2941
+ const fees = await this.getFees(userAddr);
2942
+ ethValue = BigInt(recipients.length) * fees.gasFeeWei;
2943
+ }
2944
+ await this.#preflightWrite(
2945
+ "disperse[direct]",
2946
+ "disperseConfidentialTokenDirect",
2947
+ [token, recipients, encrypted.handles, encrypted.inputProof],
2948
+ account,
2949
+ { user: userAddr },
2950
+ ethValue
2951
+ );
2952
+ let hash;
2953
+ try {
2954
+ hash = await wallet.writeContract({
2955
+ address: this.address,
2956
+ abi: disperseConfidentialAbi,
2957
+ functionName: "disperseConfidentialTokenDirect",
2958
+ args: [token, recipients, encrypted.handles, encrypted.inputProof],
2959
+ account,
2960
+ chain: wallet.chain,
2961
+ value: ethValue
2962
+ });
2963
+ } catch (err) {
2964
+ throw this.#mapRevert("disperse[direct]", err, { user: userAddr }, userAddr);
2965
+ }
2966
+ const distributions = await this.#parseDirectDistributions(hash);
2967
+ return { hash, distributions };
2968
+ }
2969
+ async #disperseWallet(args) {
2970
+ const { token, mode, recipients, amounts, account, wallet, userAddr, enc, gasFeeOverride } = args;
2971
+ const count = amounts.length;
2972
+ const { group0, group1 } = computeSubtotals(amounts);
2973
+ const allValues = [...amounts, group0, group1];
2974
+ let encrypted;
2975
+ try {
2976
+ encrypted = await encryptUint64Batch({
2977
+ encryptor: enc,
2978
+ contractAddress: this.address,
2979
+ userAddress: userAddr,
2980
+ values: allValues
2981
+ });
2982
+ } catch (err) {
2983
+ throw mapZamaError(err, { method: `disperse[${mode}]`, operation: "encrypt" });
2984
+ }
2985
+ const amountHandles = encrypted.handles.slice(0, count);
2986
+ const subtotal0Handle = encrypted.handles[count];
2987
+ const subtotal1Handle = encrypted.handles[count + 1];
2988
+ if (mode === "wallet-token-fee") {
2989
+ const writeArgs = [
2990
+ token,
2991
+ recipients,
2992
+ amountHandles,
2993
+ [subtotal0Handle, subtotal1Handle],
2994
+ encrypted.inputProof
2995
+ ];
2996
+ await this.#preflightWrite(
2997
+ "disperse[wallet-token-fee]",
2998
+ "disperseConfidentialTokensWithTokenFee",
2999
+ writeArgs,
3000
+ account,
3001
+ { user: userAddr }
3002
+ );
3003
+ let hash2;
3004
+ try {
3005
+ hash2 = await wallet.writeContract({
3006
+ address: this.address,
3007
+ abi: disperseConfidentialAbi,
3008
+ functionName: "disperseConfidentialTokensWithTokenFee",
3009
+ args: writeArgs,
3010
+ account,
3011
+ chain: wallet.chain
3012
+ });
3013
+ } catch (err) {
3014
+ throw this.#mapRevert("disperse[wallet-token-fee]", err, { user: userAddr }, userAddr);
3015
+ }
3016
+ const distributions2 = await this.#parseWalletDistributions(hash2);
3017
+ return { hash: hash2, distributions: distributions2 };
3018
+ }
3019
+ let ethValue = gasFeeOverride;
3020
+ if (ethValue === void 0) {
3021
+ const fees = await this.getFees(userAddr);
3022
+ ethValue = BigInt(count) * fees.gasFeeWei;
3023
+ }
3024
+ const walletWriteArgs = [
3025
+ token,
3026
+ recipients,
3027
+ amountHandles,
3028
+ [subtotal0Handle, subtotal1Handle],
3029
+ encrypted.inputProof
3030
+ ];
3031
+ await this.#preflightWrite(
3032
+ "disperse[wallet]",
3033
+ "disperseConfidentialTokens",
3034
+ walletWriteArgs,
3035
+ account,
3036
+ { user: userAddr },
3037
+ ethValue
3038
+ );
3039
+ let hash;
3040
+ try {
3041
+ hash = await wallet.writeContract({
3042
+ address: this.address,
3043
+ abi: disperseConfidentialAbi,
3044
+ functionName: "disperseConfidentialTokens",
3045
+ args: walletWriteArgs,
3046
+ account,
3047
+ chain: wallet.chain,
3048
+ value: ethValue
3049
+ });
3050
+ } catch (err) {
3051
+ throw this.#mapRevert("disperse[wallet]", err, { user: userAddr }, userAddr);
3052
+ }
3053
+ const distributions = await this.#parseWalletDistributions(hash);
3054
+ return { hash, distributions };
3055
+ }
3056
+ /**
3057
+ * Parse the `DirectDistribution` event from a `disperseConfidentialTokenDirect`
3058
+ * receipt. Filters logs by the singleton's own address to avoid picking up
3059
+ * unrelated events from re-entrancy / hook contracts. Returns at most one
3060
+ * row (the contract emits exactly one `DirectDistribution` per direct call)
3061
+ * but tolerates zero gracefully.
3062
+ */
3063
+ async #parseDirectDistributions(hash) {
3064
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
3065
+ const ours = receipt.logs.filter(
3066
+ (log) => log.address.toLowerCase() === this.address.toLowerCase()
3067
+ );
3068
+ const events = parseEventLogs({
3069
+ abi: disperseConfidentialAbi,
3070
+ eventName: "DirectDistribution",
3071
+ logs: ours
3072
+ });
3073
+ return events.map((ev) => ({
3074
+ recipients: [...ev.args.recipients],
3075
+ requested: [...ev.args.requested],
3076
+ transferred: [...ev.args.transferred]
3077
+ }));
3078
+ }
3079
+ /**
3080
+ * Parse `WalletDistribution` events from a wallet-mode disperse receipt.
3081
+ * The contract emits one event per non-empty sub-wallet group — so up to
3082
+ * two rows for a `disperse(...)` call. Filtered by singleton address.
3083
+ */
3084
+ async #parseWalletDistributions(hash) {
3085
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
3086
+ const ours = receipt.logs.filter(
3087
+ (log) => log.address.toLowerCase() === this.address.toLowerCase()
3088
+ );
3089
+ const events = parseEventLogs({
3090
+ abi: disperseConfidentialAbi,
3091
+ eventName: "WalletDistribution",
3092
+ logs: ours
3093
+ });
3094
+ return events.map((ev) => ({
3095
+ wallet: ev.args.wallet,
3096
+ recipients: [...ev.args.recipients],
3097
+ requested: [...ev.args.requested],
3098
+ transferred: [...ev.args.transferred]
3099
+ }));
3100
+ }
3101
+ /**
3102
+ * Resolve the encrypted-amount payload for a single-amount write. Enforces
3103
+ * **exactly one** of `amount` / `encryptedInput` so callers cannot silently
3104
+ * mix a stale plaintext with a pre-encrypted handle.
3105
+ */
3106
+ async #encryptSingle(amount, encryptor, preEncrypted, account, method) {
3107
+ const hasAmount = amount !== void 0;
3108
+ const hasInput = preEncrypted !== void 0;
3109
+ if (hasAmount && hasInput) {
3110
+ throw new InvalidArgumentError({
3111
+ method,
3112
+ argument: "amount/encryptedInput",
3113
+ reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
3114
+ });
3115
+ }
3116
+ if (!hasAmount && !hasInput) {
3117
+ throw new InvalidArgumentError({
3118
+ method,
3119
+ argument: "amount/encryptedInput",
3120
+ reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
3121
+ });
3122
+ }
3123
+ if (hasInput) return preEncrypted;
3124
+ const enc = encryptor ?? resolveEncryptor(this.encryptor);
3125
+ if (!enc) {
3126
+ throw new MissingEncryptorError("encryptSingle", {
3127
+ hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
3128
+ });
3129
+ }
3130
+ try {
3131
+ return await encryptUint64({
3132
+ encryptor: enc,
3133
+ contractAddress: this.address,
3134
+ userAddress: accountAddress(account),
3135
+ value: amount
3136
+ });
3137
+ } catch (err) {
3138
+ throw mapZamaError(err, { method: "encryptSingle", operation: "encrypt" });
3139
+ }
3140
+ }
3141
+ #requireWallet(method) {
3142
+ if (!this.walletClient) {
3143
+ throw new MissingWalletClientError(method);
3144
+ }
3145
+ return this.walletClient;
3146
+ }
3147
+ #resolveAccount(wallet, override, method) {
3148
+ const acct = override ?? wallet.account;
3149
+ if (!acct) {
3150
+ throw new MissingAccountError(method);
3151
+ }
3152
+ return acct;
3153
+ }
3154
+ /**
3155
+ * Resolve the caller's address for productContext.user without doing the
3156
+ * full `writeContract` prep. Required by the sub-wallet helpers so that
3157
+ * any typed revert (e.g. `UserNotRegistered`) carries the actual caller
3158
+ * in `error.context.user`, not the zero-address default the product
3159
+ * mapper falls back to.
3160
+ */
3161
+ #userAddressFromOverride(override, method) {
3162
+ const wallet = this.#requireWallet(method);
3163
+ return accountAddress(this.#resolveAccount(wallet, override, method));
3164
+ }
3165
+ async #write(functionName, args, account, productContext) {
3166
+ const wallet = this.#requireWallet(functionName);
3167
+ const acct = this.#resolveAccount(wallet, account, functionName);
3168
+ await this.#preflightWrite(functionName, functionName, args, acct, productContext);
3169
+ try {
3170
+ return await wallet.writeContract({
3171
+ address: this.address,
3172
+ abi: disperseConfidentialAbi,
3173
+ functionName,
3174
+ args,
3175
+ account: acct,
3176
+ chain: wallet.chain
3177
+ });
3178
+ } catch (err) {
3179
+ throw this.#mapRevert(functionName, err, productContext, accountAddress(acct));
3180
+ }
3181
+ }
3182
+ /**
3183
+ * Pre-flight a write via `simulateContract` purely to surface typed reverts.
3184
+ *
3185
+ * The simulate's *return value* is discarded — FHE writes still need
3186
+ * `writeContract` + receipt parsing because simulated FHE op handles diverge
3187
+ * from the executed-tx handles (Pitfall #1). The only purpose of the
3188
+ * simulate call here is to let viem decode any revert against the ABI and
3189
+ * produce a `ContractFunctionRevertedError` frame the revert-mapper can
3190
+ * classify (e.g. `AccessControlUnauthorizedAccount` → `AccessDeniedError`).
3191
+ */
3192
+ async #preflightWrite(method, functionName, args, account, productContext, value) {
3193
+ try {
3194
+ await this.publicClient.simulateContract({
3195
+ address: this.address,
3196
+ abi: disperseConfidentialAbi,
3197
+ functionName,
3198
+ args,
3199
+ account,
3200
+ ...value !== void 0 ? { value } : {}
3201
+ });
3202
+ } catch (err) {
3203
+ if (isContractRevert(err)) {
3204
+ throw this.#mapRevert(method, err, productContext, accountAddress(account));
3205
+ }
3206
+ }
3207
+ }
3208
+ #mapRevert(method, err, productContext, account) {
3209
+ return mapContractRevert(err, {
3210
+ method,
3211
+ contractAddress: this.address,
3212
+ abi: disperseConfidentialAbi,
3213
+ productMapper: disperseProductMapper,
3214
+ productContext,
3215
+ account
3216
+ });
3217
+ }
3218
+ async #read(functionName, args = []) {
3219
+ const result = await this.publicClient.readContract({
3220
+ address: this.address,
3221
+ abi: disperseConfidentialAbi,
3222
+ functionName,
3223
+ args
3224
+ });
3225
+ return result;
3226
+ }
3227
+ };
3228
+ function createConfidentialDisperseClient(config) {
3229
+ return new ConfidentialDisperseClient(config);
3230
+ }
3231
+ function accountAddress(account) {
3232
+ return typeof account === "string" ? account : account.address;
3233
+ }
3234
+
3235
+ // src/fhe-disperse/abis/wallet.ts
3236
+ var disperseWalletAbi = [
3237
+ {
3238
+ inputs: [],
3239
+ stateMutability: "nonpayable",
3240
+ type: "constructor"
3241
+ },
3242
+ {
3243
+ inputs: [],
3244
+ name: "InvalidAddress",
3245
+ type: "error"
3246
+ },
3247
+ {
3248
+ inputs: [],
3249
+ name: "InvalidInitialization",
3250
+ type: "error"
3251
+ },
3252
+ {
3253
+ inputs: [],
3254
+ name: "NotController",
3255
+ type: "error"
3256
+ },
3257
+ {
3258
+ inputs: [],
3259
+ name: "NotInitializing",
3260
+ type: "error"
3261
+ },
3262
+ {
3263
+ inputs: [
3264
+ {
3265
+ internalType: "address",
3266
+ name: "token",
3267
+ type: "address"
3268
+ }
3269
+ ],
3270
+ name: "SafeERC20FailedOperation",
3271
+ type: "error"
3272
+ },
3273
+ {
3274
+ inputs: [],
3275
+ name: "ZamaProtocolUnsupported",
3276
+ type: "error"
3277
+ },
3278
+ {
3279
+ anonymous: false,
3280
+ inputs: [
3281
+ {
3282
+ indexed: false,
3283
+ internalType: "uint64",
3284
+ name: "version",
3285
+ type: "uint64"
3286
+ }
3287
+ ],
3288
+ name: "Initialized",
3289
+ type: "event"
3290
+ },
3291
+ {
3292
+ inputs: [
3293
+ {
3294
+ internalType: "address",
3295
+ name: "token",
3296
+ type: "address"
3297
+ }
3298
+ ],
3299
+ name: "approveToken",
3300
+ outputs: [],
3301
+ stateMutability: "nonpayable",
3302
+ type: "function"
3303
+ },
3304
+ {
3305
+ inputs: [],
3306
+ name: "controller",
3307
+ outputs: [
3308
+ {
3309
+ internalType: "address",
3310
+ name: "",
3311
+ type: "address"
3312
+ }
3313
+ ],
3314
+ stateMutability: "view",
3315
+ type: "function"
3316
+ },
3317
+ {
3318
+ inputs: [
3319
+ {
3320
+ internalType: "address",
3321
+ name: "controller_",
3322
+ type: "address"
3323
+ }
3324
+ ],
3325
+ name: "initialize",
3326
+ outputs: [],
3327
+ stateMutability: "nonpayable",
3328
+ type: "function"
3329
+ },
3330
+ {
3331
+ inputs: [
3332
+ {
3333
+ internalType: "address",
3334
+ name: "token",
3335
+ type: "address"
3336
+ },
3337
+ {
3338
+ internalType: "address",
3339
+ name: "to",
3340
+ type: "address"
3341
+ }
3342
+ ],
3343
+ name: "recoverConfidentialToken",
3344
+ outputs: [],
3345
+ stateMutability: "nonpayable",
3346
+ type: "function"
3347
+ },
3348
+ {
3349
+ inputs: [
3350
+ {
3351
+ internalType: "address",
3352
+ name: "token",
3353
+ type: "address"
3354
+ },
3355
+ {
3356
+ internalType: "address",
3357
+ name: "to",
3358
+ type: "address"
3359
+ }
3360
+ ],
3361
+ name: "recoverERC20",
3362
+ outputs: [],
3363
+ stateMutability: "nonpayable",
3364
+ type: "function"
3365
+ },
3366
+ {
3367
+ inputs: [
3368
+ {
3369
+ internalType: "address",
3370
+ name: "token",
3371
+ type: "address"
3372
+ }
3373
+ ],
3374
+ name: "revokeToken",
3375
+ outputs: [],
3376
+ stateMutability: "nonpayable",
3377
+ type: "function"
3378
+ }
3379
+ ];
3380
+
3381
+ // src/fhe-disperse/index.ts
3382
+ var FEE_COLLECTOR_ROLE = "0x2dca0f5ce7e75a4b43fe2b0d6f5d0b7a2bf92ecf89f8f0aa17b8308b67038821";
3383
+ var FEE_MANAGER_ROLE = "0x6c0757dc3e6b28b2580c03fd9e96c274acf4f99d91fbec9b418fa1d70604ff1c";
3384
+ var PAUSER_ROLE = "0x65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a";
3385
+ var WITHDRAWER_ROLE = "0x10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e4";
3386
+ var DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000";
3387
+
3388
+ export { AlreadyRegisteredError, ConfidentialDisperseClient, DEFAULT_ADMIN_ROLE, DisperseEncryptedReserveNotGrantedError, DisperseSubwalletNotFoundError, FEE_COLLECTOR_ROLE, FEE_MANAGER_ROLE, NotRegisteredError, PAUSER_ROLE, WITHDRAWER_ROLE, computeSubtotals, createConfidentialDisperseClient, disperseConfidentialAbi, disperseWalletAbi, encryptUint64, encryptUint64Batch, resolveEncryptor };