Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockchainScanner ¶
type BlockchainScanner interface {
// Start starts the service.
Start()
// Stop stops the service.
Stop()
// WatchForAccount instructs the scanner to start notifying about txs/utxos
// related to the given list of addresses belonging to the given HD account.
WatchForAccount(
accountName string, startingBlockHeight uint32,
addresses []domain.AddressInfo,
)
WatchForUtxos(
accountName string, utxos []domain.UtxoInfo,
)
// StopWatchForAccount instructs the scanner to stop notifying about
// txs/utxos related to any address belonging to the given HD account.
StopWatchForAccount(accountName string)
// GetUtxoChannel returns the channel where notification about utxos realated
// to the given HD account are sent.
GetUtxoChannel(accountName string) chan []*domain.Utxo
// GetTxChannel returns the channel where notification about txs realated to
// the given HD account are sent.
GetTxChannel(accountName string) chan *domain.Transaction
// GetLatestBlock returns the header of the latest block of the blockchain.
GetLatestBlock() ([]byte, uint32, error)
// GetBlockHash returns the hash of the block identified by its height.
GetBlockHash(height uint32) ([]byte, error)
// GetUtxos is a sync function to get info about the utxos represented by
// given outpoints (UtxoKeys).
GetUtxos(utxos []domain.Utxo) ([]domain.Utxo, error)
// BroadcastTransaction sends the given raw tx (in hex string) over the
// network in order to be included in a later block of the Liquid blockchain.
BroadcastTransaction(txHex string) (string, error)
}
BlockchainScanner is the abstraction for any kind of service representing an Elements node. It gives info about txs and utxos related to one or more HD accounts in a aync way (via channels), and lets broadcast transactions over the Liquid network.
type CoinSelector ¶
type CoinSelector interface {
// SelectUtxos implements a certain coin selection strategy.
SelectUtxos(
utxos []*domain.Utxo, targetAmount uint64, targetAsset string,
) (selectedUtxos []*domain.Utxo, change uint64, err error)
}
CoinSelector is the abstraction for any kind of service intended to return a subset of the given utxos with target asset hash, covering the target amount based on a specific strategy.
type RepoManager ¶
type RepoManager interface {
// WalletRepository returns the concrete implentation as domain interface.
WalletRepository() domain.WalletRepository
// UtxoRepository returns the concrete implentation as domain interface.
UtxoRepository() domain.UtxoRepository
// TransactionRepository returns the concrete implentation as domain interface.
TransactionRepository() domain.TransactionRepository
// RegisterHandlerForWalletEvent registers an handler function, executed
// whenever the given event type occurs.
RegisterHandlerForWalletEvent(
eventType domain.WalletEventType, handler WalletEventHandler,
)
// RegisterHandlerForUtxoEvent registers an handler function, executed
// whenever the given event type occurs.
RegisterHandlerForUtxoEvent(
eventType domain.UtxoEventType, handler UtxoEventHandler,
)
// RegisterHandlerForTxEvent registers an handler function, executed
// whenever the given event type occurs.
RegisterHandlerForTxEvent(
eventType domain.TransactionEventType, handler TxEventHandler,
)
// Close closes the connection with all concrete repositories
// implementations.
Close()
}
RepoManager is the abstraction for any kind of service intended to manage domain repositories implementations of the same concrete type.
type TxEventHandler ¶
type TxEventHandler func(event domain.TransactionEvent)
type UtxoEventHandler ¶
type WalletEventHandler ¶
type WalletEventHandler func(event domain.WalletEvent)
Click to show internal directories.
Click to hide internal directories.