wallet

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage interface {
	//Init creates a wallet or reads existed one
	Init(context.Context) (*Wallet, error)
	// Write writes a wallet to an implemented storage
	Write(context.Context, *Wallet) error
	// Close releases allocated resources of the storage
	Close() error
}

Storage represents a storage for wallet It might be a file, memory or network implementation

func NewFileStorage

func NewFileStorage(filename string) Storage

NewFileStorage creates new Storage. It creates new filename or uses existed one

type Wallet

type Wallet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Wallet represents a container with generated keys

func Init

func Init(n int) (*Wallet, error)

Init creates a wallet with N pre-generated keys

func (*Wallet) AddKeys

func (w *Wallet) AddKeys(k *keys.Keys)

AddKeys adds keys to the wallet

func (*Wallet) Addresses

func (w *Wallet) Addresses() []*btcutil.AddressPubKeyHash

Addresses returns all addresses for all existed keys

func (*Wallet) Keys

func (w *Wallet) Keys() []*keys.Keys

Keys returns all existing keys in the wallet

func (*Wallet) MarshalJSON

func (w *Wallet) MarshalJSON() ([]byte, error)

MarshalJSON implements Marshaler interface

func (*Wallet) UnmarshalJSON

func (w *Wallet) UnmarshalJSON(d []byte) error

UnmarshalJSON implements Unmarshaler interface

Jump to

Keyboard shortcuts

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