Skip to content

Commit

Permalink
Han's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pnowosie committed Oct 28, 2024
1 parent 56509eb commit 0ce1ae2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions rpc/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rpc/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (h *Handler) Methods() ([]jsonrpc.Method, string) { //nolint: funlen
},
{
Name: "starknet_getTransactionStatus",
Params: []jsonrpc.Parameter{{Name: "transaction_hash"}},
Params: []jsonrpc.Parameter{{Name: "transaction_hash"}, {Name: "block", Optional: true}},
Handler: h.TransactionStatus,
},
{
Expand Down Expand Up @@ -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,
},
{
Expand Down

0 comments on commit 0ce1ae2

Please sign in to comment.