Documentation ¶
Index ¶
- Constants
- Variables
- func Balances(w Asset) (AssetAmount, AssetAmount, error)
- func DecodeSeedMnemonic(seedMnemonic string, assetType utils.AssetType) (hashedSeed []byte, err error)
- func ParseWalletPeers(peerAddresses string, port string) ([]string, []error)
- func SortTxs(txs []*Transaction, newestFirst bool)
- func UseLogger(logger slog.Logger)
- func VerifySeed(seedMnemonic string, assetType utils.AssetType) bool
- type Account
- type AccountProperties
- type Accounts
- type AddressDiscoveryProgressReport
- type AddressType
- type Amount
- type Asset
- type AssetAmount
- type AuthInfo
- type Balance
- type BlockInfo
- type BlocksRescanProgressListener
- type CFiltersFetchProgressReport
- type ExchangeConfig
- type FeeEstimate
- type GeneralSyncProgress
- type HeadersFetchProgressReport
- type HeadersRescanProgressReport
- type InitParams
- type KeyScope
- type PeerInfo
- type ScopeAddrSchema
- type SyncProgressListener
- type Transaction
- type TransactionDestination
- type TransactionOverview
- type TxAndBlockNotificationListener
- type TxFeeAndSize
- type TxInfoFromWallet
- type TxInput
- type TxOutput
- type UnsignedTransaction
- type UnspentOutput
- type WAccount
- type WConfig
- type WInput
- type WOutput
- type Wallet
- func CreateNewWallet(pass *AuthInfo, loader loader.AssetLoader, params *InitParams, ...) (*Wallet, error)
- func CreateWatchOnlyWallet(walletName, extendedPublicKey string, loader loader.AssetLoader, ...) (*Wallet, error)
- func RestoreWallet(seedMnemonic string, pass *AuthInfo, loader loader.AssetLoader, ...) (*Wallet, error)
- func (wallet *Wallet) ChangePrivatePassphraseForWallet(oldPrivatePassphrase, newPrivatePassphrase string, privatePassphraseType int32) error
- func (wallet *Wallet) ContainsDiscoveredAccounts() bool
- func (wallet *Wallet) DataDir() string
- func (wallet *Wallet) DecryptSeed(privatePassphrase string) (string, error)
- func (wallet *Wallet) DeleteUserConfigValueForKey(key string)
- func (wallet *Wallet) DeleteWallet(privPass string) error
- func (wallet *Wallet) GetAssetType() utils.AssetType
- func (wallet *Wallet) GetBirthday() time.Time
- func (wallet *Wallet) GetEncryptedSeed() string
- func (wallet *Wallet) GetWalletDataDb() *walletdata.DB
- func (wallet *Wallet) GetWalletID() int
- func (wallet *Wallet) GetWalletName() string
- func (wallet *Wallet) Internal() *loader.LoadedWallets
- func (wallet *Wallet) IsLocked() bool
- func (wallet *Wallet) IsWatchingOnlyWallet() bool
- func (wallet *Wallet) LockWallet()
- func (wallet *Wallet) LogFile() string
- func (wallet *Wallet) MarkWalletAsDiscoveredAccounts() error
- func (wallet *Wallet) NetType() utils.NetworkType
- func (wallet *Wallet) OpenWallet() error
- func (wallet *Wallet) Prepare(loader loader.AssetLoader, params *InitParams) (err error)
- func (wallet *Wallet) ReadBoolConfigValueForKey(key string, defaultValue bool) (valueOut bool)
- func (wallet *Wallet) ReadDoubleConfigValueForKey(key string, defaultValue float64) (valueOut float64)
- func (wallet *Wallet) ReadInt32ConfigValueForKey(key string, defaultValue int32) (valueOut int32)
- func (wallet *Wallet) ReadIntConfigValueForKey(key string, defaultValue int) (valueOut int)
- func (wallet *Wallet) ReadLongConfigValueForKey(key string, defaultValue int64) (valueOut int64)
- func (wallet *Wallet) ReadStringConfigValueForKey(key string, defaultValue string) (valueOut string)
- func (wallet *Wallet) ReadUserConfigValue(key string, valueOut interface{}) error
- func (wallet *Wallet) RenameWallet(newName string) error
- func (wallet *Wallet) RequiredConfirmations() int32
- func (wallet *Wallet) RootDir() string
- func (wallet *Wallet) SaveUserConfigValue(key string, value interface{})
- func (wallet *Wallet) SetBirthday(birthday time.Time)
- func (wallet *Wallet) SetBoolConfigValueForKey(key string, value bool)
- func (wallet *Wallet) SetDoubleConfigValueForKey(key string, value float64)
- func (wallet *Wallet) SetInt32ConfigValueForKey(key string, value int32)
- func (wallet *Wallet) SetIntConfigValueForKey(key string, value int)
- func (wallet *Wallet) SetLongConfigValueForKey(key string, value int64)
- func (wallet *Wallet) SetNetType(netType utils.NetworkType)
- func (wallet *Wallet) SetNetworkCancelCallback(callback func())
- func (wallet *Wallet) SetStringConfigValueForKey(key, value string)
- func (wallet *Wallet) Shutdown()
- func (wallet *Wallet) ShutdownContextWithCancel() (context.Context, context.CancelFunc)
- func (wallet *Wallet) TargetTimePerBlockMinutes() float64
- func (wallet *Wallet) UnlockWallet(privPass string) (err error)
- func (wallet *Wallet) VerifySeedForWallet(seedMnemonic, privpass string) (bool, error)
- func (wallet *Wallet) WalletCreationTimeInMillis() (int64, error)
- func (wallet *Wallet) WalletExists() (bool, error)
- func (wallet *Wallet) WalletNameExists(walletName string) (bool, error)
- func (wallet *Wallet) WalletOpened() bool
Constants ¶
const ( AccountMixerConfigSet = "account_mixer_config_set" AccountMixerMixedAccount = "account_mixer_mixed_account" AccountMixerUnmixedAccount = "account_mixer_unmixed_account" AccountMixerMixTxChange = "account_mixer_mix_tx_change" LogLevelConfigKey = "log_level" PrivacyModeConfigKey = "privacy_mode" SpendUnconfirmedConfigKey = "spend_unconfirmed" CurrencyConversionConfigKey = "currency_conversion_option" IsStartupSecuritySetConfigKey = "startup_security_set" StartupSecurityTypeConfigKey = "startup_security_type" UseBiometricConfigKey = "use_biometric" IncomingTxNotificationsConfigKey = "tx_notification_enabled" BeepNewBlocksConfigKey = "beep_new_blocks" SyncOnCellularConfigKey = "always_sync" NetworkModeConfigKey = "network_mode" SpvPersistentPeerAddressesConfigKey = "spv_peer_addresses" UserAgentConfigKey = "user_agent" PoliteiaNotificationConfigKey = "politeia_notification" LastTxHashConfigKey = "last_tx_hash" KnownVSPsConfigKey = "known_vsps" TicketBuyerVSPHostConfigKey = "tb_vsp_host" TicketBuyerWalletConfigKey = "tb_wallet_id" TicketBuyerAccountConfigKey = "tb_account_number" TicketBuyerATMConfigKey = "tb_amount_to_maintain" ExchangeSourceDstnTypeConfigKey = "exchange_source_destination_key" HideBalanceConfigKey = "hide_balance" AutoSyncConfigKey = "autoSync" FetchProposalConfigKey = "fetch_proposals" SeedBackupNotificationConfigKey = "seed_backup_notification" ProposalNotificationConfigKey = "proposal_notification_key" TransactionNotificationConfigKey = "transaction_notification_key" SpendUnmixedFundsKey = "spend_unmixed_funds" KnownDexServersConfigKey = "known_dex_servers" LanguagePreferenceKey = "app_language" DarkModeConfigKey = "dark_mode" HideTotalBalanceConfigKey = "hideTotalUSDBalance" IsCEXFirstVisitConfigKey = "is_cex_first_visit" PassphraseTypePin int32 = 0 PassphraseTypePass int32 = 1 )
const ( // UnminedTxHeight defines the block height of the txs in the mempool UnminedTxHeight int32 = -1 )
Variables ¶
var InvalidBlock = &BlockInfo{
Height: -1,
Timestamp: -1,
}
InvalidBlock defines invalid height and timestamp returned in case of an error.
Functions ¶
func Balances ¶ added in v1.1.0
func Balances(w Asset) (AssetAmount, AssetAmount, error)
Balances returns the spendable balance and total balance of the wallet.
func DecodeSeedMnemonic ¶
func ParseWalletPeers ¶ added in v1.1.0
ParseWalletPeers is a convenience function that converts the provided peerAddresses string to an array of valid peer addresses.
func SortTxs ¶ added in v1.1.0
func SortTxs(txs []*Transaction, newestFirst bool)
SortTxs is a shared function that sorts the provided txs slice in ascending or descending order depending on newestFirst.
Types ¶
type AccountProperties ¶
type AccountProperties struct { // AccountNumber is the internal number used to reference the account. AccountNumber uint32 // AccountName is the user-identifying name of the account. AccountName string // ExternalKeyCount is the number of internal keys that have been // derived for the account. ExternalKeyCount uint32 // InternalKeyCount is the number of internal keys that have been // derived for the account. InternalKeyCount uint32 // ImportedKeyCount is the number of imported keys found within the // account. ImportedKeyCount uint32 // AccountPubKey is the account's public key that can be used to // derive any address relevant to said account. // // NOTE: This may be nil for imported accounts. AccountPubKey *btchdkeychain.ExtendedKey // TODO: support LTC // MasterKeyFingerprint represents the fingerprint of the root key // corresponding to the master public key (also known as the key with // derivation path m/). This may be required by some hardware wallets // for proper identification and signing. MasterKeyFingerprint uint32 // KeyScope is the key scope the account belongs to. KeyScope KeyScope // IsWatchOnly indicates whether the is set up as watch-only, i.e., it // doesn't contain any private key information. IsWatchOnly bool // AddrSchema, if non-nil, specifies an address schema override for // address generation only applicable to the account. AddrSchema *ScopeAddrSchema }
AccountProperties contains properties associated with each account, such as the account name, number, and the nubmer of derived and imported keys.
type AddressDiscoveryProgressReport ¶
type AddressDiscoveryProgressReport struct { *GeneralSyncProgress AddressDiscoveryStartTime int64 TotalDiscoveryTimeSpent int64 AddressDiscoveryProgress int32 `json:"addressDiscoveryProgress"` }
type AddressType ¶
type AddressType uint8
AddressType represents the various address types waddrmgr is currently able to generate, and maintain.
NOTE: These MUST be stable as they're used for scope address schema recognition within the database.
type Amount ¶
type Amount struct { // UnitValue holds the base monetary unit value for a cryptocurrency. // The field is currently used for both BTC, LTC and DCR. // For Decred it holds the number of Atoms per DCR. // For Bitcoin it holds the number of satoshis per BTC. // For Litecoin it holds the number of litoshis per LTC. UnitValue int64 // CoinValue holds the monetary amount counted in a cryptocurrency base // units, converted to a floating point value representing the amount // of said cryptocurrency. CoinValue float64 }
type Asset ¶
type Asset interface { Shutdown() IsSynced() bool IsSyncing() bool SpvSync() error CancelRescan() CancelSync() IsRescanning() bool RescanBlocks() error ConnectedPeers() int32 RemovePeers() SetSpecificPeer(address string) GetExtendedPubKey(account int32) (string, error) IsSyncShuttingDown() bool LockWallet() IsLocked() bool IsWaiting() bool WalletOpened() bool OpenWallet() error GetWalletID() int GetWalletName() string IsWatchingOnlyWallet() bool UnlockWallet(string) error DeleteWallet(privPass string) error RenameWallet(newName string) error DecryptSeed(privatePassphrase string) (string, error) VerifySeedForWallet(seedMnemonic, privpass string) (bool, error) ChangePrivatePassphraseForWallet(oldPrivatePassphrase, newPrivatePassphrase string, privatePassphraseType int32) error RootDir() string DataDir() string GetEncryptedSeed() string IsConnectedToNetwork() bool NetType() utils.NetworkType ToAmount(v int64) AssetAmount GetAssetType() utils.AssetType Internal() *loader.LoadedWallets TargetTimePerBlockMinutes() float64 RequiredConfirmations() int32 ShutdownContextWithCancel() (context.Context, context.CancelFunc) LogFile() string PublishUnminedTransactions() error CountTransactions(txFilter int32) (int, error) GetTransactionRaw(txHash string) (*Transaction, error) TxMatchesFilter(tx *Transaction, txFilter int32) bool GetTransactionsRaw(offset, limit, txFilter int32, newestFirst bool, txHashSearch string) ([]*Transaction, error) GetBestBlock() *BlockInfo GetBestBlockHeight() int32 GetBestBlockTimeStamp() int64 ContainsDiscoveredAccounts() bool GetAccountsRaw() (*Accounts, error) GetAccount(accountNumber int32) (*Account, error) AccountName(accountNumber int32) (string, error) CreateNewAccount(accountName, privPass string) (int32, error) RenameAccount(accountNumber int32, newName string) error AccountNumber(accountName string) (int32, error) AccountNameRaw(accountNumber uint32) (string, error) GetAccountBalance(accountNumber int32) (*Balance, error) GetWalletBalance() (*Balance, error) UnspentOutputs(account int32) ([]*UnspentOutput, error) AddSyncProgressListener(syncProgressListener *SyncProgressListener, uniqueIdentifier string) error RemoveSyncProgressListener(uniqueIdentifier string) AddTxAndBlockNotificationListener(txAndBlockNotificationListener *TxAndBlockNotificationListener, uniqueIdentifier string) error RemoveTxAndBlockNotificationListener(uniqueIdentifier string) SetBlocksRescanProgressListener(blocksRescanProgressListener *BlocksRescanProgressListener) CurrentAddress(account int32) (string, error) NextAddress(account int32) (string, error) IsAddressValid(address string) bool HaveAddress(address string) bool SignMessage(passphrase, address, message string) ([]byte, error) VerifyMessage(address, message, signatureBase64 string) (bool, error) SaveUserConfigValue(key string, value interface{}) ReadUserConfigValue(key string, valueOut interface{}) error SetBoolConfigValueForKey(key string, value bool) SetDoubleConfigValueForKey(key string, value float64) SetIntConfigValueForKey(key string, value int) SetInt32ConfigValueForKey(key string, value int32) SetLongConfigValueForKey(key string, value int64) SetStringConfigValueForKey(key, value string) ReadBoolConfigValueForKey(key string, defaultValue bool) bool ReadDoubleConfigValueForKey(key string, defaultValue float64) float64 ReadIntConfigValueForKey(key string, defaultValue int) int ReadInt32ConfigValueForKey(key string, defaultValue int32) int32 ReadLongConfigValueForKey(key string, defaultValue int64) int64 ReadStringConfigValueForKey(key string, defaultValue string) string NewUnsignedTx(accountNumber int32, utxos []*UnspentOutput) error AddSendDestination(id int, address string, unitAmount int64, sendMax bool) error ComputeTxSizeEstimation(dstAddress string, utxos []*UnspentOutput) (int, error) Broadcast(passphrase, label string) ([]byte, error) EstimateFeeAndSize() (*TxFeeAndSize, error) IsUnsignedTxExist() bool RemoveSendDestination(id int) SendDestination(id int) *TransactionDestination UpdateSendDestination(id int, address string, atomAmount int64, sendMax bool) error }
Asset defines the interface each wallet must satisfy.
type AssetAmount ¶
type AssetAmount interface { // ToCoin returns an asset formatted amount in float64. ToCoin() float64 // String returns an asset formatted amount in string. String() string // MulF64 multiplies an Amount by a floating point value. MulF64(f float64) AssetAmount // ToInt() returns the complete int64 value without formatting. ToInt() int64 }
type AuthInfo ¶
AuthInfo defines the complete information required to either create a new wallet or restore an old wallet.
type Balance ¶
type Balance struct { // Fields common to all assets. Total AssetAmount Spendable AssetAmount ImmatureReward AssetAmount Locked AssetAmount // DCR only fields ImmatureStakeGeneration AssetAmount LockedByTickets AssetAmount VotingAuthority AssetAmount UnConfirmed AssetAmount }
type BlocksRescanProgressListener ¶
type BlocksRescanProgressListener struct { OnBlocksRescanStarted func(walletID int) OnBlocksRescanProgress func(*HeadersRescanProgressReport) OnBlocksRescanEnded func(walletID int, err error) }
type CFiltersFetchProgressReport ¶
type CFiltersFetchProgressReport struct { *GeneralSyncProgress BeginFetchCFiltersTimeStamp int64 StartCFiltersHeight int32 CfiltersFetchTimeSpent int64 TotalFetchedCFiltersCount int32 TotalCFiltersToFetch int32 `json:"totalCFiltersToFetch"` CurrentCFilterHeight int32 `json:"currentCFilterHeight"` CFiltersFetchProgress int32 `json:"headersFetchProgress"` }
type ExchangeConfig ¶
type ExchangeConfig struct { SourceAsset utils.AssetType DestinationAsset utils.AssetType SourceWalletID int32 DestinationWalletID int32 SourceAccountNumber int32 DestinationAccountNumber int32 }
ExchangeConfig defines configuration parameters for creating an exchange order.
type FeeEstimate ¶
type FeeEstimate struct { // Number of confirmed blocks that show the average fee rate represented below. ConfirmedBlocks int32 // Feerate shows estimate fee rate in Sat/kvB or Lit/kvB. Feerate AssetAmount }
FeeEstimate defines the fee estimate returned by the API.
type GeneralSyncProgress ¶
type HeadersRescanProgressReport ¶
type HeadersRescanProgressReport struct { *GeneralSyncProgress TotalHeadersToScan int32 `json:"totalHeadersToScan"` CurrentRescanHeight int32 `json:"currentRescanHeight"` RescanProgress int32 `json:"rescanProgress"` RescanTimeRemaining int64 `json:"rescanTimeRemaining"` WalletID int `json:"walletID"` }
type InitParams ¶
type InitParams struct { RootDir string NetType utils.NetworkType DB *storm.DB DbDriver string LogDir string DEXTestAddr string }
InitParams defines the basic parameters required to instantiate any wallet interface.
type KeyScope ¶
type KeyScope struct { // Purpose is the purpose of this key scope. This is the first child of // the master HD key. Purpose uint32 // Coin is a value that represents the particular coin which is the // child of the purpose key. With this key, any accounts, or other // children can be derived at all. Coin uint32 }
KeyScope represents a restricted key scope from the primary root key within the HD chain. From the root manager (m/) we can create a nearly arbitrary number of ScopedKeyManagers of key derivation path: m/purpose'/cointype'. These scoped managers can then me managed indecently, as they house the encrypted cointype key and can derive any child keys from there on.
type ScopeAddrSchema ¶
type ScopeAddrSchema struct { // ExternalAddrType is the address type for all keys within branch 0. ExternalAddrType AddressType // InternalAddrType is the address type for all keys within branch 1 // (change addresses). InternalAddrType AddressType }
ScopeAddrSchema is the address schema of a particular KeyScope. This will be persisted within the database, and will be consulted when deriving any keys for a particular scope to know how to encode the public keys as addresses.
type SyncProgressListener ¶
type SyncProgressListener struct { OnSyncStarted func() OnPeerConnectedOrDisconnected func(numberOfConnectedPeers int32) OnCFiltersFetchProgress func(cfiltersFetchProgress *CFiltersFetchProgressReport) OnHeadersFetchProgress func(headersFetchProgress *HeadersFetchProgressReport) OnAddressDiscoveryProgress func(addressDiscoveryProgress *AddressDiscoveryProgressReport) OnHeadersRescanProgress func(headersRescanProgress *HeadersRescanProgressReport) OnSyncCompleted func() OnSyncCanceled func(willRestart bool) OnSyncEndedWithError func(err error) }
type Transaction ¶
type Transaction struct { Hash string `storm:"id,unique" json:"hash"` Type string `storm:"index" json:"type,omitempty"` Hex string `json:"hex"` Timestamp int64 `storm:"index" json:"timestamp"` BlockHeight int32 `storm:"index" json:"block_height"` TicketSpender string `storm:"index" json:"ticket_spender,omitempty"` // (DCR Field) MixDenomination int64 `json:"mix_denom,omitempty"` // (DCR Field) MixCount int32 `json:"mix_count,omitempty"` // (DCR Field) Version int32 `json:"version"` LockTime int32 `json:"lock_time"` Expiry int32 `json:"expiry,omitempty"` // (DCR Field) Fee int64 `json:"fee"` FeeRate int64 `json:"fee_rate"` Size int `json:"size"` Label string `json:"label"` Direction int32 `storm:"index" json:"direction"` Amount int64 `json:"amount"` Inputs []*TxInput `json:"inputs"` Outputs []*TxOutput `json:"outputs"` // Vote Info (DCR fields) VoteVersion int32 `json:"vote_version,omitempty"` LastBlockValid bool `json:"last_block_valid,omitempty"` VoteBits string `json:"vote_bits,omitempty"` VoteReward int64 `json:"vote_reward,omitempty"` TicketSpentHash string `storm:"unique" json:"ticket_spent_hash,omitempty"` DaysToVoteOrRevoke int32 `json:"days_to_vote_revoke,omitempty"` }
Transaction is used with storm for tx indexing operations. For faster queries, the `Hash`, `Type` and `Direction` fields are indexed.
type TransactionDestination ¶
type TransactionOverview ¶
type TxFeeAndSize ¶
type TxInfoFromWallet ¶
type TxInfoFromWallet struct { WalletID int Hex string Timestamp int64 BlockHeight int32 Inputs []*WInput Outputs []*WOutput }
TxInfoFromWallet contains tx data that relates to the querying wallet. This info is used with `DecodeTransaction` to compose the entire details of a transaction.
type UnsignedTransaction ¶
type UnspentOutput ¶
type UnspentOutput struct { TxID string Vout uint32 Address string ScriptPubKey string RedeemScript string Amount AssetAmount Confirmations int32 Spendable bool ReceiveTime time.Time Tree int8 }
UnspentOutput defines the unspent output parameters for coin selection.
type WConfig ¶
type WConfig struct { // General GapLimit uint32 // Allowed unused address gap between used addresses of accounts ManualTickets bool // Do not discover new tickets through network synchronization AllowHighFees bool // Do not perform high fee checks RelayFee dcrutil.Amount // Transaction fee per kilobyte AccountGapLimit int // Allowed gap of unused accounts DisableCoinTypeUpgrades bool // Never upgrade from legacy to SLIP0044 coin type keys // CSPP MixSplitLimit int // Connection limit to CoinShuffle++ server per change amount }
WConfig defines options for configuring wallet behaviour. This is a subset of the config used by dcrwallet.
type Wallet ¶
type Wallet struct { ID int `storm:"id,increment"` Name string `storm:"unique"` CreatedAt time.Time `storm:"index"` Type utils.AssetType EncryptedSeed []byte IsRestored bool HasDiscoveredAccounts bool PrivatePassphraseType int32 // Birthday holds the timestamp of the birthday block from where wallet // restoration begins from. CreatedAt is available for audit purposes // in relation to how long the wallet has been in existence. Birthday time.Time // contains filtered or unexported fields }
func CreateNewWallet ¶
func CreateNewWallet(pass *AuthInfo, loader loader.AssetLoader, params *InitParams, assetType utils.AssetType, ) (*Wallet, error)
func CreateWatchOnlyWallet ¶
func CreateWatchOnlyWallet(walletName, extendedPublicKey string, loader loader.AssetLoader, params *InitParams, assetType utils.AssetType, ) (*Wallet, error)
func RestoreWallet ¶
func RestoreWallet(seedMnemonic string, pass *AuthInfo, loader loader.AssetLoader, params *InitParams, assetType utils.AssetType, ) (*Wallet, error)
func (*Wallet) ChangePrivatePassphraseForWallet ¶
func (wallet *Wallet) ChangePrivatePassphraseForWallet(oldPrivatePassphrase, newPrivatePassphrase string, privatePassphraseType int32) error
ChangePrivatePassphraseForWallet attempts to change the wallet's passphrase and re-encrypts the seed with the new passphrase.
func (*Wallet) ContainsDiscoveredAccounts ¶
func (*Wallet) DataDir ¶
DataDir returns the current wallet bucket directory. It is exported via the interface thus the need to be thread safe.
func (*Wallet) DecryptSeed ¶
DecryptSeed decrypts wallet.EncryptedSeed using privatePassphrase
func (*Wallet) DeleteUserConfigValueForKey ¶
DeleteUserConfigValueForKey method deletes the value stored against the provided key at the asset level.
func (*Wallet) DeleteWallet ¶
func (*Wallet) GetAssetType ¶
GetAssetType returns the current wallet's asset type. It is exported via the interface thus the the need to be thread safe.
func (*Wallet) GetBirthday ¶
GetBirthday returns the timestamp when the wallet was created or its keys were first used. This helps to check if a wallet requires auto rescan and recovery on wallet startup.
func (*Wallet) GetEncryptedSeed ¶
func (*Wallet) GetWalletDataDb ¶
func (wallet *Wallet) GetWalletDataDb() *walletdata.DB
GetWalletDataDb returns the walletdatadb instance. Its not exported via the but nonetheless has been made thread safe.
func (*Wallet) GetWalletID ¶
func (*Wallet) GetWalletName ¶
func (*Wallet) Internal ¶
func (wallet *Wallet) Internal() *loader.LoadedWallets
Internal return the upstream wallet of the current asset created in the loader package. Since its exported via the interface thus the need to be thread safe.
func (*Wallet) IsWatchingOnlyWallet ¶
func (*Wallet) LockWallet ¶
func (wallet *Wallet) LockWallet()
func (*Wallet) MarkWalletAsDiscoveredAccounts ¶
func (*Wallet) NetType ¶
func (wallet *Wallet) NetType() utils.NetworkType
NetType returns the current network type. It is exported via the interface thus the the need to thread safe.
func (*Wallet) OpenWallet ¶
func (*Wallet) Prepare ¶
func (wallet *Wallet) Prepare(loader loader.AssetLoader, params *InitParams) (err error)
prepare gets a wallet ready for use by opening the transactions index database and initializing the wallet loader which can be used subsequently to create, load and unload the wallet.
func (*Wallet) ReadBoolConfigValueForKey ¶
ReadBoolConfigValueForKey reads the boolean value stored against the provided key at the asset level. Provided default value is returned if the key is not found.
func (*Wallet) ReadDoubleConfigValueForKey ¶
func (wallet *Wallet) ReadDoubleConfigValueForKey(key string, defaultValue float64) (valueOut float64)
ReadDoubleConfigValueForKey reads the float64 value stored against the provided key at the asset level. Provided default value is returned if the key is not found.
func (*Wallet) ReadInt32ConfigValueForKey ¶
ReadInt32ConfigValueForKey int32 the boolean value stored against the provided key at the asset level. Provided default value is returned if the key is not found.
func (*Wallet) ReadIntConfigValueForKey ¶
ReadIntConfigValueForKey reads the int value stored against the provided key at the asset level. Provided default value is returned if the key is not found.
func (*Wallet) ReadLongConfigValueForKey ¶
ReadLongConfigValueForKey reads the int64 value stored against the provided key at the asset level. Provided default value is returned if the key is not found.
func (*Wallet) ReadStringConfigValueForKey ¶
func (wallet *Wallet) ReadStringConfigValueForKey(key string, defaultValue string) (valueOut string)
ReadStringConfigValueForKey reads the string value stored against the provided key at the asset level. Provided default value is returned if the key is not found.
func (*Wallet) ReadUserConfigValue ¶
ReadUserConfigValue reads the generic value stored against the provided key at the asset level.
func (*Wallet) RenameWallet ¶
func (*Wallet) RequiredConfirmations ¶
RequiredConfirmations specifies the minimum number of confirmations a transaction needs to be consider as confirmed.
func (*Wallet) RootDir ¶
RootDir returns the root of current wallet bucket. It is exported via the interface thus the need to be thread safe. RootD
func (*Wallet) SaveUserConfigValue ¶
SaveUserConfigValue stores the generic value against the provided key at the asset level.
func (*Wallet) SetBirthday ¶
SetBirthday allows updating the birthday time to a more precise value that is verified by the network.
func (*Wallet) SetBoolConfigValueForKey ¶
SetBoolConfigValueForKey stores the boolean value against the provided key at the asset level.
func (*Wallet) SetDoubleConfigValueForKey ¶
SetDoubleConfigValueForKey stores the float64 value against the provided key at the asset level.
func (*Wallet) SetInt32ConfigValueForKey ¶
SetInt32ConfigValueForKey stores the int32 value against the provided key at the asset level.
func (*Wallet) SetIntConfigValueForKey ¶
SetIntConfigValueForKey stores the int value against the provided key at the asset level.
func (*Wallet) SetLongConfigValueForKey ¶
SetLongConfigValueForKey stores the int64 value against the provided key at the asset level.
func (*Wallet) SetNetType ¶
func (wallet *Wallet) SetNetType(netType utils.NetworkType)
SetNetType is used to set the net type if it doesn't exist. This method is used before the actual wallet is loaded otherwise once loaded the nettype can't be altered. This method help create the full method with the unique path for the folder structure for the testnet data dirs.
func (*Wallet) SetNetworkCancelCallback ¶
func (wallet *Wallet) SetNetworkCancelCallback(callback func())
func (*Wallet) SetStringConfigValueForKey ¶
SetStringConfigValueForKey stores the string value against the provided key at the asset level.
func (*Wallet) ShutdownContextWithCancel ¶
func (wallet *Wallet) ShutdownContextWithCancel() (context.Context, context.CancelFunc)
func (*Wallet) TargetTimePerBlockMinutes ¶
func (*Wallet) UnlockWallet ¶
func (*Wallet) VerifySeedForWallet ¶
VerifySeedForWallet compares seedMnemonic with the decrypted wallet.EncryptedSeed and clears wallet.EncryptedSeed if they match.
func (*Wallet) WalletCreationTimeInMillis ¶
WalletCreationTimeInMillis returns the wallet creation time for new wallets. Restored wallets would return an error.
func (*Wallet) WalletExists ¶
func (*Wallet) WalletNameExists ¶
func (*Wallet) WalletOpened ¶
WalletOpened checks if the upstream loader instance of the asset wallet is loaded (i.e. open).