swaps

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateWitnessScriptSubmarineSwapV1

func CreateWitnessScriptSubmarineSwapV1(refundAddress string, paymentHash []byte, swapServerPubKey []byte, lockTime int64, network *chaincfg.Params) ([]byte, error)

func CreateWitnessScriptSubmarineSwapV2

func CreateWitnessScriptSubmarineSwapV2(paymentHash, userPubKey, muunPubKey, swapServerPubKey []byte, blocksForExpiration int64) ([]byte, error)

Types

type KeyDescriptor

type KeyDescriptor struct {
	Key  *hdkeychain.ExtendedKey
	Path string
}

func (*KeyDescriptor) DeriveTo

func (d *KeyDescriptor) DeriveTo(path string) (*hdkeychain.ExtendedKey, error)

type SubmarineSwap

type SubmarineSwap struct {
	Invoice       string
	Receiver      SubmarineSwapReceiver
	FundingOutput SubmarineSwapFundingOutput
	PreimageInHex string
}

func (*SubmarineSwap) Validate

func (swap *SubmarineSwap) Validate(
	rawInvoice string,
	userPublicKey *KeyDescriptor,
	muunPublicKey *KeyDescriptor,
	originalExpirationInBlocks int64,
	network *chaincfg.Params,
) error

type SubmarineSwapFundingOutput

type SubmarineSwapFundingOutput struct {
	ScriptVersion          int64
	OutputAddress          string
	OutputAmount           int64
	ConfirmationsNeeded    int
	ServerPaymentHashInHex string
	ServerPublicKeyInHex   string

	UserLockTime int64 // TODO: not checked in v2?

	// v1 only
	UserRefundAddress *addresses.WalletAddress

	// v2 only
	ExpirationInBlocks int64
	UserPublicKey      *hdkeychain.ExtendedKey
	MuunPublicKey      *hdkeychain.ExtendedKey
	KeyPath            string
}

type SubmarineSwapReceiver

type SubmarineSwapReceiver struct {
	Alias     string
	PublicKey string
}

Jump to

Keyboard shortcuts

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