@tokenops/sdk 1.6.0 → 2.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/CHANGELOG.md +77 -8
  2. package/CONTRIBUTING.md +4 -2
  3. package/README.md +146 -90
  4. package/SUPPORT.md +47 -0
  5. package/dist/{chunk-BD4LZBVF.cjs → chunk-3QHNYEQD.cjs} +18 -17
  6. package/dist/{chunk-YFIWCYHC.cjs → chunk-3YHBO2DL.cjs} +56 -54
  7. package/dist/{chunk-QET3Q4JP.js → chunk-44YJPMQC.js} +8 -6
  8. package/dist/{chunk-6WSNS3UV.js → chunk-4RAAATVY.js} +2 -4
  9. package/dist/{chunk-4KJ66YRH.js → chunk-4TSDNZQ3.js} +2 -2
  10. package/dist/chunk-66IHPTOK.cjs +20 -0
  11. package/dist/{chunk-2RNW4MIJ.cjs → chunk-67OV5CX2.cjs} +0 -18
  12. package/dist/{chunk-PD7ME2BT.js → chunk-6GNR22OV.js} +2 -1
  13. package/dist/{chunk-WOEETTH7.cjs → chunk-7AFPOE7N.cjs} +6 -6
  14. package/dist/{chunk-QKKBBH7I.js → chunk-A4DCEE33.js} +34 -7
  15. package/dist/chunk-AREQJHKA.cjs +713 -0
  16. package/dist/{chunk-U57COLUE.js → chunk-AXIPOR3C.js} +2 -2
  17. package/dist/chunk-EBLBPUPI.cjs +255 -0
  18. package/dist/chunk-EYDA6Q6C.js +245 -0
  19. package/dist/{chunk-SYHNZSZZ.cjs → chunk-FAXIIH5R.cjs} +3 -3
  20. package/dist/{chunk-AYGRYDBX.cjs → chunk-FEDX7B6T.cjs} +37 -35
  21. package/dist/{chunk-CBRL2PJA.cjs → chunk-FHWSBGWE.cjs} +12 -12
  22. package/dist/{chunk-WUXUWTFW.cjs → chunk-FT5H2Q7Y.cjs} +37 -7
  23. package/dist/chunk-GADGBQJO.js +423 -0
  24. package/dist/{chunk-VHSNYUYV.js → chunk-IGO5XSPS.js} +5 -5
  25. package/dist/chunk-IUKKNJ2R.cjs +433 -0
  26. package/dist/{chunk-VR3FREBX.cjs → chunk-JK4XMMKM.cjs} +3 -3
  27. package/dist/{chunk-4ZCXK4VI.cjs → chunk-KFRDLKMA.cjs} +14 -14
  28. package/dist/chunk-KWFFIJYX.js +11 -0
  29. package/dist/{chunk-7G7UOQV4.cjs → chunk-MM5BV5CS.cjs} +4 -4
  30. package/dist/{chunk-43RFBQ73.cjs → chunk-MVDQMV25.cjs} +29 -32
  31. package/dist/chunk-NWFMBLSQ.js +4 -0
  32. package/dist/{chunk-HETNKZEE.js → chunk-PYYSB5ZN.js} +1 -1
  33. package/dist/chunk-PZZK3O3S.cjs +9843 -0
  34. package/dist/{chunk-DRSPMIZ7.js → chunk-QBJ7O2B4.js} +1 -11
  35. package/dist/{chunk-WTK6JDSI.js → chunk-SPLNGUFF.js} +6 -4
  36. package/dist/{chunk-UJS4N2XM.cjs → chunk-TEBM66WA.cjs} +12 -12
  37. package/dist/{chunk-TN65XNTI.js → chunk-TWT3STIX.js} +8 -6
  38. package/dist/chunk-UG5RKLU2.cjs +6 -0
  39. package/dist/{chunk-EUKPOXWR.cjs → chunk-UHHMVBLU.cjs} +17 -15
  40. package/dist/chunk-VW356KR3.js +688 -0
  41. package/dist/{chunk-BK7YIVLK.cjs → chunk-WJLECC22.cjs} +75 -73
  42. package/dist/{chunk-V5D7BHW3.js → chunk-WJMEBBU7.js} +6 -4
  43. package/dist/{chunk-NFW7AUEX.js → chunk-WMACINXO.js} +1 -1
  44. package/dist/chunk-X7WBPCEU.js +9817 -0
  45. package/dist/{chunk-46T67CE2.js → chunk-ZA673I3O.js} +1 -1
  46. package/dist/{chunk-YPYCWLYP.js → chunk-ZWXJTBZO.js} +1 -1
  47. package/dist/core/addresses.d.ts +14 -2
  48. package/dist/core/brands.d.ts +8 -2
  49. package/dist/core/errors.d.ts +71 -10
  50. package/dist/core/preflight.d.ts +1 -0
  51. package/dist/fhe/erc7984-abi.d.ts +1 -0
  52. package/dist/fhe/index.cjs +64 -63
  53. package/dist/fhe/index.js +7 -6
  54. package/dist/fhe/operators.d.ts +22 -5
  55. package/dist/fhe/react/index.cjs +13 -12
  56. package/dist/fhe/react/index.js +6 -5
  57. package/dist/fhe/types.d.ts +8 -2
  58. package/dist/fhe-airdrop/abis/{cloneable.d.ts → airdrop-base.d.ts} +254 -396
  59. package/dist/fhe-airdrop/abis/compliance.d.ts +422 -0
  60. package/dist/fhe-airdrop/abis/ecdsa.d.ts +1316 -0
  61. package/dist/fhe-airdrop/abis/factory.d.ts +1319 -190
  62. package/dist/fhe-airdrop/abis/index.d.ts +5 -2
  63. package/dist/fhe-airdrop/abis/merkle.d.ts +1250 -0
  64. package/dist/fhe-airdrop/advanced/index.cjs +11 -12
  65. package/dist/fhe-airdrop/advanced/index.d.cts +34 -11
  66. package/dist/fhe-airdrop/advanced/index.d.ts +34 -11
  67. package/dist/fhe-airdrop/advanced/index.js +3 -8
  68. package/dist/fhe-airdrop/advanced/react/index.cjs +619 -51
  69. package/dist/fhe-airdrop/advanced/react/index.d.cts +43 -3
  70. package/dist/fhe-airdrop/advanced/react/index.d.ts +43 -3
  71. package/dist/fhe-airdrop/advanced/react/index.js +592 -52
  72. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
  73. package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
  74. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +25 -0
  75. package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
  76. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
  77. package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
  78. package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
  79. package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
  80. package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
  81. package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
  82. package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +36 -0
  83. package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +35 -0
  84. package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
  85. package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +47 -0
  86. package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
  87. package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
  88. package/dist/fhe-airdrop/advanced/react/usePredictEcdsaAirdropAddress.d.ts +33 -0
  89. package/dist/fhe-airdrop/advanced/react/usePredictMerkleAirdropAddress.d.ts +27 -0
  90. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
  91. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
  92. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
  93. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +28 -0
  94. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
  95. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +28 -0
  96. package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
  97. package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
  98. package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
  99. package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
  100. package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
  101. package/dist/fhe-airdrop/airdrop-base.d.ts +608 -0
  102. package/dist/fhe-airdrop/campaign.d.ts +338 -0
  103. package/dist/fhe-airdrop/compliance.d.ts +302 -0
  104. package/dist/fhe-airdrop/constants.d.ts +33 -0
  105. package/dist/fhe-airdrop/ecdsa.d.ts +263 -0
  106. package/dist/fhe-airdrop/encryption.d.ts +92 -14
  107. package/dist/fhe-airdrop/errors.d.ts +273 -15
  108. package/dist/fhe-airdrop/factory.d.ts +533 -274
  109. package/dist/fhe-airdrop/guards.d.ts +317 -0
  110. package/dist/fhe-airdrop/index.cjs +233 -73
  111. package/dist/fhe-airdrop/index.d.cts +46 -8
  112. package/dist/fhe-airdrop/index.d.ts +46 -8
  113. package/dist/fhe-airdrop/index.js +11 -7
  114. package/dist/fhe-airdrop/merkle-tree.d.ts +97 -0
  115. package/dist/fhe-airdrop/merkle.d.ts +201 -0
  116. package/dist/fhe-airdrop/react/_shared.d.ts +156 -70
  117. package/dist/fhe-airdrop/react/index.cjs +1174 -384
  118. package/dist/fhe-airdrop/react/index.d.cts +99 -74
  119. package/dist/fhe-airdrop/react/index.d.ts +99 -74
  120. package/dist/fhe-airdrop/react/index.js +993 -303
  121. package/dist/fhe-airdrop/react/keys.d.ts +90 -0
  122. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
  123. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
  124. package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
  125. package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
  126. package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
  127. package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
  128. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
  129. package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
  130. package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +10 -5
  131. package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +29 -10
  132. package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +15 -6
  133. package/dist/fhe-airdrop/react/useAirdropPause.d.ts +30 -0
  134. package/dist/fhe-airdrop/react/useAirdropPaused.d.ts +17 -0
  135. package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
  136. package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +27 -9
  137. package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
  138. package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
  139. package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
  140. package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -4
  141. package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
  142. package/dist/fhe-airdrop/react/useAirdropWindow.d.ts +37 -0
  143. package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
  144. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
  145. package/dist/fhe-airdrop/react/useClaimedAmount.d.ts +29 -0
  146. package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
  147. package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
  148. package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
  149. package/dist/fhe-airdrop/react/useComplianceManager.d.ts +16 -0
  150. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
  151. package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
  152. package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
  153. package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
  154. package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
  155. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
  156. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
  157. package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +28 -0
  158. package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +25 -0
  159. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
  160. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +24 -0
  161. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
  162. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
  163. package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
  164. package/dist/fhe-airdrop/react/useEffectiveUpgradeable.d.ts +20 -0
  165. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
  166. package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +17 -12
  167. package/dist/fhe-airdrop/react/useFactoryFees.d.ts +28 -0
  168. package/dist/fhe-airdrop/react/useFactoryRegistry.d.ts +35 -0
  169. package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +35 -0
  170. package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +35 -0
  171. package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
  172. package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
  173. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
  174. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +22 -0
  175. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
  176. package/dist/fhe-airdrop/react/useMerkleRoot.d.ts +15 -0
  177. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
  178. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
  179. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -35
  180. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
  181. package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
  182. package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
  183. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
  184. package/dist/fhe-airdrop/react/useSetMerkleRoot.d.ts +22 -0
  185. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +32 -21
  186. package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +23 -0
  187. package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
  188. package/dist/fhe-airdrop/roles.d.ts +147 -0
  189. package/dist/fhe-airdrop/types.d.ts +78 -63
  190. package/dist/fhe-disperse/index.cjs +70 -68
  191. package/dist/fhe-disperse/index.js +10 -8
  192. package/dist/fhe-disperse/react/index.cjs +94 -92
  193. package/dist/fhe-disperse/react/index.js +13 -11
  194. package/dist/fhe-vesting/advanced/index.cjs +10 -8
  195. package/dist/fhe-vesting/advanced/index.js +8 -6
  196. package/dist/fhe-vesting/advanced/react/index.cjs +16 -14
  197. package/dist/fhe-vesting/advanced/react/index.js +13 -11
  198. package/dist/fhe-vesting/index.cjs +74 -72
  199. package/dist/fhe-vesting/index.js +11 -9
  200. package/dist/fhe-vesting/react/index.cjs +228 -226
  201. package/dist/fhe-vesting/react/index.js +15 -13
  202. package/dist/index.cjs +100 -87
  203. package/dist/index.js +3 -2
  204. package/dist/testnet-faucet/index.cjs +57 -55
  205. package/dist/testnet-faucet/index.js +7 -5
  206. package/dist/testnet-faucet/react/index.cjs +55 -53
  207. package/dist/testnet-faucet/react/index.js +9 -7
  208. package/package.json +6 -2
  209. package/dist/chunk-CNP4L3GF.js +0 -105
  210. package/dist/chunk-KSDSXJ34.js +0 -41
  211. package/dist/chunk-LBWRFZR3.cjs +0 -1681
  212. package/dist/chunk-OL6SHN3D.cjs +0 -44
  213. package/dist/chunk-S2XD75JM.js +0 -1637
  214. package/dist/chunk-SPGSO5SO.cjs +0 -1644
  215. package/dist/chunk-UE5XK2SY.js +0 -1673
  216. package/dist/chunk-WO72UBQD.cjs +0 -109
  217. package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +0 -53
  218. package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +0 -49
  219. package/dist/fhe-airdrop/airdrop.d.ts +0 -317
  220. package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +0 -37
  221. package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +0 -7
  222. package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +0 -10
  223. package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +0 -16
  224. package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +0 -6
  225. package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +0 -8
  226. package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +0 -10
  227. package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +0 -17
  228. package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +0 -10
  229. package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +0 -15
  230. package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +0 -11
  231. package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +0 -17
  232. package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +0 -17
  233. package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +0 -16
  234. package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +0 -15
  235. package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +0 -7
  236. package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +0 -7
  237. package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +0 -9
  238. package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +0 -8
  239. package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +0 -22
  240. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +0 -51
  241. package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +0 -10
  242. package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +0 -15
  243. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +0 -14
  244. package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +0 -14
  245. package/dist/fhe-airdrop/react/useClaim.d.ts +0 -39
  246. package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +0 -11
  247. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +0 -41
  248. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +0 -48
  249. package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +0 -29
  250. package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +0 -31
  251. package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +0 -14
  252. package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +0 -17
  253. package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +0 -10
  254. package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +0 -11
  255. package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +0 -17
  256. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +0 -33
  257. package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +0 -16
  258. package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +0 -15
  259. package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +0 -14
  260. package/dist/fhe-airdrop/react/useSetPaused.d.ts +0 -14
  261. package/dist/fhe-airdrop/react/useWithdraw.d.ts +0 -12
  262. package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +0 -13
  263. package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +0 -13
@@ -1,1637 +0,0 @@
1
- import { getFhevmAclAddress, requireFhevmAclAddress, ACL_ALLOWED_EVENT } from './chunk-YPYCWLYP.js';
2
- import { SDK_VERSION, mapContractRevert, isContractRevert } from './chunk-6WSNS3UV.js';
3
- import { TokenOpsSdkError, PausedError, InsufficientFeeError, ReceiptEventNotFoundError, ReceiptEventAmbiguousError, InvalidArgumentError, MissingWalletClientError, MissingAccountError, InsufficientBalanceError, InvalidSignatureError } from './chunk-DRSPMIZ7.js';
4
- import { withTelemetry } from './chunk-Q2GP5UDC.js';
5
- import { parseEventLogs, isAddress } from 'viem';
6
-
7
- // src/fhe-airdrop/abis/cloneable.ts
8
- var confidentialAirdropCloneableAbi = [
9
- {
10
- inputs: [],
11
- stateMutability: "nonpayable",
12
- type: "constructor"
13
- },
14
- {
15
- inputs: [],
16
- name: "AccessControlBadConfirmation",
17
- type: "error"
18
- },
19
- {
20
- inputs: [
21
- {
22
- internalType: "address",
23
- name: "account",
24
- type: "address"
25
- },
26
- {
27
- internalType: "bytes32",
28
- name: "neededRole",
29
- type: "bytes32"
30
- }
31
- ],
32
- name: "AccessControlUnauthorizedAccount",
33
- type: "error"
34
- },
35
- {
36
- inputs: [],
37
- name: "ClaimNotStarted",
38
- type: "error"
39
- },
40
- {
41
- inputs: [],
42
- name: "ClaimWindowFinished",
43
- type: "error"
44
- },
45
- {
46
- inputs: [],
47
- name: "ClaimsPaused",
48
- type: "error"
49
- },
50
- {
51
- inputs: [],
52
- name: "ECDSAInvalidSignature",
53
- type: "error"
54
- },
55
- {
56
- inputs: [
57
- {
58
- internalType: "uint256",
59
- name: "length",
60
- type: "uint256"
61
- }
62
- ],
63
- name: "ECDSAInvalidSignatureLength",
64
- type: "error"
65
- },
66
- {
67
- inputs: [
68
- {
69
- internalType: "bytes32",
70
- name: "s",
71
- type: "bytes32"
72
- }
73
- ],
74
- name: "ECDSAInvalidSignatureS",
75
- type: "error"
76
- },
77
- {
78
- inputs: [],
79
- name: "EndTimeInPast",
80
- type: "error"
81
- },
82
- {
83
- inputs: [],
84
- name: "ExtensionNotAllowed",
85
- type: "error"
86
- },
87
- {
88
- inputs: [],
89
- name: "InsufficientBalance",
90
- type: "error"
91
- },
92
- {
93
- inputs: [],
94
- name: "InsufficientFee",
95
- type: "error"
96
- },
97
- {
98
- inputs: [],
99
- name: "InvalidAddress",
100
- type: "error"
101
- },
102
- {
103
- inputs: [],
104
- name: "InvalidDuration",
105
- type: "error"
106
- },
107
- {
108
- inputs: [],
109
- name: "InvalidInitialization",
110
- type: "error"
111
- },
112
- {
113
- inputs: [],
114
- name: "InvalidSignature",
115
- type: "error"
116
- },
117
- {
118
- inputs: [],
119
- name: "InvalidStartTime",
120
- type: "error"
121
- },
122
- {
123
- inputs: [],
124
- name: "NotInitializing",
125
- type: "error"
126
- },
127
- {
128
- inputs: [
129
- {
130
- internalType: "bytes32",
131
- name: "handle",
132
- type: "bytes32"
133
- },
134
- {
135
- internalType: "address",
136
- name: "sender",
137
- type: "address"
138
- }
139
- ],
140
- name: "SenderNotAllowedToUseHandle",
141
- type: "error"
142
- },
143
- {
144
- inputs: [
145
- {
146
- internalType: "address",
147
- name: "sender",
148
- type: "address"
149
- }
150
- ],
151
- name: "SenderNotAllowed",
152
- type: "error"
153
- },
154
- {
155
- inputs: [],
156
- name: "SignatureAlreadyClaimed",
157
- type: "error"
158
- },
159
- {
160
- inputs: [],
161
- name: "TransferFailed",
162
- type: "error"
163
- },
164
- {
165
- inputs: [],
166
- name: "ZamaProtocolUnsupported",
167
- type: "error"
168
- },
169
- {
170
- inputs: [],
171
- name: "ZeroBalance",
172
- type: "error"
173
- },
174
- {
175
- anonymous: false,
176
- inputs: [
177
- {
178
- indexed: true,
179
- internalType: "address",
180
- name: "admin",
181
- type: "address"
182
- },
183
- {
184
- indexed: false,
185
- internalType: "uint32",
186
- name: "oldEndTime",
187
- type: "uint32"
188
- },
189
- {
190
- indexed: false,
191
- internalType: "uint32",
192
- name: "newEndTime",
193
- type: "uint32"
194
- }
195
- ],
196
- name: "ClaimWindowExtended",
197
- type: "event"
198
- },
199
- {
200
- anonymous: false,
201
- inputs: [
202
- {
203
- indexed: true,
204
- internalType: "address",
205
- name: "user",
206
- type: "address"
207
- },
208
- {
209
- indexed: false,
210
- internalType: "bytes32",
211
- name: "signatureHash",
212
- type: "bytes32"
213
- }
214
- ],
215
- name: "Claimed",
216
- type: "event"
217
- },
218
- {
219
- anonymous: false,
220
- inputs: [],
221
- name: "EIP712DomainChanged",
222
- type: "event"
223
- },
224
- {
225
- anonymous: false,
226
- inputs: [
227
- {
228
- indexed: true,
229
- internalType: "address",
230
- name: "recipient",
231
- type: "address"
232
- },
233
- {
234
- indexed: false,
235
- internalType: "uint256",
236
- name: "amount",
237
- type: "uint256"
238
- }
239
- ],
240
- name: "GasFeeWithdrawn",
241
- type: "event"
242
- },
243
- {
244
- anonymous: false,
245
- inputs: [
246
- {
247
- indexed: false,
248
- internalType: "uint64",
249
- name: "version",
250
- type: "uint64"
251
- }
252
- ],
253
- name: "Initialized",
254
- type: "event"
255
- },
256
- {
257
- anonymous: false,
258
- inputs: [
259
- {
260
- indexed: true,
261
- internalType: "address",
262
- name: "admin",
263
- type: "address"
264
- },
265
- {
266
- indexed: true,
267
- internalType: "address",
268
- name: "feeCollector",
269
- type: "address"
270
- },
271
- {
272
- indexed: false,
273
- internalType: "uint32",
274
- name: "endTime",
275
- type: "uint32"
276
- }
277
- ],
278
- name: "Initialized",
279
- type: "event"
280
- },
281
- {
282
- anonymous: false,
283
- inputs: [
284
- {
285
- indexed: true,
286
- internalType: "address",
287
- name: "admin",
288
- type: "address"
289
- },
290
- {
291
- indexed: true,
292
- internalType: "address",
293
- name: "token",
294
- type: "address"
295
- },
296
- {
297
- indexed: true,
298
- internalType: "address",
299
- name: "recipient",
300
- type: "address"
301
- }
302
- ],
303
- name: "OtherConfidentialTokenWithdrawn",
304
- type: "event"
305
- },
306
- {
307
- anonymous: false,
308
- inputs: [
309
- {
310
- indexed: true,
311
- internalType: "address",
312
- name: "admin",
313
- type: "address"
314
- },
315
- {
316
- indexed: true,
317
- internalType: "address",
318
- name: "token",
319
- type: "address"
320
- },
321
- {
322
- indexed: false,
323
- internalType: "uint256",
324
- name: "amount",
325
- type: "uint256"
326
- }
327
- ],
328
- name: "OtherTokenWithdrawn",
329
- type: "event"
330
- },
331
- {
332
- anonymous: false,
333
- inputs: [
334
- {
335
- indexed: false,
336
- internalType: "bool",
337
- name: "isPaused",
338
- type: "bool"
339
- }
340
- ],
341
- name: "PauseToggled",
342
- type: "event"
343
- },
344
- {
345
- anonymous: false,
346
- inputs: [
347
- {
348
- indexed: true,
349
- internalType: "bytes32",
350
- name: "role",
351
- type: "bytes32"
352
- },
353
- {
354
- indexed: true,
355
- internalType: "bytes32",
356
- name: "previousAdminRole",
357
- type: "bytes32"
358
- },
359
- {
360
- indexed: true,
361
- internalType: "bytes32",
362
- name: "newAdminRole",
363
- type: "bytes32"
364
- }
365
- ],
366
- name: "RoleAdminChanged",
367
- type: "event"
368
- },
369
- {
370
- anonymous: false,
371
- inputs: [
372
- {
373
- indexed: true,
374
- internalType: "bytes32",
375
- name: "role",
376
- type: "bytes32"
377
- },
378
- {
379
- indexed: true,
380
- internalType: "address",
381
- name: "account",
382
- type: "address"
383
- },
384
- {
385
- indexed: true,
386
- internalType: "address",
387
- name: "sender",
388
- type: "address"
389
- }
390
- ],
391
- name: "RoleGranted",
392
- type: "event"
393
- },
394
- {
395
- anonymous: false,
396
- inputs: [
397
- {
398
- indexed: true,
399
- internalType: "bytes32",
400
- name: "role",
401
- type: "bytes32"
402
- },
403
- {
404
- indexed: true,
405
- internalType: "address",
406
- name: "account",
407
- type: "address"
408
- },
409
- {
410
- indexed: true,
411
- internalType: "address",
412
- name: "sender",
413
- type: "address"
414
- }
415
- ],
416
- name: "RoleRevoked",
417
- type: "event"
418
- },
419
- {
420
- anonymous: false,
421
- inputs: [
422
- {
423
- indexed: true,
424
- internalType: "address",
425
- name: "admin",
426
- type: "address"
427
- },
428
- {
429
- indexed: true,
430
- internalType: "address",
431
- name: "recipient",
432
- type: "address"
433
- }
434
- ],
435
- name: "Withdrawn",
436
- type: "event"
437
- },
438
- {
439
- inputs: [],
440
- name: "CAN_EXTEND_CLAIM_WINDOW",
441
- outputs: [
442
- {
443
- internalType: "bool",
444
- name: "",
445
- type: "bool"
446
- }
447
- ],
448
- stateMutability: "view",
449
- type: "function"
450
- },
451
- {
452
- inputs: [],
453
- name: "CLAIM_TYPEHASH",
454
- outputs: [
455
- {
456
- internalType: "bytes32",
457
- name: "",
458
- type: "bytes32"
459
- }
460
- ],
461
- stateMutability: "view",
462
- type: "function"
463
- },
464
- {
465
- inputs: [],
466
- name: "DEFAULT_ADMIN_ROLE",
467
- outputs: [
468
- {
469
- internalType: "bytes32",
470
- name: "",
471
- type: "bytes32"
472
- }
473
- ],
474
- stateMutability: "view",
475
- type: "function"
476
- },
477
- {
478
- inputs: [],
479
- name: "DOMAIN_SEPARATOR",
480
- outputs: [
481
- {
482
- internalType: "bytes32",
483
- name: "",
484
- type: "bytes32"
485
- }
486
- ],
487
- stateMutability: "view",
488
- type: "function"
489
- },
490
- {
491
- inputs: [],
492
- name: "FEE_COLLECTOR_ROLE",
493
- outputs: [
494
- {
495
- internalType: "bytes32",
496
- name: "",
497
- type: "bytes32"
498
- }
499
- ],
500
- stateMutability: "view",
501
- type: "function"
502
- },
503
- {
504
- inputs: [],
505
- name: "GAS_FEE",
506
- outputs: [
507
- {
508
- internalType: "uint256",
509
- name: "",
510
- type: "uint256"
511
- }
512
- ],
513
- stateMutability: "view",
514
- type: "function"
515
- },
516
- {
517
- inputs: [],
518
- name: "START_TIME",
519
- outputs: [
520
- {
521
- internalType: "uint32",
522
- name: "",
523
- type: "uint32"
524
- }
525
- ],
526
- stateMutability: "view",
527
- type: "function"
528
- },
529
- {
530
- inputs: [],
531
- name: "TOKEN",
532
- outputs: [
533
- {
534
- internalType: "contract IERC7984",
535
- name: "",
536
- type: "address"
537
- }
538
- ],
539
- stateMutability: "view",
540
- type: "function"
541
- },
542
- {
543
- inputs: [
544
- {
545
- internalType: "externalEuint64",
546
- name: "inputAmount",
547
- type: "bytes32"
548
- },
549
- {
550
- internalType: "bytes",
551
- name: "inputProof",
552
- type: "bytes"
553
- },
554
- {
555
- internalType: "bytes",
556
- name: "signature",
557
- type: "bytes"
558
- }
559
- ],
560
- name: "claim",
561
- outputs: [],
562
- stateMutability: "payable",
563
- type: "function"
564
- },
565
- {
566
- inputs: [
567
- {
568
- internalType: "bytes32",
569
- name: "signatureHash",
570
- type: "bytes32"
571
- }
572
- ],
573
- name: "claimedSignatures",
574
- outputs: [
575
- {
576
- internalType: "bool",
577
- name: "isClaimed",
578
- type: "bool"
579
- }
580
- ],
581
- stateMutability: "view",
582
- type: "function"
583
- },
584
- {
585
- inputs: [],
586
- name: "deploymentBlockNumber",
587
- outputs: [
588
- {
589
- internalType: "uint256",
590
- name: "",
591
- type: "uint256"
592
- }
593
- ],
594
- stateMutability: "view",
595
- type: "function"
596
- },
597
- {
598
- inputs: [],
599
- name: "eip712Domain",
600
- outputs: [
601
- {
602
- internalType: "bytes1",
603
- name: "fields",
604
- type: "bytes1"
605
- },
606
- {
607
- internalType: "string",
608
- name: "name",
609
- type: "string"
610
- },
611
- {
612
- internalType: "string",
613
- name: "version",
614
- type: "string"
615
- },
616
- {
617
- internalType: "uint256",
618
- name: "chainId",
619
- type: "uint256"
620
- },
621
- {
622
- internalType: "address",
623
- name: "verifyingContract",
624
- type: "address"
625
- },
626
- {
627
- internalType: "bytes32",
628
- name: "salt",
629
- type: "bytes32"
630
- },
631
- {
632
- internalType: "uint256[]",
633
- name: "extensions",
634
- type: "uint256[]"
635
- }
636
- ],
637
- stateMutability: "view",
638
- type: "function"
639
- },
640
- {
641
- inputs: [],
642
- name: "endTime",
643
- outputs: [
644
- {
645
- internalType: "uint32",
646
- name: "",
647
- type: "uint32"
648
- }
649
- ],
650
- stateMutability: "view",
651
- type: "function"
652
- },
653
- {
654
- inputs: [
655
- {
656
- internalType: "uint32",
657
- name: "newEndTime",
658
- type: "uint32"
659
- }
660
- ],
661
- name: "extendClaimWindow",
662
- outputs: [],
663
- stateMutability: "nonpayable",
664
- type: "function"
665
- },
666
- {
667
- inputs: [
668
- {
669
- internalType: "externalEuint64",
670
- name: "inputAmount",
671
- type: "bytes32"
672
- },
673
- {
674
- internalType: "bytes",
675
- name: "inputProof",
676
- type: "bytes"
677
- },
678
- {
679
- internalType: "bytes",
680
- name: "signature",
681
- type: "bytes"
682
- }
683
- ],
684
- name: "getClaimAmount",
685
- outputs: [
686
- {
687
- internalType: "euint64",
688
- name: "encryptedAmount",
689
- type: "bytes32"
690
- }
691
- ],
692
- stateMutability: "nonpayable",
693
- type: "function"
694
- },
695
- {
696
- inputs: [
697
- {
698
- internalType: "bytes32",
699
- name: "role",
700
- type: "bytes32"
701
- }
702
- ],
703
- name: "getRoleAdmin",
704
- outputs: [
705
- {
706
- internalType: "bytes32",
707
- name: "",
708
- type: "bytes32"
709
- }
710
- ],
711
- stateMutability: "view",
712
- type: "function"
713
- },
714
- {
715
- inputs: [
716
- {
717
- internalType: "bytes32",
718
- name: "role",
719
- type: "bytes32"
720
- },
721
- {
722
- internalType: "address",
723
- name: "account",
724
- type: "address"
725
- }
726
- ],
727
- name: "grantRole",
728
- outputs: [],
729
- stateMutability: "nonpayable",
730
- type: "function"
731
- },
732
- {
733
- inputs: [],
734
- name: "hasClaimEnded",
735
- outputs: [
736
- {
737
- internalType: "bool",
738
- name: "",
739
- type: "bool"
740
- }
741
- ],
742
- stateMutability: "view",
743
- type: "function"
744
- },
745
- {
746
- inputs: [],
747
- name: "hasClaimStarted",
748
- outputs: [
749
- {
750
- internalType: "bool",
751
- name: "",
752
- type: "bool"
753
- }
754
- ],
755
- stateMutability: "view",
756
- type: "function"
757
- },
758
- {
759
- inputs: [
760
- {
761
- internalType: "bytes32",
762
- name: "role",
763
- type: "bytes32"
764
- },
765
- {
766
- internalType: "address",
767
- name: "account",
768
- type: "address"
769
- }
770
- ],
771
- name: "hasRole",
772
- outputs: [
773
- {
774
- internalType: "bool",
775
- name: "",
776
- type: "bool"
777
- }
778
- ],
779
- stateMutability: "view",
780
- type: "function"
781
- },
782
- {
783
- inputs: [
784
- {
785
- internalType: "address",
786
- name: "_admin",
787
- type: "address"
788
- },
789
- {
790
- internalType: "address",
791
- name: "_feeCollector",
792
- type: "address"
793
- },
794
- {
795
- internalType: "uint32",
796
- name: "_endTime",
797
- type: "uint32"
798
- }
799
- ],
800
- name: "initialize",
801
- outputs: [],
802
- stateMutability: "nonpayable",
803
- type: "function"
804
- },
805
- {
806
- inputs: [],
807
- name: "isClaimWindowActive",
808
- outputs: [
809
- {
810
- internalType: "bool",
811
- name: "",
812
- type: "bool"
813
- }
814
- ],
815
- stateMutability: "view",
816
- type: "function"
817
- },
818
- {
819
- inputs: [],
820
- name: "isPaused",
821
- outputs: [
822
- {
823
- internalType: "bool",
824
- name: "",
825
- type: "bool"
826
- }
827
- ],
828
- stateMutability: "view",
829
- type: "function"
830
- },
831
- {
832
- inputs: [
833
- {
834
- internalType: "address",
835
- name: "user",
836
- type: "address"
837
- },
838
- {
839
- internalType: "externalEuint64",
840
- name: "encryptedAmount",
841
- type: "bytes32"
842
- }
843
- ],
844
- name: "isSignatureClaimed",
845
- outputs: [
846
- {
847
- internalType: "bool",
848
- name: "",
849
- type: "bool"
850
- }
851
- ],
852
- stateMutability: "view",
853
- type: "function"
854
- },
855
- {
856
- inputs: [
857
- {
858
- internalType: "externalEuint64",
859
- name: "inputAmount",
860
- type: "bytes32"
861
- },
862
- {
863
- internalType: "bytes",
864
- name: "signature",
865
- type: "bytes"
866
- }
867
- ],
868
- name: "isSignatureValid",
869
- outputs: [
870
- {
871
- internalType: "bool",
872
- name: "",
873
- type: "bool"
874
- }
875
- ],
876
- stateMutability: "view",
877
- type: "function"
878
- },
879
- {
880
- inputs: [
881
- {
882
- internalType: "bytes32",
883
- name: "role",
884
- type: "bytes32"
885
- },
886
- {
887
- internalType: "address",
888
- name: "callerConfirmation",
889
- type: "address"
890
- }
891
- ],
892
- name: "renounceRole",
893
- outputs: [],
894
- stateMutability: "nonpayable",
895
- type: "function"
896
- },
897
- {
898
- inputs: [
899
- {
900
- internalType: "bytes32",
901
- name: "role",
902
- type: "bytes32"
903
- },
904
- {
905
- internalType: "address",
906
- name: "account",
907
- type: "address"
908
- }
909
- ],
910
- name: "revokeRole",
911
- outputs: [],
912
- stateMutability: "nonpayable",
913
- type: "function"
914
- },
915
- {
916
- inputs: [
917
- {
918
- internalType: "bool",
919
- name: "paused",
920
- type: "bool"
921
- }
922
- ],
923
- name: "setPaused",
924
- outputs: [],
925
- stateMutability: "nonpayable",
926
- type: "function"
927
- },
928
- {
929
- inputs: [
930
- {
931
- internalType: "bytes4",
932
- name: "interfaceId",
933
- type: "bytes4"
934
- }
935
- ],
936
- name: "supportsInterface",
937
- outputs: [
938
- {
939
- internalType: "bool",
940
- name: "",
941
- type: "bool"
942
- }
943
- ],
944
- stateMutability: "view",
945
- type: "function"
946
- },
947
- {
948
- inputs: [
949
- {
950
- internalType: "address",
951
- name: "recipient",
952
- type: "address"
953
- }
954
- ],
955
- name: "withdraw",
956
- outputs: [],
957
- stateMutability: "nonpayable",
958
- type: "function"
959
- },
960
- {
961
- inputs: [
962
- {
963
- internalType: "address",
964
- name: "recipient",
965
- type: "address"
966
- },
967
- {
968
- internalType: "uint256",
969
- name: "amount",
970
- type: "uint256"
971
- }
972
- ],
973
- name: "withdrawGasFee",
974
- outputs: [],
975
- stateMutability: "nonpayable",
976
- type: "function"
977
- },
978
- {
979
- inputs: [
980
- {
981
- internalType: "address",
982
- name: "tokenAddress",
983
- type: "address"
984
- },
985
- {
986
- internalType: "address",
987
- name: "recipient",
988
- type: "address"
989
- }
990
- ],
991
- name: "withdrawOtherConfidentialToken",
992
- outputs: [],
993
- stateMutability: "nonpayable",
994
- type: "function"
995
- },
996
- {
997
- inputs: [
998
- {
999
- internalType: "address",
1000
- name: "tokenAddress",
1001
- type: "address"
1002
- },
1003
- {
1004
- internalType: "address",
1005
- name: "recipient",
1006
- type: "address"
1007
- }
1008
- ],
1009
- name: "withdrawOtherToken",
1010
- outputs: [],
1011
- stateMutability: "nonpayable",
1012
- type: "function"
1013
- }
1014
- ];
1015
-
1016
- // src/fhe-airdrop/errors.ts
1017
- var AlreadyClaimedError = class extends TokenOpsSdkError {
1018
- name = "AlreadyClaimedError";
1019
- constructor(args) {
1020
- const who = args.caller ? `${args.caller}: ` : "";
1021
- super(`${args.method}: ${who}this airdrop claim has already been redeemed.`, {
1022
- code: "TOKENOPS_ALREADY_CLAIMED",
1023
- cause: args.cause,
1024
- context: {
1025
- method: args.method,
1026
- contractAddress: args.contractAddress,
1027
- caller: args.caller
1028
- }
1029
- });
1030
- }
1031
- };
1032
- var ClaimNotStartedError = class extends TokenOpsSdkError {
1033
- name = "ClaimNotStartedError";
1034
- constructor(args) {
1035
- const detail = args.startsAt !== void 0 ? ` Opens at unix timestamp ${args.startsAt}.` : "";
1036
- super(`${args.method}: airdrop claim window has not started.${detail}`, {
1037
- code: "TOKENOPS_CLAIM_NOT_STARTED",
1038
- cause: args.cause,
1039
- context: {
1040
- method: args.method,
1041
- contractAddress: args.contractAddress,
1042
- startsAt: args.startsAt
1043
- }
1044
- });
1045
- }
1046
- };
1047
- var ClaimWindowClosedError = class extends TokenOpsSdkError {
1048
- name = "ClaimWindowClosedError";
1049
- constructor(args) {
1050
- const detail = args.endedAt !== void 0 ? ` Closed at unix timestamp ${args.endedAt}.` : "";
1051
- super(`${args.method}: airdrop claim window has closed.${detail}`, {
1052
- code: "TOKENOPS_CLAIM_WINDOW_CLOSED",
1053
- cause: args.cause,
1054
- context: {
1055
- method: args.method,
1056
- contractAddress: args.contractAddress,
1057
- endedAt: args.endedAt
1058
- }
1059
- });
1060
- }
1061
- };
1062
- var CONFIDENTIAL_POOL_BALANCE_METHODS = /* @__PURE__ */ new Set([
1063
- "claim",
1064
- "withdraw",
1065
- "withdrawOtherConfidentialToken"
1066
- ]);
1067
- var airdropProductMapper = (name, _args, ctx) => {
1068
- switch (name) {
1069
- case "SignatureAlreadyClaimed":
1070
- return new AlreadyClaimedError(ctx);
1071
- case "ClaimNotStarted":
1072
- return new ClaimNotStartedError(ctx);
1073
- case "ClaimWindowFinished":
1074
- return new ClaimWindowClosedError(ctx);
1075
- // OZ ECDSA reverts surface from `isSignatureValid` when the signature
1076
- // bytes are structurally malformed (e.g. `s`-value out of range,
1077
- // 0-length, wrong length). Map to a single typed error so consumers
1078
- // can branch on `error.code === "TOKENOPS_INVALID_SIGNATURE"`.
1079
- case "ECDSAInvalidSignature":
1080
- case "ECDSAInvalidSignatureS":
1081
- case "ECDSAInvalidSignatureLength":
1082
- return new InvalidSignatureError(ctx);
1083
- case "ZeroBalance":
1084
- case "InsufficientBalance":
1085
- return CONFIDENTIAL_POOL_BALANCE_METHODS.has(ctx.method) ? new InsufficientBalanceError({ ...ctx, balanceKind: "confidential" }) : void 0;
1086
- default:
1087
- return void 0;
1088
- }
1089
- };
1090
- var ConfidentialAirdropClient = class {
1091
- publicClient;
1092
- walletClient;
1093
- address;
1094
- #aclAddressOverride;
1095
- #telemetry;
1096
- #cachedAclAddress;
1097
- constructor(config) {
1098
- this.publicClient = config.publicClient;
1099
- this.walletClient = config.walletClient;
1100
- this.address = config.address;
1101
- this.#telemetry = config.telemetry;
1102
- this.#aclAddressOverride = config.aclAddress;
1103
- const chainIdForInit = config.publicClient.chain?.id;
1104
- this.#telemetry?.event("fhe-airdrop.client.init", {
1105
- surface: "client",
1106
- chainId: chainIdForInit ?? null,
1107
- hasWallet: !!this.walletClient,
1108
- aclResolved: !!config.aclAddress || chainIdForInit !== void 0 && !!getFhevmAclAddress(chainIdForInit),
1109
- sdkVersion: SDK_VERSION
1110
- });
1111
- }
1112
- /**
1113
- * The FHEVM ACL contract address used by encrypted-view methods to parse
1114
- * `ACL.Allowed` events. Resolved lazily on first access; throws
1115
- * `DeploymentAddressUnavailableError` if no override was passed and the
1116
- * SDK does not have an ACL deployed for the connected chain.
1117
- */
1118
- get aclAddress() {
1119
- if (this.#cachedAclAddress) return this.#cachedAclAddress;
1120
- this.#cachedAclAddress = this.#aclAddressOverride ?? requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialAirdropClient");
1121
- return this.#cachedAclAddress;
1122
- }
1123
- // ============================================================
1124
- // IMMUTABLE READS
1125
- // ============================================================
1126
- /** ERC-7984 confidential token this airdrop was deployed for. Immutable arg. */
1127
- async token() {
1128
- return this.#read("TOKEN");
1129
- }
1130
- /** Per-claim gas fee in wei. Immutable arg. Attached as `msg.value` by `claim()` automatically. */
1131
- async gasFee() {
1132
- return this.#read("GAS_FEE");
1133
- }
1134
- /** Unix timestamp when claims become available. Immutable arg. */
1135
- async startTime() {
1136
- return this.#read("START_TIME");
1137
- }
1138
- /** Whether the admin can extend the claim window past `endTime`. Immutable arg. */
1139
- async canExtendClaimWindow() {
1140
- return this.#read("CAN_EXTEND_CLAIM_WINDOW");
1141
- }
1142
- // ============================================================
1143
- // STORAGE READS
1144
- // ============================================================
1145
- /** Unix timestamp when claims end. Mutable — can be extended by admin if `canExtendClaimWindow`. */
1146
- async endTime() {
1147
- return this.#read("endTime");
1148
- }
1149
- /** Whether claims are currently paused by the admin. */
1150
- async isPaused() {
1151
- return this.#read("isPaused");
1152
- }
1153
- /** Block number at which this clone was deployed. */
1154
- async deploymentBlockNumber() {
1155
- return this.#read("deploymentBlockNumber");
1156
- }
1157
- /**
1158
- * Check whether a pre-computed signature hash has been consumed.
1159
- *
1160
- * The contract keys claim replay-protection on
1161
- * `keccak256(abi.encode(CLAIM_TYPEHASH, recipient, bytes32(encryptedAmountHandle)))`.
1162
- * Use this when you already hold the struct hash (e.g. you computed it server-side
1163
- * while building the claim payload). For the more common case where you hold the
1164
- * user address and the encrypted handle, use {@link isSignatureClaimed} instead —
1165
- * it computes the hash for you.
1166
- *
1167
- * @param signatureHash `bytes32` storage key — the EIP-712 struct hash of the Claim.
1168
- */
1169
- async claimedSignatures(signatureHash) {
1170
- return this.#read("claimedSignatures", [signatureHash]);
1171
- }
1172
- // ============================================================
1173
- // VIEW FUNCTIONS
1174
- // ============================================================
1175
- /** `true` if within the claim time window and not paused. Free read — no gas. */
1176
- async isClaimWindowActive() {
1177
- return this.#read("isClaimWindowActive");
1178
- }
1179
- /** `true` if the current timestamp is past `START_TIME`. */
1180
- async hasClaimStarted() {
1181
- return this.#read("hasClaimStarted");
1182
- }
1183
- /** `true` if the current timestamp is past `endTime`. */
1184
- async hasClaimEnded() {
1185
- return this.#read("hasClaimEnded");
1186
- }
1187
- /** EIP-712 domain separator for the clone. Useful for off-chain signing tools. */
1188
- async domainSeparator() {
1189
- return this.#read("DOMAIN_SEPARATOR");
1190
- }
1191
- /**
1192
- * EIP-712 type hash for the `Claim(address recipient, bytes32 encryptedAmount)`
1193
- * struct. Off-chain signers that don't use {@link signClaimAuthorization}
1194
- * (e.g. custom HSM-backed signers, ledger flows) need this to assemble the
1195
- * typed-data payload manually.
1196
- */
1197
- async claimTypehash() {
1198
- return this.#read("CLAIM_TYPEHASH");
1199
- }
1200
- /**
1201
- * Check whether a claim has been consumed, given the user address and encrypted amount handle.
1202
- *
1203
- * This is the method most frontend developers want. Pass the same `user` and
1204
- * `encryptedAmountHandle` that appear in the admin-issued claim payload; the contract
1205
- * recomputes the struct hash internally and looks it up in storage.
1206
- *
1207
- * Prefer this over {@link claimedSignatures} unless you already hold the pre-computed
1208
- * `bytes32` struct hash (e.g. from a server-side indexer).
1209
- *
1210
- * @param user Recipient address from the claim authorization.
1211
- * @param encryptedAmountHandle The `externalEuint64` handle (as `Hex`) from the claim payload.
1212
- */
1213
- async isSignatureClaimed(user, encryptedAmountHandle) {
1214
- return this.#read("isSignatureClaimed", [user, encryptedAmountHandle]);
1215
- }
1216
- /**
1217
- * Check whether an admin-issued claim authorization is valid for a specific caller,
1218
- * without consuming it.
1219
- *
1220
- * Returns `false` (not a revert) when the signature is **structurally valid** but
1221
- * fails one of the on-chain checks: already-claimed, claim window inactive, or the
1222
- * signer lacks `DEFAULT_ADMIN_ROLE`. The on-chain implementation recomputes the
1223
- * EIP-712 struct hash over `(msg.sender, encryptedAmount)`, so the result is
1224
- * caller-specific: a signature issued for recipient A is invalid when checked
1225
- * against caller B. Pass the address that will actually submit the claim.
1226
- *
1227
- * **Throws** {@link InvalidSignatureError} (code `TOKENOPS_INVALID_SIGNATURE`)
1228
- * when the signature bytes are **structurally malformed** — wrong length, invalid
1229
- * `s`-value range, or unparseable. The on-chain `ECDSA.recover` reverts before
1230
- * the boolean logic runs in that case, so consumer code must catch this
1231
- * separately from the `false` return:
1232
- *
1233
- * ```ts
1234
- * try {
1235
- * const ok = await airdrop.isSignatureValid({ encryptedAmountHandle, signature, caller });
1236
- * if (!ok) { /* signed by non-admin, window closed, or already claimed *\/ }
1237
- * } catch (err) {
1238
- * if (err instanceof InvalidSignatureError) { /* malformed signature bytes *\/ }
1239
- * }
1240
- * ```
1241
- *
1242
- * Use this to show a pre-claim validation state in the UI before asking the user to
1243
- * pay gas.
1244
- */
1245
- async isSignatureValid(args) {
1246
- try {
1247
- return await this.publicClient.readContract({
1248
- address: this.address,
1249
- abi: confidentialAirdropCloneableAbi,
1250
- functionName: "isSignatureValid",
1251
- args: [args.encryptedAmountHandle, args.signature],
1252
- account: args.caller
1253
- });
1254
- } catch (err) {
1255
- throw mapContractRevert(err, {
1256
- method: "isSignatureValid",
1257
- contractAddress: this.address,
1258
- abi: confidentialAirdropCloneableAbi,
1259
- productMapper: airdropProductMapper,
1260
- account: args.caller
1261
- });
1262
- }
1263
- }
1264
- // ============================================================
1265
- // PREFLIGHT
1266
- // ============================================================
1267
- /**
1268
- * Read-only preflight for {@link claim}. Runs the deterministic-from-off-chain
1269
- * checks in parallel and reports any blockers as typed {@link TokenOpsSdkError}s.
1270
- * Returns `{ ready: true, blockers: [] }` when the claim is safe to submit.
1271
- *
1272
- * Preflight is **opt-in**. Consumers who have already validated state can
1273
- * skip this call and invoke `claim` directly — they'll receive the same
1274
- * typed errors at write time via the revert mapper.
1275
- *
1276
- * Checks performed (all read-only, no gas):
1277
- * - Claim window started (`block.timestamp ≥ START_TIME`).
1278
- * - Claim window not closed (`block.timestamp ≤ endTime`).
1279
- * - Claims not paused.
1280
- * - Signature not already redeemed by this caller.
1281
- * - ETH balance covers `GAS_FEE()` (the `msg.value` the claim must attach).
1282
- *
1283
- * The EIP-712 admin-signature check is **not** preflight-detectable — the
1284
- * SDK cannot verify the signer's role without the contract round-trip — and
1285
- * will still surface as {@link InvalidSignatureError} at write time.
1286
- *
1287
- * Pool balance is also **not** preflight-detectable: the clone's confidential
1288
- * balance is an encrypted `euint64` handle that the SDK cannot read in
1289
- * plaintext. An unfunded clone will pass preflight and revert on-chain with
1290
- * {@link FheHandleNotAllowedError} (the FHEVM ACL rejects `FHE.allowTransient`
1291
- * on an uninitialized handle). Confirm the pool has been funded before
1292
- * showing `ready: true`.
1293
- *
1294
- * @returns `{ ready, blockers }` — same `code` shape the write would throw.
1295
- */
1296
- async preflightClaim(args) {
1297
- const blockers = [];
1298
- const [startTime, endTime, isPaused, isClaimed, block, gasFee, callerBalance] = await Promise.all([
1299
- this.startTime(),
1300
- this.endTime(),
1301
- this.isPaused(),
1302
- this.isSignatureClaimed(args.caller, args.encryptedAmountHandle),
1303
- this.publicClient.getBlock(),
1304
- this.gasFee(),
1305
- this.publicClient.getBalance({ address: args.caller })
1306
- ]);
1307
- const now = Number(block.timestamp);
1308
- if (isPaused) {
1309
- blockers.push(new PausedError({ method: "claim", contractAddress: this.address }));
1310
- }
1311
- if (now < startTime) {
1312
- blockers.push(
1313
- new ClaimNotStartedError({
1314
- method: "claim",
1315
- contractAddress: this.address,
1316
- startsAt: startTime
1317
- })
1318
- );
1319
- }
1320
- if (now > endTime) {
1321
- blockers.push(
1322
- new ClaimWindowClosedError({
1323
- method: "claim",
1324
- contractAddress: this.address,
1325
- endedAt: endTime
1326
- })
1327
- );
1328
- }
1329
- if (isClaimed) {
1330
- blockers.push(
1331
- new AlreadyClaimedError({
1332
- method: "claim",
1333
- contractAddress: this.address,
1334
- caller: args.caller
1335
- })
1336
- );
1337
- }
1338
- if (callerBalance < gasFee) {
1339
- blockers.push(
1340
- new InsufficientFeeError({
1341
- method: "claim",
1342
- contractAddress: this.address,
1343
- feeKind: "gas",
1344
- required: gasFee,
1345
- provided: callerBalance
1346
- })
1347
- );
1348
- }
1349
- return { ready: blockers.length === 0, blockers };
1350
- }
1351
- // ============================================================
1352
- // CLAIM (USER OP)
1353
- // ============================================================
1354
- /**
1355
- * Claim tokens using an EIP-712 admin signature. Sends `GAS_FEE()` ETH with the tx.
1356
- *
1357
- * The `encryptedInput` must be the exact handle the admin signed in
1358
- * {@link signClaimAuthorization}. The signature commits to that handle, so the SDK
1359
- * does NOT re-encrypt — submit the admin-issued payload as-is.
1360
- *
1361
- * **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
1362
- *
1363
- * **An unfunded pool is the opposite case — it reverts loudly.** Do not
1364
- * generalize the silent-zero rule above to a clone whose pool was never
1365
- * funded: that claim throws {@link FheHandleNotAllowedError} (the FHEVM ACL
1366
- * rejects `FHE.allowTransient` on an uninitialized handle), and
1367
- * {@link preflightClaim} cannot detect it because the pool balance is an
1368
- * encrypted `euint64` the SDK cannot read in plaintext.
1369
- *
1370
- * @returns Transaction hash.
1371
- * @example
1372
- * const fee = await airdrop.gasFee();
1373
- * const hash = await airdrop.claim({ encryptedInput, signature });
1374
- */
1375
- async claim(args) {
1376
- const wallet = this.#requireWallet("claim");
1377
- const account = this.#resolveAccount(wallet, args.account, "claim");
1378
- const fee = args.value ?? await this.gasFee();
1379
- const writeArgs = [
1380
- args.encryptedInput.handle,
1381
- args.encryptedInput.inputProof,
1382
- args.signature
1383
- ];
1384
- await this.#preflightWrite("claim", "claim", writeArgs, account, fee);
1385
- try {
1386
- return await wallet.writeContract({
1387
- address: this.address,
1388
- abi: confidentialAirdropCloneableAbi,
1389
- functionName: "claim",
1390
- args: writeArgs,
1391
- account,
1392
- chain: wallet.chain,
1393
- value: fee
1394
- });
1395
- } catch (err) {
1396
- throw this.#mapRevert("claim", err, accountAddress(account));
1397
- }
1398
- }
1399
- /**
1400
- * **This is a write transaction, not a free view. It costs gas.**
1401
- *
1402
- * Verify the admin-signed claim allocation and grant the caller decrypt access
1403
- * to the encrypted amount. Budget gas and `await` the receipt before calling
1404
- * the Zama relayer's `userDecrypt` — the handle is only valid after the tx lands.
1405
- *
1406
- * Internally the contract calls `FHE.allow(handle, msg.sender)`, which persists
1407
- * the ACL grant on-chain. The handle is extracted from the receipt's ACL `Allowed`
1408
- * event — `simulateContract` would return a divergent handle and break decryption.
1409
- *
1410
- * Does **not** consume the claim (the `claimedSignatures` bit is not set). Call
1411
- * {@link claim} when the user is ready to transfer tokens.
1412
- *
1413
- * @returns `{ handle, hash }` — `handle` is a `euint64` granted to the caller;
1414
- * pass it to the Zama relayer's `userDecrypt` to obtain the plaintext amount.
1415
- */
1416
- async getClaimAmount(args) {
1417
- const wallet = this.#requireWallet("getClaimAmount");
1418
- const account = this.#resolveAccount(wallet, args.account, "getClaimAmount");
1419
- const writeArgs = [
1420
- args.encryptedInput.handle,
1421
- args.encryptedInput.inputProof,
1422
- args.signature
1423
- ];
1424
- await this.#preflightWrite("getClaimAmount", "getClaimAmount", writeArgs, account);
1425
- let hash;
1426
- try {
1427
- hash = await wallet.writeContract({
1428
- address: this.address,
1429
- abi: confidentialAirdropCloneableAbi,
1430
- functionName: "getClaimAmount",
1431
- args: writeArgs,
1432
- account,
1433
- chain: wallet.chain
1434
- });
1435
- } catch (err) {
1436
- throw this.#mapRevert("getClaimAmount", err, accountAddress(account));
1437
- }
1438
- const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
1439
- const callerAddress = accountAddress(account).toLowerCase();
1440
- const aclLogs = receipt.logs.filter(
1441
- (log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
1442
- );
1443
- const events = parseEventLogs({ abi: [ACL_ALLOWED_EVENT], logs: aclLogs });
1444
- const granted = events.filter(
1445
- (ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
1446
- );
1447
- if (granted.length === 0) {
1448
- throw new ReceiptEventNotFoundError({
1449
- method: "getClaimAmount",
1450
- eventName: "Allowed",
1451
- contractAddress: this.aclAddress,
1452
- txHash: hash,
1453
- hint: `Expected ACL grant from airdrop ${this.address} to caller ${callerAddress}; the contract did not grant decrypt access.`
1454
- });
1455
- }
1456
- if (granted.length > 1) {
1457
- throw new ReceiptEventAmbiguousError({
1458
- method: "getClaimAmount",
1459
- eventName: "Allowed",
1460
- contractAddress: this.aclAddress,
1461
- txHash: hash,
1462
- count: granted.length
1463
- });
1464
- }
1465
- const handle = granted[0].args.handle;
1466
- return { handle, hash };
1467
- }
1468
- // ============================================================
1469
- // ADMIN WRITES
1470
- // ============================================================
1471
- /**
1472
- * Withdraw all confidential tokens to `recipient`. `DEFAULT_ADMIN_ROLE` only.
1473
- *
1474
- * Calling on a clone whose pool was **never funded** throws
1475
- * {@link FheHandleNotAllowedError} (code `TOKENOPS_FHE_HANDLE_NOT_ALLOWED`).
1476
- * The contract calls `FHE.allowTransient` on the confidential balance handle;
1477
- * when the handle is uninitialized, the FHEVM ACL contract reverts with
1478
- * `SenderNotAllowed(address)`. Confirm the pool has been funded (e.g. via the
1479
- * factory's `createAndFund...` variant or a follow-up `confidentialTransfer`)
1480
- * before calling.
1481
- */
1482
- async withdraw(recipient, account) {
1483
- this.#requireChecksumAddress("withdraw", "recipient", recipient);
1484
- return this.#simpleWrite("withdraw", [recipient], account);
1485
- }
1486
- /** Pause or unpause claims. DEFAULT_ADMIN_ROLE only. */
1487
- async setPaused(paused, account) {
1488
- return withTelemetry(this.#telemetry, "fhe-airdrop.client.setPaused", async () => {
1489
- return this.#simpleWrite("setPaused", [paused], account);
1490
- });
1491
- }
1492
- /**
1493
- * Extend the claim window end time. DEFAULT_ADMIN_ROLE only.
1494
- * Requires `CAN_EXTEND_CLAIM_WINDOW == true` or the contract reverts.
1495
- */
1496
- async extendClaimWindow(newEndTime, account) {
1497
- return withTelemetry(this.#telemetry, "fhe-airdrop.client.extendClaimWindow", async () => {
1498
- return this.#simpleWrite("extendClaimWindow", [newEndTime], account);
1499
- });
1500
- }
1501
- /** Rescue accidentally sent ERC20 tokens. DEFAULT_ADMIN_ROLE only. */
1502
- async withdrawOtherToken(tokenAddress, recipient, account) {
1503
- this.#requireChecksumAddress("withdrawOtherToken", "tokenAddress", tokenAddress);
1504
- this.#requireChecksumAddress("withdrawOtherToken", "recipient", recipient);
1505
- return this.#simpleWrite("withdrawOtherToken", [tokenAddress, recipient], account);
1506
- }
1507
- /** Rescue accidentally sent ERC7984 confidential tokens. DEFAULT_ADMIN_ROLE only. */
1508
- async withdrawOtherConfidentialToken(tokenAddress, recipient, account) {
1509
- this.#requireChecksumAddress("withdrawOtherConfidentialToken", "tokenAddress", tokenAddress);
1510
- this.#requireChecksumAddress("withdrawOtherConfidentialToken", "recipient", recipient);
1511
- return this.#simpleWrite("withdrawOtherConfidentialToken", [tokenAddress, recipient], account);
1512
- }
1513
- // ============================================================
1514
- // FEE COLLECTOR WRITES
1515
- // ============================================================
1516
- /**
1517
- * Withdraw collected ETH gas fees. FEE_COLLECTOR_ROLE only.
1518
- * Pass `amount = 0n` to withdraw the entire balance.
1519
- */
1520
- async withdrawGasFee(recipient, amount, account) {
1521
- this.#requireChecksumAddress("withdrawGasFee", "recipient", recipient);
1522
- return this.#simpleWrite("withdrawGasFee", [recipient, amount], account);
1523
- }
1524
- // ============================================================
1525
- // ROLE MANAGEMENT
1526
- // ============================================================
1527
- async hasRole(role, account) {
1528
- return this.#read("hasRole", [role, account]);
1529
- }
1530
- async grantRole(role, accountTarget, account) {
1531
- return withTelemetry(this.#telemetry, "fhe-airdrop.client.grantRole", async () => {
1532
- return this.#simpleWrite("grantRole", [role, accountTarget], account);
1533
- });
1534
- }
1535
- async revokeRole(role, accountTarget, account) {
1536
- return withTelemetry(this.#telemetry, "fhe-airdrop.client.revokeRole", async () => {
1537
- return this.#simpleWrite("revokeRole", [role, accountTarget], account);
1538
- });
1539
- }
1540
- // ============================================================
1541
- // INTERNALS
1542
- // ============================================================
1543
- #requireChecksumAddress(method, argument, value) {
1544
- if (!isAddress(value, { strict: true })) {
1545
- throw new InvalidArgumentError({
1546
- method,
1547
- argument,
1548
- reason: "must be a valid EIP-55 checksummed address",
1549
- value
1550
- });
1551
- }
1552
- }
1553
- #requireWallet(method) {
1554
- if (!this.walletClient) {
1555
- throw new MissingWalletClientError(method);
1556
- }
1557
- return this.walletClient;
1558
- }
1559
- #resolveAccount(wallet, override, method) {
1560
- const acct = override ?? wallet.account;
1561
- if (!acct) {
1562
- throw new MissingAccountError(method);
1563
- }
1564
- if (typeof acct === "string") {
1565
- this.#requireChecksumAddress(method, "account", acct);
1566
- }
1567
- return acct;
1568
- }
1569
- #mapRevert(method, err, account) {
1570
- return mapContractRevert(err, {
1571
- method,
1572
- contractAddress: this.address,
1573
- abi: confidentialAirdropCloneableAbi,
1574
- productMapper: airdropProductMapper,
1575
- account
1576
- });
1577
- }
1578
- async #simpleWrite(functionName, args, account) {
1579
- const wallet = this.#requireWallet(functionName);
1580
- const acct = this.#resolveAccount(wallet, account, functionName);
1581
- await this.#preflightWrite(functionName, functionName, args, acct);
1582
- try {
1583
- return await wallet.writeContract({
1584
- address: this.address,
1585
- abi: confidentialAirdropCloneableAbi,
1586
- functionName,
1587
- args,
1588
- account: acct,
1589
- chain: wallet.chain
1590
- });
1591
- } catch (err) {
1592
- throw this.#mapRevert(functionName, err, accountAddress(acct));
1593
- }
1594
- }
1595
- /**
1596
- * Pre-flight a write via `simulateContract` purely to surface typed reverts.
1597
- *
1598
- * The simulate's *return value* is discarded — FHE writes still need
1599
- * `writeContract` + receipt parsing because simulated FHE op handles diverge
1600
- * from the executed-tx handles (CLAUDE.md Pitfall #1). The only purpose of
1601
- * this call is to let viem decode any revert against the ABI and produce a
1602
- * `ContractFunctionRevertedError` frame the revert-mapper can classify.
1603
- */
1604
- async #preflightWrite(method, functionName, args, account, value) {
1605
- try {
1606
- await this.publicClient.simulateContract({
1607
- address: this.address,
1608
- abi: confidentialAirdropCloneableAbi,
1609
- functionName,
1610
- args,
1611
- account,
1612
- ...value !== void 0 ? { value } : {}
1613
- });
1614
- } catch (err) {
1615
- if (isContractRevert(err)) {
1616
- throw this.#mapRevert(method, err, accountAddress(account));
1617
- }
1618
- }
1619
- }
1620
- async #read(functionName, args = []) {
1621
- const result = await this.publicClient.readContract({
1622
- address: this.address,
1623
- abi: confidentialAirdropCloneableAbi,
1624
- functionName,
1625
- args
1626
- });
1627
- return result;
1628
- }
1629
- };
1630
- function createConfidentialAirdropClient(config) {
1631
- return new ConfidentialAirdropClient(config);
1632
- }
1633
- function accountAddress(account) {
1634
- return typeof account === "string" ? account : account.address;
1635
- }
1636
-
1637
- export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, ConfidentialAirdropClient, confidentialAirdropCloneableAbi, createConfidentialAirdropClient };