Documentation
¶
Index ¶
- Constants
- func ChainConfig(chainID uint64) (*params.ChainConfig, error)
- func DoCall(ctx context.Context, b *Backend, args CallArgs, ...) ([]byte, uint64, bool, error)
- func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)
- func RPCMarshalHeader(head *types.Header) map[string]interface{}
- func ReceiptModelsContainsCID(rcts []eth.ReceiptModel, cid string) bool
- func ResolveToNodeType(nodeType int) statediff.NodeType
- func TearDownDB(db *postgres.DB)
- func TxModelsContainsCID(txs []eth.TxModel, cid string) bool
- 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) Engine() consensus.Engine
- func (b *Backend) GetCanonicalHash(number uint64) common.Hash
- func (b *Backend) GetCanonicalHeader(number uint64) (string, []byte, error)
- func (b *Backend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, ...) (*vm.EVM, error)
- func (b *Backend) GetHeader(hash common.Hash, height uint64) *types.Header
- func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, 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) 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) 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)
- type CIDRetriever
- func (ecr *CIDRetriever) Retrieve(filter SubscriptionSettings, blockNumber int64) ([]CIDWrapper, bool, error)
- func (ecr *CIDRetriever) RetrieveBlockByHash(blockHash common.Hash) (eth.HeaderModel, []eth.UncleModel, []eth.TxModel, []eth.ReceiptModel, error)
- func (ecr *CIDRetriever) RetrieveBlockByNumber(blockNumber int64) (eth.HeaderModel, []eth.UncleModel, []eth.TxModel, []eth.ReceiptModel, error)
- func (ecr *CIDRetriever) RetrieveFirstBlockNumber() (int64, error)
- func (ecr *CIDRetriever) RetrieveHeaderCIDByHash(tx *sqlx.Tx, blockHash common.Hash) (eth.HeaderModel, error)
- func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]eth.HeaderModel, error)
- func (ecr *CIDRetriever) RetrieveLastBlockNumber() (int64, error)
- func (ecr *CIDRetriever) RetrieveRctCIDs(tx *sqlx.Tx, rctFilter ReceiptFilter, blockNumber int64, ...) ([]eth.ReceiptModel, error)
- func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter ReceiptFilter, headerID int64, trxIds []int64) ([]eth.ReceiptModel, error)
- func (ecr *CIDRetriever) RetrieveReceiptCIDsByTxIDs(tx *sqlx.Tx, txIDs []int64) ([]eth.ReceiptModel, error)
- func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID int64) ([]eth.StateNodeModel, error)
- func (ecr *CIDRetriever) RetrieveStorageCIDs(tx *sqlx.Tx, storageFilter StorageFilter, headerID int64) ([]eth.StorageNodeWithStateKeyModel, error)
- func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID int64) ([]eth.TxModel, error)
- func (ecr *CIDRetriever) RetrieveTxCIDsByHeaderID(tx *sqlx.Tx, headerID int64) ([]eth.TxModel, error)
- func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID int64) ([]eth.UncleModel, error)
- type CIDWrapper
- type CallArgs
- type Config
- type Fetcher
- type Filterer
- type HeaderFilter
- type IPLDFetcher
- func (f *IPLDFetcher) Fetch(cids CIDWrapper) (*IPLDs, error)
- func (f *IPLDFetcher) FetchHeader(tx *sqlx.Tx, c eth.HeaderModel) (ipfs.BlockModel, error)
- func (f *IPLDFetcher) FetchRcts(tx *sqlx.Tx, cids []eth.ReceiptModel) ([]ipfs.BlockModel, error)
- func (f *IPLDFetcher) FetchState(tx *sqlx.Tx, cids []eth.StateNodeModel) ([]StateNode, error)
- func (f *IPLDFetcher) FetchStorage(tx *sqlx.Tx, cids []eth.StorageNodeWithStateKeyModel) ([]StorageNode, error)
- func (f *IPLDFetcher) FetchTrxs(tx *sqlx.Tx, cids []eth.TxModel) ([]ipfs.BlockModel, error)
- func (f *IPLDFetcher) FetchUncles(tx *sqlx.Tx, cids []eth.UncleModel) ([]ipfs.BlockModel, error)
- 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(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(hash common.Hash) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveReceiptsByBlockNumber(number uint64) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveReceiptsByTxHashes(hashes []common.Hash) ([]string, [][]byte, error)
- func (r *IPLDRetriever) RetrieveTransactionByTxHash(hash common.Hash) (string, []byte, error)
- func (r *IPLDRetriever) RetrieveTransactionsByBlockHash(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(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 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) 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) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
- func (pea *PublicEthAPI) GetLogs(ctx context.Context, crit ethereum.FilterQuery) ([]*types.Log, error)
- func (pea *PublicEthAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
- type RPCTransaction
- type ReceiptFilter
- type ResponseFilterer
- type Retriever
- type StateFilter
- type StateNode
- type StorageFilter
- type StorageNode
- type SubscriptionSettings
- type TxFilter
Constants ¶
const ( RetrieveCanonicalBlockHashByNumber = `` /* 159-byte string literal not displayed */ RetrieveCanonicalHeaderByNumber = `` /* 158-byte string literal not displayed */ )
const ( RetrieveHeadersByHashesPgStr = `` /* 158-byte string literal not displayed */ RetrieveHeadersByBlockNumberPgStr = `` /* 140-byte string literal not displayed */ RetrieveHeaderByHashPgStr = `` /* 138-byte string literal not displayed */ RetrieveUnclesByHashesPgStr = `` /* 155-byte string literal not displayed */ RetrieveUnclesByBlockHashPgStr = `` /* 197-byte string literal not displayed */ RetrieveUnclesByBlockNumberPgStr = `` /* 199-byte string literal not displayed */ RetrieveUncleByHashPgStr = `` /* 135-byte string literal not displayed */ RetrieveTransactionsByHashesPgStr = `` /* 166-byte string literal not displayed */ RetrieveTransactionsByBlockHashPgStr = `` /* 218-byte string literal not displayed */ RetrieveTransactionsByBlockNumberPgStr = `` /* 220-byte string literal not displayed */ RetrieveTransactionByHashPgStr = `` /* 146-byte string literal not displayed */ RetrieveReceiptsByTxHashesPgStr = `` /* 223-byte string literal not displayed */ RetrieveReceiptsByBlockHashPgStr = `` /* 284-byte string literal not displayed */ RetrieveReceiptsByBlockNumberPgStr = `` /* 286-byte string literal not displayed */ RetrieveReceiptByTxHashPgStr = `` /* 206-byte string literal not displayed */ RetrieveAccountByLeafKeyAndBlockHashPgStr = `` /* 239-byte string literal not displayed */ RetrieveAccountByLeafKeyAndBlockNumberPgStr = `` /* 241-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
Variables ¶
This section is empty.
Functions ¶
func ChainConfig ¶
func ChainConfig(chainID uint64) (*params.ChainConfig, error)
ChainConfig returns the appropriate ethereum chain config for the provided chain id
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 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 []eth.ReceiptModel, cid string) bool
ListContainsBytes used to check if a list of byte arrays contains a particular byte array
func ResolveToNodeType ¶
func TearDownDB ¶
TearDownDB is used to tear down the watcher dbs after tests
Types ¶
type Backend ¶
type Backend struct {
// underlying postgres db
DB *postgres.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. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*Backend) BlockByNumber ¶
func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Block, error)
BlockByNumber returns the requested canonical block.
func (*Backend) GetCanonicalHash ¶ added in v0.3.9
GetCanonicalHash gets the canonical hash for the provided number, if there is one
func (*Backend) GetCanonicalHeader ¶ added in v0.3.9
GetCanonicalHeader gets the canonical header for the provided number, if there is one
func (*Backend) GetEVM ¶ added in v0.3.9
func (b *Backend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header) (*vm.EVM, error)
GetEVM constructs and returns a vm.EVM
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) HeaderByHash ¶ added in v0.3.9
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) StateAndHeaderByNumber ¶ added in v0.3.9
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 ¶ added in v0.3.9
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
type CIDRetriever ¶
type CIDRetriever struct {
// contains filtered or unexported fields
}
CIDRetriever satisfies the CIDRetriever interface for ethereum
func NewCIDRetriever ¶
func NewCIDRetriever(db *postgres.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) (eth.HeaderModel, []eth.UncleModel, []eth.TxModel, []eth.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) (eth.HeaderModel, []eth.UncleModel, []eth.TxModel, []eth.ReceiptModel, error)
RetrieveBlockByNumber returns all of the CIDs needed to compose an entire block, for a given block number
func (*CIDRetriever) RetrieveFirstBlockNumber ¶
func (ecr *CIDRetriever) RetrieveFirstBlockNumber() (int64, error)
RetrieveFirstBlockNumber is used to retrieve the first block number in the db
func (*CIDRetriever) RetrieveHeaderCIDByHash ¶
func (ecr *CIDRetriever) RetrieveHeaderCIDByHash(tx *sqlx.Tx, blockHash common.Hash) (eth.HeaderModel, error)
RetrieveHeaderCIDByHash returns the header for the given block hash
func (*CIDRetriever) RetrieveHeaderCIDs ¶
func (ecr *CIDRetriever) RetrieveHeaderCIDs(tx *sqlx.Tx, blockNumber int64) ([]eth.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 *common.Hash, trxIds []int64) ([]eth.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) RetrieveRctCIDsByHeaderID ¶
func (ecr *CIDRetriever) RetrieveRctCIDsByHeaderID(tx *sqlx.Tx, rctFilter ReceiptFilter, headerID int64, trxIds []int64) ([]eth.ReceiptModel, error)
RetrieveRctCIDsByHeaderID retrieves and returns all of the rct cids at the provided header ID that conform to the provided filter parameters and correspond to the provided tx ids
func (*CIDRetriever) RetrieveReceiptCIDsByTxIDs ¶
func (ecr *CIDRetriever) RetrieveReceiptCIDsByTxIDs(tx *sqlx.Tx, txIDs []int64) ([]eth.ReceiptModel, error)
RetrieveReceiptCIDsByTxIDs retrieves receipt CIDs by their associated tx IDs
func (*CIDRetriever) RetrieveStateCIDs ¶
func (ecr *CIDRetriever) RetrieveStateCIDs(tx *sqlx.Tx, stateFilter StateFilter, headerID int64) ([]eth.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 int64) ([]eth.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) RetrieveTxCIDs ¶
func (ecr *CIDRetriever) RetrieveTxCIDs(tx *sqlx.Tx, txFilter TxFilter, headerID int64) ([]eth.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 int64) ([]eth.TxModel, error)
RetrieveTxCIDsByHeaderID retrieves all tx CIDs for the given header id
func (*CIDRetriever) RetrieveUncleCIDsByHeaderID ¶
func (ecr *CIDRetriever) RetrieveUncleCIDsByHeaderID(tx *sqlx.Tx, headerID int64) ([]eth.UncleModel, error)
RetrieveUncleCIDsByHeaderID retrieves and returns all of the uncle cids for the provided header
type CIDWrapper ¶ added in v0.3.9
type CIDWrapper struct {
BlockNumber *big.Int
Header eth.HeaderModel
Uncles []eth.UncleModel
Transactions []eth.TxModel
Receipts []eth.ReceiptModel
StateNodes []eth.StateNodeModel
StorageNodes []eth.StorageNodeWithStateKeyModel
}
CIDWrapper is used to direct fetching of IPLDs from IPFS Returned by CIDRetriever Passed to IPLDFetcher
type CallArgs ¶ added in v0.3.9
type CallArgs struct {
From *common.Address `json:"from"`
To *common.Address `json:"to"`
Gas *hexutil.Uint64 `json:"gas"`
GasPrice *hexutil.Big `json:"gasPrice"`
Value *hexutil.Big `json:"value"`
Data *hexutil.Bytes `json:"data"`
}
CallArgs represents the arguments for a call.
type Fetcher ¶
type Fetcher interface {
Fetch(cids CIDWrapper) (*IPLDs, error)
}
Fetcher interface for substituting mocks in tests
type Filterer ¶
type Filterer interface {
Filter(filter SubscriptionSettings, payload eth.ConvertedPayload) (*IPLDs, error)
}
Filterer interface for substituing mocks in tests
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 *postgres.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 eth.HeaderModel) (ipfs.BlockModel, error)
FetchHeaders fetches headers
func (*IPLDFetcher) FetchRcts ¶
func (f *IPLDFetcher) FetchRcts(tx *sqlx.Tx, cids []eth.ReceiptModel) ([]ipfs.BlockModel, error)
FetchRcts fetches receipts
func (*IPLDFetcher) FetchState ¶
func (f *IPLDFetcher) FetchState(tx *sqlx.Tx, cids []eth.StateNodeModel) ([]StateNode, error)
FetchState fetches state nodes
func (*IPLDFetcher) FetchStorage ¶
func (f *IPLDFetcher) FetchStorage(tx *sqlx.Tx, cids []eth.StorageNodeWithStateKeyModel) ([]StorageNode, error)
FetchStorage fetches storage nodes
func (*IPLDFetcher) FetchTrxs ¶
func (f *IPLDFetcher) FetchTrxs(tx *sqlx.Tx, cids []eth.TxModel) ([]ipfs.BlockModel, error)
FetchTrxs fetches transactions
func (*IPLDFetcher) FetchUncles ¶
func (f *IPLDFetcher) FetchUncles(tx *sqlx.Tx, cids []eth.UncleModel) ([]ipfs.BlockModel, error)
FetchUncles fetches uncles
type IPLDRetriever ¶ added in v0.3.9
type IPLDRetriever struct {
// contains filtered or unexported fields
}
func NewIPLDRetriever ¶ added in v0.3.9
func NewIPLDRetriever(db *postgres.DB) *IPLDRetriever
func (*IPLDRetriever) RetrieveAccountByAddressAndBlockHash ¶ added in v0.3.9
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
func (*IPLDRetriever) RetrieveAccountByAddressAndBlockNumber ¶ added in v0.3.9
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 multiple results if we have two versions of state in the database as the provided height
func (*IPLDRetriever) RetrieveHeaderByHash ¶ added in v0.3.9
RetrieveHeaderByHash returns the cid and rlp bytes for the header corresponding to the provided block hash
func (*IPLDRetriever) RetrieveHeadersByBlockNumber ¶ added in v0.3.9
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 ¶ added in v0.3.9
RetrieveHeadersByHashes returns the cids and rlp bytes for the headers corresponding to the provided block hashes
func (*IPLDRetriever) RetrieveReceiptByHash ¶ added in v0.3.9
RetrieveReceiptByHash returns the cid and rlp bytes for the receipt corresponding to the provided tx hash
func (*IPLDRetriever) RetrieveReceiptsByBlockHash ¶ added in v0.3.9
RetrieveReceiptsByBlockHash returns the cids and rlp bytes for the receipts corresponding to the provided block hash
func (*IPLDRetriever) RetrieveReceiptsByBlockNumber ¶ added in v0.3.9
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
func (*IPLDRetriever) RetrieveReceiptsByTxHashes ¶ added in v0.3.9
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) RetrieveTransactionByTxHash ¶ added in v0.3.9
RetrieveTransactionByTxHash returns the cid and rlp bytes for the transaction corresponding to the provided tx hash
func (*IPLDRetriever) RetrieveTransactionsByBlockHash ¶ added in v0.3.9
func (r *IPLDRetriever) RetrieveTransactionsByBlockHash(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 ¶ added in v0.3.9
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 ¶ added in v0.3.9
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 ¶ added in v0.3.9
RetrieveUncleByHash returns the cid and rlp bytes for the uncle corresponding to the provided uncle hash
func (*IPLDRetriever) RetrieveUnclesByBlockHash ¶ added in v0.3.9
RetrieveUnclesByBlockHash returns the cids and rlp bytes for the uncles corresponding to the provided block hash (of non-omner root block)
func (*IPLDRetriever) RetrieveUnclesByBlockNumber ¶ added in v0.3.9
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 ¶ added in v0.3.9
RetrieveUnclesByHashes returns the cids and rlp bytes for the uncles corresponding to the provided uncle hashes
type IPLDs ¶ added in v0.3.9
type IPLDs struct {
BlockNumber *big.Int
TotalDifficulty *big.Int
Header ipfs.BlockModel
Uncles []ipfs.BlockModel
Transactions []ipfs.BlockModel
Receipts []ipfs.BlockModel
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 PublicEthAPI ¶
type PublicEthAPI struct {
B *Backend
}
func NewPublicEthAPI ¶
func NewPublicEthAPI(b *Backend) *PublicEthAPI
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 ¶ added in v0.3.9
func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *map[common.Address]account) (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) 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) 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 ethereum.FilterQuery) ([]*types.Log, error)
GetLogs returns logs matching the given argument that are stored within the state.
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
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"`
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"`
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) *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 eth.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 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 ¶ added in v0.3.9
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