Cloak
object. Progress text is written for people: show it, but do not branch on it. Branch on results and
on error codes.
Per-call onProgress
shield, send, withdraw, createPaymentLink, claimPaymentLink and payRequest take
onProgress: (step: string) => void.
Cross-chain calls add their own steps, for example
Sending 6 USDC from base... on a shield from
Base, and Reserving the payout..., Withdrawing..., Sending... on a payout.
Events on the Cloak object
cloak.on(event, handler) returns a function that unsubscribes.
The
CloakEvent type also lists "progress", but createCloak does not emit it. Use each call’s
onProgress.createCloak({ onWarning }) receives the same messages as the warning event.
Low-level callbacks
The low-level functions take these onTransactOptions:
transactBatch prefixes each item’s status with [batch i/N]. A wallet prompt is announced before it
opens, for example Approve the request in your wallet. This signs the request for the relay, not a transaction, and it must be approved within a few minutes to stay valid. Use that moment to bring
your UI’s attention to the wallet.
Scanning callbacks
scanTransactions takes:
recoverNotesFromIndex reports { pagesDone, pagesTotal, itemsChecked, notesFound } through its
onProgress.
Showing progress well
- Warm the circuits on mount (
verifyAllCircuits(getCircuitsPath())) so the first action does not start with a 23 MB download. - Show a determinate bar only for the circuit download and
onProofProgress. Everything else is a status line. - On a wallet prompt announcement, show “Check your wallet”. The request expires if left unapproved.