wallet

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: Apache-2.0, MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

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

Variables

View Source
var NilDefault nilDefault

Functions

func ActSigType

func ActSigType(typ types.KeyType) crypto.SigType

Types

type Default

type Default interface {
	GetDefault(ctx context.Context) (address.Address, error)
	SetDefault(ctx context.Context, a address.Address) error
}

type Key

type Key struct {
	types.KeyInfo

	PublicKey []byte
	Address   address.Address
}

func GenerateKey

func GenerateKey(typ types.KeyType) (*Key, error)

func GenerateKeyFromSeed

func GenerateKeyFromSeed(typ types.KeyType, seed []byte) (*Key, error)

func NewKey

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

type LocalWallet

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

func KeyWallet

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

func NewWallet

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

func (*LocalWallet) Get

func (w *LocalWallet) Get() api.WalletAPI

func (*LocalWallet) GetDefault

func (w *LocalWallet) GetDefault(ctx context.Context) (address.Address, error)

func (*LocalWallet) SetDefault

func (w *LocalWallet) SetDefault(ctx context.Context, a address.Address) error

func (*LocalWallet) WalletDelete

func (w *LocalWallet) WalletDelete(ctx context.Context, addr address.Address) error

func (*LocalWallet) WalletExport

func (w *LocalWallet) WalletExport(ctx context.Context, addr address.Address) (*types.KeyInfo, error)

func (*LocalWallet) WalletHas

func (w *LocalWallet) WalletHas(ctx context.Context, addr address.Address) (bool, error)

func (*LocalWallet) WalletImport

func (w *LocalWallet) WalletImport(ctx context.Context, ki *types.KeyInfo) (address.Address, error)

func (*LocalWallet) WalletList

func (w *LocalWallet) WalletList(ctx context.Context) ([]address.Address, error)

func (*LocalWallet) WalletNew

func (w *LocalWallet) WalletNew(ctx context.Context, typ types.KeyType) (address.Address, error)

func (*LocalWallet) WalletNewFromSeed

func (w *LocalWallet) WalletNewFromSeed(typ types.KeyType, seed []byte) (address.Address, error)

func (*LocalWallet) WalletSign

func (w *LocalWallet) WalletSign(ctx context.Context, addr address.Address, msg []byte, meta api.MsgMeta) (*crypto.Signature, 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 MultiWallet

type MultiWallet struct {
	fx.In // "constructed" with fx.In instead of normal constructor

	Local  *LocalWallet               `optional:"true"`
	Remote *remotewallet.RemoteWallet `optional:"true"`
	Ledger *ledgerwallet.LedgerWallet `optional:"true"`
}

func (MultiWallet) WalletDelete

func (m MultiWallet) WalletDelete(ctx context.Context, address address.Address) error

func (MultiWallet) WalletExport

func (m MultiWallet) WalletExport(ctx context.Context, address address.Address) (*types.KeyInfo, error)

func (MultiWallet) WalletHas

func (m MultiWallet) WalletHas(ctx context.Context, address address.Address) (bool, error)

func (MultiWallet) WalletImport

func (m MultiWallet) WalletImport(ctx context.Context, info *types.KeyInfo) (address.Address, error)

func (MultiWallet) WalletList

func (m MultiWallet) WalletList(ctx context.Context) ([]address.Address, error)

func (MultiWallet) WalletNew

func (m MultiWallet) WalletNew(ctx context.Context, keyType types.KeyType) (address.Address, error)

func (MultiWallet) WalletSign

func (m MultiWallet) WalletSign(ctx context.Context, signer address.Address, toSign []byte, meta api.MsgMeta) (*crypto.Signature, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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