swap

package
v0.0.0-...-1f13820 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicSwapContractPushes

type AtomicSwapContractPushes struct {
	ContractAddress   btcutil.Address `json:"contract_address"`
	RecipientAddress  btcutil.Address `json:"recipient_address"`
	RefundAddress     btcutil.Address `json:"refund_address"`
	Locktime          int64           `json:"locktime"`
	SecretHash        [32]byte        `json:"secret_hash"`
	FormattedLocktime string          `json:"formatted_locktime"`
}

AtomicSwapContractPushes models the data pushes of an atomic swap contract.

func ExtractSwapDataFromWitness

func ExtractSwapDataFromWitness(wit wire.TxWitness, params *chaincfg.Params) (*AtomicSwapContractPushes, []byte, []byte, bool, error)

func ParseAtomicSwapContract

func ParseAtomicSwapContract(script []byte, params *chaincfg.Params) (*AtomicSwapContractPushes, error)

ParseAtomicSwapContract checks if the provided script is an atomic swap contact and returns the data pushes of the contract.

type AtomicSwapData

type AtomicSwapData struct {
	ContractTx       *chainhash.Hash
	ContractVout     uint32
	SpendTx          *chainhash.Hash
	SpendVin         uint32
	Value            int64
	ContractAddress  string
	RecipientAddress string
	RefundAddress    string
	Locktime         int64
	SecretHash       [32]byte
	Secret           []byte
	Contract         []byte
	IsRefund         bool
}

type OutputSpender

type OutputSpender struct {
	Tx         *btcjson.TxRawResult
	InputIndex uint32
}

OutputSpender describes a transaction input that spends an output by specifying the spending transaction and the index of the spending input.

type OutputSpenderTxOut

type OutputSpenderTxOut struct {
	Tx  *wire.MsgTx
	Vin uint32
}

type TxSwapResults

type TxSwapResults struct {
	TxID        chainhash.Hash
	Found       string
	Contracts   map[uint32]*AtomicSwapData
	Redemptions map[uint32]*AtomicSwapData
	Refunds     map[uint32]*AtomicSwapData
}

func MsgTxAtomicSwapsInfo

func MsgTxAtomicSwapsInfo(msgTx *wire.MsgTx, outputSpenders map[uint32]*OutputSpenderTxOut,
	params *chaincfg.Params) (*TxSwapResults, error)

Jump to

Keyboard shortcuts

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