transaction

package
v0.0.0-...-32c8a8c Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WitnessScaleFactor = 4
)

Variables

This section is empty.

Functions

func DecodePSBT

func DecodePSBT(psbtStr string) (*psbt.Packet, error)

func EstimateTxFee

func EstimateTxFee(feeRate float64, ins []*wire.TxIn, outs []*wire.TxOut, changeAddress btcutil.Address) (btcutil.Amount, error)

func EstimateTxVirtualSize

func EstimateTxVirtualSize(ins []*wire.TxIn, outs []*wire.TxOut, changeAddress btcutil.Address) (vSize int, err error)

func GetChangeScriptSize

func GetChangeScriptSize(changeAddress btcutil.Address) (int, error)

func IsMultiSigScript

func IsMultiSigScript(script []byte) bool

func NewTransferTx

func NewTransferTx(net types.Network, fromAddress string, toAddress map[string]int64, changeAddress string) (*psbt.Packet, error)

func PsbtPrevOutputFetcher

func PsbtPrevOutputFetcher(packet *psbt.Packet) *txscript.MultiPrevOutFetcher

PsbtPrevOutputFetcher returns a txscript.PrevOutFetcher built from the UTXO information in a PSBT packet.

func SelectUtxo

func SelectUtxo(utxos []*types.Utxo, amount int64) (selected []*types.Utxo, totalAmount int64, err error)

func SignTx

func SignTx(net types.Network, psbtRaw, privateKey []byte) (*wire.MsgTx, error)

Types

type TxBuilder

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

func NewTxBuilder

func NewTxBuilder(cfg *chaincfg.Params, client *client.Client) *TxBuilder

func (*TxBuilder) Build

func (t *TxBuilder) Build() (*psbt.Packet, error)

func (*TxBuilder) FundRawTransaction

func (t *TxBuilder) FundRawTransaction(changeAddress string) error

func (*TxBuilder) SufficentFunds

func (t *TxBuilder) SufficentFunds() bool

type TxInputs

type TxInputs []*types.Vin

func (TxInputs) AddInput

func (t TxInputs) AddInput(vin *types.Vin, address string, amount int64) error

func (TxInputs) AddInputTransfer

func (t TxInputs) AddInputTransfer(txid string, vout uint32, address string, amount int64) error

func (TxInputs) AmountTotal

func (t TxInputs) AmountTotal() btcutil.Amount

func (TxInputs) ToWire

func (t TxInputs) ToWire() ([]*wire.OutPoint, []uint32, error)

type TxOutputs

type TxOutputs []*types.Vout

func (TxOutputs) AddOutput

func (t TxOutputs) AddOutput(address string, amount int64) error

func (TxOutputs) AddOutputTransfer

func (t TxOutputs) AddOutputTransfer(address string, amount int64) error

func (TxOutputs) AmountTotal

func (t TxOutputs) AmountTotal() btcutil.Amount

func (TxOutputs) ToWire

func (t TxOutputs) ToWire() ([]*wire.TxOut, error)

Jump to

Keyboard shortcuts

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