Disperse · Client@tokenops/sdk/fhe-disperse
ConfidentialDisperseClient
One singleton per chain. Register once and the singleton deploys two ERC-1167 subwallets owned by you; from there, batch-disperse to N recipients in a single tx with per-recipient ACL grants.
Construct
Headless TS — non-React consumers (Node, Vite, server workers). React hosts use the per-hook surface; same method names, lazy encryptor.
@tokenops/sdk/fhe-disperse
ts
import { createConfidentialDisperseClient } from "@tokenops/sdk/fhe-disperse";
const client = createConfidentialDisperseClient({
publicClient,
walletClient,
// address optional: resolved from publicClient.chain.id
});Methods
Setup · 3
- First-time setup for a deployer — singleton creates the two ERC-1167 subwallets.
client.register()React:useRegister - Approve the subwallets to transferFromConfidential for the listed tokens.
client.approveTokenOnWallets()React:useApproveTokenOnWallets - Revoke operator approval on the subwallets (rollback).
client.revokeTokenOnWallets()React:useRevokeTokenOnWallets
Write · 2
Disclose · ACL · 2
Read · 11
- Read the deployer's two registered subwallet addresses.
client.getWallets()React:useGetWallets - Compute the deterministic subwallet addresses for a deployer without registering.
client.predictWallets()React:usePredictWallets - Has this deployer already called register?
client.isRegistered()React:useIsRegistered - Check whether a user's registered subwallets have approved the singleton as an ERC-7984 operator for token.
client.hasApprovedSubwallets()React:useHasApprovedSubwallets - Quote the on-chain fee config for a given disperse batch shape (count + mode).
client.calculateFee()React:useCalculateFee - Read consolidated fee information for user — combines per-user resolved fees (getFeeAmounts) with the global feeConfig toggles in one read.
client.getFees()React:useGetFees client.getCustomFee()Read a user's raw CustomFee override; distinguishes 'no override set' from 'override disabled'. Client method only, no hook.- Read the singleton's { gasFeeEnabled, tokenFeeEnabled, defaultGasFee, defaultTokenFee } fee config.
client.getFeeConfig()React:useGetFeeConfig - Read the maximum batch size for each of the three disperse modes ("wallet", "direct", "wallet-token-fee").
client.getBatchLimits()React:useGetBatchLimits - Read the block number at which the singleton was deployed — useful as the fromBlock argument to getLogs when subscribing to events.
client.deploymentBlockNumber()React:useDeploymentBlockNumber - Read the WALLET_IMPLEMENTATION address — the singleton clones this deterministically (Clones.cloneDeterministic) for each registered user to derive their wallet pair.
client.walletImplementation()React:useWalletImplementation
Configure · 6
- Admin: update the global fee configuration — enable/disable gas and token fees, set the defaults.
client.setFeeConfig()React:useSetFeeConfig - Admin: install a per-user fee override (gas fee in wei, token fee in BPS).
client.setCustomFee()React:useSetCustomFee - Admin: remove a per-user fee override, falling back to the global defaults.
client.disableCustomFee()React:useDisableCustomFee - Admin: set the maximum batch size for "wallet" mode disperses.
client.setMaxBatchSizeHolding()React:useSetMaxBatchSizeHolding - Admin: set the maximum batch size for "direct" mode disperses.
client.setMaxBatchSizeDirect()React:useSetMaxBatchSizeDirect - Admin: set the maximum batch size for "wallet-token-fee" mode disperses.
client.setMaxBatchSizeTokenFee()React:useSetMaxBatchSizeTokenFee
Roles · RBAC · 4
- AccessControl: grant role to accountTarget on the singleton.
client.grantRole()React:useGrantRole - AccessControl: revoke role from accountTarget on the singleton.
client.revokeRole()React:useRevokeRole client.renounceRole()Caller gives up one of their own roles (callerConfirmation must be the caller). Cannot be undone. Client method only, no hook.- Read AccessControl: is account a member of role on the singleton? All five role constants (DEFAULT_ADMIN_ROLE, FEE_MANAGER_ROLE, FEE_COLLECTOR_ROLE, PAUSER_ROLE, WITHDRAWER_ROLE) are exported from @tokenops/sdk/fhe-disperse/react.
client.hasRole()React:useHasRole
Recovery · 8
- Admin: pause all disperse operations on the singleton.
client.pause()React:usePause - Admin: unpause the singleton.
client.unpause()React:useUnpause - Recover residual confidential ERC-7984 tokens from the caller's registered wallets to to.
client.recoverFromWallets()React:useRecoverFromWallets - Recover ERC-20 tokens accidentally sent to the caller's registered wallets.
client.recoverERC20FromWallets()React:useRecoverERC20FromWallets - Sweep stranded confidential tokens out of a subwallet (admin-only).
client.rescueConfidentialTokens()React:useRescueConfidentialTokens - Sweep stranded plain ERC-20 tokens (e.g. someone sent the wrong token).
client.rescueERC20()React:useRescueERC20 - Fee-collector: withdraw amount wei of accumulated ETH gas fees from the singleton to to.
client.withdrawGasFee()React:useWithdrawGasFee - Fee-collector: withdraw accumulated encrypted token fees.
client.withdrawTokenFee()React:useWithdrawTokenFee