bdkwallet

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRecipient = errors.New("must have atleast one recipient")
	ErrNoBDK       = errors.New("utreexod must be built with the 'bdkwallet' tag to enable the BDK wallet")
)

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func DoesWalletDirExist

func DoesWalletDirExist(dataDir string) (bool, error)

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info.

func WalletDir

func WalletDir(dataDir string) string

Types

type Balance

type Balance struct {
	Immature         btcutil.Amount // immature coinbase balance
	TrustedPending   btcutil.Amount // unconfirmed balance that is part of our change keychain
	UntrustedPending btcutil.Amount // unconfirmed balance that is part of our public keychain
	Confirmed        btcutil.Amount // confirmed balance
}

Balance in satoshis.

func (*Balance) Total

func (b *Balance) Total() btcutil.Amount

Total is the total funds of the wallet.

func (*Balance) TrustedSpendable

func (b *Balance) TrustedSpendable() btcutil.Amount

TrustedSpendable are funds that are safe to spend.

type BlockId

type BlockId struct {
	Height uint           // block height
	Hash   chainhash.Hash // block hash
}

BlockId consists of a block height and a block hash. This identifies a block.

type Manager

type Manager struct {

	// Wallet is the underlying wallet that calls out to the
	// bdk rust library.
	Wallet Wallet // wallet does not need a mutex as it's done in Rust
	// contains filtered or unexported fields
}

Manager handles the configuration and handling data in between the utreexo node and the bdk wallet library.

func NewManager

func NewManager(config ManagerConfig) (*Manager, error)

func (*Manager) NotifyNewTransactions

func (m *Manager) NotifyNewTransactions(txns []*mempool.TxDesc)

type ManagerConfig

type ManagerConfig struct {
	Chain       *blockchain.BlockChain
	TxMemPool   *mempool.TxPool
	ChainParams *chaincfg.Params
	DataDir     string
}

ManagerConfig is a configuration struct used to

type Recipient

type Recipient struct {
	Amount  btcutil.Amount // amount to send
	Address string         // recipient address to send to (in human-readable form)
}

Recipient specifies the intended amount and destination address for a transaction output.

type TxInfo

type TxInfo struct {
	Txid          chainhash.Hash
	Tx            btcutil.Tx
	Spent         btcutil.Amount // sum of owned inputs
	Received      btcutil.Amount // sum of owned outputs
	Confirmations uint           // number of confirmations for this tx
}

TxInfo is information on a given transaction.

type UTXOInfo

type UTXOInfo struct {
	Txid            chainhash.Hash
	Vout            uint
	Amount          btcutil.Amount
	ScriptPubKey    []byte
	IsChange        bool
	DerivationIndex uint
	Confirmations   uint // number of confirmations for this utxo
}

UtxoInfo is information on a given transaction.

type Wallet

type Wallet interface {
	UnusedAddress() (uint, btcutil.Address, error)
	FreshAddress() (uint, btcutil.Address, error)
	PeekAddress(index uint32) (uint, btcutil.Address, error)
	Balance() Balance
	RecentBlocks(count uint32) []BlockId
	ApplyBlock(block *btcutil.Block) error
	ApplyMempoolTransactions(txns []*mempool.TxDesc) error
	CreateTx(feerate float32, recipients []Recipient) ([]byte, error)
	MnemonicWords() []string
	Transactions() ([]TxInfo, error)
	UTXOs() []UTXOInfo
}

Wallet tracks addresses and transactions sending/receiving to/from those addresses. The wallet is updated by incoming blocks and new mempool transactions.

type WalletFactory

type WalletFactory interface {
	Create(dbPath string, chainParams *chaincfg.Params) (Wallet, error)
	Load(dbPath string) (Wallet, error)
}

WalletFactory creates wallets.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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