recovery

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBitcoinTransaction

func BuildBitcoinTransaction(
	ctx context.Context,
	networkProvider net.Provider,
	hostChain chain.Handle,
	fundingInfo *chain.FundingInfo,
	signer *tss.ThresholdSigner,
	chainParams *chaincfg.Params,
	retrievalAddresses []string,
	maxFeePerVByte int32,
) (string, error)

BuildBitcoinTransaction generates a signed transaction hex string that can recover an underlying bitcoin deposit that has been liquidated.

func ResolveAddress

func ResolveAddress(
	beneficiaryAddress string,
	storage *DerivationIndexStorage,
	chainParams *chaincfg.Params,
	handle bitcoin.Handle,
	isDryRun bool,
) (string, error)

ResolveAddress resolves a configured beneficiaryAddress into a valid bitcoin address. If the supplied address is already a valid bitcoin address, we don't have to do anything. If the supplied address is an extended public key of a HD wallet, attempt to derive the bitcoin address at the specified index. The function will store an index of the last resolved bitcoin address unless it is a dry run.

The function does not validate inputs. It is expected that validations are performed before calling this function. Especially the beneficiary address should be validated with the given chain network type.

Types

type DerivationIndexStorage

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

DerivationIndexStorage provides access to the derivation index persistence API, which makes sure we're not reusing derived wallet addresses.

func NewDerivationIndexStorage

func NewDerivationIndexStorage(path string) (*DerivationIndexStorage, error)

NewDerivationIndexStorage is a factory method that creates a new DerivationIndexStorage at the specified path.

func (*DerivationIndexStorage) GetNextAddress

func (dis *DerivationIndexStorage) GetNextAddress(
	extendedPublicKey string,
	handle bitcoin.Handle,
	chainParams *chaincfg.Params,
	isDryRun bool,
) (string, error)

GetNextAddress returns the next unused btc address for the extended public key

Jump to

Keyboard shortcuts

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