Skip to Content

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:

1

Create

Initialize the action with configuration (chain, asset, protocol)

2

Prepare

Validate parameters and verify requirements (amount, recipient)

3

Authorize

Sign required messages and transactions

4

Execute

Complete the primary operation

Each phase transitions the action to a new state.


State Management

Actions maintain three independent properties:

PropertyTypeDescription
statusstringCurrent step in the process
isLoadingbooleanWhether async work is happening
errorLombardError | nullAny issue that occurred

These properties operate independently, allowing an action to carry both state information and error details simultaneously.


Status Tracking

BTC Actions
IDLENEEDS_FEE_AUTHORIZATIONREADYADDRESS_READY

Or for non-Ethereum chains:

BTC Actions (Non-ETH)
IDLENEEDS_ADDRESS_CONFIRMATIONREADYADDRESS_READY
EVM Actions
IDLENEEDS_APPROVALREADYCONFIRMINGCOMPLETED
Non-EVM Unstake
IDLEREADYCONFIRMINGCOMPLETED

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.

Last updated on