Documentation
¶
Index ¶
- Variables
- type ABI
- type ABIEntry
- type ABIType
- type AddDeclareTransactionOutput
- type AddDeclareTransactionResponse
- type AddDeployTransactionOutput
- type AddDeployTransactionResponse
- type AddInvokeTransactionResponse
- type Block
- type BlockHashAndNumberOutput
- type BlockHeader
- type BlockID
- type BlockStatus
- type BroadcastedDeclareTransaction
- type BroadcastedDeployAccountTransaction
- type BroadcastedDeployTxn
- type BroadcastedInvokeTransaction
- type BroadcastedInvokeV1Transaction
- type BroadcastedTransaction
- type BroadcastedTxnCommonProperties
- type CommonTransaction
- type CommonTransactionReceipt
- type ContractClass
- type ContractNonce
- type ContractStorageDiffItem
- type DeclareTransactionReceipt
- type DeclareTxn
- type DeployAccountTransactionProperties
- type DeployAccountTransactionReceipt
- type DeployAccountTxn
- type DeployTransactionProperties
- type DeployTransactionReceipt
- type DeployTxn
- type DeployedContractItem
- type EmittedEvent
- type EntryPoint
- type EntryPointsByType
- type Event
- type EventABIEntry
- type EventFilter
- type EventsInput
- type EventsOutput
- type FeeEstimate
- type FunctionABIEntry
- type FunctionCall
- type InvokeTransactionReceipt
- type InvokeTxn
- type InvokeTxnV0
- type InvokeTxnV1
- type L1HandlerTransactionReceipt
- type L1HandlerTxn
- type Member
- type MsgToL1
- type NumAsHex
- type PendingBlock
- type PendingCommonTransactionReceiptProperties
- type PendingDeployTransactionReceipt
- type Provider
- func (provider *Provider) AddDeclareTransaction(ctx context.Context, declareTransaction BroadcastedDeclareTransaction) (*AddDeclareTransactionResponse, error)
- func (provider *Provider) AddDeployAccountTransaction(ctx context.Context, ...) (*AddDeployTransactionResponse, error)
- func (provider *Provider) AddDeployTransaction(ctx context.Context, deployTransaction BroadcastedDeployTxn) (*AddDeployTransactionResponse, error)
- func (provider *Provider) AddInvokeTransaction(ctx context.Context, broadcastedInvoke BroadcastedInvokeTransaction) (*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) ([]string, error)
- func (provider *Provider) ChainID(ctx context.Context) (string, error)
- func (provider *Provider) Class(ctx context.Context, blockID BlockID, classHash string) (*ContractClass, error)
- func (provider *Provider) ClassAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*ContractClass, error)
- func (provider *Provider) ClassHashAt(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*string, error)
- func (provider *Provider) EstimateFee(ctx context.Context, requests []BroadcastedTransaction, blockID BlockID) ([]FeeEstimate, error)
- func (provider *Provider) Events(ctx context.Context, input EventsInput) (*EventsOutput, error)
- func (provider *Provider) Nonce(ctx context.Context, blockID BlockID, contractAddress *felt.Felt) (*string, error)
- func (provider *Provider) PendingTransaction(ctx context.Context) ([]Transaction, 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, hash string) 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)
- func (provider *Provider) TransactionTrace(ctx context.Context, hash string) error
- func (provider *Provider) WaitForTransaction(ctx context.Context, transactionHash *felt.Felt, pollInterval time.Duration) (TransactionState, error)
- type RPCError
- type ResultPageRequest
- type StateDiff
- type StateUpdateOutput
- type StorageEntry
- type StructABIEntry
- type SyncStatus
- type TXN
- type Transaction
- type TransactionHash
- type TransactionReceipt
- type TransactionState
- type TransactionType
- type TransactionVersion
- type Transactions
- type TypedParameter
- type UnknownTransaction
- type UnknownTransactionReceipt
Constants ¶
This section is empty.
Variables ¶
var ( ErrFailedToReceiveTxn = &RPCError{ code: 1, message: "Failed to write transaction", } ErrContractNotFound = &RPCError{ code: 20, message: "Contract not found", } ErrInvalidMessageSelector = &RPCError{ code: 21, message: "Invalid message selector", } ErrInvalidCallData = &RPCError{ code: 22, message: "Invalid call data", } ErrBlockNotFound = &RPCError{ code: 24, message: "Block not found", } ErrHashNotFound = &RPCError{ code: 25, message: "Transaction hash not found", } ErrInvalidTxnIndex = &RPCError{ code: 27, message: "Invalid transaction index in a block", } ErrClassHashNotFound = &RPCError{ code: 28, message: "Class 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", } )
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 AddDeployTransactionOutput ¶
type AddDeployTransactionOutput struct {
TransactionHash *felt.Felt `json:"transaction_hash"`
ContractAddress *felt.Felt `json:"contract_address"`
}
AddDeployTransactionOutput provides the output for AddDeployTransaction.
type AddDeployTransactionResponse ¶
type AddDeployTransactionResponse struct {
TransactionHash *felt.Felt `json:"transaction_hash"`
ContractAddress *felt.Felt `json:"contract_address"`
}
AddDeployTransactionResponse provides the output for AddDeployTransaction.
type Block ¶
type Block struct {
BlockHeader
Status BlockStatus `json:"status"`
// Transactions The hashes of the transactions included in this block
Transactions Transactions `json:"transactions"`
}
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 WithBlockNumber ¶
func WithBlockTag ¶
func (BlockID) MarshalJSON ¶
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 BroadcastedDeclareTransaction ¶
type BroadcastedDeclareTransaction struct {
BroadcastedTxnCommonProperties
ContractClass ContractClass `json:"contract_class"`
SenderAddress *felt.Felt `json:"sender_address"`
}
func (BroadcastedDeclareTransaction) MarshalJSON ¶
func (b BroadcastedDeclareTransaction) MarshalJSON() ([]byte, error)
type BroadcastedDeployAccountTransaction ¶
type BroadcastedDeployAccountTransaction struct {
BroadcastedTxnCommonProperties
ContractAddressSalt *felt.Felt `json:"contract_address_salt"`
ConstructorCalldata []*felt.Felt `json:"constructor_calldata"`
ClassHash *felt.Felt `json:"class_hash"`
}
func (BroadcastedDeployAccountTransaction) MarshalJSON ¶
func (b BroadcastedDeployAccountTransaction) MarshalJSON() ([]byte, error)
type BroadcastedDeployTxn ¶
type BroadcastedDeployTxn struct {
DeployTransactionProperties
ContractClass ContractClass `json:"contract_class"`
}
func (BroadcastedDeployTxn) MarshalJSON ¶
func (b BroadcastedDeployTxn) MarshalJSON() ([]byte, error)
type BroadcastedInvokeTransaction ¶
type BroadcastedInvokeTransaction interface{}
type BroadcastedInvokeV1Transaction ¶
type BroadcastedInvokeV1Transaction struct {
BroadcastedTxnCommonProperties
SenderAddress *felt.Felt `json:"sender_address"`
Calldata []*felt.Felt `json:"calldata"`
}
BroadcastedInvokeV1Transaction is BROADCASTED_INVOKE_TXN since we only support InvokeV1 transactions
func (BroadcastedInvokeV1Transaction) MarshalJSON ¶
func (b BroadcastedInvokeV1Transaction) MarshalJSON() ([]byte, error)
type BroadcastedTransaction ¶
type BroadcastedTransaction interface{}
type BroadcastedTxnCommonProperties ¶
type BroadcastedTxnCommonProperties struct {
MaxFee *felt.Felt `json:"max_fee"`
// Version of the transaction scheme, should be set to 0 or 1
Version TransactionVersion `json:"version"`
// Signature
Signature []*felt.Felt `json:"signature"`
Nonce *felt.Felt `json:"nonce"`
Type TransactionType `json:"type"`
}
type CommonTransaction ¶
type CommonTransaction struct {
TransactionHash *felt.Felt `json:"transaction_hash,omitempty"`
BroadcastedTxnCommonProperties
}
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"`
Status TransactionState `json:"status"`
BlockHash *felt.Felt `json:"block_hash"`
BlockNumber uint64 `json:"block_number"`
Type TransactionType `json:"type"`
MessagesSent []MsgToL1 `json:"messages_sent"`
// Events The events emitted as part of this transaction
Events []Event `json:"events"`
}
CommonTransactionReceipt Common properties for a transaction receipt
func (CommonTransactionReceipt) Hash ¶
func (tr CommonTransactionReceipt) Hash() *felt.Felt
type ContractClass ¶
type ContractClass struct {
// Program A base64 representation of the compressed program code
Program string `json:"program"`
EntryPointsByType EntryPointsByType `json:"entry_points_by_type"`
ABI *ABI `json:"abi,omitempty"`
}
func (*ContractClass) UnmarshalJSON ¶
func (c *ContractClass) UnmarshalJSON(content []byte) error
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) Hash ¶
func (tr DeclareTransactionReceipt) Hash() *felt.Felt
type DeclareTxn ¶
type DeclareTxn struct {
CommonTransaction
// ClassHash the hash of the declared class
ClassHash *felt.Felt `json:"class_hash"`
// SenderAddress the address of the account contract sending the declaration transaction
SenderAddress *felt.Felt `json:"sender_address"`
}
func (DeclareTxn) Hash ¶
func (tx DeclareTxn) Hash() *felt.Felt
type DeployAccountTransactionProperties ¶
type DeployAccountTransactionProperties struct {
// 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"`
}
type DeployAccountTransactionReceipt ¶
type DeployAccountTransactionReceipt struct {
CommonTransactionReceipt
// ContractAddress The address of the deployed contract
ContractAddress string `json:"contract_address"`
}
DeployAccountTransactionReceipt Deploy Account Transaction Receipt
type DeployAccountTxn ¶
type DeployAccountTxn struct {
CommonTransaction
DeployAccountTransactionProperties
}
DeployTxn The structure of a deploy transaction. Note that this transaction type is deprecated and will no longer be supported in future versions
func (DeployAccountTxn) Hash ¶
func (tx DeployAccountTxn) Hash() *felt.Felt
type DeployTransactionProperties ¶
type DeployTransactionProperties struct {
Version TransactionVersion `json:"version"`
Type TransactionType `json:"type"`
ContractAddressSalt *felt.Felt `json:"contract_address_salt"`
ConstructorCalldata []*felt.Felt `json:"constructor_calldata"`
}
type DeployTransactionReceipt ¶
type DeployTransactionReceipt struct {
CommonTransactionReceipt
// ContractAddress The address of the deployed contract
ContractAddress string `json:"contract_address"`
}
DeployTransactionReceipt Deploy Transaction Receipt
type DeployTxn ¶
type DeployTxn struct {
TransactionHash *felt.Felt `json:"transaction_hash,omitempty"`
// ClassHash The hash of the deployed contract's class
ClassHash *felt.Felt `json:"class_hash"`
DeployTransactionProperties
}
DeployTxn The structure of a deploy transaction. Note that this transaction type is deprecated and will no longer be supported in future versions
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 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 EntryPoint ¶
type EntryPointsByType ¶
type EntryPointsByType struct {
Constructor []EntryPoint `json:"CONSTRUCTOR"`
External []EntryPoint `json:"EXTERNAL"`
L1Handler []EntryPoint `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
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 EventsOutput ¶
type EventsOutput struct {
Events []EmittedEvent `json:"events"`
ContinuationToken *string `json:"continuation_token,omitempty"`
}
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 FunctionABIEntry ¶
type FunctionABIEntry struct {
// The function type
Type ABIType `json:"type"`
// The function name
Name string `json:"name"`
StateMutability *string `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,omitempty"`
// Calldata The parameters passed to the function
Calldata []*felt.Felt `json:"calldata"`
}
FunctionCall function call information
type InvokeTransactionReceipt ¶
type InvokeTransactionReceipt CommonTransactionReceipt
InvokeTransactionReceipt Invoke Transaction Receipt
func (InvokeTransactionReceipt) Hash ¶
func (tr InvokeTransactionReceipt) Hash() *felt.Felt
type InvokeTxnV0 ¶
type InvokeTxnV0 struct {
CommonTransaction
FunctionCall
}
func (InvokeTxnV0) Hash ¶
func (tx InvokeTxnV0) Hash() *felt.Felt
type InvokeTxnV1 ¶
type InvokeTxnV1 struct {
CommonTransaction
SenderAddress *felt.Felt `json:"sender_address"`
// Calldata The parameters passed to the function
Calldata []*felt.Felt `json:"calldata"`
}
func (InvokeTxnV1) Hash ¶
func (tx InvokeTxnV1) Hash() *felt.Felt
type L1HandlerTransactionReceipt ¶
type L1HandlerTransactionReceipt CommonTransactionReceipt
L1HandlerTransactionReceipt L1 Handler Transaction Receipt
func (L1HandlerTransactionReceipt) Hash ¶
func (tr L1HandlerTransactionReceipt) Hash() *felt.Felt
type L1HandlerTxn ¶
type L1HandlerTxn struct {
TransactionHash *felt.Felt `json:"transaction_hash,omitempty"`
Type TransactionType `json:"type,omitempty"`
// Version of the transaction scheme
Version NumAsHex `json:"version"`
// Nonce
Nonce string `json:"nonce,omitempty"`
FunctionCall
}
func (L1HandlerTxn) Hash ¶
func (tx L1HandlerTxn) Hash() *felt.Felt
type Member ¶
type Member struct {
TypedParameter
Offset int64 `json:"offset"`
}
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 hashes of the transactions included in this block
Transactions Transactions `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"`
// Events The events emitted as part of this transaction
Events []Event `json:"events"`
}
PendingCommonTransactionReceiptProperties Pending Transaction Receipt
type PendingDeployTransactionReceipt ¶
type PendingDeployTransactionReceipt struct {
PendingCommonTransactionReceiptProperties
// ContractAddress The address of the deployed contract
ContractAddress *felt.Felt `json:"contract_address"`
}
PendingDeployTransactionReceipt Pending Transaction Receipt
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider provides the provider for starknet.go/rpc implementation.
func NewProvider ¶
NewProvider creates a *Provider from an existing `go-ethereum/rpc` *Client.
func (*Provider) AddDeclareTransaction ¶
func (provider *Provider) AddDeclareTransaction(ctx context.Context, declareTransaction BroadcastedDeclareTransaction) (*AddDeclareTransactionResponse, error)
AddDeclareTransaction submits a new class declaration transaction.
func (*Provider) AddDeployAccountTransaction ¶
func (provider *Provider) AddDeployAccountTransaction(ctx context.Context, deployAccountTransaction BroadcastedDeployAccountTransaction) (*AddDeployTransactionResponse, error)
AddDeployAccountTransaction manages the DEPLOY_ACCOUNT syscall
func (*Provider) AddDeployTransaction ¶
func (provider *Provider) AddDeployTransaction(ctx context.Context, deployTransaction BroadcastedDeployTxn) (*AddDeployTransactionResponse, error)
AddDeployTransaction allows to declare a class and instantiate the associated contract in one command. This function will be deprecated and replaced by AddDeclareTransaction to declare a class, followed by AddInvokeTransaction to instantiate the contract. For now, it remains the only way to deploy an account without being charged for it.
func (*Provider) AddInvokeTransaction ¶
func (provider *Provider) AddInvokeTransaction(ctx context.Context, broadcastedInvoke BroadcastedInvokeTransaction) (*AddInvokeTransactionResponse, error)
AddInvokeTransaction estimates the fee for a given StarkNet transaction.
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 ¶
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. TODO: add support for PendingBlock
func (*Provider) BlockWithTxs ¶
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) ([]string, error)
Call a starknet function without creating a StarkNet transaction.
func (*Provider) ChainID ¶
ChainID retrieves the current chain ID for transaction replay protection.
func (*Provider) Class ¶
func (provider *Provider) Class(ctx context.Context, blockID BlockID, classHash string) (*ContractClass, 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) (*ContractClass, 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) (*string, 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 []BroadcastedTransaction, blockID BlockID) ([]FeeEstimate, error)
EstimateFee estimates the fee for a given StarkNet transaction.
func (*Provider) Events ¶
func (provider *Provider) Events(ctx context.Context, input EventsInput) (*EventsOutput, 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) 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 ¶
not implemented for testing yet
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 ¶
not implemented for testing yet
type ResultPageRequest ¶
type StateDiff ¶
type StateDiff struct {
// StorageDiffs list storage changes
StorageDiffs []ContractStorageDiffItem `json:"storage_diffs"`
// Contracts list new contracts added as part of the new state
DeclaredContractHashes []*felt.Felt `json:"declared_contract_hashes"`
// Nonces provides the updated nonces per contract addresses
DeployedContracts []DeployedContractItem `json:"deployed_contracts"`
// 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"`
// 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"`
}
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
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"`
}
type Transaction ¶
type TransactionHash ¶
func (TransactionHash) Hash ¶
func (t TransactionHash) Hash() *felt.Felt
func (TransactionHash) MarshalJSON ¶
func (t TransactionHash) MarshalJSON() ([]byte, error)
func (TransactionHash) MarshalText ¶
func (t TransactionHash) MarshalText() ([]byte, error)
func (*TransactionHash) UnmarshalJSON ¶
func (t *TransactionHash) UnmarshalJSON(input []byte) error
func (*TransactionHash) UnmarshalText ¶
func (t *TransactionHash) UnmarshalText(input []byte) error
type TransactionReceipt ¶
type TransactionState ¶
type TransactionState string
const ( TransactionAcceptedOnL1 TransactionState = "ACCEPTED_ON_L1" TransactionAcceptedOnL2 TransactionState = "ACCEPTED_ON_L2" TransactionNotReceived TransactionState = "NOT_RECEIVED" TransactionPending TransactionState = "PENDING" TransactionReceived TransactionState = "RECEIVED" TransactionRejected TransactionState = "REJECTED" )
func (TransactionState) IsTransactionFinal ¶
func (s TransactionState) IsTransactionFinal() bool
func (TransactionState) MarshalJSON ¶
func (ts TransactionState) MarshalJSON() ([]byte, error)
func (TransactionState) String ¶
func (s TransactionState) String() string
func (*TransactionState) UnmarshalJSON ¶
func (ts *TransactionState) UnmarshalJSON(data []byte) error
type TransactionType ¶
type TransactionType string
TODO: check how we can move that type up in starknet.go/types
const ( TransactionType_Declare TransactionType = "DECLARE" TransactionType_Deploy TransactionType = "DEPLOY" TransactionType_DeployAccount TransactionType = "DEPLOY_ACCOUNT" 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" )
type Transactions ¶
type Transactions []Transaction
func (*Transactions) UnmarshalJSON ¶
func (txns *Transactions) UnmarshalJSON(data []byte) error
type TypedParameter ¶
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