Activities & Events
After executing a plan, you’ll want to track its progress. Legend provides two complementary mechanisms.Activities
Activities represent completed or in-progress on-chain operations. Each activity contains:id— Unique activity identifierstatus— Current state:"pending","completed", or"failed"quark_intent— The original intent that created this activity (if applicable)executions— A list of on-chain executions that make up the activity
Quark Intent
When an activity was created from a plan, thequark_intent field contains the original intent:
Activity lifecycle
failedif any execution revertedpendingif any execution is still pendingcompletedonly when all executions have succeeded
Executions
Each execution represents a single on-chain transaction within the activity:Actions
Each execution contains a list of actions. Every action has:action_type— The type of on-chain action (see below)expected_values— What was intended at plan timeobserved_values— What actually happened on-chain (populated after execution)
expected_values to observed_values lets you verify that the execution matched the plan.
Action Types
Each action’sexpected_values and observed_values follow a schema determined by the action_type. The fields below describe the body for each type.
Lending & Borrowing
AAVE_SUPPLY
Supply assets to an Aave pool.
AAVE_WITHDRAW
Withdraw assets from an Aave pool.
COMET_SUPPLY
Supply assets to a Compound Comet market.
COMET_WITHDRAW
Withdraw assets from a Compound Comet market.
COMET_BORROW
Borrow assets from a Compound Comet market.
COMET_REPAY
Repay a Compound Comet borrow position.
COMET_CLAIM_REWARDS
Claim Compound Comet rewards.
MORPHO_BORROW
Borrow assets from a Morpho market.
MORPHO_REPAY
Repay a Morpho borrow position.
MORPHO_VAULT_SUPPLY
Supply assets to a Morpho vault.
MORPHO_VAULT_WITHDRAW
Withdraw assets from a Morpho vault.
MORPHO_CLAIM_REWARDS
Claim Morpho rewards.
Swapping
SWAP
Swap one token for another.
RECURRING_SWAP
Execute a recurring swap.
QUOTE_PAY
Pay for a quoted price.
Transfers & Bridging
TRANSFER
Transfer tokens to a recipient.
INBOUND_TRANSFER
Receive tokens from a sender.
BRIDGE
Initiate a cross-chain bridge.
BRIDGE_MINT
Mint bridged tokens on the destination chain.
Leveraged Positions
LOOP_LONG
Open or increase a leveraged long position.
LOOP_SHORT
Open or increase a leveraged short position.
UNLOOP_LONG
Close or decrease a leveraged long position.
UNLOOP_SHORT
Close or decrease a leveraged short position.
ADD_BACKING_TOKEN
Add backing collateral to a leveraged position.
WITHDRAW_BACKING_TOKEN
Withdraw backing collateral from a leveraged position.
WITHDRAW_AND_BORROW
Withdraw collateral and borrow in a single Compound Comet operation.
Token Operations
WRAP
Wrap a token (e.g., ETH to WETH).
UNWRAP
Unwrap a token (e.g., WETH to ETH).
Events
Events provide a real-time stream of changes to a sub-account. Use them for:- Webhooks-style monitoring — Long-poll for updates instead of repeatedly fetching activities
- Cursor-based pagination — Track where you left off with the
cursorvalue
Long-polling
Passpoll=true to the Events endpoint and the request will hang until new events arrive (up to ~30 seconds). This is more efficient than polling activities on a timer.