Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Log = slog.Disabled
log is a logger that is initialized with no output filters. This means the package will not perform any logging by default until the caller requests it.
Functions ¶
Types ¶
type AssetLoader ¶
type AssetLoader interface { GetDbDirPath() string SetDatabaseDriver(driver string) OpenExistingWallet(ctx context.Context, WalletID string, pubPassphrase []byte) (*LoadedWallets, error) CreateNewWallet(ctx context.Context, params *CreateWalletParams) (*LoadedWallets, error) CreateWatchingOnlyWallet(ctx context.Context, params *WatchOnlyWalletParams) (*LoadedWallets, error) GetLoadedWallet() (*LoadedWallets, bool) UnloadWallet() error WalletExists(WalletID string) (bool, error) }
AssetLoader defines the interface exported by the loader implementation of each asset.
type CreateWalletParams ¶
type LoadedWallets ¶
LoadedWallets holds all the upstream wallets managed by the loader
type Loader ¶
type Loader struct { // The full db path required to create the individual wallets follows the // format ~.cryptopower/[network_selected]/[asset_selected]/[wallet_ID]. // DbDirPath by default is only expected to hold the path upto the // [network_selected] folder. The other details are added on demand. DbDirPath string // DbDriver defines the type of database driver in use by the individual // wallets. DbDriver string }
func (*Loader) CreateDirPath ¶
func (l *Loader) CreateDirPath(WalletID, walletDbName string, assetType utils.AssetType) (dbPath string, err error)
CreateDirPath checks that fully qualified path to the wallet bucket exists. If it doesn't exist it's created. It also checks if the actual db file required exists, if it exists an error is returned otherwise it's created. Since the fully qualified path of the db is as follows: ~.cryptopower/[network_selected]/[asset_selected]/[wallet_ID]/[WalletDbName.db]. l.DbDirPath provides the path of the network_selected. assetType provides the asset_selected name, WalletID provides the wallet Id of the wallet needed. assetType and WalletID are provided for every new bucket instance needed.
func (*Loader) FileExists ¶
func (l *Loader) FileExists(WalletID, walletDbName string, assetType utils.AssetType) (string, bool, error)
FileExists checks if db bucket path identified by the following parameters exists.
func (*Loader) SetDatabaseDriver ¶
/SetDatabaseDriver specifies the database to be used by walletdb