Action Lifecycle
Actions are the core building blocks of the SDK. Each action represents a multi-step blockchain operation with state management, event updates, error handling, and retry capabilities.
Core Pattern
Every SDK action follows four sequential stages:
Each phase transitions the action to a new state.
State Management
Actions maintain three independent properties:
| Property | Type | Description |
|---|---|---|
status | string | Current step in the process |
isLoading | boolean | Whether async work is happening |
error | LombardError | null | Any issue that occurred |
These properties operate independently, allowing an action to carry both state information and error details simultaneously.
Status Tracking
Or for non-Ethereum chains:
Error Recovery
When an error occurs, the status stays at the step where it happened. This design lets users retry the same operation without losing context or starting over.
// Check status before calling next method
if (stake.status === BtcActionStatus.NEEDS_FEE_AUTHORIZATION) {
await stake.authorize();
}Always inspect the status property before calling subsequent methods to ensure the action has progressed to the appropriate stage.