#pragma once #include #include #include #include #include namespace dragonx::wallet { enum class LiteResultCommand { Info, Height, Balance, Addresses, List, Notes, SyncStatus, }; enum class LiteResultParserError { None, InvalidJson, ExpectedObject, ExpectedArray, MissingField, InvalidFieldType, InvalidFieldValue, }; enum class LiteSpendableOutputKind { UnspentNote, Utxo, PendingNote, PendingUtxo, }; enum class LiteTransactionDirection { Unknown, Send, Receive, }; struct LiteResultParserIssue { std::string path; std::string message; }; struct LiteParseResultBase { bool ok = false; LiteResultCommand command = LiteResultCommand::Info; LiteResultParserError error = LiteResultParserError::None; std::string errorPath; std::string errorMessage; std::vector issues; }; struct LiteInfoResponse { std::optional chainName; std::optional version; std::optional vendor; std::optional latestBlockHeight; std::optional difficulty; std::optional longestChain; std::optional notarized; }; struct LiteHeightResponse { std::int64_t height = 0; }; struct LiteBalanceResponse { std::uint64_t transparentBalance = 0; std::uint64_t shieldedBalance = 0; std::uint64_t unconfirmedBalance = 0; std::uint64_t verifiedShieldedBalance = 0; std::uint64_t spendableShieldedBalance = 0; }; struct LiteAddressesResponse { std::vector zAddresses; std::vector tAddresses; }; struct LiteSpendableOutput { LiteSpendableOutputKind kind = LiteSpendableOutputKind::UnspentNote; std::string address; std::string createdInTxid; std::optional createdInBlock; std::uint64_t value = 0; bool spent = false; bool unconfirmedSpent = false; bool pending = false; bool spendable = false; }; struct LiteNotesResponse { std::vector unspentNotes; std::vector utxos; std::vector pendingNotes; std::vector pendingUtxos; }; struct LiteTransactionOutput { std::string address; std::int64_t value = 0; std::string memo; }; struct LiteTransactionRecord { std::string txid; std::int64_t datetime = 0; std::optional blockHeight; bool unconfirmed = false; LiteTransactionDirection direction = LiteTransactionDirection::Unknown; std::string address; std::int64_t amount = 0; std::string memo; std::optional position; std::vector outgoingMetadata; }; struct LiteTransactionsResponse { std::vector transactions; }; struct LiteSyncStatusResponse { std::uint64_t syncedBlocks = 0; std::uint64_t totalBlocks = 0; double progress = 0.0; bool complete = false; }; struct LiteInfoParseResult : LiteParseResultBase { LiteInfoResponse info; }; struct LiteHeightParseResult : LiteParseResultBase { LiteHeightResponse height; }; struct LiteBalanceParseResult : LiteParseResultBase { LiteBalanceResponse balance; }; struct LiteAddressesParseResult : LiteParseResultBase { LiteAddressesResponse addresses; }; struct LiteNotesParseResult : LiteParseResultBase { LiteNotesResponse notes; }; struct LiteTransactionsParseResult : LiteParseResultBase { LiteTransactionsResponse transactions; }; struct LiteSyncStatusParseResult : LiteParseResultBase { LiteSyncStatusResponse syncStatus; }; const char* liteResultCommandName(LiteResultCommand command); const char* liteResultParserErrorName(LiteResultParserError error); const char* liteSpendableOutputKindName(LiteSpendableOutputKind kind); const char* liteTransactionDirectionName(LiteTransactionDirection direction); LiteInfoParseResult parseLiteInfoResponse(const std::string& jsonText); LiteInfoParseResult parseLiteInfoResponse(const nlohmann::json& value); LiteHeightParseResult parseLiteHeightResponse(const std::string& jsonText); LiteHeightParseResult parseLiteHeightResponse(const nlohmann::json& value); LiteBalanceParseResult parseLiteBalanceResponse(const std::string& jsonText); LiteBalanceParseResult parseLiteBalanceResponse(const nlohmann::json& value); LiteAddressesParseResult parseLiteAddressesResponse(const std::string& jsonText); LiteAddressesParseResult parseLiteAddressesResponse(const nlohmann::json& value); LiteNotesParseResult parseLiteNotesResponse(const std::string& jsonText); LiteNotesParseResult parseLiteNotesResponse(const nlohmann::json& value); LiteTransactionsParseResult parseLiteTransactionsResponse(const std::string& jsonText); LiteTransactionsParseResult parseLiteTransactionsResponse(const nlohmann::json& value); LiteSyncStatusParseResult parseLiteSyncStatusResponse(const std::string& jsonText); LiteSyncStatusParseResult parseLiteSyncStatusResponse(const nlohmann::json& value); } // namespace dragonx::wallet