v2

package
v0.4.3-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCmpConfig added in v0.4.3

func ReadCmpConfig(path string) (*cmp.Config, error)

Read CmpConfig reads a CmpConfig from the specified file path in the BIP32 file system.

Types

type Account

type Account interface {
	// Address returns the address of the account based on the coin type
	Address() string

	// CoinType returns the coin type of the account
	CoinType() crypto.CoinType

	// DID returns the DID of the account
	DID() string

	// ListKeyshares returns a list of keyshares for the account
	ListKeyshares() ([]KeyShare, error)

	// Name returns the name of the account
	Name() string

	// Path returns the path of the account
	Path() string

	// PartyIDs returns the party IDs of the account
	PartyIDs() []crypto.PartyID

	// PubKey returns secp256k1 public key
	PubKey() *crypto.PubKey

	// Rename renames the account
	Rename(name string) error

	// Signs a message
	Sign(bz []byte) ([]byte, error)

	// Type returns the type of the account
	Type() string

	// Verifies a signature
	Verify(bz []byte, sig []byte) (bool, error)
}

Account is an interface for an account in the wallet

func NewWalletAccount added in v0.4.3

func NewWalletAccount(p string) (Account, error)

NewWalletAccount loads an accound directory and returns a WalletAccount

type FileStore added in v0.4.3

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

func NewFileStore added in v0.4.3

func NewFileStore(p string) (*FileStore, error)

func (*FileStore) ListAccounts added in v0.4.3

func (fs *FileStore) ListAccounts() (map[crypto.CoinType][]Account, error)

GetAccountNames returns a list of all account names for each supported coin in the BIP32 file system.

func (*FileStore) ListAccountsForToken added in v0.4.3

func (fs *FileStore) ListAccountsForToken(coinType crypto.CoinType) ([]Account, error)

ListAccountNames returns a list of all account names in the BIP32 file system.

func (*FileStore) WriteCmpConfigs added in v0.4.3

func (fs *FileStore) WriteCmpConfigs(ct crypto.CoinType, cmpConfigs []*cmp.Config) (Account, error)

WriteCmpConfig writes a CmpConfig to the BIP32 file system.

type KeyShare added in v0.4.3

type KeyShare interface {
	// Path returns the path to the file.
	Path() string

	// Config returns the cmp.Config.
	Config() *cmp.Config

	// CoinType returns the coin type based on the account directories parent
	CoinType() crypto.CoinType

	// AccountName returns the account name based on the account directory name
	AccountName() string
}

KeyShare is a type that interacts with a cmp.Config file located on disk.

func NewKeyshare added in v0.4.3

func NewKeyshare(path string) (KeyShare, error)

NewKeyshare creates a new KeyShare.

type Wallet added in v0.4.3

type Wallet interface {
	// Get the wallet's controller
	Controller() string

	// CreateAccount creates a new account for the given coin type
	CreateAccount(coin crypto.CoinType) (Account, error)

	// ListAllocatedCoins returns a list of coins that this currently has accounts for
	ListCoins() ([]crypto.CoinType, error)

	// ListAccounts returns a list of accounts for the given coin type
	ListAccounts() (map[crypto.CoinType][]Account, error)

	// ListAccountsForCoin returns a list of accounts for the given coin type
	ListAccountsForCoin(coin crypto.CoinType) ([]Account, error)

	// GetAccount returns the account for the given coin type and account name
	GetAccount(coin crypto.CoinType, name string) (Account, error)

	// GetAccountByAddress returns the account for the given address and parses the coin type from the address
	GetAccountByAddress(address string) (Account, error)

	// GetAccountByDID returns the account for the given DID and parses the coin type from the DID
	GetAccountByDID(did string) (Account, error)

	// GetAccountByPublicKey returns the account for the given public key and parses the coin type from the public key
	GetAccountByPublicKey(key string) (Account, error)
}

func NewWallet added in v0.4.3

func NewWallet(currentId string, threshold int) (Wallet, error)

Directories

Path Synopsis
controller
tx

Jump to

Keyboard shortcuts

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