Documentation ¶
Index ¶
- type API
- func (api API) BlockHashAndNumber(ctx context.Context, opts ...RequestOption) (*Response[BlockHashAndNumber], error)
- func (api API) BlockNumber(ctx context.Context, opts ...RequestOption) (*Response[uint64], error)
- func (api API) Call(ctx context.Context, params CallRequest, block data.BlockID, ...) (*Response[[]string], error)
- func (api API) ChainID(ctx context.Context, opts ...RequestOption) (*Response[string], error)
- func (api API) EstimateFee(ctx context.Context, tx data.Transaction, block data.BlockID, ...) (*Response[EstmatedGas], error)
- func (api API) GetBlockTransactionCount(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[uint64], error)
- func (api API) GetBlockWithTxHashes(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[BlockWithTxHashes], error)
- func (api API) GetBlockWithTxs(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[BlockWithTxs], error)
- func (api API) GetClass(ctx context.Context, block data.BlockID, classHash string, ...) (*Response[data.Class], error)
- func (api API) GetClassAt(ctx context.Context, block data.BlockID, contractAddress string, ...) (*Response[data.Class], error)
- func (api API) GetClassHashAt(ctx context.Context, block data.BlockID, contractAddress string, ...) (*Response[string], error)
- func (api API) GetEvents(ctx context.Context, filters EventsFilters, opts ...RequestOption) (*Response[EventsResponse], error)
- func (api API) GetNonce(ctx context.Context, contract string, block data.BlockID, ...) (*Response[string], error)
- func (api API) GetStateUpdate(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[data.StateUpdate], error)
- func (api API) GetStorageAt(ctx context.Context, contract, key string, block data.BlockID, ...) (*Response[string], error)
- func (api API) GetTransactionByBlockNumberAndIndex(ctx context.Context, block data.BlockID, index uint64, opts ...RequestOption) (*Response[data.Transaction], error)
- func (api API) GetTransactionByHash(ctx context.Context, hash string, opts ...RequestOption) (*Response[data.Transaction], error)
- func (api API) GetTransactionReceipts(ctx context.Context, hash string, opts ...RequestOption) (*Response[Receipt], error)
- func (api API) PendingTransactions(ctx context.Context, opts ...RequestOption) (*Response[data.Transaction], error)
- func (api API) Syncing(ctx context.Context, opts ...RequestOption) (*Response[Syncing], error)
- type ApiOption
- type BlockHashAndNumber
- type BlockWithTxHashes
- type BlockWithTxs
- type CallRequest
- type EstmatedGas
- type EventsFilters
- type EventsResponse
- type Receipt
- type Request
- type RequestOption
- type Response
- type Syncing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API - wrapper of starknet node API.
func (API) BlockHashAndNumber ¶
func (api API) BlockHashAndNumber(ctx context.Context, opts ...RequestOption) (*Response[BlockHashAndNumber], error)
BlockHashAndNumber - Get the most recent accepted block hash and number
func (API) BlockNumber ¶
BlockNumber - Get the most recent accepted block number
func (API) Call ¶
func (api API) Call(ctx context.Context, params CallRequest, block data.BlockID, opts ...RequestOption) (*Response[[]string], error)
Call - Calls a function in a contract and returns the return value. Using this call will not create a transaction; hence, will not change the state
func (API) EstimateFee ¶
func (api API) EstimateFee(ctx context.Context, tx data.Transaction, block data.BlockID, opts ...RequestOption) (*Response[EstmatedGas], error)
EstimateFee - estimates the resources required by a transaction relative to a given state
func (API) GetBlockTransactionCount ¶
func (api API) GetBlockTransactionCount(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[uint64], error)
GetBlockTransactionCount -
func (API) GetBlockWithTxHashes ¶
func (api API) GetBlockWithTxHashes(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[BlockWithTxHashes], error)
GetBlockWithTxHashes -
func (API) GetBlockWithTxs ¶
func (api API) GetBlockWithTxs(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[BlockWithTxs], error)
GetBlockWithTxs -
func (API) GetClass ¶
func (api API) GetClass(ctx context.Context, block data.BlockID, classHash string, opts ...RequestOption) (*Response[data.Class], error)
GetClass - Get the contract class definition in the given block associated with the given hash
func (API) GetClassAt ¶
func (api API) GetClassAt(ctx context.Context, block data.BlockID, contractAddress string, opts ...RequestOption) (*Response[data.Class], error)
GetClassAt -
func (API) GetClassHashAt ¶
func (api API) GetClassHashAt(ctx context.Context, block data.BlockID, contractAddress string, opts ...RequestOption) (*Response[string], error)
GetClassHashAt -
func (API) GetEvents ¶
func (api API) GetEvents(ctx context.Context, filters EventsFilters, opts ...RequestOption) (*Response[EventsResponse], error)
GetEvents - Returns all event objects matching the conditions in the provided filter
func (API) GetNonce ¶
func (api API) GetNonce(ctx context.Context, contract string, block data.BlockID, opts ...RequestOption) (*Response[string], error)
GetNonce -
func (API) GetStateUpdate ¶
func (api API) GetStateUpdate(ctx context.Context, block data.BlockID, opts ...RequestOption) (*Response[data.StateUpdate], error)
GetStateUpdate -
func (API) GetStorageAt ¶
func (api API) GetStorageAt(ctx context.Context, contract, key string, block data.BlockID, opts ...RequestOption) (*Response[string], error)
GetStorageAt -
func (API) GetTransactionByBlockNumberAndIndex ¶
func (api API) GetTransactionByBlockNumberAndIndex(ctx context.Context, block data.BlockID, index uint64, opts ...RequestOption) (*Response[data.Transaction], error)
GetTransactionByBlockNumberAndIndex - Get the details of the transaction given by the identified block and index in that block. If no transaction is found, null is returned.
func (API) GetTransactionByHash ¶
func (api API) GetTransactionByHash(ctx context.Context, hash string, opts ...RequestOption) (*Response[data.Transaction], error)
GetTransactionByHash -
func (API) GetTransactionReceipts ¶
func (api API) GetTransactionReceipts(ctx context.Context, hash string, opts ...RequestOption) (*Response[Receipt], error)
GetTransactionReceipts -
func (API) PendingTransactions ¶
func (api API) PendingTransactions(ctx context.Context, opts ...RequestOption) (*Response[data.Transaction], error)
PendingTransactions - Returns the transactions in the transaction pool, recognized by this sequencer
type BlockHashAndNumber ¶
type BlockHashAndNumber struct { Hash string `json:"block_hash"` Number uint64 `json:"block_number"` }
BlockHashAndNumber -
type BlockWithTxHashes ¶
type BlockWithTxHashes struct { Status string `json:"status"` BlockHash string `json:"block_hash"` ParentHash string `json:"parent_hash"` BlockNumber uint64 `json:"block_number"` NewRoot string `json:"new_root"` Timestamp int64 `json:"timestamp"` SequencerAddress string `json:"sequencer_address"` Transactions []string `json:"transactions"` }
BlockWithTxHashes -
type BlockWithTxs ¶
type BlockWithTxs struct { Status string `json:"status"` BlockHash string `json:"block_hash"` ParentHash string `json:"parent_hash"` BlockNumber uint64 `json:"block_number"` NewRoot string `json:"new_root"` Timestamp int64 `json:"timestamp"` SequencerAddress string `json:"sequencer_address"` Transactions []data.Transaction `json:"transactions"` }
BlockWithTxs -
type CallRequest ¶
type CallRequest struct { ContractAddress string `json:"contract_address"` EntrypointSelector string `json:"entry_point_selector"` Calldata []string `json:"calldata"` }
CallRequest -
type EstmatedGas ¶
type EstmatedGas struct { GasConsumed string `json:"gas_consumed"` GasPrice string `json:"gas_price"` OverallFee string `json:"overall_fee"` }
EstmatedGas -
type EventsFilters ¶
type EventsFilters struct { FromBlock *data.BlockID `json:"from_block,omitempty"` ToBlock *data.BlockID `json:"to_block,omitempty"` Address string `json:"address,omitempty"` Keys [][]string `json:"keys"` ContinuationToken string `json:"continuation_token,omitempty"` ChunkSize int `json:"chunk_size"` }
EventsFilters -
type EventsResponse ¶
type EventsResponse struct { Events []data.Event `json:"events"` ContinuationToken string `json:"continuation_token"` }
EventsResponse -
type Receipt ¶
type Receipt struct { Type string `json:"type"` TransactionHash string `json:"transaction_hash"` ActualFee string `json:"actual_fee"` Status string `json:"status"` BlockHash string `json:"block_hash"` BlockNumber uint64 `json:"block_number"` MessagesSent []data.Message `json:"messages_sent"` Events []data.Event `json:"events"` ContractAddress string `json:"contract_address"` }
Receipt -
type Request ¶
type Request struct { Version string `json:"jsonrpc"` Method string `json:"method"` Params []any `json:"params"` ID uint64 `json:"id"` // contains filtered or unexported fields }
Request -
type RequestOption ¶
type RequestOption func(*Request)
RequestOption -
func WithCustomID ¶
func WithCustomID(id uint64) RequestOption
WithCustomID - set custom request id. Request id increment automatically per request.
func WithJsonRpcVersion ¶
func WithJsonRpcVersion(version string) RequestOption
WithJsonRpcVersion - change json rpc version. Default: 2.0
func WithTimeout ¶
func WithTimeout(timeout uint64) RequestOption
WithTimeout - set custom timeout in seconds. Default: 10 seconds
type Response ¶
type Response[T any] struct { Version string `json:"jsonrpc"` Result T `json:"result,omitempty"` ID uint64 `json:"id"` Error *data.Error `json:"error,omitempty"` }
Response -
type Syncing ¶
type Syncing struct { Synced bool `json:"-"` StartingBlockNum string `json:"starting_block_num"` CurrentBlockNum string `json:"current_block_num"` HighestBlockNum string `json:"highest_block_num"` StartingBlockHash string `json:"starting_block_hash"` CurrentBlockHash string `json:"current_block_hash"` HighestBlockHash string `json:"highest_block_hash"` }
Syncing -
Source Files ¶
- api.go
- block_hash_and_number.go
- block_number.go
- call.go
- chain_id.go
- data.go
- estimate_fee.go
- get_block_transaction_count.go
- get_block_with_tx_hashes.go
- get_block_with_txs.go
- get_class.go
- get_class_at.go
- get_class_hash_at.go
- get_events.go
- get_nonce.go
- get_state_update.go
- get_storage_at.go
- get_transaction_by_block_and_index.go
- get_transaction_by_hash.go
- get_transaction_receipts.go
- options.go
- pending_transactions.go
- post.go
- syncing.go