mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Expose wallet creation to the GUI via WalletController
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <primitives/block.h>
|
||||
#include <rpc/server.h>
|
||||
#include <shutdown.h>
|
||||
#include <support/allocators/secure.h>
|
||||
#include <sync.h>
|
||||
#include <txmempool.h>
|
||||
#include <ui_interface.h>
|
||||
@@ -43,6 +44,7 @@ fs::path GetWalletDir();
|
||||
std::vector<fs::path> ListWalletDir();
|
||||
std::vector<std::shared_ptr<CWallet>> GetWallets();
|
||||
std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const std::string& name, std::string& error, std::string& warning);
|
||||
WalletCreationStatus CreateWallet(interfaces::Chain& chain, const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::string& warning, std::shared_ptr<CWallet>& result);
|
||||
|
||||
namespace interfaces {
|
||||
|
||||
@@ -258,6 +260,13 @@ public:
|
||||
{
|
||||
return MakeWallet(LoadWallet(*m_interfaces.chain, name, error, warning));
|
||||
}
|
||||
WalletCreationStatus createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::string& warning, std::unique_ptr<Wallet>& result) override
|
||||
{
|
||||
std::shared_ptr<CWallet> wallet;
|
||||
WalletCreationStatus status = CreateWallet(*m_interfaces.chain, passphrase, wallet_creation_flags, name, error, warning, wallet);
|
||||
result = MakeWallet(wallet);
|
||||
return status;
|
||||
}
|
||||
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
|
||||
{
|
||||
return MakeHandler(::uiInterface.InitMessage_connect(fn));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <amount.h> // For CAmount
|
||||
#include <net.h> // For CConnman::NumConnections
|
||||
#include <netaddress.h> // For Network
|
||||
#include <support/allocators/secure.h> // For SecureString
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -27,6 +28,7 @@ class RPCTimerInterface;
|
||||
class UniValue;
|
||||
class proxyType;
|
||||
struct CNodeStateStats;
|
||||
enum class WalletCreationStatus;
|
||||
|
||||
namespace interfaces {
|
||||
class Handler;
|
||||
@@ -200,6 +202,9 @@ public:
|
||||
//! with handleLoadWallet.
|
||||
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, std::string& error, std::string& warning) = 0;
|
||||
|
||||
//! Create a wallet from file
|
||||
virtual WalletCreationStatus createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::string& warning, std::unique_ptr<Wallet>& result) = 0;
|
||||
|
||||
//! Register handler for init messages.
|
||||
using InitMessageFn = std::function<void(const std::string& message)>;
|
||||
virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0;
|
||||
|
||||
Reference in New Issue
Block a user