Skip to main content
Subscribe to wallet and transaction lifecycle events with c8.on(event, handler).
c8.on('connected',      (e) => { /* ... */ });
c8.on('txChanged',      (e) => { /* ... */ });

Event reference

connected
event
Fires when the user approves the connection in the popup. Payload: { meta?: Json }.
disconnected
event
Fires when disconnect() is called or the popup is closed. Payload: { reason?: string, meta?: Json }.
accountChanged
event
Fires when balances or holdings change. Payload: { accounts: AccountInfoPayload[], meta?: Json }.
txInitiated
event
Fires when a transaction request is initiated. Payload: { txId?: string, meta?: Json }.
txChanged
event
Fires when a transaction’s completion status updates. Payload: { txId: string, status: "pending" | "confirmed" | "failed" | string, meta?: Json }.
themeChanged
event
Fires when the wallet interface changes its UI display theme. Payload: { theme: "dark" | "light", meta?: Json }.
operationCanceled
event
Fires when an action or modal interface is explicitly rejected by the user. Payload: { reason: string, meta?: Json }.
Always register listeners before calling connect() to ensure you don’t miss the initial connected event.

Unsubscribing from events

The on() method returns an unsubscribe function. Call it to remove the listener.
const unsubscribe = c8.on("connected", (event) => {
  console.log("Connected", event);
});

unsubscribe();