#pragma once #include "lite_wallet_refresh_service.h" #include #include #include #include #include namespace dragonx::wallet { enum class LiteWalletAppAddressKind { Shielded, Transparent, }; enum class LiteWalletAppTransactionKind { Unknown, Send, Receive, }; enum class LiteWalletStateMapIssue { EmptyBundle, IncompleteBundle, }; struct LiteWalletAppChainModel { std::optional chainName; std::optional version; std::optional vendor; std::optional latestBlockHeight; std::optional difficulty; std::optional longestChain; std::optional notarized; }; struct LiteWalletAppHeightModel { std::int64_t height = 0; }; struct LiteWalletAppBalanceModel { std::uint64_t transparentZatoshis = 0; std::uint64_t shieldedZatoshis = 0; std::uint64_t unconfirmedZatoshis = 0; std::uint64_t verifiedShieldedZatoshis = 0; std::uint64_t spendableShieldedZatoshis = 0; std::uint64_t totalZatoshis = 0; }; struct LiteWalletAppAddressModel { std::string address; LiteWalletAppAddressKind kind = LiteWalletAppAddressKind::Shielded; bool spendabilityKnown = false; bool spendable = false; }; struct LiteWalletAppSpendableOutputModel { LiteSpendableOutputKind kind = LiteSpendableOutputKind::UnspentNote; std::string address; std::string createdInTxid; std::optional createdInBlock; std::uint64_t valueZatoshis = 0; bool spent = false; bool unconfirmedSpent = false; bool pending = false; bool spendable = false; }; struct LiteWalletAppTransactionOutputModel { std::string address; std::int64_t valueZatoshis = 0; std::string memo; }; struct LiteWalletAppTransactionModel { std::string txid; LiteWalletAppTransactionKind kind = LiteWalletAppTransactionKind::Unknown; std::int64_t timestamp = 0; std::optional blockHeight; bool unconfirmed = false; std::string address; std::int64_t amountZatoshis = 0; std::int64_t signedAmountZatoshis = 0; std::string memo; std::optional position; std::vector outgoingOutputs; }; struct LiteWalletAppSyncModel { std::uint64_t walletHeight = 0; std::uint64_t chainHeight = 0; double progress = 0.0; bool complete = false; }; struct LiteWalletAppRefreshModel { bool complete = false; bool hasChainInfo = false; bool hasHeight = false; bool hasBalance = false; bool hasAddresses = false; bool hasSpendableOutputs = false; bool hasTransactions = false; bool hasSyncStatus = false; std::size_t successfulCommandCount = 0; LiteWalletAppChainModel chain; LiteWalletAppHeightModel height; LiteWalletAppBalanceModel balance; LiteWalletAppSyncModel sync; std::vector addresses; std::vector spendableOutputs; std::vector transactions; }; struct LiteWalletStateMapIssueInfo { LiteWalletStateMapIssue issue = LiteWalletStateMapIssue::EmptyBundle; std::string message; }; struct LiteWalletStateMapResult { bool ok = false; bool stateMutationAllowed = false; LiteWalletAppRefreshModel model; std::vector issues; std::string error; }; const char* liteWalletAppAddressKindName(LiteWalletAppAddressKind kind); const char* liteWalletAppTransactionKindName(LiteWalletAppTransactionKind kind); const char* liteWalletStateMapIssueName(LiteWalletStateMapIssue issue); LiteWalletStateMapResult mapLiteWalletRefreshBundle(const LiteWalletRefreshBundle& bundle); LiteWalletStateMapResult mapLiteWalletRefreshResult(const LiteWalletRefreshResult& result); LiteWalletStateMapResult mapLiteWalletRefreshServiceResult(const LiteWalletRefreshServiceResult& result); } // namespace dragonx::wallet