feat(lite): lite wallet foundation (inherited working-tree state)

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>
This commit is contained in:
2026-06-04 21:15:28 -05:00
parent a78a13edf3
commit 863d015628
69 changed files with 39458 additions and 85 deletions

View File

@@ -0,0 +1,179 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#ifndef DRAGONX_LITE_BUILD
#define DRAGONX_LITE_BUILD 0
#endif
#ifndef DRAGONX_ENABLE_EMBEDDED_DAEMON
#define DRAGONX_ENABLE_EMBEDDED_DAEMON 1
#endif
#ifndef DRAGONX_ENABLE_LITE_BACKEND
#define DRAGONX_ENABLE_LITE_BACKEND 0
#endif
namespace dragonx {
namespace wallet {
enum class WalletBuildKind {
FullNode,
Lite
};
enum class WalletBackendKind {
FullNodeRpc,
LiteClient
};
enum class WalletUiSurface {
Overview,
Send,
Receive,
History,
Mining,
Market,
Console,
Peers,
Explorer,
Settings,
BootstrapDownload,
SetupWizard,
NodeSettings
};
struct WalletCapabilities {
WalletBuildKind buildKind = WalletBuildKind::FullNode;
WalletBackendKind backendKind = WalletBackendKind::FullNodeRpc;
bool fullNodeRpcAvailable = true;
bool embeddedDaemonAvailable = true;
bool fullNodePagesAvailable = true;
bool fullNodeLifecycleActionsAvailable = true;
bool soloMiningAvailable = true;
bool poolMiningAvailable = true;
bool liteBackendAvailable = false;
bool lightwalletdNetworkAvailable = false;
bool liteWalletLifecycleAvailable = false;
bool liteWalletSyncAvailable = false;
bool liteWalletSendAvailable = false;
};
constexpr bool isLiteBuild(WalletBuildKind buildKind)
{
return buildKind == WalletBuildKind::Lite;
}
constexpr bool isLiteBuild(const WalletCapabilities& capabilities)
{
return isLiteBuild(capabilities.buildKind);
}
constexpr bool isFullNodeBuild(WalletBuildKind buildKind)
{
return buildKind == WalletBuildKind::FullNode;
}
constexpr WalletCapabilities makeWalletCapabilities(
WalletBuildKind buildKind,
bool embeddedDaemonCompiled,
bool liteBackendLinked)
{
const bool liteBuild = isLiteBuild(buildKind);
const bool fullNodeBuild = !liteBuild;
const bool liteBackendAvailable = liteBuild && liteBackendLinked;
return WalletCapabilities{
buildKind,
liteBuild ? WalletBackendKind::LiteClient : WalletBackendKind::FullNodeRpc,
fullNodeBuild,
fullNodeBuild && embeddedDaemonCompiled,
fullNodeBuild,
fullNodeBuild,
fullNodeBuild,
true,
liteBackendAvailable,
liteBackendAvailable,
liteBackendAvailable,
liteBackendAvailable,
liteBackendAvailable
};
}
constexpr WalletBuildKind currentWalletBuildKind()
{
return DRAGONX_LITE_BUILD ? WalletBuildKind::Lite : WalletBuildKind::FullNode;
}
constexpr WalletCapabilities currentWalletCapabilities()
{
return makeWalletCapabilities(
currentWalletBuildKind(),
DRAGONX_ENABLE_EMBEDDED_DAEMON != 0,
DRAGONX_ENABLE_LITE_BACKEND != 0);
}
constexpr bool supportsEmbeddedDaemon(const WalletCapabilities& capabilities)
{
return capabilities.embeddedDaemonAvailable;
}
constexpr bool supportsFullNodeLifecycleActions(const WalletCapabilities& capabilities)
{
return capabilities.fullNodeLifecycleActionsAvailable;
}
constexpr bool supportsSoloMining(const WalletCapabilities& capabilities)
{
return capabilities.soloMiningAvailable;
}
constexpr bool supportsPoolMining(const WalletCapabilities& capabilities)
{
return capabilities.poolMiningAvailable;
}
constexpr bool supportsLiteBackend(const WalletCapabilities& capabilities)
{
return capabilities.liteBackendAvailable;
}
constexpr bool supportsWalletDataBackend(const WalletCapabilities& capabilities)
{
return capabilities.fullNodeRpcAvailable || capabilities.liteWalletSyncAvailable;
}
constexpr bool isUiSurfaceAvailable(const WalletCapabilities& capabilities,
WalletUiSurface surface)
{
switch (surface) {
case WalletUiSurface::Console:
case WalletUiSurface::Peers:
case WalletUiSurface::Explorer:
return capabilities.fullNodePagesAvailable;
case WalletUiSurface::BootstrapDownload:
case WalletUiSurface::SetupWizard:
case WalletUiSurface::NodeSettings:
return capabilities.fullNodeLifecycleActionsAvailable;
default:
return true;
}
}
constexpr bool uiSurfaceNeedsWalletData(WalletUiSurface surface)
{
switch (surface) {
case WalletUiSurface::Overview:
case WalletUiSurface::Send:
case WalletUiSurface::Receive:
case WalletUiSurface::History:
return true;
default:
return false;
}
}
} // namespace wallet
} // namespace dragonx