wallet

package
v0.0.0-...-79d14b3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2015 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func NewAccount

func NewAccount(seed string) (*Account, error)

func (*Account) HasNewAddressesToWatch

func (a *Account) HasNewAddressesToWatch() bool

hasNewAddressesToWatch returns true if additional addresses has been added since last call of WatchObjects.

func (*Account) MarkAddressAsUsed

func (a *Account) MarkAddressAsUsed(hash []byte)

func (*Account) NewPayment

func (a *Account) NewPayment() *Payment

func (*Account) NextChangeAddress

func (a *Account) NextChangeAddress() []byte

func (*Account) NextFree

func (a *Account) NextFree(list []string) *Address

func (*Account) NextReceiveAddress

func (a *Account) NextReceiveAddress() []byte

func (*Account) ServeHTTP

func (a *Account) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Account) SetTxInventory

func (a *Account) SetTxInventory(inv UnspentTxOutputter)

func (*Account) SpendableOutputs

func (a *Account) SpendableOutputs() []*spendable

SpendableOutputs reads outputs from a central storage and returns the ones that are spendable by this acount.

func (*Account) UnusedAddresses

func (a *Account) UnusedAddresses(list []string) int

UnusedAddresses returne the number of unused addresses at the end of the address space currently watched, ie. not counting those in gaps.

func (*Account) UpdateBalances

func (a *Account) UpdateBalances()

UpdateBalances will update the list of spendable outputs and hence the balance of all active addresses.

func (*Account) WatchObjects

func (a *Account) WatchObjects() [][]byte

type Address

type Address struct {
	// contains filtered or unexported fields
}

func NewAddress

func NewAddress(key *hdkeys.Key) *Address

func (Address) Balance

func (a Address) Balance() uint64

Balance returns the unspent balance in the address. Assumes UpdateBalances has been called just prior.

type OutputsByTxHash

type OutputsByTxHash []*messages.TxOutput

func (OutputsByTxHash) Len

func (slice OutputsByTxHash) Len() int

func (OutputsByTxHash) Less

func (slice OutputsByTxHash) Less(i, j int) bool

func (OutputsByTxHash) Swap

func (slice OutputsByTxHash) Swap(i, j int)

type Payment

type Payment struct {
	// contains filtered or unexported fields
}

func (*Payment) AddDataOutput

func (p *Payment) AddDataOutput(data []byte) error

AddDataOutput adds up to 40 bytes of arbitrary data using the OP_RETURN op code.

func (*Payment) AddInputsAndFee

func (p *Payment) AddInputsAndFee(fee uint64) error

AddInputsAndFee to payment adds spendable inputs from the account until the value of the inputs matches or surpases the outputs. If the inputs become larger than the outputs, a change output from the account is added. No more outputs should be added after calling this.

func (*Payment) AddOutput

func (p *Payment) AddOutput(addrHash []byte, value uint64) error

AddOutput adds a standard pay to public key hash output to a payment transaction.

func (*Payment) Sign

func (p *Payment) Sign() error

Sign all the inputs of the payment transaction.

func (*Payment) Transactions

func (p *Payment) Transactions() []*messages.Transaction

type UnspentTxOutputter

type UnspentTxOutputter interface {
	UnspentTxOutputs() []*messages.TxOutput
}

Storage object that gives unspent outputs, some of which may be spendable by a certain account.

type Wallet

type Wallet struct {
	// contains filtered or unexported fields
}

func New

func New(root *hdkeys.Key) *Wallet

func (*Wallet) HasNewAddressesToWatch

func (w *Wallet) HasNewAddressesToWatch() bool

func (*Wallet) MarkAddressAsUsed

func (w *Wallet) MarkAddressAsUsed(hash []byte)

func (*Wallet) NewPayment

func (w *Wallet) NewPayment() *Payment

Pay from account0

func (*Wallet) ServeHTTP

func (wallet *Wallet) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Wallet) SetTxInventory

func (w *Wallet) SetTxInventory(inv UnspentTxOutputter)

func (*Wallet) WatchObjects

func (w *Wallet) WatchObjects() [][]byte

Jump to

Keyboard shortcuts

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