-
Notifications
You must be signed in to change notification settings - Fork 199
Description
Problem
Developers need a first-class way to query the results of scheduled transactions by callbackID, analogous to how native transactions are queried by txID. Without this, callback observability depends on an external indexer to locate the block which a given callback was included in.
Rough API Sketch
gRPC (AccessAPI)
- Lookup (single response):
GetScheduledTransactionResult(GetScheduledTransactionRequest) -> TransactionResultResponseGetScheduledTransaction(GetScheduledTransactionRequest) -> TransactionResponsemessage GetScheduledTransactionRequest { uint64 id = 1; }
- Subscription (streaming):
SubscribeScheduledTransactionResults(SubscribeScheduledTransactionRequest) -> (stream TransactionResultResponse)message SubscribeScheduledTransactionRequest { uint64 id = 1; }
REST (HTTP)
- Lookup:
GET /v1/scheduled_transactions/{callback_id}/resultGET /v1/scheduled_transactions/{callback_id}/transaction
- WebSocket (/v1/ws):
- Topic:
scheduled_transactions_results - Arguments:
callback_id - Payload: same shape as transaction result messages
- Topic:
Acceptance Criteria
- Given a valid
callbackID, a client can:- Fetch
TransactionResultwithout an indexer - Subscribe and receive the result at execution
- Retrieve the associated system
Transaction(or learn it's not yet available)
- Fetch
Future Scope
Including more verbose endpoints relating to scheduled transactions (e.g. lookup CallbackData for a currently scheduled transaction that has not yet executed) would offer a useful & more direct API for clients. However, these are not must-have items and can be derived via script execution if necessary.
The primary gap at the moment is that there is no mapping for callback ID <-> TX ID once executed, meaning that clients must manually index ALL callback Executed/PendingExecution events to locate their results.