Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address interface { // ID is an identifier for the address. ID() string EncodeForHumans() string }
Address models a blockchain address to which coins can be sent.
type AddressAndAmount ¶
type AddressAndAmount struct { Address string // Amount is the amount sent to or received on the address in a transaction. Amount coin.Amount // Ours is true if the address is one of our receive addresses. Ours bool }
AddressAndAmount holds an address and the corresponding amount.
type Balance ¶
type Balance struct {
// contains filtered or unexported fields
}
Balance contains the available and incoming balance of an account.
func NewBalance ¶
NewBalance creates a new balance with the given amounts.
type Event ¶
type Event string
Event instances are sent to the onEvent callback of the wallet.
const ( // EventStatusChanged is fired when the status changes. Check the status using Initialized(). EventStatusChanged Event = "statusChanged" // EventSyncStarted is fired when syncing with the blockchain starts. This happens in the very // beginning for the initial sync, and repeatedly afterwards when the wallet is updated (new // transactions, confirmations, etc.). EventSyncStarted Event = "syncstarted" // EventSyncDone follows EventSyncStarted. EventSyncDone Event = "syncdone" // EventHeadersSynced is fired when the headers finished syncing. EventHeadersSynced Event = "headersSynced" // EventFeeTargetsChanged is fired when the fee targets change. EventFeeTargetsChanged Event = "feeTargetsChanged" )
type FeeTarget ¶
type FeeTarget interface {
Code() FeeTargetCode
}
FeeTarget interface has priority codes. Coin specific methods are implemented in corresponding coins
type FeeTargetCode ¶
type FeeTargetCode string
FeeTargetCode models the code of a fee target. See the constants below.
const ( // FeeTargetCodeLow is the low priority fee target. FeeTargetCodeLow FeeTargetCode = "low" // FeeTargetCodeEconomy is the economy priority fee target. FeeTargetCodeEconomy FeeTargetCode = "economy" // FeeTargetCodeNormal is the normal priority fee target. FeeTargetCodeNormal FeeTargetCode = "normal" // FeeTargetCodeHigh is the high priority fee target. FeeTargetCodeHigh FeeTargetCode = "high" // DefaultFeeTarget is the default fee target DefaultFeeTarget = FeeTargetCodeNormal )
func NewFeeTargetCode ¶
func NewFeeTargetCode(code string) (FeeTargetCode, error)
NewFeeTargetCode checks if the code is valid and returns a FeeTargetCode in that case.
type Info ¶
type Info struct {
SigningConfiguration *signing.Configuration `json:"signingConfiguration"`
}
Info holds account information.
type Interface ¶
type Interface interface { Info() *Info // Code is a identifier for the account (to identify the account in databases, apis, etc.). Code() string Coin() coin.Coin // Name returns a human readable long name. Name() string // Initialize only starts the initialization, the account is not initialized right afterwards. Initialize() error Initialized() bool Offline() bool FatalError() bool Close() Notifier() Notifier Transactions() ([]Transaction, error) Balance() (*Balance, error) // Creates, signs and broadcasts a transaction. Returns keystore.ErrSigningAborted on user // abort. SendTx(string, coin.SendAmount, FeeTargetCode, map[wire.OutPoint]struct{}, []byte) error FeeTargets() ([]FeeTarget, FeeTargetCode) TxProposal(string, coin.SendAmount, FeeTargetCode, map[wire.OutPoint]struct{}, []byte) ( coin.Amount, coin.Amount, coin.Amount, error) GetUnusedReceiveAddresses() []Address CanVerifyAddresses() (bool, bool, error) VerifyAddress(addressID string) (bool, error) ConvertToLegacyAddress(addressID string) (btcutil.Address, error) Keystores() *keystore.Keystores }
Interface is the API of a Account.
type Notifier ¶
type Notifier interface { // Put adds the id to the 'unnotified' set, unless it is already in the 'seen' set. Put(id []byte) error // Delete removes the id from all sets. Delete(id []byte) error // UnnotifiedCount returns the number ids in the 'unnotified' set. UnnotifiedCount() (int, error) // MarkAllNotified moves all ids from the 'unnotified' set to the 'seen' set. MarkAllNotified() error }
Notifier juggles transaction IDs for the purpose of notifications and unread counts.
type Transaction ¶
type Transaction interface { // Fee is nil for a receiving tx. The fee is only displayed (and relevant) when sending funds // from the wallet. Fee() *coin.Amount // Time of confirmation. nil for unconfirmed tx or when the headers are not synced yet. Timestamp() *time.Time // ID is the tx ID. ID() string // NumConfirmations is the number of confirmations. 0 for unconfirmed. NumConfirmations() int // Type returns the type of the transaction. Type() TxType // Amount is always >0 and is the amount received or sent (not including the fee). Amount() coin.Amount // Addresses money was sent to / received on. Addresses() []AddressAndAmount }
Transaction models a transaction with common transaction info.