util

package
v0.0.0-...-3a7d5fb Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 15 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcBalance

func CalcBalance(utxos []wi.Utxo, txns []wi.Txn) (confirmed, unconfirmed int64)

func DecodeAddress

func DecodeAddress(address string, params *chaincfg.Params) (btcutil.Address, error)

func GatherCoins

func GatherCoins(height uint32, utxos []wallet.Utxo, scriptToAddress func(script []byte) (btcutil.Address, error), getKeyForScript func(scriptAddress []byte) (*hd.ExtendedKey, error)) map[coinset.Coin]*hd.ExtendedKey

func LoadAllInputs

func LoadAllInputs(tx *wire.MsgTx, coinMap map[coinset.Coin]*hd.ExtendedKey, params *chaincfg.Params) (int64, map[wire.OutPoint]int64, map[wire.OutPoint][]byte, map[string]*btcutil.WIF)

func NewCoin

func NewCoin(txid chainhash.Hash, index uint32, value btcutil.Amount, numConfs int64, scriptPubKey []byte) (coinset.Coin, error)

func NormalizeCurrencyCode

func NormalizeCurrencyCode(currencyCode string) string

NormalizeCurrencyCode standardizes the format for the given currency code

func OutPointsEqual

func OutPointsEqual(a, b wire.OutPoint) bool

func SatoshisPerCoin

func SatoshisPerCoin(coinType wallet.CoinType) float64

All implemented coins currently have 100m satoshis per coin

Types

type Coin

type Coin struct {
	TxHash       *chainhash.Hash
	TxIndex      uint32
	TxValue      btcutil.Amount
	TxNumConfs   int64
	ScriptPubKey []byte
}

func (*Coin) Hash

func (c *Coin) Hash() *chainhash.Hash

func (*Coin) Index

func (c *Coin) Index() uint32

func (*Coin) NumConfs

func (c *Coin) NumConfs() int64

func (*Coin) PkScript

func (c *Coin) PkScript() []byte

func (*Coin) Value

func (c *Coin) Value() btcutil.Amount

func (*Coin) ValueAge

func (c *Coin) ValueAge() int64

type FeeProvider

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

func NewFeeProvider

func NewFeeProvider(maxFee, priorityFee, normalFee, economicFee, superEconomicFee uint64, exchangeRates wallet.ExchangeRates) *FeeProvider

func (*FeeProvider) GetFeePerByte

func (fp *FeeProvider) GetFeePerByte(feeLevel wallet.FeeLevel) uint64

type FeeTargetInUSDCents

type FeeTargetInUSDCents float64

We will target a fee per byte such that it would equal 0.1 USD cent for economic, 1 USD cents for normal and 5 USD cents for priority for a median (226 byte) transaction.

const (
	EconomicTarget FeeTargetInUSDCents = 0.1
	NormalTarget   FeeTargetInUSDCents = 1
	PriorityTarget FeeTargetInUSDCents = 5

	AverageTransactionSize = 226
)

type Fees

type Fees struct {
	FastestFee  uint64
	HalfHourFee uint64
	HourFee     uint64
}

Fees describe

Jump to

Keyboard shortcuts

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