@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,332 @@
|
|
|
1
|
+
import type { Account, Address, Hex } from "viem";
|
|
2
|
+
import type { EncryptedHandle, TxHash } from "../core/brands.js";
|
|
3
|
+
import { TokenOpsSdkError } from "../core/errors.js";
|
|
4
|
+
import type { EncryptedInput, EncryptedInputs, EncryptedViewResult } from "../fhe/types.js";
|
|
5
|
+
import type { Encryptor } from "./encryption.js";
|
|
6
|
+
export type { EncryptedInput, EncryptedInputs, EncryptedViewResult };
|
|
7
|
+
/**
|
|
8
|
+
* Disperse mode. Maps to the three `DisperseConfidential` entry points:
|
|
9
|
+
* - `"wallet"` — per-user wallet pair, gas fee in ETH per recipient.
|
|
10
|
+
* - `"wallet-token-fee"` — per-user wallet pair, token BPS fee on subtotals.
|
|
11
|
+
* - `"direct"` — direct `confidentialTransferFrom`, gas fee in ETH per recipient.
|
|
12
|
+
*/
|
|
13
|
+
export type DisperseMode = "wallet" | "wallet-token-fee" | "direct";
|
|
14
|
+
/**
|
|
15
|
+
* Resolved fee configuration for a given user.
|
|
16
|
+
* Combines `getFeeAmounts(user)` and `feeConfig()` global toggles.
|
|
17
|
+
*/
|
|
18
|
+
export interface UserFees {
|
|
19
|
+
/** `true` when the user has a per-user custom fee override. */
|
|
20
|
+
isCustom: boolean;
|
|
21
|
+
/** Resolved gas fee per recipient in wei (0 if gas fee is disabled). */
|
|
22
|
+
gasFeeWei: bigint;
|
|
23
|
+
/** Resolved token fee in basis points (0 if token fee is disabled). */
|
|
24
|
+
tokenFeeBps: number;
|
|
25
|
+
/** Whether gas fees are globally enabled. */
|
|
26
|
+
gasFeeEnabled: boolean;
|
|
27
|
+
/** Whether token fees are globally enabled. */
|
|
28
|
+
tokenFeeEnabled: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Global fee configuration (on-chain `feeConfig` struct).
|
|
32
|
+
*
|
|
33
|
+
* Field names match the contract ABI exactly so the type round-trips through
|
|
34
|
+
* `getFeeConfig()` (read) and `setFeeConfig(config)` (write).
|
|
35
|
+
*/
|
|
36
|
+
export interface FeeConfig {
|
|
37
|
+
gasFeeEnabled: boolean;
|
|
38
|
+
tokenFeeEnabled: boolean;
|
|
39
|
+
/** Default gas fee per recipient, in wei. */
|
|
40
|
+
defaultGasFee: bigint;
|
|
41
|
+
/** Default token fee in basis points. */
|
|
42
|
+
defaultTokenFee: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Batch size limits. `0n` means no limit.
|
|
46
|
+
*/
|
|
47
|
+
export interface BatchLimits {
|
|
48
|
+
/** Max recipients for wallet-mode disperses. `0n` = no limit. */
|
|
49
|
+
holding: bigint;
|
|
50
|
+
/** Max recipients for direct-mode disperses. `0n` = no limit. */
|
|
51
|
+
direct: bigint;
|
|
52
|
+
/** Max recipients for token-fee wallet-mode disperses. `0n` = no limit. */
|
|
53
|
+
tokenFee: bigint;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Calculated fee for a specific disperse call.
|
|
57
|
+
* - For `"wallet"` and `"direct"` modes: `ethValue` covers the gas fee; `tokenFeeAmount` is `undefined`.
|
|
58
|
+
* - For `"wallet-token-fee"`: `ethValue` is `0n`; `tokenFeeAmount` is the BPS fee on the subtotals.
|
|
59
|
+
*/
|
|
60
|
+
export interface CalculatedFee {
|
|
61
|
+
ethValue: bigint;
|
|
62
|
+
tokenFeeAmount?: bigint | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Raw per-user fee override as stored on-chain. Distinct from {@link UserFees}
|
|
66
|
+
* (which combines this with global toggles into the *resolved* fee).
|
|
67
|
+
*
|
|
68
|
+
* Use to surface "this user has an override of 0 BPS that's currently being
|
|
69
|
+
* masked by `tokenFeeEnabled = false`" in admin UIs.
|
|
70
|
+
*/
|
|
71
|
+
export interface CustomFee {
|
|
72
|
+
/** `true` when the user has an override set. `false` means no override. */
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
/** Override gas fee per recipient, in wei. Only meaningful when `enabled`. */
|
|
75
|
+
gasFeeWei: bigint;
|
|
76
|
+
/** Override token fee in basis points. Only meaningful when `enabled`. */
|
|
77
|
+
tokenFeeBps: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Per-recipient validation result inside a {@link PreflightReport}.
|
|
81
|
+
*/
|
|
82
|
+
export interface RecipientCheck {
|
|
83
|
+
address: Address;
|
|
84
|
+
/** `true` when no structural problem was detected for this recipient. */
|
|
85
|
+
ok: boolean;
|
|
86
|
+
/** Human-readable description if `ok === false`. */
|
|
87
|
+
reason?: string | undefined;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Comprehensive pre-flight report returned by
|
|
91
|
+
* `ConfidentialDisperseClient.preflightDisperse`.
|
|
92
|
+
*
|
|
93
|
+
* One call gives a UI everything it needs to render a "ready to disperse"
|
|
94
|
+
* checklist. Compose it; do not implement each check inline.
|
|
95
|
+
*/
|
|
96
|
+
export interface PreflightReport {
|
|
97
|
+
/** Whether the user has already registered via `register(token)`. */
|
|
98
|
+
isUserRegistered: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* On-chain wallet pair for the user. `null` if not registered.
|
|
101
|
+
* For wallet modes, these wallets must exist before dispersing.
|
|
102
|
+
*/
|
|
103
|
+
wallets: [Address, Address] | null;
|
|
104
|
+
/**
|
|
105
|
+
* Deterministically predicted wallet addresses — present regardless of
|
|
106
|
+
* registration state.
|
|
107
|
+
*/
|
|
108
|
+
predictedWallets: [Address, Address];
|
|
109
|
+
/** Per-wallet approval state for the given token. Only relevant for wallet modes. */
|
|
110
|
+
hasApprovedSubwallets: {
|
|
111
|
+
wallet0: boolean;
|
|
112
|
+
wallet1: boolean;
|
|
113
|
+
both: boolean;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* For `"direct"` mode: whether the sender itself has approved the singleton as operator.
|
|
117
|
+
* `null` for wallet modes (approval is on the subwallets, not the sender).
|
|
118
|
+
*/
|
|
119
|
+
hasApprovedSingleton: boolean | null;
|
|
120
|
+
/** ETH to attach as `msg.value`. */
|
|
121
|
+
feeEth: bigint;
|
|
122
|
+
/** Token BPS fee amount. Defined only for `"wallet-token-fee"` mode. */
|
|
123
|
+
feeTokenAmount?: bigint | undefined;
|
|
124
|
+
/** Current batch limit for the selected mode. `0n` = no limit. */
|
|
125
|
+
batchLimit: bigint;
|
|
126
|
+
/** `true` when `recipients.length <= batchLimit` (or limit is 0). */
|
|
127
|
+
batchOk: boolean;
|
|
128
|
+
/** Per-recipient structural checks (zero-address, etc.). */
|
|
129
|
+
recipientChecks: RecipientCheck[];
|
|
130
|
+
/** `true` when `amounts.length === recipients.length` and lengths are non-zero. */
|
|
131
|
+
amountsOk: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Pre-computed group subtotals for wallet modes. Matches the split the SDK
|
|
134
|
+
* will use inside `disperse()`. `undefined` for `"direct"` mode.
|
|
135
|
+
*/
|
|
136
|
+
subtotals?: {
|
|
137
|
+
group0: bigint;
|
|
138
|
+
group1: bigint;
|
|
139
|
+
};
|
|
140
|
+
/** `true` when no blockers are present — green light to call `disperse`. */
|
|
141
|
+
ready: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Human-readable reasons that prevent dispersing. Empty when `ready === true`.
|
|
144
|
+
*
|
|
145
|
+
* @deprecated Use {@link blockerErrors} instead — typed `TokenOpsSdkError`s
|
|
146
|
+
* give you `error.code` to branch on. This field stays for backward
|
|
147
|
+
* compatibility; it will be removed in the next major.
|
|
148
|
+
*/
|
|
149
|
+
blockers: string[];
|
|
150
|
+
/**
|
|
151
|
+
* Typed errors that would otherwise be thrown at write time. Same shape as
|
|
152
|
+
* the generic {@link PreflightResult.blockers} contract used by
|
|
153
|
+
* `preflightClaim` on the vesting and airdrop clients. Empty when
|
|
154
|
+
* `ready === true`. Branch on `error.code` to render UI.
|
|
155
|
+
*/
|
|
156
|
+
blockerErrors: TokenOpsSdkError[];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Approval state of a user's subwallet pair for a specific token.
|
|
160
|
+
*/
|
|
161
|
+
export interface SubwalletApprovalState {
|
|
162
|
+
wallet0: boolean;
|
|
163
|
+
wallet1: boolean;
|
|
164
|
+
both: boolean;
|
|
165
|
+
}
|
|
166
|
+
/** Result of `register()`. */
|
|
167
|
+
export interface RegisterResult {
|
|
168
|
+
/** Transaction hash. */
|
|
169
|
+
hash: TxHash;
|
|
170
|
+
/** The two subwallet addresses parsed from the `UserRegistered` event. */
|
|
171
|
+
wallets: [Address, Address];
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Per-wallet (wallet modes) or single (direct mode) distribution row, parsed
|
|
175
|
+
* from a `WalletDistribution` / `DirectDistribution` event in the disperse
|
|
176
|
+
* receipt.
|
|
177
|
+
*/
|
|
178
|
+
export interface DisperseDistribution {
|
|
179
|
+
/**
|
|
180
|
+
* Sub-wallet that funded this distribution, for wallet-mode disperses.
|
|
181
|
+
* `undefined` for direct mode (sender transfers directly).
|
|
182
|
+
*/
|
|
183
|
+
wallet?: Address;
|
|
184
|
+
/** Recipients in this distribution row, in contract emission order. */
|
|
185
|
+
recipients: Address[];
|
|
186
|
+
/**
|
|
187
|
+
* Encrypted `euint64` handles for the per-recipient **requested** amount —
|
|
188
|
+
* the value the caller passed into `disperse`.
|
|
189
|
+
*/
|
|
190
|
+
requested: Hex[];
|
|
191
|
+
/**
|
|
192
|
+
* Encrypted `euint64` handles for the per-recipient **transferred** amount —
|
|
193
|
+
* what the ERC-7984 `confidentialTransfer`/`confidentialTransferFrom`
|
|
194
|
+
* actually moved. Can be less than `requested` when the sender's confidential
|
|
195
|
+
* balance was insufficient, or zero on a subtotal overflow.
|
|
196
|
+
*/
|
|
197
|
+
transferred: Hex[];
|
|
198
|
+
}
|
|
199
|
+
/** Result of `disperse()`. */
|
|
200
|
+
export interface DisperseResult {
|
|
201
|
+
/** Transaction hash. */
|
|
202
|
+
hash: Hex;
|
|
203
|
+
/**
|
|
204
|
+
* Distributions parsed from the receipt. One entry per `WalletDistribution`
|
|
205
|
+
* (wallet modes — up to two entries) or a single entry per
|
|
206
|
+
* `DirectDistribution` (direct mode). Empty array if no distribution event
|
|
207
|
+
* was emitted (which would indicate a contract or parse anomaly).
|
|
208
|
+
*/
|
|
209
|
+
distributions: DisperseDistribution[];
|
|
210
|
+
}
|
|
211
|
+
/** Result of `withdrawTokenFee()`. */
|
|
212
|
+
export interface WithdrawTokenFeeResult {
|
|
213
|
+
/** Transaction hash. */
|
|
214
|
+
hash: Hex;
|
|
215
|
+
/**
|
|
216
|
+
* Encrypted `euint64` handle for the **actual** transferred amount, parsed
|
|
217
|
+
* from the `TokenFeeWithdrawn` event. May be less than the requested
|
|
218
|
+
* withdrawal when the reserve was lower (the contract caps via `FHE.min`).
|
|
219
|
+
* Pass to Zama's `userDecrypt` to view the plaintext.
|
|
220
|
+
*
|
|
221
|
+
* `undefined` if no `TokenFeeWithdrawn` event was found in the receipt.
|
|
222
|
+
*/
|
|
223
|
+
transferredHandle?: Hex;
|
|
224
|
+
}
|
|
225
|
+
/** Result of `discloseHandleToParty()` / `batchDiscloseHandlesToParty()`. */
|
|
226
|
+
export interface DisclosureResult {
|
|
227
|
+
/** Transaction hash. */
|
|
228
|
+
hash: Hex;
|
|
229
|
+
/** Caller that initiated the disclosure (from the `HandlesDisclosedToParty` event). */
|
|
230
|
+
discloser: Address;
|
|
231
|
+
/** Address that received persistent ACL on the disclosed handles. */
|
|
232
|
+
party: Address;
|
|
233
|
+
/** Handles whose ACL was granted to `party`. */
|
|
234
|
+
disclosedHandles: Hex[];
|
|
235
|
+
}
|
|
236
|
+
/** Arguments for `disperse()`. */
|
|
237
|
+
export interface DisperseArgs {
|
|
238
|
+
/** ERC-7984 token address. */
|
|
239
|
+
token: Address;
|
|
240
|
+
/** Disperse mode. */
|
|
241
|
+
mode: DisperseMode;
|
|
242
|
+
/** Array of recipient addresses. Must be non-empty, no zero addresses. */
|
|
243
|
+
recipients: Address[];
|
|
244
|
+
/** Plaintext per-recipient amounts in raw token units. SDK encrypts these. */
|
|
245
|
+
amounts: bigint[];
|
|
246
|
+
/** Override the ETH value — skips live fee read for gas/direct modes. */
|
|
247
|
+
gasFeeOverride?: bigint | undefined;
|
|
248
|
+
/** Override signer account. Falls back to `walletClient.account`. */
|
|
249
|
+
account?: Account | Address | undefined;
|
|
250
|
+
}
|
|
251
|
+
/** Arguments for `getEncryptedFeeReserve()`. */
|
|
252
|
+
export interface GetEncryptedFeeReserveArgs {
|
|
253
|
+
/** ERC-7984 token to query the fee reserve for. */
|
|
254
|
+
token: Address;
|
|
255
|
+
/** Override signer account. Falls back to `walletClient.account`. */
|
|
256
|
+
account?: Account | Address | undefined;
|
|
257
|
+
}
|
|
258
|
+
/** Arguments for `discloseHandleToParty()`. */
|
|
259
|
+
export interface DiscloseHandleArgs {
|
|
260
|
+
/** The `euint64` handle to re-share. */
|
|
261
|
+
handle: EncryptedHandle;
|
|
262
|
+
/** The address receiving persistent decrypt access. */
|
|
263
|
+
party: Address;
|
|
264
|
+
account?: Account | Address | undefined;
|
|
265
|
+
}
|
|
266
|
+
/** Arguments for `batchDiscloseHandlesToParty()`. */
|
|
267
|
+
export interface BatchDiscloseHandlesArgs {
|
|
268
|
+
/** The `euint64` handles to re-share. */
|
|
269
|
+
handles: EncryptedHandle[];
|
|
270
|
+
/** The address receiving persistent decrypt access. */
|
|
271
|
+
party: Address;
|
|
272
|
+
account?: Account | Address | undefined;
|
|
273
|
+
}
|
|
274
|
+
/** Common fields for {@link WithdrawTokenFeeArgs} — discriminated below. */
|
|
275
|
+
interface WithdrawTokenFeeArgsCommon {
|
|
276
|
+
token: Address;
|
|
277
|
+
to: Address;
|
|
278
|
+
account?: Account | Address | undefined;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Discriminated union: provide EITHER an encryptor (the SDK encrypts `amount`)
|
|
282
|
+
* OR a pre-built `encryptedInput`. Passing both is a compile error.
|
|
283
|
+
*/
|
|
284
|
+
export type WithdrawTokenFeeArgs = (WithdrawTokenFeeArgsCommon & {
|
|
285
|
+
amount: bigint;
|
|
286
|
+
encryptor?: Encryptor | undefined;
|
|
287
|
+
encryptedInput?: never;
|
|
288
|
+
}) | (WithdrawTokenFeeArgsCommon & {
|
|
289
|
+
encryptedInput: EncryptedInput;
|
|
290
|
+
amount?: never;
|
|
291
|
+
encryptor?: never;
|
|
292
|
+
});
|
|
293
|
+
/** Arguments for `preflightDisperse()`. */
|
|
294
|
+
export interface PreflightDisperseArgs {
|
|
295
|
+
user: Address;
|
|
296
|
+
token: Address;
|
|
297
|
+
recipients: Address[];
|
|
298
|
+
amounts: bigint[];
|
|
299
|
+
mode: DisperseMode;
|
|
300
|
+
}
|
|
301
|
+
/** Arguments for `calculateFee()`. */
|
|
302
|
+
export interface CalculateFeeArgs {
|
|
303
|
+
user: Address;
|
|
304
|
+
mode: DisperseMode;
|
|
305
|
+
recipients: number;
|
|
306
|
+
/** Required for `"wallet-token-fee"` to compute the token fee. */
|
|
307
|
+
totalTokens?: bigint | undefined;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Thrown by `register()` when no `UserRegistered` event matching the
|
|
311
|
+
* singleton address is found in the transaction receipt.
|
|
312
|
+
*/
|
|
313
|
+
export declare class DisperseSubwalletNotFoundError extends TokenOpsSdkError {
|
|
314
|
+
name: string;
|
|
315
|
+
readonly context: {
|
|
316
|
+
txHash: Hex;
|
|
317
|
+
singletonAddress: Address;
|
|
318
|
+
};
|
|
319
|
+
constructor(txHash: Hex, singletonAddress: Address);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Thrown by `getEncryptedFeeReserve()` when no ACL `Allowed` event granting
|
|
323
|
+
* the caller access to the fee reserve handle is found in the receipt.
|
|
324
|
+
*/
|
|
325
|
+
export declare class DisperseEncryptedReserveNotGrantedError extends TokenOpsSdkError {
|
|
326
|
+
name: string;
|
|
327
|
+
readonly context: {
|
|
328
|
+
txHash: Hex;
|
|
329
|
+
callerAddress: Address;
|
|
330
|
+
};
|
|
331
|
+
constructor(txHash: Hex, callerAddress: Address);
|
|
332
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared deterministic validation for `disperse` / `preflightDisperse`.
|
|
3
|
+
*
|
|
4
|
+
* The same input rules (length match, non-zero recipients, uint64 bounds per
|
|
5
|
+
* amount, wallet-mode subtotal overflow, batch-limit) must apply in two
|
|
6
|
+
* places:
|
|
7
|
+
* - `preflightDisperse()` — reports them as blockers in the UI report.
|
|
8
|
+
* - `disperse()` — throws them before encryption, so an oversized or
|
|
9
|
+
* malformed batch does not spend client-side FHE encryption time and then
|
|
10
|
+
* revert on-chain.
|
|
11
|
+
*
|
|
12
|
+
* This module is the single source of truth. It is **synchronous + pure** —
|
|
13
|
+
* no chain calls, no contract reads. Callers fetch `batchLimits` once and
|
|
14
|
+
* pass the relevant limit in.
|
|
15
|
+
*/
|
|
16
|
+
import type { Address } from "viem";
|
|
17
|
+
import type { TokenOpsSdkError } from "../core/errors.js";
|
|
18
|
+
import type { DisperseMode } from "./types.js";
|
|
19
|
+
export interface ValidateDisperseInputsArgs {
|
|
20
|
+
recipients: ReadonlyArray<Address>;
|
|
21
|
+
amounts: ReadonlyArray<bigint>;
|
|
22
|
+
mode: DisperseMode;
|
|
23
|
+
/**
|
|
24
|
+
* The relevant batch limit for `mode`, fetched via `getBatchLimits()`. A
|
|
25
|
+
* value of `0n` means "unlimited" (matches the contract's encoding).
|
|
26
|
+
*/
|
|
27
|
+
batchLimit: bigint;
|
|
28
|
+
/**
|
|
29
|
+
* Method name used in produced error contexts — `"disperse"` for the write
|
|
30
|
+
* path, `"preflightDisperse"` for the report path. The downstream `code`
|
|
31
|
+
* is the same; this just sharpens the message.
|
|
32
|
+
*/
|
|
33
|
+
method: "disperse" | "preflightDisperse";
|
|
34
|
+
/** Contract address for `BatchTooLargeError.contractAddress`. */
|
|
35
|
+
contractAddress: Address;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Deterministic input checks that must hold for any `disperse` call. Returns
|
|
39
|
+
* the typed errors that would block submission. Empty array == valid.
|
|
40
|
+
*
|
|
41
|
+
* Checks performed:
|
|
42
|
+
* 1. `recipients` non-empty.
|
|
43
|
+
* 2. `amounts.length === recipients.length`.
|
|
44
|
+
* 3. No zero address in `recipients`.
|
|
45
|
+
* 4. Each amount fits in `uint64` (0..2^64-1).
|
|
46
|
+
* 5. Wallet-mode group subtotals fit in `uint64` (the contract splits amounts
|
|
47
|
+
* across two FHE-encrypted subwallets — each subtotal is an `euint64`).
|
|
48
|
+
* 6. Batch size ≤ `batchLimit` (when `batchLimit > 0`).
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateDisperseInputs(args: ValidateDisperseInputsArgs): TokenOpsSdkError[];
|
|
51
|
+
/**
|
|
52
|
+
* Reject any `Address` argument that is not a strict EIP-55 checksum.
|
|
53
|
+
*
|
|
54
|
+
* viem's `isAddress(addr, { strict: true })` accepts all-lowercase (treats it
|
|
55
|
+
* as "no checksum claim"). The actual failure mode this guards against is
|
|
56
|
+
* **mixed-case** addresses whose case does not match the EIP-55 checksum —
|
|
57
|
+
* those typically come from copy-paste typos and should be surfaced as a
|
|
58
|
+
* typed `InvalidArgumentError` instead of leaking through as a raw viem
|
|
59
|
+
* `InvalidAddressError` from inside `writeContract`.
|
|
60
|
+
*
|
|
61
|
+
* No-op for `undefined` so optional address args can be passed through.
|
|
62
|
+
*/
|
|
63
|
+
export declare function assertChecksumAddress(value: Address | undefined, argument: string, method: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Stricter variant of {@link assertChecksumAddress} that also rejects the
|
|
66
|
+
* zero address. Use for write-method recipient/`to` args where the contract
|
|
67
|
+
* already reverts on zero with `Errors.InvalidAddress` — failing client-side
|
|
68
|
+
* saves the gas round-trip and surfaces the same typed error.
|
|
69
|
+
*/
|
|
70
|
+
export declare function assertNonZeroChecksumAddress(value: Address | undefined, argument: string, method: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Select the relevant batch limit for `mode` from a `BatchLimits` reading.
|
|
73
|
+
*/
|
|
74
|
+
export declare function batchLimitForMode(mode: DisperseMode, limits: {
|
|
75
|
+
direct: bigint;
|
|
76
|
+
holding: bigint;
|
|
77
|
+
tokenFee: bigint;
|
|
78
|
+
}): bigint;
|