rpc

package
v0.4.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 12 Imported by: 45

README

RPC implementation

starknet.go RPC implementation provides the RPC API to perform operations with Starknet. It is currently being tested and maintained up-to-date with Pathfinder and relies on go-ethereum to provide the JSON RPC 2.0 client implementation.

If you need starknet.go to support another API, open an issue on the project.

Testing the RPC API

To test the RPC API, you should simply go the the rpc directory and run go test like below:

cd rpc
go test -v .

We provide an additional -env flag to go test so that you can choose the environment you want to test. For instance, if you plan to test with the testnet, run:

cd rpc
go test -env testnet -v .

Supported environments are mock, testnet and mainnet. The support for devnet is planned but might require some dedicated condition since it is empty.

If you plan to specify an alternative URL to test the environment, you can set the INTEGRATION_BASE environment variable. In addition, tests load .env.${env}, and .env before relying on the environment variable. So for instanve if you want the URL to change only for the testnet environment, you could add the line below in .env.testnet:

INTEGRATION_BASE=http://localhost:9546

Documentation

Index

Constants

View Source
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

View Source
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",
	}
	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",
	}
)
View Source
var ErrInvalidBlockID = errors.New("invalid blockid")
View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

func NewClient added in v0.4.6

func NewClient(url string) (*ethrpc.Client, error)

Types

type ABI

type ABI []ABIEntry

type ABIEntry

type ABIEntry interface {
	IsType() ABIType
}

type ABIType

type ABIType string
const (
	ABITypeConstructor ABIType = "constructor"
	ABITypeFunction    ABIType = "function"
	ABITypeL1Handler   ABIType = "l1_handler"
	ABITypeEvent       ABIType = "event"
	ABITypeStruct      ABIType = "struct"
)

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 added in v0.4.4

type AddDeclareTxnInput interface{}

type AddDeployAccountTransactionResponse added in v0.4.3

type AddDeployAccountTransactionResponse struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	ContractAddress *felt.Felt `json:"contract_address"`
}

AddDeployTransactionResponse provides the output for AddDeployTransaction.

type AddInvokeTransactionResponse

type AddInvokeTransactionResponse struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
}

type Block

type Block struct {
	BlockHeader
	Status BlockStatus `json:"status"`
	// Transactions The transactions in this block
	Transactions BlockTransactions `json:"transactions"`
}

type BlockDeclareTxnV0 added in v0.4.4

type BlockDeclareTxnV0 struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	DeclareTxnV0
}

func (BlockDeclareTxnV0) Hash added in v0.4.4

func (tx BlockDeclareTxnV0) Hash() *felt.Felt

type BlockDeclareTxnV1 added in v0.4.4

type BlockDeclareTxnV1 struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	DeclareTxnV1
}

func (BlockDeclareTxnV1) Hash added in v0.4.4

func (tx BlockDeclareTxnV1) Hash() *felt.Felt

type BlockDeclareTxnV2 added in v0.4.4

type BlockDeclareTxnV2 struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	DeclareTxnV2
}

func (BlockDeclareTxnV2) Hash added in v0.4.4

func (tx BlockDeclareTxnV2) Hash() *felt.Felt

type BlockDeployAccountTxn added in v0.4.4

type BlockDeployAccountTxn struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	DeployAccountTxn
}

func (BlockDeployAccountTxn) Hash added in v0.4.4

func (tx BlockDeployAccountTxn) Hash() *felt.Felt

type BlockDeployTxn added in v0.4.4

type BlockDeployTxn struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	DeployTxn
}

func (BlockDeployTxn) Hash added in v0.4.4

func (tx BlockDeployTxn) Hash() *felt.Felt

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"`
}

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

func WithBlockHash(h *felt.Felt) BlockID

func WithBlockNumber

func WithBlockNumber(n uint64) BlockID

func WithBlockTag

func WithBlockTag(tag string) BlockID

func (BlockID) MarshalJSON

func (b BlockID) MarshalJSON() ([]byte, error)

type BlockInvokeTxnV0 added in v0.4.4

type BlockInvokeTxnV0 struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	InvokeTxnV0
}

func (BlockInvokeTxnV0) Hash added in v0.4.4

func (tx BlockInvokeTxnV0) Hash() *felt.Felt

type BlockInvokeTxnV1 added in v0.4.4

type BlockInvokeTxnV1 struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	InvokeTxnV1
}

func (BlockInvokeTxnV1) Hash added in v0.4.4

func (tx BlockInvokeTxnV1) Hash() *felt.Felt

type BlockL1HandlerTxn added in v0.4.4

type BlockL1HandlerTxn struct {
	TransactionHash *felt.Felt `json:"transaction_hash"`
	L1HandlerTxn
}

func (BlockL1HandlerTxn) Hash added in v0.4.4

func (tx BlockL1HandlerTxn) Hash() *felt.Felt

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)

func (*BlockStatus) UnmarshalJSON

func (bs *BlockStatus) UnmarshalJSON(data []byte) error

type BlockTransaction added in v0.4.4

type BlockTransaction interface {
	Hash() *felt.Felt
}

type BlockTransactions added in v0.4.4

type BlockTransactions []BlockTransaction

func (*BlockTransactions) UnmarshalJSON added in v0.4.4

func (txns *BlockTransactions) UnmarshalJSON(data []byte) error

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 CallType added in v0.4.3

type CallType string
const (
	LibraryCall CallType = "LIBRARY_CALL"
	Call        CallType = "CALL"
)

type ClassOutput added in v0.4.3

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       *felt.Felt         `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"`
}

CommonTransactionReceipt Common properties for a transaction receipt

func (CommonTransactionReceipt) GetExecutionStatus added in v0.4.4

func (tr CommonTransactionReceipt) GetExecutionStatus() TxnExecutionStatus

func (CommonTransactionReceipt) Hash

func (tr CommonTransactionReceipt) Hash() *felt.Felt

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 DeclareTransactionReceipt

type DeclareTransactionReceipt CommonTransactionReceipt

DeclareTransactionReceipt Declare Transaction Receipt

func (DeclareTransactionReceipt) GetExecutionStatus added in v0.4.4

func (tr DeclareTransactionReceipt) GetExecutionStatus() TxnExecutionStatus

func (DeclareTransactionReceipt) Hash

func (tr DeclareTransactionReceipt) Hash() *felt.Felt

type DeclareTxnTrace added in v0.4.3

type DeclareTxnTrace struct {
	ValidateInvocation    FnInvocation `json:"validate_invocation"`
	FeeTransferInvocation FnInvocation `json:"fee_transfer_invocation"`
}

the execution trace of a declare transaction

type DeclareTxnType added in v0.4.6

type DeclareTxnType interface{}

type DeclareTxnV0 added in v0.4.4

type DeclareTxnV0 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 the address of the account contract sending the declaration transaction
	SenderAddress *felt.Felt `json:"sender_address"`

	DeprecatedContractClass `json:"contract_class,omitempty"`
	ClassHash               *felt.Felt `json:"class_hash,omitempty"`
}

func (DeclareTxnV0) GetType added in v0.4.4

func (tx DeclareTxnV0) GetType() TransactionType

type DeclareTxnV1 added in v0.4.3

type DeclareTxnV1 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 declared class
	ClassHash *felt.Felt `json:"class_hash,omitempty"`

	DeprecatedContractClass `json:"contract_class,omitempty"`

	// SenderAddress the address of the account contract sending the declaration transaction
	SenderAddress *felt.Felt `json:"sender_address"`
}

func (DeclareTxnV1) GetType added in v0.4.4

func (tx DeclareTxnV1) GetType() TransactionType

type DeclareTxnV2 added in v0.4.3

type DeclareTxnV2 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 the address of the account contract sending the declaration transaction
	SenderAddress *felt.Felt `json:"sender_address"`

	CompiledClassHash *felt.Felt `json:"compiled_class_hash"`

	ContractClass `json:"contract_class,omitempty"`
	ClassHash     *felt.Felt `json:"class_hash,omitempty"`
}

func (DeclareTxnV2) GetType added in v0.4.4

func (tx DeclareTxnV2) GetType() TransactionType

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 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 added in v0.4.4

func (tr DeployAccountTransactionReceipt) GetExecutionStatus() TxnExecutionStatus

func (DeployAccountTransactionReceipt) Hash added in v0.4.3

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 added in v0.4.4

func (tx DeployAccountTxn) GetType() TransactionType

type DeployAccountTxnTrace added in v0.4.3

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"`
}

the execution trace of a deploy account transaction

type DeployAccountType added in v0.4.6

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 added in v0.4.4

func (tr DeployTransactionReceipt) GetExecutionStatus() TxnExecutionStatus

func (DeployTransactionReceipt) Hash added in v0.4.3

func (tr DeployTransactionReceipt) Hash() *felt.Felt

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

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 DeprecatedCairoEntryPoint added in v0.4.3

type DeprecatedCairoEntryPoint struct {
	// The offset of the entry point in the program
	Offset NumAsHex `json:"offset"`
	// A unique  identifier of the entry point (function) in the program
	Selector *felt.Felt `json:"selector"`
}

type DeprecatedContractClass added in v0.4.3

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 added in v0.4.3

func (c *DeprecatedContractClass) UnmarshalJSON(content []byte) error

type DeprecatedEntryPointsByType added in v0.4.3

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"`
	// BlockNumber the number of the block in which the event was emitted
	BlockNumber uint64 `json:"block_number"`
	// 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 added in v0.4.3

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 EstimateFeeInput added in v0.4.4

type EstimateFeeInput interface{}

type Event

type Event struct {
	FromAddress *felt.Felt   `json:"from_address"`
	Keys        []*felt.Felt `json:"keys"`
	Data        []*felt.Felt `json:"data"`
}

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

type EventChunk added in v0.4.3

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 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 NumAsHex `json:"gas_consumed"`

	// GasPrice the gas price (in gwei) that was used in the cost estimation
	GasPrice NumAsHex `json:"gas_price"`

	// OverallFee the estimated fee for the transaction (in gwei), product of gas_consumed and gas_price
	OverallFee NumAsHex `json:"overall_fee"`
}

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,omitempty"`

	// The hash of the class being called
	ClassHash *felt.Felt `json:"class_hash,omitempty"`

	EntryPointType EntryPointType `json:"entry_point_type,omitempty"`

	CallType CallType `json:"call_type,omitempty"`

	//The value returned from the function invocation
	Result []*felt.Felt `json:"result,omitempty"`

	// The calls made by this invocation
	NestedCalls []FnInvocation `json:"calls,omitempty"`

	// The events emitted in this invocation
	InvocationEvents []Event `json:"events,omitempty"`

	// The messages sent by this invocation to L1
	L1Messages []MsgToL1 `json:"messages,omitempty"`
}

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

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 added in v0.4.3

type FunctionStateMutability string
const (
	FuncStateMutVIEW FunctionStateMutability = "view"
)

type InvokeTransactionReceipt

type InvokeTransactionReceipt CommonTransactionReceipt

InvokeTransactionReceipt Invoke Transaction Receipt

func (InvokeTransactionReceipt) GetExecutionStatus added in v0.4.4

func (tr InvokeTransactionReceipt) GetExecutionStatus() TxnExecutionStatus

func (InvokeTransactionReceipt) Hash

func (tr InvokeTransactionReceipt) Hash() *felt.Felt

type InvokeTxnTrace added in v0.4.3

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     FnInvocation `json:"execute_invocation"`
	FeeTransferInvocation FnInvocation `json:"fee_transfer_invocation"`
}

the execution trace of an invoke transaction

type InvokeTxnType added in v0.4.6

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 added in v0.4.4

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 added in v0.4.4

func (tx InvokeTxnV1) GetType() TransactionType

type L1HandlerTransactionReceipt

type L1HandlerTransactionReceipt CommonTransactionReceipt

L1HandlerTransactionReceipt L1 Handler Transaction Receipt

func (L1HandlerTransactionReceipt) GetExecutionStatus added in v0.4.4

func (tr L1HandlerTransactionReceipt) GetExecutionStatus() TxnExecutionStatus

func (L1HandlerTransactionReceipt) Hash

type L1HandlerTxn

type L1HandlerTxn struct {
	Type TransactionType `json:"type,omitempty"`
	// Version of the transaction scheme
	Version NumAsHex `json:"version"`
	// Nonce
	Nonce string `json:"nonce,omitempty"`
	FunctionCall
}

func (L1HandlerTxn) GetType added in v0.4.4

func (tx L1HandlerTxn) GetType() TransactionType

type L1HandlerTxnTrace added in v0.4.3

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"`
}

the execution trace of an L1 handler transaction

type Member

type Member struct {
	TypedParameter
	Offset int64 `json:"offset"`
}

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 NumAsHex

type NumAsHex string

type PendingBlock

type PendingBlock 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"`
	// Transactions The transactions in this block
	Transactions BlockTransactions `json:"transactions"`
}

type PendingBlockTxHashes added in v0.4.4

type PendingBlockTxHashes 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"`
	// Transactions The hashes of the transactions included in this block
	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       *felt.Felt         `json:"actual_fee"`
	Type            TransactionType    `json:"type,omitempty"`
	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"`
}

func (PendingCommonTransactionReceiptProperties) GetExecutionStatus added in v0.4.4

func (PendingCommonTransactionReceiptProperties) Hash added in v0.4.3

type PendingDeployTransactionReceipt

type PendingDeployTransactionReceipt struct {
	CommonTransactionReceipt
	// The address of the deployed contract
	ContractAddress *felt.Felt `json:"contract_address"`
}

func (PendingDeployTransactionReceipt) GetExecutionStatus added in v0.4.4

func (tr PendingDeployTransactionReceipt) GetExecutionStatus() TxnExecutionStatus

func (PendingDeployTransactionReceipt) Hash added in v0.4.3

type PendingStateUpdate added in v0.4.3

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 *rpc.Client) *Provider

NewProvider creates a *Provider from an existing `go-ethereum/rpc` *Client.

func (*Provider) AddDeclareTransaction

func (provider *Provider) AddDeclareTransaction(ctx context.Context, declareTransaction AddDeclareTxnInput) (*AddDeclareTransactionResponse, error)

func (*Provider) AddDeployAccountTransaction

func (provider *Provider) AddDeployAccountTransaction(ctx context.Context, deployAccountTransaction DeployAccountTxn) (*AddDeployAccountTransactionResponse, error)

AddDeployAccountTransaction manages the DEPLOY_ACCOUNT syscall

func (*Provider) AddInvokeTransaction

func (provider *Provider) AddInvokeTransaction(ctx context.Context, invokeTxn InvokeTxnV1) (*AddInvokeTransactionResponse, error)

func (*Provider) BlockHashAndNumber

func (provider *Provider) BlockHashAndNumber(ctx context.Context) (*BlockHashAndNumberOutput, error)

BlockHashAndNumber gets block information given the block number or its hash.

func (*Provider) BlockNumber

func (provider *Provider) BlockNumber(ctx context.Context) (uint64, error)

BlockNumber gets the most recent accepted block number.

func (*Provider) BlockTransactionCount

func (provider *Provider) BlockTransactionCount(ctx context.Context, blockID BlockID) (uint64, error)

BlockTransactionCount gets the number of transactions in a block

func (*Provider) BlockWithTxHashes

func (provider *Provider) BlockWithTxHashes(ctx context.Context, blockID BlockID) (interface{}, error)

BlockWithTxHashes gets block information given the block id.

func (*Provider) BlockWithTxs

func (provider *Provider) BlockWithTxs(ctx context.Context, blockID BlockID) (interface{}, error)

BlockWithTxs get block information with full transactions given the block id.

func (*Provider) Call

func (provider *Provider) Call(ctx context.Context, request FunctionCall, blockID BlockID) ([]*felt.Felt, error)

Call a starknet function without creating a Starknet transaction.

func (*Provider) ChainID

func (provider *Provider) ChainID(ctx context.Context) (string, error)

ChainID retrieves the current chain ID for transaction replay protection.

func (*Provider) Class

func (provider *Provider) Class(ctx context.Context, blockID BlockID, classHash *felt.Felt) (ClassOutput, error)

Class gets the contract class definition associated with the given hash.

func (*Provider) ClassAt

func (provider *Provider) ClassAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (ClassOutput, error)

ClassAt get the contract class definition at the given address.

func (*Provider) ClassHashAt

func (provider *Provider) ClassHashAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*felt.Felt, error)

ClassHashAt gets the contract class hash for the contract deployed at the given address.

func (*Provider) EstimateFee

func (provider *Provider) EstimateFee(ctx context.Context, requests []EstimateFeeInput, blockID BlockID) ([]FeeEstimate, error)

EstimateFee estimates the fee for a given Starknet transaction.

func (*Provider) EstimateMessageFee added in v0.4.4

func (provider *Provider) EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (*FeeEstimate, error)

EstimateMessageFee estimates the L2 fee of a message sent on L1

func (*Provider) Events

func (provider *Provider) Events(ctx context.Context, input EventsInput) (*EventChunk, error)

Events returns all events matching the given filter

func (*Provider) Nonce

func (provider *Provider) Nonce(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*string, error)

Nonce returns the Nonce of a contract

func (*Provider) PendingTransaction

func (provider *Provider) PendingTransaction(ctx context.Context) ([]Transaction, error)

PendingTransaction returns the transactions in the transaction pool, recognized by this sequencer.

func (*Provider) SimulateTransactions added in v0.4.3

func (provider *Provider) SimulateTransactions(ctx context.Context, blockID BlockID, txns []Transaction, simulationFlags []SimulationFlag) ([]SimulatedTransaction, error)

simulate a given transaction on the requested state, and generate the execution trace

func (*Provider) StateUpdate

func (provider *Provider) StateUpdate(ctx context.Context, blockID BlockID) (*StateUpdateOutput, error)

StateUpdate gets the information about the result of executing the requested block.

func (*Provider) StorageAt

func (provider *Provider) StorageAt(ctx context.Context, contractAddress *felt.Felt, key string, blockID BlockID) (string, error)

StorageAt gets the value of the storage at the given address and key.

func (*Provider) Syncing

func (provider *Provider) Syncing(ctx context.Context) (*SyncStatus, error)

Syncing checks the syncing status of the node.

func (*Provider) TraceBlockTransactions

func (provider *Provider) TraceBlockTransactions(ctx context.Context, blockHash *felt.Felt) ([]Trace, error)

Retrieve traces for all transactions in the given block

func (*Provider) TransactionByBlockIdAndIndex

func (provider *Provider) TransactionByBlockIdAndIndex(ctx context.Context, blockID BlockID, index uint64) (Transaction, error)

TransactionByBlockIdAndIndex Get the details of the transaction given by the identified block and index in that block. If no transaction is found, null is returned.

func (*Provider) TransactionByHash

func (provider *Provider) TransactionByHash(ctx context.Context, hash *felt.Felt) (Transaction, error)

TransactionByHash gets the details and status of a submitted transaction.

func (*Provider) TransactionReceipt

func (provider *Provider) TransactionReceipt(ctx context.Context, transactionHash *felt.Felt) (TransactionReceipt, error)

TxnReceipt gets the transaction receipt by the transaction hash.

func (*Provider) TransactionTrace

func (provider *Provider) TransactionTrace(ctx context.Context, transactionHash *felt.Felt) (TxnTrace, error)

For a given executed transaction, return the trace of its execution, including internal calls

type RPCError

type RPCError struct {
	// contains filtered or unexported fields
}

func Err added in v0.4.4

func Err(code int, data any) *RPCError

func (*RPCError) Code

func (e *RPCError) Code() int

func (*RPCError) Data added in v0.4.3

func (e *RPCError) Data() any

func (*RPCError) Error

func (e *RPCError) Error() string

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 ResultPageRequest

type ResultPageRequest struct {
	// a pointer to the last element of the delivered page, use this token in a subsequent query to obtain the next page
	ContinuationToken string `json:"continuation_token,omitempty"`
	ChunkSize         int    `json:"chunk_size"`
}

type RpcProvider added in v0.4.6

type RpcProvider interface {
	AddInvokeTransaction(ctx context.Context, invokeTxn InvokeTxnV1) (*AddInvokeTransactionResponse, error)
	AddDeclareTransaction(ctx context.Context, declareTransaction AddDeclareTxnInput) (*AddDeclareTransactionResponse, error)
	AddDeployAccountTransaction(ctx context.Context, deployAccountTransaction DeployAccountTxn) (*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 []EstimateFeeInput, blockID BlockID) ([]FeeEstimate, error)
	EstimateMessageFee(ctx context.Context, msg MsgFromL1, blockID BlockID) (*FeeEstimate, error)
	Events(ctx context.Context, input EventsInput) (*EventChunk, error)
	Nonce(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*string, 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)
	Syncing(ctx context.Context) (*SyncStatus, error)
	TraceBlockTransactions(ctx context.Context, blockHash *felt.Felt) ([]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)
	TransactionTrace(ctx context.Context, transactionHash *felt.Felt) (TxnTrace, error)
}

type SierraEntryPoint added in v0.4.3

type SierraEntryPoint struct {
	// The index of the function in the program
	FunctionIdx int `json:"function_idx"`
	// A unique  identifier of the entry point (function) in the program
	Selector *felt.Felt `json:"selector"`
}

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            []Transaction    `json:"transactions"`
	BlockID         BlockID          `json:"block_id"`
	SimulationFlags []SimulationFlag `json:"simulation_flags"`
}

type SimulateTransactionOutput added in v0.4.3

type SimulateTransactionOutput struct {
	Txns []SimulatedTransaction `json:"result"`
}

The execution trace and consumed resources of the required transactions

type SimulatedTransaction added in v0.4.3

type SimulatedTransaction struct {
	TxnTrace `json:"transaction_trace"`
	FeeEstimate
}

type SimulationFlag added in v0.4.3

type SimulationFlag string
const (
	SKIP_FEE_CHARGE SimulationFlag = "SKIP_FEE_CHARGE"
	SKIP_EXECUTE    SimulationFlag = "SKIP_EXECUTE"
)

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 StorageEntry struct {
	Key   *felt.Felt `json:"key"`
	Value *felt.Felt `json:"value"`
}

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

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)

func (*SyncStatus) UnmarshalJSON

func (s *SyncStatus) UnmarshalJSON(data []byte) error

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"`
}

https://github.com/starkware-libs/starknet-specs/blob/a789ccc3432c57777beceaa53a34a7ae2f25fda0/api/starknet_api_openrpc.json#L1252

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

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)

func (*TransactionType) UnmarshalJSON

func (tt *TransactionType) UnmarshalJSON(data []byte) error

type TransactionVersion

type TransactionVersion string

string must be NUM_AS_HEX

const (
	TransactionV0 TransactionVersion = "0x0"
	TransactionV1 TransactionVersion = "0x1"
	TransactionV2 TransactionVersion = "0x2"
)

func (*TransactionVersion) BigInt

func (v *TransactionVersion) BigInt() (*big.Int, error)

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)

func (TxnExecutionStatus) String added in v0.4.4

func (s TxnExecutionStatus) String() string

func (*TxnExecutionStatus) UnmarshalJSON added in v0.4.4

func (ts *TxnExecutionStatus) UnmarshalJSON(data []byte) error

type TxnFinalityStatus added in v0.4.4

type TxnFinalityStatus string
const (
	TxnFinalityStatusAcceptedOnL1 TxnFinalityStatus = "ACCEPTED_ON_L1"
	TxnFinalityStatusAcceptedOnL2 TxnFinalityStatus = "ACCEPTED_ON_L2"
)

func (TxnFinalityStatus) MarshalJSON added in v0.4.4

func (ts TxnFinalityStatus) MarshalJSON() ([]byte, error)

func (TxnFinalityStatus) String added in v0.4.4

func (s TxnFinalityStatus) String() string

func (*TxnFinalityStatus) UnmarshalJSON added in v0.4.4

func (ts *TxnFinalityStatus) UnmarshalJSON(data []byte) error

type TxnTrace added in v0.4.3

type TxnTrace interface{}

type TypedParameter

type TypedParameter struct {
	// The parameter's name
	Name string `json:"name"`

	// The parameter's type
	Type string `json:"type"`
}

type UnknownTransaction

type UnknownTransaction struct{ Transaction }

func (*UnknownTransaction) UnmarshalJSON

func (txn *UnknownTransaction) UnmarshalJSON(data []byte) error

type UnknownTransactionReceipt

type UnknownTransactionReceipt struct{ TransactionReceipt }

func (*UnknownTransactionReceipt) UnmarshalJSON

func (tr *UnknownTransactionReceipt) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL