ObsidianDragon - DragonX ImGui Wallet
Full-node GUI wallet for DragonX cryptocurrency. Built with Dear ImGui, SDL3, and OpenGL3/DX11. Features: - Send/receive shielded and transparent transactions - Autoshield with merged transaction display - Built-in CPU mining (xmrig) - Peer management and network monitoring - Wallet encryption with PIN lock - QR code generation for receive addresses - Transaction history with pagination - Console for direct RPC commands - Cross-platform (Linux, Windows)
This commit is contained in:
57
src/data/wallet_state.cpp
Normal file
57
src/data/wallet_state.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// DragonX Wallet - ImGui Edition
|
||||
// Copyright 2024-2026 The Hush Developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#include "wallet_state.h"
|
||||
#include <ctime>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
namespace dragonx {
|
||||
|
||||
std::string TransactionInfo::getTimeString() const
|
||||
{
|
||||
if (timestamp == 0) return "Unknown";
|
||||
|
||||
std::time_t t = static_cast<std::time_t>(timestamp);
|
||||
std::tm* tm = std::localtime(&t);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::put_time(tm, "%Y-%m-%d %H:%M");
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string TransactionInfo::getTypeDisplay() const
|
||||
{
|
||||
if (type == "send") return "Sent";
|
||||
if (type == "receive") return "Received";
|
||||
if (type == "mined" || type == "generate" || type == "immature") return "Mined";
|
||||
return type;
|
||||
}
|
||||
|
||||
std::string PeerInfo::getConnectionTime() const
|
||||
{
|
||||
if (conntime == 0) return "Unknown";
|
||||
|
||||
int64_t now = std::time(nullptr);
|
||||
int64_t diff = now - conntime;
|
||||
|
||||
if (diff < 60) return std::to_string(diff) + "s";
|
||||
if (diff < 3600) return std::to_string(diff / 60) + "m";
|
||||
if (diff < 86400) return std::to_string(diff / 3600) + "h";
|
||||
return std::to_string(diff / 86400) + "d";
|
||||
}
|
||||
|
||||
std::string BannedPeer::getBannedUntilString() const
|
||||
{
|
||||
if (banned_until == 0) return "Never";
|
||||
|
||||
std::time_t t = static_cast<std::time_t>(banned_until);
|
||||
std::tm* tm = std::localtime(&t);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::put_time(tm, "%Y-%m-%d %H:%M");
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
} // namespace dragonx
|
||||
Reference in New Issue
Block a user