eth

package
v4.2.8-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: AGPL-3.0 Imports: 51 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RetrieveCanonicalBlockHashByNumber = `SELECT block_hash
									FROM canonical_header_hash($1) AS block_hash
									WHERE block_hash IS NOT NULL`
	RetrieveCanonicalHeaderByNumber = `` /* 253-byte string literal not displayed */

	RetrieveTD = `SELECT CAST(td as Text) FROM eth.header_cids
			WHERE header_cids.block_hash = $1`
	RetrieveRPCTransaction = `` /* 351-byte string literal not displayed */

	RetrieveCodeHashByLeafKeyAndBlockHash = `` /* 740-byte string literal not displayed */

	RetrieveCodeByMhKey = `SELECT data FROM public.blocks WHERE key = $1`
)
View Source
const (
	RetrieveHeadersByHashesPgStr = `` /* 248-byte string literal not displayed */

	RetrieveHeadersByBlockNumberPgStr = `` /* 242-byte string literal not displayed */

	RetrieveHeaderByHashPgStr = `` /* 228-byte string literal not displayed */

	RetrieveUnclesByHashesPgStr = `` /* 245-byte string literal not displayed */

	RetrieveUnclesPgStr = `` /* 527-byte string literal not displayed */

	RetrieveUnclesByBlockHashPgStr = `` /* 483-byte string literal not displayed */

	RetrieveUnclesByBlockNumberPgStr = `` /* 443-byte string literal not displayed */

	RetrieveUncleByHashPgStr = `` /* 225-byte string literal not displayed */

	RetrieveTransactionsByHashesPgStr = `` /* 288-byte string literal not displayed */

	RetrieveTransactionsPgStr = `` /* 571-byte string literal not displayed */

	RetrieveTransactionsByBlockHashPgStr = `` /* 526-byte string literal not displayed */

	RetrieveTransactionsByBlockNumberPgStr = `` /* 625-byte string literal not displayed */

	RetrieveTransactionByHashPgStr = `` /* 268-byte string literal not displayed */

	RetrieveReceiptsByTxHashesPgStr = `` /* 637-byte string literal not displayed */

	RetrieveReceiptsPgStr = `` /* 844-byte string literal not displayed */

	RetrieveReceiptsByBlockHashPgStr = `` /* 800-byte string literal not displayed */

	RetrieveReceiptsByBlockNumberPgStr = `` /* 868-byte string literal not displayed */

	RetrieveReceiptByTxHashPgStr = `` /* 617-byte string literal not displayed */

	RetrieveAccountByLeafKeyAndBlockHashPgStr = `` /* 658-byte string literal not displayed */

	RetrieveAccountByLeafKeyAndBlockNumberPgStr = `` /* 448-byte string literal not displayed */

	RetrieveStorageLeafByAddressHashAndLeafKeyAndBlockNumberPgStr = `SELECT cid, mh_key, block_number, node_type, state_leaf_removed FROM get_storage_at_by_number($1, $2, $3)`
	RetrieveStorageLeafByAddressHashAndLeafKeyAndBlockHashPgStr   = `SELECT cid, mh_key, block_number, node_type, state_leaf_removed FROM get_storage_at_by_hash($1, $2, $3)`
)
View Source
const APIName = "eth"

APIName is the namespace for the watcher's eth api

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the watcher's eth api

View Source
const (
	StateDBGroupCacheName = "statedb"
)

Variables

View Source
var EmptyNodeValue = make([]byte, common.HashLength)

Functions

func CheckGetSliceResponse

func CheckGetSliceResponse(sliceResponse GetSliceResponse, expectedResponse GetSliceResponse)

func DecodeLeafNode

func DecodeLeafNode(node []byte) ([]byte, error)

DecodeLeafNode decodes the leaf node data

func DoCall

func DoCall(ctx context.Context, b *Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, timeout time.Duration, globalGasCap uint64) (*core.ExecutionResult, error)

func GetRctLeafNodeData

func GetRctLeafNodeData(rcts types.Receipts) ([]cid.Cid, [][]byte, error)

GetRctLeafNodeData converts the receipts to receipt trie and returns the receipt leaf node IPLD data and corresponding CIDs

func RPCMarshalBlock

func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)

RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.

func RPCMarshalBlockWithUncleHashes

func RPCMarshalBlockWithUncleHashes(block *types.Block, uncleHashes []common.Hash, inclTx bool, fullTx bool) (map[string]interface{}, error)

RPCMarshalBlockWithUncleHashes marshals the block with the provided uncle hashes

func RPCMarshalHeader

func RPCMarshalHeader(head *types.Header) map[string]interface{}

RPCMarshalHeader converts the given header to the RPC output. This function is eth/internal so we have to make our own version here...

func ReceiptModelsContainsCID

func ReceiptModelsContainsCID(rcts []models.ReceiptModel, cid string) bool

ReceiptModelsContainsCID used to check if a list of ReceiptModel contains a specific cid string

func ResolveNode

func ResolveNode(path []byte, node []byte, trieDB *trie.Database) (sdtypes.StateNode, []interface{}, error)

func ResolveToNodeType

func ResolveToNodeType(nodeType int) sdtypes.NodeType

func TxModelsContainsCID

func TxModelsContainsCID(txs []models.TxModel, cid string) bool

TxModelsContainsCID used to check if a list of TxModels contains a specific cid string

Types

type APIConfig

type APIConfig struct {
	// Proxy node for forwarding cache misses
	SupportsStateDiff   bool // Whether the remote node supports the statediff_writeStateDiffAt endpoint, if it does we can fill the local cache when we hit a miss
	ForwardEthCalls     bool // if true, forward eth_call calls directly to the configured proxy node
	ForwardGetStorageAt bool // if true, forward eth_getStorageAt calls directly to the configured proxy node
	ProxyOnError        bool // turn on regular proxy fall-through on errors; needed to test difference between direct and indirect fall-through

	StateDiffTimeout time.Duration
}

type AccountResult

type AccountResult struct {
	Address      common.Address  `json:"address"`
	AccountProof []string        `json:"accountProof"`
	Balance      *hexutil.Big    `json:"balance"`
	CodeHash     common.Hash     `json:"codeHash"`
	Nonce        hexutil.Uint64  `json:"nonce"`
	StorageHash  common.Hash     `json:"storageHash"`
	StorageProof []StorageResult `json:"storageProof"`
}

AccountResult struct for GetProof

type Backend

type Backend struct {
	// underlying postgres db
	DB *sqlx.DB

	// postgres db interfaces
	Retriever     *CIDRetriever
	Fetcher       *IPLDFetcher
	IPLDRetriever *IPLDRetriever

	// ethereum interfaces
	EthDB         ethdb.Database
	StateDatabase state.Database

	Config *Config
}

func NewEthBackend

func NewEthBackend(db *sqlx.DB, c *Config) (*Backend, error)

func (*Backend) BlockByHash

func (b *Backend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

BlockByHash returns the requested block

func (*Backend) BlockByNumber

func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Block, error)

BlockByNumber returns the requested canonical block

func (*Backend) BlockByNumberOrHash

func (b *Backend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, error)

BlockByNumberOrHash returns block by number or hash

func (*Backend) BloomStatus

func (b *Backend) BloomStatus() (uint64, uint64)

func (*Backend) ChainConfig

func (b *Backend) ChainConfig() *params.ChainConfig

ChainConfig returns the active chain configuration.

func (*Backend) ChainDb

func (b *Backend) ChainDb() ethdb.Database

ChainDb returns the backend's underlying chain database

func (*Backend) CurrentBlock

func (b *Backend) CurrentBlock() (*types.Block, error)

CurrentBlock returns the current block

func (*Backend) CurrentHeader

func (b *Backend) CurrentHeader() *types.Header

CurrentHeader returns the current block's header

func (*Backend) Engine

func (b *Backend) Engine() consensus.Engine

Engine satisfied the ChainContext interface

func (*Backend) GetAccountByHash

func (b *Backend) GetAccountByHash(ctx context.Context, address common.Address, hash common.Hash) (*types.StateAccount, error)

GetAccountByHash returns the account object for the provided address at the block with the provided hash

func (*Backend) GetAccountByNumber

func (b *Backend) GetAccountByNumber(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) (*types.StateAccount, error)

GetAccountByNumber returns the account object for the provided address at the canonical block at the provided height

func (*Backend) GetAccountByNumberOrHash

func (b *Backend) GetAccountByNumberOrHash(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*types.StateAccount, error)

GetAccountByNumberOrHash returns the account object for the provided address at the block corresponding to the provided number or hash

func (*Backend) GetBody

func (b *Backend) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error)

GetBody returns the the body for the provided block hash and number

func (*Backend) GetCanonicalHash

func (b *Backend) GetCanonicalHash(number uint64) (common.Hash, error)

GetCanonicalHash gets the canonical hash for the provided number, if there is one

func (*Backend) GetCanonicalHeader

func (b *Backend) GetCanonicalHeader(number uint64) (string, []byte, error)

GetCanonicalHeader gets the canonical header for the provided number, if there is one

func (*Backend) GetCodeByHash

func (b *Backend) GetCodeByHash(ctx context.Context, address common.Address, hash common.Hash) ([]byte, error)

GetCodeByHash returns the byte code for the contract deployed at the provided address at the block with the provided hash

func (*Backend) GetCodeByNumber

func (b *Backend) GetCodeByNumber(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) ([]byte, error)

GetCodeByNumber returns the byte code for the contract deployed at the provided address at the canonical block with the provided block number

func (*Backend) GetCodeByNumberOrHash

func (b *Backend) GetCodeByNumberOrHash(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) ([]byte, error)

GetCodeByNumberOrHash returns the byte code for the contract deployed at the provided address at the block with the provided hash or block number

func (*Backend) GetEVM

func (b *Backend) GetEVM(ctx context.Context, msg *core.Message, state *state.StateDB, header *types.Header) (*vm.EVM, func() error, error)

GetEVM constructs and returns a vm.EVM

func (*Backend) GetHeader

func (b *Backend) GetHeader(hash common.Hash, height uint64) *types.Header

GetHeader satisfied the ChainContext interface

func (*Backend) GetHeaderByBlockHash

func (b *Backend) GetHeaderByBlockHash(tx *sqlx.Tx, hash common.Hash) (*types.Header, error)

GetHeaderByBlockHash retrieves header for a provided block hash

func (*Backend) GetLogs

func (b *Backend) GetLogs(ctx context.Context, hash common.Hash, number uint64) ([][]*types.Log, error)

GetLogs returns all the logs for the given block hash

func (*Backend) GetReceipts

func (b *Backend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

GetReceipts retrieves receipts for provided block hash

func (*Backend) GetReceiptsByBlockHash

func (b *Backend) GetReceiptsByBlockHash(tx *sqlx.Tx, hash common.Hash) (types.Receipts, error)

GetReceiptsByBlockHash retrieves receipts for a provided block hash

func (*Backend) GetReceiptsByBlockHashAndNumber

func (b *Backend) GetReceiptsByBlockHashAndNumber(tx *sqlx.Tx, hash common.Hash, number uint64) (types.Receipts, error)

GetReceiptsByBlockHashAndNumber retrieves receipts for a provided block hash and number

func (*Backend) GetSlice

func (b *Backend) GetSlice(path string, depth int, root common.Hash, storage bool) (*GetSliceResponse, error)

func (*Backend) GetStorageByHash

func (b *Backend) GetStorageByHash(ctx context.Context, address common.Address, key, hash common.Hash) (hexutil.Bytes, error)

GetStorageByHash returns the storage value for the provided contract address an storage key at the block corresponding to the provided hash

func (*Backend) GetStorageByNumber

func (b *Backend) GetStorageByNumber(ctx context.Context, address common.Address, key common.Hash, blockNumber rpc.BlockNumber) (hexutil.Bytes, error)

GetStorageByNumber returns the storage value for the provided contract address an storage key at the block corresponding to the provided number

func (*Backend) GetStorageByNumberOrHash

func (b *Backend) GetStorageByNumberOrHash(ctx context.Context, address common.Address, key common.Hash, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetStorageByNumberOrHash returns the storage value for the provided contract address an storage key at the block corresponding to the provided number or hash

func (*Backend) GetTd

func (b *Backend) GetTd(blockHash common.Hash) (*big.Int, error)

GetTd gets the total difficulty at the given block hash

func (*Backend) GetTransaction

func (b *Backend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error)

GetTransaction retrieves a tx by hash It also returns the blockhash, blocknumber, and tx index associated with the transaction

func (*Backend) GetTransactionsByBlockHash

func (b *Backend) GetTransactionsByBlockHash(tx *sqlx.Tx, hash common.Hash) (types.Transactions, error)

GetTransactionsByBlockHash retrieves transactions for a provided block hash

func (*Backend) GetTransactionsByBlockHashAndNumber

func (b *Backend) GetTransactionsByBlockHashAndNumber(tx *sqlx.Tx, hash common.Hash, number uint64) (types.Transactions, error)

GetTransactionsByBlockHashAndNumber retrieves transactions for a provided block hash and number

func (*Backend) GetUnclesByBlockHash

func (b *Backend) GetUnclesByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]*types.Header, error)

GetUnclesByBlockHash retrieves uncles for a provided block hash

func (*Backend) GetUnclesByBlockHashAndNumber

func (b *Backend) GetUnclesByBlockHashAndNumber(tx *sqlx.Tx, hash common.Hash, number uint64) ([]*types.Header, error)

GetUnclesByBlockHashAndNumber retrieves uncles for a provided block hash and number

func (*Backend) HeaderByHash

func (b *Backend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

HeaderByHash gets the header for the provided block hash

func (*Backend) HeaderByNumber

func (b *Backend) HeaderByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Header, error)

HeaderByNumber gets the canonical header for the provided block number

func (*Backend) HeaderByNumberOrHash

func (b *Backend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error)

HeaderByNumberOrHash gets the header for the provided block hash or number

func (*Backend) PendingBlockAndReceipts

func (b *Backend) PendingBlockAndReceipts() (*types.Block, types.Receipts)

func (*Backend) RPCGasCap

func (b *Backend) RPCGasCap() uint64

RPCGasCap returns the configured gas cap for the rpc server

func (*Backend) ServiceFilter

func (b *Backend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*Backend) StateAndHeaderByNumber

func (b *Backend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error)

StateAndHeaderByNumber returns the statedb and header for a provided block number

func (*Backend) StateAndHeaderByNumberOrHash

func (b *Backend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error)

StateAndHeaderByNumberOrHash returns the statedb and header for the provided block number or hash

func (*Backend) SubscribeChainEvent

func (b *Backend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription

func (*Backend) SubscribeLogsEvent

func (b *Backend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*Backend) SubscribeNewTxsEvent

func (b *Backend) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription

func (*Backend) SubscribePendingLogsEvent

func (b *Backend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*Backend) SubscribeRemovedLogsEvent

func (b *Backend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription

func (*Backend) ValidateTrie

func (b *Backend) ValidateTrie(stateRoot common.Hash) error

ValidateTrie validates the trie for the given stateRoot

type CIDRetriever

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

CIDRetriever satisfies the CIDRetriever interface for ethereum

func NewCIDRetriever

func NewCIDRetriever(db *sqlx.DB) *CIDRetriever

NewCIDRetriever returns a pointer to a new CIDRetriever which supports the CIDRetriever interface

func (*CIDRetriever) Retrieve

func (ecr *CIDRetriever) Retrieve(filter SubscriptionSettings, blockNumber int64) ([]CIDWrapper, bool, error)

Retrieve is used to retrieve all of the CIDs which conform to the passed StreamFilters

func (*CIDRetriever) RetrieveBlockByHash

func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (models.HeaderModel, []models.UncleModel, []models.TxModel, []models.ReceiptModel, error)

RetrieveBlockByHash returns all of the CIDs needed to compose an entire block, for a given block hash

func (*CIDRetriever) RetrieveBlockByNumber

func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (models.HeaderModel, []models.UncleModel, []models.TxModel, []models.ReceiptModel, error)

RetrieveBlockByNumber returns all of the CIDs needed to compose an entire block, for a given block number

func (*CIDRetriever) RetrieveFilteredGQLLogs

func (ecr *CIDRetriever) RetrieveFilteredGQLLogs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockHash *common.Hash, blockNumber *big.Int) ([]LogResult, error)

RetrieveFilteredGQLLogs retrieves and returns all the log CIDs provided blockHash that conform to the provided filter parameters.

func (*CIDRetriever) RetrieveFilteredLog

func (ecr *CIDRetriever) RetrieveFilteredLog(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash *common.Hash) ([]LogResult, error)

RetrieveFilteredLog retrieves and returns all the log CIDs provided blockHeight or blockHash that conform to the provided filter parameters.

func (*CIDRetriever) RetrieveFirstBlockNumber

func (ecr *CIDRetriever) RetrieveFirstBlockNumber() (int64, error)

RetrieveFirstBlockNumber is used to retrieve the first block number in the db

func (*CIDRetriever) RetrieveHeaderAndTxCIDsByBlockHash

func (ecr *CIDRetriever) RetrieveHeaderAndTxCIDsByBlockHash(blockHash common.Hash, blockNumber *big.Int) (HeaderCIDRecord, error)

RetrieveHeaderAndTxCIDsByBlockHash retrieves header CID and their associated tx CIDs by block hash (and optionally block number)

func (*CIDRetriever) RetrieveHeaderAndTxCIDsByBlockNumber

func (ecr *CIDRetriever) RetrieveHeaderAndTxCIDsByBlockNumber(blockNumber int64) ([]HeaderCIDRecord, error)

RetrieveHeaderAndTxCIDsByBlockNumber retrieves header CIDs and their associated tx CIDs by block number

func (*CIDRetriever) RetrieveHeaderCIDByHash

func (ecr *CIDRetriever) RetrieveHeaderCIDByHash(tx *sqlx.Tx, blockHash common.Hash) (models.HeaderModel, error)

RetrieveHeaderCIDByHash returns the header for the given block hash

func (*CIDRetriever) RetrieveHeaderCIDs

func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]models.HeaderModel, error)

RetrieveHeaderCIDs retrieves and returns all of the header cids at the provided blockheight

func (*CIDRetriever) RetrieveLastBlockNumber

func (ecr *CIDRetriever) RetrieveLastBlockNumber() (int64, error)

RetrieveLastBlockNumber is used to retrieve the latest block number in the db

func (*CIDRetriever) RetrieveRctCIDs

func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash string, txHashes []string) ([]models.ReceiptModel, error)

RetrieveRctCIDs retrieves and returns all of the rct cids at the provided blockheight or block hash that conform to the provided filter parameters and correspond to the provided tx ids

func (*CIDRetriever) RetrieveReceiptCIDsByByHeaderIDAndTxIDs

func (ecr *CIDRetriever) RetrieveReceiptCIDsByByHeaderIDAndTxIDs(tx *sqlx.Tx, headerID string, txHashes []string, blockNumber int64) ([]models.ReceiptModel, error)

RetrieveReceiptCIDsByByHeaderIDAndTxIDs retrieves receipt CIDs by their associated tx IDs for the given header id

func (*CIDRetriever) RetrieveStateCIDs

func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID string) ([]models.StateNodeModel, error)

RetrieveStateCIDs retrieves and returns all of the state node cids at the provided header ID that conform to the provided filter parameters

func (*CIDRetriever) RetrieveStorageCIDs

func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageFilter, headerID string) ([]models.StorageNodeWithStateKeyModel, error)

RetrieveStorageCIDs retrieves and returns all of the storage node cids at the provided header id that conform to the provided filter parameters

func (*CIDRetriever) RetrieveTxCIDByHash

func (ecr *CIDRetriever) RetrieveTxCIDByHash(txHash string, blockNumber *big.Int) (TransactionCIDRecord, error)

RetrieveTxCIDByHash returns the tx for the given tx hash (and optionally block number)

func (*CIDRetriever) RetrieveTxCIDs

func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID string) ([]models.TxModel, error)

RetrieveTxCIDs retrieves and returns all of the trx cids at the provided blockheight that conform to the provided filter parameters also returns the ids for the returned transaction cids

func (*CIDRetriever) RetrieveTxCIDsByHeaderID

func (ecr *CIDRetriever) RetrieveTxCIDsByHeaderID(tx *sqlx.Tx, headerID string, blockNumber int64) ([]models.TxModel, error)

RetrieveTxCIDsByHeaderID retrieves all tx CIDs for the given header id

func (*CIDRetriever) RetrieveUncleCIDsByHeaderID

func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID string) ([]models.UncleModel, error)

RetrieveUncleCIDsByHeaderID retrieves and returns all of the uncle cids for the provided header

type CIDWrapper

type CIDWrapper struct {
	BlockNumber  *big.Int
	Header       models.HeaderModel
	Uncles       []models.UncleModel
	Transactions []models.TxModel
	Receipts     []models.ReceiptModel
	StateNodes   []models.StateNodeModel
	StorageNodes []models.StorageNodeWithStateKeyModel
}

CIDWrapper is used to direct fetching of IPLDs from IPFS Returned by CIDRetriever Passed to IPLDFetcher

type CallArgs

type CallArgs struct {
	From                 *common.Address   `json:"from"`
	To                   *common.Address   `json:"to"`
	Gas                  *hexutil.Uint64   `json:"gas"`
	GasPrice             *hexutil.Big      `json:"gasPrice"`
	MaxFeePerGas         *hexutil.Big      `json:"maxFeePerGas"`
	MaxPriorityFeePerGas *hexutil.Big      `json:"maxPriorityFeePerGas"`
	Value                *hexutil.Big      `json:"value"`
	Data                 *hexutil.Bytes    `json:"data"`
	AccessList           *types.AccessList `json:"accessList,omitempty"`
	Input                *hexutil.Bytes    `json:"input"`
}

CallArgs represents the arguments for a call.

func (*CallArgs) ToMessage

func (arg *CallArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*core.Message, error)

ToMessage converts the transaction arguments to the Message type used by the core evm. This method is used in calls and traces that do not require a real live transaction.

type Config

type Config struct {
	ChainConfig      *params.ChainConfig
	VMConfig         vm.Config
	DefaultSender    *common.Address
	RPCGasCap        *big.Int
	GroupCacheConfig *shared.GroupCacheConfig
}

type ConvertedPayload

type ConvertedPayload struct {
	TotalDifficulty *big.Int
	Block           *types.Block
	TxMetaData      []models.TxModel
	Receipts        types.Receipts
	ReceiptMetaData []models.ReceiptModel
	StateNodes      []sdtypes.StateNode
	StorageNodes    map[string][]sdtypes.StorageNode
}

ConvertedPayload is a custom type which packages raw ETH data for publishing to IPFS and filtering to subscribers Returned by PayloadConverter Passed to IPLDPublisher and ResponseFilterer

type Fetcher

type Fetcher interface {
	Fetch(cids CIDWrapper) (*IPLDs, error)
}

Fetcher interface for substituting mocks in tests

type FilterBackend

type FilterBackend interface {
	ChainDb() ethdb.Database
	HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
	HeaderByHash(ctx context.Context, blockHash common.Hash) (*types.Header, error)
	GetReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, error)
	GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error)

	SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription
	SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
	SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
	SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
	SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription

	BloomStatus() (uint64, uint64)
	ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
}

FilterBackend is the geth interface we need to satisfy to use their filters

type Filterer

type Filterer interface {
	Filter(filter SubscriptionSettings, payload ConvertedPayload) (*IPLDs, error)
}

Filterer interface for substituing mocks in tests

type GetSliceResponse

type GetSliceResponse struct {
	SliceID   string                             `json:"sliceId"`
	MetaData  GetSliceResponseMetadata           `json:"metadata"`
	TrieNodes GetSliceResponseTrieNodes          `json:"trieNodes"`
	Leaves    map[string]GetSliceResponseAccount `json:"leaves"` // key: Keccak256Hash(address) in hex (leafKey)
}

GetSliceResponse holds response for the eth_getSlice method

type GetSliceResponseAccount

type GetSliceResponseAccount struct {
	StorageRoot string `json:"storageRoot"`
	EVMCode     string `json:"evmCode"`
}

type GetSliceResponseMetadata

type GetSliceResponseMetadata struct {
	TimeStats map[string]string `json:"timeStats"` // stem, state, storage (one by one)
	NodeStats map[string]string `json:"nodeStats"` // total, leaves, smart contracts
}

type GetSliceResponseTrieNodes

type GetSliceResponseTrieNodes struct {
	Stem  map[string]string `json:"stem"` // key: Keccak256Hash(data) in hex, value: trie node data in hex
	Head  map[string]string `json:"head"`
	Slice map[string]string `json:"sliceNodes"`
}

type HeaderCIDRecord

type HeaderCIDRecord struct {
	CID             string `gorm:"column:cid"`
	BlockHash       string `gorm:"primaryKey"`
	BlockNumber     string `gorm:"primaryKey"`
	ParentHash      string
	Timestamp       uint64
	StateRoot       string
	TotalDifficulty string `gorm:"column:td"`
	TxRoot          string
	RctRoot         string `gorm:"column:receipt_root"`
	UncleRoot       string
	Bloom           []byte
	MhKey           string

	// gorm doesn't check if foreign key exists in database.
	// It is required to eager load relations using preload.
	TransactionCIDs []TransactionCIDRecord `gorm:"foreignKey:HeaderID,BlockNumber;references:BlockHash,BlockNumber"`
	IPLD            IPLDModelRecord        `gorm:"foreignKey:MhKey,BlockNumber;references:Key,BlockNumber"`
}

func (HeaderCIDRecord) TableName

func (HeaderCIDRecord) TableName() string

TableName overrides the table name used by HeaderCIDRecord

type HeaderFilter

type HeaderFilter struct {
	Off    bool
	Uncles bool
}

HeaderFilter contains filter settings for headers

type IPLDFetcher

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

IPLDFetcher satisfies the IPLDFetcher interface for ethereum It interfaces directly with PG-IPFS

func NewIPLDFetcher

func NewIPLDFetcher(db *sqlx.DB) *IPLDFetcher

NewIPLDFetcher creates a pointer to a new IPLDFetcher

func (*IPLDFetcher) Fetch

func (f *IPLDFetcher) Fetch(cids CIDWrapper) (*IPLDs, error)

Fetch is the exported method for fetching and returning all the IPLDS specified in the CIDWrapper

func (*IPLDFetcher) FetchHeader

func (f *IPLDFetcher) FetchHeader(tx *sqlx.Tx, c models.HeaderModel) (models.IPLDModel, error)

FetchHeader fetches header

func (*IPLDFetcher) FetchRcts

func (f *IPLDFetcher) FetchRcts(tx *sqlx.Tx, cids []models.ReceiptModel) ([]models.IPLDModel, error)

FetchRcts fetches receipts

func (*IPLDFetcher) FetchState

func (f *IPLDFetcher) FetchState(tx *sqlx.Tx, cids []models.StateNodeModel) ([]StateNode, error)

FetchState fetches state nodes

func (*IPLDFetcher) FetchStorage

func (f *IPLDFetcher) FetchStorage(tx *sqlx.Tx, cids []models.StorageNodeWithStateKeyModel) ([]StorageNode, error)

FetchStorage fetches storage nodes

func (*IPLDFetcher) FetchTrxs

func (f *IPLDFetcher) FetchTrxs(tx *sqlx.Tx, cids []models.TxModel) ([]models.IPLDModel, error)

FetchTrxs fetches transactions

func (*IPLDFetcher) FetchUncles

func (f *IPLDFetcher) FetchUncles(tx *sqlx.Tx, cids []models.UncleModel) ([]models.IPLDModel, error)

FetchUncles fetches uncles

type IPLDModelRecord

type IPLDModelRecord struct {
	models.IPLDModel
}

func (IPLDModelRecord) TableName

func (IPLDModelRecord) TableName() string

TableName overrides the table name used by IPLD

type IPLDRetriever

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

func NewIPLDRetriever

func NewIPLDRetriever(db *sqlx.DB) *IPLDRetriever

func (*IPLDRetriever) RetrieveAccountByAddressAndBlockHash

func (r *IPLDRetriever) RetrieveAccountByAddressAndBlockHash(address common.Address, hash common.Hash) (string, []byte, error)

RetrieveAccountByAddressAndBlockHash returns the cid and rlp bytes for the account corresponding to the provided address and block hash TODO: ensure this handles deleted accounts appropriately

func (*IPLDRetriever) RetrieveAccountByAddressAndBlockNumber

func (r *IPLDRetriever) RetrieveAccountByAddressAndBlockNumber(address common.Address, number uint64) (string, []byte, error)

RetrieveAccountByAddressAndBlockNumber returns the cid and rlp bytes for the account corresponding to the provided address and block number This can return a non-canonical account

func (*IPLDRetriever) RetrieveHeaderByHash

func (r *IPLDRetriever) RetrieveHeaderByHash(tx *sqlx.Tx, hash common.Hash) (string, []byte, error)

RetrieveHeaderByHash returns the cid and rlp bytes for the header corresponding to the provided block hash

func (*IPLDRetriever) RetrieveHeadersByBlockNumber

func (r *IPLDRetriever) RetrieveHeadersByBlockNumber(number uint64) ([]string, [][]byte, error)

RetrieveHeadersByBlockNumber returns the cids and rlp bytes for the headers corresponding to the provided block number This can return more than one result since there can be more than one header (non-canonical headers)

func (*IPLDRetriever) RetrieveHeadersByHashes

func (r *IPLDRetriever) RetrieveHeadersByHashes(hashes []common.Hash) ([]string, [][]byte, error)

RetrieveHeadersByHashes returns the cids and rlp bytes for the headers corresponding to the provided block hashes

func (*IPLDRetriever) RetrieveReceiptByHash

func (r *IPLDRetriever) RetrieveReceiptByHash(hash common.Hash) (string, []byte, error)

RetrieveReceiptByHash returns the cid and rlp bytes for the receipt corresponding to the provided tx hash. cid returned corresponds to the leaf node data which contains the receipt.

func (*IPLDRetriever) RetrieveReceipts

func (r *IPLDRetriever) RetrieveReceipts(tx *sqlx.Tx, hash common.Hash, number uint64) ([]string, [][]byte, []common.Hash, error)

RetrieveReceipts returns the cids and rlp bytes for the receipts corresponding to the provided block hash, number. cid returned corresponds to the leaf node data which contains the receipt.

func (*IPLDRetriever) RetrieveReceiptsByBlockHash

func (r *IPLDRetriever) RetrieveReceiptsByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]string, [][]byte, []common.Hash, error)

RetrieveReceiptsByBlockHash returns the cids and rlp bytes for the receipts corresponding to the provided block hash. cid returned corresponds to the leaf node data which contains the receipt.

func (*IPLDRetriever) RetrieveReceiptsByBlockNumber

func (r *IPLDRetriever) RetrieveReceiptsByBlockNumber(number uint64) ([]string, [][]byte, error)

RetrieveReceiptsByBlockNumber returns the cids and rlp bytes for the receipts corresponding to the provided block hash. cid returned corresponds to the leaf node data which contains the receipt.

func (*IPLDRetriever) RetrieveReceiptsByTxHashes

func (r *IPLDRetriever) RetrieveReceiptsByTxHashes(hashes []common.Hash) ([]string, [][]byte, error)

RetrieveReceiptsByTxHashes returns the cids and rlp bytes for the receipts corresponding to the provided tx hashes

func (*IPLDRetriever) RetrieveStorageAtByAddressAndStorageKeyAndBlockNumber

func (r *IPLDRetriever) RetrieveStorageAtByAddressAndStorageKeyAndBlockNumber(address common.Address, storageLeafKey common.Hash, number uint64) (string, []byte, error)

RetrieveStorageAtByAddressAndStorageKeyAndBlockNumber returns the cid and rlp bytes for the storage value corresponding to the provided address, storage key, and block number This can retrun a non-canonical value

func (*IPLDRetriever) RetrieveStorageAtByAddressAndStorageSlotAndBlockHash

func (r *IPLDRetriever) RetrieveStorageAtByAddressAndStorageSlotAndBlockHash(address common.Address, key, hash common.Hash) (string, []byte, []byte, error)

RetrieveStorageAtByAddressAndStorageSlotAndBlockHash returns the cid and rlp bytes for the storage value corresponding to the provided address, storage slot, and block hash

func (*IPLDRetriever) RetrieveTransactionByTxHash

func (r *IPLDRetriever) RetrieveTransactionByTxHash(hash common.Hash) (string, []byte, error)

RetrieveTransactionByTxHash returns the cid and rlp bytes for the transaction corresponding to the provided tx hash

func (*IPLDRetriever) RetrieveTransactions

func (r *IPLDRetriever) RetrieveTransactions(tx *sqlx.Tx, hash common.Hash, number uint64) ([]string, [][]byte, error)

RetrieveTransactions returns the cids and rlp bytes for the transactions corresponding to the provided block hash, number

func (*IPLDRetriever) RetrieveTransactionsByBlockHash

func (r *IPLDRetriever) RetrieveTransactionsByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]string, [][]byte, error)

RetrieveTransactionsByBlockHash returns the cids and rlp bytes for the transactions corresponding to the provided block hash

func (*IPLDRetriever) RetrieveTransactionsByBlockNumber

func (r *IPLDRetriever) RetrieveTransactionsByBlockNumber(number uint64) ([]string, [][]byte, error)

RetrieveTransactionsByBlockNumber returns the cids and rlp bytes for the transactions corresponding to the provided block number

func (*IPLDRetriever) RetrieveTransactionsByHashes

func (r *IPLDRetriever) RetrieveTransactionsByHashes(hashes []common.Hash) ([]string, [][]byte, error)

RetrieveTransactionsByHashes returns the cids and rlp bytes for the transactions corresponding to the provided tx hashes

func (*IPLDRetriever) RetrieveUncleByHash

func (r *IPLDRetriever) RetrieveUncleByHash(hash common.Hash) (string, []byte, error)

RetrieveUncleByHash returns the cid and rlp bytes for the uncle corresponding to the provided uncle hash

func (*IPLDRetriever) RetrieveUncles

func (r *IPLDRetriever) RetrieveUncles(tx *sqlx.Tx, hash common.Hash, number uint64) ([]string, [][]byte, error)

RetrieveUncles returns the cids and rlp bytes for the uncles corresponding to the provided block hash, number (of non-omner root block)

func (*IPLDRetriever) RetrieveUnclesByBlockHash

func (r *IPLDRetriever) RetrieveUnclesByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]string, [][]byte, error)

RetrieveUnclesByBlockHash returns the cids and rlp bytes for the uncles corresponding to the provided block hash (of non-omner root block)

func (*IPLDRetriever) RetrieveUnclesByBlockNumber

func (r *IPLDRetriever) RetrieveUnclesByBlockNumber(number uint64) ([]string, [][]byte, error)

RetrieveUnclesByBlockNumber returns the cids and rlp bytes for the uncles corresponding to the provided block number (of non-omner root block)

func (*IPLDRetriever) RetrieveUnclesByHashes

func (r *IPLDRetriever) RetrieveUnclesByHashes(hashes []common.Hash) ([]string, [][]byte, error)

RetrieveUnclesByHashes returns the cids and rlp bytes for the uncles corresponding to the provided uncle hashes

type IPLDs

type IPLDs struct {
	BlockNumber     *big.Int
	TotalDifficulty *big.Int
	Header          models.IPLDModel
	Uncles          []models.IPLDModel
	Transactions    []models.IPLDModel
	Receipts        []models.IPLDModel
	StateNodes      []StateNode
	StorageNodes    []StorageNode
}

IPLDs is used to package raw IPLD block data fetched from IPFS and returned by the server Returned by IPLDFetcher and ResponseFilterer

type LogResult

type LogResult struct {
	LeafCID     string `db:"leaf_cid"`
	ReceiptID   string `db:"rct_id"`
	Address     string `db:"address"`
	Index       int64  `db:"index"`
	Data        []byte `db:"log_data"`
	Topic0      string `db:"topic0"`
	Topic1      string `db:"topic1"`
	Topic2      string `db:"topic2"`
	Topic3      string `db:"topic3"`
	LogLeafData []byte `db:"data"`
	RctCID      string `db:"cid"`
	RctStatus   uint64 `db:"post_status"`
	BlockNumber string `db:"block_number"`
	BlockHash   string `db:"block_hash"`
	TxnIndex    int64  `db:"txn_index"`
	TxHash      string `db:"tx_hash"`
}

LogResult represent a log.

type OverrideAccount

type OverrideAccount struct {
	Nonce     *hexutil.Uint64              `json:"nonce"`
	Code      *hexutil.Bytes               `json:"code"`
	Balance   **hexutil.Big                `json:"balance"`
	State     *map[common.Hash]common.Hash `json:"state"`
	StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
}

OverrideAccount indicates the overriding fields of account during the execution of a message call. Note, state and stateDiff can't be specified at the same time. If state is set, message execution will only use the data in the given state. Otherwise if statDiff is set, all diff will be applied first and then execute the call message.

type PublicEthAPI

type PublicEthAPI struct {
	// Local db backend
	B *Backend
	// contains filtered or unexported fields
}

PublicEthAPI is the eth namespace API

func NewPublicEthAPI

func NewPublicEthAPI(b *Backend, client *rpc.Client, config APIConfig) (*PublicEthAPI, error)

NewPublicEthAPI creates a new PublicEthAPI with the provided underlying Backend

func (*PublicEthAPI) BlockNumber

func (pea *PublicEthAPI) BlockNumber() hexutil.Uint64

BlockNumber returns the block number of the chain head.

func (*PublicEthAPI) Call

func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error)

Call executes the given transaction on the state for the given block number.

Additionally, the caller can specify a batch of contract for fields overriding.

Note, this function doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.

func (*PublicEthAPI) ChainId

func (pea *PublicEthAPI) ChainId() *hexutil.Big

ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.

func (*PublicEthAPI) CreateAccessList

func (pea *PublicEthAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error)

CreateAccessList creates a EIP-2930 type AccessList for the given transaction. Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain state.

func (*PublicEthAPI) EstimateGas

func (pea *PublicEthAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)

EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.

func (*PublicEthAPI) FeeHistory

func (pea *PublicEthAPI) FeeHistory(ctx context.Context, blockCount int, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error)

FeeHistory returns the fee market history.

func (*PublicEthAPI) GasPrice

func (pea *PublicEthAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)

GasPrice returns a suggestion for a gas price for legacy transactions.

func (*PublicEthAPI) GetBalance

func (pea *PublicEthAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)

GetBalance returns the amount of wei for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

func (*PublicEthAPI) GetBlockByHash

func (pea *PublicEthAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)

GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicEthAPI) GetBlockByNumber

func (pea *PublicEthAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)

GetBlockByNumber returns the requested canonical block.

  • When blockNr is -1 the chain head is returned.
  • We cannot support pending block calls since we do not have an active miner
  • When fullTx is true all transactions in the block are returned, otherwise only the transaction hash is returned.

func (*PublicEthAPI) GetBlockTransactionCountByHash

func (pea *PublicEthAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.

func (*PublicEthAPI) GetBlockTransactionCountByNumber

func (pea *PublicEthAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.

func (*PublicEthAPI) GetCode

func (pea *PublicEthAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetCode returns the code stored at the given address in the state for the given block number.

func (*PublicEthAPI) GetHeaderByHash

func (pea *PublicEthAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{}

GetHeaderByHash returns the requested header by hash.

func (*PublicEthAPI) GetHeaderByNumber

func (pea *PublicEthAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)

GetHeaderByNumber returns the requested canonical block header. * When blockNr is -1 the chain head is returned. * We cannot support pending block calls since we do not have an active miner

func (*PublicEthAPI) GetLogs

func (pea *PublicEthAPI) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([]*types.Log, error)

GetLogs returns logs matching the given argument that are stored within the state.

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs

func (*PublicEthAPI) GetProof

func (pea *PublicEthAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error)

GetProof returns the Merkle-proof for a given account and optionally some storage keys.

func (*PublicEthAPI) GetRawTransactionByBlockHashAndIndex

func (pea *PublicEthAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes

GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.

func (*PublicEthAPI) GetRawTransactionByBlockNumberAndIndex

func (pea *PublicEthAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes

GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.

func (*PublicEthAPI) GetRawTransactionByHash

func (pea *PublicEthAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

GetRawTransactionByHash returns the bytes of the transaction for the given hash.

func (*PublicEthAPI) GetSlice

func (pea *PublicEthAPI) GetSlice(ctx context.Context, path string, depth int, root common.Hash, storage bool) (*GetSliceResponse, error)

GetSlice returns a slice of state or storage nodes from a provided root to a provided path and past it to a certain depth

func (*PublicEthAPI) GetStorageAt

func (pea *PublicEthAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetStorageAt returns the storage from the state at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

func (*PublicEthAPI) GetTransactionByBlockHashAndIndex

func (pea *PublicEthAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction

GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.

func (*PublicEthAPI) GetTransactionByBlockNumberAndIndex

func (pea *PublicEthAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction

GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.

func (*PublicEthAPI) GetTransactionByHash

func (pea *PublicEthAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)

GetTransactionByHash returns the transaction for the given hash eth ipld-eth-server cannot currently handle pending/tx_pool txs

func (*PublicEthAPI) GetTransactionCount

func (pea *PublicEthAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)

GetTransactionCount returns the number of transactions the given address has sent for the given block number

func (*PublicEthAPI) GetTransactionReceipt

func (pea *PublicEthAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt returns the transaction receipt for the given transaction hash.

func (*PublicEthAPI) GetUncleByBlockHashAndIndex

func (pea *PublicEthAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)

GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicEthAPI) GetUncleByBlockNumberAndIndex

func (pea *PublicEthAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)

GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicEthAPI) GetUncleCountByBlockHash

func (pea *PublicEthAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

GetUncleCountByBlockHash returns number of uncles in the block for the given block hash

func (*PublicEthAPI) GetUncleCountByBlockNumber

func (pea *PublicEthAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint

GetUncleCountByBlockNumber returns number of uncles in the block for the given block number

func (*PublicEthAPI) MaxPriorityFeePerGas

func (pea *PublicEthAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error)

MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.

type RPCReceipt

type RPCReceipt struct {
	BlockHash        *common.Hash    `json:"blockHash"`
	BlockNumber      *hexutil.Big    `json:"blockNumber"`
	TransactionHash  *common.Hash    `json:"transactionHash"`
	TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
	From             common.Address  `json:"from"`
	To               *common.Address `json:"to"`
	GasUsed          hexutil.Uint64  `json:"gasUsed"`
	CumulativeGsUsed hexutil.Uint64  `json:"cumulativeGasUsed"`
	ContractAddress  *common.Address `json:"contractAddress"`
	Logs             []*types.Log    `json:"logs"`
	Bloom            types.Bloom     `json:"logsBloom"`
	Root             []byte          `json:"root"`
	Status           uint64          `json:"status"`
}

RPCReceipt represents a receipt that will serialize to the RPC representation of a receipt

type RPCTransaction

type RPCTransaction struct {
	BlockHash        *common.Hash      `json:"blockHash"`
	BlockNumber      *hexutil.Big      `json:"blockNumber"`
	From             common.Address    `json:"from"`
	Gas              hexutil.Uint64    `json:"gas"`
	GasPrice         *hexutil.Big      `json:"gasPrice"`
	GasFeeCap        *hexutil.Big      `json:"maxFeePerGas,omitempty"`
	GasTipCap        *hexutil.Big      `json:"maxPriorityFeePerGas,omitempty"`
	Hash             common.Hash       `json:"hash"`
	Input            hexutil.Bytes     `json:"input"`
	Nonce            hexutil.Uint64    `json:"nonce"`
	To               *common.Address   `json:"to"`
	TransactionIndex *hexutil.Uint64   `json:"transactionIndex"`
	Value            *hexutil.Big      `json:"value"`
	Type             hexutil.Uint64    `json:"type"`
	Accesses         *types.AccessList `json:"accessList,omitempty"`
	ChainID          *hexutil.Big      `json:"chainId,omitempty"`
	V                *hexutil.Big      `json:"v"`
	R                *hexutil.Big      `json:"r"`
	S                *hexutil.Big      `json:"s"`
}

RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction

func NewRPCTransaction

func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int) *RPCTransaction

NewRPCTransaction returns a transaction that will serialize to the RPC representation, with the given location metadata set (if available).

func NewRPCTransactionFromBlockHash

func NewRPCTransactionFromBlockHash(b *types.Block, hash common.Hash) *RPCTransaction

NewRPCTransactionFromBlockHash returns a transaction that will serialize to the RPC representation.

type ReceiptFilter

type ReceiptFilter struct {
	Off bool
	// TODO: change this so that we filter for receipts first and we always return the corresponding transaction
	MatchTxs     bool     // turn on to retrieve receipts that pair with retrieved transactions
	LogAddresses []string // receipt contains logs from the provided addresses
	Topics       [][]string
}

ReceiptFilter contains filter settings for receipts

type RequiresProxyError

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

func (RequiresProxyError) Error

func (e RequiresProxyError) Error() string

func (RequiresProxyError) SetMethod

func (e RequiresProxyError) SetMethod(method string)

type ResponseFilterer

type ResponseFilterer struct{}

ResponseFilterer satisfies the ResponseFilterer interface for ethereum

func NewResponseFilterer

func NewResponseFilterer() *ResponseFilterer

NewResponseFilterer creates a new Filterer satisfying the ResponseFilterer interface

func (*ResponseFilterer) Filter

func (s *ResponseFilterer) Filter(filter SubscriptionSettings, payload ConvertedPayload) (*IPLDs, error)

Filter is used to filter through eth data to extract and package requested data into a Payload

type Retriever

type Retriever interface {
	RetrieveFirstBlockNumber() (int64, error)
	RetrieveLastBlockNumber() (int64, error)
	Retrieve(filter SubscriptionSettings, blockNumber int64) ([]CIDWrapper, bool, error)
}

Retriever interface for substituting mocks in tests

type StateFilter

type StateFilter struct {
	Off               bool
	Addresses         []string // is converted to state key by taking its keccak256 hash
	IntermediateNodes bool
}

StateFilter contains filter settings for state

type StateNode

type StateNode struct {
	Type         sdtypes.NodeType
	StateLeafKey common.Hash
	Path         []byte
	IPLD         models.IPLDModel
}

type StateOverride

type StateOverride map[common.Address]OverrideAccount

StateOverride is the collection of overridden accounts.

func (*StateOverride) Apply

func (diff *StateOverride) Apply(state *state.StateDB) error

Apply overrides the fields of specified accounts into the given state.

type StorageFilter

type StorageFilter struct {
	Off               bool
	Addresses         []string
	StorageKeys       []string // need to be the hashs key themselves not slot position
	IntermediateNodes bool
}

StorageFilter contains filter settings for storage

type StorageNode

type StorageNode struct {
	Type           sdtypes.NodeType
	StateLeafKey   common.Hash
	StorageLeafKey common.Hash
	Path           []byte
	IPLD           models.IPLDModel
}

type StorageResult

type StorageResult struct {
	Key   string       `json:"key"`
	Value *hexutil.Big `json:"value"`
	Proof []string     `json:"proof"`
}

StorageResult for GetProof

type SubscriptionSettings

type SubscriptionSettings struct {
	BackFill      bool
	BackFillOnly  bool
	Start         *big.Int
	End           *big.Int // set to 0 or a negative value to have no ending block
	HeaderFilter  HeaderFilter
	TxFilter      TxFilter
	ReceiptFilter ReceiptFilter
	StateFilter   StateFilter
	StorageFilter StorageFilter
}

SubscriptionSettings config is used by a subscriber to specify what eth data to stream from the watcher

func NewEthSubscriptionConfig

func NewEthSubscriptionConfig() (*SubscriptionSettings, error)

Init is used to initialize a EthSubscription struct with env variables

type TransactionArgs

type TransactionArgs struct {
	From                 *common.Address `json:"from"`
	To                   *common.Address `json:"to"`
	Gas                  *hexutil.Uint64 `json:"gas"`
	GasPrice             *hexutil.Big    `json:"gasPrice"`
	MaxFeePerGas         *hexutil.Big    `json:"maxFeePerGas"`
	MaxPriorityFeePerGas *hexutil.Big    `json:"maxPriorityFeePerGas"`
	Value                *hexutil.Big    `json:"value"`
	Nonce                *hexutil.Uint64 `json:"nonce"`

	// We accept "data" and "input" for backwards-compatibility reasons.
	// "input" is the newer name and should be preferred by clients.
	// Issue detail: https://github.com/ethereum/go-ethereum/issues/15628
	Data  *hexutil.Bytes `json:"data"`
	Input *hexutil.Bytes `json:"input"`

	// Introduced by AccessListTxType transaction.
	AccessList *types.AccessList `json:"accessList,omitempty"`
	ChainID    *hexutil.Big      `json:"chainId,omitempty"`
}

TransactionArgs represents the arguments to construct a new transaction or a message call.

type TransactionCIDRecord

type TransactionCIDRecord struct {
	CID         string `gorm:"column:cid"`
	TxHash      string `gorm:"primaryKey"`
	BlockNumber string `gorm:"primaryKey"`
	HeaderID    string `gorm:"column:header_id"`
	Index       int64
	Src         string
	Dst         string
	MhKey       string
	IPLD        IPLDModelRecord `gorm:"foreignKey:MhKey,BlockNumber;references:Key,BlockNumber"`
}

func (TransactionCIDRecord) TableName

func (TransactionCIDRecord) TableName() string

TableName overrides the table name used by TransactionCIDRecord

type TxFilter

type TxFilter struct {
	Off bool
	Src []string
	Dst []string
}

TxFilter contains filter settings for txs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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