Documentation
¶
Index ¶
- func ExponentialBackoff(wait time.Duration) time.Duration
- func NopBackoff(d time.Duration) time.Duration
- func ProgramHash(contractDefinition *ClassDefinition) (*felt.Felt, error)
- type Backoff
- type Block
- type BuiltinInstanceCounter
- type ClassDefinition
- type ContractCode
- type EntryPoint
- type Event
- type ExecutionResources
- type GatewayClient
- func (c *GatewayClient) GetBlock(ctx context.Context, blockNumber uint64) (*Block, error)
- func (c *GatewayClient) GetClassDefinition(ctx context.Context, classHash *felt.Felt) (*ClassDefinition, error)
- func (c *GatewayClient) GetStateUpdate(ctx context.Context, blockNumber uint64) (*StateUpdate, error)
- func (c *GatewayClient) GetTransaction(ctx context.Context, transactionHash *felt.Felt) (*TransactionStatus, error)
- func (c *GatewayClient) WithBackoff(b Backoff) *GatewayClient
- func (c *GatewayClient) WithLogger(log utils.SimpleLogger) *GatewayClient
- func (c *GatewayClient) WithMaxRetries(num int) *GatewayClient
- func (c *GatewayClient) WithMaxWait(d time.Duration) *GatewayClient
- func (c *GatewayClient) WithMinWait(d time.Duration) *GatewayClient
- type Hints
- type Identifiers
- type L1ToL2Message
- type L2ToL1Message
- type Program
- type StateUpdate
- type Transaction
- type TransactionReceipt
- type TransactionStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProgramHash ¶
func ProgramHash(contractDefinition *ClassDefinition) (*felt.Felt, error)
Types ¶
type Block ¶
type Block struct {
Hash *felt.Felt `json:"block_hash"`
ParentHash *felt.Felt `json:"parent_block_hash"`
Number uint64 `json:"block_number"`
StateRoot *felt.Felt `json:"state_root"`
Status string `json:"status"`
GasPrice *felt.Felt `json:"gas_price"`
Transactions []*Transaction `json:"transactions"`
Timestamp uint64 `json:"timestamp"`
Version string `json:"starknet_version"`
Receipts []*TransactionReceipt `json:"transaction_receipts"`
SequencerAddress *felt.Felt `json:"sequencer_address"`
}
Block object returned by the gateway in JSON format for "get_block" endpoint
type BuiltinInstanceCounter ¶
type ClassDefinition ¶
type ClassDefinition struct {
Abi any `json:"abi"`
EntryPoints struct {
Constructor []EntryPoint `json:"CONSTRUCTOR"`
External []EntryPoint `json:"EXTERNAL"`
L1Handler []EntryPoint `json:"L1_HANDLER"`
} `json:"entry_points_by_type"`
Program Program `json:"program"`
}
type ContractCode ¶
type ContractCode struct {
Abi interface{} `json:"abi"`
Program *Program `json:"program"`
}
func (ContractCode) Marshal ¶
func (c ContractCode) Marshal() ([]byte, error)
Marshal is a custom json marshaler for ContractCode
type EntryPoint ¶
type ExecutionResources ¶
type ExecutionResources struct {
Steps uint64 `json:"n_steps"`
BuiltinInstanceCounter BuiltinInstanceCounter `json:"builtin_instance_counter"`
MemoryHoles uint64 `json:"n_memory_holes"`
}
type GatewayClient ¶
type GatewayClient struct {
// contains filtered or unexported fields
}
func NewGatewayClient ¶
func NewGatewayClient(url string) *GatewayClient
func (*GatewayClient) GetClassDefinition ¶
func (c *GatewayClient) GetClassDefinition(ctx context.Context, classHash *felt.Felt) (*ClassDefinition, error)
func (*GatewayClient) GetStateUpdate ¶
func (c *GatewayClient) GetStateUpdate(ctx context.Context, blockNumber uint64) (*StateUpdate, error)
func (*GatewayClient) GetTransaction ¶
func (c *GatewayClient) GetTransaction(ctx context.Context, transactionHash *felt.Felt) (*TransactionStatus, error)
func (*GatewayClient) WithBackoff ¶
func (c *GatewayClient) WithBackoff(b Backoff) *GatewayClient
func (*GatewayClient) WithLogger ¶
func (c *GatewayClient) WithLogger(log utils.SimpleLogger) *GatewayClient
func (*GatewayClient) WithMaxRetries ¶
func (c *GatewayClient) WithMaxRetries(num int) *GatewayClient
func (*GatewayClient) WithMaxWait ¶
func (c *GatewayClient) WithMaxWait(d time.Duration) *GatewayClient
func (*GatewayClient) WithMinWait ¶
func (c *GatewayClient) WithMinWait(d time.Duration) *GatewayClient
type Identifiers ¶
type Identifiers map[string]struct { CairoType string `json:"cairo_type,omitempty"` Decorators *[]interface{} `json:"decorators,omitempty"` Destination string `json:"destination,omitempty"` FullName string `json:"full_name,omitempty"` Members *interface{} `json:"members,omitempty"` Pc *uint64 `json:"pc,omitempty"` References *[]interface{} `json:"references,omitempty"` Size *uint64 `json:"size,omitempty"` Type string `json:"type,omitempty"` Value json.Number `json:"value,omitempty"` }
type L1ToL2Message ¶
type L2ToL1Message ¶
type Program ¶
type Program struct {
Attributes interface{} `json:"attributes,omitempty"`
Builtins []string `json:"builtins"`
CompilerVersion string `json:"compiler_version,omitempty"`
Data []string `json:"data"`
DebugInfo interface{} `json:"debug_info"`
Hints Hints `json:"hints"`
Identifiers Identifiers `json:"identifiers"`
MainScope interface{} `json:"main_scope"`
Prime string `json:"prime"`
ReferenceManager interface{} `json:"reference_manager"`
}
type StateUpdate ¶
type StateUpdate struct {
BlockHash *felt.Felt `json:"block_hash"`
NewRoot *felt.Felt `json:"new_root"`
OldRoot *felt.Felt `json:"old_root"`
StateDiff struct {
StorageDiffs map[string][]struct {
Key *felt.Felt `json:"key"`
Value *felt.Felt `json:"value"`
} `json:"storage_diffs"`
Nonces map[string]*felt.Felt `json:"nonces"`
DeployedContracts []struct {
Address *felt.Felt `json:"address"`
ClassHash *felt.Felt `json:"class_hash"`
} `json:"deployed_contracts"`
DeclaredContracts []*felt.Felt `json:"declared_contracts"`
} `json:"state_diff"`
}
StateUpdate object returned by the gateway in JSON format for "get_state_update" endpoint
type Transaction ¶
type Transaction struct {
Hash *felt.Felt `json:"transaction_hash"`
Version *felt.Felt `json:"version"`
ContractAddress *felt.Felt `json:"contract_address"`
ContractAddressSalt *felt.Felt `json:"contract_address_salt"`
ClassHash *felt.Felt `json:"class_hash"`
ConstructorCallData []*felt.Felt `json:"constructor_calldata"`
Type string `json:"type"`
SenderAddress *felt.Felt `json:"sender_address"`
MaxFee *felt.Felt `json:"max_fee"`
Signature []*felt.Felt `json:"signature"`
CallData []*felt.Felt `json:"calldata"`
EntryPointSelector *felt.Felt `json:"entry_point_selector"`
Nonce *felt.Felt `json:"nonce"`
}
Transaction object returned by the gateway in JSON format for multiple endpoints
type TransactionReceipt ¶
type TransactionReceipt struct {
ActualFee *felt.Felt `json:"actual_fee"`
Events []*Event `json:"events"`
ExecutionResources *ExecutionResources `json:"execution_resources"`
L1ToL2Message *L1ToL2Message `json:"l1_to_l2_consumed_message"`
L2ToL1Message []*L2ToL1Message `json:"l2_to_l1_messages"`
TransactionHash *felt.Felt `json:"transaction_hash"`
TransactionIndex uint64 `json:"transaction_index"`
}
type TransactionStatus ¶
Click to show internal directories.
Click to hide internal directories.