Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amount ¶
type Amount struct {
// contains filtered or unexported fields
}
Amount represents an amount in the smallest coin unit (e.g. satoshi).
func NewAmountFromInt64 ¶
NewAmountFromInt64 creates a new amount.
func NewAmountFromString ¶
NewAmountFromString parses a user given coin amount, converting it from the default coin unit to the the smallest unit.
type Coin ¶
type Coin interface { observable.Interface // Code returns the code used to identify the coin (should be the acronym of the coin in // lowercase). Code() string // Unit is the unit code of the string for formatting amounts. Unit() string // FormatAmount formats the given amount as a number. FormatAmount(Amount) string // ToUnit returns the given amount in the unit as returned above. ToUnit(Amount) float64 // BlockExplorerTransactionURLPrefix returns the URL prefix of the block explorer. BlockExplorerTransactionURLPrefix() string // Initialize initializes the coin by connecting to a full node, downloading the headers, etc. Initialize() // SmallestUnit returns the name of the smallest unit of a given coin SmallestUnit() string }
Coin models the currency of a blockchain.
type SendAmount ¶
type SendAmount struct {
// contains filtered or unexported fields
}
SendAmount is either a concrete amount, or "all"/"max". The concrete amount is user input and is parsed/validated in Amount().
func NewSendAmount ¶
func NewSendAmount(amount string) SendAmount
NewSendAmount creates a new SendAmount based on a concrete amount.
func NewSendAmountAll ¶
func NewSendAmountAll() SendAmount
NewSendAmountAll creates a new Sendall-amount.
func (SendAmount) Amount ¶
Amount parses the amount and converts it from the default unit to the smallest unit (e.g. satoshi = 1e8). Returns an error if the amount is negative, or depending on allowZero, if it is zero.
func (*SendAmount) SendAll ¶
func (sendAmount *SendAmount) SendAll() bool
SendAll returns if this represents a send-all input.