Documentation ¶
Index ¶
- Constants
- Variables
- type ABI
- type ABIEntry
- type ABIType
- type AddDeclareTransactionOutput
- type AddDeclareTransactionResponse
- type AddDeclareTxnInput
- type AddDeployAccountTransactionResponse
- type AddInvokeTransactionResponse
- type Block
- type BlockDeclareTxnV0
- type BlockDeclareTxnV1
- type BlockDeclareTxnV2
- type BlockDeclareTxnV3
- type BlockDeployAccountTxn
- type BlockDeployTxn
- type BlockHashAndNumberOutput
- type BlockHeader
- type BlockID
- type BlockInvokeTxnV0
- type BlockInvokeTxnV1
- type BlockL1HandlerTxn
- type BlockStatus
- type BlockTransaction
- type BlockTransactions
- type BlockTxHashes
- type BroadcastAddDeployTxnType
- type BroadcastDeclareTxnType
- type BroadcastDeclareTxnV1
- type BroadcastDeclareTxnV2
- type BroadcastDeclareTxnV3
- type BroadcastDeployAccountTxn
- type BroadcastDeployAccountTxnV3
- type BroadcastInvokeTxnType
- type BroadcastInvokev0Txn
- type BroadcastInvokev1Txn
- type BroadcastInvokev3Txn
- type BroadcastTxn
- type CallCloser
- type CallType
- type ClassOutput
- type CommonTransactionReceipt
- type ContractClass
- type ContractNonce
- type ContractStorageDiffItem
- type DataAvailabilityMode
- type DeclareTransactionReceipt
- type DeclareTxnTrace
- type DeclareTxnType
- type DeclareTxnV0
- type DeclareTxnV1
- type DeclareTxnV2
- type DeclareTxnV3
- type DeclaredClassesItem
- type DeployAccountTransactionReceipt
- type DeployAccountTxn
- type DeployAccountTxnTrace
- type DeployAccountTxnV3
- type DeployAccountType
- type DeployTransactionReceipt
- type DeployTxn
- type DeployedContractItem
- type DeprecatedCairoEntryPoint
- type DeprecatedContractClass
- type DeprecatedEntryPointsByType
- type EmittedEvent
- type EntryPointType
- type EntryPointsByType
- type Event
- type EventABIEntry
- type EventChunk
- type EventFilter
- type EventsInput
- type ExecInvocation
- type ExecutionResources
- type FeeEstimate
- type FeePayment
- type FeePaymentUnit
- type FnInvocation
- type FunctionABIEntry
- type FunctionCall
- type FunctionStateMutability
- type InvokeTransactionReceipt
- type InvokeTxnTrace
- type InvokeTxnType
- type InvokeTxnV0
- type InvokeTxnV1
- type InvokeTxnV3
- type L1HandlerTransactionReceipt
- type L1HandlerTxn
- type L1HandlerTxnTrace
- type Member
- type MsgFromL1
- type MsgToL1
- type NumAsHex
- type OrderedEvent
- type OrderedMsg
- type PendingBlock
- type PendingBlockHeader
- type PendingBlockTxHashes
- type PendingCommonTransactionReceiptProperties
- type PendingDeclareTransactionReceipt
- type PendingDeployAccountTransactionReceipt
- type PendingInvokeTransactionReceipt
- type PendingL1HandlerTransactionReceipt
- type PendingStateUpdate
- type Provider
- func (provider *Provider) AddDeclareTransaction(ctx context.Context, declareTransaction BroadcastDeclareTxnType) (*AddDeclareTransactionResponse, error)
- func (provider *Provider) AddDeployAccountTransaction(ctx context.Context, deployAccountTransaction BroadcastAddDeployTxnType) (*AddDeployAccountTransactionResponse, error)
- func (provider *Provider) AddInvokeTransaction(ctx context.Context, invokeTxn BroadcastInvokeTxnType) (*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) 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) EstimateFee(ctx context.Context, requests []BroadcastTxn, simulationFlags []SimulationFlag, ...) ([]FeeEstimate, error)
- func (provider *Provider) EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (*FeeEstimate, error)
- func (provider *Provider) Events(ctx context.Context, input EventsInput) (*EventChunk, error)
- func (provider *Provider) GetTransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*TxnStatusResp, 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 []Transaction, ...) ([]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) (Transaction, error)
- func (provider *Provider) TransactionByHash(ctx context.Context, hash *felt.Felt) (Transaction, error)
- func (provider *Provider) TransactionReceipt(ctx context.Context, transactionHash *felt.Felt) (TransactionReceipt, error)
- type RPCError
- type ReplacedClassesItem
- type Resource
- type ResourceBounds
- type ResourceBoundsMapping
- type ResourcePrice
- type ResultPageRequest
- type RpcProvider
- type SierraEntryPoint
- type SimulateTransactionInput
- type SimulateTransactionOutput
- type SimulatedTransaction
- type SimulationFlag
- type StateDiff
- type StateUpdateOutput
- type StorageEntry
- type StructABIEntry
- type SyncStatus
- type TXN
- type Trace
- type Transaction
- type TransactionReceipt
- type TransactionType
- type TransactionVersion
- type TxDetails
- type TxnExecutionStatus
- type TxnFinalityStatus
- type TxnStatus
- type TxnStatusResp
- type TxnTrace
- type TypedParameter
- type U128
- type U64
- type UnknownTransaction
- type UnknownTransactionReceipt
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", } ErrContractNotFound = &RPCError{ code: 20, message: "Contract not found", } 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", } ErrTxnExec = &RPCError{ code: 41, message: "Transaction execution error", } ErrInvalidContractClass = &RPCError{ code: 50, message: "Invalid contract class", } ErrClassAlreadyDeclared = &RPCError{ code: 51, message: "Class already declared", } ErrInvalidTransactionNonce = &RPCError{ code: 52, message: "Invalid transaction nonce", } ErrInsufficientMaxFee = &RPCError{ code: 53, message: "Max fee is smaller than the minimal transaction cost (validation plus fee transfer)", } ErrInsufficientAccountBalance = &RPCError{ code: 54, message: "Account balance is smaller than the transaction's max_fee", } ErrValidationFailure = &RPCError{ code: 55, message: "Account validation failed", } ErrCompilationFailed = &RPCError{ code: 56, message: "Compilation failed", } 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", } )
var ErrInvalidBlockID = errors.New("invalid blockid")
var ErrNotImplemented = errors.New("not implemented")
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 { TransactionHash *felt.Felt `json:"transaction_hash"` ClassHash *felt.Felt `json:"class_hash"` }
AddDeclareTransactionResponse provides the output for AddDeclareTransaction.
type AddDeclareTxnInput ¶
type AddDeclareTxnInput interface{}
type AddDeployAccountTransactionResponse ¶
type AddDeployAccountTransactionResponse struct { TransactionHash *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 Block ¶
type Block struct { BlockHeader Status BlockStatus `json:"status"` // Transactions The transactions in this block Transactions BlockTransactions `json:"transactions"` }
type BlockDeclareTxnV0 ¶
type BlockDeclareTxnV0 struct { TransactionHash *felt.Felt `json:"transaction_hash"` DeclareTxnV0 }
func (BlockDeclareTxnV0) Hash ¶
func (tx BlockDeclareTxnV0) Hash() *felt.Felt
Hash returns the transaction hash of the BlockDeclareTxnV0.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockDeclareTxnV1 ¶
type BlockDeclareTxnV1 struct { TransactionHash *felt.Felt `json:"transaction_hash"` DeclareTxnV1 }
func (BlockDeclareTxnV1) Hash ¶
func (tx BlockDeclareTxnV1) Hash() *felt.Felt
Hash returns the transaction hash of the BlockDeclareTxnV1.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockDeclareTxnV2 ¶
type BlockDeclareTxnV2 struct { TransactionHash *felt.Felt `json:"transaction_hash"` DeclareTxnV2 }
func (BlockDeclareTxnV2) Hash ¶
func (tx BlockDeclareTxnV2) Hash() *felt.Felt
Hash returns the transaction hash of the BlockDeclareTxnV2.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockDeclareTxnV3 ¶
type BlockDeclareTxnV3 struct { TransactionHash *felt.Felt `json:"transaction_hash"` DeclareTxnV3 }
type BlockDeployAccountTxn ¶
type BlockDeployAccountTxn struct { TransactionHash *felt.Felt `json:"transaction_hash"` DeployAccountTxn }
func (BlockDeployAccountTxn) Hash ¶
func (tx BlockDeployAccountTxn) Hash() *felt.Felt
Hash returns the Felt hash of the BlockDeployAccountTxn.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockDeployTxn ¶
func (BlockDeployTxn) Hash ¶
func (tx BlockDeployTxn) Hash() *felt.Felt
Hash returns the hash of the BlockDeployTxn.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockHashAndNumberOutput ¶
type BlockHashAndNumberOutput struct { BlockNumber uint64 `json:"block_number,omitempty"` BlockHash *felt.Felt `json:"block_hash,omitempty"` }
BlockHashAndNumberOutput is a struct that is returned by BlockHashAndNumber.
type BlockHeader ¶
type BlockHeader struct { // BlockHash The hash of this block BlockHash *felt.Felt `json:"block_hash"` // ParentHash The hash of this block's parent ParentHash *felt.Felt `json:"parent_hash"` // BlockNumber the block number (its height) BlockNumber 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"` // 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"` Tag string `json:"block_tag,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 marshaling process.
Parameters:
none
Returns: - []byte: the JSON representation of the BlockID - error: any error that occurred during the marshaling process
type BlockInvokeTxnV0 ¶
type BlockInvokeTxnV0 struct { TransactionHash *felt.Felt `json:"transaction_hash"` InvokeTxnV0 }
func (BlockInvokeTxnV0) Hash ¶
func (tx BlockInvokeTxnV0) Hash() *felt.Felt
Hash returns the transaction hash of the BlockInvokeTxnV0.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockInvokeTxnV1 ¶
type BlockInvokeTxnV1 struct { TransactionHash *felt.Felt `json:"transaction_hash"` InvokeTxnV1 }
func (BlockInvokeTxnV1) Hash ¶
func (tx BlockInvokeTxnV1) Hash() *felt.Felt
Hash returns the hash of the BlockInvokeTxnV1 transaction.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockL1HandlerTxn ¶
type BlockL1HandlerTxn struct { TransactionHash *felt.Felt `json:"transaction_hash"` L1HandlerTxn }
func (BlockL1HandlerTxn) Hash ¶
func (tx BlockL1HandlerTxn) Hash() *felt.Felt
Hash returns the hash of the BlockL1HandlerTxn.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type BlockStatus ¶
type BlockStatus string
const ( BlockStatus_Pending BlockStatus = "PENDING" BlockStatus_AcceptedOnL2 BlockStatus = "ACCEPTED_ON_L2" BlockStatus_AcceptedOnL1 BlockStatus = "ACCEPTED_ON_L1" BlockStatus_Rejected BlockStatus = "REJECTED" )
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 BlockTransaction ¶
type BlockTransactions ¶
type BlockTransactions []BlockTransaction
func (*BlockTransactions) UnmarshalJSON ¶
func (txns *BlockTransactions) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the data into a BlockTransactions 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 ¶
type BlockTxHashes struct { BlockHeader Status BlockStatus `json:"status"` // Transactions The hashes of the transactions included in this block Transactions []*felt.Felt `json:"transactions"` }
type BroadcastAddDeployTxnType ¶
type BroadcastAddDeployTxnType interface{}
type BroadcastDeclareTxnType ¶
type BroadcastDeclareTxnType interface{}
type BroadcastDeclareTxnV1 ¶
type BroadcastDeclareTxnV1 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 NumAsHex `json:"version"` Signature []*felt.Felt `json:"signature"` Nonce *felt.Felt `json:"nonce"` ContractClass DeprecatedContractClass `json:"contract_class"` }
type BroadcastDeclareTxnV2 ¶
type BroadcastDeclareTxnV2 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 NumAsHex `json:"version"` Signature []*felt.Felt `json:"signature"` Nonce *felt.Felt `json:"nonce"` ContractClass ContractClass `json:"contract_class"` }
type BroadcastDeclareTxnV3 ¶
type BroadcastDeclareTxnV3 struct { Type TransactionType `json:"type"` SenderAddress *felt.Felt `json:"sender_address"` CompiledClassHash *felt.Felt `json:"compiled_class_hash"` Version NumAsHex `json:"version"` Signature []*felt.Felt `json:"signature"` Nonce *felt.Felt `json:"nonce"` ContractClass *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"` }
type BroadcastDeployAccountTxn ¶
type BroadcastDeployAccountTxn struct {
DeployAccountTxn
}
type BroadcastDeployAccountTxnV3 ¶
type BroadcastDeployAccountTxnV3 struct {
DeployAccountTxnV3
}
type BroadcastInvokeTxnType ¶
type BroadcastInvokeTxnType interface{}
type BroadcastInvokev0Txn ¶
type BroadcastInvokev0Txn struct {
InvokeTxnV0
}
type BroadcastInvokev1Txn ¶
type BroadcastInvokev1Txn struct {
InvokeTxnV1
}
type BroadcastInvokev3Txn ¶
type BroadcastInvokev3Txn struct {
InvokeTxnV3
}
type BroadcastTxn ¶
type BroadcastTxn interface{}
type CallCloser ¶
type ClassOutput ¶
type ClassOutput interface{}
type CommonTransactionReceipt ¶
type CommonTransactionReceipt struct { // TransactionHash The hash identifying the transaction TransactionHash *felt.Felt `json:"transaction_hash"` // ActualFee The fee that was charged by the sequencer ActualFee FeePayment `json:"actual_fee"` ExecutionStatus TxnExecutionStatus `json:"execution_status"` FinalityStatus TxnFinalityStatus `json:"finality_status"` BlockHash *felt.Felt `json:"block_hash"` BlockNumber uint64 `json:"block_number"` Type TransactionType `json:"type,omitempty"` MessagesSent []MsgToL1 `json:"messages_sent"` RevertReason string `json:"revert_reason,omitempty"` // Events The events emitted as part of this transaction Events []Event `json:"events"` ExecutionResources ExecutionResources `json:"execution_resources"` }
CommonTransactionReceipt Common properties for a transaction receipt
func (CommonTransactionReceipt) GetExecutionStatus ¶
func (tr CommonTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the CommonTransactionReceipt.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (CommonTransactionReceipt) Hash ¶
func (tr CommonTransactionReceipt) Hash() *felt.Felt
Hash returns the transaction hash associated with the CommonTransactionReceipt.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type ContractClass ¶
type ContractClass struct { // The list of Sierra instructions of which the program consists SierraProgram []*felt.Felt `json:"sierra_program"` // The version of the contract class object. Currently, the Starknet OS supports version 0.1.0 ContractClassVersion string `json:"contract_class_version"` EntryPointsByType EntryPointsByType `json:"entry_points_by_type"` ABI string `json:"abi,omitempty"` }
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 DataAvailabilityMode ¶
type DataAvailabilityMode string
const ( DAModeL1 DataAvailabilityMode = "L1" DAModeL2 DataAvailabilityMode = "L2" )
func (*DataAvailabilityMode) UInt64 ¶
func (da *DataAvailabilityMode) UInt64() (uint64, error)
type DeclareTransactionReceipt ¶
type DeclareTransactionReceipt CommonTransactionReceipt
DeclareTransactionReceipt Declare Transaction Receipt
func (DeclareTransactionReceipt) GetExecutionStatus ¶
func (tr DeclareTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the DeclareTransactionReceipt function.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (DeclareTransactionReceipt) Hash ¶
func (tr DeclareTransactionReceipt) Hash() *felt.Felt
Hash returns the transaction hash.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type DeclareTxnTrace ¶
type DeclareTxnTrace struct { ValidateInvocation FnInvocation `json:"validate_invocation"` FeeTransferInvocation FnInvocation `json:"fee_transfer_invocation"` StateDiff StateDiff `json:"state_diff"` Type TransactionType `json:"type"` }
the execution trace of a declare transaction
type DeclareTxnType ¶
type DeclareTxnType interface{}
type DeclareTxnV0 ¶
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) GetType ¶
func (tx DeclareTxnV0) GetType() TransactionType
type DeclareTxnV1 ¶
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) GetType ¶
func (tx DeclareTxnV1) GetType() TransactionType
type DeclareTxnV2 ¶
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) GetType ¶
func (tx DeclareTxnV2) GetType() TransactionType
type DeclareTxnV3 ¶
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) GetType ¶
func (tx DeclareTxnV3) GetType() TransactionType
type DeclaredClassesItem ¶
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 DeployAccountTransactionReceipt ¶
type DeployAccountTransactionReceipt struct { CommonTransactionReceipt // ContractAddress The address of the deployed contract ContractAddress *felt.Felt `json:"contract_address"` }
DeployAccountTransactionReceipt Deploy Account Transaction Receipt
func (DeployAccountTransactionReceipt) GetExecutionStatus ¶
func (tr DeployAccountTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the DeployAccountTransactionReceipt.
Parameters:
none
Returns: - *TxnExecutionStatus: the execution status
func (DeployAccountTransactionReceipt) Hash ¶
func (tr DeployAccountTransactionReceipt) Hash() *felt.Felt
Hash returns the transaction hash for the given DeployAccountTransactionReceipt.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type DeployAccountTxn ¶
type DeployAccountTxn 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"` }
DeployAccountTxn The structure of a deployAccount transaction.
func (DeployAccountTxn) GetType ¶
func (tx DeployAccountTxn) GetType() TransactionType
type DeployAccountTxnTrace ¶
type DeployAccountTxnTrace struct { ValidateInvocation FnInvocation `json:"validate_invocation"` //the trace of the __execute__ call or constructor call, depending on the transaction type (none for declare transactions) ConstructorInvocation FnInvocation `json:"constructor_invocation"` FeeTransferInvocation FnInvocation `json:"fee_transfer_invocation"` StateDiff StateDiff `json:"state_diff"` Type TransactionType `json:"type"` }
the execution trace of a deploy account transaction
type DeployAccountTxnV3 ¶
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) GetType ¶
func (tx DeployAccountTxnV3) GetType() TransactionType
type DeployAccountType ¶
type DeployAccountType interface{}
type DeployTransactionReceipt ¶
type DeployTransactionReceipt struct { CommonTransactionReceipt // The address of the deployed contract ContractAddress *felt.Felt `json:"contract_address"` }
DeployTransactionReceipt Deploy Transaction Receipt
func (DeployTransactionReceipt) GetExecutionStatus ¶
func (tr DeployTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the DeployTransactionReceipt.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (DeployTransactionReceipt) Hash ¶
func (tr DeployTransactionReceipt) Hash() *felt.Felt
Hash returns the transaction hash of the DeployTransactionReceipt.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
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 ¶
func (tx DeployTxn) GetType() TransactionType
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 DeprecatedContractClass ¶
type DeprecatedContractClass struct { // Program A base64 representation of the compressed program code Program string `json:"program"` DeprecatedEntryPointsByType DeprecatedEntryPointsByType `json:"entry_points_by_type"` ABI *ABI `json:"abi,omitempty"` }
func (*DeprecatedContractClass) UnmarshalJSON ¶
func (c *DeprecatedContractClass) UnmarshalJSON(content []byte) error
UnmarshalJSON unmarshals the JSON content into the DeprecatedContractClass struct.
It takes a byte array `content` as a parameter and returns an error if there is any. The function processes the `program` field in the JSON object. If `program` is a string, it is assigned to the `Program` field in the struct. Otherwise, it is encoded and assigned to the `Program` field. The function then processes the `entry_points_by_type` field in the JSON object. The value is unmarshaled into the `DeprecatedEntryPointsByType` field in the struct. Finally, the function processes the `abi` field in the JSON object. If it is missing, the function returns nil. Otherwise, it unmarshals the value into a slice of interfaces. For each element in the slice, it checks the type and assigns it to the appropriate field in the `ABI` field in the struct.
Parameters: - content: byte array Returns: - error: error if there is any
type DeprecatedEntryPointsByType ¶
type DeprecatedEntryPointsByType struct { Constructor []DeprecatedCairoEntryPoint `json:"CONSTRUCTOR"` External []DeprecatedCairoEntryPoint `json:"EXTERNAL"` L1Handler []DeprecatedCairoEntryPoint `json:"L1_HANDLER"` }
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 EntryPointType ¶
type EntryPointType string
const ( External EntryPointType = "EXTERNAL" L1Handler EntryPointType = "L1_HANDLER" Constructor EntryPointType = "CONSTRUCTOR" )
type EntryPointsByType ¶
type EntryPointsByType struct { Constructor []SierraEntryPoint `json:"CONSTRUCTOR"` External []SierraEntryPoint `json:"EXTERNAL"` L1Handler []SierraEntryPoint `json:"L1_HANDLER"` }
type EventABIEntry ¶
type EventABIEntry struct { // The event type Type ABIType `json:"type"` // The event name Name string `json:"name"` Keys []TypedParameter `json:"keys"` Data []TypedParameter `json:"data"` }
func (*EventABIEntry) IsType ¶
func (e *EventABIEntry) IsType() ABIType
IsType returns the ABIType of the EventABIEntry.
Parameters:
none
Returns: - ABIType: the ABIType
type EventChunk ¶
type EventChunk struct { Events []EmittedEvent `json:"events"` ContinuationToken string `json:"continuation_token,omitempty"` }
type EventFilter ¶
type EventFilter struct { // FromBlock from block FromBlock BlockID `json:"from_block"` // 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 EventsInput ¶
type EventsInput struct { EventFilter ResultPageRequest }
type ExecInvocation ¶
type ExecInvocation struct { FunctionInvocation FnInvocation `json:"function_invocation,omitempty"` RevertReason string `json:"revert_reason,omitempty"` }
type ExecutionResources ¶
type ExecutionResources struct { // The number of Cairo steps used Steps int `json:"steps"` // The number of unused memory cells (each cell is roughly equivalent to a step) MemoryHoles int `json:"memory_holes,omitempty"` // The number of RANGE_CHECK builtin instances RangeCheckApps int `json:"range_check_builtin_applications,omitempty"` // The number of Pedersen builtin instances PedersenApps int `json:"pedersen_builtin_applications,omitempty"` // The number of Poseidon builtin instances PoseidonApps int `json:"poseidon_builtin_applications,omitempty"` // The number of EC_OP builtin instances ECOPApps int `json:"ec_op_builtin_applications,omitempty"` // The number of ECDSA builtin instances ECDSAApps int `json:"ecdsa_builtin_applications,omitempty"` // The number of BITWISE builtin instances BitwiseApps int `json:"bitwise_builtin_applications,omitempty"` // The number of KECCAK builtin instances KeccakApps int `json:"keccak_builtin_applications,omitempty"` // The number of accesses to the segment arena SegmentArenaBuiltin int `json:"segment_arena_builtin,omitempty"` }
func (*ExecutionResources) Validate ¶
func (er *ExecutionResources) Validate() bool
Validate checks if the fields are non-zero (to match the starknet-specs)
type FeeEstimate ¶
type FeeEstimate struct { // GasConsumed the Ethereum gas cost of the transaction (see https://docs.starknet.io/docs/Fees/fee-mechanism for more info) GasConsumed *felt.Felt `json:"gas_consumed"` // The gas price (in gwei or fri, depending on the tx version) that was used in the cost estimation GasPrice *felt.Felt `json:"gas_price"` // The estimated fee for the transaction (in gwei or fri, depending on the tx version), product of gas_consumed and gas_price OverallFee *felt.Felt `json:"overall_fee"` // Units in which the fee is given FeeUnit FeePaymentUnit `json:"unit"` }
type FeePayment ¶
type FeePayment struct { Amount *felt.Felt `json:"amount"` Unit FeePaymentUnit `json:"unit"` }
type FeePaymentUnit ¶
type FeePaymentUnit string
const ( UnitWei FeePaymentUnit = "WEI" UnitStrk FeePaymentUnit = "FRI" )
type FnInvocation ¶
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 ExecutionResources `json:"execution_resources"` }
type FunctionABIEntry ¶
type FunctionABIEntry struct { // The function type Type ABIType `json:"type"` // The function name Name string `json:"name"` StateMutability FunctionStateMutability `json:"stateMutability,omitempty"` Inputs []TypedParameter `json:"inputs"` Outputs []TypedParameter `json:"outputs"` }
func (*FunctionABIEntry) IsType ¶
func (f *FunctionABIEntry) IsType() ABIType
IsType returns the ABIType of the FunctionABIEntry.
Parameters:
none
Returns: - ABIType: the ABIType
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 FunctionStateMutability ¶
type FunctionStateMutability string
const (
FuncStateMutVIEW FunctionStateMutability = "view"
)
type InvokeTransactionReceipt ¶
type InvokeTransactionReceipt CommonTransactionReceipt
InvokeTransactionReceipt Invoke Transaction Receipt
func (InvokeTransactionReceipt) GetExecutionStatus ¶
func (tr InvokeTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the InvokeTransactionReceipt.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (InvokeTransactionReceipt) Hash ¶
func (tr InvokeTransactionReceipt) Hash() *felt.Felt
Hash returns the hash of the invoke transaction receipt.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type InvokeTxnTrace ¶
type InvokeTxnTrace struct { ValidateInvocation FnInvocation `json:"validate_invocation"` //the trace of the __execute__ call or constructor call, depending on the transaction type (none for declare transactions) ExecuteInvocation ExecInvocation `json:"execute_invocation"` FeeTransferInvocation FnInvocation `json:"fee_transfer_invocation"` StateDiff StateDiff `json:"state_diff"` Type TransactionType `json:"type"` }
the execution trace of an invoke transaction
type InvokeTxnType ¶
type InvokeTxnType interface{}
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) GetType ¶
func (tx InvokeTxnV0) GetType() TransactionType
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) GetType ¶
func (tx InvokeTxnV1) GetType() TransactionType
type InvokeTxnV3 ¶
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) GetType ¶
func (tx InvokeTxnV3) GetType() TransactionType
type L1HandlerTransactionReceipt ¶
type L1HandlerTransactionReceipt CommonTransactionReceipt
L1HandlerTransactionReceipt L1 Handler Transaction Receipt
func (L1HandlerTransactionReceipt) GetExecutionStatus ¶
func (tr L1HandlerTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the L1HandlerTransactionReceipt.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (L1HandlerTransactionReceipt) Hash ¶
func (tr L1HandlerTransactionReceipt) Hash() *felt.Felt
Hash returns the transaction hash.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type L1HandlerTxn ¶
type L1HandlerTxn struct { Type TransactionType `json:"type,omitempty"` // Version of the transaction scheme Version *felt.Felt `json:"version"` // Nonce Nonce string `json:"nonce,omitempty"` FunctionCall }
func (L1HandlerTxn) GetType ¶
func (tx L1HandlerTxn) GetType() TransactionType
type L1HandlerTxnTrace ¶
type L1HandlerTxnTrace struct { //the trace of the __execute__ call or constructor call, depending on the transaction type (none for declare transactions) FunctionInvocation FnInvocation `json:"function_invocation"` StateDiff StateDiff `json:"state_diff"` Type TransactionType `json:"type"` }
the execution trace of an L1 handler transaction
type Member ¶
type Member struct { TypedParameter Offset int64 `json:"offset"` }
type MsgFromL1 ¶
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 OrderedEvent ¶
type OrderedMsg ¶
type PendingBlock ¶
type PendingBlock struct { PendingBlockHeader BlockTransactions }
type PendingBlockHeader ¶
type PendingBlockHeader struct { // ParentHash The hash of this block's parent ParentHash *felt.Felt `json:"parent_hash"` // 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"` // Semver of the current Starknet protocol StarknetVersion string `json:"starknet_version"` }
type PendingBlockTxHashes ¶
type PendingBlockTxHashes struct { PendingBlockHeader Transactions []*felt.Felt `json:"transactions"` }
type PendingCommonTransactionReceiptProperties ¶
type PendingCommonTransactionReceiptProperties struct { // TransactionHash The hash identifying the transaction TransactionHash *felt.Felt `json:"transaction_hash"` // ActualFee The fee that was charged by the sequencer ActualFee FeePayment `json:"actual_fee"` MessagesSent []MsgToL1 `json:"messages_sent"` ExecutionStatus TxnExecutionStatus `json:"execution_status"` FinalityStatus TxnFinalityStatus `json:"finality_status"` RevertReason string `json:"revert_reason"` // Events The events emitted as part of this transaction Events []Event `json:"events"` ExecutionResources ExecutionResources `json:"execution_resources"` }
func (PendingCommonTransactionReceiptProperties) GetExecutionStatus ¶
func (tr PendingCommonTransactionReceiptProperties) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the pending common transaction receipt properties.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (PendingCommonTransactionReceiptProperties) Hash ¶
func (tr PendingCommonTransactionReceiptProperties) Hash() *felt.Felt
Hash returns the transaction hash of the PendingCommonTransactionReceiptProperties.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type PendingDeclareTransactionReceipt ¶
type PendingDeclareTransactionReceipt struct { Type TransactionType `json:"type"` PendingCommonTransactionReceiptProperties }
func (PendingDeclareTransactionReceipt) GetExecutionStatus ¶
func (tr PendingDeclareTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
func (PendingDeclareTransactionReceipt) Hash ¶
func (tr PendingDeclareTransactionReceipt) Hash() *felt.Felt
type PendingDeployAccountTransactionReceipt ¶
type PendingDeployAccountTransactionReceipt struct { Type TransactionType `json:"type"` // The address of the deployed contract ContractAddress *felt.Felt `json:"contract_address"` PendingCommonTransactionReceiptProperties }
func (PendingDeployAccountTransactionReceipt) GetExecutionStatus ¶
func (tr PendingDeployAccountTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the pending deploy transaction receipt.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (PendingDeployAccountTransactionReceipt) Hash ¶
func (tr PendingDeployAccountTransactionReceipt) Hash() *felt.Felt
Hash returns the transaction hash of the pending deploy transaction receipt.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type PendingInvokeTransactionReceipt ¶
type PendingInvokeTransactionReceipt struct { Type TransactionType `json:"type"` PendingCommonTransactionReceiptProperties }
func (PendingInvokeTransactionReceipt) GetExecutionStatus ¶
func (tr PendingInvokeTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
GetExecutionStatus returns the execution status of the pending deploy transaction receipt.
Parameters:
none
Returns: - TxnExecutionStatus: the execution status
func (PendingInvokeTransactionReceipt) Hash ¶
func (tr PendingInvokeTransactionReceipt) Hash() *felt.Felt
Hash returns the transaction hash of the pending deploy transaction receipt.
Parameters:
none
Returns: - *felt.Felt: the transaction hash
type PendingL1HandlerTransactionReceipt ¶
type PendingL1HandlerTransactionReceipt struct { Type TransactionType `json:"type"` // The message hash as it appears on the L1 core contract MsgHash NumAsHex `json:"message_hash"` PendingCommonTransactionReceiptProperties }
func (PendingL1HandlerTransactionReceipt) GetExecutionStatus ¶
func (tr PendingL1HandlerTransactionReceipt) GetExecutionStatus() TxnExecutionStatus
func (PendingL1HandlerTransactionReceipt) Hash ¶
func (tr PendingL1HandlerTransactionReceipt) Hash() *felt.Felt
type PendingStateUpdate ¶
type PendingStateUpdate struct { // OldRoot is the previous global state root. OldRoot *felt.Felt `json:"old_root"` // AcceptedTime is when the block was accepted on L1. StateDiff StateDiff `json:"state_diff"` }
PENDING_STATE_UPDATE in spec
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider provides the provider for starknet.go/rpc implementation.
func NewProvider ¶
func NewProvider(c CallCloser) *Provider
NewProvider creates a new Provider instance with the given RPC (`go-ethereum/rpc`) client.
It takes a *rpc.Client as a parameter and returns a pointer to a Provider struct.
func (*Provider) AddDeclareTransaction ¶
func (provider *Provider) AddDeclareTransaction(ctx context.Context, declareTransaction BroadcastDeclareTxnType) (*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 BroadcastAddDeployTxnType) (*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 BroadcastInvokeTxnType) (*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) 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) EstimateFee ¶
func (provider *Provider) EstimateFee(ctx context.Context, requests []BroadcastTxn, simulationFlags []SimulationFlag, blockID BlockID) ([]FeeEstimate, 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. For v0-2 transactions the estimate is given in wei, and for v3 transactions it is given in fri.
func (*Provider) EstimateMessageFee ¶
func (provider *Provider) EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (*FeeEstimate, 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: - *FeeEstimate: 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) GetTransactionStatus ¶
func (provider *Provider) GetTransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*TxnStatusResp, 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 transaction hash as a felt Returns: - *GetTxnStatusResp: The transaction 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 ¶
func (provider *Provider) SimulateTransactions(ctx context.Context, blockID BlockID, txns []Transaction, 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.
func (*Provider) SpecVersion ¶
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 synchronization status of the provider.
Parameters: - ctx: The context.Context object for the function Returns: - *SyncStatus: The synchronization 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 - blockHash: the hash of the block to retrieve the traces from 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 ¶
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) (Transaction, 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: - Transaction: The retrieved Transaction object - error: An error, if any
func (*Provider) TransactionByHash ¶
func (provider *Provider) TransactionByHash(ctx context.Context, hash *felt.Felt) (Transaction, 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: - Transaction: The retrieved Transaction - error: An error if any
func (*Provider) TransactionReceipt ¶
func (provider *Provider) TransactionReceipt(ctx context.Context, transactionHash *felt.Felt) (TransactionReceipt, 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 RPCError ¶
type RPCError struct {
// contains filtered or unexported fields
}
func Err ¶
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) Code ¶
Code returns the code of the RPCError.
Parameters:
none
Returns:
- int: the code
type ReplacedClassesItem ¶
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 ResourceBounds ¶
type ResourceBoundsMapping ¶
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 L2 gas used in this tx L2Gas ResourceBounds `json:"l2_gas"` }
type ResourcePrice ¶
type ResultPageRequest ¶
type RpcProvider ¶
type RpcProvider interface { AddInvokeTransaction(ctx context.Context, invokeTxn BroadcastInvokeTxnType) (*AddInvokeTransactionResponse, error) AddDeclareTransaction(ctx context.Context, declareTransaction BroadcastDeclareTxnType) (*AddDeclareTransactionResponse, error) AddDeployAccountTransaction(ctx context.Context, deployAccountTransaction BroadcastAddDeployTxnType) (*AddDeployAccountTransactionResponse, error) BlockHashAndNumber(ctx context.Context) (*BlockHashAndNumberOutput, error) BlockNumber(ctx context.Context) (uint64, error) BlockTransactionCount(ctx context.Context, blockID BlockID) (uint64, 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) EstimateFee(ctx context.Context, requests []BroadcastTxn, simulationFlags []SimulationFlag, blockID BlockID) ([]FeeEstimate, error) EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (*FeeEstimate, error) Events(ctx context.Context, input EventsInput) (*EventChunk, error) GetTransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*TxnStatusResp, error) Nonce(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error) SimulateTransactions(ctx context.Context, blockID BlockID, txns []Transaction, 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) (Transaction, error) TransactionByHash(ctx context.Context, hash *felt.Felt) (Transaction, error) TransactionReceipt(ctx context.Context, transactionHash *felt.Felt) (TransactionReceipt, error) TraceTransaction(ctx context.Context, transactionHash *felt.Felt) (TxnTrace, error) }
type SierraEntryPoint ¶
type SimulateTransactionInput ¶
type SimulateTransactionInput struct { //a sequence of transactions to simulate, running each transaction on the state resulting from applying all the previous ones Txns []Transaction `json:"transactions"` BlockID BlockID `json:"block_id"` SimulationFlags []SimulationFlag `json:"simulation_flags"` }
type SimulateTransactionOutput ¶
type SimulateTransactionOutput struct {
Txns []SimulatedTransaction `json:"result"`
}
The execution trace and consumed resources of the required transactions
type SimulatedTransaction ¶
type SimulatedTransaction struct { TxnTrace `json:"transaction_trace"` FeeEstimate `json:"fee_estimation"` }
type SimulationFlag ¶
type SimulationFlag string
const ( SKIP_FEE_CHARGE SimulationFlag = "SKIP_FEE_CHARGE" SKIP_EXECUTE SimulationFlag = "SKIP_EXECUTE" // Flags that indicate how to simulate a given transaction. By default, the sequencer behavior 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, BlockHash *felt.Felt `json:"block_hash"` // NewRoot is the new global state root. NewRoot *felt.Felt `json:"new_root"` // Pending PendingStateUpdate }
STATE_UPDATE in spec
type StorageEntry ¶
type StructABIEntry ¶
type StructABIEntry struct { // The event type Type ABIType `json:"type"` // The event name Name string `json:"name"` // todo(minumum size should be 1) Size uint64 `json:"size"` Members []Member `json:"members"` }
func (*StructABIEntry) IsType ¶
func (s *StructABIEntry) IsType() ABIType
IsType returns the ABIType of the StructABIEntry.
Parameters:
none
Returns: - ABIType: the ABIType
type SyncStatus ¶
type SyncStatus struct { SyncStatus bool // todo(remove? not in spec) StartingBlockHash *felt.Felt `json:"starting_block_hash,omitempty"` StartingBlockNum NumAsHex `json:"starting_block_num,omitempty"` CurrentBlockHash *felt.Felt `json:"current_block_hash,omitempty"` CurrentBlockNum NumAsHex `json:"current_block_num,omitempty"` HighestBlockHash *felt.Felt `json:"highest_block_hash,omitempty"` HighestBlockNum NumAsHex `json:"highest_block_num,omitempty"` }
SyncStatus is An object describing the node synchronization status
func (SyncStatus) MarshalJSON ¶
func (s SyncStatus) MarshalJSON() ([]byte, error)
MarshalJSON marshals the SyncStatus struct into JSON format.
It returns a byte slice and an error. The byte slice represents the JSON encoding of the SyncStatus struct, while the error indicates any error that occurred during the marshaling process.
Parameters:
none
Returns: - []byte: the JSON encoding of the SyncStatus struct - error: any error that occurred during the marshaling process
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 TXN ¶
type TXN struct { Hash *felt.Felt `json:"transaction_hash,omitempty"` Type TransactionType `json:"type"` Version *felt.Felt `json:"version,omitempty"` Nonce *felt.Felt `json:"nonce,omitempty"` MaxFee *felt.Felt `json:"max_fee,omitempty"` ContractAddress *felt.Felt `json:"contract_address,omitempty"` ContractAddressSalt *felt.Felt `json:"contract_address_salt,omitempty"` ClassHash *felt.Felt `json:"class_hash,omitempty"` ConstructorCalldata []*felt.Felt `json:"constructor_calldata,omitempty"` SenderAddress *felt.Felt `json:"sender_address,omitempty"` Signature *[]*felt.Felt `json:"signature,omitempty"` Calldata *[]*felt.Felt `json:"calldata,omitempty"` EntryPointSelector *felt.Felt `json:"entry_point_selector,omitempty"` CompiledClassHash *felt.Felt `json:"compiled_class_hash,omitempty"` }
type Trace ¶
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
type Transaction ¶
type Transaction interface {
GetType() TransactionType
}
type TransactionReceipt ¶
type TransactionReceipt interface { Hash() *felt.Felt GetExecutionStatus() TxnExecutionStatus }
type TransactionType ¶
type TransactionType string
TODO: check how we can move that type up in starknet.go/types
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.
Parameters:
none
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" )
type TxDetails ¶
type TxDetails struct { Nonce *felt.Felt MaxFee *felt.Felt Version TransactionVersion }
TxDetails contains details needed for computing transaction hashes
type TxnExecutionStatus ¶
type TxnExecutionStatus string
const ( TxnExecutionStatusSUCCEEDED TxnExecutionStatus = "SUCCEEDED" TxnExecutionStatusREVERTED TxnExecutionStatus = "REVERTED" )
func (TxnExecutionStatus) MarshalJSON ¶
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 marshaled byte slice and a nil error.
Parameters:
none
Returns: - []byte: the JSON encoding of the TxnExecutionStatus - error: the error if there was an issue marshaling
func (TxnExecutionStatus) String ¶
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 ¶
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 ¶
type TxnFinalityStatus string
const ( TxnFinalityStatusAcceptedOnL1 TxnFinalityStatus = "ACCEPTED_ON_L1" TxnFinalityStatusAcceptedOnL2 TxnFinalityStatus = "ACCEPTED_ON_L2" )
func (TxnFinalityStatus) MarshalJSON ¶
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 ¶
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 ¶
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 TxnStatus ¶
type TxnStatus string
The finality status of the transaction, including the case the txn is still in the mempool or failed validation during the block construction phase
type TxnStatusResp ¶
type TxnStatusResp struct { ExecutionStatus TxnExecutionStatus `json:"execution_status,omitempty"` FinalityStatus TxnStatus `json:"finality_status"` }
type TypedParameter ¶
type UnknownTransaction ¶
type UnknownTransaction struct{ Transaction }
func (*UnknownTransaction) UnmarshalJSON ¶
func (txn *UnknownTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON data into an UnknownTransaction object.
Parameters: - data: The JSON data to be unmarshalled Returns: - error: An error if the unmarshalling process fails
type UnknownTransactionReceipt ¶
type UnknownTransactionReceipt struct{ TransactionReceipt }
func (*UnknownTransactionReceipt) UnmarshalJSON ¶
func (tr *UnknownTransactionReceipt) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the given JSON data into an UnknownTransactionReceipt.
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
Source Files ¶
- block.go
- call.go
- chain.go
- client.go
- contract.go
- errors.go
- events.go
- provider.go
- trace.go
- transaction.go
- types.go
- types_block.go
- types_block_transaction.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
- write.go