Documentation ¶
Index ¶
- Variables
- func SumOutputs(outputs []types.SiacoinElement) (sum types.Currency)
- type DBStore
- func (s *DBStore) Address() types.Address
- func (s *DBStore) Annotate(txns []types.Transaction) (ptxns []wallet.PoolTransaction)
- func (s *DBStore) ProcessChainApplyUpdate(cau *chain.ApplyUpdate, mayCommit bool) (err error)
- func (s *DBStore) ProcessChainRevertUpdate(cru *chain.RevertUpdate) (err error)
- func (s *DBStore) UnspentOutputs() (sces []types.SiacoinElement, sfes []types.SiafundElement, err error)
- type Wallet
- func (w *Wallet) Address(network string) types.Address
- func (w *Wallet) Annotate(network string, txns []types.Transaction) ([]wallet.PoolTransaction, error)
- func (w *Wallet) Close()
- func (w *Wallet) Fund(network string, txn *types.Transaction, amount types.Currency, ...) (parents []types.Transaction, toSign []types.Hash256, err error)
- func (w *Wallet) Key(network string) types.PrivateKey
- func (w *Wallet) Redistribute(network string, amount types.Currency, outputs int) error
- func (w *Wallet) Release(txns ...types.Transaction)
- func (w *Wallet) Sign(network string, txn *types.Transaction, toSign []types.Hash256, ...)
- func (w *Wallet) UnspentOutputs(network string) ([]types.SiacoinElement, []types.SiafundElement, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInsufficientBalance = errors.New("insufficient balance")
ErrInsufficientBalance is returned when there aren't enough unused outputs to cover the requested amount.
Functions ¶
func SumOutputs ¶
func SumOutputs(outputs []types.SiacoinElement) (sum types.Currency)
SumOutputs returns the total value of the supplied outputs.
Types ¶
type DBStore ¶
type DBStore struct {
// contains filtered or unexported fields
}
A DBStore stores wallet state in a MySQL database.
func NewDBStore ¶
func NewDBStore(db *sql.DB, seed, network string, logger *zap.Logger) (*DBStore, types.ChainIndex, error)
NewDBStore returns a new DBStore.
func (*DBStore) Annotate ¶
func (s *DBStore) Annotate(txns []types.Transaction) (ptxns []wallet.PoolTransaction)
Annotate implements api.Wallet.
func (*DBStore) ProcessChainApplyUpdate ¶
func (s *DBStore) ProcessChainApplyUpdate(cau *chain.ApplyUpdate, mayCommit bool) (err error)
ProcessChainApplyUpdate implements chain.Subscriber.
func (*DBStore) ProcessChainRevertUpdate ¶
func (s *DBStore) ProcessChainRevertUpdate(cru *chain.RevertUpdate) (err error)
ProcessChainRevertUpdate implements chain.Subscriber.
func (*DBStore) UnspentOutputs ¶
func (s *DBStore) UnspentOutputs() (sces []types.SiacoinElement, sfes []types.SiafundElement, err error)
UnspentOutputs implements api.Wallet.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func NewWallet ¶
func NewWallet(db *sql.DB, seed, seedZen, dir string, cm *chain.Manager, cmZen *chain.Manager, syncer *syncer.Syncer, syncerZen *syncer.Syncer) (*Wallet, error)
NewWallet returns a wallet that is stored in a MySQL database.
func (*Wallet) Annotate ¶
func (w *Wallet) Annotate(network string, txns []types.Transaction) ([]wallet.PoolTransaction, error)
Annotate implements api.Wallet.
func (*Wallet) Fund ¶
func (w *Wallet) Fund(network string, txn *types.Transaction, amount types.Currency, useUnconfirmed bool) (parents []types.Transaction, toSign []types.Hash256, err error)
Fund adds Siacoin inputs with the required amount to the transaction.
func (*Wallet) Key ¶
func (w *Wallet) Key(network string) types.PrivateKey
Key implements api.Wallet.
func (*Wallet) Redistribute ¶
Redistribute creates a specified number of new outputs and distributes the funds between them.
func (*Wallet) Release ¶
func (w *Wallet) Release(txns ...types.Transaction)
Release marks the inputs as unused.
func (*Wallet) Sign ¶
func (w *Wallet) Sign(network string, txn *types.Transaction, toSign []types.Hash256, cf types.CoveredFields)
Sign adds signatures corresponding to toSign elements to the transaction.
func (*Wallet) UnspentOutputs ¶
func (w *Wallet) UnspentOutputs(network string) ([]types.SiacoinElement, []types.SiafundElement, error)
UnspentOutputs implements api.Wallet.