Documentation
¶
Index ¶
- type AddressKey
- type Wallet
- func (w *Wallet) AddArbitraryData(id string, arb string) error
- func (w *Wallet) AddFileContract(id string, fc consensus.FileContract) error
- func (w *Wallet) AddMinerFee(id string, fee consensus.Currency) error
- func (w *Wallet) AddOutput(id string, o consensus.Output) error
- func (w *Wallet) AddStorageProof(id string, sp consensus.StorageProof) error
- func (w *Wallet) AddTimelockedRefund(id string, amount consensus.Currency, release consensus.BlockHeight) (spendConditions consensus.SpendConditions, refundIndex uint64, err error)
- func (w *Wallet) Balance(full bool) (total consensus.Currency)
- func (w *Wallet) CoinAddress() (coinAddress consensus.CoinAddress, spendConditions consensus.SpendConditions, ...)
- func (w *Wallet) FundTransaction(id string, amount consensus.Currency) error
- func (w *Wallet) Load(filename string) (err error)
- func (w *Wallet) RegisterTransaction(t consensus.Transaction) (id string, err error)
- func (w *Wallet) Reset() error
- func (w *Wallet) Save() (err error)
- func (w *Wallet) SignTransaction(id string, wholeTransaction bool) (transaction consensus.Transaction, err error)
- func (w *Wallet) TimelockedCoinAddress(unlockHeight consensus.BlockHeight) (coinAddress consensus.CoinAddress, spendConditions consensus.SpendConditions, ...)
- func (w *Wallet) Update(diffs []consensus.OutputDiff) error
- func (w *Wallet) WalletInfo() (status components.WalletInfo, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressKey ¶
type AddressKey struct {
SpendConditions consensus.SpendConditions
SecretKey crypto.SecretKey
}
AddressKey is how we serialize and store spendable addresses on disk.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet holds your coins, manages privacy, outputs, ect. The balance reported ignores outputs you've already spent even if they haven't made it into the blockchain yet.
The spentCounter is used to indicate which transactions have been spent but have not appeared in the blockchain. It's used as an int for an easy reset. Each transaction also has a spent counter. If the transaction's spent counter is equal to the wallet's spent counter, then the transaction has been spent since the last reset. Upon reset, the wallet's spent counter is incremented, which means all transactions will no longer register as having been spent since the last reset.
Wallet.transactions is a list of transactions that are currently being built within the wallet. The transactionCounter ensures that each transaction-in-progress gets a unique ID.
func New ¶
New creates a new wallet, loading any known addresses from the input file name and then using the file to save in the future.
func (*Wallet) AddArbitraryData ¶
AddArbitraryData implements the core.Wallet interface.
func (*Wallet) AddFileContract ¶
func (w *Wallet) AddFileContract(id string, fc consensus.FileContract) error
AddFileContract implements the core.Wallet interface.
func (*Wallet) AddMinerFee ¶
AddMinerFee implements the core.Wallet interface.
func (*Wallet) AddStorageProof ¶
func (w *Wallet) AddStorageProof(id string, sp consensus.StorageProof) error
AddStorageProof implements the core.Wallet interface.
func (*Wallet) AddTimelockedRefund ¶
func (w *Wallet) AddTimelockedRefund(id string, amount consensus.Currency, release consensus.BlockHeight) (spendConditions consensus.SpendConditions, refundIndex uint64, err error)
AddTimelockedRefund implements the core.Wallet interface.
func (*Wallet) CoinAddress ¶
func (w *Wallet) CoinAddress() (coinAddress consensus.CoinAddress, spendConditions consensus.SpendConditions, err error)
CoinAddress implements the core.Wallet interface.
func (*Wallet) FundTransaction ¶
FundTransaction implements the core.Wallet interface.
func (*Wallet) RegisterTransaction ¶
func (w *Wallet) RegisterTransaction(t consensus.Transaction) (id string, err error)
RegisterTransaction implements the core.Wallet interface.
func (*Wallet) SignTransaction ¶
func (w *Wallet) SignTransaction(id string, wholeTransaction bool) (transaction consensus.Transaction, err error)
SignTransaction implements the core.Wallet interface.
func (*Wallet) TimelockedCoinAddress ¶
func (w *Wallet) TimelockedCoinAddress(unlockHeight consensus.BlockHeight) (coinAddress consensus.CoinAddress, spendConditions consensus.SpendConditions, err error)
TimelockedCoinAddress returns an address that can only be spent after block `unlockHeight`.
func (*Wallet) Update ¶
func (w *Wallet) Update(diffs []consensus.OutputDiff) error
Update implements the core.Wallet interface.
func (*Wallet) WalletInfo ¶
func (w *Wallet) WalletInfo() (status components.WalletInfo, err error)
Info implements the core.Wallet interface.