aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet_manager.cpp
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-06-04 16:58:13 +0900
committerstoffu <stoffu@protonmail.ch>2018-06-21 12:36:27 +0900
commit46e90b7780459007b6bb74423c99f92791de77b4 (patch)
tree7955a78473a36dcdf0aa868ddc2d274eba567855 /src/wallet/api/wallet_manager.cpp
parentMove parse_subaddress_lookahead() from simplewallet.cpp to util.cpp (diff)
downloadmonero-46e90b7780459007b6bb74423c99f92791de77b4.tar.xz
Wallet API: add support for wallet creation from hardware device
Diffstat (limited to 'src/wallet/api/wallet_manager.cpp')
-rw-r--r--src/wallet/api/wallet_manager.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp
index a63716576..99eadc82f 100644
--- a/src/wallet/api/wallet_manager.cpp
+++ b/src/wallet/api/wallet_manager.cpp
@@ -114,6 +114,26 @@ Wallet *WalletManagerImpl::createWalletFromKeys(const std::string &path,
return wallet;
}
+Wallet *WalletManagerImpl::createWalletFromDevice(const std::string &path,
+ const std::string &password,
+ NetworkType nettype,
+ const std::string &deviceName,
+ uint64_t restoreHeight,
+ const std::string &subaddressLookahead)
+{
+ WalletImpl * wallet = new WalletImpl(nettype);
+ if(restoreHeight > 0){
+ wallet->setRefreshFromBlockHeight(restoreHeight);
+ }
+ auto lookahead = tools::parse_subaddress_lookahead(subaddressLookahead);
+ if (lookahead)
+ {
+ wallet->setSubaddressLookahead(lookahead->first, lookahead->second);
+ }
+ wallet->recoverFromDevice(path, password, deviceName);
+ return wallet;
+}
+
bool WalletManagerImpl::closeWallet(Wallet *wallet, bool store)
{
WalletImpl * wallet_ = dynamic_cast<WalletImpl*>(wallet);