fix: wownero seed giving incorrect

add: pr-comment.yaml
This commit is contained in:
Czarek Nakamoto
2024-06-30 11:53:21 +00:00
parent eaa7bdb8be
commit 8af6b773b7
3 changed files with 110 additions and 23 deletions

View File

@@ -1870,32 +1870,45 @@ uint64_t WOWNERO_cw_WalletListener_height(void* cw_walletListener_ptr) {
// https://github.com/cypherstack/flutter_libmonero/blob/2c684cedba6c3d9353c7ea748cadb5a246008027/cw_wownero/ios/Classes/wownero_api.cpp#L240
// this code slightly goes against the way of being simple
void* WOWNERO_deprecated_restore14WordSeed(char *path, char *password, char *seed, int32_t networkType) {
Monero::NetworkType _networkType = static_cast<Monero::NetworkType>(networkType);
Monero::WalletManager *walletManager = Monero::WalletManagerFactory::getWalletManager();
try {
Monero::NetworkType _networkType = static_cast<Monero::NetworkType>(networkType);
// 14 word seeds /*
wownero_seed wow_seed(seed, "wownero");
// 14 word seeds /*
wownero_seed wow_seed(seed, "wownero");
std::stringstream seed_stream;
seed_stream << wow_seed;
std::string seed_str = seed_stream.str();
std::stringstream seed_stream;
seed_stream << wow_seed;
std::string seed_str = seed_stream.str();
std::stringstream key_stream;
key_stream << wow_seed.key();
std::string spendKey = key_stream.str();
std::stringstream key_stream;
key_stream << wow_seed.key();
std::string spendKey = key_stream.str();
uint64_t restoreHeight = wow_seed.blockheight();
uint64_t restoreHeight = wow_seed.blockheight();
Monero::Wallet *wallet = walletManager->createDeterministicWalletFromSpendKey(
std::string(path),
std::string(password),
"English",
static_cast<Monero::NetworkType>(_networkType),
(uint64_t)restoreHeight,
spendKey,
1);
wallet->setCacheAttribute("cake.seed", seed_str);
return reinterpret_cast<void*>(wallet);
Monero::Wallet *wallet = walletManager->createDeterministicWalletFromSpendKey(
std::string(path),
std::string(password),
"English",
static_cast<Monero::NetworkType>(_networkType),
(uint64_t)restoreHeight,
spendKey,
1);
wallet->setCacheAttribute("cake.seed", seed_str);
return reinterpret_cast<void*>(wallet);
} catch (...) {
// fallback code so wallet->status() returns at least something.. eh..
Monero::Wallet *wallet = walletManager->recoveryWallet(
"/",
"",
"invalid mnemonic",
static_cast<Monero::NetworkType>(networkType),
0,
1,
"");
return reinterpret_cast<void*>(wallet);
}
}
uint64_t WOWNERO_deprecated_14WordSeedHeight(char *seed) {