mirror of
https://github.com/monero-project/monero.git
synced 2025-05-19 22:10:25 -04:00
Wallet API: generalize 'bool testnet' to 'NetworkType nettype'
This commit is contained in:
parent
af773211cb
commit
0e7ad2e2c9
5 changed files with 103 additions and 42 deletions
|
@ -60,46 +60,46 @@ namespace {
|
|||
namespace Monero {
|
||||
|
||||
Wallet *WalletManagerImpl::createWallet(const std::string &path, const std::string &password,
|
||||
const std::string &language, bool testnet)
|
||||
const std::string &language, NetworkType nettype)
|
||||
{
|
||||
WalletImpl * wallet = new WalletImpl(testnet);
|
||||
WalletImpl * wallet = new WalletImpl(nettype);
|
||||
wallet->create(path, password, language);
|
||||
return wallet;
|
||||
}
|
||||
|
||||
Wallet *WalletManagerImpl::openWallet(const std::string &path, const std::string &password, bool testnet)
|
||||
Wallet *WalletManagerImpl::openWallet(const std::string &path, const std::string &password, NetworkType nettype)
|
||||
{
|
||||
WalletImpl * wallet = new WalletImpl(testnet);
|
||||
WalletImpl * wallet = new WalletImpl(nettype);
|
||||
wallet->open(path, password);
|
||||
//Refresh addressBook
|
||||
wallet->addressBook()->refresh();
|
||||
return wallet;
|
||||
}
|
||||
|
||||
Wallet *WalletManagerImpl::recoveryWallet(const std::string &path, const std::string &mnemonic, bool testnet, uint64_t restoreHeight)
|
||||
Wallet *WalletManagerImpl::recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight)
|
||||
{
|
||||
return recoveryWallet(path, "", mnemonic, testnet, restoreHeight);
|
||||
return recoveryWallet(path, "", mnemonic, nettype, restoreHeight);
|
||||
}
|
||||
|
||||
Wallet *WalletManagerImpl::createWalletFromKeys(const std::string &path,
|
||||
const std::string &language,
|
||||
bool testnet,
|
||||
NetworkType nettype,
|
||||
uint64_t restoreHeight,
|
||||
const std::string &addressString,
|
||||
const std::string &viewKeyString,
|
||||
const std::string &spendKeyString)
|
||||
{
|
||||
return createWalletFromKeys(path, "", language, testnet, restoreHeight,
|
||||
return createWalletFromKeys(path, "", language, nettype, restoreHeight,
|
||||
addressString, viewKeyString, spendKeyString);
|
||||
}
|
||||
|
||||
Wallet *WalletManagerImpl::recoveryWallet(const std::string &path,
|
||||
const std::string &password,
|
||||
const std::string &mnemonic,
|
||||
bool testnet,
|
||||
NetworkType nettype,
|
||||
uint64_t restoreHeight)
|
||||
{
|
||||
WalletImpl * wallet = new WalletImpl(testnet);
|
||||
WalletImpl * wallet = new WalletImpl(nettype);
|
||||
if(restoreHeight > 0){
|
||||
wallet->setRefreshFromBlockHeight(restoreHeight);
|
||||
}
|
||||
|
@ -110,13 +110,13 @@ Wallet *WalletManagerImpl::recoveryWallet(const std::string &path,
|
|||
Wallet *WalletManagerImpl::createWalletFromKeys(const std::string &path,
|
||||
const std::string &password,
|
||||
const std::string &language,
|
||||
bool testnet,
|
||||
NetworkType nettype,
|
||||
uint64_t restoreHeight,
|
||||
const std::string &addressString,
|
||||
const std::string &viewKeyString,
|
||||
const std::string &spendKeyString)
|
||||
{
|
||||
WalletImpl * wallet = new WalletImpl(testnet);
|
||||
WalletImpl * wallet = new WalletImpl(nettype);
|
||||
if(restoreHeight > 0){
|
||||
wallet->setRefreshFromBlockHeight(restoreHeight);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue