Documentation
¶
Index ¶
- Constants
- Variables
- func AdaptBroadcastedTransaction(ctx context.Context, compiler compiler.Compiler, ...) (core.Transaction, core.ClassDefinition, *felt.Felt, error)
- func MakeContractError(err json.RawMessage) *jsonrpc.Error
- func Validator() *validator.Validate
- type AddTxResponse
- type BinaryNode
- type BlockHashAndNumber
- type BlockHeader
- type BlockID
- type BlockStatus
- type BlockWithReceipts
- type BlockWithTxHashes
- type BlockWithTxs
- type BroadcastedTransaction
- type BroadcastedTransactionInputs
- type CalldataInputs
- type CasmCompiledContractClass
- type CasmEntryPoint
- type Class
- type ComputationResources
- type ContractErrorData
- type ContractProof
- type DataAvailabilityMode
- type DeclaredClass
- type DeployedContract
- type EdgeNode
- type EmittedEvent
- type Entry
- type EntryPoint
- type EntryPoints
- type EntryPointsByType
- type Event
- type EventFilter
- type EventsArg
- type EventsChunk
- type ExecuteInvocation
- type ExecutionResources
- type FeeEstimate
- type FeePayment
- type FeeUnit
- type FunctionCall
- type FunctionInvocation
- type GlobalRoots
- type Handler
- func (h *Handler) AddTransaction(ctx context.Context, tx *BroadcastedTransaction) (AddTxResponse, *jsonrpc.Error)
- func (h *Handler) BlockHashAndNumber() (*BlockHashAndNumber, *jsonrpc.Error)
- func (h *Handler) BlockNumber() (uint64, *jsonrpc.Error)
- func (h *Handler) BlockTransactionCount(id BlockID) (uint64, *jsonrpc.Error)
- func (h *Handler) BlockWithReceipts(id *BlockID) (*BlockWithReceipts, *jsonrpc.Error)
- func (h *Handler) BlockWithTxHashes(id *BlockID) (*BlockWithTxHashes, *jsonrpc.Error)
- func (h *Handler) BlockWithTxs(blockID *BlockID) (*BlockWithTxs, *jsonrpc.Error)
- func (h *Handler) Call(funcCall *FunctionCall, id *BlockID) ([]*felt.Felt, *jsonrpc.Error)
- func (h *Handler) ChainID() (*felt.Felt, *jsonrpc.Error)
- func (h *Handler) Class(id BlockID, classHash felt.Felt) (*Class, *jsonrpc.Error)
- func (h *Handler) ClassAt(id BlockID, address felt.Felt) (*Class, *jsonrpc.Error)
- func (h *Handler) ClassHashAt(id BlockID, address felt.Felt) (*felt.Felt, *jsonrpc.Error)
- func (h *Handler) CompiledCasm(classHash *felt.Felt) (CasmCompiledContractClass, *jsonrpc.Error)
- func (h *Handler) EstimateFee(ctx context.Context, broadcastedTxns BroadcastedTransactionInputs, ...) ([]FeeEstimate, http.Header, *jsonrpc.Error)
- func (h *Handler) EstimateMessageFee(ctx context.Context, msg *MsgFromL1, id *BlockID) (FeeEstimate, http.Header, *jsonrpc.Error)
- func (h *Handler) Events(args EventsArg) (*EventsChunk, *jsonrpc.Error)
- func (h *Handler) GetMessageStatus(ctx context.Context, l1TxnHash *common.Hash) ([]MsgStatus, *jsonrpc.Error)
- func (h *Handler) Nonce(id BlockID, address felt.Felt) (*felt.Felt, *jsonrpc.Error)
- func (h *Handler) Pending() (*pendingpkg.Pending, error)
- func (h *Handler) PendingBlock() *core.Block
- func (h *Handler) Run(ctx context.Context) error
- func (h *Handler) SimulateTransactions(ctx context.Context, id *BlockID, transactions BroadcastedTransactionInputs, ...) ([]SimulatedTransaction, http.Header, *jsonrpc.Error)
- func (h *Handler) SpecVersion() (string, *jsonrpc.Error)
- func (h *Handler) StateUpdate(id BlockID) (*StateUpdate, *jsonrpc.Error)
- func (h *Handler) StorageAt(address, key *felt.Felt, id *BlockID) (*felt.Felt, *jsonrpc.Error)
- func (h *Handler) StorageProof(id *BlockID, classes, contracts []felt.Felt, storageKeys []StorageKeys) (*StorageProofResult, *jsonrpc.Error)
- func (h *Handler) SubscribeEvents(ctx context.Context, fromAddr *felt.Address, keys [][]felt.Felt, ...) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) SubscribeNewHeads(ctx context.Context, blockID *SubscriptionBlockID) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) SubscribePendingTxs(ctx context.Context, getDetails *bool, senderAddr []felt.Felt) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) SubscribeTransactionStatus(ctx context.Context, txHash *felt.Felt) (SubscriptionID, *jsonrpc.Error)
- func (h *Handler) Syncing() (*Sync, *jsonrpc.Error)
- func (h *Handler) TraceBlockTransactions(ctx context.Context, id *BlockID) ([]TracedBlockTransaction, http.Header, *jsonrpc.Error)
- func (h *Handler) TraceTransaction(ctx context.Context, hash felt.Felt) (*TransactionTrace, http.Header, *jsonrpc.Error)
- func (h *Handler) TransactionByBlockIDAndIndex(blockID *BlockID, txIndex int) (*Transaction, *jsonrpc.Error)
- func (h *Handler) TransactionByHash(hash felt.Felt) (*Transaction, *jsonrpc.Error)
- func (h *Handler) TransactionReceiptByHash(hash felt.Felt) (*TransactionReceipt, *jsonrpc.Error)
- func (h *Handler) TransactionStatus(ctx context.Context, hash felt.Felt) (*TransactionStatus, *jsonrpc.Error)
- func (h *Handler) TransactionStatusV0_7(ctx context.Context, hash felt.Felt) (*TransactionStatusV0_7, *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) WithCompiler(compiler compiler.Compiler) *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) WithReceivedTransactionFeed(feed *feed.Feed[core.Transaction]) *Handler
- func (h *Handler) WithSubmittedTransactionsCache(cache *rpccore.TransactionCache) *Handler
- type HashToNode
- type InnerExecutionResources
- type L1DAMode
- type LeafData
- type MsgFromL1
- type MsgStatus
- type MsgToL1
- type Node
- type Nonce
- type OrderedEvent
- type OrderedL2toL1Message
- type ReorgEvent
- type ReplacedClass
- type Resource
- type ResourceBounds
- type ResourceBoundsMap
- type ResourcePrice
- type ResultPageRequest
- type SimulatedTransaction
- type SimulationFlag
- type StateDiff
- type StateUpdate
- type StorageDiff
- type StorageKeys
- type StorageProofResult
- type SubscriptionBlockID
- func (b *SubscriptionBlockID) Hash() *felt.Felt
- func (b *SubscriptionBlockID) IsHash() bool
- func (b *SubscriptionBlockID) IsLatest() bool
- func (b *SubscriptionBlockID) IsNumber() bool
- func (b *SubscriptionBlockID) Number() uint64
- func (b *SubscriptionBlockID) Type() blockIDType
- func (b *SubscriptionBlockID) UnmarshalJSON(data []byte) error
- type SubscriptionID
- type SubscriptionResponse
- type SubscriptionTransactionStatus
- type Sync
- type TracedBlockTransaction
- type Transaction
- type TransactionExecutionErrorData
- type TransactionReceipt
- type TransactionStatus
- type TransactionStatusV0_7
- type TransactionTrace
- type TransactionType
- type TransactionWithReceipt
- type TxnExecutionStatus
- type TxnFinalityStatus
- type TxnStatus
Constants ¶
const ( MissingContractAddress = "missing field: contract_address" MissingStorageKeys = "missing field: storage_keys" )
const ExecutionStepsHeader string = "X-Cairo-Steps"
Variables ¶
Functions ¶
func AdaptBroadcastedTransaction ¶ added in v0.14.4
func AdaptBroadcastedTransaction( ctx context.Context, compiler compiler.Compiler, broadcastedTxn *BroadcastedTransaction, network *utils.Network, ) (core.Transaction, core.ClassDefinition, *felt.Felt, error)
func MakeContractError ¶
func MakeContractError(err json.RawMessage) *jsonrpc.Error
Types ¶
type AddTxResponse ¶
type BinaryNode ¶
func (*BinaryNode) AsProofNode ¶
func (b *BinaryNode) AsProofNode() trie.ProofNode
type BlockHashAndNumber ¶ added in v0.16.0
type BlockHashAndNumber struct {
Hash *felt.Felt `json:"block_hash"`
Number uint64 `json:"block_number"`
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L733-L751
type BlockHeader ¶
type BlockHeader struct {
Hash *felt.Felt `json:"block_hash,omitempty"`
ParentHash *felt.Felt `json:"parent_hash"`
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 *ResourcePrice `json:"l1_gas_price"`
L1DataGasPrice *ResourcePrice `json:"l1_data_gas_price,omitempty"`
L1DAMode *L1DAMode `json:"l1_da_mode,omitempty"`
StarknetVersion string `json:"starknet_version"`
L2GasPrice *ResourcePrice `json:"l2_gas_price"`
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L1544
type BlockID ¶
type BlockID struct {
// contains filtered or unexported fields
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L1190
func BlockIDFromHash ¶ added in v0.14.5
func BlockIDFromNumber ¶ added in v0.14.5
func BlockIDPending ¶ added in v0.15.2
func BlockIDPending() BlockID
func (*BlockID) UnmarshalJSON ¶
type BlockStatus ¶ added in v0.16.0
type BlockStatus uint8
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L3129
const ( BlockPending BlockStatus = iota BlockAcceptedL2 BlockAcceptedL1 BlockRejected )
func (BlockStatus) MarshalText ¶ added in v0.16.0
func (s BlockStatus) MarshalText() ([]byte, error)
type BlockWithReceipts ¶
type BlockWithReceipts struct {
Status BlockStatus `json:"status,omitempty"`
BlockHeader
Transactions []TransactionWithReceipt `json:"transactions"`
}
type BlockWithTxHashes ¶
type BlockWithTxHashes struct {
Status BlockStatus `json:"status,omitempty"`
BlockHeader
TxnHashes []*felt.Felt `json:"transactions"`
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L1680
type BlockWithTxs ¶
type BlockWithTxs struct {
Status BlockStatus `json:"status,omitempty"`
BlockHeader
Transactions []*Transaction `json:"transactions"`
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L1705
type BroadcastedTransaction ¶
type BroadcastedTransaction struct {
Transaction
ContractClass json.RawMessage `json:"contract_class,omitempty" validate:"required_if=Transaction.Type DECLARE"`
PaidFeeOnL1 *felt.Felt `json:"paid_fee_on_l1,omitempty" validate:"required_if=Transaction.Type L1_HANDLER"`
}
type BroadcastedTransactionInputs ¶ added in v0.15.8
type BroadcastedTransactionInputs = rpccore.LimitSlice[ BroadcastedTransaction, rpccore.SimulationLimit, ]
type CalldataInputs ¶ added in v0.15.8
type CalldataInputs = rpccore.LimitSlice[felt.Felt, rpccore.FunctionCalldataLimit]
type CasmCompiledContractClass ¶
type CasmCompiledContractClass struct {
EntryPointsByType EntryPointsByType `json:"entry_points_by_type"`
// can't use felt.Felt here because prime is larger than felt
Prime string `json:"prime"`
CompilerVersion string `json:"compiler_version"`
Bytecode []*felt.Felt `json:"bytecode"`
Hints json.RawMessage `json:"hints"`
BytecodeSegmentLengths []int `json:"bytecode_segment_lengths,omitempty"`
}
CasmCompiledContractClass follows this specification: https://github.com/starkware-libs/starknet-specs/blob/v0.8.0-rc0/api/starknet_executables.json#L45
type CasmEntryPoint ¶
type Class ¶
type Class struct {
SierraProgram []*felt.Felt `json:"sierra_program,omitempty"`
Program string `json:"program,omitempty"`
ContractClassVersion string `json:"contract_class_version,omitempty"`
EntryPoints EntryPoints `json:"entry_points_by_type"`
Abi any `json:"abi"`
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L3159
type ComputationResources ¶
type ComputationResources struct {
Steps uint64 `json:"steps"`
MemoryHoles uint64 `json:"memory_holes,omitempty"`
Pedersen uint64 `json:"pedersen_builtin_applications,omitempty"`
RangeCheck uint64 `json:"range_check_builtin_applications,omitempty"`
Bitwise uint64 `json:"bitwise_builtin_applications,omitempty"`
Ecdsa uint64 `json:"ecdsa_builtin_applications,omitempty"`
EcOp uint64 `json:"ec_op_builtin_applications,omitempty"`
Keccak uint64 `json:"keccak_builtin_applications,omitempty"`
Poseidon uint64 `json:"poseidon_builtin_applications,omitempty"`
SegmentArena uint64 `json:"segment_arena_builtin,omitempty"`
}
type ContractErrorData ¶
type ContractErrorData struct {
RevertError json.RawMessage `json:"revert_error"`
}
type ContractProof ¶
type ContractProof struct {
Nodes []*HashToNode `json:"nodes"`
LeavesData []*LeafData `json:"contract_leaves_data"`
}
type DataAvailabilityMode ¶
type DataAvailabilityMode uint32
const ( DAModeL1 DataAvailabilityMode = iota DAModeL2 )
func (DataAvailabilityMode) MarshalText ¶
func (m DataAvailabilityMode) MarshalText() ([]byte, error)
func (*DataAvailabilityMode) UnmarshalJSON ¶
func (m *DataAvailabilityMode) UnmarshalJSON(data []byte) error
type DeclaredClass ¶ added in v0.16.0
type DeployedContract ¶ added in v0.16.0
type EdgeNode ¶
type EdgeNode struct {
Path string `json:"path"`
Length int `json:"length"`
Child *felt.Felt `json:"child"`
}
func (*EdgeNode) AsProofNode ¶
type EmittedEvent ¶
type EntryPoint ¶
type EntryPoints ¶
type EntryPoints struct {
Constructor []EntryPoint `json:"CONSTRUCTOR"`
External []EntryPoint `json:"EXTERNAL"`
L1Handler []EntryPoint `json:"L1_HANDLER"`
}
type EntryPointsByType ¶
type EntryPointsByType struct {
Constructor []CasmEntryPoint `json:"CONSTRUCTOR"`
External []CasmEntryPoint `json:"EXTERNAL"`
L1Handler []CasmEntryPoint `json:"L1_HANDLER"`
}
type EventFilter ¶ added in v0.16.0
type EventsArg ¶ added in v0.16.0
type EventsArg struct {
EventFilter
ResultPageRequest
}
type EventsChunk ¶ added in v0.16.0
type EventsChunk struct {
Events []EmittedEvent `json:"events"`
ContinuationToken string `json:"continuation_token,omitempty"`
}
type ExecuteInvocation ¶ added in v0.13.3
type ExecuteInvocation struct {
RevertReason string `json:"revert_reason"`
*FunctionInvocation `json:",omitempty"`
}
func (ExecuteInvocation) MarshalJSON ¶ added in v0.13.3
func (e ExecuteInvocation) MarshalJSON() ([]byte, error)
type ExecutionResources ¶
type ExecutionResources struct {
InnerExecutionResources
L1DataGas uint64 `json:"l1_data_gas"`
}
type FeeEstimate ¶
type FeeEstimate struct {
L1GasConsumed *felt.Felt `json:"l1_gas_consumed,omitempty"`
L1GasPrice *felt.Felt `json:"l1_gas_price,omitempty"`
L2GasConsumed *felt.Felt `json:"l2_gas_consumed,omitempty"`
L2GasPrice *felt.Felt `json:"l2_gas_price,omitempty"`
L1DataGasConsumed *felt.Felt `json:"l1_data_gas_consumed,omitempty"`
L1DataGasPrice *felt.Felt `json:"l1_data_gas_price,omitempty"`
OverallFee *felt.Felt `json:"overall_fee"`
Unit *FeeUnit `json:"unit,omitempty"`
}
type FeePayment ¶
type FunctionCall ¶
type FunctionCall struct {
ContractAddress felt.Felt `json:"contract_address"`
EntryPointSelector felt.Felt `json:"entry_point_selector"`
Calldata CalldataInputs `json:"calldata"`
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L3135
type FunctionInvocation ¶ added in v0.13.3
type FunctionInvocation struct {
ContractAddress felt.Felt `json:"contract_address"`
EntryPointSelector *felt.Felt `json:"entry_point_selector"`
Calldata []felt.Felt `json:"calldata"`
CallerAddress felt.Felt `json:"caller_address"`
ClassHash *felt.Felt `json:"class_hash"`
EntryPointType string `json:"entry_point_type"`
CallType string `json:"call_type"`
Result []felt.Felt `json:"result"`
Calls []FunctionInvocation `json:"calls"`
Events []OrderedEvent `json:"events"`
Messages []OrderedL2toL1Message `json:"messages"`
ExecutionResources *InnerExecutionResources `json:"execution_resources"`
IsReverted bool `json:"is_reverted"`
}
func DefaultL1HandlerFunctionInvocation ¶ added in v0.15.0
func DefaultL1HandlerFunctionInvocation() FunctionInvocation
type GlobalRoots ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) AddTransaction ¶
func (h *Handler) AddTransaction(ctx context.Context, tx *BroadcastedTransaction) (AddTxResponse, *jsonrpc.Error)
AddTransaction relays a transaction to the gateway, or to the sequencer if enabled
func (*Handler) BlockHashAndNumber ¶ added in v0.16.0
func (h *Handler) BlockHashAndNumber() (*BlockHashAndNumber, *jsonrpc.Error)
BlockHashAndNumber returns the block hash and number of the latest synced block.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L730
func (*Handler) BlockNumber ¶ added in v0.16.0
***************************************************
Block Handlers
**************************************************** BlockNumber returns the latest synced block number.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L712
func (*Handler) BlockTransactionCount ¶ added in v0.16.0
BlockTransactionCount returns the number of transactions in a block identified by the given BlockID.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L531
func (*Handler) BlockWithReceipts ¶
func (h *Handler) BlockWithReceipts(id *BlockID) (*BlockWithReceipts, *jsonrpc.Error)
func (*Handler) BlockWithTxHashes ¶
func (h *Handler) BlockWithTxHashes(id *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/v0.8.1/api/starknet_api_openrpc.json#L25
func (*Handler) BlockWithTxs ¶
func (h *Handler) BlockWithTxs(blockID *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/v0.8.1/api/starknet_api_openrpc.json#L62
func (*Handler) ChainID ¶ added in v0.16.0
ChainID returns the chain ID of the currently configured network.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L759
func (*Handler) Class ¶
Class gets the contract class definition in the given block associated with the given hash
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L393
func (*Handler) ClassAt ¶ added in v0.16.0
ClassAt gets the contract class definition in the given block instantiated by the given contract address
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L482
func (*Handler) ClassHashAt ¶ added in v0.16.0
ClassHashAt gets the class hash for the contract deployed at the given address in the given block.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L442
func (*Handler) CompiledCasm ¶
func (*Handler) EstimateFee ¶
func (h *Handler) EstimateFee( ctx context.Context, broadcastedTxns BroadcastedTransactionInputs, simulationFlags []SimulationFlag, id *BlockID, ) ([]FeeEstimate, http.Header, *jsonrpc.Error)
func (*Handler) EstimateMessageFee ¶
func (*Handler) Events ¶ added in v0.16.0
func (h *Handler) Events(args EventsArg) (*EventsChunk, *jsonrpc.Error)
Events gets the events matching a filter
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L796
func (*Handler) GetMessageStatus ¶
func (*Handler) Nonce ¶ added in v0.16.0
Nonce returns the nonce associated with the given address in the given block number
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L843
func (*Handler) PendingBlock ¶ added in v0.15.0
func (*Handler) SimulateTransactions ¶
func (h *Handler) SimulateTransactions( ctx context.Context, id *BlockID, transactions BroadcastedTransactionInputs, simulationFlags []SimulationFlag, ) ([]SimulatedTransaction, http.Header, *jsonrpc.Error)
func (*Handler) StateUpdate ¶ added in v0.16.0
func (h *Handler) StateUpdate(id 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/v0.8.1/api/starknet_api_openrpc.json#L136
func (*Handler) StorageAt ¶
StorageAt gets the value of the storage at the given address and key.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/a789ccc3432c57777beceaa53a34a7ae2f25fda0/api/starknet_api_openrpc.json#L110
func (*Handler) StorageProof ¶
func (h *Handler) StorageProof( id *BlockID, classes, contracts []felt.Felt, storageKeys []StorageKeys, ) (*StorageProofResult, *jsonrpc.Error)
func (*Handler) SubscribeEvents ¶
func (h *Handler) SubscribeEvents( ctx context.Context, fromAddr *felt.Address, keys [][]felt.Felt, blockID *SubscriptionBlockID, ) (SubscriptionID, *jsonrpc.Error)
SubscribeEvents creates a WebSocket stream which will fire events for new Starknet events with applied filters
func (*Handler) SubscribeNewHeads ¶
func (h *Handler) SubscribeNewHeads(ctx context.Context, blockID *SubscriptionBlockID) (SubscriptionID, *jsonrpc.Error)
SubscribeNewHeads creates a WebSocket stream which will fire events when a new block header is added.
func (*Handler) SubscribePendingTxs ¶
func (h *Handler) SubscribePendingTxs(ctx context.Context, getDetails *bool, senderAddr []felt.Felt) (SubscriptionID, *jsonrpc.Error)
SubscribePendingTxs creates a WebSocket stream which will fire events when a new pending transaction is added. The getDetails flag controls if the response will contain the transaction details or just the transaction hashes. The senderAddr flag is used to filter the transactions by sender address.
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. The optional block_id parameter is ignored, as status changes are not stored and historical data cannot be sent.
func (*Handler) Syncing ¶ added in v0.16.0
Syncing returns the syncing status of the node.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L772
func (*Handler) TraceBlockTransactions ¶
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/1ae810e0137cc5d175ace4554892a4f43052be56/api/starknet_trace_api_openrpc.json#L11
func (*Handler) TransactionByBlockIDAndIndex ¶
func (h *Handler) TransactionByBlockIDAndIndex( blockID *BlockID, txIndex int, ) (*Transaction, *jsonrpc.Error)
TransactionByBlockIDAndIndex returns the details of a transaction identified by the given BlockID and index.
It follows the specification defined here: https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json#L184
func (*Handler) TransactionByHash ¶
TransactionByHash returns the details 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#L158
func (*Handler) TransactionReceiptByHash ¶
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) TransactionStatusV0_7 ¶
func (*Handler) Unsubscribe ¶
func (*Handler) WithCallMaxGas ¶ added in v0.15.8
func (*Handler) WithCallMaxSteps ¶
func (*Handler) WithCompiler ¶ added in v0.15.20
func (*Handler) WithFilterLimit ¶
WithFilterLimit sets the maximum number of blocks to scan in a single call for event filtering.
func (*Handler) WithMempool ¶ added in v0.14.4
func (*Handler) WithReceivedTransactionFeed ¶ added in v0.16.0
func (*Handler) WithSubmittedTransactionsCache ¶ added in v0.15.0
func (h *Handler) WithSubmittedTransactionsCache(cache *rpccore.TransactionCache) *Handler
type HashToNode ¶
type InnerExecutionResources ¶ added in v0.13.3
type MsgFromL1 ¶
type MsgFromL1 struct {
// The address of the L1 contract sending the message.
From common.Address `json:"from_address" validate:"required"`
// The address of the L2 contract receiving the message.
To felt.Felt `json:"to_address" validate:"required"`
// The payload of the message.
Payload []felt.Felt `json:"payload" validate:"required"`
Selector felt.Felt `json:"entry_point_selector" validate:"required"`
}
type OrderedEvent ¶ added in v0.16.0
type OrderedL2toL1Message ¶ added in v0.16.0
type ReorgEvent ¶
type ReplacedClass ¶ added in v0.16.0
type Resource ¶
type Resource uint32
func (Resource) MarshalText ¶
func (*Resource) UnmarshalJSON ¶
func (*Resource) UnmarshalText ¶
type ResourceBounds ¶
type ResourceBoundsMap ¶ added in v0.14.4
type ResourceBoundsMap struct {
L1Gas *ResourceBounds `json:"l1_gas" validate:"required"`
L2Gas *ResourceBounds `json:"l2_gas" validate:"required"`
L1DataGas *ResourceBounds `json:"l1_data_gas" validate:"required"`
}
TODO: using Value fields here is a good idea, however we are currently keeping the field's type Reference since the current validation tags we are using does not work well with Value field. We should revisit this when we start implementing custom validations.
func (*ResourceBoundsMap) MarshalJSON ¶ added in v0.14.4
func (r *ResourceBoundsMap) MarshalJSON() ([]byte, error)
type ResourcePrice ¶ added in v0.16.0
type ResultPageRequest ¶ added in v0.16.0
type SimulatedTransaction ¶
type SimulatedTransaction struct {
TransactionTrace *TransactionTrace `json:"transaction_trace,omitempty"`
FeeEstimation FeeEstimate `json:"fee_estimation,omitzero"`
}
type SimulationFlag ¶
type SimulationFlag int
const ( SkipValidateFlag SimulationFlag = iota + 1 SkipFeeChargeFlag )
func (*SimulationFlag) UnmarshalJSON ¶
func (s *SimulationFlag) UnmarshalJSON(bytes []byte) (err error)
type StateDiff ¶ added in v0.16.0
type StateDiff struct {
StorageDiffs []StorageDiff `json:"storage_diffs"`
Nonces []Nonce `json:"nonces"`
DeployedContracts []DeployedContract `json:"deployed_contracts"`
DeprecatedDeclaredClasses []*felt.Felt `json:"deprecated_declared_classes"`
DeclaredClasses []DeclaredClass `json:"declared_classes"`
ReplacedClasses []ReplacedClass `json:"replaced_classes"`
}
func AdaptVMStateDiff ¶ added in v0.16.0
type StateUpdate ¶ added in v0.16.0
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/v0.8.1/api/starknet_api_openrpc.json#L1416
type StorageDiff ¶ added in v0.16.0
type StorageKeys ¶
type StorageProofResult ¶
type StorageProofResult struct {
ClassesProof []*HashToNode `json:"classes_proof"`
ContractsProof *ContractProof `json:"contracts_proof"`
ContractsStorageProofs [][]*HashToNode `json:"contracts_storage_proofs"`
GlobalRoots *GlobalRoots `json:"global_roots"`
}
type SubscriptionBlockID ¶
type SubscriptionBlockID BlockID
As per the spec, this is the same as BlockID, but without `pending`
func (*SubscriptionBlockID) Hash ¶
func (b *SubscriptionBlockID) Hash() *felt.Felt
func (*SubscriptionBlockID) IsHash ¶ added in v0.14.5
func (b *SubscriptionBlockID) IsHash() bool
func (*SubscriptionBlockID) IsLatest ¶
func (b *SubscriptionBlockID) IsLatest() bool
func (*SubscriptionBlockID) IsNumber ¶ added in v0.14.5
func (b *SubscriptionBlockID) IsNumber() bool
func (*SubscriptionBlockID) Number ¶
func (b *SubscriptionBlockID) Number() uint64
func (*SubscriptionBlockID) Type ¶ added in v0.14.5
func (b *SubscriptionBlockID) Type() blockIDType
func (*SubscriptionBlockID) UnmarshalJSON ¶
func (b *SubscriptionBlockID) UnmarshalJSON(data []byte) error
type SubscriptionID ¶
type SubscriptionID string
type SubscriptionResponse ¶
type SubscriptionTransactionStatus ¶
type SubscriptionTransactionStatus struct {
TransactionHash *felt.Felt `json:"transaction_hash"`
Status TransactionStatus `json:"status"`
}
type Sync ¶ added in v0.16.0
type Sync struct {
Syncing *bool `json:"-"`
StartingBlockHash *felt.Felt `json:"starting_block_hash,omitempty"`
StartingBlockNumber *uint64 `json:"starting_block_num,omitempty"`
CurrentBlockHash *felt.Felt `json:"current_block_hash,omitempty"`
CurrentBlockNumber *uint64 `json:"current_block_num,omitempty"`
HighestBlockHash *felt.Felt `json:"highest_block_hash,omitempty"`
HighestBlockNumber *uint64 `json:"highest_block_num,omitempty"`
}
https://github.com/starkware-libs/starknet-specs/blob/v0.8.1/api/starknet_api_openrpc.json#L1228
func (Sync) MarshalJSON ¶ added in v0.16.0
type TracedBlockTransaction ¶
type TracedBlockTransaction struct {
TraceRoot *TransactionTrace `json:"trace_root,omitempty"`
TransactionHash *felt.Felt `json:"transaction_hash,omitempty"`
}
func AdaptFeederBlockTrace ¶ added in v0.13.3
func AdaptFeederBlockTrace(block *BlockWithTxs, blockTrace *starknet.BlockTrace) ([]TracedBlockTransaction, error)
type Transaction ¶
type Transaction struct {
Hash *felt.Felt `json:"transaction_hash,omitempty"`
Type TransactionType `json:"type" validate:"required"`
Version *felt.Felt `json:"version,omitempty" validate:"required,version_0x3"`
Nonce *felt.Felt `json:"nonce,omitempty" validate:"required"`
MaxFee *felt.Felt `json:"max_fee,omitempty"`
ContractAddress *felt.Felt `json:"contract_address,omitempty"`
ContractAddressSalt *felt.Felt `json:"contract_address_salt,omitempty" validate:"required_if=Type DEPLOY,required_if=Type DEPLOY_ACCOUNT"`
ClassHash *felt.Felt `json:"class_hash,omitempty" validate:"required_if=Type DEPLOY,required_if=Type DEPLOY_ACCOUNT"`
ConstructorCallData *[]*felt.Felt `json:"constructor_calldata,omitempty" validate:"required_if=Type DEPLOY,required_if=Type DEPLOY_ACCOUNT"`
SenderAddress *felt.Felt `json:"sender_address,omitempty" validate:"required_if=Type DECLARE,required_if=Type INVOKE"`
Signature *[]*felt.Felt `json:"signature,omitempty" validate:"required"`
CallData *[]*felt.Felt `json:"calldata,omitempty" validate:"required_if=Type INVOKE"`
EntryPointSelector *felt.Felt `json:"entry_point_selector,omitempty"`
CompiledClassHash *felt.Felt `json:"compiled_class_hash,omitempty"`
ResourceBounds *ResourceBoundsMap `json:"resource_bounds,omitempty" validate:"resource_bounds_required"`
Tip *felt.Felt `json:"tip,omitempty" validate:"required"`
PaymasterData *[]*felt.Felt `json:"paymaster_data,omitempty" validate:"required"`
AccountDeploymentData *[]*felt.Felt `json:"account_deployment_data,omitempty" validate:"required_if=Type INVOKE,required_if=Type DECLARE"`
NonceDAMode *DataAvailabilityMode `json:"nonce_data_availability_mode,omitempty" validate:"required"`
FeeDAMode *DataAvailabilityMode `json:"fee_data_availability_mode,omitempty" validate:"required"`
}
func AdaptTransaction ¶
func AdaptTransaction(t core.Transaction) *Transaction
type TransactionExecutionErrorData ¶
type TransactionExecutionErrorData struct {
TransactionIndex uint64 `json:"transaction_index"`
ExecutionError json.RawMessage `json:"execution_error"`
}
type TransactionReceipt ¶
type TransactionReceipt struct {
Type TransactionType `json:"type"`
Hash *felt.Felt `json:"transaction_hash"`
ActualFee *FeePayment `json:"actual_fee"`
ExecutionStatus TxnExecutionStatus `json:"execution_status"`
FinalityStatus TxnFinalityStatus `json:"finality_status"`
BlockHash *felt.Felt `json:"block_hash,omitempty"`
BlockNumber *uint64 `json:"block_number,omitempty"`
MessagesSent []*MsgToL1 `json:"messages_sent"`
Events []*Event `json:"events"`
ContractAddress *felt.Felt `json:"contract_address,omitempty"`
RevertReason string `json:"revert_reason,omitempty"`
ExecutionResources *ExecutionResources `json:"execution_resources,omitempty"`
MessageHash string `json:"message_hash,omitempty"`
}
https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json#L1871
func AdaptReceipt ¶
func AdaptReceipt(receipt *core.TransactionReceipt, txn core.Transaction, finalityStatus TxnFinalityStatus, blockHash *felt.Felt, blockNumber uint64, ) *TransactionReceipt
todo(Kirill): try to replace core.Transaction with rpc.Transaction type
type TransactionStatus ¶
type TransactionStatus struct {
Finality TxnStatus `json:"finality_status"`
Execution TxnExecutionStatus `json:"execution_status,omitempty"`
FailureReason string `json:"failure_reason,omitempty"`
}
type TransactionStatusV0_7 ¶
type TransactionStatusV0_7 struct {
Finality TxnStatus `json:"finality_status"`
Execution TxnExecutionStatus `json:"execution_status,omitempty"`
}
In 0.7.0, the failure reason is not returned in the TransactionStatus response.
type TransactionTrace ¶ added in v0.13.3
type TransactionTrace struct {
Type TransactionType `json:"type"`
ValidateInvocation *FunctionInvocation `json:"validate_invocation,omitempty"`
ExecuteInvocation *ExecuteInvocation `json:"execute_invocation,omitempty" validate:"required_if=Type INVOKE"`
FeeTransferInvocation *FunctionInvocation `json:"fee_transfer_invocation,omitempty"`
ConstructorInvocation *FunctionInvocation `json:"constructor_invocation,omitempty" validate:"required_if=Type DEPLOY_ACCOUNT"`
FunctionInvocation *FunctionInvocation `json:"function_invocation,omitempty" validate:"required_if=Type L1_HANDLER"`
StateDiff *StateDiff `json:"state_diff,omitempty"`
ExecutionResources *ExecutionResources `json:"execution_resources"`
}
func AdaptVMTransactionTrace ¶ added in v0.13.3
func AdaptVMTransactionTrace(trace *vm.TransactionTrace) TransactionTrace
type TransactionType ¶
type TransactionType uint8
const ( Invalid TransactionType = iota TxnDeclare TxnDeploy TxnDeployAccount TxnInvoke TxnL1Handler )
func (TransactionType) MarshalText ¶
func (t TransactionType) MarshalText() ([]byte, error)
func (TransactionType) String ¶
func (t TransactionType) String() string
func (*TransactionType) UnmarshalJSON ¶
func (t *TransactionType) UnmarshalJSON(data []byte) error
type TransactionWithReceipt ¶
type TransactionWithReceipt struct {
Transaction *Transaction `json:"transaction"`
Receipt *TransactionReceipt `json:"receipt"`
}
type TxnExecutionStatus ¶
type TxnExecutionStatus uint8
const ( TxnSuccess TxnExecutionStatus = iota + 1 TxnFailure )
func (TxnExecutionStatus) MarshalText ¶
func (es TxnExecutionStatus) MarshalText() ([]byte, error)
type TxnFinalityStatus ¶
type TxnFinalityStatus uint8
const ( TxnAcceptedOnL2 TxnFinalityStatus = iota + 3 TxnAcceptedOnL1 TxnPending )
func (TxnFinalityStatus) MarshalText ¶
func (fs TxnFinalityStatus) MarshalText() ([]byte, error)