Wallet API: generalize 'bool testnet' to 'NetworkType nettype'

This commit is contained in:
stoffu 2018-03-05 23:59:16 +09:00
parent af773211cb
commit 0e7ad2e2c9
No known key found for this signature in database
GPG key ID: 41DAB8343A9EC012
5 changed files with 103 additions and 42 deletions

View file

@ -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);
}