diff --git a/rpc/events.go b/rpc/events.go index 15f8d06b2e..06f998e151 100644 --- a/rpc/events.go +++ b/rpc/events.go @@ -372,6 +372,9 @@ func (h *Handler) sendReorg(w jsonrpc.Conn, reorg *sync.ReorgData, id uint64) er return err } +// SubscribeTxnStatus subscribes to status changes of a transaction. It checks for updates each time a new block is added. +// Subsequent updates are sent only when the transaction status changes. +// The optional block_id parameter is ignored, as status changes are not stored and historical data cannot be sent. func (h *Handler) SubscribeTxnStatus(ctx context.Context, txHash felt.Felt, _ *BlockID) (*SubscriptionID, *jsonrpc.Error) { var ( lastKnownStatus, lastSendStatus *TransactionStatus diff --git a/rpc/handlers.go b/rpc/handlers.go index c391aac5ac..58c87a71c7 100644 --- a/rpc/handlers.go +++ b/rpc/handlers.go @@ -339,7 +339,7 @@ func (h *Handler) Methods() ([]jsonrpc.Method, string) { //nolint: funlen }, { Name: "starknet_subscribeTransactionStatus", - Params: []jsonrpc.Parameter{{Name: "transaction_hash"}, {Name: "block"}}, + Params: []jsonrpc.Parameter{{Name: "transaction_hash"}, {Name: "block", Optional: true}}, Handler: h.SubscribeTxnStatus, }, {