components

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: ISC Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Uint32Size    = 32 // 32 or 64 ? shifting 32-bit value by 32 bits will always clear it
	MaxInt32      = 1<<(Uint32Size-1) - 1
	WalletsPageID = "Wallets"
)
View Source
const (
	// MinSeedBytes is the minimum number of bytes allowed for a seed.
	MinSeedBytes = 16

	// MaxSeedBytes is the maximum number of bytes allowed for a seed.
	MaxSeedBytes = 64
)
View Source
const AssetTypeSelectorID = "AssetTypeSelectorID"
View Source
const CreateRestorePageID = "Restore"
View Source
const (
	CreateWalletID = "create_wallet"
)
View Source
const (
	SeedRestorePageID = "seed_restore"
)
View Source
const WalletAndAccountSelectorID = "WalletAndAccountSelector"
View Source
const WalletSyncInfoID = "WalletSyncInfo"

Variables

This section is empty.

Functions

func CoinImageBySymbol

func CoinImageBySymbol(l *load.Load, assetType libutils.AssetType, isWatchOnly bool) *cryptomaterial.Image

CoinImageBySymbol returns image widget for supported asset coins.

func ConditionalFlexedRigidLayout added in v1.1.0

func ConditionalFlexedRigidLayout(flexWeight float32, isMobileView bool, content layout.Widget) layout.FlexChild

ConditionalFlexedRigidLayout decides whether to use layout.Rigid or layout.Flexed

func ContextDone

func ContextDone(ctx context.Context) bool

done returns whether the context's Done channel was closed due to cancellation or exceeded deadline.

func DisableLog

func DisableLog()

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

func FormatDateOrTime

func FormatDateOrTime(timestamp int64) string

func GetBackButton added in v1.1.0

func GetBackButton(l *load.Load) cryptomaterial.IconButton

func GetServerIcon added in v1.1.0

func GetServerIcon(theme *cryptomaterial.Theme, serverName string) *cryptomaterial.Image

GetServerIcon returns the icon for the provided server name.

func GetTicketPurchaseAccount

func GetTicketPurchaseAccount(selectedWallet *dcr.Asset) (acct *sharedW.Account, err error)

GetTicketPurchaseAccount returns the validly set ticket purchase account if it exists.

func GoToURL

func GoToURL(url string)

func HorizontalInset added in v1.1.0

func HorizontalInset(v unit.Dp) layout.Inset

HorizontalInset creates an inset with the specified amount applied uniformly to both the left and right edges. This function is useful for ensuring consistent horizontal padding or margin around elements, without affecting the vertical spacing.

func IconButton added in v1.1.0

func IconButton(icon *widget.Icon, txt string, inset layout.Inset, th *cryptomaterial.Theme, clickable *cryptomaterial.Clickable) func(gtx C) D

IconButton creates the display for an icon button. The default icon and text color is Theme.Color.Primary.

func InputsNotEmpty

func InputsNotEmpty(editors ...*widget.Editor) bool

InputsNotEmpty checks if all the provided editors have non-empty text.

func LayoutBalance

func LayoutBalance(gtx layout.Context, l *load.Load, amount string) layout.Dimensions

LayoutBalance aligns the main and sub DCR balances horizontally, putting the sub balance at the baseline of the row.

func LayoutBalanceColor

func LayoutBalanceColor(gtx layout.Context, l *load.Load, amount string, color color.NRGBA) layout.Dimensions

func LayoutBalanceColorWithState added in v1.1.0

func LayoutBalanceColorWithState(gtx layout.Context, l *load.Load, amount string, color color.NRGBA) layout.Dimensions

func LayoutBalanceColorWithStateUSD added in v1.1.0

func LayoutBalanceColorWithStateUSD(gtx layout.Context, l *load.Load, amount string, color color.NRGBA) layout.Dimensions

func LayoutBalanceCustom added in v1.1.0

func LayoutBalanceCustom(gtx layout.Context, l *load.Load, amount string, mainTextSize unit.Sp, isBold bool) layout.Dimensions

func LayoutBalanceSize

func LayoutBalanceSize(gtx layout.Context, l *load.Load, amount string, mainTextSize unit.Sp) layout.Dimensions

func LayoutBalanceWithState added in v1.1.0

func LayoutBalanceWithState(gtx layout.Context, l *load.Load, amount string) layout.Dimensions

func LayoutBalanceWithStateSemiBold added in v1.1.0

func LayoutBalanceWithStateSemiBold(gtx layout.Context, l *load.Load, amount string) layout.Dimensions

func LayoutBalanceWithStateUSD added in v1.1.0

func LayoutBalanceWithStateUSD(gtx layout.Context, l *load.Load, amount string) layout.Dimensions

func LayoutBalanceWithUnit

func LayoutBalanceWithUnit(gtx layout.Context, l *load.Load, amount string) layout.Dimensions

func LayoutBalanceWithUnitSize

func LayoutBalanceWithUnitSize(gtx layout.Context, l *load.Load, amount string, mainTextSize unit.Sp) layout.Dimensions

func LayoutBalanceWithUnitSizeBoldText added in v1.1.0

func LayoutBalanceWithUnitSizeBoldText(gtx layout.Context, l *load.Load, amount string, mainTextSize unit.Sp) layout.Dimensions

func LayoutNavigationBar added in v1.1.0

func LayoutNavigationBar(gtx layout.Context, theme *cryptomaterial.Theme, navItems []NavBarItem) layout.Dimensions

func LoadOrders

func LoadOrders(l *load.Load, offset, limit int32, newestFirst bool, server, searchKey string, status ...api.Status) []*instantswap.Order

func RetryFunc

func RetryFunc(retryAttempts int, sleepDur time.Duration, funcDesc string, errFunc func() error) (int, error)

RetryFunc implements retry policy for processes that needs to be executed after initial failure.

func SecondsToDays

func SecondsToDays(totalTimeLeft int64) string

SecondsToDays takes time in seconds and returns its string equivalent in the format ddhhmm.

func SeedWordsToHex

func SeedWordsToHex(seedWords string) (string, error)

func TimeAgo

func TimeAgo(timestamp int64) string

func TimeFormat

func TimeFormat(secs int, long bool) string

func TruncateString

func TruncateString(str string, num int) string

func TxConfirmations

func TxConfirmations(wallet sharedW.Asset, transaction *sharedW.Transaction) int32

func TxPageDropDownFields

func TxPageDropDownFields(wType libutils.AssetType, tabIndex int) (mapInfo map[string]int32, keysInfo []string)

TxPageDropDownFields returns the fields for the required drop down with the transactions view page. Since maps access of items order is always random an array of keys is provided to guarantee the dropdown order will always be maintained.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

func VerticalInset added in v1.1.0

func VerticalInset(v unit.Dp) layout.Inset

VerticalInset creates an inset with the specified amount applied uniformly to both the top and bottom edges. This function is useful for ensuring consistent vetical padding or margin around elements, without affecting the horizontal spacing.

Types

type AssetTypeItem

type AssetTypeItem struct {
	Type libutils.AssetType
	Icon *cryptomaterial.Image
	// contains filtered or unexported fields
}

assetTypeItem wraps the asset type in a clickable.

type AssetTypeSelector

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

AssetTypeSelector models a wiget for use for selecting asset types.

func NewAssetTypeSelector

func NewAssetTypeSelector(l *load.Load) *AssetTypeSelector

NewAssetTypeSelector creates an assetType selector component. It opens a modal to select a desired assetType.

func (*AssetTypeSelector) AssetTypeSelected

func (ats *AssetTypeSelector) AssetTypeSelected(callback func(*AssetTypeItem) bool) *AssetTypeSelector

AssetTypeSelected sets the callback executed when an asset type is selected.

func (*AssetTypeSelector) DisableBorder

func (ats *AssetTypeSelector) DisableBorder() *AssetTypeSelector

DisableBorder will disable border on layout selected Asset type.

func (*AssetTypeSelector) Handle

func (ats *AssetTypeSelector) Handle(window app.WindowNavigator)

func (*AssetTypeSelector) Layout

func (ats *AssetTypeSelector) Layout(window app.WindowNavigator, gtx C) D

func (AssetTypeSelector) OnDismiss

func (atm AssetTypeSelector) OnDismiss()

func (AssetTypeSelector) OnResume

func (atm AssetTypeSelector) OnResume()

func (*AssetTypeSelector) SelectedAssetType

func (ats *AssetTypeSelector) SelectedAssetType() *libutils.AssetType

SelectedAssetType returns the currently selected Asset type.

func (*AssetTypeSelector) SetBackground

func (ats *AssetTypeSelector) SetBackground(background color.NRGBA) *AssetTypeSelector

SetBackground sets the asset background colour

func (*AssetTypeSelector) SetHint

func (ats *AssetTypeSelector) SetHint(hint string) *AssetTypeSelector

SetHint sets hint for selector

func (*AssetTypeSelector) SetSelectedAssetType

func (ats *AssetTypeSelector) SetSelectedAssetType(assetType libutils.AssetType)

SetSelectedAssetType sets assetType as the current selected asset type.

func (*AssetTypeSelector) SupportedAssetTypes

func (ats *AssetTypeSelector) SupportedAssetTypes() []*AssetTypeItem

SupportedAssetTypes returns a slice containing all the asset types Currently supported.

func (*AssetTypeSelector) Title

func (ats *AssetTypeSelector) Title(title string) *AssetTypeSelector

Title Sets the title of the asset type list dialog.

type BottomNavigationBar

type BottomNavigationBar struct {
	*load.Load

	FloatingActionButton  []BottomNavigationBarHandler
	BottomNavigationItems []BottomNavigationBarHandler
	CurrentPage           string
	// contains filtered or unexported fields
}

func (*BottomNavigationBar) LayoutBottomNavigationBar

func (bottomNavigationbar *BottomNavigationBar) LayoutBottomNavigationBar(gtx layout.Context) layout.Dimensions

func (*BottomNavigationBar) LayoutSendReceive

func (bottomNavigationbar *BottomNavigationBar) LayoutSendReceive(gtx layout.Context) layout.Dimensions

func (*BottomNavigationBar) OnViewCreated

func (bottomNavigationbar *BottomNavigationBar) OnViewCreated()

type BottomNavigationBarHandler

type BottomNavigationBarHandler struct {
	Clickable     *cryptomaterial.Clickable
	Image         *cryptomaterial.Image
	ImageInactive *cryptomaterial.Image
	Title         string
	PageID        string
}

type C

type C = layout.Context

type ConsensusItem

type ConsensusItem struct {
	Agenda     *dcr.Agenda
	VoteButton cryptomaterial.Button
}

func LoadAgendas

func LoadAgendas(l *load.Load, dcrWallet *dcr.Asset, newestFirst bool) []*ConsensusItem

type Container

type Container struct {
	Padding layout.Inset
}

Container is simply a wrapper for the Inset type. Its purpose is to differentiate the use of an inset as a padding or margin, making it easier to visualize the structure of a layout when reading UI code.

func (Container) Layout

func (c Container) Layout(gtx C, w layout.Widget) D

type CreateWallet added in v1.1.0

type CreateWallet struct {
	*load.Load
	// GenericPageModal defines methods such as ID() and OnAttachedToNavigator()
	// that helps this Page satisfy the app.Page interface. It also defines
	// helper methods for accessing the PageNavigator that displayed this page
	// and the root WindowNavigator.
	*app.GenericPageModal
	// contains filtered or unexported fields
}

func NewCreateWallet added in v1.1.0

func NewCreateWallet(l *load.Load, walletCreationSuccessCallback func(), assetType ...libutils.AssetType) *CreateWallet

func (*CreateWallet) HandleUserInteractions added in v1.1.0

func (pg *CreateWallet) HandleUserInteractions()

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. Part of the load.Page interface.

func (*CreateWallet) Layout added in v1.1.0

func (pg *CreateWallet) Layout(gtx C) D

Layout draws the page UI components into the provided C to be eventually drawn on screen. Part of the load.Page interface.

func (*CreateWallet) OnNavigatedFrom added in v1.1.0

func (pg *CreateWallet) OnNavigatedFrom()

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. Part of the load.Page interface.

func (*CreateWallet) OnNavigatedTo added in v1.1.0

func (pg *CreateWallet) OnNavigatedTo()

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. Part of the load.Page interface.

type CummulativeWalletsBalance

type CummulativeWalletsBalance struct {
	Total                   sharedW.AssetAmount
	Spendable               sharedW.AssetAmount
	ImmatureReward          sharedW.AssetAmount
	ImmatureStakeGeneration sharedW.AssetAmount
	LockedByTickets         sharedW.AssetAmount
	VotingAuthority         sharedW.AssetAmount
	UnConfirmed             sharedW.AssetAmount
}

CummulativeWalletsBalance defines total balance for all available wallets.

func CalculateMixedAccountBalance

func CalculateMixedAccountBalance(selectedWallet *dcr.Asset) (*CummulativeWalletsBalance, error)

func CalculateTotalWalletsBalance

func CalculateTotalWalletsBalance(wallet sharedW.Asset) (*CummulativeWalletsBalance, error)

type D

type D = layout.Dimensions

func AgendaItemWidget

func AgendaItemWidget(gtx C, l *load.Load, consensusItem *ConsensusItem, hasVotingWallet bool) D

func BrowserURLWidget

func BrowserURLWidget(gtx C, l *load.Load, url string, copyRedirect *cryptomaterial.Clickable) D

func DisablePageWithOverlay

func DisablePageWithOverlay(l *load.Load, currentPage app.Page, gtx C, title, subtitle string, actionButton *cryptomaterial.Button) D

DisablePageWithOverlay disables the provided page by highlighting a message why the page is disabled and adding a background color overlay that blocks any page event being triggered.

func EndToEndRow

func EndToEndRow(gtx C, leftWidget, rightWidget func(C) D) D

EndToEndRow layouts out its content on both ends of its horizontal layout.

func FlexLayout added in v1.1.0

func FlexLayout(gtx C, options FlexOptions, widgets []func(gtx C) D) D

func LayoutIconAndTextWithSize added in v1.1.0

func LayoutIconAndTextWithSize(l *load.Load, gtx C, text string, col color.NRGBA, size unit.Sp, iconSize unit.Dp) D

func LayoutNoAgendasFound

func LayoutNoAgendasFound(gtx C, l *load.Load, syncing bool) D

func LayoutNoOrderHistoryWithMsg added in v1.1.0

func LayoutNoOrderHistoryWithMsg(gtx C, l *load.Load, syncing bool, msg string) D

func LayoutNoPoliciesFound

func LayoutNoPoliciesFound(gtx C, l *load.Load, syncing bool) D

func LayoutNoProposalsFound

func LayoutNoProposalsFound(gtx C, l *load.Load, syncing bool, category int32) D

func LayoutOrderAmount

func LayoutOrderAmount(l *load.Load, gtx C, assetType string, amount float64) D

func LayoutTransactionRow

func LayoutTransactionRow(gtx C, l *load.Load, wal sharedW.Asset, tx *sharedW.Transaction, hideTxAssetInfo bool) D

LayoutTransactionRow is a single transaction row on the transactions and overview page. It lays out a transaction's direction, balance, status. hideTxAssetInfo determines if the transaction should display additional information about the tx such as the wallet the tx belong to etc. This is useful on pages where the tx is displayed from multi wallets.

func OrderItemWidget

func OrderItemWidget(gtx C, l *load.Load, orderItem *instantswap.Order) D

func ProposalsList

func ProposalsList(gtx C, l *load.Load, prop *ProposalItem) D
func SetWalletLogo(l *load.Load, gtx C, assetType libutils.AssetType, size unit.Dp) D

func TreasuryItemWidget

func TreasuryItemWidget(gtx C, l *load.Load, treasuryItem *TreasuryItem) D

func UniformHorizontalPadding

func UniformHorizontalPadding(gtx C, body layout.Widget) D

func UniformMobile

func UniformMobile(gtx C, isHorizontal, withList bool, body layout.Widget) D

func UniformPadding

func UniformPadding(gtx C, body layout.Widget) D

func WalletHighlightLabel added in v1.1.0

func WalletHighlightLabel(theme *cryptomaterial.Theme, gtx C, textSize unit.Sp, content string) D

type DexServer

type DexServer struct {
	SavedHosts map[string][]byte
}

type FeeRateSelector

type FeeRateSelector struct {
	*load.Load

	// SaveRate is a material button to trigger save tx fee rate.
	SaveRate cryptomaterial.Button

	// EstSignedSize holds the estimated size of signed tx.
	EstSignedSize string
	// TxFee stores the estimated transaction fee for a tx.
	TxFee string
	// TxFeeUSD stores the estimated tx fee in USD.
	TxFeeUSD string

	// USDExchangeSet determines if this component will in addition
	// to the TxFee show the USD rate of fee.
	USDExchangeSet bool
	// contains filtered or unexported fields
}

FeeRateSelector represent a tx fee selector UI component.

func NewFeeRateSelector

func NewFeeRateSelector(l *load.Load, callback walletTypeCallbackFunc) *FeeRateSelector

NewFeeRateSelector create and return an instance of FeeRateSelector. Since the feeRate selector can be used before the selected wallet is set a Load independent callback function is provided to help address that case scenario.

func (*FeeRateSelector) Layout

func (fs *FeeRateSelector) Layout(gtx C) D

Layout draws the UI components.

func (*FeeRateSelector) OnEditRateClicked

func (fs *FeeRateSelector) OnEditRateClicked(selectedWallet sharedW.Asset)

OnEditRateCliked is called when the edit feerate button is clicked.

func (*FeeRateSelector) SetFeerate

func (fs *FeeRateSelector) SetFeerate(rateInt int64)

SetFeerate updates the fee rate in use upstream.

func (*FeeRateSelector) ShowSizeAndCost

func (fs *FeeRateSelector) ShowSizeAndCost() *FeeRateSelector

ShowSizeAndCost turns the showSizeAndCost Field to true the component will show the estimated size and Fee when showSizeAndCost is true.backupLaterbackupLater

func (*FeeRateSelector) UpdatedFeeRate added in v1.1.0

func (fs *FeeRateSelector) UpdatedFeeRate(selectedWallet sharedW.Asset)

FetchFeeRate will fetch the fee rate from the HTTP API.

type FlexOptions added in v1.1.0

type FlexOptions struct {
	Axis      layout.Axis
	Spacing   layout.Spacing
	Alignment layout.Alignment
	WeightSum float32
}

type MixerComponent added in v1.1.0

type MixerComponent struct {
	*load.Load

	WalletName,
	UnmixedBalance string

	Width,
	Height int

	ForwardButton,
	InfoButton cryptomaterial.IconButton
}

func (MixerComponent) MixerLayout added in v1.1.0

func (mc MixerComponent) MixerLayout(gtx C) D
type NavBarItem struct {
	Clickable *cryptomaterial.Clickable
	Image     *cryptomaterial.Image
	Title     string
	PageID    string
}

type ProgressInfo added in v1.1.0

type ProgressInfo struct {
	HeadersToFetchOrScan int32
	// contains filtered or unexported fields
}

type ProposalItem

type ProposalItem struct {
	Proposal libwallet.Proposal
	// contains filtered or unexported fields
}

func LoadProposals

func LoadProposals(l *load.Load, category, offset, pageSize int32, newestFirst bool, key string) []*ProposalItem

type ReleaseResponse added in v1.1.2

type ReleaseResponse struct {
	TagName string `json:"tag_name"`
	URL     string `json:"html_url"`
}

func CheckForUpdate added in v1.1.2

func CheckForUpdate(l *load.Load) *ReleaseResponse

CheckForUpdate checks if a new version of the app is available by comparing the current version with the latest release version available on GitHub.

type Reload added in v1.1.0

type Reload func()

type Restore added in v1.1.0

type Restore struct {
	*load.Load
	// GenericPageModal defines methods such as ID() and OnAttachedToNavigator()
	// that helps this Page satisfy the app.Page interface. It also defines
	// helper methods for accessing the ParentNavigator that displayed this page
	// and the root WindowNavigator. The ParentNavigator is also the root
	// WindowNavigator if this page is displayed from the StartPage, otherwise
	// the ParentNavigator is the MainPage.
	*app.GenericPageModal
	// contains filtered or unexported fields
}

func NewRestorePage added in v1.1.0

func NewRestorePage(l *load.Load, walletName string, walletType libutils.AssetType, onRestoreComplete func()) *Restore

func (*Restore) HandleKeyPress added in v1.1.0

func (pg *Restore) HandleKeyPress(evt *key.Event)

HandleKeyPress is called when one or more keys are pressed on the current window that match any of the key combinations returned by KeysToHandle(). Satisfies the load.KeyEventHandler interface for receiving key events.

func (*Restore) HandleUserInteractions added in v1.1.0

func (pg *Restore) HandleUserInteractions()

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. Part of the load.Page interface.

func (*Restore) KeysToHandle added in v1.1.0

func (pg *Restore) KeysToHandle() key.Set

KeysToHandle returns an expression that describes a set of key combinations that this page wishes to capture. The HandleKeyPress() method will only be called when any of these key combinations is pressed. Satisfies the load.KeyEventHandler interface for receiving key events.

func (*Restore) Layout added in v1.1.0

func (pg *Restore) Layout(gtx C) D

Layout draws the page UI components into the provided C to be eventually drawn on screen. Part of the load.Page interface.

func (*Restore) OnNavigatedFrom added in v1.1.0

func (pg *Restore) OnNavigatedFrom()

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. Part of the load.Page interface.

func (*Restore) OnNavigatedTo added in v1.1.0

func (pg *Restore) OnNavigatedTo()

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. Part of the load.Page interface.

type Scroll

type Scroll[T any] struct {
	// contains filtered or unexported fields
}

func NewScroll

func NewScroll[T any](load *load.Load, pageSize int32, queryFunc ScrollFunc[T]) *Scroll[T]

NewScroll returns a new scroll items component.

func (*Scroll[T]) FetchScrollData

func (s *Scroll[T]) FetchScrollData(isScrollUp bool, window app.WindowNavigator, isResetList bool)

FetchScrollData is a mutex protected fetchScrollData function. At the end of the function call a window reload is triggered. Returns that latest records.

func (*Scroll[T]) FetchedData

func (s *Scroll[T]) FetchedData() []T

FetchedData returns the latest queried data.

func (*Scroll[T]) ItemsCount

func (s *Scroll[T]) ItemsCount() int

ItemsCount returns the count of the last fetched items.

func (*Scroll[T]) List

func (s *Scroll[T]) List() *cryptomaterial.ListStyle

List returns the list theme already in existence or newly created. Multiple list instances shouldn't exist for a given scroll component.

func (*Scroll[T]) OnScrollChangeListener

func (s *Scroll[T]) OnScrollChangeListener(window app.WindowNavigator)

OnScrollChangeListener listens for the scroll bar movement and update the items list view accordingly. FetchScrollData needs to be invoked first before calling this function.

func (*Scroll[T]) SetIsHaveKeySearch added in v1.1.0

func (s *Scroll[T]) SetIsHaveKeySearch(isHaveKeySearch bool)

type ScrollFunc

type ScrollFunc[T any] func(offset, pageSize int32) (data []T, count int, isReset bool, err error)

ScrollFunc is a query function that accepts offset and pagesize parameters and returns data interface, count of the items in the data interface, isReset and an error. isReset is used to reset the offset value.

type SeedRestore added in v1.1.0

type SeedRestore struct {
	*load.Load
	// GenericPageModal defines methods such as ID() and OnAttachedToNavigator()
	// that helps this Page satisfy the app.Page interface. It also defines
	// helper methods for accessing the ParentNavigator that displayed this page
	// and the root WindowNavigator. The ParentNavigator is also the root
	// WindowNavigator if this page is displayed from the StartPage, otherwise
	// the ParentNavigator is the MainPage.
	*app.GenericPageModal
	// contains filtered or unexported fields
}

func NewSeedRestorePage added in v1.1.0

func NewSeedRestorePage(l *load.Load, walletName string, walletType libutils.AssetType, onRestoreComplete func()) *SeedRestore

func (*SeedRestore) HandleKeyPress added in v1.1.0

func (pg *SeedRestore) HandleKeyPress(evt *key.Event)

HandleKeyPress is called when one or more keys are pressed on the current window that match any of the key combinations returned by KeysToHandle(). Satisfies the load.KeyEventHandler interface for receiving key events.

func (*SeedRestore) HandleUserInteractions added in v1.1.0

func (pg *SeedRestore) HandleUserInteractions()

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. Part of the load.Page interface.

func (*SeedRestore) ID added in v1.1.0

func (pg *SeedRestore) ID() string

ID is a unique string that identifies the page and may be used to differentiate this page from other pages. Part of the load.Page interface.

func (*SeedRestore) KeysToHandle added in v1.1.0

func (pg *SeedRestore) KeysToHandle() key.Set

KeysToHandle returns an expression that describes a set of key combinations that this page wishes to capture. The HandleKeyPress() method will only be called when any of these key combinations is pressed. Satisfies the load.KeyEventHandler interface for receiving key events.

func (*SeedRestore) Layout added in v1.1.0

func (pg *SeedRestore) Layout(gtx C) D

Layout draws the page UI components into the provided layout context to be eventually drawn on screen. Part of the load.Page interface.

func (*SeedRestore) OnNavigatedFrom added in v1.1.0

func (pg *SeedRestore) OnNavigatedFrom()

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. Part of the load.Page interface.

func (*SeedRestore) OnNavigatedTo added in v1.1.0

func (pg *SeedRestore) OnNavigatedTo()

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. Part of the load.Page interface.

func (*SeedRestore) SetParentNav added in v1.1.0

func (pg *SeedRestore) SetParentNav(window app.WindowNavigator)

type SelectAssetEditor

type SelectAssetEditor struct {
	*load.Load
	Edit              cryptomaterial.Editor
	AssetTypeSelector *AssetTypeSelector
}

func NewSelectAssetEditor

func NewSelectAssetEditor(l *load.Load) *SelectAssetEditor

func (SelectAssetEditor) Layout

func (sae SelectAssetEditor) Layout(window app.WindowNavigator, gtx C) D

type SelectorItem

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

SelectorItem models a wallet or an account along with it's clickable.

type SubPage

type SubPage struct {
	*load.Load
	Title        string
	SubTitle     string
	Back         func()
	Body         layout.Widget
	InfoTemplate string
	ExtraItem    *cryptomaterial.Clickable
	Extra        layout.Widget
	ExtraText    string
	HandleExtra  func()
	ExtraHeader  layout.Widget

	BackButton cryptomaterial.IconButton
	InfoButton cryptomaterial.IconButton
}

func (*SubPage) CombinedLayout

func (sp *SubPage) CombinedLayout(window app.WindowNavigator, gtx C) D

func (*SubPage) EventHandler

func (sp *SubPage) EventHandler(window app.WindowNavigator)

func (*SubPage) Header

func (sp *SubPage) Header(window app.WindowNavigator, gtx C) D

func (*SubPage) Layout

func (sp *SubPage) Layout(window app.WindowNavigator, gtx C) D

func (*SubPage) LayoutWithHeadCard added in v1.1.0

func (sp *SubPage) LayoutWithHeadCard(window app.WindowNavigator, gtx C) D

type TreasuryItem

type TreasuryItem struct {
	Policy            dcr.TreasuryKeyPolicy
	OptionsRadioGroup *widget.Enum
	VoteChoices       [3]string
	SetChoiceButton   cryptomaterial.Button
}

func LoadPolicies

func LoadPolicies(l *load.Load, selectedDCRWallet *dcr.Asset, pikey string) []*TreasuryItem

func (*TreasuryItem) SetVoteChoices

func (t *TreasuryItem) SetVoteChoices(voteChoices [3]string)

type TxStatus

type TxStatus struct {
	Title string
	Icon  *cryptomaterial.Image

	// tx purchase only
	TicketStatus       string
	Color              color.NRGBA
	ProgressBarColor   color.NRGBA
	ProgressTrackColor color.NRGBA
	Background         color.NRGBA
}

func TransactionTitleIcon

func TransactionTitleIcon(l *load.Load, wal sharedW.Asset, tx *sharedW.Transaction) *TxStatus

type VSPSelector

type VSPSelector struct {
	*load.Load
	// contains filtered or unexported fields
}

func NewVSPSelector

func NewVSPSelector(l *load.Load, dcrWallet *dcr.Asset) *VSPSelector

func (*VSPSelector) Changed

func (v *VSPSelector) Changed() bool

func (*VSPSelector) Layout

func (v *VSPSelector) Layout(window app.WindowNavigator, gtx C) D

func (*VSPSelector) SelectVSP

func (v *VSPSelector) SelectVSP(vspHost string)

func (*VSPSelector) SelectedVSP

func (v *VSPSelector) SelectedVSP() *dcr.VSP

func (*VSPSelector) Title

func (v *VSPSelector) Title(title string) *VSPSelector

type VoteBar

type VoteBar struct {
	*load.Load

	BottomExtra layout.Widget
	// contains filtered or unexported fields
}

VoteBar widget implements voting stat for proposals. VoteBar shows the range/percentage of the yes votes and no votes against the total required.

func NewVoteBar

func NewVoteBar(l *load.Load) *VoteBar

func (*VoteBar) Layout

func (v *VoteBar) Layout(gtx C) D

func (*VoteBar) SetBottomLayout added in v1.1.0

func (v *VoteBar) SetBottomLayout(lay layout.Widget) *VoteBar

func (*VoteBar) SetDisableInfoTitle added in v1.1.0

func (v *VoteBar) SetDisableInfoTitle(isDisable bool) *VoteBar

func (*VoteBar) SetProposalDetails

func (v *VoteBar) SetProposalDetails(numComment int32, publishedAt int64, token string) *VoteBar

func (*VoteBar) SetVoteValidityParams

func (v *VoteBar) SetVoteValidityParams(eligibleVotes, requiredPercentage, passPercentage float32) *VoteBar

func (*VoteBar) SetYesNoVoteParams

func (v *VoteBar) SetYesNoVoteParams(yesVotes, noVotes float32) *VoteBar

type WalletAndAccountSelector

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

func NewWalletAndAccountSelector

func NewWalletAndAccountSelector(l *load.Load, assetType ...utils.AssetType) *WalletAndAccountSelector

NewWalletAndAccountSelector creates a wallet selector component. It opens a modal to select a desired wallet or a desired account.

func (*WalletAndAccountSelector) AccountSelected

func (ws *WalletAndAccountSelector) AccountSelected(callback func(*sharedW.Account)) *WalletAndAccountSelector

func (*WalletAndAccountSelector) AccountValidator

func (ws *WalletAndAccountSelector) AccountValidator(accountIsValid func(*sharedW.Account) bool) *WalletAndAccountSelector

AccountValidator validates an account according to the rules defined to determine a valid a account.

func (*WalletAndAccountSelector) Changed

func (ws *WalletAndAccountSelector) Changed() bool

func (*WalletAndAccountSelector) Clickable

func (WalletAndAccountSelector) Count added in v1.1.0

func (sm WalletAndAccountSelector) Count() int

return the count of wallets and accounts

func (*WalletAndAccountSelector) EnableWatchOnlyWallets

func (ws *WalletAndAccountSelector) EnableWatchOnlyWallets(isEnable bool) *WalletAndAccountSelector

EnableWatchOnlyWallets enables selection of watchOnly wallets and their accounts.

func (*WalletAndAccountSelector) Handle

func (ws *WalletAndAccountSelector) Handle(window app.WindowNavigator)

func (*WalletAndAccountSelector) Layout

func (ws *WalletAndAccountSelector) Layout(window app.WindowNavigator, gtx C) D

func (*WalletAndAccountSelector) ListenForTxNotifications

func (ws *WalletAndAccountSelector) ListenForTxNotifications(window app.WindowNavigator)

ListenForTxNotifications listens for transaction and block updates and updates the selector modal, if the modal is open at the time of the update. The tx update listener MUST be unregistered using ws.StopTxNtfnListener() when the page using this WalletAndAccountSelector widget is exited.

func (WalletAndAccountSelector) OnDismiss

func (sm WalletAndAccountSelector) OnDismiss()

func (WalletAndAccountSelector) OnResume

func (sm WalletAndAccountSelector) OnResume()

func (*WalletAndAccountSelector) ResetAccount

func (ws *WalletAndAccountSelector) ResetAccount()

func (*WalletAndAccountSelector) SelectAccount

func (ws *WalletAndAccountSelector) SelectAccount(wallet sharedW.Asset, accountNumber int32) error

func (*WalletAndAccountSelector) SelectFirstValidAccount

func (ws *WalletAndAccountSelector) SelectFirstValidAccount(wallet sharedW.Asset) error

SelectFirstValidAccount transforms this widget into an Account selector and selects the first valid account from the the wallet passed to this method.

func (*WalletAndAccountSelector) SelectedAccount

func (ws *WalletAndAccountSelector) SelectedAccount() *sharedW.Account

SelectedAccount returns the currently selected account.

func (*WalletAndAccountSelector) SelectedAsset

func (ws *WalletAndAccountSelector) SelectedAsset() utils.AssetType

func (*WalletAndAccountSelector) SelectedWallet

func (ws *WalletAndAccountSelector) SelectedWallet() sharedW.Asset

func (*WalletAndAccountSelector) SetActionInfoText

func (ws *WalletAndAccountSelector) SetActionInfoText(text string) *WalletAndAccountSelector

SetActionInfoText sets the text that is shown when the info action icon of the selector modal is is clicked. The {text} is rendered using a html renderer. So HTML text can be passed in.

func (*WalletAndAccountSelector) SetBorder added in v1.1.0

func (ws *WalletAndAccountSelector) SetBorder(isHaveBorder bool)

func (*WalletAndAccountSelector) SetError

func (ws *WalletAndAccountSelector) SetError(errMsg string)

func (*WalletAndAccountSelector) SetHideBalance added in v1.1.0

func (ws *WalletAndAccountSelector) SetHideBalance(isHide bool)

func (*WalletAndAccountSelector) SetLeftAlignment added in v1.1.0

func (ws *WalletAndAccountSelector) SetLeftAlignment(isLeft bool)

func (*WalletAndAccountSelector) SetSelectedAccount

func (ws *WalletAndAccountSelector) SetSelectedAccount(account *sharedW.Account)

func (*WalletAndAccountSelector) SetSelectedAsset

func (ws *WalletAndAccountSelector) SetSelectedAsset(assetType ...utils.AssetType) bool

SetSelectedAsset sets the specified assetType and returns true if the asset has at least one wallet.

func (*WalletAndAccountSelector) SetSelectedWallet

func (ws *WalletAndAccountSelector) SetSelectedWallet(wallet sharedW.Asset)

func (*WalletAndAccountSelector) StopTxNtfnListener added in v1.1.0

func (ws *WalletAndAccountSelector) StopTxNtfnListener()

func (*WalletAndAccountSelector) Title

func (*WalletAndAccountSelector) WalletSelected

func (ws *WalletAndAccountSelector) WalletSelected(callback func(sharedW.Asset)) *WalletAndAccountSelector

func (*WalletAndAccountSelector) WalletValidator added in v1.1.0

func (ws *WalletAndAccountSelector) WalletValidator(walletIsValid func(sharedW.Asset) bool) *WalletAndAccountSelector

WalletValidator validates a wallet according to the rules defined to determine a valid a wallet.

type WalletSyncInfo added in v1.1.0

type WalletSyncInfo struct {
	*load.Load

	ForwardButton cryptomaterial.IconButton

	IsSlider bool
	// contains filtered or unexported fields
}

func NewWalletSyncInfo added in v1.1.0

func NewWalletSyncInfo(l *load.Load, wallet sharedW.Asset, reload Reload, backup func(sharedW.Asset)) *WalletSyncInfo

func (*WalletSyncInfo) FetchSyncProgress added in v1.1.0

func (wsi *WalletSyncInfo) FetchSyncProgress() ProgressInfo

func (*WalletSyncInfo) GetWallet added in v1.1.0

func (wsi *WalletSyncInfo) GetWallet() sharedW.Asset

func (*WalletSyncInfo) Init added in v1.1.0

func (wsi *WalletSyncInfo) Init()

func (*WalletSyncInfo) ListenForNotifications added in v1.1.0

func (wsi *WalletSyncInfo) ListenForNotifications()

ListenForNotifications starts a goroutine to watch for sync updates and update the UI accordingly. To prevent UI lags, this method does not refresh the window display every time a sync update is received. During active blocks sync, rescan or proposals sync, the Layout method auto refreshes the display every set interval. Other sync updates that affect the UI but occur outside of an active sync requires a display refresh. The caller of this method must ensure that the StopListeningForNotifications() method is called whenever the the page or modal using these notifications is closed.

func (*WalletSyncInfo) StopListeningForNotifications added in v1.1.0

func (wsi *WalletSyncInfo) StopListeningForNotifications()

StopListeningForNotifications stops listening for sync progress, tx and block notifications.

func (*WalletSyncInfo) WalletInfoLayout added in v1.1.0

func (wsi *WalletSyncInfo) WalletInfoLayout(gtx C) D

Jump to

Keyboard shortcuts

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