Preserve the previously-uncommitted lite wallet implementation and related dev WIP under version control: - src/wallet/ lite services: client bridge, bridge runtime, connection, lifecycle, sync, gateway, result parsers, state mapper, artifact contract/resolver, refresh services, UI adapters, wallet_backend/capabilities. (Includes two small M1 fixes: lifecycle walletReady now parses the response; default chain name -> "main".) - src/chat/ chat protocol; tests/fixtures/ (lite + hushchat); tools/hushchat_fixture_check.cpp; scripts/build-lite-backend-artifact.sh. - Pre-existing modified app_network/security/wizard, network_refresh_service, sidebar, mining_tab, bootstrap dialog, and version headers captured as-is. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
109 lines
3.3 KiB
C++
109 lines
3.3 KiB
C++
#pragma once
|
|
|
|
#include "lite_wallet_refresh_readiness_policy.h"
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace dragonx::wallet {
|
|
|
|
enum class LiteWalletAppRefreshOrchestrationStatus {
|
|
Queued,
|
|
Skipped,
|
|
Blocked,
|
|
};
|
|
|
|
enum class LiteWalletAppRefreshScheduleTrigger {
|
|
Periodic,
|
|
Manual,
|
|
Startup,
|
|
WalletOpened,
|
|
};
|
|
|
|
enum class LiteWalletAppRefreshOrchestrationIssue {
|
|
ReadinessRejected,
|
|
UnsafeReadinessReport,
|
|
SchedulerDisabled,
|
|
RefreshNotDue,
|
|
RefreshAlreadyQueued,
|
|
RefreshInProgress,
|
|
QueuePressure,
|
|
};
|
|
|
|
struct LiteWalletAppRefreshScheduleInput {
|
|
LiteWalletAppRefreshScheduleTrigger trigger = LiteWalletAppRefreshScheduleTrigger::Periodic;
|
|
bool schedulerEnabled = true;
|
|
bool refreshDue = false;
|
|
bool forceRefresh = false;
|
|
bool refreshAlreadyQueued = false;
|
|
bool refreshInProgress = false;
|
|
std::size_t queueDepth = 0;
|
|
std::size_t maxQueueDepth = 0;
|
|
};
|
|
|
|
struct LiteWalletAppRefreshOrchestratorOptions {
|
|
bool requireEligibleReadiness = true;
|
|
std::size_t maxQueueDepth = 0;
|
|
};
|
|
|
|
struct LiteWalletAppRefreshOrchestrationIssueInfo {
|
|
LiteWalletAppRefreshOrchestrationIssue issue = LiteWalletAppRefreshOrchestrationIssue::ReadinessRejected;
|
|
std::string message;
|
|
};
|
|
|
|
struct LiteWalletAppRefreshOrchestrationResult {
|
|
bool ok = false;
|
|
bool wouldQueueRefresh = false;
|
|
bool skipped = false;
|
|
bool blocked = false;
|
|
bool readinessAccepted = false;
|
|
bool schedulerAccepted = false;
|
|
bool dryRunOnly = true;
|
|
bool noNetwork = true;
|
|
bool stateMutationRequested = false;
|
|
bool stateMutationAllowed = false;
|
|
bool stateMutated = false;
|
|
bool walletStateWritten = false;
|
|
|
|
bool schedulerEnabled = true;
|
|
bool refreshDue = false;
|
|
bool forceRefresh = false;
|
|
bool refreshAlreadyQueued = false;
|
|
bool refreshInProgress = false;
|
|
std::size_t queueDepth = 0;
|
|
std::size_t maxQueueDepth = 0;
|
|
|
|
LiteWalletAppRefreshOrchestrationStatus status = LiteWalletAppRefreshOrchestrationStatus::Blocked;
|
|
LiteWalletAppRefreshScheduleTrigger trigger = LiteWalletAppRefreshScheduleTrigger::Periodic;
|
|
LiteWalletRefreshRouteKind route = LiteWalletRefreshRouteKind::Unavailable;
|
|
LiteWalletRefreshReadinessResult readinessResult;
|
|
std::vector<LiteWalletAppRefreshOrchestrationIssueInfo> issues;
|
|
std::string error;
|
|
};
|
|
|
|
const char* liteWalletAppRefreshOrchestrationStatusName(
|
|
LiteWalletAppRefreshOrchestrationStatus status);
|
|
const char* liteWalletAppRefreshScheduleTriggerName(
|
|
LiteWalletAppRefreshScheduleTrigger trigger);
|
|
const char* liteWalletAppRefreshOrchestrationIssueName(
|
|
LiteWalletAppRefreshOrchestrationIssue issue);
|
|
|
|
LiteWalletAppRefreshOrchestrationResult orchestrateLiteWalletAppRefresh(
|
|
const LiteWalletRefreshReadinessResult& readiness,
|
|
const LiteWalletAppRefreshScheduleInput& schedule,
|
|
LiteWalletAppRefreshOrchestratorOptions options = {});
|
|
|
|
class LiteWalletAppRefreshOrchestrator {
|
|
public:
|
|
explicit LiteWalletAppRefreshOrchestrator(LiteWalletAppRefreshOrchestratorOptions options = {});
|
|
|
|
LiteWalletAppRefreshOrchestrationResult evaluate(
|
|
const LiteWalletRefreshReadinessResult& readiness,
|
|
const LiteWalletAppRefreshScheduleInput& schedule) const;
|
|
|
|
private:
|
|
LiteWalletAppRefreshOrchestratorOptions options_;
|
|
};
|
|
|
|
} // namespace dragonx::wallet
|