Documentation ¶
Index ¶
- type ChainFetch
- func (cf *ChainFetch) FetchABlock(blockNumber *big.Int) (*types.BLockDetail, error)
- func (cf *ChainFetch) GetLatestBlock() (*big.Int, error)
- func (cf *ChainFetch) IpcUpdated()
- func (cf *ChainFetch) RealtimeFetch(ch chan<- *types.BLockDetail)
- func (cf *ChainFetch) TransactionByHash(txHash string) (*types.TransactionExtra, error)
- type EthClient
- type Fetch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainFetch ¶
type ChainFetch struct { Client EthClient // contains filtered or unexported fields }
ChainFetch the real implementation
func NewChainFetch ¶
func NewChainFetch() (*ChainFetch, error)
NewChainFetch new ChainFetch instance
func (*ChainFetch) FetchABlock ¶
func (cf *ChainFetch) FetchABlock(blockNumber *big.Int) (*types.BLockDetail, error)
FetchABlock fetch a block by block number
func (*ChainFetch) GetLatestBlock ¶
func (cf *ChainFetch) GetLatestBlock() (*big.Int, error)
GetLatestBlock get latest known block by geth node
func (*ChainFetch) IpcUpdated ¶
func (cf *ChainFetch) IpcUpdated()
IpcUpdated no need to implement IpcSubscriber interface Let indexer update me
func (*ChainFetch) RealtimeFetch ¶
func (cf *ChainFetch) RealtimeFetch(ch chan<- *types.BLockDetail)
RealtimeFetch fetch data from blockchain
func (*ChainFetch) TransactionByHash ¶
func (cf *ChainFetch) TransactionByHash(txHash string) (*types.TransactionExtra, error)
TransactionByHash query geth node to get addtional data of tx
type EthClient ¶
type EthClient interface { SubscribeNewHead(ctx context.Context, ch chan<- *gethtypes.Header) (ethereum.Subscription, error) BlockByNumber(ctx context.Context, number *big.Int) (*gethtypes.Block, error) TransactionSender(ctx context.Context, tx *gethtypes.Transaction, block common.Hash, index uint) (common.Address, error) HeaderByNumber(ctx context.Context, number *big.Int) (*gethtypes.Header, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*gethtypes.Receipt, error) TransactionByHash(ctx context.Context, hash common.Hash) (*gethtypes.Transaction, bool, error) Close() }
EthClient the Client of geth
Click to show internal directories.
Click to hide internal directories.