common

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigIntSliceToChunks

func BigIntSliceToChunks(values []*big.Int, chunkSize int) [][]*big.Int

func ConstructEventABI

func ConstructEventABI(signature string) (*abi.Event, error)

func ConstructFunctionABI

func ConstructFunctionABI(signature string) (*abi.Method, error)

func StripPayload

func StripPayload(signature string) string

StripPayload removes parameter names, 'indexed' keywords, and extra whitespaces from a Solidity function or event signature.

func ValidateQuery

func ValidateQuery(query string) error

validateQuery checks the query for disallowed patterns and ensures only allowed functions are used.

Types

type Block

type Block struct {
	ChainId          *big.Int `json:"chain_id"`
	Number           *big.Int `json:"number"`
	Hash             string   `json:"hash"`
	ParentHash       string   `json:"parent_hash"`
	Timestamp        uint64   `json:"timestamp"`
	Nonce            string   `json:"nonce"`
	Sha3Uncles       string   `json:"sha3_uncles"`
	MixHash          string   `json:"mix_hash"`
	Miner            string   `json:"miner"`
	StateRoot        string   `json:"state_root"`
	TransactionsRoot string   `json:"transactions_root"`
	ReceiptsRoot     string   `json:"receipts_root"`
	LogsBloom        string   `json:"logs_bloom"`
	Size             uint64   `json:"size"`
	ExtraData        string   `json:"extra_data"`
	Difficulty       *big.Int `json:"difficulty"`
	TotalDifficulty  *big.Int `json:"total_difficulty"`
	TransactionCount uint64   `json:"transaction_count"`
	GasLimit         *big.Int `json:"gas_limit"`
	GasUsed          *big.Int `json:"gas_used"`
	WithdrawalsRoot  string   `json:"withdrawals_root"`
	BaseFeePerGas    uint64   `json:"base_fee_per_gas"`
}

type BlockData

type BlockData struct {
	Block        Block
	Transactions []Transaction
	Logs         []Log
	Traces       []Trace
}

type BlockFailure

type BlockFailure struct {
	BlockNumber   *big.Int
	ChainId       *big.Int
	FailureTime   time.Time
	FailureReason string
	FailureCount  int
}

type BlockHeader

type BlockHeader struct {
	Number     *big.Int `json:"number"`
	Hash       string   `json:"hash"`
	ParentHash string   `json:"parent_hash"`
}

type DecodedLog

type DecodedLog struct {
	Log
	Decoded DecodedLogData `json:"decodedData"`
}

type DecodedLogData

type DecodedLogData struct {
	Name             string                 `json:"name"`
	Signature        string                 `json:"signature"`
	IndexedParams    map[string]interface{} `json:"indexedParams"`
	NonIndexedParams map[string]interface{} `json:"nonIndexedParams"`
}

type DecodedTransaction

type DecodedTransaction struct {
	Transaction
	Decoded DecodedTransactionData `json:"decodedData"`
}

type DecodedTransactionData

type DecodedTransactionData struct {
	Name      string                 `json:"name"`
	Signature string                 `json:"signature"`
	Inputs    map[string]interface{} `json:"inputs"`
}

type Log

type Log struct {
	ChainId          *big.Int `json:"chain_id" swaggertype:"string"`
	BlockNumber      *big.Int `json:"block_number" swaggertype:"string"`
	BlockHash        string   `json:"block_hash"`
	BlockTimestamp   uint64   `json:"block_timestamp"`
	TransactionHash  string   `json:"transaction_hash"`
	TransactionIndex uint64   `json:"transaction_index"`
	LogIndex         uint64   `json:"log_index"`
	Address          string   `json:"address"`
	Data             string   `json:"data"`
	Topics           []string `json:"topics"`
}

func (*Log) Decode

func (l *Log) Decode(eventABI *abi.Event) *DecodedLog

type RawBlock

type RawBlock = map[string]interface{}

type RawLogs

type RawLogs = []map[string]interface{}

type RawReceipt

type RawReceipt = map[string]interface{}

type RawReceipts

type RawReceipts = []RawReceipt

type RawTraces

type RawTraces = []map[string]interface{}

type Trace

type Trace struct {
	ChainID          *big.Int `json:"chain_id"`
	BlockNumber      *big.Int `json:"block_number"`
	BlockHash        string   `json:"block_hash"`
	BlockTimestamp   uint64   `json:"block_timestamp"`
	TransactionHash  string   `json:"transaction_hash"`
	TransactionIndex uint64   `json:"transaction_index"`
	Subtraces        int64    `json:"subtraces"`
	TraceAddress     []uint64 `json:"trace_address"`
	TraceType        string   `json:"trace_type"`
	CallType         string   `json:"call_type"`
	Error            string   `json:"error"`
	FromAddress      string   `json:"from_address"`
	ToAddress        string   `json:"to_address"`
	Gas              *big.Int `json:"gas"`
	GasUsed          *big.Int `json:"gas_used"`
	Input            string   `json:"input"`
	Output           string   `json:"output"`
	Value            *big.Int `json:"value"`
	Author           string   `json:"author"`
	RewardType       string   `json:"reward_type"`
	RefundAddress    string   `json:"refund_address"`
}

type Transaction

type Transaction struct {
	ChainId              *big.Int `json:"chain_id" swaggertype:"string"`
	Hash                 string   `json:"hash"`
	Nonce                uint64   `json:"nonce"`
	BlockHash            string   `json:"block_hash"`
	BlockNumber          *big.Int `json:"block_number" swaggertype:"string"`
	BlockTimestamp       uint64   `json:"block_timestamp"`
	TransactionIndex     uint64   `json:"transaction_index"`
	FromAddress          string   `json:"from_address"`
	ToAddress            string   `json:"to_address"`
	Value                *big.Int `json:"value" swaggertype:"string"`
	Gas                  uint64   `json:"gas"`
	GasPrice             *big.Int `json:"gas_price" swaggertype:"string"`
	Data                 string   `json:"data"`
	FunctionSelector     string   `json:"function_selector"`
	MaxFeePerGas         *big.Int `json:"max_fee_per_gas" swaggertype:"string"`
	MaxPriorityFeePerGas *big.Int `json:"max_priority_fee_per_gas" swaggertype:"string"`
	TransactionType      uint8    `json:"transaction_type"`
	R                    *big.Int `json:"r" swaggertype:"string"`
	S                    *big.Int `json:"s" swaggertype:"string"`
	V                    *big.Int `json:"v" swaggertype:"string"`
	AccessListJson       *string  `json:"access_list_json"`
	ContractAddress      *string  `json:"contract_address"`
	GasUsed              *uint64  `json:"gas_used"`
	CumulativeGasUsed    *uint64  `json:"cumulative_gas_used"`
	EffectiveGasPrice    *big.Int `json:"effective_gas_price" swaggertype:"string"`
	BlobGasUsed          *uint64  `json:"blob_gas_used"`
	BlobGasPrice         *big.Int `json:"blob_gas_price" swaggertype:"string"`
	LogsBloom            *string  `json:"logs_bloom"`
	Status               *uint64  `json:"status"`
}

func (*Transaction) Decode

func (t *Transaction) Decode(functionABI *abi.Method) *DecodedTransaction

Jump to

Keyboard shortcuts

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