Documentation
¶
Index ¶
- Constants
- Variables
- type AddDeclareTransactionOutput
- type AddDeclareTransactionResponse
- type AddDeployAccountTransactionResponse
- type AddInvokeTransactionResponse
- type BinaryNode
- type Block
- type BlockBodyWithReceipts
- type BlockHashAndNumberOutput
- type BlockHeader
- type BlockID
- type BlockStatus
- type BlockTag
- type BlockTransaction
- type BlockTxHashes
- type BlockWithReceipts
- type BroadcastDeclareTxnV3
- type BroadcastDeployAccountTxnV3
- type BroadcastInvokeTxnV3
- type BroadcastTxn
- type CallType
- type ClassOutput
- type CompilationErrData
- type ContractErrData
- type ContractExecutionError
- type ContractExecutionErrorInner
- type ContractLeavesData
- type ContractNonce
- type ContractStorageDiffItem
- type ContractStorageKeys
- type ContractsProof
- type DataAvailabilityMode
- type DeclareTxnTrace
- type DeclareTxnType
- type DeclareTxnV0
- type DeclareTxnV1
- type DeclareTxnV2
- type DeclareTxnV3
- type DeclaredClassesItem
- type DeployAccountTxnTrace
- type DeployAccountTxnV1
- type DeployAccountTxnV3
- type DeployAccountType
- type DeployTxn
- type DeployedContractItem
- type EdgeNode
- type EmittedEvent
- type EmittedEventWithFinalityStatus
- type EntryPointType
- type Event
- type EventChunk
- type EventContent
- type EventFilter
- type EventSubscriptionInput
- type EventsInput
- type ExecInvocation
- type ExecutionResources
- type FeeEstimation
- type FeeEstimationCommon
- type FeePayment
- type FnInvocation
- type FunctionCall
- type GlobalRoots
- type InnerCallExecutionResources
- type InvokeFunctionCall
- type InvokeTxnTrace
- type InvokeTxnType
- type InvokeTxnV0
- type InvokeTxnV1
- type InvokeTxnV3
- type L1DAMode
- type L1HandlerTxn
- type L1HandlerTxnTrace
- type MerkleNode
- type MessageFeeEstimation
- type MessageStatus
- type MsgFromL1
- type MsgToL1
- type NewTxnStatus
- type NodeHashToNode
- type NumAsHex
- type OrderedEvent
- type OrderedMsg
- type Pre_confirmedBlock
- type Pre_confirmedBlockHeader
- type Pre_confirmedBlockTxHashes
- type Pre_confirmedBlockWithReceipts
- type Pre_confirmedStateUpdate
- type PriceUnit
- type PriceUnitFri
- type PriceUnitWei
- type Provider
- func (provider *Provider) AddDeclareTransaction(ctx context.Context, declareTransaction *BroadcastDeclareTxnV3) (*AddDeclareTransactionResponse, error)
- func (provider *Provider) AddDeployAccountTransaction(ctx context.Context, deployAccountTransaction *BroadcastDeployAccountTxnV3) (*AddDeployAccountTransactionResponse, error)
- func (provider *Provider) AddInvokeTransaction(ctx context.Context, invokeTxn *BroadcastInvokeTxnV3) (*AddInvokeTransactionResponse, error)
- func (provider *Provider) BlockHashAndNumber(ctx context.Context) (*BlockHashAndNumberOutput, error)
- func (provider *Provider) BlockNumber(ctx context.Context) (uint64, error)
- func (provider *Provider) BlockTransactionCount(ctx context.Context, blockID BlockID) (uint64, error)
- func (provider *Provider) BlockWithReceipts(ctx context.Context, blockID BlockID) (interface{}, error)
- func (provider *Provider) BlockWithTxHashes(ctx context.Context, blockID BlockID) (interface{}, error)
- func (provider *Provider) BlockWithTxs(ctx context.Context, blockID BlockID) (interface{}, error)
- func (provider *Provider) Call(ctx context.Context, request FunctionCall, blockID BlockID) ([]*felt.Felt, error)
- func (provider *Provider) ChainID(ctx context.Context) (string, error)
- func (provider *Provider) Class(ctx context.Context, blockID BlockID, classHash *felt.Felt) (ClassOutput, error)
- func (provider *Provider) ClassAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (ClassOutput, error)
- func (provider *Provider) ClassHashAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error)
- func (provider *Provider) CompiledCasm(ctx context.Context, classHash *felt.Felt) (*contracts.CasmClass, error)
- func (provider *Provider) EstimateFee(ctx context.Context, requests []BroadcastTxn, simulationFlags []SimulationFlag, ...) ([]FeeEstimation, error)
- func (provider *Provider) EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (MessageFeeEstimation, error)
- func (provider *Provider) Events(ctx context.Context, input EventsInput) (*EventChunk, error)
- func (provider *Provider) GetMessagesStatus(ctx context.Context, transactionHash NumAsHex) ([]MessageStatus, error)
- func (provider *Provider) GetStorageProof(ctx context.Context, storageProofInput StorageProofInput) (*StorageProofResult, error)
- func (provider *Provider) GetTransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*TxnStatusResult, error)
- func (provider *Provider) Nonce(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error)
- func (provider *Provider) SimulateTransactions(ctx context.Context, blockID BlockID, txns []BroadcastTxn, ...) ([]SimulatedTransaction, error)
- func (provider *Provider) SpecVersion(ctx context.Context) (string, error)
- func (provider *Provider) StateUpdate(ctx context.Context, blockID BlockID) (*StateUpdateOutput, error)
- func (provider *Provider) StorageAt(ctx context.Context, contractAddress *felt.Felt, key string, blockID BlockID) (string, error)
- func (provider *Provider) Syncing(ctx context.Context) (SyncStatus, error)
- func (provider *Provider) TraceBlockTransactions(ctx context.Context, blockID BlockID) ([]Trace, error)
- func (provider *Provider) TraceTransaction(ctx context.Context, transactionHash *felt.Felt) (TxnTrace, error)
- func (provider *Provider) TransactionByBlockIdAndIndex(ctx context.Context, blockID BlockID, index uint64) (*BlockTransaction, error)
- func (provider *Provider) TransactionByHash(ctx context.Context, hash *felt.Felt) (*BlockTransaction, error)
- func (provider *Provider) TransactionReceipt(ctx context.Context, transactionHash *felt.Felt) (*TransactionReceiptWithBlockInfo, error)
- type RPCData
- type RPCError
- type ReplacedClassesItem
- type Resource
- type ResourceBounds
- type ResourceBoundsMapping
- type ResourcePrice
- type ResultPageRequest
- type RpcProvider
- type SimulateTransactionInput
- type SimulatedTransaction
- type SimulationFlag
- type StateDiff
- type StateUpdateOutput
- type StorageEntry
- type StorageProofInput
- type StorageProofResult
- type StringErrData
- type SubNewTxnReceiptsInput
- type SubNewTxnsInput
- type SubscriptionBlockID
- func (b *SubscriptionBlockID) BlockID() BlockID
- func (b SubscriptionBlockID) MarshalJSON() ([]byte, error)
- func (b *SubscriptionBlockID) UnmarshalJSON(data []byte) error
- func (b *SubscriptionBlockID) WithBlockHash(hash *felt.Felt) SubscriptionBlockID
- func (b *SubscriptionBlockID) WithBlockNumber(number uint64) SubscriptionBlockID
- func (b *SubscriptionBlockID) WithLatestTag() SubscriptionBlockID
- type SyncStatus
- type Trace
- type TraceStatus
- type TraceStatusErrData
- type Transaction
- type TransactionExecErrData
- type TransactionReceipt
- type TransactionReceiptWithBlockInfo
- type TransactionResponse
- type TransactionType
- type TransactionVersion
- type TransactionWithReceipt
- type TxDetails
- type TxnExecutionStatus
- type TxnFinalityStatus
- type TxnStatus
- type TxnStatusResult
- type TxnTrace
- type TxnWithHashAndStatus
- type U128
- type U64
- type WebsocketProvider
- type WsProvider
- func (p *WsProvider) Close()
- func (provider *WsProvider) SubscribeEvents(ctx context.Context, events chan<- *EmittedEventWithFinalityStatus, ...) (*client.ClientSubscription, error)
- func (provider *WsProvider) SubscribeNewHeads(ctx context.Context, headers chan<- *BlockHeader, ...) (*client.ClientSubscription, error)
- func (provider *WsProvider) SubscribeNewTransactionReceipts(ctx context.Context, txnReceipts chan<- *TransactionReceiptWithBlockInfo, ...) (*client.ClientSubscription, error)
- func (provider *WsProvider) SubscribeNewTransactions(ctx context.Context, newTxns chan<- *TxnWithHashAndStatus, ...) (*client.ClientSubscription, error)
- func (provider *WsProvider) SubscribeTransactionStatus(ctx context.Context, newStatus chan<- *NewTxnStatus, ...) (*client.ClientSubscription, error)
Constants ¶
const ( InvalidJSON = -32700 // Invalid JSON was received by the server. InvalidRequest = -32600 // The JSON sent is not a valid Request object. MethodNotFound = -32601 // The method does not exist / is not available. InvalidParams = -32602 // Invalid method parameter(s). InternalError = -32603 // Internal JSON-RPC error. )
Variables ¶
var ( ErrFailedToReceiveTxn = &RPCError{ Code: 1, Message: "Failed to write transaction", } ErrNoTraceAvailable = &RPCError{ Code: 10, Message: "No trace available for transaction", Data: &TraceStatusErrData{}, } ErrContractNotFound = &RPCError{ Code: 20, Message: "Contract not found", } ErrEntrypointNotFound = &RPCError{ Code: 21, Message: "Requested entrypoint does not exist in the contract", } ErrBlockNotFound = &RPCError{ Code: 24, Message: "Block not found", } ErrInvalidTxnHash = &RPCError{ Code: 25, Message: "Invalid transaction hash", } ErrInvalidBlockHash = &RPCError{ Code: 26, Message: "Invalid block hash", } ErrInvalidTxnIndex = &RPCError{ Code: 27, Message: "Invalid transaction index in a block", } ErrClassHashNotFound = &RPCError{ Code: 28, Message: "Class hash not found", } ErrHashNotFound = &RPCError{ Code: 29, Message: "Transaction hash not found", } ErrPageSizeTooBig = &RPCError{ Code: 31, Message: "Requested page size is too big", } ErrNoBlocks = &RPCError{ Code: 32, Message: "There are no blocks", } ErrInvalidContinuationToken = &RPCError{ Code: 33, Message: "The supplied continuation token is invalid or unknown", } ErrTooManyKeysInFilter = &RPCError{ Code: 34, Message: "Too many keys provided in a filter", } ErrContractError = &RPCError{ Code: 40, Message: "Contract error", Data: &ContractErrData{}, } ErrTxnExec = &RPCError{ Code: 41, Message: "Transaction execution error", Data: &TransactionExecErrData{}, } ErrStorageProofNotSupported = &RPCError{ Code: 42, Message: "the node doesn't support storage proofs for blocks that are too far in the past", } ErrInvalidContractClass = &RPCError{ Code: 50, Message: "Invalid contract class", } ErrClassAlreadyDeclared = &RPCError{ Code: 51, Message: "Class already declared", } ErrInvalidTransactionNonce = &RPCError{ Code: 52, Message: "Invalid transaction nonce", Data: StringErrData(""), } ErrInsufficientResourcesForValidate = &RPCError{ Code: 53, Message: "The transaction's resources don't cover validation or the minimal transaction fee", } ErrInsufficientAccountBalance = &RPCError{ Code: 54, Message: "Account balance is smaller than the transaction's maximal fee (calculated as the sum of each resource's limit x max price)", } ErrValidationFailure = &RPCError{ Code: 55, Message: "Account validation failed", Data: StringErrData(""), } ErrCompilationFailed = &RPCError{ Code: 56, Message: "Compilation failed", Data: StringErrData(""), } ErrContractClassSizeTooLarge = &RPCError{ Code: 57, Message: "Contract class size is too large", } ErrNonAccount = &RPCError{ Code: 58, Message: "Sender address is not an account contract", } ErrDuplicateTx = &RPCError{ Code: 59, Message: "A transaction with the same hash already exists in the mempool", } ErrCompiledClassHashMismatch = &RPCError{ Code: 60, Message: "The compiled class hash did not match the one supplied in the transaction", } ErrUnsupportedTxVersion = &RPCError{ Code: 61, Message: "The transaction version is not supported", } ErrUnsupportedContractClassVersion = &RPCError{ Code: 62, Message: "The contract class version is not supported", } ErrUnexpectedError = &RPCError{ Code: 63, Message: "An unexpected error occurred", Data: StringErrData(""), } ErrReplacementTransactionUnderpriced = &RPCError{ Code: 64, Message: "Replacement transaction is underpriced", } ErrFeeBelowMinimum = &RPCError{ Code: 65, Message: "Transaction fee below minimum", } ErrInvalidSubscriptionID = &RPCError{ Code: 66, Message: "Invalid subscription id", } ErrTooManyAddressesInFilter = &RPCError{ Code: 67, Message: "Too many addresses in filter sender_address filter", } ErrTooManyBlocksBack = &RPCError{ Code: 68, Message: "Cannot go back more than 1024 blocks", } ErrCompilationError = &RPCError{ Code: 100, Message: "Failed to compile the contract", Data: &CompilationErrData{}, } )
var ErrInvalidBlockID = errors.New("invalid blockid")
Functions ¶
This section is empty.
Types ¶
type AddDeclareTransactionOutput ¶
type AddDeclareTransactionOutput struct {
TransactionHash *felt.Felt `json:"transaction_hash"`
ClassHash *felt.Felt `json:"class_hash"`
}
AddDeclareTransactionOutput provides the output for AddDeclareTransaction.
type AddDeclareTransactionResponse ¶
type AddDeclareTransactionResponse struct {
Hash *felt.Felt `json:"transaction_hash"`
ClassHash *felt.Felt `json:"class_hash"`
}
AddDeclareTransactionResponse provides the output for AddDeclareTransaction.
type AddDeployAccountTransactionResponse ¶ added in v0.4.3
type AddDeployAccountTransactionResponse struct {
Hash *felt.Felt `json:"transaction_hash"`
ContractAddress *felt.Felt `json:"contract_address"`
}
AddDeployTransactionResponse provides the output for AddDeployTransaction.
type AddInvokeTransactionResponse ¶
AddInvokeTransactionResponse provides the output for AddInvokeTransaction.
type BinaryNode ¶ added in v0.8.0
type BinaryNode struct {
// the hash of the left child
Left *felt.Felt `json:"left"`
// the hash of the right child
Right *felt.Felt `json:"right"`
}
An internal node whose both children are non-zero
type Block ¶
type Block struct {
BlockHeader
Status BlockStatus `json:"status"`
// Transactions The transactions in this block
Transactions []BlockTransaction `json:"transactions"`
}
type BlockBodyWithReceipts ¶ added in v0.7.0
type BlockBodyWithReceipts struct {
Transactions []TransactionWithReceipt `json:"transactions"`
}
type BlockHashAndNumberOutput ¶
type BlockHashAndNumberOutput struct {
Number uint64 `json:"block_number,omitempty"`
Hash *felt.Felt `json:"block_hash,omitempty"`
}
BlockHashAndNumberOutput is a struct that is returned by BlockHashAndNumber.
type BlockHeader ¶
type BlockHeader struct {
// Hash The hash of this block
Hash *felt.Felt `json:"block_hash"`
// ParentHash The hash of this block's parent
ParentHash *felt.Felt `json:"parent_hash"`
// Number the block number (its height)
Number uint64 `json:"block_number"`
// NewRoot The new global state root
NewRoot *felt.Felt `json:"new_root"`
// Timestamp the time in which the block was created, encoded in Unix time
Timestamp uint64 `json:"timestamp"`
// SequencerAddress the StarkNet identity of the sequencer submitting this block
SequencerAddress *felt.Felt `json:"sequencer_address"`
// The price of l1 gas in the block
L1GasPrice ResourcePrice `json:"l1_gas_price"`
// The price of l2 gas in the block
L2GasPrice ResourcePrice `json:"l2_gas_price"`
// The price of l1 data gas in the block
L1DataGasPrice ResourcePrice `json:"l1_data_gas_price"`
// Specifies whether the data of this block is published via blob data or calldata
L1DAMode L1DAMode `json:"l1_da_mode"`
// Semver of the current Starknet protocol
StarknetVersion string `json:"starknet_version"`
}
type BlockID ¶
type BlockID struct {
Number *uint64 `json:"block_number,omitempty"`
Hash *felt.Felt `json:"block_hash,omitempty"`
// A tag specifying a dynamic reference to a block. Tag `l1_accepted` refers
// to the latest Starknet block which was included in a state update on L1 and
// finalised by the consensus on L1. Tag `latest` refers to the latest Starknet
// block finalised by the consensus on L2. Tag `pre_confirmed` refers to the block
// which is currently being built by the block proposer in height `latest` + 1.
Tag BlockTag `json:",omitempty"`
}
BlockID is a struct that is used to choose between different search types.
func WithBlockHash ¶
WithBlockHash returns a BlockID with the given hash.
Parameters:
- h: The hash to use for the BlockID.
Returns:
- BlockID: A BlockID struct with the specified hash
func WithBlockNumber ¶
WithBlockNumber returns a BlockID with the given block number.
Parameters:
- n: The block number to use for the BlockID.
Returns:
- BlockID: A BlockID struct with the specified block number
func WithBlockTag ¶
WithBlockTag creates a new BlockID with the specified tag.
Parameters:
- tag: The tag for the BlockID
Returns:
- BlockID: A BlockID struct with the specified tag
func (BlockID) MarshalJSON ¶
MarshalJSON marshals the BlockID to JSON format.
It returns a byte slice and an error. The byte slice contains the JSON representation of the BlockID, while the error indicates any error that occurred during the marshalling process.
Parameters:
none
Returns:
- []byte: the JSON representation of the BlockID
- error: any error that occurred during the marshalling process
func (*BlockID) UnmarshalJSON ¶ added in v0.14.0
type BlockStatus ¶
type BlockStatus string
const ( BlockStatus_Pre_confirmed BlockStatus = "PRE_CONFIRMED" BlockStatus_AcceptedOnL2 BlockStatus = "ACCEPTED_ON_L2" BlockStatus_AcceptedOnL1 BlockStatus = "ACCEPTED_ON_L1" )
func (BlockStatus) MarshalJSON ¶
func (bs BlockStatus) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of BlockStatus.
Parameters:
none
Returns:
- []byte: a byte slice
- error: an error if any
func (*BlockStatus) UnmarshalJSON ¶
func (bs *BlockStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON representation of a BlockStatus.
It takes in a byte slice containing the JSON data to be unmarshaled. The function returns an error if there is an issue unmarshaling the data.
Parameters:
- data: It takes a byte slice as a parameter, which represents the JSON data to be unmarshaled
Returns:
- error: an error if the unmarshaling fails
type BlockTag ¶ added in v0.11.0
type BlockTag string
BlockTag represents the possible values for a block tag.
const ( // The block which is currently being built by the block proposer in height `latest` + 1. BlockTagPre_confirmed BlockTag = "pre_confirmed" // The latest Starknet block finalised by the consensus on L2. BlockTagLatest BlockTag = "latest" // The latest Starknet block which was included in a state update on L1 and finalised by the consensus on L1. BlockTagL1Accepted BlockTag = "l1_accepted" )
type BlockTransaction ¶ added in v0.4.4
type BlockTransaction struct {
Hash *felt.Felt `json:"transaction_hash"`
Transaction
}
func (*BlockTransaction) MarshalJSON ¶ added in v0.11.0
func (blockTxn *BlockTransaction) MarshalJSON() ([]byte, error)
MarshalJSON marshals the BlockTransaction object into a JSON byte slice.
It takes a pointer to a BlockTransaction object as the parameter. The function returns a byte slice representing the JSON data and an error if the marshalling process fails.
func (*BlockTransaction) UnmarshalJSON ¶ added in v0.7.1
func (blockTxn *BlockTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the data into a BlockTransaction object.
It takes a byte slice as the parameter, representing the JSON data to be unmarshalled. The function returns an error if the unmarshalling process fails.
Parameters:
- data: The JSON data to be unmarshalled
Returns:
- error: An error if the unmarshalling process fails
type BlockTxHashes ¶ added in v0.4.4
type BlockTxHashes struct {
BlockHeader
Status BlockStatus `json:"status"`
// Transactions The hashes of the transactions included in this block
Transactions []*felt.Felt `json:"transactions"`
}
type BlockWithReceipts ¶ added in v0.7.0
type BlockWithReceipts struct {
BlockHeader
Status BlockStatus `json:"status"`
BlockBodyWithReceipts
}
encoding/json doesn't support inlining fields
type BroadcastDeclareTxnV3 ¶ added in v0.6.0
type BroadcastDeclareTxnV3 struct {
Type TransactionType `json:"type"`
SenderAddress *felt.Felt `json:"sender_address"`
CompiledClassHash *felt.Felt `json:"compiled_class_hash"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
ContractClass *contracts.ContractClass `json:"contract_class"`
ResourceBounds *ResourceBoundsMapping `json:"resource_bounds"`
Tip U64 `json:"tip"`
// The data needed to allow the paymaster to pay for the transaction in native tokens
PayMasterData []*felt.Felt `json:"paymaster_data"`
// The data needed to deploy the account contract from which this tx will be initiated
AccountDeploymentData []*felt.Felt `json:"account_deployment_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}
func (BroadcastDeclareTxnV3) GetSenderAddress ¶ added in v0.11.0
func (tx BroadcastDeclareTxnV3) GetSenderAddress() *felt.Felt
func (BroadcastDeclareTxnV3) GetType ¶ added in v0.11.1
func (tx BroadcastDeclareTxnV3) GetType() TransactionType
func (BroadcastDeclareTxnV3) GetVersion ¶ added in v0.11.1
func (tx BroadcastDeclareTxnV3) GetVersion() TransactionVersion
type BroadcastDeployAccountTxnV3 ¶ added in v0.6.0
type BroadcastDeployAccountTxnV3 = DeployAccountTxnV3
type BroadcastInvokeTxnV3 ¶ added in v0.8.0
type BroadcastInvokeTxnV3 = InvokeTxnV3
type BroadcastTxn ¶ added in v0.5.0
type BroadcastTxn interface{}
type ClassOutput ¶ added in v0.4.3
type ClassOutput interface{}
type CompilationErrData ¶ added in v0.8.0
type CompilationErrData struct {
CompilationError string `json:"compilation_error"`
}
Structured type for the ErrCompilationError data
func (*CompilationErrData) ErrorMessage ¶ added in v0.8.0
func (c *CompilationErrData) ErrorMessage() string
type ContractErrData ¶ added in v0.8.0
type ContractErrData struct {
RevertError ContractExecutionError `json:"revert_error"`
}
Structured type for the ErrContractError data
func (*ContractErrData) ErrorMessage ¶ added in v0.8.0
func (c *ContractErrData) ErrorMessage() string
type ContractExecutionError ¶ added in v0.8.0
type ContractExecutionError struct {
// the error raised during execution
Message string
ContractExecErrInner *ContractExecutionErrorInner
}
structured error that can later be processed by wallets or sdks
func (*ContractExecutionError) MarshalJSON ¶ added in v0.8.0
func (contractEx *ContractExecutionError) MarshalJSON() ([]byte, error)
func (*ContractExecutionError) UnmarshalJSON ¶ added in v0.8.0
func (contractEx *ContractExecutionError) UnmarshalJSON(data []byte) error
type ContractExecutionErrorInner ¶ added in v0.8.0
type ContractExecutionErrorInner struct {
ContractAddress *felt.Felt `json:"contract_address"`
ClassHash *felt.Felt `json:"class_hash"`
Selector *felt.Felt `json:"selector"`
Error *ContractExecutionError `json:"error"`
}
can be either this struct or a string. The parent type will handle the unmarshalling
type ContractLeavesData ¶ added in v0.8.0
type ContractLeavesData struct {
Nonce *felt.Felt `json:"nonce"`
ClassHash *felt.Felt `json:"class_hash"`
StorageRoot *felt.Felt `json:"storage_root,omitempty"`
}
The nonce and class hash for each requested contract address, in the order in which they appear in the request. These values are needed to construct the associated leaf node
type ContractNonce ¶
type ContractNonce struct {
// ContractAddress is the address of the contract
ContractAddress *felt.Felt `json:"contract_address"`
// Nonce is the nonce for the given address at the end of the block"
Nonce *felt.Felt `json:"nonce"`
}
ContractNonce is a the updated nonce per contract address
type ContractStorageDiffItem ¶
type ContractStorageDiffItem struct {
// ContractAddress is the contract address for which the state changed
Address *felt.Felt `json:"address"`
StorageEntries []StorageEntry `json:"storage_entries"`
}
ContractStorageDiffItem is a change in a single storage item
type ContractStorageKeys ¶ added in v0.8.0
type ContractsProof ¶ added in v0.8.0
type ContractsProof struct {
// The nodes in the union of the paths from the contracts tree root to the requested leaves
Nodes []NodeHashToNode `json:"nodes"`
ContractLeavesData []ContractLeavesData `json:"contract_leaves_data"`
}
type DataAvailabilityMode ¶ added in v0.6.0
type DataAvailabilityMode string
DA_MODE: Specifies a storage domain in Starknet. Each domain has different guarantees regarding availability
const ( DAModeL1 DataAvailabilityMode = "L1" DAModeL2 DataAvailabilityMode = "L2" )
func (DataAvailabilityMode) MarshalJSON ¶ added in v0.8.0
func (da DataAvailabilityMode) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface. It validates that the DataAvailabilityMode is either L1 or L2 before marshalling.
func (*DataAvailabilityMode) UInt64 ¶ added in v0.6.0
func (da *DataAvailabilityMode) UInt64() (uint64, error)
type DeclareTxnTrace ¶ added in v0.4.3
type DeclareTxnTrace struct {
ValidateInvocation *FnInvocation `json:"validate_invocation,omitempty"`
FeeTransferInvocation *FnInvocation `json:"fee_transfer_invocation,omitempty"`
StateDiff *StateDiff `json:"state_diff,omitempty"`
Type TransactionType `json:"type"`
ExecutionResources ExecutionResources `json:"execution_resources"`
}
the execution trace of a declare transaction
type DeclareTxnType ¶ added in v0.4.6
DeclareTxnType is an interface that represents a Starknet declare transaction. It is used to provide a common interface for all declare transaction types. The 'SenderAddress' field is present in all declare transaction types.
type DeclareTxnV0 ¶ added in v0.4.4
type DeclareTxnV0 struct {
Type TransactionType `json:"type"`
// SenderAddress the address of the account contract sending the declaration transaction
SenderAddress *felt.Felt `json:"sender_address"`
MaxFee *felt.Felt `json:"max_fee"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
ClassHash *felt.Felt `json:"class_hash"`
}
func (DeclareTxnV0) GetSenderAddress ¶ added in v0.11.0
func (tx DeclareTxnV0) GetSenderAddress() *felt.Felt
func (DeclareTxnV0) GetType ¶ added in v0.4.4
func (tx DeclareTxnV0) GetType() TransactionType
Declare transactions
func (DeclareTxnV0) GetVersion ¶ added in v0.11.0
func (tx DeclareTxnV0) GetVersion() TransactionVersion
type DeclareTxnV1 ¶ added in v0.4.3
type DeclareTxnV1 struct {
Type TransactionType `json:"type"`
// SenderAddress the address of the account contract sending the declaration transaction
SenderAddress *felt.Felt `json:"sender_address"`
MaxFee *felt.Felt `json:"max_fee"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
// ClassHash the hash of the declared class
ClassHash *felt.Felt `json:"class_hash"`
}
func (DeclareTxnV1) GetSenderAddress ¶ added in v0.11.0
func (tx DeclareTxnV1) GetSenderAddress() *felt.Felt
func (DeclareTxnV1) GetType ¶ added in v0.4.4
func (tx DeclareTxnV1) GetType() TransactionType
func (DeclareTxnV1) GetVersion ¶ added in v0.11.0
func (tx DeclareTxnV1) GetVersion() TransactionVersion
type DeclareTxnV2 ¶ added in v0.4.3
type DeclareTxnV2 struct {
Type TransactionType `json:"type"`
// SenderAddress the address of the account contract sending the declaration transaction
SenderAddress *felt.Felt `json:"sender_address"`
CompiledClassHash *felt.Felt `json:"compiled_class_hash"`
MaxFee *felt.Felt `json:"max_fee"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
ClassHash *felt.Felt `json:"class_hash"`
}
func (DeclareTxnV2) GetSenderAddress ¶ added in v0.11.0
func (tx DeclareTxnV2) GetSenderAddress() *felt.Felt
func (DeclareTxnV2) GetType ¶ added in v0.4.4
func (tx DeclareTxnV2) GetType() TransactionType
func (DeclareTxnV2) GetVersion ¶ added in v0.11.0
func (tx DeclareTxnV2) GetVersion() TransactionVersion
type DeclareTxnV3 ¶ added in v0.6.0
type DeclareTxnV3 struct {
Type TransactionType `json:"type"`
SenderAddress *felt.Felt `json:"sender_address"`
CompiledClassHash *felt.Felt `json:"compiled_class_hash"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
ClassHash *felt.Felt `json:"class_hash"`
ResourceBounds *ResourceBoundsMapping `json:"resource_bounds"`
Tip U64 `json:"tip"`
// The data needed to allow the paymaster to pay for the transaction in native tokens
PayMasterData []*felt.Felt `json:"paymaster_data"`
// The data needed to deploy the account contract from which this tx will be initiated
AccountDeploymentData []*felt.Felt `json:"account_deployment_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}
func (DeclareTxnV3) GetSenderAddress ¶ added in v0.11.0
func (tx DeclareTxnV3) GetSenderAddress() *felt.Felt
func (DeclareTxnV3) GetType ¶ added in v0.6.0
func (tx DeclareTxnV3) GetType() TransactionType
func (DeclareTxnV3) GetVersion ¶ added in v0.11.0
func (tx DeclareTxnV3) GetVersion() TransactionVersion
type DeclaredClassesItem ¶ added in v0.4.3
type DeclaredClassesItem struct {
// The hash of the declared class
ClassHash *felt.Felt `json:"class_hash"`
// The Cairo assembly hash corresponding to the declared class
CompiledClassHash *felt.Felt `json:"compiled_class_hash"`
}
DeclaredClassesItem is an object with class_hash and compiled_class_hash
type DeployAccountTxnTrace ¶ added in v0.4.3
type DeployAccountTxnTrace struct {
ValidateInvocation *FnInvocation `json:"validate_invocation,omitempty"`
// the trace of the constructor call
ConstructorInvocation FnInvocation `json:"constructor_invocation"`
FeeTransferInvocation *FnInvocation `json:"fee_transfer_invocation,omitempty"`
StateDiff *StateDiff `json:"state_diff,omitempty"`
Type TransactionType `json:"type"`
ExecutionResources ExecutionResources `json:"execution_resources"`
}
the execution trace of a deploy account transaction
type DeployAccountTxnV1 ¶ added in v0.11.0
type DeployAccountTxnV1 struct {
MaxFee *felt.Felt `json:"max_fee"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
Type TransactionType `json:"type"`
// ClassHash The hash of the deployed contract's class
ClassHash *felt.Felt `json:"class_hash"`
// ContractAddressSalt The salt for the address of the deployed contract
ContractAddressSalt *felt.Felt `json:"contract_address_salt"`
// ConstructorCalldata The parameters passed to the constructor
ConstructorCalldata []*felt.Felt `json:"constructor_calldata"`
}
DeployAccountTxnV1 The structure of a deployAccount transaction.
func (DeployAccountTxnV1) GetConstructorCalldata ¶ added in v0.11.0
func (tx DeployAccountTxnV1) GetConstructorCalldata() []*felt.Felt
func (DeployAccountTxnV1) GetType ¶ added in v0.11.0
func (tx DeployAccountTxnV1) GetType() TransactionType
DeployAccount transactions
func (DeployAccountTxnV1) GetVersion ¶ added in v0.11.0
func (tx DeployAccountTxnV1) GetVersion() TransactionVersion
type DeployAccountTxnV3 ¶ added in v0.6.0
type DeployAccountTxnV3 struct {
Type TransactionType `json:"type"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
ContractAddressSalt *felt.Felt `json:"contract_address_salt"`
ConstructorCalldata []*felt.Felt `json:"constructor_calldata"`
ClassHash *felt.Felt `json:"class_hash"`
ResourceBounds *ResourceBoundsMapping `json:"resource_bounds"`
Tip U64 `json:"tip"`
// The data needed to allow the paymaster to pay for the transaction in native tokens
PayMasterData []*felt.Felt `json:"paymaster_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}
func (DeployAccountTxnV3) GetConstructorCalldata ¶ added in v0.11.0
func (tx DeployAccountTxnV3) GetConstructorCalldata() []*felt.Felt
func (DeployAccountTxnV3) GetType ¶ added in v0.6.0
func (tx DeployAccountTxnV3) GetType() TransactionType
func (DeployAccountTxnV3) GetVersion ¶ added in v0.11.0
func (tx DeployAccountTxnV3) GetVersion() TransactionVersion
type DeployAccountType ¶ added in v0.4.6
DeployAccountType is an interface that represents a Starknet deploy account transaction. It is used to provide a common interface for all deploy account transaction types. The 'ConstructorCalldata' field is present in all deploy account transaction types.
type DeployTxn ¶
type DeployTxn struct {
// ClassHash The hash of the deployed contract's class
ClassHash *felt.Felt `json:"class_hash"`
Version TransactionVersion `json:"version"`
Type TransactionType `json:"type"`
ContractAddressSalt *felt.Felt `json:"contract_address_salt"`
ConstructorCalldata []*felt.Felt `json:"constructor_calldata"`
}
DeployTxn The structure of a deploy transaction. Note that this transaction type is deprecated and will no longer be supported in future versions
func (DeployTxn) GetType ¶ added in v0.4.4
func (tx DeployTxn) GetType() TransactionType
Deploy transaction
func (DeployTxn) GetVersion ¶ added in v0.11.0
func (tx DeployTxn) GetVersion() TransactionVersion
type DeployedContractItem ¶
type DeployedContractItem struct {
// ContractAddress is the address of the contract
Address *felt.Felt `json:"address"`
// ClassHash is the hash of the contract code
ClassHash *felt.Felt `json:"class_hash"`
}
DeployedContractItem A new contract deployed as part of the new state
type EdgeNode ¶ added in v0.8.0
type EdgeNode struct {
// an unsigned integer whose binary representation represents the path from the current node
// to its highest non-zero descendant (bounded by 2^251)
Path NumAsHex `json:"path"`
// the length of the path (bounded by 251)
Length uint `json:"length"`
// the hash of the unique non-zero maximal-height descendant node
Child *felt.Felt `json:"child"`
}
Represents a path to the highest non-zero descendant node
type EmittedEvent ¶
type EmittedEvent struct {
Event
// BlockHash the hash of the block in which the event was emitted
BlockHash *felt.Felt `json:"block_hash,omitempty"`
// BlockNumber the number of the block in which the event was emitted
BlockNumber uint64 `json:"block_number,omitempty"`
// TransactionHash the transaction that emitted the event
TransactionHash *felt.Felt `json:"transaction_hash"`
}
EmittedEvent an event emitted as a result of transaction execution
type EmittedEventWithFinalityStatus ¶ added in v0.14.0
type EmittedEventWithFinalityStatus struct {
EmittedEvent
FinalityStatus TxnFinalityStatus `json:"finality_status"`
}
Notification from the server about a new event. The event also includes the finality status of the transaction emitting the event.
type EntryPointType ¶ added in v0.4.3
type EntryPointType string
const ( External EntryPointType = "EXTERNAL" L1Handler EntryPointType = "L1_HANDLER" Constructor EntryPointType = "CONSTRUCTOR" )
type Event ¶
type Event struct {
FromAddress *felt.Felt `json:"from_address"`
EventContent
}
type EventChunk ¶ added in v0.4.3
type EventChunk struct {
Events []EmittedEvent `json:"events"`
ContinuationToken string `json:"continuation_token,omitempty"`
}
type EventContent ¶ added in v0.8.0
type EventFilter ¶
type EventFilter struct {
// FromBlock from block
FromBlock BlockID `json:"from_block,omitempty"`
// ToBlock to block
ToBlock BlockID `json:"to_block,omitempty"`
// Address from contract
Address *felt.Felt `json:"address,omitempty"`
// Keys the values used to filter the events
Keys [][]*felt.Felt `json:"keys,omitempty"`
}
type EventSubscriptionInput ¶ added in v0.8.0
type EventSubscriptionInput struct {
// (Optional) Filter events by from_address which emitted the event
FromAddress *felt.Felt `json:"from_address,omitempty"`
// (Optional) Per key (by position), designate the possible values to be
// matched for events to be returned. Empty array designates 'any' value
Keys [][]*felt.Felt `json:"keys,omitempty"`
// (Optional) The block to get notifications from, default is latest, limited to 1024 blocks back
SubBlockID SubscriptionBlockID `json:"block_id,omitzero"`
// (Optional) The finality status of the most recent events to include.
// Only `PRE_CONFIRMED` and `ACCEPTED_ON_L2` are supported. Default is `ACCEPTED_ON_L2`.
// If PRE_CONFIRMED finality is selected, events might appear multiple times, once for each finality status update.
FinalityStatus TxnFinalityStatus `json:"finality_status,omitempty"`
}
type EventsInput ¶
type EventsInput struct {
EventFilter
ResultPageRequest
}
EventsInput is the input for the 'starknet_getEvents' method. All fields are optional, except for the 'chunk_size' field.
type ExecInvocation ¶ added in v0.5.0
type ExecInvocation struct {
*FnInvocation
// the revert reason for the failed invocation
RevertReason string `json:"revert_reason,omitempty"`
}
type ExecutionResources ¶ added in v0.5.0
type ExecutionResources struct {
// l1 gas consumed by this transaction, used for l2-->l1 messages and state updates if blobs are not used
L1Gas uint `json:"l1_gas"`
// data gas consumed by this transaction, 0 if blobs are not used
L1DataGas uint `json:"l1_data_gas"`
// l2 gas consumed by this transaction, used for computation and calldata
L2Gas uint `json:"l2_gas"`
}
type FeeEstimation ¶ added in v0.7.1
type FeeEstimation struct {
FeeEstimationCommon
// Units in which the fee is given, can only be FRI
Unit PriceUnitFri `json:"unit"`
}
type FeeEstimationCommon ¶ added in v0.14.0
type FeeEstimationCommon struct {
// The Ethereum gas consumption of the transaction, charged for L1->L2 messages and, depending on the block's DA_MODE, state diffs
L1GasConsumed *felt.Felt `json:"l1_gas_consumed"`
// The gas price (in wei or fri, depending on the tx version) that was used in the cost estimation.
L1GasPrice *felt.Felt `json:"l1_gas_price"`
// The L2 gas consumption of the transaction
L2GasConsumed *felt.Felt `json:"l2_gas_consumed"`
// The L2 gas price (in wei or fri, depending on the tx version) that was used in the cost estimation.
L2GasPrice *felt.Felt `json:"l2_gas_price"`
// The Ethereum data gas consumption of the transaction.
L1DataGasConsumed *felt.Felt `json:"l1_data_gas_consumed"`
// The data gas price (in wei or fri, depending on the tx version) that was used in the cost estimation.
L1DataGasPrice *felt.Felt `json:"l1_data_gas_price"`
// The estimated fee for the transaction (in wei or fri, depending on the tx version), equals to
// gas_consumed*gas_price + data_gas_consumed*data_gas_price.
OverallFee *felt.Felt `json:"overall_fee"`
}
Fee estimation common fields
type FeePayment ¶ added in v0.6.0
type FnInvocation ¶ added in v0.4.3
type FnInvocation struct {
FunctionCall
// The address of the invoking contract. 0 for the root invocation
CallerAddress *felt.Felt `json:"caller_address"`
// The hash of the class being called
ClassHash *felt.Felt `json:"class_hash"`
EntryPointType EntryPointType `json:"entry_point_type"`
CallType CallType `json:"call_type"`
// The value returned from the function invocation
Result []*felt.Felt `json:"result"`
// The calls made by this invocation
NestedCalls []FnInvocation `json:"calls"`
// The events emitted in this invocation
InvocationEvents []OrderedEvent `json:"events"`
// The messages sent by this invocation to L1
L1Messages []OrderedMsg `json:"messages"`
// Resources consumed by the internal call
ExecutionResources InnerCallExecutionResources `json:"execution_resources"`
// True if this inner call panicked
IsReverted bool `json:"is_reverted"`
}
type FunctionCall ¶
type FunctionCall struct {
ContractAddress *felt.Felt `json:"contract_address"`
EntryPointSelector *felt.Felt `json:"entry_point_selector"`
// Calldata The parameters passed to the function
Calldata []*felt.Felt `json:"calldata"`
}
FunctionCall function call information
type GlobalRoots ¶ added in v0.8.0
type InnerCallExecutionResources ¶ added in v0.8.0
type InnerCallExecutionResources struct {
// l1 gas consumed by this transaction, used for l2-->l1 messages and state updates if blobs are not used
L1Gas uint `json:"l1_gas"`
// l2 gas consumed by this transaction, used for computation and calldata
L2Gas uint `json:"l2_gas"`
}
the resources consumed by an inner call (does not account for state diffs since data is squashed across the transaction)
type InvokeFunctionCall ¶ added in v0.8.0
type InvokeFunctionCall struct {
// The address of the contract to invoke
ContractAddress *felt.Felt
// The name of the function to invoke
FunctionName string
// The parameters passed to the function
CallData []*felt.Felt
}
InvokeFunctionCall represents a function call to be invoked on a contract. It's a helper type used to build a FunctionCall for a v3 Invoke transaction.
type InvokeTxnTrace ¶ added in v0.4.3
type InvokeTxnTrace struct {
ValidateInvocation *FnInvocation `json:"validate_invocation,omitempty"`
// the trace of the __execute__ call
ExecuteInvocation ExecInvocation `json:"execute_invocation"`
FeeTransferInvocation *FnInvocation `json:"fee_transfer_invocation,omitempty"`
StateDiff *StateDiff `json:"state_diff,omitempty"`
Type TransactionType `json:"type"`
ExecutionResources ExecutionResources `json:"execution_resources"`
}
the execution trace of an invoke transaction
type InvokeTxnType ¶ added in v0.4.6
InvokeTxnType is an interface that represents a Starknet invoke transaction. It is used to provide a common interface for all invoke transaction types. The 'Calldata' field is present in all invoke transaction types.
type InvokeTxnV0 ¶
type InvokeTxnV0 struct {
Type TransactionType `json:"type"`
MaxFee *felt.Felt `json:"max_fee"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
FunctionCall
}
func (InvokeTxnV0) GetCalldata ¶ added in v0.11.0
func (tx InvokeTxnV0) GetCalldata() []*felt.Felt
func (InvokeTxnV0) GetType ¶ added in v0.4.4
func (tx InvokeTxnV0) GetType() TransactionType
Invoke transactions
func (InvokeTxnV0) GetVersion ¶ added in v0.11.0
func (tx InvokeTxnV0) GetVersion() TransactionVersion
type InvokeTxnV1 ¶
type InvokeTxnV1 struct {
MaxFee *felt.Felt `json:"max_fee"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
Type TransactionType `json:"type"`
SenderAddress *felt.Felt `json:"sender_address"`
// The data expected by the account's `execute` function (in most usecases, this includes the
// called contract address and a function selector)
Calldata []*felt.Felt `json:"calldata"`
}
func (InvokeTxnV1) GetCalldata ¶ added in v0.11.0
func (tx InvokeTxnV1) GetCalldata() []*felt.Felt
func (InvokeTxnV1) GetType ¶ added in v0.4.4
func (tx InvokeTxnV1) GetType() TransactionType
func (InvokeTxnV1) GetVersion ¶ added in v0.11.0
func (tx InvokeTxnV1) GetVersion() TransactionVersion
type InvokeTxnV3 ¶ added in v0.6.0
type InvokeTxnV3 struct {
Type TransactionType `json:"type"`
SenderAddress *felt.Felt `json:"sender_address"`
Calldata []*felt.Felt `json:"calldata"`
Version TransactionVersion `json:"version"`
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
ResourceBounds *ResourceBoundsMapping `json:"resource_bounds"`
Tip U64 `json:"tip"`
// The data needed to allow the paymaster to pay for the transaction in native tokens
PayMasterData []*felt.Felt `json:"paymaster_data"`
// The data needed to deploy the account contract from which this tx will be initiated
AccountDeploymentData []*felt.Felt `json:"account_deployment_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}
func (InvokeTxnV3) GetCalldata ¶ added in v0.11.0
func (tx InvokeTxnV3) GetCalldata() []*felt.Felt
func (InvokeTxnV3) GetType ¶ added in v0.6.0
func (tx InvokeTxnV3) GetType() TransactionType
func (InvokeTxnV3) GetVersion ¶ added in v0.11.0
func (tx InvokeTxnV3) GetVersion() TransactionVersion
type L1DAMode ¶ added in v0.7.0
type L1DAMode int
func (L1DAMode) MarshalJSON ¶ added in v0.7.0
func (*L1DAMode) UnmarshalJSON ¶ added in v0.7.0
type L1HandlerTxn ¶
type L1HandlerTxn struct {
Type TransactionType `json:"type"`
// Version of the transaction scheme
Version TransactionVersion `json:"version"`
// Nonce
Nonce string `json:"nonce"`
FunctionCall
}
func (L1HandlerTxn) GetType ¶ added in v0.4.4
func (tx L1HandlerTxn) GetType() TransactionType
L1Handler transaction
func (L1HandlerTxn) GetVersion ¶ added in v0.11.0
func (tx L1HandlerTxn) GetVersion() TransactionVersion
type L1HandlerTxnTrace ¶ added in v0.4.3
type L1HandlerTxnTrace struct {
// the trace of the L1 handler call
FunctionInvocation FnInvocation `json:"function_invocation"`
StateDiff *StateDiff `json:"state_diff,omitempty"`
ExecutionResources ExecutionResources `json:"execution_resources"`
Type TransactionType `json:"type"`
}
the execution trace of an L1 handler transaction
type MerkleNode ¶ added in v0.8.0
A node in the Merkle-Patricia tree, can be a leaf, binary node, or an edge node (EdgeNode or BinaryNode types)
func (*MerkleNode) MarshalJSON ¶ added in v0.8.0
func (m *MerkleNode) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for MerkleNode It marshals the data into an EdgeNode or BinaryNode depending on the type
func (*MerkleNode) UnmarshalJSON ¶ added in v0.8.0
func (m *MerkleNode) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for MerkleNode It unmarshals the data into an EdgeNode or BinaryNode depending on the type
type MessageFeeEstimation ¶ added in v0.14.0
type MessageFeeEstimation struct {
FeeEstimationCommon
// Units in which the fee is given, can only be WEI
Unit PriceUnitWei `json:"unit"`
}
type MessageStatus ¶ added in v0.9.0
type MessageStatus struct {
// The hash of the L1_HANDLER transaction in L2 that contains the message
Hash *felt.Felt `json:"transaction_hash"`
// The finality status of the L1_HANDLER transaction, including the case the txn is still in the mempool or
// failed validation during the block construction phase
FinalityStatus TxnFinalityStatus `json:"finality_status"`
// The execution status of the L1_HANDLER transaction
ExecutionStatus TxnExecutionStatus `json:"execution_status"`
// The failure reason. Only appears if `execution_status` is REVERTED
FailureReason string `json:"failure_reason,omitempty"`
}
MessageStatus represents the status of a message sent from an L1 transaction to an L2 contract.
type MsgFromL1 ¶ added in v0.4.4
type MsgFromL1 struct {
// FromAddress The address of the L1 contract sending the message
FromAddress string `json:"from_address"`
// ToAddress The target L2 address the message is sent to
ToAddress *felt.Felt `json:"to_address"`
// EntryPointSelector The selector of the l1_handler in invoke in the target contract
Selector *felt.Felt `json:"entry_point_selector"`
// Payload The payload of the message
Payload []*felt.Felt `json:"payload"`
}
type MsgToL1 ¶
type MsgToL1 struct {
// FromAddress The address of the L2 contract sending the message
FromAddress *felt.Felt `json:"from_address"`
// ToAddress The target L1 address the message is sent to
ToAddress *felt.Felt `json:"to_address"`
// Payload The payload of the message
Payload []*felt.Felt `json:"payload"`
}
type NewTxnStatus ¶ added in v0.9.0
type NewTxnStatus struct {
TransactionHash *felt.Felt `json:"transaction_hash"`
Status TxnStatusResult `json:"status"`
}
The response of the starknet_subscribeTransactionStatus subscription.
type NodeHashToNode ¶ added in v0.8.0
type NodeHashToNode struct {
NodeHash *felt.Felt `json:"node_hash"`
Node MerkleNode `json:"node"`
}
A node_hash -> node mapping of all the nodes in the union of the paths between the requested leaves and the root
type OrderedEvent ¶ added in v0.5.0
type OrderedEvent struct {
// The order of the event within the transaction
Order int `json:"order"`
*EventContent
}
type OrderedMsg ¶ added in v0.5.0
type Pre_confirmedBlock ¶ added in v0.14.0
type Pre_confirmedBlock struct {
Pre_confirmedBlockHeader
Transactions []BlockTransaction `json:"transactions"`
}
type Pre_confirmedBlockHeader ¶ added in v0.14.0
type Pre_confirmedBlockHeader struct {
// The block number of the block that the proposer is currently building.
// Note that this is a local view of the node, whose accuracy depends on its polling interval length.
Number uint64 `json:"block_number"`
// Timestamp the time in which the block was created, encoded in Unix time
Timestamp uint64 `json:"timestamp"`
// SequencerAddress the StarkNet identity of the sequencer submitting this block
SequencerAddress *felt.Felt `json:"sequencer_address"`
// The price of l1 gas in the block
L1GasPrice ResourcePrice `json:"l1_gas_price"`
// The price of l2 gas in the block
L2GasPrice ResourcePrice `json:"l2_gas_price"`
// Semver of the current Starknet protocol
StarknetVersion string `json:"starknet_version"`
// The price of l1 data gas in the block
L1DataGasPrice ResourcePrice `json:"l1_data_gas_price"`
// Specifies whether the data of this block is published via blob data or calldata
L1DAMode L1DAMode `json:"l1_da_mode"`
}
type Pre_confirmedBlockTxHashes ¶ added in v0.14.0
type Pre_confirmedBlockTxHashes struct {
Pre_confirmedBlockHeader
Transactions []*felt.Felt `json:"transactions"`
}
type Pre_confirmedBlockWithReceipts ¶ added in v0.14.0
type Pre_confirmedBlockWithReceipts struct {
Pre_confirmedBlockHeader
BlockBodyWithReceipts
}
The dynamic block being constructed by the sequencer. Note that this object will be deprecated upon decentralisation.
type Pre_confirmedStateUpdate ¶ added in v0.14.0
type Pre_confirmedStateUpdate struct {
// OldRoot is the previous global state root.
OldRoot *felt.Felt `json:"old_root"`
StateDiff StateDiff `json:"state_diff"`
}
PRE_CONFIRMED_STATE_UPDATE in spec
type PriceUnit ¶ added in v0.14.0
type PriceUnit string
Units in which the fee is given
func (*PriceUnit) UnmarshalJSON ¶ added in v0.14.0
Unmarshals the JSON data into a PriceUnit.
type PriceUnitFri ¶ added in v0.14.0
type PriceUnitFri string
Representation of the unit FRI
const (
FriUnit PriceUnitFri = "FRI"
)
func (*PriceUnitFri) UnmarshalJSON ¶ added in v0.14.0
func (f *PriceUnitFri) UnmarshalJSON(data []byte) error
Unmarshals the JSON data into a PriceUnitFri.
type PriceUnitWei ¶ added in v0.14.0
type PriceUnitWei string
Representation of the unit WEI
const (
WeiUnit PriceUnitWei = "WEI"
)
func (*PriceUnitWei) UnmarshalJSON ¶ added in v0.14.0
func (f *PriceUnitWei) UnmarshalJSON(data []byte) error
Unmarshals the JSON data into a PriceUnitWei.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider provides the provider for starknet.go/rpc implementation.
func NewProvider ¶
func NewProvider(url string, options ...client.ClientOption) (*Provider, error)
NewProvider creates a new HTTP rpc Provider instance.
func (*Provider) AddDeclareTransaction ¶
func (provider *Provider) AddDeclareTransaction( ctx context.Context, declareTransaction *BroadcastDeclareTxnV3, ) (*AddDeclareTransactionResponse, error)
AddDeclareTransaction submits a declare transaction to the StarkNet contract.
Parameters:
- ctx: The context.Context object for the request.
- declareTransaction: The input for the declare transaction.
Returns:
- *AddDeclareTransactionResponse: The response of submitting the declare transaction
- error: an error if any
func (*Provider) AddDeployAccountTransaction ¶
func (provider *Provider) AddDeployAccountTransaction( ctx context.Context, deployAccountTransaction *BroadcastDeployAccountTxnV3, ) (*AddDeployAccountTransactionResponse, error)
AddDeployAccountTransaction adds a DEPLOY_ACCOUNT transaction to the provider.
Parameters:
- ctx: The context of the function
- deployAccountTransaction: The deploy account transaction to be added
Returns:
- *AddDeployAccountTransactionResponse: the response of adding the deploy account transaction or an error
func (*Provider) AddInvokeTransaction ¶
func (provider *Provider) AddInvokeTransaction( ctx context.Context, invokeTxn *BroadcastInvokeTxnV3, ) (*AddInvokeTransactionResponse, error)
AddInvokeTransaction adds an invoke transaction to the provider.
Parameters:
- ctx: The context for the function.
- invokeTxn: The invoke transaction to be added.
Returns:
- *AddInvokeTransactionResponse: the response of adding the invoke transaction
- error: an error if any
func (*Provider) BlockHashAndNumber ¶
func (provider *Provider) BlockHashAndNumber(ctx context.Context) (*BlockHashAndNumberOutput, error)
BlockHashAndNumber retrieves the hash and number of the current block.
Parameters:
- ctx: The context to use for the request.
Returns:
- *BlockHashAndNumberOutput: The hash and number of the current block
- error: An error if any
func (*Provider) BlockNumber ¶
BlockNumber returns the block number of the current block.
Parameters:
- ctx: The context to use for the request
Returns:
- uint64: The block number
- error: An error if any
func (*Provider) BlockTransactionCount ¶
func (provider *Provider) BlockTransactionCount(ctx context.Context, blockID BlockID) (uint64, error)
BlockTransactionCount returns the number of transactions in a specific block.
Parameters:
- ctx: The context.Context object to handle cancellation signals and timeouts
- blockID: The ID of the block to retrieve the number of transactions from
Returns:
- uint64: The number of transactions in the block
- error: An error, if any
func (*Provider) BlockWithReceipts ¶ added in v0.7.0
func (provider *Provider) BlockWithReceipts(ctx context.Context, blockID BlockID) (interface{}, error)
Get block information with full transactions and receipts given the block id
func (*Provider) BlockWithTxHashes ¶
func (provider *Provider) BlockWithTxHashes(ctx context.Context, blockID BlockID) (interface{}, error)
BlockWithTxHashes retrieves the block with transaction hashes for the given block ID.
Parameters:
- ctx: The context.Context object for controlling the function call
- blockID: The ID of the block to retrieve the transactions from
Returns:
- interface{}: The retrieved block
- error: An error, if any
func (*Provider) BlockWithTxs ¶
BlockWithTxs retrieves a block with its transactions given the block id.
Parameters:
- ctx: The context.Context object for the request
- blockID: The ID of the block to retrieve
Returns:
- interface{}: The retrieved block
- error: An error, if any
func (*Provider) Call ¶
func (provider *Provider) Call(ctx context.Context, request FunctionCall, blockID BlockID) ([]*felt.Felt, error)
Call calls the Starknet Provider's function with the given (Starknet) request and block ID.
Parameters:
- ctx: the context.Context object for the function call
- request: the FunctionCall object representing the request
- blockID: the BlockID object representing the block ID
Returns
- []*felt.Felt: the result of the function call
- error: an error if any occurred during the execution
func (*Provider) ChainID ¶
ChainID returns the chain ID for transaction replay protection.
Parameters:
- ctx: The context.Context object for the function
Returns:
- string: The chain ID
- error: An error if any occurred during the execution
func (*Provider) Class ¶
func (provider *Provider) Class(ctx context.Context, blockID BlockID, classHash *felt.Felt) (ClassOutput, error)
Class retrieves the class information from the Provider with the given hash.
Parameters:
- ctx: The context.Context object
- blockID: The BlockID object
- classHash: The *felt.Felt object
Returns:
- ClassOutput: The output of the class.
- error: An error if any occurred during the execution.
func (*Provider) ClassAt ¶
func (provider *Provider) ClassAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (ClassOutput, error)
ClassAt returns the class at the specified blockID and contractAddress.
Parameters:
- ctx: The context.Context object for the function
- blockID: The BlockID of the class
- contractAddress: The address of the contract
Returns:
- ClassOutput: The output of the class
- error: An error if any occurred during the execution
func (*Provider) ClassHashAt ¶
func (provider *Provider) ClassHashAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error)
ClassHashAt retrieves the class hash at the given block ID and contract address.
Parameters:
- ctx: The context.Context used for the request
- blockID: The ID of the block
- contractAddress: The address of the contract
Returns:
- *felt.Felt: The class hash
- error: An error if any occurred during the execution
func (*Provider) CompiledCasm ¶ added in v0.8.0
func (provider *Provider) CompiledCasm(ctx context.Context, classHash *felt.Felt) (*contracts.CasmClass, error)
Get the CASM code resulting from compiling a given class
Parameters:
- ctx: The context.Context used for the request
- classHash: The hash of the contract class whose CASM will be returned
Returns:
- CasmCompiledContractClass: The compiled contract class
- error: An error if any occurred during the execution
func (*Provider) EstimateFee ¶
func (provider *Provider) EstimateFee( ctx context.Context, requests []BroadcastTxn, simulationFlags []SimulationFlag, blockID BlockID, ) ([]FeeEstimation, error)
Estimates the resources required by a given sequence of transactions when applied on a given state. If one of the transactions reverts or fails due to any reason (e.g. validation failure or an internal error), a TRANSACTION_EXECUTION_ERROR is returned. The estimate is given in fri.
Parameters:
- ctx: The context of the function call
- requests: A sequence of transactions to estimate, running each transaction on the state resulting from applying all the previous ones
- simulationFlags: Describes what parts of the transaction should be executed
- blockID: The hash of the requested block, or number (height) of the requested block, or a block tag, for the block referencing the state or call the transaction on.
Returns:
- []FeeEstimation: A sequence of fee estimation where the i'th estimate corresponds to the i'th transaction
- error: An error if any occurred during the execution
func (*Provider) EstimateMessageFee ¶ added in v0.4.4
func (provider *Provider) EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (MessageFeeEstimation, error)
EstimateMessageFee estimates the L2 fee of a message sent on L1 (Provider struct).
Parameters:
- ctx: The context of the function call
- msg: The message to estimate the fee for
- blockID: The ID of the block to estimate the fee in
Returns:
- MessageFeeEstimation: the fee estimated for the message
- error: an error if any occurred during the execution
func (*Provider) Events ¶
func (provider *Provider) Events(ctx context.Context, input EventsInput) (*EventChunk, error)
Events retrieves events from the provider matching the given filter.
Parameters:
- ctx: The context to use for the request
- input: The input parameters for retrieving events
Returns
- eventChunk: The retrieved events
- error: An error if any
func (*Provider) GetMessagesStatus ¶ added in v0.8.0
func (provider *Provider) GetMessagesStatus(ctx context.Context, transactionHash NumAsHex) ([]MessageStatus, error)
Given an L1 tx hash, returns the associated l1_handler tx hashes and statuses for all L1 -> L2 messages sent by the l1 transaction, ordered by the L1 tx sending order
Parameters:
- ctx: the context.Context object for cancellation and timeouts.
- transactionHash: The hash of the L1 transaction that sent L1->L2 messages
Returns:
- [] MessageStatusResp: An array containing the status of the messages sent by the L1 transaction
- error, if one arose.
func (*Provider) GetStorageProof ¶ added in v0.8.0
func (provider *Provider) GetStorageProof(ctx context.Context, storageProofInput StorageProofInput) (*StorageProofResult, error)
Get merkle paths in one of the state tries: global state, classes, individual contract. A single request can query for any mix of the three types of storage proofs (classes, contracts, and storage)
Parameters:
- ctx: The context of the function call
- storageProofInput: an input containing optional and required fields for the request
Returns:
- *StorageProofResult: The requested storage proofs. Note that if a requested leaf has the default value, the path to it may end in an edge node whose path is not a prefix of the requested leaf, thus effectively proving non-membership
- error: an error if any occurred during the execution
func (*Provider) GetTransactionStatus ¶ added in v0.5.0
func (provider *Provider) GetTransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*TxnStatusResult, error)
GetTransactionStatus gets the transaction status (possibly reflecting that the tx is still in the mempool, or dropped from it) Parameters:
- ctx: the context.Context object for cancellation and timeouts.
- transactionHash: The hash of the requested transaction
Returns:
- *TxnStatusResult: Transaction status result, including finality status and execution status
- error, if one arose.
func (*Provider) Nonce ¶
func (provider *Provider) Nonce(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error)
Nonce retrieves the nonce for a given block ID and contract address.
Parameters:
- ctx: is the context.Context for the function call
- blockID: is the ID of the block
- contractAddress: is the address of the contract
Returns:
- *felt.Felt: the contract's nonce at the requested state
- error: an error if any
func (*Provider) SimulateTransactions ¶ added in v0.4.3
func (provider *Provider) SimulateTransactions( ctx context.Context, blockID BlockID, txns []BroadcastTxn, simulationFlags []SimulationFlag, ) ([]SimulatedTransaction, error)
SimulateTransactions simulates transactions on the blockchain. Simulate a given sequence of transactions on the requested state, and generate the execution traces. Note that some of the transactions may revert, in which case no error is thrown, but revert details can be seen on the returned trace object. Note that some of the transactions may revert, this will be reflected by the revert_error property in the trace. Other types of failures (e.g. unexpected error or failure in the validation phase) will result in TRANSACTION_EXECUTION_ERROR.
Parameters:
- ctx: The context of the function call
- blockID: The hash of the requested block, or number (height) of the requested block, or a block tag, for the block referencing the state or call the transaction on.
- txns: A sequence of transactions to simulate, running each transaction on the state resulting from applying all the previous ones
- simulationFlags: Describes what parts of the transaction should be executed
Returns:
- []SimulatedTransaction: The execution trace and consumed resources of the required transactions
- error: An error if any occurred during the execution
func (*Provider) SpecVersion ¶ added in v0.5.0
SpecVersion returns the version of the Starknet JSON-RPC specification being used Parameters: None Returns: String of the Starknet JSON-RPC specification
func (*Provider) StateUpdate ¶
func (provider *Provider) StateUpdate(ctx context.Context, blockID BlockID) (*StateUpdateOutput, error)
StateUpdate is a function that performs a state update operation (gets the information about the result of executing the requested block).
Parameters:
- ctx: The context.Context object for controlling the function call
- blockID: The ID of the block to retrieve the transactions from
Returns:
- *StateUpdateOutput: The retrieved state update
- error: An error, if any
func (*Provider) StorageAt ¶
func (provider *Provider) StorageAt(ctx context.Context, contractAddress *felt.Felt, key string, blockID BlockID) (string, error)
StorageAt retrieves the storage value of a given contract at a specific key and block ID.
Parameters:
- ctx: The context.Context for the function
- contractAddress: The address of the contract
- key: The key for which to retrieve the storage value
- blockID: The ID of the block at which to retrieve the storage value
Returns:
- string: The value of the storage
- error: An error if any occurred during the execution
func (*Provider) Syncing ¶
func (provider *Provider) Syncing(ctx context.Context) (SyncStatus, error)
Syncing retrieves the synchronisation status of the provider.
Parameters:
- ctx: The context.Context object for the function
Returns:
- *SyncStatus: The synchronisation status
- error: An error if any occurred during the execution
func (*Provider) TraceBlockTransactions ¶
func (provider *Provider) TraceBlockTransactions(ctx context.Context, blockID BlockID) ([]Trace, error)
TraceBlockTransactions retrieves the traces of transactions in a given block.
Parameters:
- ctx: the context.Context object for controlling the request
- blockID: the block to retrieve the traces from. `pre_confirmed` tag is not allowed
Returns:
- []Trace: a slice of Trace objects representing the traces of transactions in the block
- error: an error if there was a problem retrieving the traces.
func (*Provider) TraceTransaction ¶ added in v0.5.0
func (provider *Provider) TraceTransaction(ctx context.Context, transactionHash *felt.Felt) (TxnTrace, error)
TraceTransaction returns the transaction trace for the given transaction hash.
Parameters:
- ctx: the context.Context object for the request
- transactionHash: the transaction hash to trace
Returns:
- TxnTrace: the transaction trace
- error: an error if the transaction trace cannot be retrieved
func (*Provider) TransactionByBlockIdAndIndex ¶
func (provider *Provider) TransactionByBlockIdAndIndex(ctx context.Context, blockID BlockID, index uint64) (*BlockTransaction, error)
TransactionByBlockIdAndIndex retrieves a transaction by its block ID and index.
Parameters:
- ctx: The context.Context object for the request.
- blockID: The ID of the block containing the transaction.
- index: The index of the transaction within the block.
Returns:
- BlockTransaction: The retrieved Transaction object
- error: An error, if any
func (*Provider) TransactionByHash ¶
func (provider *Provider) TransactionByHash(ctx context.Context, hash *felt.Felt) (*BlockTransaction, error)
TransactionByHash retrieves the details and status of a transaction by its hash.
Parameters:
- ctx: The context.Context object for the request.
- hash: The hash of the transaction.
Returns:
- BlockTransaction: The retrieved Transaction
- error: An error if any
func (*Provider) TransactionReceipt ¶
func (provider *Provider) TransactionReceipt(ctx context.Context, transactionHash *felt.Felt) (*TransactionReceiptWithBlockInfo, error)
TransactionReceipt fetches the transaction receipt for a given transaction hash.
Parameters:
- ctx: the context.Context object for the request
- transactionHash: the hash of the transaction as a Felt
Returns:
- TransactionReceipt: the transaction receipt
- error: an error if any
type RPCData ¶ added in v0.8.0
type RPCData interface {
ErrorMessage() string
}
RPCData is the interface that all error data types must implement
type RPCError ¶
type RPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data RPCData `json:"data,omitempty"`
}
func Err ¶ added in v0.4.4
Err returns an RPCError based on the given code and data.
Parameters:
- code: an integer representing the error code.
- data: any data associated with the error.
Returns
- *RPCError: a pointer to an RPCError object.
func (*RPCError) UnmarshalJSON ¶ added in v0.8.0
UnmarshalJSON implements the json.Unmarshaler interface for RPCError. It handles the deserialization of JSON into an RPCError struct, with special handling for the Data field.
type ReplacedClassesItem ¶ added in v0.4.3
type ReplacedClassesItem struct {
// The address of the contract whose class was replaced
ContractClass *felt.Felt `json:"contract_address"`
// The new class hash
ClassHash *felt.Felt `json:"class_hash"`
}
contracts whose class was replaced
type Resource ¶ added in v0.6.0
type Resource string
const ( ResourceL1Gas Resource = "L1_GAS" ResourceL2Gas Resource = "L2_GAS" ResourceL1DataGas Resource = "L1_DATA" )
Values used in the Resource Bounds hash calculation Ref: https://docs.starknet.io/architecture-and-concepts/network-architecture/transactions/#v3_hash_calculation
type ResourceBounds ¶ added in v0.6.0
type ResourceBoundsMapping ¶ added in v0.6.0
type ResourceBoundsMapping struct {
// The max amount and max price per unit of L1 gas used in this tx
L1Gas ResourceBounds `json:"l1_gas"`
// The max amount and max price per unit of L1 blob gas used in this tx
L1DataGas ResourceBounds `json:"l1_data_gas"`
// The max amount and max price per unit of L2 gas used in this tx
L2Gas ResourceBounds `json:"l2_gas"`
}
type ResourcePrice ¶ added in v0.5.0
type ResultPageRequest ¶
type RpcProvider ¶ added in v0.4.6
type RpcProvider interface {
AddInvokeTransaction(ctx context.Context, invokeTxn *BroadcastInvokeTxnV3) (*AddInvokeTransactionResponse, error)
AddDeclareTransaction(ctx context.Context, declareTransaction *BroadcastDeclareTxnV3) (*AddDeclareTransactionResponse, error)
AddDeployAccountTransaction(
ctx context.Context,
deployAccountTransaction *BroadcastDeployAccountTxnV3,
) (*AddDeployAccountTransactionResponse, error)
BlockHashAndNumber(ctx context.Context) (*BlockHashAndNumberOutput, error)
BlockNumber(ctx context.Context) (uint64, error)
BlockTransactionCount(ctx context.Context, blockID BlockID) (uint64, error)
BlockWithReceipts(ctx context.Context, blockID BlockID) (interface{}, error)
BlockWithTxHashes(ctx context.Context, blockID BlockID) (interface{}, error)
BlockWithTxs(ctx context.Context, blockID BlockID) (interface{}, error)
Call(ctx context.Context, call FunctionCall, block BlockID) ([]*felt.Felt, error)
ChainID(ctx context.Context) (string, error)
Class(ctx context.Context, blockID BlockID, classHash *felt.Felt) (ClassOutput, error)
ClassAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (ClassOutput, error)
ClassHashAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error)
CompiledCasm(ctx context.Context, classHash *felt.Felt) (*contracts.CasmClass, error)
EstimateFee(ctx context.Context, requests []BroadcastTxn, simulationFlags []SimulationFlag, blockID BlockID) ([]FeeEstimation, error)
EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (MessageFeeEstimation, error)
Events(ctx context.Context, input EventsInput) (*EventChunk, error)
GetStorageProof(ctx context.Context, storageProofInput StorageProofInput) (*StorageProofResult, error)
GetTransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*TxnStatusResult, error)
GetMessagesStatus(ctx context.Context, transactionHash NumAsHex) ([]MessageStatus, error)
Nonce(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error)
SimulateTransactions(
ctx context.Context,
blockID BlockID,
txns []BroadcastTxn,
simulationFlags []SimulationFlag,
) ([]SimulatedTransaction, error)
StateUpdate(ctx context.Context, blockID BlockID) (*StateUpdateOutput, error)
StorageAt(ctx context.Context, contractAddress *felt.Felt, key string, blockID BlockID) (string, error)
SpecVersion(ctx context.Context) (string, error)
Syncing(ctx context.Context) (SyncStatus, error)
TraceBlockTransactions(ctx context.Context, blockID BlockID) ([]Trace, error)
TransactionByBlockIdAndIndex(ctx context.Context, blockID BlockID, index uint64) (*BlockTransaction, error)
TransactionByHash(ctx context.Context, hash *felt.Felt) (*BlockTransaction, error)
TransactionReceipt(ctx context.Context, transactionHash *felt.Felt) (*TransactionReceiptWithBlockInfo, error)
TraceTransaction(ctx context.Context, transactionHash *felt.Felt) (TxnTrace, error)
}
type SimulateTransactionInput ¶ added in v0.4.3
type SimulateTransactionInput struct {
// a sequence of transactions to simulate, running each transaction on the state resulting from applying all the previous ones
Txns []BroadcastTxn `json:"transactions"`
BlockID BlockID `json:"block_id"`
SimulationFlags []SimulationFlag `json:"simulation_flags"`
}
type SimulatedTransaction ¶ added in v0.4.3
type SimulatedTransaction struct {
TxnTrace `json:"transaction_trace"`
FeeEstimation `json:"fee_estimation"`
}
func (*SimulatedTransaction) UnmarshalJSON ¶ added in v0.7.1
func (txn *SimulatedTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the data into a SimulatedTransaction object.
It takes a byte slice as the parameter, representing the JSON data to be unmarshalled. The function returns an error if the unmarshalling process fails.
Parameters:
- data: The JSON data to be unmarshalled
Returns:
- error: An error if the unmarshalling process fails
type SimulationFlag ¶ added in v0.4.3
type SimulationFlag string
const ( SKIP_FEE_CHARGE SimulationFlag = "SKIP_FEE_CHARGE" // Flags that indicate how to simulate a given transaction. By default, the sequencer behaviour is replicated locally SKIP_VALIDATE SimulationFlag = "SKIP_VALIDATE" )
type StateDiff ¶
type StateDiff struct {
// list storage changes
StorageDiffs []ContractStorageDiffItem `json:"storage_diffs"`
// a list of Deprecated declared classes
DeprecatedDeclaredClasses []*felt.Felt `json:"deprecated_declared_classes"`
// list of DeclaredClassesItems objects
DeclaredClasses []DeclaredClassesItem `json:"declared_classes"`
// list of new contract deployed as part of the state update
DeployedContracts []DeployedContractItem `json:"deployed_contracts"`
// list of contracts whose class was replaced
ReplacedClasses []ReplacedClassesItem `json:"replaced_classes"`
// Nonces provides the updated nonces per contract addresses
Nonces []ContractNonce `json:"nonces"`
}
StateDiff is the change in state applied in this block, given as a mapping of addresses to the new values and/or new contracts.
type StateUpdateOutput ¶
type StateUpdateOutput struct {
// BlockHash is the block identifier. Nil for pre_confirmed block.
BlockHash *felt.Felt `json:"block_hash"`
// NewRoot is the new global state root. Nil for pre_confirmed block.
NewRoot *felt.Felt `json:"new_root"`
Pre_confirmedStateUpdate
}
STATE_UPDATE in spec
type StorageEntry ¶
type StorageProofInput ¶ added in v0.8.0
type StorageProofInput struct {
// Required. The hash of the requested block, or number (height) of the requested block, or a block tag
BlockID BlockID `json:"block_id"`
// Optional. A list of the class hashes for which we want to prove membership in the classes trie
ClassHashes []*felt.Felt `json:"class_hashes,omitempty"`
// Optional. A list of contracts for which we want to prove membership in the global state trie
ContractAddresses []*felt.Felt `json:"contract_addresses,omitempty"`
// Optional. A list of (contract_address, storage_keys) pairs
ContractsStorageKeys []ContractStorageKeys `json:"contracts_storage_keys,omitempty"`
}
type StorageProofResult ¶ added in v0.8.0
type StorageProofResult struct {
ClassesProof []NodeHashToNode `json:"classes_proof"`
ContractsProof ContractsProof `json:"contracts_proof"`
ContractsStorageProofs [][]NodeHashToNode `json:"contracts_storage_proofs"`
GlobalRoots GlobalRoots `json:"global_roots"`
}
The requested storage proofs. Note that if a requested leaf has the default value, the path to it may end in an edge node whose path is not a prefix of the requested leaf, thus effectively proving non-membership
type StringErrData ¶ added in v0.8.0
type StringErrData string
StringErrData handles plain string data messages
func (StringErrData) ErrorMessage ¶ added in v0.8.0
func (s StringErrData) ErrorMessage() string
type SubNewTxnReceiptsInput ¶ added in v0.14.0
type SubNewTxnReceiptsInput struct {
// Optional: A vector of finality statuses to receive updates for.
// Only `PRE_CONFIRMED` and `ACCEPTED_ON_L2` are supported. Default is `ACCEPTED_ON_L2`.
FinalityStatus []TxnFinalityStatus `json:"finality_status,omitempty"`
// Optional: Filter transaction receipts to only include transactions sent by the specified addresses
SenderAddress []*felt.Felt `json:"sender_address,omitempty"`
}
SubPendingTxnsInput is the optional input of the starknet_subscribeNewTransactionReceipts subscription.
type SubNewTxnsInput ¶ added in v0.14.0
type SubNewTxnsInput struct {
// Optional: A vector of finality statuses to receive updates for.
// Support all transaction statuses, except `ACCEPTED_ON_L1`. Default is `ACCEPTED_ON_L2`.
FinalityStatus []TxnStatus `json:"finality_status,omitempty"`
// Optional: Filter transaction receipts to only include transactions sent by the specified addresses
SenderAddress []*felt.Felt `json:"sender_address,omitempty"`
}
SubNewTxnsInput is the optional input of the starknet_subscribeNewTransactions subscription.
type SubscriptionBlockID ¶ added in v0.14.0
type SubscriptionBlockID BlockID
Block hash, number or tag, same as BLOCK_ID, but without 'pre_confirmed' or 'l1_accepted'
func (*SubscriptionBlockID) BlockID ¶ added in v0.14.0
func (b *SubscriptionBlockID) BlockID() BlockID
BlockID returns a BlockID from a SubscriptionBlockID.
func (SubscriptionBlockID) MarshalJSON ¶ added in v0.14.0
func (b SubscriptionBlockID) MarshalJSON() ([]byte, error)
func (*SubscriptionBlockID) UnmarshalJSON ¶ added in v0.14.0
func (b *SubscriptionBlockID) UnmarshalJSON(data []byte) error
func (*SubscriptionBlockID) WithBlockHash ¶ added in v0.14.0
func (b *SubscriptionBlockID) WithBlockHash(hash *felt.Felt) SubscriptionBlockID
WithBlockHash sets the block hash for the SubscriptionBlockID.
func (*SubscriptionBlockID) WithBlockNumber ¶ added in v0.14.0
func (b *SubscriptionBlockID) WithBlockNumber(number uint64) SubscriptionBlockID
WithBlockNumber sets the block number for the SubscriptionBlockID.
func (*SubscriptionBlockID) WithLatestTag ¶ added in v0.14.0
func (b *SubscriptionBlockID) WithLatestTag() SubscriptionBlockID
WithLatestTag sets the block tag to latest for the SubscriptionBlockID. It's the only block tag allowed for this type.
type SyncStatus ¶
type SyncStatus struct {
// A boolean indicating whether the node is syncing. If false, all other fields are empty.
IsSyncing bool
// All these fields are only present if IsSyncing is true.
StartingBlockHash *felt.Felt `json:"starting_block_hash,omitempty"`
StartingBlockNum uint64 `json:"starting_block_num,omitempty"`
CurrentBlockHash *felt.Felt `json:"current_block_hash,omitempty"`
CurrentBlockNum uint64 `json:"current_block_num,omitempty"`
HighestBlockHash *felt.Felt `json:"highest_block_hash,omitempty"`
HighestBlockNum uint64 `json:"highest_block_num,omitempty"`
}
SyncStatus is An object describing the node synchronisation status
func (SyncStatus) MarshalJSON ¶
func (s SyncStatus) MarshalJSON() ([]byte, error)
func (*SyncStatus) UnmarshalJSON ¶
func (s *SyncStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON data into the SyncStatus struct.
Parameters:
-data: It takes a byte slice as input representing the JSON data to be unmarshaled.
Returns:
- error: an error if the unmarshaling fails
type Trace ¶ added in v0.4.3
type Trace struct {
TraceRoot TxnTrace `json:"trace_root,omitempty"`
TxnHash *felt.Felt `json:"transaction_hash,omitempty"`
}
A single pair of transaction hash and corresponding trace
func (*Trace) UnmarshalJSON ¶ added in v0.7.1
UnmarshalJSON unmarshals the data into a Trace object.
It takes a byte slice as the parameter, representing the JSON data to be unmarshalled. The function returns an error if the unmarshalling process fails.
Parameters:
- data: The JSON data to be unmarshalled
Returns:
- error: An error if the unmarshalling process fails
type TraceStatus ¶ added in v0.8.0
type TraceStatus string
const ( TraceStatusReceived TraceStatus = "RECEIVED" TraceStatusRejected TraceStatus = "REJECTED" )
func (*TraceStatus) UnmarshalJSON ¶ added in v0.8.0
func (s *TraceStatus) UnmarshalJSON(data []byte) error
type TraceStatusErrData ¶ added in v0.8.0
type TraceStatusErrData struct {
Status TraceStatus `json:"status"`
}
Structured type for the ErrTraceStatusError data
func (*TraceStatusErrData) ErrorMessage ¶ added in v0.8.0
func (t *TraceStatusErrData) ErrorMessage() string
type Transaction ¶
type Transaction interface {
GetType() TransactionType
GetVersion() TransactionVersion
}
Transaction is an interface that represents a Starknet transaction. It is used to provide a common interface for all transaction types. The 'Type' and 'Version' fields are present in all transaction types.
type TransactionExecErrData ¶ added in v0.8.0
type TransactionExecErrData struct {
TransactionIndex int `json:"transaction_index"`
ExecutionError ContractExecutionError `json:"execution_error"`
}
Structured type for the ErrTransactionExecError data
func (*TransactionExecErrData) ErrorMessage ¶ added in v0.8.0
func (t *TransactionExecErrData) ErrorMessage() string
type TransactionReceipt ¶
type TransactionReceipt struct {
Hash *felt.Felt `json:"transaction_hash"`
Type TransactionType `json:"type"`
ActualFee FeePayment `json:"actual_fee"`
FinalityStatus TxnFinalityStatus `json:"finality_status"`
MessagesSent []MsgToL1 `json:"messages_sent"`
Events []Event `json:"events"`
ExecutionResources ExecutionResources `json:"execution_resources"`
ExecutionStatus TxnExecutionStatus `json:"execution_status"`
// Only present in case of a Deploy or DeployAccount transaction receipt
ContractAddress *felt.Felt `json:"contract_address,omitempty"`
// Only appears if the transaction is a L1Handler transaction
MessageHash NumAsHex `json:"message_hash,omitempty"`
// Only appears if execution_status is REVERTED
RevertReason string `json:"revert_reason,omitempty"`
}
TransactionReceipt represents the common structure of a transaction receipt.
type TransactionReceiptWithBlockInfo ¶ added in v0.7.0
type TransactionReceiptWithBlockInfo struct {
TransactionReceipt
BlockHash *felt.Felt `json:"block_hash,omitempty"`
BlockNumber uint `json:"block_number,omitempty"`
}
func (*TransactionReceiptWithBlockInfo) MarshalJSON ¶ added in v0.7.1
func (t *TransactionReceiptWithBlockInfo) MarshalJSON() ([]byte, error)
func (*TransactionReceiptWithBlockInfo) UnmarshalJSON ¶ added in v0.7.1
func (tr *TransactionReceiptWithBlockInfo) UnmarshalJSON(data []byte) error
type TransactionResponse ¶ added in v0.7.3
type TransactionResponse struct {
// Present for all transaction types
Hash *felt.Felt `json:"transaction_hash"`
// Present only for declare transactions
ClassHash *felt.Felt `json:"class_hash,omitempty"`
// Present only for deploy transactions
ContractAddress *felt.Felt `json:"contract_address,omitempty"`
}
TransactionResponse is a generic response for all transaction types sent to the network.
type TransactionType ¶
type TransactionType string
const ( TransactionType_Declare TransactionType = "DECLARE" TransactionType_DeployAccount TransactionType = "DEPLOY_ACCOUNT" TransactionType_Deploy TransactionType = "DEPLOY" TransactionType_Invoke TransactionType = "INVOKE" TransactionType_L1Handler TransactionType = "L1_HANDLER" )
func (TransactionType) MarshalJSON ¶
func (tt TransactionType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the TransactionType to JSON.
Returns:
- []byte: a byte slice
- error: an error if any
func (*TransactionType) UnmarshalJSON ¶
func (tt *TransactionType) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON data into a TransactionType.
The function modifies the value of the TransactionType pointer tt based on the unmarshaled data. The supported JSON values and their corresponding TransactionType values are:
- "DECLARE" maps to TransactionType_Declare
- "DEPLOY_ACCOUNT" maps to TransactionType_DeployAccount
- "DEPLOY" maps to TransactionType_Deploy
- "INVOKE" maps to TransactionType_Invoke
- "L1_HANDLER" maps to TransactionType_L1Handler
If none of the supported values match the input data, the function returns an error.
nil if the unmarshaling is successful.
Parameters:
- data: It takes a byte slice as input representing the JSON data to be unmarshaled
Returns:
- error: an error if the unmarshaling fails
type TransactionVersion ¶
type TransactionVersion string
string must be NUM_AS_HEX
const ( TransactionV0 TransactionVersion = "0x0" TransactionV0WithQueryBit TransactionVersion = "0x100000000000000000000000000000000" TransactionV1 TransactionVersion = "0x1" TransactionV1WithQueryBit TransactionVersion = "0x100000000000000000000000000000001" TransactionV2 TransactionVersion = "0x2" TransactionV2WithQueryBit TransactionVersion = "0x100000000000000000000000000000002" TransactionV3 TransactionVersion = "0x3" TransactionV3WithQueryBit TransactionVersion = "0x100000000000000000000000000000003" )
func (*TransactionVersion) BigInt ¶
func (v *TransactionVersion) BigInt() (*big.Int, error)
BigInt returns a big integer corresponding to the transaction version.
Returns:
- *big.Int: a pointer to a big.Int
- error: an error if the conversion fails
func (*TransactionVersion) Int ¶ added in v0.11.0
func (v *TransactionVersion) Int() int
Int returns an integer corresponding to the transaction version. For versions with query bit, it returns the base version number (e.g. TransactionV2WithQueryBit returns 2). Returns -1 for invalid versions.
Returns:
- int: the integer version, or -1 for invalid versions
type TransactionWithReceipt ¶ added in v0.7.0
type TransactionWithReceipt struct {
Transaction BlockTransaction `json:"transaction"`
Receipt TransactionReceipt `json:"receipt"`
}
type TxDetails ¶ added in v0.4.6
type TxDetails struct {
Nonce *felt.Felt
MaxFee *felt.Felt
Version TransactionVersion
}
TxDetails contains details needed for computing transaction hashes
type TxnExecutionStatus ¶ added in v0.4.4
type TxnExecutionStatus string
const ( TxnExecutionStatusSUCCEEDED TxnExecutionStatus = "SUCCEEDED" TxnExecutionStatusREVERTED TxnExecutionStatus = "REVERTED" )
func (TxnExecutionStatus) MarshalJSON ¶ added in v0.4.4
func (ts TxnExecutionStatus) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the TxnExecutionStatus.
It marshals the TxnExecutionStatus into a byte slice by quoting its string representation. The function returns the marshalled byte slice and a nil error.
Parameters:
none
Returns:
- []byte: the JSON encoding of the TxnExecutionStatus
- error: the error if there was an issue marshalling
func (TxnExecutionStatus) String ¶ added in v0.4.4
func (s TxnExecutionStatus) String() string
String returns the string representation of the TxnExecutionStatus.
Parameters:
none
Returns:
- string: the string representation of the TxnExecutionStatus
func (*TxnExecutionStatus) UnmarshalJSON ¶ added in v0.4.4
func (ts *TxnExecutionStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON data into a TxnExecutionStatus struct.
Parameters:
- data: It takes a byte slice as a parameter, which represents the JSON data to be unmarshalled
Returns:
- error: an error if the unmarshaling fails
type TxnFinalityStatus ¶ added in v0.4.4
type TxnFinalityStatus string
const ( TxnFinalityStatusPre_confirmed TxnFinalityStatus = "PRE_CONFIRMED" TxnFinalityStatusAcceptedOnL2 TxnFinalityStatus = "ACCEPTED_ON_L2" TxnFinalityStatusAcceptedOnL1 TxnFinalityStatus = "ACCEPTED_ON_L1" )
func (TxnFinalityStatus) MarshalJSON ¶ added in v0.4.4
func (ts TxnFinalityStatus) MarshalJSON() ([]byte, error)
MarshalJSON marshals the TxnFinalityStatus into JSON.
Parameters:
none
Returns:
- []byte: a byte slice
- error: an error if any
func (TxnFinalityStatus) String ¶ added in v0.4.4
func (s TxnFinalityStatus) String() string
String returns the string representation of the TxnFinalityStatus.
Parameters:
none
Returns:
- string: the string representation of the TxnFinalityStatus
func (*TxnFinalityStatus) UnmarshalJSON ¶ added in v0.4.4
func (ts *TxnFinalityStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON data into a TxnFinalityStatus.
Parameters:
- data: It takes a byte slice as a parameter, which represents the JSON data to be unmarshalled
Returns:
- error: an error if the unmarshaling fails
type TxnStatusResult ¶ added in v0.9.0
type TxnStatusResult struct {
FinalityStatus TxnStatus `json:"finality_status"`
ExecutionStatus TxnExecutionStatus `json:"execution_status,omitempty"`
// the failure reason, only appears if execution_status is REVERTED
FailureReason string `json:"failure_reason,omitempty"`
}
Transaction status result, including finality status and execution status
type TxnWithHashAndStatus ¶ added in v0.14.0
type TxnWithHashAndStatus struct {
// Transaction with hash and status
BlockTransaction
// Finality status of the transaction, except `ACCEPTED_ON_L1`.
FinalityStatus TxnStatus `json:"finality_status"`
}
TxnWithHashAndStatus is the response of the starknet_subscribeNewTransactions subscription.
func (*TxnWithHashAndStatus) UnmarshalJSON ¶ added in v0.14.0
func (txn *TxnWithHashAndStatus) UnmarshalJSON(data []byte) error
type U128 ¶ added in v0.6.0
type U128 string
128 bit unsigned integers, represented by hex string of length at most 32
type U64 ¶ added in v0.6.0
type U64 string
64 bit unsigned integers, represented by hex string of length at most 16
type WebsocketProvider ¶ added in v0.8.0
type WebsocketProvider interface {
SubscribeEvents(
ctx context.Context,
events chan<- *EmittedEventWithFinalityStatus,
options *EventSubscriptionInput,
) (*client.ClientSubscription, error)
SubscribeNewHeads(ctx context.Context, headers chan<- *BlockHeader, subBlockID SubscriptionBlockID) (*client.ClientSubscription, error)
SubscribeNewTransactions(
ctx context.Context,
newTxns chan<- *TxnWithHashAndStatus,
options *SubNewTxnsInput,
) (*client.ClientSubscription, error)
SubscribeNewTransactionReceipts(
ctx context.Context,
txnReceipts chan<- *TransactionReceiptWithBlockInfo,
options *SubNewTxnReceiptsInput,
) (*client.ClientSubscription, error)
SubscribeTransactionStatus(
ctx context.Context,
newStatus chan<- *NewTxnStatus,
transactionHash *felt.Felt,
) (*client.ClientSubscription, error)
}
type WsProvider ¶ added in v0.8.0
type WsProvider struct {
// contains filtered or unexported fields
}
WsProvider provides the provider for websocket starknet.go/rpc implementation.
func NewWebsocketProvider ¶ added in v0.8.0
func NewWebsocketProvider(url string, options ...client.ClientOption) (*WsProvider, error)
NewWebsocketProvider creates a new Websocket rpc Provider instance.
func (*WsProvider) Close ¶ added in v0.8.0
func (p *WsProvider) Close()
Close closes the client, aborting any in-flight requests.
func (*WsProvider) SubscribeEvents ¶ added in v0.8.0
func (provider *WsProvider) SubscribeEvents( ctx context.Context, events chan<- *EmittedEventWithFinalityStatus, options *EventSubscriptionInput, ) (*client.ClientSubscription, error)
Events subscription. Creates a WebSocket stream which will fire events for new Starknet events with applied filters. Events are emitted for all events from the specified block_id, up to the latest block. If PRE_CONFIRMED finality status is provided, events might appear multiple times, for each finality status update. If a single event is required, ACCEPTED_ON_L2 must be selected (the default).
Parameters:
- ctx: The context.Context object for controlling the function call
- events: The channel to send the new events to
- options: The optional input struct containing the optional filters. Set to nil if no filters are needed.
Returns:
- clientSubscription: The client subscription object, used to unsubscribe from the stream and to get errors
- error: An error, if any
func (*WsProvider) SubscribeNewHeads ¶ added in v0.8.0
func (provider *WsProvider) SubscribeNewHeads( ctx context.Context, headers chan<- *BlockHeader, subBlockID SubscriptionBlockID, ) (*client.ClientSubscription, error)
New block headers subscription. Creates a WebSocket stream which will fire events for new block headers
Parameters:
- ctx: The context.Context object for controlling the function call
- headers: The channel to send the new block headers to
- blockID (optional): The block to get notifications from, limited to 1024 blocks back. If empty, the latest block will be used
Returns:
- clientSubscription: The client subscription object, used to unsubscribe from the stream and to get errors
- error: An error, if any
func (*WsProvider) SubscribeNewTransactionReceipts ¶ added in v0.14.0
func (provider *WsProvider) SubscribeNewTransactionReceipts( ctx context.Context, txnReceipts chan<- *TransactionReceiptWithBlockInfo, options *SubNewTxnReceiptsInput, ) (*client.ClientSubscription, error)
New transactions receipts subscription 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.
Parameters:
- ctx: The context.Context object for controlling the function call
- txnReceipts: The channel to send the new transaction receipts to
- options: The optional input struct containing the optional filters. Set to nil if no filters are needed.
Returns:
- clientSubscription: The client subscription object, used to unsubscribe from the stream and to get errors
- error: An error, if any
func (*WsProvider) SubscribeNewTransactions ¶ added in v0.14.0
func (provider *WsProvider) SubscribeNewTransactions( ctx context.Context, newTxns chan<- *TxnWithHashAndStatus, options *SubNewTxnsInput, ) (*client.ClientSubscription, error)
New transactions subscription 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.
Parameters:
- ctx: The context.Context object for controlling the function call
- newTxns: The channel to send the new transactions to
- options: The optional input struct containing the optional filters. Set to nil if no filters are needed.
Returns:
- clientSubscription: The client subscription object, used to unsubscribe from the stream and to get errors
- error: An error, if any
func (*WsProvider) SubscribeTransactionStatus ¶ added in v0.8.0
func (provider *WsProvider) SubscribeTransactionStatus( ctx context.Context, newStatus chan<- *NewTxnStatus, transactionHash *felt.Felt, ) (*client.ClientSubscription, error)
Transaction Status subscription. Creates a WebSocket stream which at first fires an event with the current known transaction status, followed by events for every transaction status update
Parameters:
- ctx: The context.Context object for controlling the function call
- newStatus: The channel to send the new transaction status to
- transactionHash: The transaction hash to fetch status updates for
Returns:
- clientSubscription: The client subscription object, used to unsubscribe from the stream and to get errors
- error: An error, if any
Source Files
¶
- block.go
- call.go
- chain.go
- client.go
- contract.go
- errors.go
- events.go
- executables.go
- provider.go
- trace.go
- transaction.go
- types.go
- types_block.go
- types_broadcast_transaction.go
- types_contract.go
- types_event.go
- types_trace.go
- types_transaction.go
- types_transaction_interfaces.go
- types_transaction_receipt.go
- types_transaction_response.go
- version.go
- websocket.go
- write.go