types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockOfStarknetDeploymentContractMainnet = 13617000
	BlockOfStarknetDeploymentContractGoerli  = 5840000

	MemoryPagesContractAddressMainnet = "0x96375087b2f6efc59e5e0dd5111b4d090ebfdd8b"
	MemoryPagesContractAddressGoerli  = "0x743789ff2ff82bfb907009c9911a7da636d34fa7"
	GpsVerifierContractAddressMainnet = "0xa739b175325cca7b71fcb51c3032935ef7ac338f"
	GpsVerifierContractAddressGoerli  = "0x5ef3c980bf970fce5bbc217835743ea9f0388f4f"
)

Variables

View Source
var (
	BlockStatusName = map[BlockStatus]string{
		BlockStatusUnknown:      "UNKNOWN",
		BlockStatusPending:      "PENDING",
		BlockStatusProven:       "PROVEN",
		BlockStatusAcceptedOnL2: "ACCEPTED_ON_L2",
		BlockStatusAcceptedOnL1: "ACCEPTED_ON_L1",
		BlockStatusRejected:     "REJECTED",
	}
	BlockStatusValue = map[string]BlockStatus{
		"UNKNOWN":        BlockStatusUnknown,
		"PENDING":        BlockStatusPending,
		"PROVEN":         BlockStatusProven,
		"ACCEPTED_ON_L2": BlockStatusAcceptedOnL2,
		"ACCEPTED_ON_L1": BlockStatusAcceptedOnL1,
		"REJECTED":       BlockStatusRejected,
	}
)
View Source
var (
	TxStatusName = map[TxnStatus]string{
		TxStatusUnknown:      "UNKNOWN",
		TxStatusNotReceived:  "NOT_RECEIVED",
		TxStatusReceived:     "RECEIVED",
		TxStatusPending:      "PENDING",
		TxStatusRejected:     "REJECTED",
		TxStatusAcceptedOnL2: "ACCEPTED_ON_L2",
		TxStatusAcceptedOnL1: "ACCEPTED_ON_L1",
	}
	TxStatusValue = map[string]TxnStatus{
		"UNKNOWN":        TxStatusUnknown,
		"NOT_RECEIVED":   TxStatusNotReceived,
		"RECEIVED":       TxStatusReceived,
		"PENDING":        TxStatusPending,
		"REJECTED":       TxStatusRejected,
		"ACCEPTED_ON_L2": TxStatusAcceptedOnL2,
		"ACCEPTED_ON_L1": TxStatusAcceptedOnL1,
	}
)

Functions

This section is empty.

Types

type Abi

type Abi []struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Inputs []struct {
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"inputs"`
	Outputs []interface{} `json:"outputs"`
}

type Block

type Block struct {
	BlockHash    *felt.Felt  `json:"bloch_hash"`
	ParentHash   *felt.Felt  `json:"parent_hash"`
	BlockNumber  uint64      `json:"block_number"`
	Status       BlockStatus `json:"status"`
	Sequencer    *felt.Felt  `json:"sequencer"`
	NewRoot      *felt.Felt  `json:"new_root,omitempty"`
	OldRoot      *felt.Felt  `json:"old_root"`
	AcceptedTime int64       `json:"accepted_time"`
	TimeStamp    int64       `json:"time_stamp"`

	TxCount      uint64     `json:"tx_count"`
	TxCommitment *felt.Felt `json:"tx_commitment"`
	TxHashes     []*felt.Felt

	EventCount      uint64     `json:"event_count"`
	EventCommitment *felt.Felt `json:"event_commitment"`
}

type BlockStatus

type BlockStatus int32
const (
	BlockStatusUnknown BlockStatus = iota
	BlockStatusPending
	BlockStatusProven
	BlockStatusAcceptedOnL2
	BlockStatusAcceptedOnL1
	BlockStatusRejected
)

func StringToBlockStatus

func StringToBlockStatus(s string) BlockStatus

func (BlockStatus) MarshalJSON

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

notest

func (BlockStatus) String

func (b BlockStatus) String() string

type BlockTag

type BlockTag string

type Contract

type Contract struct {
	Abi      Abi
	Bytecode []*felt.Felt

	FullDef json.RawMessage
}

func (*Contract) MarshalJSON

func (c *Contract) MarshalJSON() ([]byte, error)

MarshalJSON marshals the contract into JSON-encoded data. notest

func (*Contract) UnmarshalJSON

func (c *Contract) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal the JSON-encoded data into the contract.

func (*Contract) UnmarshalRaw

func (c *Contract) UnmarshalRaw(raw *json.RawMessage) error

UnmarshalRaw unmarshal the raw message data into the contract. notest

type ContractInfo

type ContractInfo struct {
	Contract  abi.ABI
	EventName string
	Address   common.Address
}

ContractInfo represent the info associated to one contract

type DeployedContract

type DeployedContract struct {
	Address             *felt.Felt   `json:"address"`
	Hash                *felt.Felt   `json:"contract_hash"`
	ConstructorCallData []*felt.Felt `json:"constructor_call_data"`
}

DeployedContract represent the contracts that have been deployed in this Block and the information stored on-chain

type Dictionary

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

Dictionary - the dictionary object with key of type interface{} & value of type IValue

func NewDictionary

func NewDictionary() *Dictionary

func (*Dictionary) Add

func (dict *Dictionary) Add(key interface{}, value IValue)

Add adds a new item to the dictionary

func (*Dictionary) Exist

func (dict *Dictionary) Exist(key interface{}) bool

Exist returns true if the key exists in the dictionary

func (*Dictionary) Get

func (dict *Dictionary) Get(key interface{}) (interface{}, bool)

Get returns the value associated with the key

func (*Dictionary) Remove

func (dict *Dictionary) Remove(key interface{})

Remove removes a value from the dictionary, given its key

func (*Dictionary) Size

func (dict *Dictionary) Size() int

type EthAddress

type EthAddress eth.Address

func BytesToEthAddress

func BytesToEthAddress(b []byte) EthAddress

func HexToEthAddress

func HexToEthAddress(s string) EthAddress

func (EthAddress) Bytes

func (a EthAddress) Bytes() []byte

func (EthAddress) MarshalJSON

func (a EthAddress) MarshalJSON() ([]byte, error)

type Event

type Event struct {
	FromAddress *felt.Felt
	Keys        []*felt.Felt
	Data        []*felt.Felt
}

type EventInfo

type EventInfo struct {
	Block              uint64
	Address            common.Address
	Event              map[string]interface{}
	TxnHash            common.Hash
	InitialBlockLogged int64
}

EventInfo represent the information retrieved from events that comes from L1

type Fact

type Fact struct {
	StateRoot          *felt.Felt  `json:"state_root"`
	SequenceNumber     uint64      `json:"block_number"`
	Value              common.Hash `json:"value"`
	InitialBlockLogged int64       `json:"initial_block_logged"`
}

Fact represent to the struct that save the Facts that comes from L1 notest

func (Fact) Marshal

func (f Fact) Marshal() ([]byte, error)

func (Fact) UnMarshal

func (f Fact) UnMarshal(bytes []byte) (IValue, error)

type IValue

type IValue interface {
	Marshal() ([]byte, error)
	UnMarshal([]byte) (IValue, error)
}

IValue - the value of the dictionary

type IsTransaction

type IsTransaction interface {
	GetHash() *felt.Felt
}

type MemoryCell

type MemoryCell struct {
	Address *felt.Felt `json:"key"`
	Value   *felt.Felt `json:"Value"`
}

MemoryCell represents a memory cell in Cairo

type MsgToL1

type MsgToL1 struct {
	FromAddress *felt.Felt
	ToAddress   EthAddress
	Payload     []*felt.Felt
}

type MsgToL2

type MsgToL2 struct {
	FromAddress EthAddress
	ToAddress   *felt.Felt
	Payload     []*felt.Felt
}

type PagesHash

type PagesHash struct {
	Bytes [][32]byte
}

func (PagesHash) Marshal

func (p PagesHash) Marshal() ([]byte, error)

func (PagesHash) UnMarshal

func (p PagesHash) UnMarshal(bytes []byte) (IValue, error)

type StateUpdate

type StateUpdate struct {
	StorageDiff       `json:"storage_diffs"`
	BlockHash         *felt.Felt         `json:"block_hash"`
	BlockNumber       int64              `json:"block_number"`
	NewRoot           *felt.Felt         `json:"new_root"`
	OldRoot           *felt.Felt         `json:"old_root"`
	DeployedContracts []DeployedContract `json:"deployed_contracts"`
	DeclaredContracts []*felt.Felt       `json:"declared_contracts"`
}

StateUpdate Represent the deployed contracts and the storage diffs for those and for the one's already deployed

type StorageDiff

type StorageDiff map[felt.Felt][]MemoryCell

type SyncStatus

type SyncStatus struct {
	// StartingBlockHash is the hash of the block that the node started syncing from
	StartingBlockHash string `json:"starting_block_hash"`
	// StartingBlockNumber is the number of the block that the node started syncing from
	StartingBlockNumber string `json:"starting_block_number"`
	// CurrentBlockHash is the hash of the block that the node is currently syncing to
	CurrentBlockHash string `json:"current_block_hash"`
	// CurrentBlockNumber is the number of the block that the node is currently syncing to
	CurrentBlockNumber string `json:"current_block_number"`
	// HighestBlockHash is the hash of the block that the node is currently syncing to
	HighestBlockHash string `json:"highest_block_hash"`
	// HighestBlockNumber is the number of the block that the node is currently syncing to
	HighestBlockNumber string `json:"highest_block_number"`
}

SyncStatus is an object describing the node synchronization status

type TransactionDeclare

type TransactionDeclare struct {
	Hash          *felt.Felt
	ClassHash     *felt.Felt
	SenderAddress *felt.Felt
	MaxFee        *felt.Felt
	Signature     []*felt.Felt
	Nonce         *felt.Felt
	Version       *felt.Felt
}

func (*TransactionDeclare) GetHash

func (tx *TransactionDeclare) GetHash() *felt.Felt

type TransactionDeploy

type TransactionDeploy struct {
	Hash                *felt.Felt
	ClassHash           *felt.Felt
	ContractAddress     *felt.Felt
	ContractAddressSalt *felt.Felt
	ConstructorCallData []*felt.Felt
}

func (*TransactionDeploy) GetHash

func (tx *TransactionDeploy) GetHash() *felt.Felt

type TransactionInvoke

type TransactionInvoke struct {
	Hash               *felt.Felt   `json:"txn_hash"`
	ContractAddress    *felt.Felt   `json:"contract_address"`
	EntryPointSelector *felt.Felt   `json:"entry_point_selector"`
	CallData           []*felt.Felt `json:"calldata"`
	Signature          []*felt.Felt `json:"-"`
	MaxFee             *felt.Felt   `json:"max_fee"`
}

func (*TransactionInvoke) GetHash

func (tx *TransactionInvoke) GetHash() *felt.Felt

type TxnDeclareReceipt

type TxnDeclareReceipt struct {
	TxnReceiptCommon
}

type TxnDeployReceipt

type TxnDeployReceipt struct {
	TxnReceiptCommon
}

type TxnHash

type TxnHash struct {
	Hash common.Hash
}

func (TxnHash) Marshal

func (t TxnHash) Marshal() ([]byte, error)

func (TxnHash) UnMarshal

func (t TxnHash) UnMarshal(bytes []byte) (IValue, error)

type TxnInvokeReceipt

type TxnInvokeReceipt struct {
	TxnReceiptCommon
	MessagesSent    []*MsgToL1
	L1OriginMessage *MsgToL2
	Events          []*Event
}

type TxnReceipt

type TxnReceipt interface {
	// contains filtered or unexported methods
}

type TxnReceiptCommon

type TxnReceiptCommon struct {
	TxnHash     *felt.Felt
	ActualFee   *felt.Felt
	Status      TxnStatus
	BlockHash   *felt.Felt
	BlockNumber uint64
}

type TxnStatus

type TxnStatus int64
const (
	TxStatusUnknown TxnStatus = iota
	TxStatusNotReceived
	TxStatusReceived
	TxStatusPending
	TxStatusRejected
	TxStatusAcceptedOnL2
	TxStatusAcceptedOnL1
)

func (TxnStatus) String

func (s TxnStatus) String() string

Jump to

Keyboard shortcuts

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