common

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeLogArgsToLabelData

func DecodeLogArgsToLabelData(contractABI *abi.ABI, topics []string, data string) (map[string]interface{}, error)

func DecodeTransactionInputDataToInterface

func DecodeTransactionInputDataToInterface(contractABI *abi.ABI, data []byte) (map[string]interface{}, error)

func GetABI

func GetABI(abistr string) (*abi.ABI, error)

Types

type AccessList

type AccessList struct {
	Address     string   `json:"address"`
	StorageKeys []string `json:"storageKeys"`
}

type BlockJson

type BlockJson struct {
	Difficulty       string `json:"difficulty"`
	ExtraData        string `json:"extraData"`
	GasLimit         string `json:"gasLimit"`
	GasUsed          string `json:"gasUsed"`
	Hash             string `json:"hash"`
	LogsBloom        string `json:"logsBloom"`
	Miner            string `json:"miner"`
	Nonce            string `json:"nonce"`
	BlockNumber      string `json:"number"`
	ParentHash       string `json:"parentHash"`
	ReceiptsRoot     string `json:"receiptsRoot"`
	Sha3Uncles       string `json:"sha3Uncles"`
	StateRoot        string `json:"stateRoot"`
	Timestamp        string `json:"timestamp"`
	TotalDifficulty  string `json:"totalDifficulty"`
	TransactionsRoot string `json:"transactionsRoot"`
	Size             string `json:"size"`
	BaseFeePerGas    string `json:"baseFeePerGas"`
	IndexedAt        string `json:"indexed_at"`

	MixHash       string `json:"mixHash,omitempty"`
	SendCount     string `json:"sendCount,omitempty"`
	SendRoot      string `json:"sendRoot,omitempty"`
	L1BlockNumber string `json:"l1BlockNumber,omitempty"`

	Transactions []TransactionJson `json:"transactions,omitempty"`
}

func ReadJsonBlocks

func ReadJsonBlocks() []*BlockJson

ReadJsonBlocks reads blocks from a JSON file

type BlockWithTransactions

type BlockWithTransactions struct {
	BlockNumber    uint64
	BlockHash      string
	BlockTimestamp uint64
	Transactions   map[string]TransactionJson
}

type BlockchainHandler

type BlockchainHandler interface {
	FetchData(blockNumber *big.Int) ([]EventData, error)
}

BlockchainHandler defines the interface for handling blockchain data fetching.

type BlocksBatchJson

type BlocksBatchJson struct {
	Blocks      []BlockJson `json:"blocks"`
	SeerVersion string      `json:"seer_version"`
}

type EventData

type EventData struct {
	// Common fields...
	BlockNumber uint64
	Data        []byte
	ChainID     string
	Extra       interface{} // Use for blockchain-specific additional data
}

EventData outlines the structure for blockchain event data.

type EventJson

type EventJson struct {
	Address          string   `json:"address"`
	Topics           []string `json:"topics"`
	Data             string   `json:"data"`
	BlockNumber      string   `json:"blockNumber"`
	TransactionHash  string   `json:"transactionHash"`
	BlockHash        string   `json:"blockHash"`
	Removed          bool     `json:"removed"`
	LogIndex         string   `json:"logIndex"`
	TransactionIndex string   `json:"transactionIndex"`
}

SingleEvent represents a single event within a transaction

func ReadJsonEventLogs

func ReadJsonEventLogs() []*EventJson

ReadJsonEventLogs reads event logs from a JSON file

type EventLog

type EventLog struct {
	Address          common.Address `json:"address"`          // The address of the contract that generated the log.
	Topics           []common.Hash  `json:"topics"`           // Topics are indexed parameters during log generation.
	Data             []byte         `json:"data"`             // The data field from the log.
	BlockNumber      *big.Int       `json:"blockNumber"`      // The block number where this log was in.
	TransactionHash  common.Hash    `json:"transactionHash"`  // The hash of the transaction that generated this log.
	BlockHash        common.Hash    `json:"blockHash"`        // The hash of the block where this log was in.
	Removed          bool           `json:"removed"`          // True if the log was reverted due to a chain reorganization.
	LogIndex         uint64         `json:"logIndex"`         // The index of the log in the block.
	TransactionIndex uint64         `json:"transactionIndex"` // The index of the transaction in the block.

}

type QueryFilter

type QueryFilter struct {
	BlockHash string     `json:"blockHash"`
	FromBlock string     `json:"fromBlock"`
	ToBlock   string     `json:"toBlock"`
	Address   []string   `json:"address"`
	Topics    [][]string `json:"topics"`
}

type Trace

type Trace struct {
	Action              json.RawMessage `json:"action"`
	BlockHash           common.Hash     `json:"blockHash"`
	BlockNumber         *big.Int        `json:"blockNumber"`
	Result              *TraceResult    `json:"result,omitempty"`
	SubTraces           int             `json:"subtraces"`
	TraceAddress        []int           `json:"traceAddress"`
	TransactionHash     common.Hash     `json:"transactionHash"`
	TransactionPosition uint64          `json:"transactionPosition"`
	Type                string          `json:"type"`
}

type TraceActionCall

type TraceActionCall struct {
	From     common.Address `json:"from"`
	CallType string         `json:"callType"`
	Gas      *big.Int       `json:"gas"`
	Input    string         `json:"input"`
	To       common.Address `json:"to"`
	Value    *big.Int       `json:"value"`
}

type TraceActionReward

type TraceActionReward struct {
	Author     common.Address `json:"author"`
	RewardType string         `json:"rewardType"`
	Value      *big.Int       `json:"value"`
}

type TraceResult

type TraceResult struct {
	GasUsed *big.Int `json:"gasUsed"`
	Output  string   `json:"output"`
}

type TransactionJson

type TransactionJson struct {
	BlockHash            string `json:"blockHash"`
	BlockNumber          string `json:"blockNumber"`
	ChainId              string `json:"chainId"`
	FromAddress          string `json:"from"`
	Gas                  string `json:"gas"`
	GasPrice             string `json:"gasPrice"`
	Hash                 string `json:"hash"`
	Input                string `json:"input"`
	MaxFeePerGas         string `json:"maxFeePerGas"`
	MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas"`
	Nonce                string `json:"nonce"`
	V                    string `json:"v"`
	R                    string `json:"r"`
	S                    string `json:"s"`
	ToAddress            string `json:"to"`
	TransactionIndex     string `json:"transactionIndex"`
	TransactionType      string `json:"type"`
	Value                string `json:"value"`
	IndexedAt            string `json:"indexed_at"`
	BlockTimestamp       string `json:"block_timestamp"`

	AccessList []AccessList `json:"accessList,omitempty"`
	YParity    string       `json:"yParity,omitempty"`

	Events []EventJson `json:"events,omitempty"`
}

func ReadJsonTransactions

func ReadJsonTransactions() []*TransactionJson

ReadJsonTransactions reads transactions from a JSON file

Jump to

Keyboard shortcuts

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