diff --git a/src/daemon/MoneroDaemon.h b/src/daemon/MoneroDaemon.h index 791be29..4cb7930 100644 --- a/src/daemon/MoneroDaemon.h +++ b/src/daemon/MoneroDaemon.h @@ -27,4 +27,105 @@ namespace monero { //MoneroRpcConnection() : uri(""), username(""), password("")) {} MoneroRpcConnection(const string& uri = "", const string& username = "", const string& password = "") : uri(uri), username(username), password(password) {} }; + + // forward declarations + struct MoneroTx; + struct MoneroBlock; + + /** + * Models a Monero block header which contains information about the block. + */ + struct MoneroBlockHeader { + string id; + uint64_t height; + uint64_t timestamp; + uint64_t size; + uint64_t weight; + uint64_t longTermWeight; + uint64_t depth; + uint64_t difficulty; + uint64_t cumulativeDifficulty; + uint32_t majorVersion; + uint32_t minorVersion; + uint64_t nonce; + string coinbaseTxId; + uint32_t numTxs; + bool orphanStatus; + string prevId; + uint64_t reward; + }; + + /** + * Models a Monero block in the blockchain. + */ + struct MoneroBlock : public MoneroBlockHeader { + string hex; + MoneroTx coinbaseTx; + vector txs; + vector txIds; + }; + + /** + * Models a Monero key image. + */ + struct MoneroKeyImage { + string hex; + string signature; + }; + + /** + * Models a Monero transaction output. + */ + struct MoneroOutput { + MoneroTx* tx; + MoneroKeyImage keyImage; + uint64_t amount; + uint32_t index; + vector ringOutputIndices; + string stealthPublicKey; + }; + + /** + * Models a Monero transaction on the blockchain. + */ + struct MoneroTx { + MoneroBlock* block; + string id; + string version; + bool isCoinbase; + string paymentId; + uint64_t fee; + uint32_t mixin; + bool doNotRelay; + bool isRelayed; + bool isConfirmed; + bool inTxPool; + uint64_t numConfirmations; + uint64_t unlockTime; + uint64_t lastRelayedTimestamp; + uint64_t receivedTimestamp; + bool isDoubleSpend; + string key; + string fullHex; + string prunedHex; + string prunableHex; + string prunableHash; + uint32_t size; + uint32_t weight; + vector vins; + vector vouts; + vector outputIndices; + string metadata; + string commonTxSets; + //uint32_t* extra[]; // TODO: flexible member? + string rctSignatures; // TODO: implement + string rctSigPrunable; // TODO: implement + bool isKeptByBlock; + bool isFailed; + uint32_t lastFailedHeight; + string lastFailedId; + uint32_t maxUsedBlockHeight; + string maxUsedBlockId; + vector signatures; + }; } diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index 09a5b52..1316721 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -26,20 +26,6 @@ namespace monero { MoneroSyncResult(const uint64_t numBlocksFetched, const bool receivedMoney) : numBlocksFetched(numBlocksFetched), receivedMoney(receivedMoney) {} }; - /** - * Models a Monero block header. - */ - struct MoneroBlockHeader { - uint64_t height; - }; - - /** - * Models a Monero block. - */ - struct MoneroBlock : public MoneroBlockHeader { - // TODO - }; - /** * Models a Monero subaddress. */ @@ -90,6 +76,54 @@ namespace monero { END_KV_SERIALIZE_MAP() }; + // forward declarations + struct MoneroTxWallet; + + /** + * Models an outgoing transfer destination. + */ + struct MoneroDestination { + string address; + uint64_t amount; + }; + + /** + * Models a base transfer of funds to or from the wallet. + */ + struct MoneroTransfer { + MoneroTxWallet tx; + uint64_t amount; + uint32_t accountIndex; + bool isIncoming; + }; + + /** + * Models an incoming transfer of funds to the wallet. + */ + struct MoneroIncomingTransfer : public MoneroTransfer { + uint32_t subaddressIndex; + string address; + }; + + /** + * Models an outgoing transfer of funds from the wallet. + */ + struct MoneroOutgoingTransfer : public MoneroTransfer { + vector subaddressIndices; + vector addresses; + vector destinations; + }; + + /** + * Models a Monero transaction in the context of a wallet. + */ + struct MoneroTxWallet : public MoneroTx { + vector incomingTransfers; + MoneroOutgoingTransfer outgoingTransfer; + uint32_t numSuggestedConfirmations; + string note; + }; + // --------------------------------- LISTENERS ------------------------------ // class i_wallet2_callback