rpcv10

package
v0.15.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const ExecutionStepsHeader string = "X-Cairo-Steps"

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeader added in v0.15.13

type BlockHeader struct {
	Hash                  *felt.Felt           `json:"block_hash,omitempty"`
	ParentHash            *felt.Felt           `json:"parent_hash,omitempty"`
	Number                *uint64              `json:"block_number,omitempty"`
	NewRoot               *felt.Felt           `json:"new_root,omitempty"`
	Timestamp             uint64               `json:"timestamp"`
	SequencerAddress      *felt.Felt           `json:"sequencer_address,omitempty"`
	L1GasPrice            *rpcv6.ResourcePrice `json:"l1_gas_price"`
	L1DataGasPrice        *rpcv6.ResourcePrice `json:"l1_data_gas_price,omitempty"`
	L1DAMode              *rpcv6.L1DAMode      `json:"l1_da_mode,omitempty"`
	StarknetVersion       string               `json:"starknet_version"`
	L2GasPrice            *rpcv6.ResourcePrice `json:"l2_gas_price"`
	TransactionCommitment *felt.Hash           `json:"transaction_commitment,omitempty"`
	EventCommitment       *felt.Hash           `json:"event_commitment,omitempty"`
	ReceiptCommitment     *felt.Hash           `json:"receipt_commitment,omitempty"`
	StateDiffCommitment   *felt.Hash           `json:"state_diff_commitment,omitempty"`
	EventCount            *uint64              `json:"event_count,omitempty"`
	TransactionCount      *uint64              `json:"transaction_count,omitempty"`
	StateDiffLength       *uint64              `json:"state_diff_length,omitempty"`
}

BLOCK_HEADER https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L1591 PRE_CONFIRMED_BLOCK_HEADER https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L1711

func AdaptBlockHeader added in v0.15.13

func AdaptBlockHeader(
	header *core.Header,
	commitments *core.BlockCommitments,
	stateDiff *core.StateDiff,
) BlockHeader

type BlockWithReceipts added in v0.15.13

type BlockWithReceipts struct {
	Status rpcv9.BlockStatus `json:"status,omitempty"`
	BlockHeader
	Transactions []rpcv9.TransactionWithReceipt `json:"transactions"`
}

https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L1819

type BlockWithTxHashes added in v0.15.13

type BlockWithTxHashes struct {
	Status rpcv9.BlockStatus `json:"status,omitempty"`
	BlockHeader
	TxnHashes []*felt.Felt `json:"transactions"`
}

https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L1769

type BlockWithTxs added in v0.15.13

type BlockWithTxs struct {
	Status rpcv9.BlockStatus `json:"status,omitempty"`
	BlockHeader
	Transactions []*rpcv9.Transaction `json:"transactions"`
}

https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L1794

type EmittedEvent

type EmittedEvent struct {
	*rpcv6.Event
	BlockNumber      *uint64    `json:"block_number,omitempty"`
	BlockHash        *felt.Felt `json:"block_hash,omitempty"`
	TransactionHash  *felt.Felt `json:"transaction_hash"`
	TransactionIndex uint       `json:"transaction_index"`
	EventIndex       uint       `json:"event_index"`
}

type EventArgs

type EventArgs struct {
	EventFilter
	rpcv6.ResultPageRequest
}

type EventFilter

type EventFilter struct {
	FromBlock *rpcv9.BlockID `json:"from_block"`
	ToBlock   *rpcv9.BlockID `json:"to_block"`
	Address   *felt.Felt     `json:"address"`
	Keys      [][]felt.Felt  `json:"keys"`
}

type EventsChunk

type EventsChunk struct {
	Events            []EmittedEvent `json:"events"`
	ContinuationToken string         `json:"continuation_token,omitempty"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(
	bcReader blockchain.Reader,
	syncReader sync.Reader,
	virtualMachine vm.VM,
	logger utils.Logger,
) *Handler

func (*Handler) BlockWithReceipts added in v0.15.13

func (h *Handler) BlockWithReceipts(id *rpcv9.BlockID) (*BlockWithReceipts, *jsonrpc.Error)

BlockWithTxHashes returns the block information with transaction receipts given a block ID.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L99

func (*Handler) BlockWithTxHashes added in v0.15.13

func (h *Handler) BlockWithTxHashes(id *rpcv9.BlockID) (*BlockWithTxHashes, *jsonrpc.Error)

BlockWithTxHashes returns the block information with transaction hashes given a block ID.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L25

func (*Handler) BlockWithTxs added in v0.15.13

func (h *Handler) BlockWithTxs(blockID *rpcv9.BlockID) (*BlockWithTxs, *jsonrpc.Error)

BlockWithTxs returns the block information with full transactions given a block ID.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/cce1563eff702c87590bad3a48382d2febf1f7d9/api/starknet_api_openrpc.json#L62

func (*Handler) Events

func (h *Handler) Events(args EventArgs) (EventsChunk, *jsonrpc.Error)

Events gets the events matching a filter

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/785257f27cdc4ea0ca3b62a21b0f7bf51000f9b1/api/starknet_api_openrpc.json#L810 //nolint:lll

func (*Handler) PendingBlock

func (h *Handler) PendingBlock() *core.Block

func (*Handler) PendingData

func (h *Handler) PendingData() (core.PendingData, error)

func (*Handler) PendingState

func (h *Handler) PendingState() (core.StateReader, func() error, error)

func (*Handler) Run

func (h *Handler) Run(ctx context.Context) error

Currently only used for testing

func (*Handler) SimulateTransactions

func (h *Handler) SimulateTransactions(
	id *rpcv9.BlockID,
	transactions BroadcastedTransactionInputs,
	simulationFlags []rpcv6.SimulationFlag,
) ([]SimulatedTransaction, http.Header, *jsonrpc.Error)

func (*Handler) SpecVersion

func (h *Handler) SpecVersion() (string, *jsonrpc.Error)

func (*Handler) StateUpdate

func (h *Handler) StateUpdate(id *rpcv9.BlockID) (StateUpdate, *jsonrpc.Error)

StateUpdate returns the state update identified by the given BlockID.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/9377851884da5c81f757b6ae0ed47e84f9e7c058/api/starknet_api_openrpc.json#L136 //nolint:lll

func (*Handler) SubscribeEvents

func (h *Handler) SubscribeEvents(
	ctx context.Context,
	fromAddr *felt.Felt,
	keys [][]felt.Felt,
	blockID *rpcv9.SubscriptionBlockID,
	finalityStatus *rpcv9.TxnFinalityStatusWithoutL1,
) (SubscriptionID, *jsonrpc.Error)

SubscribeEvents creates a WebSocket stream which will fire events for new Starknet events with applied filters

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/c2e93098b9c2ca0423b7f4d15b201f52f22d8c36/api/starknet_ws_api.json#L59

func (*Handler) SubscribeNewHeads

func (h *Handler) SubscribeNewHeads(
	ctx context.Context,
	blockID *rpcv9.SubscriptionBlockID,
) (SubscriptionID, *jsonrpc.Error)

SubscribeNewHeads creates a WebSocket stream which will fire events when a new block header is added.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/c2e93098b9c2ca0423b7f4d15b201f52f22d8c36/api/starknet_ws_api.json#L10

func (*Handler) SubscribeNewTransactionReceipts

func (h *Handler) SubscribeNewTransactionReceipts(
	ctx context.Context,
	senderAddress []felt.Felt,
	finalityStatuses []rpcv9.TxnFinalityStatusWithoutL1,
) (SubscriptionID, *jsonrpc.Error)

SubscribeTransactionReceipts creates a WebSocket stream which will fire events when new transaction receipts are created.

The endpoint receives a vector of finality statuses. An event is fired for each finality status update. It is possible for receipts for pre-confirmed transactions to be received multiple times, or not at all.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/4e98e3684b50ee9e63b7eeea9412b6a2ed7494ec/api/starknet_ws_api.json#L186

func (*Handler) SubscribeNewTransactions

func (h *Handler) SubscribeNewTransactions(
	ctx context.Context,
	finalityStatus []rpcv9.TxnStatusWithoutL1,
	senderAddr []felt.Felt,
) (SubscriptionID, *jsonrpc.Error)

SubscribeNewTransactions Creates a WebSocket stream which will fire events when new transaction are created.

The endpoint receives a vector of finality statuses. An event is fired for each finality status update. It is possible for events for pre-confirmed and candidate transactions to be received multiple times, or not at all.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/4e98e3684b50ee9e63b7eeea9412b6a2ed7494ec/api/starknet_ws_api.json#L257

func (*Handler) SubscribeTransactionStatus

func (h *Handler) SubscribeTransactionStatus(
	ctx context.Context,
	txHash *felt.Felt,
) (SubscriptionID, *jsonrpc.Error)

SubscribeTransactionStatus subscribes to status changes of a transaction. It checks for updates each time a new block is added. Later updates are sent only when the transaction status changes.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/c2e93098b9c2ca0423b7f4d15b201f52f22d8c36/api/starknet_ws_api.json#L151

func (*Handler) TraceBlockTransactions

func (h *Handler) TraceBlockTransactions(
	ctx context.Context, id *rpcv9.BlockID,
) ([]TracedBlockTransaction, http.Header, *jsonrpc.Error)

TraceBlockTransactions returns the trace for a given blockID

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/9377851884da5c81f757b6ae0ed47e84f9e7c058/api/starknet_trace_api_openrpc.json#L108 //nolint:lll

func (*Handler) TraceTransaction

func (h *Handler) TraceTransaction(
	ctx context.Context, hash *felt.Felt,
) (TransactionTrace, http.Header, *jsonrpc.Error)

TraceTransaction returns the trace for a given executed transaction, including internal calls

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/9377851884da5c81f757b6ae0ed47e84f9e7c058/api/starknet_trace_api_openrpc.json#L11 //nolint:lll

func (*Handler) TransactionReceiptByHash

func (h *Handler) TransactionReceiptByHash(
	hash *felt.Felt,
) (*rpcv9.TransactionReceipt, *jsonrpc.Error)

TransactionReceiptByHash returns the receipt of a transaction identified by the given hash.

It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json#L222

func (*Handler) TransactionStatus

func (h *Handler) TransactionStatus(
	ctx context.Context,
	hash *felt.Felt,
) (rpcv9.TransactionStatus, *jsonrpc.Error)

func (*Handler) Unsubscribe

func (h *Handler) Unsubscribe(ctx context.Context, id string) (bool, *jsonrpc.Error)

func (*Handler) WithCallMaxGas

func (h *Handler) WithCallMaxGas(maxGas uint64) *Handler

func (*Handler) WithCallMaxSteps

func (h *Handler) WithCallMaxSteps(maxSteps uint64) *Handler

func (*Handler) WithFeeder

func (h *Handler) WithFeeder(feederClient *feeder.Client) *Handler

func (*Handler) WithFilterLimit

func (h *Handler) WithFilterLimit(limit uint) *Handler

WithFilterLimit sets the maximum number of blocks to scan in a single call for event filtering.

func (*Handler) WithGateway

func (h *Handler) WithGateway(gatewayClient rpccore.Gateway) *Handler

func (*Handler) WithIDGen

func (h *Handler) WithIDGen(idgen func() string) *Handler

func (*Handler) WithL1Client

func (h *Handler) WithL1Client(l1Client rpccore.L1Client) *Handler

func (*Handler) WithMempool

func (h *Handler) WithMempool(memPool mempool.Pool) *Handler

func (*Handler) WithSubmittedTransactionsCache

func (h *Handler) WithSubmittedTransactionsCache(cache *rpccore.TransactionCache) *Handler

type MigratedCompiledClass

type MigratedCompiledClass struct {
	ClassHash         felt.SierraClassHash `json:"class_hash"`
	CompiledClassHash felt.CasmClassHash   `json:"compiled_class_hash"`
}

type SentEvent

type SentEvent struct {
	TransactionHash  felt.Felt
	TransactionIndex uint
	EventIndex       uint
}

type SimulatedTransaction

type SimulatedTransaction struct {
	TransactionTrace *TransactionTrace `json:"transaction_trace,omitempty"`
	FeeEstimation    rpcv9.FeeEstimate `json:"fee_estimation,omitzero"`
}

type StateDiff

type StateDiff struct {
	StorageDiffs              []rpcv6.StorageDiff      `json:"storage_diffs"`
	Nonces                    []rpcv6.Nonce            `json:"nonces"`
	DeployedContracts         []rpcv6.DeployedContract `json:"deployed_contracts"`
	DeprecatedDeclaredClasses []*felt.Felt             `json:"deprecated_declared_classes"`
	DeclaredClasses           []rpcv6.DeclaredClass    `json:"declared_classes"`
	ReplacedClasses           []rpcv6.ReplacedClass    `json:"replaced_classes"`
	MigratedCompiledClasses   []MigratedCompiledClass  `json:"migrated_compiled_classes"`
}

func AdaptVMStateDiff

func AdaptVMStateDiff(vmStateDiff *vm.StateDiff) StateDiff

type StateUpdate

type StateUpdate struct {
	BlockHash *felt.Felt `json:"block_hash,omitempty"`
	NewRoot   *felt.Felt `json:"new_root,omitempty"`
	OldRoot   *felt.Felt `json:"old_root"`
	StateDiff *StateDiff `json:"state_diff"`
}

https://github.com/starkware-libs/starknet-specs/blob/8016dd08ed7cd220168db16f24c8a6827ab88317/api/starknet_api_openrpc.json#L909 //nolint:lll

type SubscriptionEmittedEvent

type SubscriptionEmittedEvent struct {
	EmittedEvent
	FinalityStatus rpcv9.TxnFinalityStatus `json:"finality_status"`
}

type SubscriptionID

type SubscriptionID string

type TracedBlockTransaction

type TracedBlockTransaction struct {
	TraceRoot       *TransactionTrace `json:"trace_root,omitempty"`
	TransactionHash *felt.Felt        `json:"transaction_hash,omitempty"`
}

func AdaptFeederBlockTrace

func AdaptFeederBlockTrace(
	block *core.Block,
	blockTrace *starknet.BlockTrace,
) ([]TracedBlockTransaction, error)

type TransactionTrace

type TransactionTrace struct {
	Type                  rpcv9.TransactionType     `json:"type"`
	ValidateInvocation    *rpcv9.FunctionInvocation `json:"validate_invocation,omitempty"`
	ExecuteInvocation     *rpcv9.ExecuteInvocation  `json:"execute_invocation,omitempty" validate:"required_if=Type INVOKE"` //nolint:lll // struct tag exceeds line limit
	FeeTransferInvocation *rpcv9.FunctionInvocation `json:"fee_transfer_invocation,omitempty"`
	ConstructorInvocation *rpcv9.FunctionInvocation `json:"constructor_invocation,omitempty" validate:"required_if=Type DEPLOY_ACCOUNT"` //nolint:lll // struct tag exceeds line limit
	FunctionInvocation    *rpcv9.ExecuteInvocation  `json:"function_invocation,omitempty" validate:"required_if=Type L1_HANDLER"`        //nolint:lll // struct tag exceeds line limit
	StateDiff             *StateDiff                `json:"state_diff,omitempty"`
	ExecutionResources    *rpcv9.ExecutionResources `json:"execution_resources"`
}

func AdaptVMTransactionTrace

func AdaptVMTransactionTrace(trace *vm.TransactionTrace) TransactionTrace

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL