maketx

package
v4.13.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package maketx provides transaction creation code for wallets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TxProposal

type TxProposal struct {
	// Coin is the coin this tx was made for.
	Coin                 coin.Coin
	AccountConfiguration *signing.Configuration
	// Amount is the amount that is sent out. The fee is not included and is deducted on top.
	Amount btcutil.Amount
	// Fee is the mining fee used.
	Fee         btcutil.Amount
	Transaction *wire.MsgTx
	// ChangeAddress is the address of the wallet to which the change of the transaction is sent.
	ChangeAddress *addresses.AccountAddress
}

TxProposal is the data needed for a new transaction to be able to display it and sign it.

func NewTx

func NewTx(
	coin coin.Coin,
	inputConfiguration *signing.Configuration,
	spendableOutputs map[wire.OutPoint]*wire.TxOut,
	output *wire.TxOut,
	feePerKb btcutil.Amount,
	getChangeAddress func() *addresses.AccountAddress,
	log *logrus.Entry,
) (*TxProposal, error)

NewTx creates a transaction from a set of unspent outputs, targeting an output value. A subset of the unspent outputs is selected to cover the needed amount. A change output is added if needed.

func NewTxSpendAll

func NewTxSpendAll(
	coin coin.Coin,
	inputConfiguration *signing.Configuration,
	spendableOutputs map[wire.OutPoint]*wire.TxOut,
	outputPkScript []byte,
	feePerKb btcutil.Amount,
	log *logrus.Entry,
) (*TxProposal, error)

NewTxSpendAll creates a transaction which spends all available unspent outputs.

func (*TxProposal) Total

func (txProposal *TxProposal) Total() btcutil.Amount

Total is amount+fee.

Jump to

Keyboard shortcuts

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