mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 21:33:11 +02:00
wallet: Return util::Result
from WalletLoader methods
This commit is contained in:
@@ -88,7 +88,7 @@ public:
|
||||
virtual std::string getWalletName() = 0;
|
||||
|
||||
// Get a new address.
|
||||
virtual util::Result<CTxDestination> getNewDestination(const OutputType type, const std::string label) = 0;
|
||||
virtual util::Result<CTxDestination> getNewDestination(const OutputType type, const std::string& label) = 0;
|
||||
|
||||
//! Get public key.
|
||||
virtual bool getPubKey(const CScript& script, const CKeyID& address, CPubKey& pub_key) = 0;
|
||||
@@ -320,31 +320,31 @@ class WalletLoader : public ChainClient
|
||||
{
|
||||
public:
|
||||
//! Create new wallet.
|
||||
virtual std::unique_ptr<Wallet> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
|
||||
virtual util::Result<std::unique_ptr<Wallet>> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, std::vector<bilingual_str>& warnings) = 0;
|
||||
|
||||
//! Load existing wallet.
|
||||
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
|
||||
//! Load existing wallet.
|
||||
virtual util::Result<std::unique_ptr<Wallet>> loadWallet(const std::string& name, std::vector<bilingual_str>& warnings) = 0;
|
||||
|
||||
//! Return default wallet directory.
|
||||
virtual std::string getWalletDir() = 0;
|
||||
//! Return default wallet directory.
|
||||
virtual std::string getWalletDir() = 0;
|
||||
|
||||
//! Restore backup wallet
|
||||
virtual util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) = 0;
|
||||
//! Restore backup wallet
|
||||
virtual util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) = 0;
|
||||
|
||||
//! Return available wallets in wallet directory.
|
||||
virtual std::vector<std::string> listWalletDir() = 0;
|
||||
//! Return available wallets in wallet directory.
|
||||
virtual std::vector<std::string> listWalletDir() = 0;
|
||||
|
||||
//! Return interfaces for accessing wallets (if any).
|
||||
virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
|
||||
//! Return interfaces for accessing wallets (if any).
|
||||
virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
|
||||
|
||||
//! Register handler for load wallet messages. This callback is triggered by
|
||||
//! createWallet and loadWallet above, and also triggered when wallets are
|
||||
//! loaded at startup or by RPC.
|
||||
using LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>;
|
||||
virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0;
|
||||
//! Register handler for load wallet messages. This callback is triggered by
|
||||
//! createWallet and loadWallet above, and also triggered when wallets are
|
||||
//! loaded at startup or by RPC.
|
||||
using LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>;
|
||||
virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0;
|
||||
|
||||
//! Return pointer to internal context, useful for testing.
|
||||
virtual wallet::WalletContext* context() { return nullptr; }
|
||||
//! Return pointer to internal context, useful for testing.
|
||||
virtual wallet::WalletContext* context() { return nullptr; }
|
||||
};
|
||||
|
||||
//! Information about one wallet address.
|
||||
|
Reference in New Issue
Block a user