mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-21 17:18:44 +02:00
added structs: MoneroTx, MoneroOutput, MoneroKeyImage, MoneroBlock,
MoneroBlockHeader, MoneroDestination, MoneroTransfer, MoneroIncomingTransfer, MoneroOutgoingTransfer, MoneroTxWallet; not compiling due incomplete types / circular struct references
This commit is contained in:
@@ -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<MoneroTx> txs;
|
||||
vector<string> 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<uint32_t> 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<MoneroOutput> vins;
|
||||
vector<MoneroOutput> vouts;
|
||||
vector<uint32_t> 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<string> signatures;
|
||||
};
|
||||
}
|
||||
|
||||
+48
-14
@@ -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<uint32_t> subaddressIndices;
|
||||
vector<string> addresses;
|
||||
vector<MoneroDestination> destinations;
|
||||
};
|
||||
|
||||
/**
|
||||
* Models a Monero transaction in the context of a wallet.
|
||||
*/
|
||||
struct MoneroTxWallet : public MoneroTx {
|
||||
vector<MoneroIncomingTransfer> incomingTransfers;
|
||||
MoneroOutgoingTransfer outgoingTransfer;
|
||||
uint32_t numSuggestedConfirmations;
|
||||
string note;
|
||||
};
|
||||
|
||||
// --------------------------------- LISTENERS ------------------------------
|
||||
|
||||
// class i_wallet2_callback
|
||||
|
||||
Reference in New Issue
Block a user