Documentation ¶
Index ¶
- Constants
- func InitGlobalLogging(externalLogDir string, errorLogger assetlog.ParentLogger) error
- func ParseChainParams(net asset.Network) (*chaincfg.Params, error)
- func WalletExistsAt(dir string) (bool, error)
- type Wallet
- func CreateWallet[Tx any](ctx context.Context, params asset.CreateWalletParams[Tx], ...) (*Wallet[Tx], error)
- func CreateWatchOnlyWallet[Tx any](ctx context.Context, extendedPubKey string, ...) (*Wallet[Tx], error)
- func LoadWallet[Tx any](ctx context.Context, params asset.OpenWalletParams[Tx]) (*Wallet[Tx], error)
- func (w *Wallet[_]) CloseWallet() error
- func (w *Wallet[_]) IsSynced() bool
- func (w *Wallet[_]) IsSyncing() bool
- func (w *Wallet[_]) MainWallet() *wallet.Wallet
- func (w *Wallet[_]) OpenWallet() error
- func (w *Wallet[_]) Shutdown() error
- func (w *Wallet[_]) StartSync(ctx context.Context, connectPeers []string, savedPeersFilePath string) error
- func (w *Wallet[_]) WalletOpened() bool
Constants ¶
const LogFileName = "external.log"
Variables ¶
This section is empty.
Functions ¶
func InitGlobalLogging ¶
func InitGlobalLogging(externalLogDir string, errorLogger assetlog.ParentLogger) error
InitGlobalLogging initializes logging in the dcrwallet packages, writing the logs to a log file in the specified logDir. If desired, log messages with level >= warn can be additionally written to a separate logger. To achieve this, pass a non-nil ParentLogger that can be used to create error-only loggers.
Logging only has to be initialized once, so an atomic flag is used internally to return early on subsequent invocations.
In theory, the rotating file logger must be Closed at some point, but there are concurrency issues with that since btcd and btcwallet have unsupervised goroutines still running after shutdown. So we leave the rotator running at the risk of losing some logs.
func WalletExistsAt ¶
WalletExistsAt checks the existence of the wallet.
Types ¶
type Wallet ¶
type Wallet[Tx any] struct { *asset.WalletBase[Tx] // contains filtered or unexported fields }
func CreateWallet ¶
func CreateWallet[Tx any](ctx context.Context, params asset.CreateWalletParams[Tx], recovery *asset.RecoveryCfg) (*Wallet[Tx], error)
CreateWallet creates and opens an SPV wallet. If recovery params is not provided, a new seed is generated and used. The seed is encrypted with the provided passphrase and can be revealed for backup later by providing the passphrase.
func CreateWatchOnlyWallet ¶
func CreateWatchOnlyWallet[Tx any](ctx context.Context, extendedPubKey string, params asset.CreateWalletParams[Tx]) (*Wallet[Tx], error)
CreateWatchOnlyWallet creates and opens a watchonly SPV wallet.
func LoadWallet ¶
func LoadWallet[Tx any](ctx context.Context, params asset.OpenWalletParams[Tx]) (*Wallet[Tx], error)
LoadWallet loads a previously created SPV wallet. The wallet must be opened via its OpenWallet method before it can be used.
func (*Wallet[_]) CloseWallet ¶
CloseWallet stops any active network synchronization and unloads the main wallet.
func (*Wallet[_]) IsSynced ¶
IsSynced returns true if the wallet has synced up to the best block on the mainchain.
func (*Wallet[_]) IsSyncing ¶
IsSyncing returns true if the wallet is catching up to the mainchain's best block.
func (*Wallet[_]) MainWallet ¶
MainWallet returns the main ltc wallet with the core wallet functionalities.
func (*Wallet[_]) OpenWallet ¶
OpenWallet opens the main wallet.
func (*Wallet[_]) StartSync ¶
func (w *Wallet[_]) StartSync(ctx context.Context, connectPeers []string, savedPeersFilePath string) error
StartSync connects the wallet to the blockchain network via SPV and returns immediately. The wallet stays connected in the background until the provided ctx is canceled or either StopSync or CloseWallet is called. TODO: Accept sync ntfn listeners.
func (*Wallet[_]) WalletOpened ¶
WalletOpened returns true if the main wallet has been opened.