- Add refresh scheduler and network refresh service boundaries for typed refresh results, ordered RPC collectors, applicators, and price parsing. - Add daemon lifecycle and wallet security workflow helpers while preserving App-owned command RPC, decrypt, cancellation, and UI handoff behavior. - Split balance, console, mining, amount formatting, and async task logic into focused modules with expanded Phase 4 test coverage. - Fix market price loading by triggering price refresh immediately, avoiding queue-pressure drops, tracking loading/error state, and adding translations. - Polish send, explorer, peers, settings, theme/schema, and related tab UI. - Replace checked-in generated language headers with build-generated resources. - Document the cleanup audit, UI static-state guidance, and architecture updates.
79 lines
2.3 KiB
C++
79 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include "wallet_security_controller.h"
|
|
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace dragonx {
|
|
namespace services {
|
|
|
|
class WalletSecurityWorkflow {
|
|
public:
|
|
enum class DecryptPhase {
|
|
PassphraseEntry = 0,
|
|
Working = 1,
|
|
Success = 2,
|
|
Error = 3
|
|
};
|
|
|
|
enum class DecryptStep {
|
|
Unlock = 0,
|
|
ExportKeys = 1,
|
|
StopDaemon = 2,
|
|
BackupWallet = 3,
|
|
RestartDaemon = 4,
|
|
ImportKeys = 5
|
|
};
|
|
|
|
struct DecryptSnapshot {
|
|
DecryptPhase phase = DecryptPhase::PassphraseEntry;
|
|
DecryptStep step = DecryptStep::Unlock;
|
|
std::string status;
|
|
bool inProgress = false;
|
|
bool importActive = false;
|
|
std::chrono::steady_clock::time_point stepStarted{};
|
|
std::chrono::steady_clock::time_point overallStarted{};
|
|
};
|
|
|
|
struct WalletFilePlan {
|
|
std::string dataDir;
|
|
std::string exportFile;
|
|
std::string exportPath;
|
|
std::string walletPath;
|
|
std::string backupPath;
|
|
};
|
|
|
|
void reset();
|
|
void start(std::chrono::steady_clock::time_point now);
|
|
void advanceTo(DecryptStep step, std::string status,
|
|
std::chrono::steady_clock::time_point now);
|
|
void failEntry(std::string status);
|
|
void fail(std::string status);
|
|
void closeDialogForImport();
|
|
void finishImport();
|
|
|
|
DecryptSnapshot snapshot() const { return state_; }
|
|
DecryptPhase phase() const { return state_.phase; }
|
|
DecryptStep step() const { return state_.step; }
|
|
const std::string& status() const { return state_.status; }
|
|
bool inProgress() const { return state_.inProgress; }
|
|
bool importActive() const { return state_.importActive; }
|
|
bool canClose() const { return state_.phase != DecryptPhase::Working; }
|
|
|
|
static WalletFilePlan planWalletFiles(const std::string& dataDir,
|
|
std::uint64_t timestampSeconds);
|
|
static const char* stepStatus(DecryptStep step);
|
|
static const char* stepLabel(DecryptStep step);
|
|
static int stepIndex(DecryptStep step) { return static_cast<int>(step); }
|
|
static DecryptStep stepFromIndex(int step);
|
|
static bool stepIsComplete(DecryptStep current, DecryptStep candidate);
|
|
|
|
private:
|
|
DecryptSnapshot state_;
|
|
};
|
|
|
|
} // namespace services
|
|
} // namespace dragonx
|