Skip to main content
SparkWallet extends EventEmitter, so it inherits the following methods for handling events.

Available Events

The updatedBalance parameter is a bigint representing the wallet’s new total balance in satoshis after the event.
Events are only emitted for incoming funds (transfers received, deposits confirmed). For outgoing operations (Lightning sends, withdrawals), poll the status using getLightningSendRequest() or getCoopExitRequest().



on(event: string, listener: Function)

Adds a listener for the specified event.

Parameters

string
required
The event name to listen for
Function
required
The callback function to execute when the event is emitted

Returns

this
required
The SparkWallet instance for chaining

Example




once(event: string, listener: Function)

Adds a one-time listener for the specified event.

Parameters

string
required
The event name to listen for
Function
required
The callback function to execute when the event is emitted

Returns

this
required
The SparkWallet instance for chaining

Example




off(event: string, listener: Function)

Removes the specified listener from the specified event.

Parameters

string
required
The event name
Function
required
The callback function to remove

Returns

this
required
The SparkWallet instance for chaining

Example