API Reference
Exports
| Export | Kind | Description |
|---|---|---|
ConfidentialVestingFactoryClient | class | Typed wrapper around the deployed factory |
createConfidentialVestingFactoryClient | function | Convenience constructor |
ConfidentialVestingManagerClientConfig | interface | Config for the factory client |
CreateManagerArgs | interface | Args for factory.createManager |
CreateManagerResult | interface | { hash, manager } returned by factory.createManager (rich-return; receipt-parsed ManagerCreated event) |
PredictManagerArgs | interface | Args for factory.predictManagerAddress (includes required blockNumber) |
ConfidentialVestingManagerClient | class | Typed wrapper around a per-user manager clone |
createConfidentialVestingManagerClient | function | Convenience constructor |
ConfidentialVestingManagerClientConfig | interface | Config for the manager client (address, encryptor, etc.) |
CreateVestingArgs | interface | Args for manager.createVesting |
BatchCreateVestingArgs | interface | Args for manager.batchCreateVesting |
ClaimArgs | interface | Args for manager.claim / adminClaim |
PartialClaimArgs | interface | Args for manager.partialClaim |
SplitVestingArgs | interface | Args for manager.splitVesting |
InitiateTransferArgs | interface | Args for manager.initiateVestingTransfer |
DiscloseArgs | interface | Args for disclosure methods |
EncryptedViewResult | interface | { handle: Hex, hash: Hex } returned by encrypted view methods |
encryptUint64 | function | Encrypt a single uint64 to an externalEuint64 + input proof |
encryptUint64Batch | function | Encrypt N uint64 values under a single input proof |
resolveEncryptor | function | Normalize an EncryptorSource to the live Encryptor |
Encryptor | interface | Structural interface for Zama RelayerWeb / RelayerNode / mock |
EncryptorSource | type | Encryptor | (() => Encryptor | undefined) — eager or lazy |
EncryptUint64Args | interface | Args for encryptUint64 |
EncryptUint64BatchArgs | interface | Args for encryptUint64Batch |
FheValueInput | type | Discriminated union of FHE input types |
VestingParams | interface | Struct passed to createVesting |
VestingInfo | interface | Read-only snapshot from getVestingInfo |
DisclosureType | enum | TotalAllocation | SettledAmount | VestedAmount | ClaimableAmount |
FeeType | enum | Gas | DistributionToken |
CustomFee | interface | Per-creator fee override from getCustomFee |
PendingTransfer | interface | Return type of getPendingVestingTransfer |
EncryptedInput | interface | Single { handle: Hex, inputProof: Hex } |
EncryptedInputs | interface | Batch { handles: Hex[], inputProof: Hex } |
scaleRatio | function | Re-export from @tokenops/sdk/fhe — scale a ratio to meet MIN_SPLIT_DENOMINATOR |
ScaleRatioArgs | interface | Args for scaleRatio |
ScaledRatio | interface | Return type of scaleRatio |
confidentialVestingFactoryAbi | const | ABI for the factory contract |
confidentialVestingManagerAbi | const | ABI 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
| Method | Description |
|---|---|
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
| Method | Returns | Description |
|---|---|---|
predictManagerAddress(args) | Address | Compute 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() | Address | Current implementation address (LibClone target) |
defaultGasFee() | bigint | Current default gas fee in wei |
defaultTokenFee() | bigint | Current default token fee in basis points |
defaultFeeType() | FeeType | Current default fee model |
feeCollector() | Address | Current fee collector address |
getCustomFee(creator) | CustomFee | Per-creator fee configuration |
getInitCodeHash(args) | Hex | Init-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.
| Method | ACL 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
| Method | Description |
|---|---|
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
| Method | Description |
|---|---|
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:
| Method | Description |
|---|---|
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
| Method | Description |
|---|---|
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.
| Method | Description |
|---|---|
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
| Method | Returns | Description |
|---|---|---|
token() | Address | ERC-7984 token this manager was deployed for |
feeType() | FeeType | Immutable fee model |
fee() | bigint | Immutable fee amount |
getFeeInfo() | { feeType, fee } | Both immutables in one call |
isSplitEnabled() | boolean | Whether splitVesting is available |
isPausable() | boolean | Whether pause / unpause are available |
paused() | boolean | Current pause state |
maxBatchSize() | bigint | Max items per batchCreateVesting |
maxRevokeBatchSize() | bigint | Max items per batchRevokeVesting |
deploymentBlockNumber() | bigint | Block at which the clone was deployed |
getVestingInfo(vestingId) | VestingInfo | Full plaintext schedule metadata |
getAllRecipients() | Address[] | All recipients with active schedules |
getAllRecipientVestings(recipient) | Hex[] | All vesting IDs for a recipient |
getPendingVestingTransfer(vestingId) | PendingTransfer | Active transfer request, if any |
isRecipient(account) | boolean | Whether 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.