accounts

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NodeConfigTag tag for a node configuration.
	NodeConfigTag = "node_config"
)

Variables

View Source
var (
	// ErrWalletNotUnique returned if another account has `wallet` field set to true.
	ErrWalletNotUnique = errors.New("another account is set to be default wallet. disable it before using new")
	// ErrChatNotUnique returned if another account has `chat` field set to true.
	ErrChatNotUnique = errors.New("another account is set to be default chat. disable it before using new")
	// ErrInvalidConfig returned if config isn't allowed
	ErrInvalidConfig = errors.New("configuration value not allowed")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	Address   types.Address  `json:"address"`
	Wallet    bool           `json:"wallet"`
	Chat      bool           `json:"chat"`
	Type      string         `json:"type,omitempty"`
	Storage   string         `json:"storage,omitempty"`
	Path      string         `json:"path,omitempty"`
	PublicKey types.HexBytes `json:"public-key,omitempty"`
	Name      string         `json:"name"`
	Color     string         `json:"color"`
}

type Database

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

Database sql wrapper for operations with browser objects.

func NewDB

func NewDB(db *sql.DB) *Database

func (*Database) AddressExists

func (db *Database) AddressExists(address types.Address) (exists bool, err error)

AddressExists returns true if given address is stored in database.

func (Database) Close

func (db Database) Close() error

Close closes database.

func (*Database) CreateSettings added in v0.38.4

func (db *Database) CreateSettings(s Settings, nodecfg params.NodeConfig) error

func (*Database) DeleteAccount added in v0.38.1

func (db *Database) DeleteAccount(address types.Address) error

func (*Database) GetAccounts

func (db *Database) GetAccounts() ([]Account, error)

func (*Database) GetAddresses

func (db *Database) GetAddresses() (rst []types.Address, err error)

func (*Database) GetChatAddress

func (db *Database) GetChatAddress() (rst types.Address, err error)

func (*Database) GetNodeConfig added in v0.38.4

func (db *Database) GetNodeConfig(nodecfg interface{}) error

func (*Database) GetSettings added in v0.38.4

func (db *Database) GetSettings() (Settings, error)

func (*Database) GetWalletAddress

func (db *Database) GetWalletAddress() (rst types.Address, err error)

func (*Database) SaveAccounts

func (db *Database) SaveAccounts(accounts []Account) (err error)

func (*Database) SaveSetting added in v0.38.4

func (db *Database) SaveSetting(setting string, value interface{}) error

nolint: gocyclo

type Settings added in v0.38.4

type Settings struct {
	// required
	Address                types.Address    `json:"address"`
	ChaosMode              bool             `json:"chaos-mode?,omitempty"`
	Currency               string           `json:"currency,omitempty"`
	CurrentNetwork         string           `json:"networks/current-network"`
	CustomBootnodes        *json.RawMessage `json:"custom-bootnodes,omitempty"`
	CustomBootnodesEnabled *json.RawMessage `json:"custom-bootnodes-enabled?,omitempty"`
	DappsAddress           types.Address    `json:"dapps-address"`
	EIP1581Address         types.Address    `json:"eip1581-address"`
	Fleet                  *string          `json:"fleet,omitempty"`
	HideHomeTooltip        bool             `json:"hide-home-tooltip?,omitempty"`
	InstallationID         string           `json:"installation-id"`
	KeyUID                 string           `json:"key-uid"`
	KeycardInstanceUID     string           `json:"keycard-instance-uid,omitempty"`
	KeycardPAiredOn        int64            `json:"keycard-paired-on,omitempty"`
	KeycardPairing         string           `json:"keycard-pairing,omitempty"`
	LastUpdated            *int64           `json:"last-updated,omitempty"`
	LatestDerivedPath      uint             `json:"latest-derived-path"`
	LogLevel               *string          `json:"log-level,omitempty"`
	Mnemonic               string           `json:"mnemonic,omitempty"`
	Name                   string           `json:"name,omitempty"`
	Networks               *json.RawMessage `json:"networks/networks"`
	NotificationsEnabled   bool             `json:"notifications-enabled?,omitempty"`
	PhotoPath              string           `json:"photo-path"`
	PinnedMailserver       *json.RawMessage `json:"pinned-mailservers,omitempty"`
	PreferredName          *string          `json:"preferred-name,omitempty"`
	PreviewPrivacy         bool             `json:"preview-privacy?"`
	PublicKey              string           `json:"public-key"`
	RememberSyncingChoice  bool             `json:"remember-syncing-choice?,omitempty"`
	SigningPhrase          string           `json:"signing-phrase"`
	StickerPacksInstalled  *json.RawMessage `json:"stickers-packs-installed,omitempty"`
	StickersRecentStickers *json.RawMessage `json:"stickers-recent-stickers,omitempty"`
	SyncingOnMobileNetwork bool             `json:"syncing-on-mobile-network?,omitempty"`
	Usernames              *json.RawMessage `json:"usernames,omitempty"`
	WalletRootAddress      types.Address    `json:"wallet-root-address,omitempty"`
	WalletSetUpPassed      bool             `json:"wallet-set-up-passed?,omitempty"`
	WalletVisibleTokens    *json.RawMessage `json:"wallet/visible-tokens,omitempty"`
}

Jump to

Keyboard shortcuts

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