b3

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_blockchain_b3_b3_index_types_proto protoreflect.FileDescriptor

Functions

func ToEntireBlocksBatchFromLogProto

func ToEntireBlocksBatchFromLogProto(obj *B3BlocksBatch) *seer_common.BlocksBatchJson

func ToEvenFromLogProto

func ToEvenFromLogProto(obj *B3EventLog) *seer_common.EventJson

Types

type B3Block

type B3Block struct {
	BlockNumber      uint64           `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
	Difficulty       uint64           `protobuf:"varint,2,opt,name=difficulty,proto3" json:"difficulty,omitempty"`
	ExtraData        string           `protobuf:"bytes,3,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"`
	GasLimit         uint64           `protobuf:"varint,4,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
	GasUsed          uint64           `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
	BaseFeePerGas    string           `protobuf:"bytes,6,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3" json:"base_fee_per_gas,omitempty"` // using string to handle big numeric values
	Hash             string           `protobuf:"bytes,7,opt,name=hash,proto3" json:"hash,omitempty"`
	LogsBloom        string           `protobuf:"bytes,8,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom,omitempty"`
	Miner            string           `protobuf:"bytes,9,opt,name=miner,proto3" json:"miner,omitempty"`
	Nonce            string           `protobuf:"bytes,10,opt,name=nonce,proto3" json:"nonce,omitempty"`
	ParentHash       string           `protobuf:"bytes,11,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
	ReceiptsRoot     string           `protobuf:"bytes,12,opt,name=receipts_root,json=receiptsRoot,proto3" json:"receipts_root,omitempty"`
	Sha3Uncles       string           `protobuf:"bytes,13,opt,name=sha3_uncles,json=sha3Uncles,proto3" json:"sha3_uncles,omitempty"`
	Size             uint64           `protobuf:"varint,14,opt,name=size,proto3" json:"size,omitempty"`
	StateRoot        string           `protobuf:"bytes,15,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"`
	Timestamp        uint64           `protobuf:"varint,16,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	TotalDifficulty  string           `protobuf:"bytes,17,opt,name=total_difficulty,json=totalDifficulty,proto3" json:"total_difficulty,omitempty"`
	TransactionsRoot string           `protobuf:"bytes,18,opt,name=transactions_root,json=transactionsRoot,proto3" json:"transactions_root,omitempty"`
	IndexedAt        uint64           `protobuf:"varint,19,opt,name=indexed_at,json=indexedAt,proto3" json:"indexed_at,omitempty"` // using uint64 to represent timestamp
	Transactions     []*B3Transaction `protobuf:"bytes,20,rep,name=transactions,proto3" json:"transactions,omitempty"`
	// contains filtered or unexported fields
}

Represents a single blockchain block

func ToProtoSingleBlock

func ToProtoSingleBlock(obj *seer_common.BlockJson) *B3Block

func (*B3Block) Descriptor deprecated

func (*B3Block) Descriptor() ([]byte, []int)

Deprecated: Use B3Block.ProtoReflect.Descriptor instead.

func (*B3Block) GetBaseFeePerGas

func (x *B3Block) GetBaseFeePerGas() string

func (*B3Block) GetBlockNumber

func (x *B3Block) GetBlockNumber() uint64

func (*B3Block) GetDifficulty

func (x *B3Block) GetDifficulty() uint64

func (*B3Block) GetExtraData

func (x *B3Block) GetExtraData() string

func (*B3Block) GetGasLimit

func (x *B3Block) GetGasLimit() uint64

func (*B3Block) GetGasUsed

func (x *B3Block) GetGasUsed() uint64

func (*B3Block) GetHash

func (x *B3Block) GetHash() string

func (*B3Block) GetIndexedAt

func (x *B3Block) GetIndexedAt() uint64

func (*B3Block) GetLogsBloom

func (x *B3Block) GetLogsBloom() string

func (*B3Block) GetMiner

func (x *B3Block) GetMiner() string

func (*B3Block) GetNonce

func (x *B3Block) GetNonce() string

func (*B3Block) GetParentHash

func (x *B3Block) GetParentHash() string

func (*B3Block) GetReceiptsRoot

func (x *B3Block) GetReceiptsRoot() string

func (*B3Block) GetSha3Uncles

func (x *B3Block) GetSha3Uncles() string

func (*B3Block) GetSize

func (x *B3Block) GetSize() uint64

func (*B3Block) GetStateRoot

func (x *B3Block) GetStateRoot() string

func (*B3Block) GetTimestamp

func (x *B3Block) GetTimestamp() uint64

func (*B3Block) GetTotalDifficulty

func (x *B3Block) GetTotalDifficulty() string

func (*B3Block) GetTransactions

func (x *B3Block) GetTransactions() []*B3Transaction

func (*B3Block) GetTransactionsRoot

func (x *B3Block) GetTransactionsRoot() string

func (*B3Block) ProtoMessage

func (*B3Block) ProtoMessage()

func (*B3Block) ProtoReflect

func (x *B3Block) ProtoReflect() protoreflect.Message

func (*B3Block) Reset

func (x *B3Block) Reset()

func (*B3Block) String

func (x *B3Block) String() string

type B3BlocksBatch

type B3BlocksBatch struct {
	Blocks      []*B3Block `protobuf:"bytes,1,rep,name=blocks,proto3" json:"blocks,omitempty"`
	SeerVersion string     `protobuf:"bytes,2,opt,name=seer_version,json=seerVersion,proto3" json:"seer_version,omitempty"`
	// contains filtered or unexported fields
}

func (*B3BlocksBatch) Descriptor deprecated

func (*B3BlocksBatch) Descriptor() ([]byte, []int)

Deprecated: Use B3BlocksBatch.ProtoReflect.Descriptor instead.

func (*B3BlocksBatch) GetBlocks

func (x *B3BlocksBatch) GetBlocks() []*B3Block

func (*B3BlocksBatch) GetSeerVersion

func (x *B3BlocksBatch) GetSeerVersion() string

func (*B3BlocksBatch) ProtoMessage

func (*B3BlocksBatch) ProtoMessage()

func (*B3BlocksBatch) ProtoReflect

func (x *B3BlocksBatch) ProtoReflect() protoreflect.Message

func (*B3BlocksBatch) Reset

func (x *B3BlocksBatch) Reset()

func (*B3BlocksBatch) String

func (x *B3BlocksBatch) String() string

type B3EventLog

type B3EventLog struct {
	Address          string   `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`                                            // The address of the contract that generated the log
	Topics           []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"`                                              // Topics are indexed parameters during log generation
	Data             string   `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`                                                  // The data field from the log
	BlockNumber      uint64   `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`                // The block number where this log was in
	TransactionHash  string   `protobuf:"bytes,5,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"`     // The hash of the transaction that generated this log
	BlockHash        string   `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`                       // The hash of the block where this log was in
	Removed          bool     `protobuf:"varint,7,opt,name=removed,proto3" json:"removed,omitempty"`                                           // True if the log was reverted due to a chain reorganization
	LogIndex         uint64   `protobuf:"varint,8,opt,name=log_index,json=logIndex,proto3" json:"log_index,omitempty"`                         // The index of the log in the block
	TransactionIndex uint64   `protobuf:"varint,9,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"` // The index of the transaction in the block
	// contains filtered or unexported fields
}

func ToProtoSingleEventLog

func ToProtoSingleEventLog(obj *seer_common.EventJson) *B3EventLog

func (*B3EventLog) Descriptor deprecated

func (*B3EventLog) Descriptor() ([]byte, []int)

Deprecated: Use B3EventLog.ProtoReflect.Descriptor instead.

func (*B3EventLog) GetAddress

func (x *B3EventLog) GetAddress() string

func (*B3EventLog) GetBlockHash

func (x *B3EventLog) GetBlockHash() string

func (*B3EventLog) GetBlockNumber

func (x *B3EventLog) GetBlockNumber() uint64

func (*B3EventLog) GetData

func (x *B3EventLog) GetData() string

func (*B3EventLog) GetLogIndex

func (x *B3EventLog) GetLogIndex() uint64

func (*B3EventLog) GetRemoved

func (x *B3EventLog) GetRemoved() bool

func (*B3EventLog) GetTopics

func (x *B3EventLog) GetTopics() []string

func (*B3EventLog) GetTransactionHash

func (x *B3EventLog) GetTransactionHash() string

func (*B3EventLog) GetTransactionIndex

func (x *B3EventLog) GetTransactionIndex() uint64

func (*B3EventLog) ProtoMessage

func (*B3EventLog) ProtoMessage()

func (*B3EventLog) ProtoReflect

func (x *B3EventLog) ProtoReflect() protoreflect.Message

func (*B3EventLog) Reset

func (x *B3EventLog) Reset()

func (*B3EventLog) String

func (x *B3EventLog) String() string

type B3Transaction

type B3Transaction struct {
	Hash                 string                     `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	BlockNumber          uint64                     `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
	FromAddress          string                     `protobuf:"bytes,3,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"`
	ToAddress            string                     `protobuf:"bytes,4,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"`
	Gas                  string                     `protobuf:"bytes,5,opt,name=gas,proto3" json:"gas,omitempty"` // using string to handle big numeric values
	GasPrice             string                     `protobuf:"bytes,6,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"`
	MaxFeePerGas         string                     `protobuf:"bytes,7,opt,name=max_fee_per_gas,json=maxFeePerGas,proto3" json:"max_fee_per_gas,omitempty"`
	MaxPriorityFeePerGas string                     ``                                                                /* 127-byte string literal not displayed */
	Input                string                     `protobuf:"bytes,9,opt,name=input,proto3" json:"input,omitempty"` // could be a long text
	Nonce                string                     `protobuf:"bytes,10,opt,name=nonce,proto3" json:"nonce,omitempty"`
	TransactionIndex     uint64                     `protobuf:"varint,11,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"`
	TransactionType      uint64                     `protobuf:"varint,12,opt,name=transaction_type,json=transactionType,proto3" json:"transaction_type,omitempty"`
	Value                string                     `protobuf:"bytes,13,opt,name=value,proto3" json:"value,omitempty"`                                          // using string to handle big numeric values
	IndexedAt            uint64                     `protobuf:"varint,14,opt,name=indexed_at,json=indexedAt,proto3" json:"indexed_at,omitempty"`                // using uint64 to represent timestamp
	BlockTimestamp       uint64                     `protobuf:"varint,15,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp,omitempty"` // using uint64 to represent timestam
	BlockHash            string                     `protobuf:"bytes,16,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`                 // Added field for block hash
	ChainId              string                     `protobuf:"bytes,17,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`                       // Used as a field to match potential EIP-1559 transaction types
	V                    string                     `protobuf:"bytes,18,opt,name=v,proto3" json:"v,omitempty"`                                                  // Used as a field to match potential EIP-1559 transaction types
	R                    string                     `protobuf:"bytes,19,opt,name=r,proto3" json:"r,omitempty"`                                                  // Used as a field to match potential EIP-1559 transaction types
	S                    string                     `protobuf:"bytes,20,opt,name=s,proto3" json:"s,omitempty"`                                                  // Used as a field to match potential EIP-1559 transaction types
	AccessList           []*B3TransactionAccessList `protobuf:"bytes,21,rep,name=access_list,json=accessList,proto3" json:"access_list,omitempty"`
	YParity              string                     `protobuf:"bytes,22,opt,name=y_parity,json=yParity,proto3" json:"y_parity,omitempty"` // Used as a field to match potential EIP-1559 transaction types
	Logs                 []*B3EventLog              `protobuf:"bytes,23,rep,name=logs,proto3" json:"logs,omitempty"`
	// contains filtered or unexported fields
}

Represents a single transaction within a block

func ToProtoSingleTransaction

func ToProtoSingleTransaction(obj *seer_common.TransactionJson) *B3Transaction

func (*B3Transaction) Descriptor deprecated

func (*B3Transaction) Descriptor() ([]byte, []int)

Deprecated: Use B3Transaction.ProtoReflect.Descriptor instead.

func (*B3Transaction) GetAccessList

func (x *B3Transaction) GetAccessList() []*B3TransactionAccessList

func (*B3Transaction) GetBlockHash

func (x *B3Transaction) GetBlockHash() string

func (*B3Transaction) GetBlockNumber

func (x *B3Transaction) GetBlockNumber() uint64

func (*B3Transaction) GetBlockTimestamp

func (x *B3Transaction) GetBlockTimestamp() uint64

func (*B3Transaction) GetChainId

func (x *B3Transaction) GetChainId() string

func (*B3Transaction) GetFromAddress

func (x *B3Transaction) GetFromAddress() string

func (*B3Transaction) GetGas

func (x *B3Transaction) GetGas() string

func (*B3Transaction) GetGasPrice

func (x *B3Transaction) GetGasPrice() string

func (*B3Transaction) GetHash

func (x *B3Transaction) GetHash() string

func (*B3Transaction) GetIndexedAt

func (x *B3Transaction) GetIndexedAt() uint64

func (*B3Transaction) GetInput

func (x *B3Transaction) GetInput() string

func (*B3Transaction) GetLogs

func (x *B3Transaction) GetLogs() []*B3EventLog

func (*B3Transaction) GetMaxFeePerGas

func (x *B3Transaction) GetMaxFeePerGas() string

func (*B3Transaction) GetMaxPriorityFeePerGas

func (x *B3Transaction) GetMaxPriorityFeePerGas() string

func (*B3Transaction) GetNonce

func (x *B3Transaction) GetNonce() string

func (*B3Transaction) GetR

func (x *B3Transaction) GetR() string

func (*B3Transaction) GetS

func (x *B3Transaction) GetS() string

func (*B3Transaction) GetToAddress

func (x *B3Transaction) GetToAddress() string

func (*B3Transaction) GetTransactionIndex

func (x *B3Transaction) GetTransactionIndex() uint64

func (*B3Transaction) GetTransactionType

func (x *B3Transaction) GetTransactionType() uint64

func (*B3Transaction) GetV

func (x *B3Transaction) GetV() string

func (*B3Transaction) GetValue

func (x *B3Transaction) GetValue() string

func (*B3Transaction) GetYParity

func (x *B3Transaction) GetYParity() string

func (*B3Transaction) ProtoMessage

func (*B3Transaction) ProtoMessage()

func (*B3Transaction) ProtoReflect

func (x *B3Transaction) ProtoReflect() protoreflect.Message

func (*B3Transaction) Reset

func (x *B3Transaction) Reset()

func (*B3Transaction) String

func (x *B3Transaction) String() string

type B3TransactionAccessList

type B3TransactionAccessList struct {
	Address     string   `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	StorageKeys []string `protobuf:"bytes,2,rep,name=storage_keys,json=storageKeys,proto3" json:"storage_keys,omitempty"`
	// contains filtered or unexported fields
}

func (*B3TransactionAccessList) Descriptor deprecated

func (*B3TransactionAccessList) Descriptor() ([]byte, []int)

Deprecated: Use B3TransactionAccessList.ProtoReflect.Descriptor instead.

func (*B3TransactionAccessList) GetAddress

func (x *B3TransactionAccessList) GetAddress() string

func (*B3TransactionAccessList) GetStorageKeys

func (x *B3TransactionAccessList) GetStorageKeys() []string

func (*B3TransactionAccessList) ProtoMessage

func (*B3TransactionAccessList) ProtoMessage()

func (*B3TransactionAccessList) ProtoReflect

func (x *B3TransactionAccessList) ProtoReflect() protoreflect.Message

func (*B3TransactionAccessList) Reset

func (x *B3TransactionAccessList) Reset()

func (*B3TransactionAccessList) String

func (x *B3TransactionAccessList) String() string

type Client

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

func NewClient

func NewClient(url string, timeout int) (*Client, error)

func (*Client) BlockByHash

func (c *Client) BlockByHash(ctx context.Context, hash common.Hash) (*seer_common.BlockJson, error)

BlockByHash returns the block with the given hash.

func (*Client) ChainType

func (c *Client) ChainType() string

ChainType returns the chain type.

func (*Client) ClientFilterLogs

func (c *Client) ClientFilterLogs(ctx context.Context, q ethereum.FilterQuery, debug bool) ([]*seer_common.EventJson, error)

func (*Client) Close

func (c *Client) Close()

Close closes the underlying RPC client.

func (*Client) DecodeProtoBlocks

func (c *Client) DecodeProtoBlocks(data []string) ([]*B3Block, error)

func (*Client) DecodeProtoEntireBlockToJson

func (c *Client) DecodeProtoEntireBlockToJson(rawData *bytes.Buffer) (*seer_common.BlocksBatchJson, error)

func (*Client) DecodeProtoEntireBlockToLabels

func (c *Client) DecodeProtoEntireBlockToLabels(rawData *bytes.Buffer, abiMap map[string]map[string]*indexer.AbiEntry, threads int) ([]indexer.EventLabel, []indexer.TransactionLabel, error)

func (*Client) DecodeProtoEventLogs

func (c *Client) DecodeProtoEventLogs(data []string) ([]*B3EventLog, error)

func (*Client) DecodeProtoTransactions

func (c *Client) DecodeProtoTransactions(data []string) ([]*B3Transaction, error)

func (*Client) DecodeProtoTransactionsToLabels

func (c *Client) DecodeProtoTransactionsToLabels(transactions []string, blocksCache map[uint64]uint64, abiMap map[string]map[string]*indexer.AbiEntry) ([]indexer.TransactionLabel, error)

func (*Client) FetchAsProtoBlocksWithEvents

func (c *Client) FetchAsProtoBlocksWithEvents(from, to *big.Int, debug bool, maxRequests int) ([]proto.Message, []indexer.BlockIndex, uint64, error)

func (*Client) FetchBlocksInRange

func (c *Client) FetchBlocksInRange(from, to *big.Int, debug bool) ([]*seer_common.BlockJson, error)

FetchBlocksInRange fetches blocks within a specified range. This could be useful for batch processing or analysis.

func (*Client) FetchBlocksInRangeAsync

func (c *Client) FetchBlocksInRangeAsync(from, to *big.Int, debug bool, maxRequests int) ([]*seer_common.BlockJson, error)

FetchBlocksInRangeAsync fetches blocks within a specified range concurrently.

func (*Client) GetBlockByNumber

func (c *Client) GetBlockByNumber(ctx context.Context, number *big.Int, withTransactions bool) (*seer_common.BlockJson, error)

GetBlockByNumber returns the block with the given number.

func (*Client) GetCode

func (c *Client) GetCode(ctx context.Context, address common.Address, blockNumber uint64) ([]byte, error)

Get bytecode of a contract by address.

func (*Client) GetEventsLabels

func (c *Client) GetEventsLabels(startBlock uint64, endBlock uint64, abiMap map[string]map[string]*indexer.AbiEntry, blocksCache map[uint64]seer_common.BlockWithTransactions) ([]indexer.EventLabel, error)

func (*Client) GetLatestBlockNumber

func (c *Client) GetLatestBlockNumber() (*big.Int, error)

GetLatestBlockNumber returns the latest block number.

func (*Client) GetTransactionByHash

func (c *Client) GetTransactionByHash(ctx context.Context, hash string) (*seer_common.TransactionJson, error)

func (*Client) GetTransactionsLabels

func (c *Client) GetTransactionsLabels(startBlock uint64, endBlock uint64, abiMap map[string]map[string]*indexer.AbiEntry, threads int) ([]indexer.TransactionLabel, map[uint64]seer_common.BlockWithTransactions, error)

func (*Client) ParseBlocksWithTransactions

func (c *Client) ParseBlocksWithTransactions(from, to *big.Int, debug bool, maxRequests int) ([]*B3Block, error)

ParseBlocksWithTransactions parses blocks and their transactions into custom data structure. This method showcases how to handle and transform detailed block and transaction data.

func (*Client) ParseEvents

func (c *Client) ParseEvents(from, to *big.Int, blocksCache map[uint64]indexer.BlockCache, debug bool) ([]*B3EventLog, error)

func (*Client) ProcessBlocksToBatch

func (c *Client) ProcessBlocksToBatch(msgs []proto.Message) (proto.Message, error)

func (*Client) TransactionReceipt

func (c *Client) TransactionReceipt(ctx context.Context, hash common.Hash) (*types.Receipt, error)

TransactionReceipt returns the receipt of a transaction by transaction hash.

Jump to

Keyboard shortcuts

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