The four disperse flows.
The singleton + per-user wallet-pair architecture collapses every disperse campaign to these four paths. Each carries the hooks, the recipe, and the story chapter that demos it end-to-end.
- 1
Register (one-time per user)
Operator calls register(token) on the disperse singleton. Singleton deploys a deterministic wallet pair (wallet0 + wallet1) via CREATE2: predictable addresses, no per-recipient deploy.
- useRegister({ token }) — submits the registration tx
- Singleton clones WALLET_IMPLEMENTATION twice (wallet0 + wallet1) under deterministic salts
- useGetWallets({ user }) returns the deployed pair
- 2
Approve the wallet pair
ERC-7984 operator authorization is the pre-step for any flow that pulls funds. register() approves the pair for its token; wallet-mode disperses pull the batch through wallet0/wallet1 at send time.
- setOperator (re-exported from @tokenops/sdk/fhe-disperse) for ERC-7984 operator grants
- useApproveTokenOnWallets({ token }) approves the registered pair for additional tokens
- Verify with useHasApprovedSubwallets({ user, token })
- 3
Disperse to N recipients
One call, N transfers. SDK builds the encrypted batch input proof; singleton verifies + atomically transfers to every recipient, splitting wallet-mode batches across wallet0/wallet1.
- usePreflightDisperse({ user, token, recipients, amounts, mode }) returns the full PreflightReport
- useDisperse.mutate({ token, mode, recipients, amounts }) encrypts the batch in one input proof, submits
- Receipt's WalletDistribution / DirectDistribution events list per-recipient handles
- 4
Recover + fee management
Pull funds back from a subwallet after a campaign closes; admin pause/unpause; fee withdrawal.
- useRecoverFromWallets({ token, to }) returns residual balance to your EOA
- Fee-collector flow: useWithdrawTokenFee / useWithdrawGasFee
- usePause / useUnpause for incident response