load

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: ISC Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// godcr config keys
	HideBalanceConfigKey             = "hide_balance"
	AutoSyncConfigKey                = "autoSync"
	LanguagePreferenceKey            = "app_language"
	DarkModeConfigKey                = "dark_mode"
	FetchProposalConfigKey           = "fetch_proposals"
	SeedBackupNotificationConfigKey  = "seed_backup_notification"
	ProposalNotificationConfigKey    = "proposal_notification_key"
	TransactionNotificationConfigKey = "transaction_notification_key"
)
View Source
const MaxInt32 = 1<<(Uint32Size-1) - 1
View Source
const Uint32Size = 32 << (^uint32(0) >> 32 & 1) // 32 or 64

Variables

View Source
var ErrIDNotExist = errors.New("ID does not exist")

ErrIDNotExist is returned when a given ID does not exist

Functions

func DCRToUSD

func DCRToUSD(exchangeRate, dcr float64) float64

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func FormatUSDBalance

func FormatUSDBalance(p *message.Printer, balance float64) string

func GetUSDExchangeValue

func GetUSDExchangeValue(target interface{}) error

func USDToDCR

func USDToDCR(exchangeRate, usd float64) float64

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type AppSettingsChangeHandler added in v1.7.0

type AppSettingsChangeHandler interface {
	// OnDarkModeChanged is triggered whenever the dark mode setting is changed
	// to enable restyling UI elements where necessary.
	OnDarkModeChanged(bool)
	// OnCurrencyChanged is triggered whenever the currency setting is changed
	// to enable app refresh where necessary especially on the main page.
	OnCurrencyChanged()
	// OnLanguageChanged is triggered whenever the language setting is changed
	// to enable UI language update where necessary especially on page Nav
	OnLanguageChanged()
}

AppSettingsChangeHandler defines a method that can be implemented by pages and modals to watch for real-time changes to the dark mode setting and modify widget appearance accordingly.

type DCRUSDTBittrex

type DCRUSDTBittrex struct {
	LastTradeRate string
}

type Load

type Load struct {
	Theme *decredmaterial.Theme

	WL       *WalletLoad
	Receiver *Receiver
	Printer  *message.Printer
	Network  string

	Toast *notification.Toast

	SelectedUTXO map[int]map[int32]map[string]*wallet.UnspentOutput

	ToggleSync          func()
	RefreshWindow       func()
	ShowModal           func(Modal)
	DismissModal        func(Modal)
	ChangeWindowPage    func(page Page, keepBackStack bool)
	PopWindowPage       func() bool
	ChangeFragment      func(page Page)
	PopFragment         func()
	PopToFragment       func(pageID string)
	SubscribeKeyEvent   func(eventChan chan *key.Event, pageID string) // Widgets call this function to recieve key events.
	UnsubscribeKeyEvent func(pageID string) error
	ReloadApp           func()

	DarkModeSettingChanged func(bool)
	LanguageSettingChanged func()
	CurrencySettingChanged func()
}

func (*Load) Dexc added in v1.7.0

func (l *Load) Dexc() *dcrlibwallet.DexClient

func (*Load) RefreshTheme

func (l *Load) RefreshTheme()
type Modal interface {
	ModalID() string
	OnResume()
	Layout(gtx layout.Context) layout.Dimensions
	OnDismiss()
	Dismiss()
	Show()
	Handle()
}

type Page

type Page interface {
	// ID is a unique string that identifies the page and may be used
	// to differentiate this page from other pages.
	ID() string
	// OnNavigatedTo is called when the page is about to be displayed and
	// may be used to initialize page features that are only relevant when
	// the page is displayed.
	OnNavigatedTo()
	// HandleUserInteractions is called just before Layout() to determine
	// if any user interaction recently occurred on the page and may be
	// used to update the page's UI components shortly before they are
	// displayed.
	HandleUserInteractions()
	// Layout draws the page UI components into the provided layout context
	// to be eventually drawn on screen.
	Layout(layout.Context) layout.Dimensions
	// OnNavigatedFrom is called when the page is about to be removed from
	// the displayed window. This method should ideally be used to disable
	// features that are irrelevant when the page is NOT displayed.
	// NOTE: The page may be re-displayed on the app's window, in which case
	// OnNavigatedTo() will be called again. This method should not destroy UI
	// components unless they'll be recreated in the OnNavigatedTo() method.
	OnNavigatedFrom()
}

Page defines methods that control the appearance and functionality of UI components displayed on a window.

type Receiver

type Receiver struct {
	KeyEvents map[string]chan *key.Event
}

type WalletLoad

type WalletLoad struct {
	MultiWallet *dcrlibwallet.MultiWallet
	TxAuthor    dcrlibwallet.TxAuthor

	UnspentOutputs *wallet.UnspentOutputs
	Wallet         *wallet.Wallet

	SelectedWallet  *int
	SelectedAccount *int
}

func (*WalletLoad) DataSize

func (wl *WalletLoad) DataSize() string

func (*WalletLoad) HDPrefix

func (wl *WalletLoad) HDPrefix() string

func (*WalletLoad) SortedWalletList

func (wl *WalletLoad) SortedWalletList() []*dcrlibwallet.Wallet

func (*WalletLoad) SpendableWalletBalance

func (wl *WalletLoad) SpendableWalletBalance(walletID int) (dcrutil.Amount, error)

func (*WalletLoad) TotalWalletBalance

func (wl *WalletLoad) TotalWalletBalance(walletID int) (dcrutil.Amount, error)

func (*WalletLoad) TotalWalletsBalance

func (wl *WalletLoad) TotalWalletsBalance() (dcrutil.Amount, error)

func (*WalletLoad) WalletDirectory

func (wl *WalletLoad) WalletDirectory() string

Jump to

Keyboard shortcuts

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