v2.0.0-rc.1 release candidate
The API is frozen and later candidates carry fixes only, except the receipt-free and Safe create surface of /fhe-airdrop, which is @beta. Published on the next dist-tag; latest stays on 1.6.0 until 2.0.0.Disperse 2.0 · Roles · 5@tokenops/sdk/fhe-disperse
Disperse 2.0 role constants.
The singleton holds the contract-level roles. Registering, dispersing and recovering your own subwallets are gated by msg.sender, not by a role: any registered user moves only their own funds.
| Role | Permits | Granted by |
|---|---|---|
| DEFAULT_ADMIN_ROLE 0x0000000000000000…000000 | Grant and revoke every other role, plus setMaxBatchSizeHolding / setMaxBatchSizeDirect / setMaxBatchSizeTokenFee. Can also read the encrypted fee reserve. | DEFAULT_ADMIN_ROLE |
| PAUSER_ROLE 0x65d7a28e3265b37a…0d862a | pause and unpause. While paused, disperses, registration and subwallet approvals revert and preflightDisperse reports PausedError; users can still recover from their subwallets and existing handles stay decryptable. | DEFAULT_ADMIN_ROLE |
| WITHDRAWER_ROLE 0x10dac8c06a04bec0…1334e4 | rescueConfidentialTokens and rescueERC20, for tokens sent to the singleton by mistake. | DEFAULT_ADMIN_ROLE |
| FEE_MANAGER_ROLE 0x6c0757dc3e6b28b2…04ff1c | setFeeConfig, setCustomFee and disableCustomFee. | DEFAULT_ADMIN_ROLE |
| FEE_COLLECTOR_ROLE 0x2dca0f5ce7e75a4b…038821 | withdrawGasFee, withdrawTokenFee, and getEncryptedFeeReserve (useAccessEncryptedFeeReserve), which is also open to DEFAULT_ADMIN_ROLE. | DEFAULT_ADMIN_ROLE |
Reading + managing
Role hooks take holder
On the 2.0 line useHasRole, useGrantRole and useRevokeRole name the address whose membership is read or changed holder, as on /fhe-airdrop. UseGrantRoleArgs and UseRevokeRoleArgs are unions that accept exactly one of holder or the deprecated accountTarget. The headless grantRole(role, accountTarget, account?) / revokeRole and renounceRole(role, callerConfirmation, account?) are positional and unchanged; renounceRole has no hook.
@tokenops/sdk/fhe-disperse/react
tsx
import {
FEE_COLLECTOR_ROLE,
useGrantRole,
useHasRole,
} from "@tokenops/sdk/fhe-disperse/react";
const { data: isCollector } = useHasRole({ role: FEE_COLLECTOR_ROLE, holder: opsAddress });
const grant = useGrantRole();
grant.mutate({ role: FEE_COLLECTOR_ROLE, holder: opsAddress });
// `account` (read) and `accountTarget` (write) still compile and are deprecated.
// `accountTarget` cannot be passed together with `holder`; on useHasRole,
// `holder` wins over `account` when both are passed.