Skip to main content

PressKey events

A connected browser identity is not static. Users can change accounts, lock PressKey or encounter a network change while an application remains open. PressKey exposes provider events so the application can respond without relying on stale state.

Accounts changed

When the account changes, invalidate role, bond, outlet and Capsule-relationship caches tied to the previous address. Do not update only the avatar while leaving authorization state untouched.

Chain changed

A network mismatch should disable writes and clearly explain the required network rather than allowing a transaction to fail later.

Lock changed

Current provider behavior includes a lockChanged event. This is useful for flows that prepare an action over several minutes.
If PressKey locks after metadata upload but before signing, keep the prepared action and prompt for unlock rather than forcing the user to rebuild the publication.

Remove listeners

Single-page applications can accidentally subscribe several times during navigation or hot reload.
Clean up listeners when the component or session manager that owns them is disposed.

Invalidate derived authorization state

An account change should invalidate data such as:
  • protocol role
  • active bond
  • outlet permissions
  • contributor relationship
  • existing evidence vote
  • bounty assignment
  • pending unsigned transaction intent
The last item is especially important. A transaction prepared for one account should not silently be signed by a newly selected account.

Pending transaction state is separate

Do not delete a submitted transaction from local state simply because the wallet disconnects. Once the transaction hash exists, confirmation belongs to network observation, not wallet session state. A robust state model distinguishes:
That lets the application reconnect and continue tracking correctly.

UX principle

Provider events are not merely technical callbacks. They tell the application that the user’s authorization context changed. Make that change visible before the next irreversible action.