descriptor

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidChecksumLength = errors.New("invalid checksum length")
)

Functions

This section is empty.

Types

type ScriptOpts

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

ScriptOpts defines options for range type of descriptor wallet

func WithIndex

func WithIndex(index uint32) *ScriptOpts

WithIndex defines exact child index for which script should be generated for range wallet descriptor

func WithRange

func WithRange(numOfScrips int) *ScriptOpts

WithRange defines how many scripts should be generated for range wallet descriptor

type ScriptResponse

type ScriptResponse struct {
	DerivationPath []uint32
	Script         []byte
}

ScriptResponse defines response for Script func

type Wallet

type Wallet interface {
	// Type returns type of descriptor wallet (e.g. wpkh, wsh etc.)
	Type() string
	// IsRange returns true if wallet description is of type range which means
	//that key expression provides master key and requires more scripts to be generated
	IsRange() bool
	// Script generates new script, or range of scripts depending on wallet description
	//it returns ScriptResponse which holds script and its derivation path in case wallet descriptor is range
	//if it isn't derivation path will be nil
	//wits ScriptOpts pkg user can specify how many scripts should be generated in case of
	//range wallet descriptor, it also can specify exact index
	Script(opts *ScriptOpts) ([]ScriptResponse, error)
}

Wallet is interface to be implemented by various descriptor wallets

func Parse

func Parse(descriptor string) (Wallet, error)

type WpkhWallet

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

func (WpkhWallet) IsRange

func (w WpkhWallet) IsRange() bool

func (WpkhWallet) Script

func (w WpkhWallet) Script(opts *ScriptOpts) ([]ScriptResponse, error)

func (WpkhWallet) Type

func (w WpkhWallet) Type() string

Jump to

Keyboard shortcuts

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