wallet

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0, MIT Imports: 12 Imported by: 30

Documentation

Index

Constants

View Source
const (
	KNamePrefix = "wallet-"
	KDefault    = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	types.KeyInfo

	PublicKey []byte
	Address   address.Address
}

func GenerateKey

func GenerateKey(typ string) (*Key, error)

func NewKey

func NewKey(keyinfo types.KeyInfo) (*Key, error)

type MemKeyStore

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

func NewMemKeyStore

func NewMemKeyStore() *MemKeyStore

func (*MemKeyStore) Delete

func (mks *MemKeyStore) Delete(k string) error

Delete removes a key from keystore

func (*MemKeyStore) Get

func (mks *MemKeyStore) Get(k string) (types.KeyInfo, error)

Get gets a key out of keystore and returns KeyInfo corresponding to named key

func (*MemKeyStore) List

func (mks *MemKeyStore) List() ([]string, error)

List lists all the keys stored in the KeyStore

func (*MemKeyStore) Put

func (mks *MemKeyStore) Put(k string, ki types.KeyInfo) error

Put saves a key info under given name

type Wallet

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

func KeyWallet

func KeyWallet(keys ...*Key) *Wallet

func NewWallet

func NewWallet(keystore types.KeyStore) (*Wallet, error)

func (*Wallet) Export

func (w *Wallet) Export(addr address.Address) (*types.KeyInfo, error)

func (*Wallet) GenerateKey

func (w *Wallet) GenerateKey(typ string) (address.Address, error)

func (*Wallet) GetDefault

func (w *Wallet) GetDefault() (address.Address, error)

func (*Wallet) HasKey

func (w *Wallet) HasKey(addr address.Address) (bool, error)

func (*Wallet) Import

func (w *Wallet) Import(ki *types.KeyInfo) (address.Address, error)

func (*Wallet) ListAddrs

func (w *Wallet) ListAddrs() ([]address.Address, error)

func (*Wallet) SetDefault

func (w *Wallet) SetDefault(a address.Address) error

func (*Wallet) Sign

func (w *Wallet) Sign(ctx context.Context, addr address.Address, msg []byte) (*types.Signature, error)

Jump to

Keyboard shortcuts

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