Skip to content

Commit ab288b4

Browse files
committed
interfaces: Add loadWallet to Node
1 parent 17abc0f commit ab288b4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/interfaces/node.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class CWallet;
4242
fs::path GetWalletDir();
4343
std::vector<fs::path> ListWalletDir();
4444
std::vector<std::shared_ptr<CWallet>> GetWallets();
45+
std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const std::string& name, std::string& error, std::string& warning);
4546

4647
namespace interfaces {
4748

@@ -252,6 +253,10 @@ class NodeImpl : public Node
252253
}
253254
return wallets;
254255
}
256+
std::unique_ptr<Wallet> loadWallet(const std::string& name, std::string& error, std::string& warning) override
257+
{
258+
return MakeWallet(LoadWallet(*m_interfaces.chain, name, error, warning));
259+
}
255260
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
256261
{
257262
return MakeHandler(::uiInterface.InitMessage_connect(fn));

src/interfaces/node.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ class Node
192192
//! Return interfaces for accessing wallets (if any).
193193
virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
194194

195+
//! Attempts to load a wallet from file or directory.
196+
//! The loaded wallet is also notified to handlers previously registered
197+
//! with handleLoadWallet.
198+
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, std::string& error, std::string& warning) = 0;
199+
195200
//! Register handler for init messages.
196201
using InitMessageFn = std::function<void(const std::string& message)>;
197202
virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0;

0 commit comments

Comments
 (0)