wallet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

func New(state *consensus.State, filename string) (w *Wallet, err error)

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

func (w *Wallet) AddArbitraryData(id string, arb string) error

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

func (w *Wallet) AddMinerFee(id string, fee consensus.Currency) error

AddMinerFee implements the core.Wallet interface.

func (*Wallet) AddOutput

func (w *Wallet) AddOutput(id string, o consensus.Output) error

AddOutput 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) Balance

func (w *Wallet) Balance(full bool) (total consensus.Currency)

Balance 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

func (w *Wallet) FundTransaction(id string, amount consensus.Currency) error

FundTransaction implements the core.Wallet interface.

func (*Wallet) Load

func (w *Wallet) Load(filename string) (err error)

Load 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) Reset

func (w *Wallet) Reset() error

Reset implements the core.Wallet interface.

func (*Wallet) Save

func (w *Wallet) Save() (err error)

Save 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL