urtypes

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Unlicense Imports: 10 Imported by: 0

Documentation

Overview

Package urtypes implements decoders for UR types specified in BCR-2020-006.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(typ string, enc []byte) (any, error)

Types

type Derivation

type Derivation struct {
	Type DerivationType
	// Index is the child index, without the hardening offset.
	// For RangeDerivations, Index is the start of the range.
	Index    uint32
	Hardened bool
	// End represents the end of a RangeDerivation.
	End uint32
}

type DerivationType

type DerivationType int
const (
	ChildDerivation DerivationType = iota
	WildcardDerivation
	RangeDerivation
)

type KeyDescriptor

type KeyDescriptor struct {
	Network           *chaincfg.Params
	MasterFingerprint uint32
	DerivationPath    Path
	Children          []Derivation
	KeyData           []byte
	ChainCode         []byte
	ParentFingerprint uint32
}

func (KeyDescriptor) Encode

func (k KeyDescriptor) Encode() []byte

Encode the key in the format described by BCR-2020-007.

func (KeyDescriptor) ExtendedKey added in v0.12.0

func (k KeyDescriptor) ExtendedKey() *hdkeychain.ExtendedKey

func (KeyDescriptor) String

func (k KeyDescriptor) String() string

type MultisigType added in v0.10.0

type MultisigType int
const (
	Singlesig MultisigType = iota
	SortedMulti
)

type OutputDescriptor

type OutputDescriptor struct {
	Title     string
	Script    Script
	Threshold int
	Type      MultisigType
	Keys      []KeyDescriptor
}

func (OutputDescriptor) Encode

func (o OutputDescriptor) Encode() []byte

Encode the output descriptor in the format described by BCR-2020-010.

type Path

type Path []uint32

func (Path) String

func (p Path) String() string

type Script

type Script int
const (
	UnknownScript Script = iota
	P2SH
	P2SH_P2WSH
	P2SH_P2WPKH
	P2PKH
	P2WSH
	P2WPKH
	P2TR
)

func (Script) DerivationPath added in v1.1.0

func (s Script) DerivationPath() Path

DerivationPath returns the standard derivation path for the script. It panics if the script is unknown.

func (Script) Singlesig added in v1.1.0

func (s Script) Singlesig() bool

Singlesig reports whether the script is for single-sig.

func (Script) String

func (s Script) String() string

Jump to

Keyboard shortcuts

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