Skip to main content

API Reference

Exports

ExportKindDescription
ConfidentialVestingFactoryClientclassTyped wrapper around the deployed factory
createConfidentialVestingFactoryClientfunctionConvenience constructor
ConfidentialVestingManagerClientConfiginterfaceConfig for the factory client
CreateManagerArgsinterfaceArgs for factory.createManager
CreateManagerResultinterface{ hash, manager } returned by factory.createManager (rich-return; receipt-parsed ManagerCreated event)
PredictManagerArgsinterfaceArgs for factory.predictManagerAddress (includes required blockNumber)
ConfidentialVestingManagerClientclassTyped wrapper around a per-user manager clone
createConfidentialVestingManagerClientfunctionConvenience constructor
ConfidentialVestingManagerClientConfiginterfaceConfig for the manager client (address, encryptor, etc.)
CreateVestingArgsinterfaceArgs for manager.createVesting
BatchCreateVestingArgsinterfaceArgs for manager.batchCreateVesting
ClaimArgsinterfaceArgs for manager.claim / adminClaim
PartialClaimArgsinterfaceArgs for manager.partialClaim
SplitVestingArgsinterfaceArgs for manager.splitVesting
InitiateTransferArgsinterfaceArgs for manager.initiateVestingTransfer
DiscloseArgsinterfaceArgs for disclosure methods
EncryptedViewResultinterface{ handle: Hex, hash: Hex } returned by encrypted view methods
encryptUint64functionEncrypt a single uint64 to an externalEuint64 + input proof
encryptUint64BatchfunctionEncrypt N uint64 values under a single input proof
resolveEncryptorfunctionNormalize an EncryptorSource to the live Encryptor
EncryptorinterfaceStructural interface for Zama RelayerWeb / RelayerNode / mock
EncryptorSourcetypeEncryptor | (() => Encryptor | undefined) — eager or lazy
EncryptUint64ArgsinterfaceArgs for encryptUint64
EncryptUint64BatchArgsinterfaceArgs for encryptUint64Batch
FheValueInputtypeDiscriminated union of FHE input types
VestingParamsinterfaceStruct passed to createVesting
VestingInfointerfaceRead-only snapshot from getVestingInfo
DisclosureTypeenumTotalAllocation | SettledAmount | VestedAmount | ClaimableAmount
FeeTypeenumGas | DistributionToken
CustomFeeinterfacePer-creator fee override from getCustomFee
PendingTransferinterfaceReturn type of getPendingVestingTransfer
EncryptedInputinterfaceSingle { handle: Hex, inputProof: Hex }
EncryptedInputsinterfaceBatch { handles: Hex[], inputProof: Hex }
scaleRatiofunctionRe-export from @tokenops/sdk/fhe — scale a ratio to meet MIN_SPLIT_DENOMINATOR
ScaleRatioArgsinterfaceArgs for scaleRatio
ScaledRatiointerfaceReturn type of scaleRatio
confidentialVestingFactoryAbiconstABI for the factory contract
confidentialVestingManagerAbiconstABI for the manager clone

API reference

ConfidentialVestingFactoryClient

Wraps the deployed ConfidentialVestingFactory. Read methods use publicClient; write methods require walletClient.

Constructor / factory function

new ConfidentialVestingFactoryClient(config: ConfidentialVestingFactoryClientConfig)
createConfidentialVestingFactoryClient(config: ConfidentialVestingFactoryClientConfig)

config.address overrides the on-chain factory address. Omit it on Sepolia — the client resolves the address from publicClient.chain.id automatically. On mainnet, pass address explicitly: the registry slot is null today (DEPLOYED_ADDRESSES.fheVesting.confidentialVestingFactory[mainnet.id] === null), so omitting address throws DeploymentAddressUnavailableError with reason: "registry-not-deployed".

Writes

MethodDescription
createManager(args)Deploy a new manager clone with default flags (splitEnabled = true, pausableEnabled = true) and return { hash, manager } — the clone address is parsed from the ManagerCreated event in the receipt. Use this in preference to predictManagerAddress for the common deploy-and-use flow.
setDefaultGasFee(fee)Set the global gas-fee default (factory admin only)
setDefaultTokenFee(feeBps)Set the global token-fee default in basis points (factory admin only)
setDefaultFeeType(feeType)Set FeeType.Gas or FeeType.DistributionToken as default (factory admin only)
resetGasFee()Reset gas fee to zero
resetTokenFee()Reset token fee to zero
setCustomFee(args)Set a per-creator fee override
disableCustomFee(creator)Remove a per-creator fee override
setFeeCollector(newCollector)Change the fee collector address

Reads

MethodReturnsDescription
predictManagerAddress(args)AddressCompute the deterministic clone address as the factory would have computed it at args.blockNumber. Block-dependent — the factory packs block.number into the clone's immutable args, so prediction only matches a deploy that mines at the same block. Useful for historical lookups; for the deploy-and-use flow, use createManager instead.
implementation()AddressCurrent implementation address (LibClone target)
defaultGasFee()bigintCurrent default gas fee in wei
defaultTokenFee()bigintCurrent default token fee in basis points
defaultFeeType()FeeTypeCurrent default fee model
feeCollector()AddressCurrent fee collector address
getCustomFee(creator)CustomFeePer-creator fee configuration
getInitCodeHash(args)HexInit-code hash used in CREATE3 address prediction

ConfidentialVestingManagerClient

Wraps a per-user ConfidentialVestingManager clone. Requires address (the clone address) in config. Encryption methods require encryptor.

Constructor / factory function

new ConfidentialVestingManagerClient(config: ConfidentialVestingManagerClientConfig)
createConfidentialVestingManagerClient(config: ConfidentialVestingManagerClientConfig)

config.aclAddress defaults to the chain's known FHEVM ACL address. Override only on custom networks.

Encrypted view methods

These perform FHE.allow(handle, msg.sender) on-chain, so they submit a transaction and extract the granted handle from the receipt's ACL Allowed events. They cannot use simulateContract — simulation would return a divergent handle. Each returns EncryptedViewResult:

interface EncryptedViewResult {
handle: Hex; // euint128 handle — pass to the Zama relayer's userDecrypt
hash: Hex; // tx hash that committed ACL
}

For details on FHE ACL and userDecrypt, see docs.zama.ai/fhevm.

MethodACL recipient
getVestedAmount({ vestingId, timestamp })caller
getClaimableAmount({ vestingId })caller
getTotalAllocation({ vestingId })caller
getSettledAmount({ vestingId })caller
adminGetVestedAmount({ vestingId, timestamp })caller (admin role required)
adminGetClaimableAmount({ vestingId })caller (admin role required)
adminGetTotalAllocation({ vestingId })caller (admin role required)
adminGetSettledAmount({ vestingId })caller (admin role required)
adminGetTokenBalance()caller (admin role required)

Vesting writes

MethodDescription
createVesting(args)Create one schedule; amount is plaintext — SDK encrypts
batchCreateVesting(args)Batch-create; all amounts share one input proof
claim(args)Recipient claims all vested tokens
adminClaim(args)Admin claims on behalf of recipient
partialClaim(args)Recipient claims a specific encrypted amount
adminPartialClaim(args)Admin partial-claim on behalf of recipient
revokeVesting(vestingId)Admin revokes a revocable schedule
batchRevokeVesting(vestingIds)Batch-revoke; respects maxRevokeBatchSize
splitVesting(args)Split into two positions; ratio is auto-scaled

Transfer flow

MethodDescription
initiateVestingTransfer(args)Start a time-gated recipient transfer
acceptVestingTransfer(vestingId)New recipient accepts the pending transfer
cancelVestingTransfer(vestingId)Initiator cancels the pending transfer
directVestingTransfer(vestingId, newOwner)Admin-only instant transfer

Disclosure

Grants a third party (e.g. auditor, regulator) decrypt access to specific vesting figures:

MethodDescription
discloseToParty(args)Disclose one vesting to one party
batchDiscloseToParty(args)Batch disclose; parallel arrays of vestingIds + disclosureTypes
adminDiscloseToParty(args)Admin-only: disclose any vesting
adminBatchDiscloseToParty(args)Admin-only batch disclosure
discloseHandleToParty(handle, party)Grant ACL directly on an arbitrary handle
batchDiscloseHandlesToParty(handles, party)Batch grant ACL on arbitrary handles

Admin writes

MethodDescription
withdrawAdmin(args)Withdraw principal tokens; amount is encrypted
withdrawGasFee(to, amount)Withdraw accumulated gas fees (plaintext)
withdrawTokenFee(args)Withdraw accumulated token fees (encrypted amount)
withdrawOtherToken(token, to)Recover non-vesting ERC-20 tokens
withdrawOtherConfidentialToken(token, to)Recover non-vesting ERC-7984 tokens
setMaxBatchSize(newMax)Update max batch size for create operations
setMaxRevokeBatchSize(newMax)Update max batch size for revoke operations
transferFeeCollectorRole(newCollector)Change the per-manager fee collector
pause() / unpause()Pause / unpause (requires isPausable flag set at deploy time)

Role management

Roles are identified by Hex constants (DEFAULT_ADMIN_ROLE, VESTING_CREATOR_ROLE, etc.). Use roleConstants() to fetch all hashes in one call.

MethodDescription
hasRole(role, account)Check role membership
grantRole(role, accountTarget)Grant role (admin only)
revokeRole(role, accountTarget)Revoke role (admin only)
renounceRole(role, callerConfirm)Caller renounces their own role
roleConstants()Fetch all role hashes in one multicall

Reads

MethodReturnsDescription
token()AddressERC-7984 token this manager was deployed for
feeType()FeeTypeImmutable fee model
fee()bigintImmutable fee amount
getFeeInfo(){ feeType, fee }Both immutables in one call
isSplitEnabled()booleanWhether splitVesting is available
isPausable()booleanWhether pause / unpause are available
paused()booleanCurrent pause state
maxBatchSize()bigintMax items per batchCreateVesting
maxRevokeBatchSize()bigintMax items per batchRevokeVesting
deploymentBlockNumber()bigintBlock at which the clone was deployed
getVestingInfo(vestingId)VestingInfoFull plaintext schedule metadata
getAllRecipients()Address[]All recipients with active schedules
getAllRecipientVestings(recipient)Hex[]All vesting IDs for a recipient
getPendingVestingTransfer(vestingId)PendingTransferActive transfer request, if any
isRecipient(account)booleanWhether account has any schedule

scaleRatio

Re-exported from @tokenops/sdk/fhe. Used internally by splitVesting; exported so UIs can preview the scaled values before submitting.

import { scaleRatio } from "@tokenops/sdk/fhe-vesting";

// Raw 2/3 split — scaled to the privacy-preserving split constant
// (FHE_SPLIT_DENOMINATOR = 90_090_000n).
const { numerator, denominator } = scaleRatio({ numerator: 2n, denominator: 3n });
// → { numerator: 60_060_000n, denominator: 90_090_000n }

Pass preScaled: true to splitVesting to skip the auto-scaler when you have already called scaleRatio yourself.