Skip to content

[Scheduled Callbacks] Access API queries & subscriptions by Callback ID #7830

@jribbink

Description

@jribbink

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) -> TransactionResultResponse
    • GetScheduledTransaction(GetScheduledTransactionRequest) -> TransactionResponse
    • message GetScheduledTransactionRequest { uint64 id = 1; }
  • Subscription (streaming):
    • SubscribeScheduledTransactionResults(SubscribeScheduledTransactionRequest) -> (stream TransactionResultResponse)
    • message SubscribeScheduledTransactionRequest { uint64 id = 1; }

REST (HTTP)

  • Lookup:
    • GET /v1/scheduled_transactions/{callback_id}/result
    • GET /v1/scheduled_transactions/{callback_id}/transaction
  • WebSocket (/v1/ws):
    • Topic: scheduled_transactions_results
    • Arguments: callback_id
    • Payload: same shape as transaction result messages

Acceptance Criteria

  • Given a valid callbackID, a client can:
    • Fetch TransactionResult without an indexer
    • Subscribe and receive the result at execution
    • Retrieve the associated system Transaction (or learn it's not yet available)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions