Documentation ¶
Index ¶
- type BitcoinNodeDatasource
- func (d *BitcoinNodeDatasource) Fetch(ctx context.Context, from, to int64) ([]*types.Block, error)
- func (d *BitcoinNodeDatasource) FetchAsync(ctx context.Context, from, to int64, ch chan<- []*types.Block) (*subscription.ClientSubscription[[]*types.Block], error)
- func (d *BitcoinNodeDatasource) GetBlockHeader(ctx context.Context, height int64) (types.BlockHeader, error)
- func (d *BitcoinNodeDatasource) GetRawTransactionAndHeightByTxHash(ctx context.Context, txHash chainhash.Hash) (*wire.MsgTx, int64, error)
- func (d *BitcoinNodeDatasource) GetRawTransactionByTxHash(ctx context.Context, txHash chainhash.Hash) (*wire.MsgTx, error)
- func (p BitcoinNodeDatasource) Name() string
- type Datasource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitcoinNodeDatasource ¶
type BitcoinNodeDatasource struct {
// contains filtered or unexported fields
}
BitcoinNodeDatasource fetch data from Bitcoin node for Bitcoin Indexer
func NewBitcoinNode ¶
func NewBitcoinNode(btcclient *rpcclient.Client) *BitcoinNodeDatasource
NewBitcoinNode create new BitcoinNodeDatasource with Bitcoin Core RPC Client
func (*BitcoinNodeDatasource) Fetch ¶
Fetch polling blocks from Bitcoin node
- from: block height to start fetching, if -1, it will start from genesis block
- to: block height to stop fetching, if -1, it will fetch until the latest block
func (*BitcoinNodeDatasource) FetchAsync ¶
func (d *BitcoinNodeDatasource) FetchAsync(ctx context.Context, from, to int64, ch chan<- []*types.Block) (*subscription.ClientSubscription[[]*types.Block], error)
FetchAsync polling blocks from Bitcoin node asynchronously (non-blocking)
- from: block height to start fetching, if -1, it will start from genesis block
- to: block height to stop fetching, if -1, it will fetch until the latest block
func (*BitcoinNodeDatasource) GetBlockHeader ¶
func (d *BitcoinNodeDatasource) GetBlockHeader(ctx context.Context, height int64) (types.BlockHeader, error)
GetBlockHeader fetch block header from Bitcoin node
func (*BitcoinNodeDatasource) GetRawTransactionAndHeightByTxHash ¶ added in v0.2.7
func (d *BitcoinNodeDatasource) GetRawTransactionAndHeightByTxHash(ctx context.Context, txHash chainhash.Hash) (*wire.MsgTx, int64, error)
GetTransaction fetch transaction from Bitcoin node
func (*BitcoinNodeDatasource) GetRawTransactionByTxHash ¶ added in v0.4.0
func (BitcoinNodeDatasource) Name ¶
func (p BitcoinNodeDatasource) Name() string
type Datasource ¶
type Datasource[T any] interface { Name() string Fetch(ctx context.Context, from, to int64) ([]T, error) FetchAsync(ctx context.Context, from, to int64, ch chan<- []T) (*subscription.ClientSubscription[[]T], error) GetBlockHeader(ctx context.Context, height int64) (types.BlockHeader, error) }
Datasource is an interface for indexer data sources.
Click to show internal directories.
Click to hide internal directories.