Monitoring
After executing a plan, you need to know when it confirms. Legend offers two approaches: polling activities and long-polling events.Polling activities
The simplest approach. After executing a plan, poll the activities endpoint until you see your transaction:Long-polling events
The events endpoint withpoll=true holds the connection open until something happens — no wasted requests:
Continuous monitoring loop
For a service that needs to react to all account changes:Which approach to use
| Scenario | Recommendation |
|---|---|
| Wait for one transaction | Poll activities in a loop |
| Monitor an account continuously | Long-poll events |
| Dashboard with live updates | Long-poll events |
| Batch job checking final state | Single activities fetch |