smWallet

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PublicKey

func PublicKey(key ed25519.PrivateKey) ed25519.PublicKey

PublicKey retrieves public key from private

Types

type Wallet

type Wallet struct {
	Meta   walletMetadata      `json:"meta"`
	Crypto walletEncryptedData `json:"crypto"`
	// contains filtered or unexported fields
}

Wallet is the basic data structure.

func LoadWallet

func LoadWallet(keystore string) (w *Wallet, err error)

LoadWallet returns a wallet object for an existing file copy of a wallet

func NewWallet

func NewWallet(walletName, password string) (w *Wallet, err error)

NewWallet returns a brand shiny new wallet with random seed and mnemonic phrase

func (*Wallet) AddContact

func (w *Wallet) AddContact(nickname string, address types.Address) error

func (*Wallet) CurrentAccount

func (w *Wallet) CurrentAccount() (*account, error)

func (*Wallet) GenerateNewPair

func (w *Wallet) GenerateNewPair(displayName string) (int, error)

GenerateNewPair - add a new pair based on mnemonic key phrase

func (*Wallet) GetAccountDisplayName

func (w *Wallet) GetAccountDisplayName(accountNumber int) (string, error)

GetAccountDisplayName retrieves an account name from a wallet (if unlocked and account exists)

func (*Wallet) GetAddress

func (w *Wallet) GetAddress(accountNumber int) (types.Address, error)

GetAddress retrieves an address from a wallet if unlocked and it has been generated

func (Wallet) GetMnemonic

func (w Wallet) GetMnemonic() (string, error)

GetMnemonic returns the mnemonic string associated with the wallet

func (Wallet) GetNumberOfAccounts

func (w Wallet) GetNumberOfAccounts() (int, error)

GetNumberOfAccounts returns the number of accounts held in said wallet

func (*Wallet) GetPrivateKey

func (w *Wallet) GetPrivateKey(accountNumber int) (ed25519.PrivateKey, error)

GetPrivateKey retrieve the private key

func (*Wallet) GetPublicKey

func (w *Wallet) GetPublicKey(accountNumber int) (ed25519.PublicKey, error)

GetPublicKey retrieves an address from a wallet if unlocked and it has been generated

func (*Wallet) SaveWallet

func (w *Wallet) SaveWallet() (err error)

SaveWallet saves a file only if it already has a filename

func (*Wallet) SaveWalletAs

func (w *Wallet) SaveWalletAs(keystorePrefix string) (err error)

SaveWalletAs saves a wallet to a file and records the filename internally

func (*Wallet) SetCurrent

func (w *Wallet) SetCurrent(accountNumber int) error

SetCurrent - set current wallet by number

func (*Wallet) SignedTransaction

func (w *Wallet) SignedTransaction(t *types.Transaction) ([]byte, error)

SignedTransaction turns a transaction into a signed transaction :-)

func (*Wallet) Unlock

func (w *Wallet) Unlock(password string) (err error)

Unlock a previously unlocked wallet

func (*Wallet) WalletPath

func (w *Wallet) WalletPath() string

Jump to

Keyboard shortcuts

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