bronwallet

package
v0.0.0-...-4461705 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const Subsystem = "BTWL"

Subsystem defines the logging code for this subsystem.

View Source
const (

	// UnconfirmedHeight is the special case end height that is used to
	// obtain unconfirmed transactions from ListTransactionDetails.
	UnconfirmedHeight int32 = -1
)

Variables

View Source
var (
	// ErrOutputSpent is returned by the GetUtxo method if the target output
	// for lookup has already been spent.
	ErrOutputSpent = errors.New("target output has been spent")

	// ErrOutputNotFound signals that the desired output could not be
	// located.
	ErrOutputNotFound = errors.New("target output was not found")
)
View Source
var (
	// PsbtKeyTypeInputSignatureTweakSingle is a custom/proprietary PSBT key
	// for an input that specifies what single tweak should be applied to
	// the key before signing the input. The value 51 is leet speak for
	// "si", short for "single".
	PsbtKeyTypeInputSignatureTweakSingle = []byte{0x51}

	// PsbtKeyTypeInputSignatureTweakDouble is a custom/proprietary PSBT key
	// for an input that specifies what double tweak should be applied to
	// the key before signing the input. The value d0 is leet speak for
	// "do", short for "double".
	PsbtKeyTypeInputSignatureTweakDouble = []byte{0xd0}
)

Functions

func DisableLog

func DisableLog()

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

func NetworkDir

func NetworkDir(dataDir string, chainParams *chaincfg.Params) string

NetworkDir returns the directory name of a network directory to hold wallet files.

func New

func New(cfg Config, blockCache *blockcache.BlockCache) (*bronwallet, error)

New returns a new fully initialized instance of bronwallet given a valid configuration struct.

func NewWalletLoader

func NewWalletLoader(chainParams *chaincfg.Params, recoveryWindow uint32,
	opts ...LoaderOption) (*wallet.Loader, error)

NewWalletLoader constructs a wallet loader.

func UseLogger

func UseLogger(logger bronlog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using bronlog.

Types

type Config

type Config struct {
	// LogDir is the name of the directory which should be used to store
	// generated log files.
	LogDir string

	// PrivatePass is the private password to the underlying bronwallet
	// instance. Without this, the wallet cannot be decrypted and operated.
	PrivatePass []byte

	// PublicPass is the optional public password to bronwallet. This is
	// optionally used to encrypt public material such as public keys and
	// scripts.
	PublicPass []byte

	// HdSeed is an optional seed to feed into the wallet. If this is
	// unspecified, a new seed will be generated.
	HdSeed []byte

	// Birthday specifies the time at which this wallet was initially
	// created. It is used to bound rescans for used addresses.
	Birthday time.Time

	// RecoveryWindow specifies the address look-ahead for which to scan
	// when restoring a wallet. The recovery window will apply to all
	// default BIP44 derivation paths.
	RecoveryWindow uint32

	// ChainSource is the primary chain interface. This is used to operate
	// the wallet and do things such as rescanning, sending transactions,
	// notifications for received funds, etc.
	ChainSource chain.Interface

	// NetParams is the net parameters for the target chain.
	NetParams *chaincfg.Params

	// CoinType specifies the BIP 44 coin type to be used for derivation.
	CoinType uint32

	// Wallet is an unlocked wallet instance that is set if the
	// UnlockerService has already opened and unlocked the wallet. If this
	// is nil, then a wallet might have just been created or is simply not
	// encrypted at all, in which case it should be attempted to be loaded
	// normally when creating the bronwallet.
	Wallet *wallet.Wallet

	// LoaderOptions holds functional wallet db loader options.
	LoaderOptions []LoaderOption

	// CoinSelectionStrategy is the strategy that is used for selecting
	// coins when funding a transaction.
	CoinSelectionStrategy wallet.CoinSelectionStrategy

	// WatchOnly indicates that the wallet was initialized with public key
	// material only and does not contain any private keys.
	WatchOnly bool

	// MigrateWatchOnly indicates that if a wallet with private key material
	// already exists, it should be attempted to be converted into a
	// watch-only wallet on first startup. This flag has no effect if no
	// wallet exists and a watch-only one is created directly, or, if the
	// wallet was previously converted to a watch-only already.
	MigrateWatchOnly bool
}

Config is a struct which houses configuration parameters which modify the instance of bronwallet generated by the New() function.

type LoaderOption

type LoaderOption func(*loaderCfg)

LoaderOption is a functional option to update the optional loader config.

func LoaderWithExternalWalletDB

func LoaderWithExternalWalletDB(db kvdb.Backend) LoaderOption

LoaderWithExternalWalletDB configures the wallet loadr to use an external db.

func LoaderWithLocalWalletDB

func LoaderWithLocalWalletDB(dbDirPath string, noFreelistSync bool,
	dbTimeout time.Duration) LoaderOption

LoaderWithLocalWalletDB configures the wallet loader to use the local db.

Jump to

Keyboard shortcuts

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