backend

package
v4.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 40 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccountAlreadyExists = errors.New("already exists")

ErrAccountAlreadyExists is returned if an account is being added which already exists.

View Source
var (
	// Version of the backend as displayed to the user.
	Version = semver.NewSemVer(4, 4, 0)
)

Functions

This section is empty.

Types

type AccountEvent

type AccountEvent struct {
	Type string `json:"type"`
	Code string `json:"code"`
	Data string `json:"data"`
}

AccountEvent models an event triggered by an account.

type Backend

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

Backend ties everything together and is the main starting point to use the BitBox wallet library.

func NewBackend

func NewBackend(arguments *arguments.Arguments) *Backend

NewBackend creates a new backend with the given arguments.

func (*Backend) Accounts

func (backend *Backend) Accounts() []accounts.Interface

Accounts returns the current accounts of the backend.

func (*Backend) AccountsStatus

func (backend *Backend) AccountsStatus() string

AccountsStatus returns whether the accounts have been initialized.

func (*Backend) CheckElectrumServer

func (backend *Backend) CheckElectrumServer(server string, pemCert string) error

CheckElectrumServer checks if a tls connection can be established with the electrum server, and whether the server is an electrum server.

func (*Backend) Coin

func (backend *Backend) Coin(code string) (coin.Coin, error)

Coin returns the coin with the given code or an error if no such coin exists.

func (*Backend) Config

func (backend *Backend) Config() *config.Config

Config returns the app config.

func (*Backend) CreateAndAddAccount

func (backend *Backend) CreateAndAddAccount(
	coin coin.Coin,
	code string,
	name string,
	getSigningConfiguration func() (*signing.Configuration, error),
	persist bool,
) error

CreateAndAddAccount creates an account with the given parameters and adds it to the backend. If persist is true, the configuration is fetched and saved in the accounts configuration.

func (*Backend) DefaultAppConfig

func (backend *Backend) DefaultAppConfig() config.AppConfig

DefaultAppConfig returns the default app config.y

func (*Backend) Deregister

func (backend *Backend) Deregister(deviceID string)

Deregister deregisters the device with the given ID from this backend.

func (*Backend) DeregisterKeystore

func (backend *Backend) DeregisterKeystore()

DeregisterKeystore removes the registered keystore.

func (*Backend) DevicesRegistered

func (backend *Backend) DevicesRegistered() map[string]device.Interface

DevicesRegistered returns a map of device IDs to device of registered devices.

func (*Backend) DownloadCert

func (backend *Backend) DownloadCert(server string) (string, error)

DownloadCert downloads the first element of the remote certificate chain.

func (*Backend) Events

func (backend *Backend) Events() <-chan interface{}

Events returns the push notifications channel.

func (*Backend) Keystores

func (backend *Backend) Keystores() *keystore.Keystores

Keystores returns the keystores registered at this backend.

func (*Backend) OnAccountInit

func (backend *Backend) OnAccountInit(f func(accounts.Interface))

OnAccountInit installs a callback to be called when an account is initialized.

func (*Backend) OnAccountUninit

func (backend *Backend) OnAccountUninit(f func(accounts.Interface))

OnAccountUninit installs a callback to be called when an account is stopped.

func (*Backend) OnDeviceInit

func (backend *Backend) OnDeviceInit(f func(device.Interface))

OnDeviceInit installs a callback to be called when a device is initialized.

func (*Backend) OnDeviceUninit

func (backend *Backend) OnDeviceUninit(f func(string))

OnDeviceUninit installs a callback to be called when a device is uninitialized.

func (*Backend) Rates

func (backend *Backend) Rates() map[string]map[string]float64

Rates return the latest rates.

func (*Backend) Register

func (backend *Backend) Register(theDevice device.Interface) error

Register registers the given device at this backend.

func (*Backend) RegisterKeystore

func (backend *Backend) RegisterKeystore(keystore keystore.Keystore)

RegisterKeystore registers the given keystore at this backend.

func (*Backend) RegisterTestKeystore

func (backend *Backend) RegisterTestKeystore(pin string)

RegisterTestKeystore adds a keystore derived deterministically from a PIN, for convenience in devmode.

func (*Backend) Start

func (backend *Backend) Start() <-chan interface{}

Start starts the background services. It returns a channel of events to handle by the library client.

func (*Backend) Testing

func (backend *Backend) Testing() bool

Testing returns whether this backend is for testing only.

func (*Backend) UserLanguage

func (backend *Backend) UserLanguage() language.Tag

UserLanguage returns the language the UI should be presented in to the user.

type RatesUpdater

type RatesUpdater struct {
	observable.Implementation
	// contains filtered or unexported fields
}

RatesUpdater implements coin.RatesUpdater.

func GetRatesUpdaterInstance

func GetRatesUpdaterInstance() *RatesUpdater

GetRatesUpdaterInstance gets a singleton instance of RatesUpdater.

func NewRatesUpdater

func NewRatesUpdater() *RatesUpdater

NewRatesUpdater returns a new rates updater.

func (*RatesUpdater) Last

func (updater *RatesUpdater) Last() map[string]map[string]float64

Last returns the last rates for a given coin and fiat or nil if not available.

type UpdateFile

type UpdateFile struct {
	// CurrentVersion stores the current version and is not loaded from the server.
	CurrentVersion *semver.SemVer `json:"current"`

	// NewVersion stores the new version and may not be nil.
	NewVersion *semver.SemVer `json:"version"`

	// Description gives additional information on the release.
	Description string `json:"description"`
}

UpdateFile is retrieved from the server.

func CheckForUpdate

func CheckForUpdate() (*UpdateFile, error)

CheckForUpdate checks whether a newer version of this application has been released. It returns the retrieved update file if a newer version has been released and nil otherwise.

func CheckForUpdateIgnoringErrors

func CheckForUpdateIgnoringErrors() *UpdateFile

CheckForUpdateIgnoringErrors suppresses any errors that are triggered, for example, when offline.

Directories

Path Synopsis
coins
btc
btc/electrum/client
Package client implements an Electrum JSON RPC client.
Package client implements an Electrum JSON RPC client.
btc/maketx
Package maketx provides transaction creation code for wallets.
Package maketx provides transaction creation code for wallets.
eth
ltc
devices
bitbox
Package bitbox contains the API to the physical device.
Package bitbox contains the API to the physical device.
usb

Jump to

Keyboard shortcuts

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