diff --git a/src/dummywallet.cpp b/src/dummywallet.cpp index 3714187a964..3eb77354c17 100644 --- a/src/dummywallet.cpp +++ b/src/dummywallet.cpp @@ -34,6 +34,16 @@ void DummyWalletInit::AddWalletOptions() const const WalletInitInterface& g_wallet_init_interface = DummyWalletInit(); +fs::path GetWalletDir() +{ + throw std::logic_error("Wallet function called in non-wallet build."); +} + +std::vector ListWalletDir() +{ + throw std::logic_error("Wallet function called in non-wallet build."); +} + std::vector> GetWallets() { throw std::logic_error("Wallet function called in non-wallet build."); diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index d95b41657ce..2b19e11f08a 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -38,6 +38,8 @@ #include class CWallet; +fs::path GetWalletDir(); +std::vector ListWalletDir(); std::vector> GetWallets(); namespace interfaces { @@ -218,6 +220,18 @@ class NodeImpl : public Node LOCK(::cs_main); return ::pcoinsTip->GetCoin(output, coin); } + std::string getWalletDir() override + { + return GetWalletDir().string(); + } + std::vector listWalletDir() override + { + std::vector paths; + for (auto& path : ListWalletDir()) { + paths.push_back(path.string()); + } + return paths; + } std::vector> getWallets() override { std::vector> wallets; diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 8185c015a9a..1f8bbbff7a8 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -173,6 +173,12 @@ public: //! Get unspent outputs associated with a transaction. virtual bool getUnspentOutput(const COutPoint& output, Coin& coin) = 0; + //! Return default wallet directory. + virtual std::string getWalletDir() = 0; + + //! Return available wallets in wallet directory. + virtual std::vector listWalletDir() = 0; + //! Return interfaces for accessing wallets (if any). virtual std::vector> getWallets() = 0;