remoteclient

package
v0.0.0-...-acf744c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInput

type AppInput struct {
	Command   string
	Address   string
	ToAddress string
	Amount    float64
	NodePort  int
	NodeHost  string
	ConfigDir string
	Nodes     []net.NodeAddr
	LogDest   string
	SQL       string
	Filepath  string
}

type Wallet

type Wallet struct {
	PrivateKey ecdsa.PrivateKey
	PublicKey  []byte
}

Wallet stores private and public keys

func MakeWalletFromEncoded

func MakeWalletFromEncoded(pubkeyenc, prikeyenc string) (wallet Wallet, err error)

func (Wallet) GetAddress

func (w Wallet) GetAddress() []byte

GetAddress returns wallet address

func (Wallet) GetPrivateKey

func (w Wallet) GetPrivateKey() ecdsa.PrivateKey

Reurns private key of a wallet

func (Wallet) GetPrivateKeyEncoded

func (w Wallet) GetPrivateKeyEncoded() string

Encode PrivateKey to string.

func (Wallet) GetPublicKey

func (w Wallet) GetPublicKey() []byte

Returns public key of a wallet

func (Wallet) GetPublicKeyEncoded

func (w Wallet) GetPublicKeyEncoded() string

Encode PubKey to string. We will use this for easy storing in a file

func (*Wallet) MakeWallet

func (w *Wallet) MakeWallet()

MakeWallet creates Wallet. It generates new keys pair and assign to the object

func (Wallet) ValidateAddress

func (w Wallet) ValidateAddress(address string) bool

ValidateAddress check if address is valid, has valid format

type WalletBalance

type WalletBalance struct {
	Total    float64
	Approved float64
	Pending  float64
}

type WalletCLI

type WalletCLI struct {
	Input      AppInput
	Node       net.NodeAddr
	ConfigDir  string
	Nodes      []net.NodeAddr
	NodeCLI    *nodeclient.NodeClient
	WalletsObj *Wallets
	NodeMode   bool
	Logger     *utils.LoggerMan
}

func (*WalletCLI) ExecuteCommand

func (wc *WalletCLI) ExecuteCommand() error

Executes command based on input arguments

func (*WalletCLI) Init

func (wc *WalletCLI) Init(logger *utils.LoggerMan, input AppInput)

Init wallet client object. This will manage execution of tasks related to a wallet

type Wallets

type Wallets struct {
	ConfigDir string

	Wallets map[string]*Wallet

	Logger *utils.LoggerMan

	WalletsFile string
}

Wallets stores a collection of wallets

func NewWallets

func NewWallets(confdir string) Wallets

func (*Wallets) CreateWallet

func (ws *Wallets) CreateWallet() (string, error)

CreateWallet adds a Wallet to Wallets

func (*Wallets) ExportWallet

func (ws *Wallets) ExportWallet(filepath string) error

Export wallets to external file. It is just a copy of wallets file

func (*Wallets) GetAddresses

func (ws *Wallets) GetAddresses() []string

GetAddresses returns an array of addresses stored in the wallet file

func (Wallets) GetWallet

func (ws Wallets) GetWallet(address string) (Wallet, error)

GetWallet returns a Wallet by its address

func (*Wallets) ImportWallet

func (ws *Wallets) ImportWallet(filepath string) ([]string, error)

Import wallets from external file

func (*Wallets) LoadFromFile

func (ws *Wallets) LoadFromFile() error

LoadFromFile loads wallets from the file

func (Wallets) SaveToFile

func (ws Wallets) SaveToFile() error

SaveToFile saves wallets to a file

type WalletsFile

type WalletsFile struct {
	Wallets []WalletsFileRec
}

type WalletsFileRec

type WalletsFileRec struct {
	Address    string
	PubKey     string
	PrivateKey string
}

Jump to

Keyboard shortcuts

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