Documentation ¶
Index ¶
- Constants
- func ConvertVotes(votes []*ProposalVote) []*politeia.ProposalVote
- func DefaultRateRequestAmt(fromCurrency string) float64
- func Log(m string)
- func LogT(tag, m string)
- func RegisterLogger(tag string) (slog.Logger, error)
- func SetLogLevels(logLevel string)
- func UseLogger(logger slog.Logger)
- type Assets
- type AssetsManager
- func (mgr *AssetsManager) AllAssetTypes() []utils.AssetType
- func (mgr *AssetsManager) AllBTCWallets() (wallets []sharedW.Asset)
- func (mgr *AssetsManager) AllDCRWallets() (wallets []sharedW.Asset)
- func (mgr *AssetsManager) AllLTCWallets() (wallets []sharedW.Asset)
- func (mgr *AssetsManager) AllVoteAgendas(newestFirst bool) ([]*dcr.Agenda, error)
- func (mgr *AssetsManager) AllWallets() (wallets []sharedW.Asset)
- func (mgr *AssetsManager) AssetWallets(assetTypes ...utils.AssetType) []sharedW.Asset
- func (mgr *AssetsManager) BTCBadWallets() map[int]*sharedW.Wallet
- func (mgr *AssetsManager) BTCHDPrefix() string
- func (mgr *AssetsManager) BTCWalletWithSeed(seedMnemonic string) (int, error)
- func (mgr *AssetsManager) BTCWalletWithXPub(xpub string) (int, error)
- func (mgr *AssetsManager) BlockExplorerURLForTx(assetType utils.AssetType, txHash string) string
- func (mgr *AssetsManager) CalculateAssetsUSDBalance(balances map[utils.AssetType]sharedW.AssetAmount) (map[utils.AssetType]float64, error)
- func (mgr *AssetsManager) CalculateTotalAssetsBalance(includeWatchWallet bool) (map[utils.AssetType]sharedW.AssetAmount, error)
- func (mgr *AssetsManager) ChangeStartupPassphrase(oldPassphrase, newPassphrase string, passphraseType int32) error
- func (mgr *AssetsManager) ClearExchangeConfig()
- func (mgr *AssetsManager) CreateNewBTCWallet(walletName, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
- func (mgr *AssetsManager) CreateNewBTCWatchOnlyWallet(walletName, extendedPublicKey string) (sharedW.Asset, error)
- func (mgr *AssetsManager) CreateNewDCRWallet(walletName, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
- func (mgr *AssetsManager) CreateNewDCRWatchOnlyWallet(walletName, extendedPublicKey string) (sharedW.Asset, error)
- func (mgr *AssetsManager) CreateNewLTCWallet(walletName, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
- func (mgr *AssetsManager) CreateNewLTCWatchOnlyWallet(walletName, extendedPublicKey string) (sharedW.Asset, error)
- func (mgr *AssetsManager) DCRBadWallets() map[int]*sharedW.Wallet
- func (mgr *AssetsManager) DCRHDPrefix() string
- func (mgr *AssetsManager) DCRWalletWithSeed(seedMnemonic string) (int, error)
- func (mgr *AssetsManager) DCRWalletWithXPub(xpub string) (int, error)
- func (mgr *AssetsManager) DEXCInitialized() bool
- func (mgr *AssetsManager) DeleteBadWallet(walletID int) error
- func (mgr *AssetsManager) DeleteDEXData() error
- func (mgr *AssetsManager) DeleteWallet(walletID int, privPass string) error
- func (mgr *AssetsManager) DexClient() DEXClient
- func (mgr *AssetsManager) ExchangeRateFetchingEnabled() bool
- func (mgr *AssetsManager) GetCurrencyConversionExchange() string
- func (mgr *AssetsManager) GetDexServers() (map[string][]byte, error)
- func (mgr *AssetsManager) GetExchangeConfig() *sharedW.ExchangeConfig
- func (mgr *AssetsManager) GetLanguagePreference() string
- func (mgr *AssetsManager) GetLogLevels() string
- func (mgr *AssetsManager) GetShedulerRuntime() string
- func (mgr *AssetsManager) GetUserAgent() string
- func (mgr *AssetsManager) InitializeDEX(ctx context.Context)
- func (mgr *AssetsManager) IsDarkModeOn() bool
- func (mgr *AssetsManager) IsExchangeConfigSet() bool
- func (mgr *AssetsManager) IsHTTPAPIPrivacyModeOff(apiType utils.HTTPAPIType) bool
- func (mgr *AssetsManager) IsOrderSchedulerRunning() bool
- func (mgr *AssetsManager) IsPrivacyModeOn() bool
- func (mgr *AssetsManager) IsStartupSecuritySet() bool
- func (mgr *AssetsManager) IsTotalBalanceVisible() bool
- func (mgr *AssetsManager) IsTransactionNotificationsOn() bool
- func (mgr *AssetsManager) LTCBadWallets() map[int]*sharedW.Wallet
- func (mgr *AssetsManager) LTCHDPrefix() string
- func (mgr *AssetsManager) LTCWalletWithSeed(seedMnemonic string) (int, error)
- func (mgr *AssetsManager) LTCWalletWithXPub(xpub string) (int, error)
- func (mgr *AssetsManager) LoadedWalletsCount() int32
- func (mgr *AssetsManager) LogDir() string
- func (mgr *AssetsManager) LogFile() string
- func (mgr *AssetsManager) NetType() utils.NetworkType
- func (mgr *AssetsManager) OpenWallets(startupPassphrase string) error
- func (mgr *AssetsManager) OpenedWalletsCount() int32
- func (mgr *AssetsManager) PiKeys() [][]byte
- func (mgr *AssetsManager) ReadBoolValue(key string, value bool) bool
- func (mgr *AssetsManager) RemoveStartupPassphrase(oldPassphrase string) error
- func (mgr *AssetsManager) RestoreBTCWallet(walletName, seedMnemonic, privatePassphrase string, ...) (sharedW.Asset, error)
- func (mgr *AssetsManager) RestoreDCRWallet(walletName, seedMnemonic, privatePassphrase string, ...) (sharedW.Asset, error)
- func (mgr *AssetsManager) RestoreLTCWallet(walletName, seedMnemonic, privatePassphrase string, ...) (sharedW.Asset, error)
- func (mgr *AssetsManager) RestoreWallet(walletType utils.AssetType, walletName, seedMnemonic, privatePassphrase string, ...) (sharedW.Asset, error)
- func (mgr *AssetsManager) RootDir() string
- func (mgr *AssetsManager) RootDirFileSizeInBytes(dataDir string) (int64, error)
- func (mgr *AssetsManager) SaveDexServers(servers map[string][]byte)
- func (mgr *AssetsManager) SetBoolValue(key string, value bool)
- func (mgr *AssetsManager) SetCurrencyConversionExchange(xc string)
- func (mgr *AssetsManager) SetDarkMode(data bool)
- func (mgr *AssetsManager) SetExchangeConfig(data sharedW.ExchangeConfig)
- func (mgr *AssetsManager) SetHTTPAPIPrivacyMode(apiType utils.HTTPAPIType, isActive bool)
- func (mgr *AssetsManager) SetLanguagePreference(lang string)
- func (mgr *AssetsManager) SetLogLevels(logLevel string)
- func (mgr *AssetsManager) SetPrivacyMode(isActive bool)
- func (mgr *AssetsManager) SetStartupPassphrase(passphrase string, passphraseType int32) error
- func (mgr *AssetsManager) SetTotalBalanceVisibility(data bool)
- func (mgr *AssetsManager) SetTransactionsNotifications(data bool)
- func (mgr *AssetsManager) SetUserAgent(data string)
- func (mgr *AssetsManager) Shutdown()
- func (mgr *AssetsManager) StartScheduler(ctx context.Context, params instantswap.SchedulerParams) error
- func (mgr *AssetsManager) StopScheduler()
- func (mgr *AssetsManager) VerifyStartupPassphrase(startupPassphrase string) error
- func (mgr *AssetsManager) WalletWithID(walletID int) sharedW.Asset
- func (mgr *AssetsManager) WalletWithSeed(walletType utils.AssetType, seedMnemonic string) (int, error)
- func (mgr *AssetsManager) WalletWithXPub(walletType utils.AssetType, xPub string) (int, error)
- type DEXClient
- type EligibleTicket
- type Politeia
- type Proposal
- type ProposalOverview
- type ProposalVote
- type ProposalVoteDetails
Constants ¶
const ( // Mainnet represents the main network. Mainnet = utils.Mainnet // Testnet3 represents the test network. Testnet = utils.Testnet )
const ( // BTCBlockTime is the average time it takes to mine a block on the BTC network. BTCBlockTime = 10 * time.Minute // DCRBlockTime is the average time it takes to mine a block on the DCR network. DCRBlockTime = 5 * time.Minute // DefaultMarketDeviation is the maximum deviation the server rate // can deviate from the market rate. DefaultMarketDeviation = 5 // 5% // DefaultConfirmations is the number of confirmations required DefaultConfirmations = 1 // DefaultRateRequestAmount is the amount used to perform the rate request query. DefaultRateRequestAmount = 1 DefaultRateRequestBTC = 0.01 DefaultRateRequestLTC = 1 DefaultRateRequestDCR = 10 )
const ( // PoliteiaMainnetHost is the politeia mainnet host. PoliteiaMainnetHost = politeia.PoliteiaMainnetHost // PoliteiaTestnetHost is the politeia testnet host. PoliteiaTestnetHost = politeia.PoliteiaTestnetHost // VoteBitYes is the string value for identifying "yes" vote bits. VoteBitYes = politeia.VoteBitYes // VoteBitNo is the string value for identifying "no" vote bits. VoteBitNo = politeia.VoteBitNo // ProposalCategoryAll is the int value for identifying all proposals. ProposalCategoryAll = politeia.ProposalCategoryAll // ProposalCategoryPre is the int value for identifying pre proposals. ProposalCategoryPre = politeia.ProposalCategoryPre // ProposalCategoryActive is the int value for identifying active proposals. ProposalCategoryActive = politeia.ProposalCategoryActive // ProposalCategoryApproved is the int value for identifying approved proposals. ProposalCategoryApproved = politeia.ProposalCategoryApproved // ProposalCategoryRejected is the int value for identifying rejected proposals. ProposalCategoryRejected = politeia.ProposalCategoryRejected // ProposalCategoryAbandoned is the int value for identifying abandoned proposals. ProposalCategoryAbandoned = politeia.ProposalCategoryAbandoned )
const ( ProposalTypeNormal = politeia.ProposalTypeNormal ProposalTypeRFPProposal = politeia.ProposalTypeRFPProposal ProposalTypeRFPSubmission = politeia.ProposalTypeRFPSubmission )
const LogFilename = "cryptopower.log"
TODO: This is the main app's log filename, should probably be defined elsewhere.
Variables ¶
This section is empty.
Functions ¶
func ConvertVotes ¶
func ConvertVotes(votes []*ProposalVote) []*politeia.ProposalVote
func DefaultRateRequestAmt ¶ added in v1.1.0
func RegisterLogger ¶
RegisterLogger should be called before logRotator is initialized.
func SetLogLevels ¶
func SetLogLevels(logLevel string)
SetLogLevels sets the logging level for all subsystems to the provided level.
Types ¶
type Assets ¶
type Assets struct { DCR struct { Wallets map[int]sharedW.Asset BadWallets map[int]*sharedW.Wallet } BTC struct { Wallets map[int]sharedW.Asset BadWallets map[int]*sharedW.Wallet } LTC struct { Wallets map[int]sharedW.Asset BadWallets map[int]*sharedW.Wallet } }
Assets is a struct that holds all the assets supported by the wallet.
type AssetsManager ¶
type AssetsManager struct { Assets *Assets Politeia *politeia.Politeia InstantSwap *instantswap.InstantSwap ExternalService *ext.Service RateSource ext.RateSource // contains filtered or unexported fields }
AssetsManager is a struct that holds all the necessary parameters to manage the assets supported by the wallet.
func NewAssetsManager ¶
func NewAssetsManager(rootDir, logDir string, netType utils.NetworkType, dexTestAddr string) (*AssetsManager, error)
NewAssetsManager creates a new AssetsManager instance.
func (*AssetsManager) AllAssetTypes ¶
func (mgr *AssetsManager) AllAssetTypes() []utils.AssetType
AllAssetTypes returns all asset types supported by the assets manager.
func (*AssetsManager) AllBTCWallets ¶
func (mgr *AssetsManager) AllBTCWallets() (wallets []sharedW.Asset)
AllBTCWallets returns all BTC wallets in the assets manager.
func (*AssetsManager) AllDCRWallets ¶
func (mgr *AssetsManager) AllDCRWallets() (wallets []sharedW.Asset)
AllDCRWallets returns all DCR wallets in the assets manager.
func (*AssetsManager) AllLTCWallets ¶
func (mgr *AssetsManager) AllLTCWallets() (wallets []sharedW.Asset)
AllLTCWallets returns all LTC wallets in the assets manager.
func (*AssetsManager) AllVoteAgendas ¶ added in v1.1.0
func (mgr *AssetsManager) AllVoteAgendas(newestFirst bool) ([]*dcr.Agenda, error)
AllVoteAgendas returns all agendas of all stake versions for the active network and this version of the software.
func (*AssetsManager) AllWallets ¶
func (mgr *AssetsManager) AllWallets() (wallets []sharedW.Asset)
AllWallets returns all wallets in the assets manager.
func (*AssetsManager) AssetWallets ¶ added in v1.1.0
func (mgr *AssetsManager) AssetWallets(assetTypes ...utils.AssetType) []sharedW.Asset
AssetWallets returns the wallets for the specified asset type(s).
func (*AssetsManager) BTCBadWallets ¶
func (mgr *AssetsManager) BTCBadWallets() map[int]*sharedW.Wallet
BTCBadWallets returns a map of all bad BTC wallets.
func (*AssetsManager) BTCHDPrefix ¶ added in v1.1.0
func (mgr *AssetsManager) BTCHDPrefix() string
func (*AssetsManager) BTCWalletWithSeed ¶
func (mgr *AssetsManager) BTCWalletWithSeed(seedMnemonic string) (int, error)
BTCWalletWithSeed returns the ID of the BTC wallet that was created or restored using the same seed as the one provided. Returns -1 if no wallet uses the provided seed.
func (*AssetsManager) BTCWalletWithXPub ¶
func (mgr *AssetsManager) BTCWalletWithXPub(xpub string) (int, error)
BTCWalletWithXPub returns the ID of the BTC wallet that has an account with the provided xpub. Returns -1 if there is no such wallet.
func (*AssetsManager) BlockExplorerURLForTx ¶ added in v1.1.0
func (mgr *AssetsManager) BlockExplorerURLForTx(assetType utils.AssetType, txHash string) string
BlockExplorerURLForTx returns a URL for viewing a transaction on the block explorer of the specified asset.
func (*AssetsManager) CalculateAssetsUSDBalance ¶ added in v1.1.0
func (mgr *AssetsManager) CalculateAssetsUSDBalance(balances map[utils.AssetType]sharedW.AssetAmount) (map[utils.AssetType]float64, error)
func (*AssetsManager) CalculateTotalAssetsBalance ¶ added in v1.1.0
func (mgr *AssetsManager) CalculateTotalAssetsBalance(includeWatchWallet bool) (map[utils.AssetType]sharedW.AssetAmount, error)
func (*AssetsManager) ChangeStartupPassphrase ¶
func (mgr *AssetsManager) ChangeStartupPassphrase(oldPassphrase, newPassphrase string, passphraseType int32) error
ChangeStartupPassphrase changes the startup passphrase for the wallet.
func (*AssetsManager) ClearExchangeConfig ¶
func (mgr *AssetsManager) ClearExchangeConfig()
ClearExchangeConfig clears the wallet's exchange config.
func (*AssetsManager) CreateNewBTCWallet ¶
func (mgr *AssetsManager) CreateNewBTCWallet(walletName, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
CreateNewBTCWallet creates a new BTC wallet and returns it.
func (*AssetsManager) CreateNewBTCWatchOnlyWallet ¶
func (mgr *AssetsManager) CreateNewBTCWatchOnlyWallet(walletName, extendedPublicKey string) (sharedW.Asset, error)
CreateNewBTCWatchOnlyWallet creates a new BTC watch only wallet and returns it.
func (*AssetsManager) CreateNewDCRWallet ¶
func (mgr *AssetsManager) CreateNewDCRWallet(walletName, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
CreateNewDCRWallet creates a new DCR wallet and returns it.
func (*AssetsManager) CreateNewDCRWatchOnlyWallet ¶
func (mgr *AssetsManager) CreateNewDCRWatchOnlyWallet(walletName, extendedPublicKey string) (sharedW.Asset, error)
CreateNewDCRWatchOnlyWallet creates a new DCR watch only wallet and returns it.
func (*AssetsManager) CreateNewLTCWallet ¶
func (mgr *AssetsManager) CreateNewLTCWallet(walletName, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
CreateNewLTCWallet creates a new LTC wallet and returns it.
func (*AssetsManager) CreateNewLTCWatchOnlyWallet ¶
func (mgr *AssetsManager) CreateNewLTCWatchOnlyWallet(walletName, extendedPublicKey string) (sharedW.Asset, error)
CreateNewBTCWatchOnlyWallet creates a new BTC watch only wallet and returns it.
func (*AssetsManager) DCRBadWallets ¶
func (mgr *AssetsManager) DCRBadWallets() map[int]*sharedW.Wallet
DCRBadWallets returns a map of all bad DCR wallets.
func (*AssetsManager) DCRHDPrefix ¶ added in v1.1.0
func (mgr *AssetsManager) DCRHDPrefix() string
func (*AssetsManager) DCRWalletWithSeed ¶
func (mgr *AssetsManager) DCRWalletWithSeed(seedMnemonic string) (int, error)
DCRWalletWithSeed returns the ID of the DCR wallet that was created or restored using the same seed as the one provided. Returns -1 if no wallet uses the provided seed.
func (*AssetsManager) DCRWalletWithXPub ¶
func (mgr *AssetsManager) DCRWalletWithXPub(xpub string) (int, error)
DCRWalletWithXPub returns the ID of the DCR wallet that has an account with the provided xpub. Returns -1 if there is no such wallet.
func (*AssetsManager) DEXCInitialized ¶ added in v1.1.0
func (mgr *AssetsManager) DEXCInitialized() bool
func (*AssetsManager) DeleteBadWallet ¶
func (mgr *AssetsManager) DeleteBadWallet(walletID int) error
DeleteBadWallet deletes a bad wallet from the assets manager.
func (*AssetsManager) DeleteDEXData ¶ added in v1.1.0
func (mgr *AssetsManager) DeleteDEXData() error
func (*AssetsManager) DeleteWallet ¶
func (mgr *AssetsManager) DeleteWallet(walletID int, privPass string) error
DeleteWallet deletes a wallet from the assets manager.
func (*AssetsManager) DexClient ¶ added in v1.1.0
func (mgr *AssetsManager) DexClient() DEXClient
DexClient returns a dexc client that MUST never be modified.
func (*AssetsManager) ExchangeRateFetchingEnabled ¶ added in v1.1.0
func (mgr *AssetsManager) ExchangeRateFetchingEnabled() bool
ExchangeRateFetchingEnabled returns true if privacy mode isn't turned on and a valid exchange rate source is configured.
func (*AssetsManager) GetCurrencyConversionExchange ¶
func (mgr *AssetsManager) GetCurrencyConversionExchange() string
GetCurrencyConversionExchange returns the currency conversion exchange.
func (*AssetsManager) GetDexServers ¶
func (mgr *AssetsManager) GetDexServers() (map[string][]byte, error)
GetDexServers returns the dex servers.
func (*AssetsManager) GetExchangeConfig ¶
func (mgr *AssetsManager) GetExchangeConfig() *sharedW.ExchangeConfig
GetExchangeConfig returns the previously set exchange config for the asset.
func (*AssetsManager) GetLanguagePreference ¶
func (mgr *AssetsManager) GetLanguagePreference() string
GetLanguagePreference returns the language preference.
func (*AssetsManager) GetLogLevels ¶
func (mgr *AssetsManager) GetLogLevels() string
GetLogLevels returns the log levels.
func (*AssetsManager) GetShedulerRuntime ¶
func (mgr *AssetsManager) GetShedulerRuntime() string
GetShedulerRuntime returns the duration the order scheduler has been running.
func (*AssetsManager) GetUserAgent ¶
func (mgr *AssetsManager) GetUserAgent() string
GetUserAgent returns the user agent.
func (*AssetsManager) InitializeDEX ¶ added in v1.1.0
func (mgr *AssetsManager) InitializeDEX(ctx context.Context)
InitializeDEX initializes mgr.dexc. Support for Cryptopower wallets are initialized first so the DEX client can bind previously added wallets when it starts.
func (*AssetsManager) IsDarkModeOn ¶
func (mgr *AssetsManager) IsDarkModeOn() bool
IsDarkModeOn checks if the dark mode is set.
func (*AssetsManager) IsExchangeConfigSet ¶
func (mgr *AssetsManager) IsExchangeConfigSet() bool
IsExchangeConfigSet checks if the exchange config is set for the asset.
func (*AssetsManager) IsHTTPAPIPrivacyModeOff ¶
func (mgr *AssetsManager) IsHTTPAPIPrivacyModeOff(apiType utils.HTTPAPIType) bool
IsHTTPAPIPrivacyModeOff returns true if the given API type is enabled and false if otherwise.
func (*AssetsManager) IsOrderSchedulerRunning ¶
func (mgr *AssetsManager) IsOrderSchedulerRunning() bool
IsOrderSchedulerRunning returns true if the order scheduler is running.
func (*AssetsManager) IsPrivacyModeOn ¶
func (mgr *AssetsManager) IsPrivacyModeOn() bool
IsPrivacyModeOn checks if the privacy mode is set. If Privacy mode is on, no API calls that can be made.
func (*AssetsManager) IsStartupSecuritySet ¶
func (mgr *AssetsManager) IsStartupSecuritySet() bool
IsStartupSecuritySet checks if the startup security is set.
func (*AssetsManager) IsTotalBalanceVisible ¶ added in v1.1.0
func (mgr *AssetsManager) IsTotalBalanceVisible() bool
IsTotalBalanceVisible checks if the total balance visibility is set.
func (*AssetsManager) IsTransactionNotificationsOn ¶
func (mgr *AssetsManager) IsTransactionNotificationsOn() bool
IsTransactionNotificationsOn checks if the transaction notifications is set.
func (*AssetsManager) LTCBadWallets ¶
func (mgr *AssetsManager) LTCBadWallets() map[int]*sharedW.Wallet
LTCBadWallets returns a map of all bad LTC wallets.
func (*AssetsManager) LTCHDPrefix ¶ added in v1.1.0
func (mgr *AssetsManager) LTCHDPrefix() string
LTC HDPrefix returns the HD path prefix for the Litecoin wallet network.
func (*AssetsManager) LTCWalletWithSeed ¶
func (mgr *AssetsManager) LTCWalletWithSeed(seedMnemonic string) (int, error)
LTCWalletWithSeed returns the ID of the LTC wallet that was created or restored using the same seed as the one provided. Returns -1 if no wallet uses the provided seed.
func (*AssetsManager) LTCWalletWithXPub ¶
func (mgr *AssetsManager) LTCWalletWithXPub(xpub string) (int, error)
LTCWalletWithXPub returns the ID of the LTC wallet that has an account with the provided xpub. Returns -1 if there is no such wallet.
func (*AssetsManager) LoadedWalletsCount ¶
func (mgr *AssetsManager) LoadedWalletsCount() int32
LoadedWalletsCount returns the number of wallets loaded in the assets manager.
func (*AssetsManager) LogDir ¶
func (mgr *AssetsManager) LogDir() string
LogDir returns the log directory of the assets manager.
func (*AssetsManager) LogFile ¶ added in v1.1.0
func (mgr *AssetsManager) LogFile() string
func (*AssetsManager) NetType ¶
func (mgr *AssetsManager) NetType() utils.NetworkType
NetType returns the network type of the assets manager. It is either mainnet or testnet.
func (*AssetsManager) OpenWallets ¶
func (mgr *AssetsManager) OpenWallets(startupPassphrase string) error
OpenWallets opens all wallets in the assets manager.
func (*AssetsManager) OpenedWalletsCount ¶
func (mgr *AssetsManager) OpenedWalletsCount() int32
OpenedWalletsCount returns the number of wallets opened in the assets manager.
func (*AssetsManager) PiKeys ¶
func (mgr *AssetsManager) PiKeys() [][]byte
PiKeys returns the sanctioned Politeia keys for the current network.
func (*AssetsManager) ReadBoolValue ¶ added in v1.1.0
func (mgr *AssetsManager) ReadBoolValue(key string, value bool) bool
ReadBoolValue reads a bool value from the app's config.
func (*AssetsManager) RemoveStartupPassphrase ¶
func (mgr *AssetsManager) RemoveStartupPassphrase(oldPassphrase string) error
RemoveStartupPassphrase removes the startup passphrase for the wallet.
func (*AssetsManager) RestoreBTCWallet ¶
func (mgr *AssetsManager) RestoreBTCWallet(walletName, seedMnemonic, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
RestoreBTCWallet restores a BTC wallet from a seed and returns it.
func (*AssetsManager) RestoreDCRWallet ¶
func (mgr *AssetsManager) RestoreDCRWallet(walletName, seedMnemonic, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
RestoreDCRWallet restores a DCR wallet from a seed and returns it.
func (*AssetsManager) RestoreLTCWallet ¶
func (mgr *AssetsManager) RestoreLTCWallet(walletName, seedMnemonic, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
RestoreLTCWallet restores a LTC wallet from a seed and returns it.
func (*AssetsManager) RestoreWallet ¶
func (mgr *AssetsManager) RestoreWallet(walletType utils.AssetType, walletName, seedMnemonic, privatePassphrase string, privatePassphraseType int32) (sharedW.Asset, error)
RestoreWallet restores a wallet from the given seed.
func (*AssetsManager) RootDir ¶ added in v1.1.0
func (mgr *AssetsManager) RootDir() string
func (*AssetsManager) RootDirFileSizeInBytes ¶
func (mgr *AssetsManager) RootDirFileSizeInBytes(dataDir string) (int64, error)
RootDirFileSizeInBytes returns the total directory size of Assets Manager's root directory in bytes.
func (*AssetsManager) SaveDexServers ¶
func (mgr *AssetsManager) SaveDexServers(servers map[string][]byte)
SaveDexServers saves the dex servers.
func (*AssetsManager) SetBoolValue ¶ added in v1.1.0
func (mgr *AssetsManager) SetBoolValue(key string, value bool)
SaveBoolValue saves a bool value to the wallet's config.
func (*AssetsManager) SetCurrencyConversionExchange ¶
func (mgr *AssetsManager) SetCurrencyConversionExchange(xc string)
SetCurrencyConversionExchange sets the currency conversion exchange.
func (*AssetsManager) SetDarkMode ¶
func (mgr *AssetsManager) SetDarkMode(data bool)
SetDarkMode sets the dark mode for the app.
func (*AssetsManager) SetExchangeConfig ¶
func (mgr *AssetsManager) SetExchangeConfig(data sharedW.ExchangeConfig)
SetExchangeConfig sets the exchange config for the asset.
func (*AssetsManager) SetHTTPAPIPrivacyMode ¶
func (mgr *AssetsManager) SetHTTPAPIPrivacyMode(apiType utils.HTTPAPIType, isActive bool)
SetHTTPAPIPrivacyMode sets Http API the privacy mode for the app.
func (*AssetsManager) SetLanguagePreference ¶
func (mgr *AssetsManager) SetLanguagePreference(lang string)
SetLanguagePreference sets the language preference.
func (*AssetsManager) SetLogLevels ¶
func (mgr *AssetsManager) SetLogLevels(logLevel string)
SetLogLevels sets the log levels.
func (*AssetsManager) SetPrivacyMode ¶
func (mgr *AssetsManager) SetPrivacyMode(isActive bool)
SetPrivacyMode sets the privacy mode for the app.
func (*AssetsManager) SetStartupPassphrase ¶
func (mgr *AssetsManager) SetStartupPassphrase(passphrase string, passphraseType int32) error
SetStartupPassphrase sets the startup passphrase for the wallet.
func (*AssetsManager) SetTotalBalanceVisibility ¶ added in v1.1.0
func (mgr *AssetsManager) SetTotalBalanceVisibility(data bool)
SetTotalBalanceVisibility sets the transaction notifications for the app.
func (*AssetsManager) SetTransactionsNotifications ¶
func (mgr *AssetsManager) SetTransactionsNotifications(data bool)
SetTransactionsNotifications sets the transaction notifications for the app.
func (*AssetsManager) SetUserAgent ¶
func (mgr *AssetsManager) SetUserAgent(data string)
SetUserAgent sets the user agent.
func (*AssetsManager) Shutdown ¶
func (mgr *AssetsManager) Shutdown()
Shutdown shuts down the assets manager and all its wallets.
func (*AssetsManager) StartScheduler ¶
func (mgr *AssetsManager) StartScheduler(ctx context.Context, params instantswap.SchedulerParams) error
StartScheduler starts the automatic order scheduler.
func (*AssetsManager) StopScheduler ¶
func (mgr *AssetsManager) StopScheduler()
StopScheduler stops the order scheduler.
func (*AssetsManager) VerifyStartupPassphrase ¶
func (mgr *AssetsManager) VerifyStartupPassphrase(startupPassphrase string) error
VerifyStartupPassphrase verifies the startup passphrase for the wallet.
func (*AssetsManager) WalletWithID ¶
func (mgr *AssetsManager) WalletWithID(walletID int) sharedW.Asset
WalletWithID returns a wallet with the given ID.
func (*AssetsManager) WalletWithSeed ¶
func (mgr *AssetsManager) WalletWithSeed(walletType utils.AssetType, seedMnemonic string) (int, error)
WalletWithSeed returns the ID of the wallet with the given seed. If a wallet with the given seed does not exist, it returns -1.
func (*AssetsManager) WalletWithXPub ¶
WalletWithXPub returns the ID of the wallet with the given xpub. If a wallet with the given xpub does not exist, it returns -1.
type DEXClient ¶ added in v1.1.0
type DEXClient interface { Ready() <-chan struct{} WaitForShutdown() <-chan struct{} Shutdown() IsInitialized() bool InitializedWithPassword() bool IsLoggedIn() bool InitWithPassword(pw, seed []byte) error Login(pw []byte) error Logout() error DBPath() string DiscoverAccount(dexAddr string, appPW []byte, certI any) (*core.Exchange, bool, error) GetDEXConfig(dexAddr string, certI any) (*core.Exchange, error) BondsFeeBuffer(assetID uint32) uint64 HasWallet(assetID int32) bool AddWallet(assetID uint32, settings map[string]string, appPW, walletPW []byte) error SetWalletPassword(appPW []byte, assetID uint32, newPW []byte) error PostBond(form *core.PostBondForm) (*core.PostBondResult, error) NotificationFeed() *core.NoteFeed Exchanges() map[string]*core.Exchange Exchange(host string) (*core.Exchange, error) ExportSeed(pw []byte) ([]byte, error) SyncBook(dex string, base, quote uint32) (*orderbook.OrderBook, core.BookFeed, error) Orders(filter *core.OrderFilter) ([]*core.Order, error) ActiveOrders() (map[string][]*core.Order, map[string][]*core.InFlightOrder, error) TradeAsync(pw []byte, form *core.TradeForm) (*core.InFlightOrder, error) WalletState(assetID uint32) *core.WalletState WalletSettings(assetID uint32) (map[string]string, error) WalletIDForAsset(assetID uint32) (*int, error) MaxBuy(host string, base, quote uint32, rate uint64) (*core.MaxOrderEstimate, error) MaxSell(host string, base, quote uint32) (*core.MaxOrderEstimate, error) Cancel(oid dex.Bytes) error }
type EligibleTicket ¶
type EligibleTicket struct {
politeia.EligibleTicket
}
type ProposalOverview ¶
type ProposalOverview struct {
politeia.ProposalOverview
}
type ProposalVote ¶
type ProposalVote struct {
politeia.ProposalVote
}
func WrapVote ¶ added in v1.0.1
func WrapVote(hash, address, bit string) *ProposalVote
WrapVote, wraps vote type of politeia.ProposalVote into libwallet.ProposalVote
type ProposalVoteDetails ¶
type ProposalVoteDetails struct {
politeia.ProposalVoteDetails
}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
assets
|
|
internal
|
|
uniformprng
Package uniformprng implements a uniform, cryptographically secure pseudo-random number generator.
|
Package uniformprng implements a uniform, cryptographically secure pseudo-random number generator. |