Skip to Content

Events Reference

All action types share identical event structures defined in packages/sdk/src/shared/events.ts.


Event Constants

import { StakeEvent, DepositEvent, UnstakeEvent, DeployEvent, RedeemEvent, BridgeEvent, StakeAndDeployEvent, DepositAndDeployEvent, } from '@lombard.finance/sdk';

Each event constant object provides:

EventValue
Progress'progress'
StatusChange'status-change'
Completed'completed'
Failed'failed'
Error'error'

Event Handler Types

All action types follow the same interface pattern:

// Progress handler action.on(StakeEvent.Progress, (progress: StrategyProgress<string>) => { console.log(progress.status); console.log(progress.steps); console.log(progress.confirmations); }); // Status change handler action.on(StakeEvent.StatusChange, (status: string) => { console.log('New status:', status); }); // Completed handler action.on(StakeEvent.Completed, () => { console.log('Done!'); }); // Failed handler action.on(StakeEvent.Failed, () => { console.log('Operation failed'); }); // Error handler action.on(StakeEvent.Error, (error: LombardError) => { console.error(error.code, error.message); });

Subscribing and Unsubscribing

// Subscribe const handler = (status: string) => console.log(status); action.on(StakeEvent.StatusChange, handler); // Unsubscribe (use same handler reference) action.off(StakeEvent.StatusChange, handler);

Progress Object Structure

interface StrategyProgress<TStatus extends string> { status: TStatus; steps: Record<string, StepStatus>; confirmations?: number; requiredConfirmations?: number; metadata?: Record<string, unknown>; }
Last updated on