wallet

package
v0.0.0-...-f1ec097 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(key ed25519.PrivateKey) types.Address

Address retrives Address key form private

func GenPair

func GenPair(no int, mnemonic string, salt string) (address types.Address, key ed25519.PrivateKey)

GenPair generates new wkeys pair

func NewMnemonic

func NewMnemonic() (mnemonic string, err error)

NewMnemonic generates new wallet mnemonic

func PublicKey

func PublicKey(key ed25519.PrivateKey) ed25519.PublicKey

PublicKey retrives publick key form private

func Unlock

func Unlock(key string, w ...Wallet) (ok bool)

Unlock wallets

Types

type Account

type Account struct {
	Name    string
	Address types.Address
	Private ed25519.PrivateKey
	Wallet  Wallet
}

Account structure for the wallet interface

func Lookup

func Lookup(alias string, w ...Wallet) (acc []Account)

Lookup for accounts in wallets

func LookupOne

func LookupOne(alias string, w ...Wallet) (acc Account, exists bool)

Lookup for an account in wallets. It panics if there are more then one account

func LuckyLookup

func LuckyLookup(alias string, w ...Wallet) Account

Lookup for an account in walltes. It panics if there is not exactly one account

type Contact

type Contact struct {
	Name    string
	Address types.Address
}

type Wallet

type Wallet struct {
	WalletImpl
}

Wallet decorator

func (Wallet) DisplayName

func (wal Wallet) DisplayName() string

DisplayName retruns composition of wallet name and its file

func (Wallet) LuckyImportKey

func (wal Wallet) LuckyImportKey(alias string, address types.Address, key ed25519.PrivateKey)

LuckyImportKey imports key to the wallet. It panics if failed to unlock

func (Wallet) LuckyNewPair

func (wal Wallet) LuckyNewPair(alias string)

LuckyNewPair creates keys pair. It panics if failed to unlock

func (Wallet) LuckySave

func (wal Wallet) LuckySave()

LuckySave saves wallet. It panics if failed to unlock

func (Wallet) LuckyUnlock

func (wal Wallet) LuckyUnlock(key string)

LuckyUnlock unlocks wallet. It panics if failed to unlock

type WalletImpl

type WalletImpl interface {
	Name() string
	Path() string
	Unlock(key string) error
	Lookup(alias string) (Account, bool)
	List() []Account
	Save() error
	NewPair(alias string) error
	ImportKey(alias string, address types.Address, key ed25519.PrivateKey) error
}

Wallet implementation

Directories

Path Synopsis
+build linux
+build linux

Jump to

Keyboard shortcuts

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