Overview
TheWaitIntentReceipt endpoint provides a streaming or long-polling mechanism to wait for an intent to complete. Unlike GetIntentReceipt, which requires manual polling, this endpoint holds the connection until the intent reaches a terminal state or times out.
Use Cases
- Wait for transaction completion without polling
- Implement real-time transaction monitoring
- Reduce API calls by using long-polling
- Get notified immediately when transaction completes
- Simplify client-side code for waiting
Request Parameters
Required Fields
- intentId (string): The unique identifier of the intent to monitor
Response
The response includes:- intentReceipt (IntentReceipt): Complete receipt with transaction details
- done (boolean): Indicates if the intent has reached a terminal state
true: Intent is complete (SUCCEEDED or FAILED)false: Intent is still processing (may require another call)
Behavior
This endpoint will:- Check the current status of the intent
- If complete (
SUCCEEDEDorFAILED), return immediately withdone: true - If still processing, wait for state changes
- Return updates as they occur
- Timeout after a reasonable period if no completion
Example
Comparison: WaitIntentReceipt vs GetIntentReceipt
GetIntentReceipt (Manual Polling)
WaitIntentReceipt (Long Polling)
WaitIntentReceipt is more efficient as it reduces the number of API calls and provides near-instant updates.With Progress Updates
Timeout Handling
Best Practices
For UI applications, combine this endpoint with progress callbacks to provide real-time feedback to users.
Next Steps
After receiving the completed receipt:- Verify transaction hashes on block explorers
- Update UI to show completion status
- Trigger any post-transaction logic
- Store receipt for record-keeping
Authorizations
API Key for authenticating requests, get an access key at https://trails.build and request early access
Body
application/json