mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Cw 462 monero polyseed restore support (#1109)
* CW-462 Mark Places to integrate Polyseed * CW-462 Add Restore from Polyseed * CW-462 Add Restore from Polyseed * CW-462 Add new Monero date-height pairs * CW-462 Little Cleanup * CW-462 Ups I missed that Debug line :/ * CW-462 Fix Polyseed not showing in Wallet-Seed/Keys Page * CW-462 Prepare for Wallet creation * CW-462 Fix merge conflict * CW-462 Fix generating monero.dart * CW-462 Add Polyseed generation * CW-462 Add Polyseed Languages to SeedLanguagePicker * CW-462 Apply requested changes * CW-462 Minor bug fixes in restore screen * Update wallet_restore_from_seed_form.dart * CW-462 Minor Bugfix * CW-462 Fix Restore from QR for Polyseeds * CW-462 Fix null-check-operator exception for Polyseeds and minor inconveniences * CW-462 Fix minor inconveniences * Fix conflicts and review comments and wrap unspent issue with try and catch with reporting failure --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
eeb9976d09
commit
00c97c74b8
57 changed files with 906 additions and 444 deletions
|
@ -374,6 +374,35 @@ extern "C"
|
|||
return true;
|
||||
}
|
||||
|
||||
bool restore_wallet_from_spend_key(char *path, char *password, char *seed, char *language, char *spendKey, int32_t networkType, uint64_t restoreHeight, char *error)
|
||||
{
|
||||
Monero::NetworkType _networkType = static_cast<Monero::NetworkType>(networkType);
|
||||
Monero::Wallet *wallet = Monero::WalletManagerFactory::getWalletManager()->createDeterministicWalletFromSpendKey(
|
||||
std::string(path),
|
||||
std::string(password),
|
||||
std::string(language),
|
||||
_networkType,
|
||||
(uint64_t)restoreHeight,
|
||||
std::string(spendKey));
|
||||
|
||||
int status;
|
||||
std::string errorString;
|
||||
|
||||
wallet->statusWithErrorString(status, errorString);
|
||||
|
||||
if (status != Monero::Wallet::Status_Ok || !errorString.empty())
|
||||
{
|
||||
error = strdup(errorString.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cache Raw to support Polyseed
|
||||
wallet->setCacheAttribute("cakewallet.seed", std::string(seed));
|
||||
|
||||
change_current_wallet(wallet);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool load_wallet(char *path, char *password, int32_t nettype)
|
||||
{
|
||||
nice(19);
|
||||
|
@ -438,6 +467,11 @@ extern "C"
|
|||
|
||||
const char *seed()
|
||||
{
|
||||
std::string _rawSeed = get_current_wallet()->getCacheAttribute("cakewallet.seed");
|
||||
if (!_rawSeed.empty())
|
||||
{
|
||||
return strdup(_rawSeed.c_str());
|
||||
}
|
||||
return strdup(get_current_wallet()->seed().c_str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue