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