wallet

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorInvalidTypeSpecified = errors.New("Invalid account type specified.")
View Source
var ErrorNameCollision = errors.New("Account with name already exists.")
View Source
var ErrorNoEncryptedKeyFound = errors.New("No encrypted key found.")
View Source
var ErrorNoPrivateKeySet = errors.New("No private key is set.")
View Source
var ErrorNoSaltSetError = errors.New("No salt is set.")

Functions

func Fake

func Fake(db *datastore.Datastore) (*Wallet, *Account, string)

func Query

Types

type Account

type Account struct {
	Encrypted string `json:"encrypted"`
	Salt      string `json:"salt"`

	Name       string `json:"name"`
	PrivateKey string `json:"-" datastore:"-"`
	PublicKey  string `json:"-"`
	Address    string `json:"address,omitempty"`

	// Can this account be withdrawn from?  This is on the org.
	Withdrawable bool             `json:"-"`
	Deleted      bool             `json:"-"`
	Type         blockchains.Type `json:"type"`

	CreatedAt time.Time `json:"createdAt,omitempty"`

	// Ignore these, this is deprecated
	TestNetAddress string `json:"-"`
	AddressBackup  string `json:"-"`
}

func (*Account) Decrypt

func (a *Account) Decrypt(withPassword []byte) error

Decrypt the Account's Private Key

func (*Account) Delete

func (a *Account) Delete()

func (*Account) Encrypt

func (a *Account) Encrypt(withPassword []byte) error

Encrypt the Account's Private Key

type Wallet

type Wallet struct {
	mixin.Model[Wallet]

	Accounts []Account `json:"accounts,omitempty"`
}

func New

func New(db *datastore.Datastore) *Wallet

func (*Wallet) CreateAccount

func (w *Wallet) CreateAccount(name string, typ blockchains.Type, withPassword []byte) (*Account, error)

Create a new Account, saves if wallet is created

func (*Wallet) Defaults

func (w *Wallet) Defaults()

func (*Wallet) GetAccountByName

func (w *Wallet) GetAccountByName(name string) (*Account, bool)

type WalletHolder

type WalletHolder struct {
	WalletId string  `json:"walletId"`
	Wallet   *Wallet `json:"wallet,omitempty" datastore:"-"`
}

func (*WalletHolder) GetOrCreateWallet

func (w *WalletHolder) GetOrCreateWallet(db *datastore.Datastore) (*Wallet, error)

func (*WalletHolder) LoadWallet

func (w *WalletHolder) LoadWallet(db *datastore.Datastore) error

Jump to

Keyboard shortcuts

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