bitcoin

package
v24.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCfg       = errorsmod.Register(ModuleName, 1, "invalid configuration")
	ErrRpcClient        = errorsmod.Register(ModuleName, 2, "rpc client error")
	ErrBlockUnavailable = errorsmod.Register(ModuleName, 3, "block not available")
)
View Source
var ModuleName = "bitcoin-chain"

Functions

This section is empty.

Types

type ChainClient

type ChainClient struct {
	// contains filtered or unexported fields
}

func NewChainClient

func NewChainClient(
	logger log.Logger,
	btcRpc *rpcclient.Client,
	vaultAddr string,
	fetchInterval time.Duration,
	lastObservedHeight uint64,
	chainParams chaincfg.Params,
) (*ChainClient, error)

NewChainClient returns new instance of `ChainClient`

func (*ChainClient) ConfirmationsRequired

func (b *ChainClient) ConfirmationsRequired(context.Context, bridgetypes.AssetID) (uint64, error)

ConfirmationsRequired returns number of required tx confirmations

func (*ChainClient) Height

func (b *ChainClient) Height(context.Context) (uint64, error)

Height returns current height of the Bitcoin chain

func (*ChainClient) ListenOutboundTransfer

func (b *ChainClient) ListenOutboundTransfer() <-chan observer.Transfer

ListenOutboundTransfer returns receive-only channel with outbound transfer items

func (*ChainClient) SignalInboundTransfer

func (b *ChainClient) SignalInboundTransfer(context.Context, observer.Transfer) error

SignalInboundTransfer sends `InboundTransfer` to Bitcoin

func (*ChainClient) Start

func (b *ChainClient) Start(context.Context) error

Start starts observing Bitcoin blocks for outbound transfers

func (*ChainClient) Stop

func (b *ChainClient) Stop(ctx context.Context) error

Stop stops observing Bitcoin blocks and shutdowns RPC client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL