wallets

package
v0.0.0-...-131cf77 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: LGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WalletStatusLocked   = "Locked"
	WalletStatusUnlocked = "Unlocked"
)
View Source
const DbWalletFile = "wallets.db"

Variables

View Source
var (
	ErrAccountNotExists = errors.New("account not exists")
	ErrInvalidAuth      = errors.New("invalid authentication code")
	ErrAccountIsLocked  = errors.New("account is locked")
)

Functions

func NewRandomKey

func NewRandomKey() (*keystore.Key, error)

func NewRandomMnemonic

func NewRandomMnemonic() (string, error)

func Sign

func Sign(msg []byte, privKey *ecdsa.PrivateKey) (sig []byte, err error)

func SignMessage

func SignMessage(msg []byte, privKey *ecdsa.PrivateKey) (sig []byte, err error)

func Verify

func Verify(msg, sig []byte) (*ecdsa.PublicKey, error)

Types

type Manager

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

func NewManager

func NewManager() (*Manager, error)

NewManager returns wallets Manager instance

func (*Manager) AddWallet

func (m *Manager) AddWallet(key *keystore.Key, auth string) (*Wallet, error)

func (*Manager) DbSize

func (m *Manager) DbSize() (int64, int64)

func (*Manager) Exists

func (m *Manager) Exists(ctx context.Context, address common.Address) error

func (*Manager) GetAllAddresses

func (m *Manager) GetAllAddresses() ([]common.Address, error)

func (*Manager) GetWallet

func (m *Manager) GetWallet(address common.Address, auth string) (*Wallet, error)

func (*Manager) Shutdown

func (m *Manager) Shutdown()

type Wallet

type Wallet struct {
	Auth    string `json:"auth" yaml:"auth"`
	KeyData []byte `json:"-" yaml:"-"` // stores encrypted key
	// contains filtered or unexported fields
}

func (*Wallet) Address

func (w *Wallet) Address() common.Address

func (*Wallet) Deserialize

func (w *Wallet) Deserialize(data []byte) error

func (*Wallet) EncryptKey

func (w *Wallet) EncryptKey() error

func (*Wallet) GetKey

func (w *Wallet) GetKey() *keystore.Key

func (*Wallet) Open

func (w *Wallet) Open() error

func (*Wallet) Serialize

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

func (*Wallet) SignTx

func (w *Wallet) SignTx(tx *types.Transaction) (*types.Transaction, error)

func (*Wallet) Status

func (w *Wallet) Status() string

Jump to

Keyboard shortcuts

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