Events Handler
When setting up the mobile and web Software Development Kits (SDKs) for the Fireblocks Non-Custodial Wallet (NCW), you're given the choice to provide an events handler. The events handler activates during different operations that occur within the SDK and keeps you in the loop about significant occurrences like key generation, backup and recovery, and transaction signing.
The events handler can be tailored to match your application's needs. It can be designed to execute various actions, such as refreshing the user interface, recording events, dispatching notifications, or initiating other behaviors specific to your application's functionality.
The events handler object should be provided when initializing the NCW SDK. It must implement the following method (following a defined interface):
handleEvent(event: Event): void
: the method that will be invoked whenever there's a new event
export interface IEventsHandler {
handleEvent(event: TEvent): void;
}
interface FireblocksEventHandler {
/**
* Listens to various Fireblocks events see [Event]. Each event has relevant information.
* In addition, in case of an error we will add the [FireblocksError] with the relevant error code
*/
fun onEvent(event: Event)
}
public protocol EventHandlerDelegate: AnyObject {
/// Listens to various Fireblocks events [FireblocksEvent]. Each event has relevant information.
/// In addition, in case of an error we will add the FireblocksError with the relevant error code
/// - Parameter event: FireblocksEvent
func onEvent(event: FireblocksEvent)
}
Updated about 1 year ago