Documentation
¶
Index ¶
- Constants
- type BlockHeader
- type BlockWithReceipts
- type BlockWithTxHashes
- type BlockWithTxs
- type BroadcastedTransactionInputs
- type EmittedEvent
- type EventArgs
- type EventFilter
- type EventsChunk
- type Handler
- func (h *Handler) BlockWithReceipts(id *rpcv9.BlockID) (*BlockWithReceipts, *jsonrpc.Error)
- func (h *Handler) BlockWithTxHashes(id *rpcv9.BlockID) (*BlockWithTxHashes, *jsonrpc.Error)
- func (h *Handler) BlockWithTxs(blockID *rpcv9.BlockID) (*BlockWithTxs, *jsonrpc.Error)
- func (h *Handler) Call(funcCall *rpcv9.FunctionCall, id *rpcv9.BlockID) ([]*felt.Felt, *jsonrpc.Error)
- func (h *Handler) Events(args EventArgs) (EventsChunk, *jsonrpc.Error)
- func (h *Handler) PendingBlock() *core.Block
- func (h *Handler) PendingData() (core.PendingData, error)
- func (h *Handler) PendingState() (core.StateReader, func() error, error)
- func (h *Handler) Run(ctx context.Context) error
- func (h *Handler) SimulateTransactions(id *rpcv9.BlockID, transactions BroadcastedTransactionInputs, ...) ([]SimulatedTransaction, http.Header, *jsonrpc.Error)
- func (h *Handler) SpecVersion() (string, *jsonrpc.Error)
- func (h *Handler) StateUpdate(id *rpcv9.BlockID) (StateUpdate, *jsonrpc.Error)
- func (h *Handler) SubscribeEvents(ctx context.Context, fromAddr *felt.Felt, keys [][]felt.Felt, ...) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) SubscribeNewHeads(ctx context.Context, blockID *rpcv9.SubscriptionBlockID) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) SubscribeNewTransactionReceipts(ctx context.Context, senderAddress []felt.Felt, ...) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) SubscribeNewTransactions(ctx context.Context, finalityStatus []rpcv9.TxnStatusWithoutL1, ...) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) SubscribeTransactionStatus(ctx context.Context, txHash *felt.Felt) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) TraceBlockTransactions(ctx context.Context, id *rpcv9.BlockID) ([]TracedBlockTransaction, http.Header, *jsonrpc.Error)
- func (h *Handler) TraceTransaction(ctx context.Context, hash *felt.Felt) (TransactionTrace, http.Header, *jsonrpc.Error)
- func (h *Handler) TransactionReceiptByHash(hash *felt.Felt) (*rpcv9.TransactionReceipt, *jsonrpc.Error)
- func (h *Handler) TransactionStatus(ctx context.Context, hash *felt.Felt) (rpcv9.TransactionStatus, *jsonrpc.Error)
- func (h *Handler) Unsubscribe(ctx context.Context, id string) (bool, *jsonrpc.Error)
- func (h *Handler) WithCallMaxGas(maxGas uint64) *Handler
- func (h *Handler) WithCallMaxSteps(maxSteps uint64) *Handler
- func (h *Handler) WithFeeder(feederClient *feeder.Client) *Handler
- func (h *Handler) WithFilterLimit(limit uint) *Handler
- func (h *Handler) WithGateway(gatewayClient rpccore.Gateway) *Handler
- func (h *Handler) WithIDGen(idgen func() string) *Handler
- func (h *Handler) WithL1Client(l1Client rpccore.L1Client) *Handler
- func (h *Handler) WithMempool(memPool mempool.Pool) *Handler
- func (h *Handler) WithSubmittedTransactionsCache(cache *rpccore.TransactionCache) *Handler
- type MigratedCompiledClass
- type SentEvent
- type SimulatedTransaction
- type StateDiff
- type StateUpdate
- type SubscriptionEmittedEvent
- type SubscriptionID
- type TracedBlockTransaction
- type TransactionTrace
Constants ¶
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"`
}
type BlockWithTxHashes ¶ added in v0.15.13
type BlockWithTxHashes struct {
Status rpcv9.BlockStatus `json:"status,omitempty"`
BlockHeader
TxnHashes []*felt.Felt `json:"transactions"`
}
type BlockWithTxs ¶ added in v0.15.13
type BlockWithTxs struct {
Status rpcv9.BlockStatus `json:"status,omitempty"`
BlockHeader
Transactions []*rpcv9.Transaction `json:"transactions"`
}
type BroadcastedTransactionInputs ¶
type BroadcastedTransactionInputs = rpccore.LimitSlice[ rpcv9.BroadcastedTransaction, rpccore.SimulationLimit, ]
type EmittedEvent ¶
type EventArgs ¶
type EventArgs struct {
EventFilter
rpcv6.ResultPageRequest
}
type EventFilter ¶
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 (*Handler) BlockWithReceipts ¶ added in v0.15.13
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
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
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) Call ¶ added in v0.15.13
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 (*Handler) PendingData ¶
func (h *Handler) PendingData() (core.PendingData, error)
func (*Handler) PendingState ¶
func (h *Handler) PendingState() (core.StateReader, func() error, error)
func (*Handler) SimulateTransactions ¶
func (h *Handler) SimulateTransactions( id *rpcv9.BlockID, transactions BroadcastedTransactionInputs, simulationFlags []rpcv6.SimulationFlag, ) ([]SimulatedTransaction, http.Header, *jsonrpc.Error)
func (*Handler) StateUpdate ¶
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 (*Handler) Unsubscribe ¶
func (*Handler) WithCallMaxGas ¶
func (*Handler) WithCallMaxSteps ¶
func (*Handler) WithFilterLimit ¶
WithFilterLimit sets the maximum number of blocks to scan in a single call for event filtering.
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 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 ¶
type StateUpdate ¶
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