psbtutils

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// default psbt encoding is hex
	DefaultEncoding = EncodingHex
)

Variables

This section is empty.

Functions

func Decode

func Decode(psbtB []byte, encoding ...Encoding) (*psbt.Packet, error)

Decode decodes a psbt hex/base64 byte into a psbt.Packet

encoding is optional, default is EncodingHex

func DecodeString

func DecodeString(psbtStr string, encoding ...Encoding) (*psbt.Packet, error)

DecodeString decodes a psbt hex/base64 string into a psbt.Packet

encoding is optional, default is EncodingHex

func EncodeToString

func EncodeToString(pC *psbt.Packet, encoding ...Encoding) (string, error)

EncodeToString encodes a psbt.Packet into a psbt hex/base64 string

encoding is optional, default is EncodingHex

func IsReadyPSBT

func IsReadyPSBT(pC *psbt.Packet, feeRate int64) (bool, error)

func PSBTSize

func PSBTSize(psbt *psbt.Packet) (float64, error)

func PredictTxFee

func PredictTxFee(feeRate int64, inputs, outputs int) int64

func TxFee

func TxFee(feeRate int64, p *psbt.Packet) (int64, error)

TxFee returns satoshis fee of a transaction given the fee rate (sat/vB) and the number of inputs and outputs.

Types

type Encoding

type Encoding string
const (
	EncodingBase64 Encoding = "base64"
	EncodingHex    Encoding = "hex"
)

Jump to

Keyboard shortcuts

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