Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeLeafNode(node []byte) ([]byte, error)
- func DoCall(ctx context.Context, b *Backend, args CallArgs, ...) (*core.ExecutionResult, error)
- func GetRctLeafNodeData(rcts types.Receipts) ([]cid.Cid, [][]byte, error)
- func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)
- func RPCMarshalBlockWithUncleHashes(block *types.Block, uncleHashes []common.Hash, inclTx bool, fullTx bool) (map[string]interface{}, error)
- func RPCMarshalHeader(head *types.Header) map[string]interface{}
- func ReceiptModelsContainsCID(rcts []models.ReceiptModel, cid string) bool
- func ResolveToNodeType(nodeType int) sdtypes.NodeType
- func TxModelsContainsCID(txs []models.TxModel, cid string) bool
- type AccountResult
- type Backend
- func (b *Backend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Block, error)
- func (b *Backend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, error)
- func (b *Backend) BloomStatus() (uint64, uint64)
- func (b *Backend) ChainDb() ethdb.Database
- func (b *Backend) CurrentBlock() (*types.Block, error)
- func (b *Backend) Engine() consensus.Engine
- func (b *Backend) GetAccountByHash(ctx context.Context, address common.Address, hash common.Hash) (*types.StateAccount, error)
- func (b *Backend) GetAccountByNumber(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) (*types.StateAccount, error)
- func (b *Backend) GetAccountByNumberOrHash(ctx context.Context, address common.Address, ...) (*types.StateAccount, error)
- func (b *Backend) GetCanonicalHash(number uint64) (common.Hash, error)
- func (b *Backend) GetCanonicalHeader(number uint64) (string, []byte, error)
- func (b *Backend) GetCodeByHash(ctx context.Context, address common.Address, hash common.Hash) ([]byte, error)
- func (b *Backend) GetCodeByNumber(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) ([]byte, error)
- func (b *Backend) GetCodeByNumberOrHash(ctx context.Context, address common.Address, ...) ([]byte, error)
- func (b *Backend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, ...) (*vm.EVM, func() error, error)
- func (b *Backend) GetHeader(hash common.Hash, height uint64) *types.Header
- func (b *Backend) GetHeaderByBlockHash(tx *sqlx.Tx, hash common.Hash) (*types.Header, error)
- func (b *Backend) GetLogs(ctx context.Context, hash common.Hash, number uint64) ([][]*types.Log, error)
- func (b *Backend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)
- func (b *Backend) GetReceiptsByBlockHash(tx *sqlx.Tx, hash common.Hash) (types.Receipts, error)
- func (b *Backend) GetStorageByHash(ctx context.Context, address common.Address, key, hash common.Hash) (hexutil.Bytes, error)
- func (b *Backend) GetStorageByNumber(ctx context.Context, address common.Address, key common.Hash, ...) (hexutil.Bytes, error)
- func (b *Backend) GetStorageByNumberOrHash(ctx context.Context, address common.Address, key common.Hash, ...) (hexutil.Bytes, error)
- func (b *Backend) GetTd(blockHash common.Hash) (*big.Int, error)
- func (b *Backend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error)
- func (b *Backend) GetTransactionsByBlockHash(tx *sqlx.Tx, hash common.Hash) (types.Transactions, error)
- func (b *Backend) GetUnclesByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]*types.Header, error)
- func (b *Backend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (b *Backend) HeaderByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Header, error)
- func (b *Backend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error)
- func (b *Backend) PendingBlockAndReceipts() (*types.Block, types.Receipts)
- func (b *Backend) RPCGasCap() *big.Int
- func (b *Backend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
- func (b *Backend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error)
- func (b *Backend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error)
- func (b *Backend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
- func (b *Backend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (b *Backend) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription
- func (b *Backend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (b *Backend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
- func (b *Backend) ValidateTrie(stateRoot common.Hash) error
- type CIDRetriever
- func (ecr *CIDRetriever) Retrieve(filter SubscriptionSettings, blockNumber int64) ([]CIDWrapper, bool, error)
- func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (models.HeaderModel, []models.UncleModel, []models.TxModel, ...)
- func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (models.HeaderModel, []models.UncleModel, []models.TxModel, ...)
- func (ecr *CIDRetriever) RetrieveFilteredGQLLogs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockHash *common.Hash) ([]LogResult, error)
- func (ecr *CIDRetriever) RetrieveFilteredLog(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, ...) ([]LogResult, error)
- func (ecr *CIDRetriever) RetrieveFirstBlockNumber() (int64, error)
- func (ecr *CIDRetriever) RetrieveHeaderAndTxCIDsByBlockHash(blockHash common.Hash) (HeaderCIDRecord, error)
- func (ecr *CIDRetriever) RetrieveHeaderAndTxCIDsByBlockNumber(blockNumber int64) ([]HeaderCIDRecord, error)
- func (ecr *CIDRetriever) RetrieveHeaderCIDByHash(tx *sqlx.Tx, blockHash common.Hash) (models.HeaderModel, error)
- func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]models.HeaderModel, error)
- func (ecr *CIDRetriever) RetrieveLastBlockNumber() (int64, error)
- func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, blockHash string, ...) ([]models.ReceiptModel, error)
- func (ecr *CIDRetriever) RetrieveReceiptCIDsByByHeaderIDAndTxIDs(tx *sqlx.Tx, headerID string, txHashes []string, blockNumber int64) ([]models.ReceiptModel, error)
- func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID string) ([]models.StateNodeModel, error)
- func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageFilter, headerID string) ([]models.StorageNodeWithStateKeyModel, error)
- func (ecr *CIDRetriever) RetrieveTxCIDByHash(txHash string) (TransactionCIDRecord, error)
- func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID string) ([]models.TxModel, error)
- func (ecr *CIDRetriever) RetrieveTxCIDsByHeaderID(tx *sqlx.Tx, headerID string, blockNumber int64) ([]models.TxModel, error)
- func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID string) ([]models.UncleModel, error)
- type CIDWrapper
- type CallArgs
- type Config
- type ConvertedPayload
- type Fetcher
- type FilterBackend
- type Filterer
- type HeaderCIDRecord
- type HeaderFilter
- type IPLDFetcher
- func (f *IPLDFetcher) Fetch(cids CIDWrapper) (*IPLDs, error)
- func (f *IPLDFetcher) FetchHeader(tx *sqlx.Tx, c models.HeaderModel) (models.IPLDModel, error)
- func (f *IPLDFetcher) FetchRcts(tx *sqlx.Tx, cids []models.ReceiptModel) ([]models.IPLDModel, error)
- func (f *IPLDFetcher) FetchState(tx *sqlx.Tx, cids []models.StateNodeModel) ([]StateNode, error)
- func (f *IPLDFetcher) FetchStorage(tx *sqlx.Tx, cids []models.StorageNodeWithStateKeyModel) ([]StorageNode, error)
- func (f *IPLDFetcher) FetchTrxs(tx *sqlx.Tx, cids []models.TxModel) ([]models.IPLDModel, error)
- func (f *IPLDFetcher) FetchUncles(tx *sqlx.Tx, cids []models.UncleModel) ([]models.IPLDModel, error)
- type IPLDModelRecord
- type IPLDRetriever
- func (r *IPLDRetriever) RetrieveAccountByAddressAndBlockHash(address common.Address, hash common.Hash) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveAccountByAddressAndBlockNumber(address common.Address, number uint64) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveHeaderByHash(tx *sqlx.Tx, hash common.Hash) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveHeadersByBlockNumber(number uint64) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveHeadersByHashes(hashes []common.Hash) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveReceiptByHash(hash common.Hash) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveReceiptsByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]string, [][]byte, []common.Hash, error)
- func (r *IPLDRetriever) RetrieveReceiptsByBlockNumber(number uint64) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveReceiptsByTxHashes(hashes []common.Hash) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveStorageAtByAddressAndStorageKeyAndBlockNumber(address common.Address, storageLeafKey common.Hash, number uint64) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveStorageAtByAddressAndStorageSlotAndBlockHash(address common.Address, key, hash common.Hash) (string, []byte, []byte, error)
- func (r *IPLDRetriever) RetrieveTransactionByTxHash(hash common.Hash) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveTransactionsByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveTransactionsByBlockNumber(number uint64) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveTransactionsByHashes(hashes []common.Hash) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveUncleByHash(hash common.Hash) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveUnclesByBlockHash(tx *sqlx.Tx, hash common.Hash) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveUnclesByBlockNumber(number uint64) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveUnclesByHashes(hashes []common.Hash) ([]string, [][]byte, error)
- type IPLDs
- type LogResult
- type OverrideAccount
- type PublicEthAPI
- func (pea *PublicEthAPI) BlockNumber() hexutil.Uint64
- func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, ...) (hexutil.Bytes, error)
- func (pea *PublicEthAPI) ChainId() *hexutil.Big
- func (pea *PublicEthAPI) GetBalance(ctx context.Context, address common.Address, ...) (*hexutil.Big, error)
- func (pea *PublicEthAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (pea *PublicEthAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (pea *PublicEthAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (pea *PublicEthAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- func (pea *PublicEthAPI) GetCode(ctx context.Context, address common.Address, ...) (hexutil.Bytes, error)
- func (pea *PublicEthAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{}
- func (pea *PublicEthAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
- func (pea *PublicEthAPI) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([]*types.Log, error)
- func (pea *PublicEthAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, ...) (*AccountResult, error)
- func (pea *PublicEthAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
- func (pea *PublicEthAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
- func (pea *PublicEthAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (pea *PublicEthAPI) GetStorageAt(ctx context.Context, address common.Address, key string, ...) (hexutil.Bytes, error)
- func (pea *PublicEthAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
- func (pea *PublicEthAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
- func (pea *PublicEthAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
- func (pea *PublicEthAPI) GetTransactionCount(ctx context.Context, address common.Address, ...) (*hexutil.Uint64, error)
- func (pea *PublicEthAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (pea *PublicEthAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
- func (pea *PublicEthAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
- func (pea *PublicEthAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (pea *PublicEthAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- type RPCReceipt
- type RPCTransaction
- type ReceiptFilter
- type ResponseFilterer
- type Retriever
- type StateFilter
- type StateNode
- type StateOverride
- type StorageFilter
- type StorageNode
- type StorageResult
- type SubscriptionSettings
- type TransactionCIDRecord
- type TxFilter
Constants ¶
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` )
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 */ 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 */ 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 */ 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 = `` /* 869-byte string literal not displayed */ RetrieveStorageLeafByAddressHashAndLeafKeyAndBlockHashPgStr = `` /* 1105-byte string literal not displayed */ )
const APIName = "eth"
APIName is the namespace for the watcher's eth api
const APIVersion = "0.0.1"
APIVersion is the version of the watcher's eth api
const (
StateDBGroupCacheName = "statedb"
)
Variables ¶
var EmptyNodeValue = make([]byte, common.HashLength)
Functions ¶
func DecodeLeafNode ¶
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 ¶
GetRctLeafNodeData converts the receipts to receipt trie and returns the receipt leaf node IPLD data and corresponding CIDs
func RPCMarshalBlock ¶
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 ¶
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 ResolveToNodeType ¶
Types ¶
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 (*Backend) BlockByHash ¶
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 (*Backend) CurrentBlock ¶
CurrentBlock returns the current block
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) GetCanonicalHash ¶
GetCanonicalHash gets the canonical hash for the provided number, if there is one
func (*Backend) GetCanonicalHeader ¶
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) GetHeaderByBlockHash ¶
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 ¶
GetReceipts retrieves receipts for provided block hash
func (*Backend) GetReceiptsByBlockHash ¶
GetReceiptsByBlockHash retrieves receipts for a provided block hash
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) 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) GetUnclesByBlockHash ¶
GetUnclesByBlockHash retrieves uncles for a provided block hash
func (*Backend) HeaderByHash ¶
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 (*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
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) ([]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) (HeaderCIDRecord, error)
RetrieveHeaderAndTxCIDsByBlockHash retrieves header CID and their associated tx CIDs by block hash
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) (TransactionCIDRecord, error)
RetrieveTxCIDByHash returns the tx for the given tx hash
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.
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 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 ¶
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) FetchUncles ¶
func (f *IPLDFetcher) FetchUncles(tx *sqlx.Tx, cids []models.UncleModel) ([]models.IPLDModel, error)
FetchUncles fetches uncles
type IPLDModelRecord ¶
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 ¶
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 ¶
RetrieveHeadersByHashes returns the cids and rlp bytes for the headers corresponding to the provided block hashes
func (*IPLDRetriever) RetrieveReceiptByHash ¶
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) 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 ¶
RetrieveTransactionByTxHash returns the cid and rlp bytes for the transaction corresponding to the provided tx hash
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 ¶
RetrieveUncleByHash returns the cid and rlp bytes for the uncle corresponding to the provided uncle hash
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 ¶
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, supportsStateDiff, forwardEthCalls, proxyOnError bool) (*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) 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.
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) 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
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 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 StateOverride ¶
type StateOverride map[common.Address]OverrideAccount
StateOverride is the collection of overridden accounts.
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 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 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