util

package
v0.0.0-...-57b5d92 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 15 Imported by: 3 modules, 12 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 ExtCoinType

type ExtCoinType wallet.CoinType
const (
	CoinTypePhore     ExtCoinType = 444
	CoinTypePhoreTest             = 1000444
)

func ExtendCoinType

func ExtendCoinType(coinType wallet.CoinType) ExtCoinType

func (*ExtCoinType) CurrencyCode

func (c *ExtCoinType) CurrencyCode() string

func (*ExtCoinType) String

func (c *ExtCoinType) String() string

func (ExtCoinType) ToCoinType

func (c ExtCoinType) ToCoinType() wallet.CoinType

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