1
0

Transaction list

This commit is contained in:
Scott E. Graves
2017-05-08 16:08:47 -05:00
parent d808c9e638
commit 9f04f4cf9e
5 changed files with 101 additions and 17 deletions

View File

@@ -8,24 +8,12 @@
NS_BEGIN(Sia)
NS_BEGIN(Api)
class SIADRIVE_EXPORTABLE CSiaTransaction
{
public:
CSiaTransaction();
~CSiaTransaction();
Property(SString, Date, public, private)
Property(SString, Amount, public, private)
Property(SString, Address, public, private)
Property(SString, TransactionId, public, private)
};
class CSiaTransaction;
typedef std::shared_ptr<CSiaTransaction> CSiaTransactionPtr;
typedef std::vector<CSiaTransactionPtr> CSiaTransactionList;
typedef std::shared_ptr<CSiaTransactionList> CSiaTransactionListPtr;
class CSiaDriveConfig;
class SIADRIVE_EXPORTABLE CSiaBase
{
public:
@@ -151,7 +139,7 @@ public:
CSiaError<_SiaApiErrorCode> Lock();
CSiaError<_SiaApiErrorCode> Unlock(const SString& password);
CSiaError<_SiaApiErrorCode> Send(const SString& address, const SiaCurrency& amount);
CSiaTransactionListPtr GetTransactionHistory();
CSiaTransactionListPtr GetTransactionHistory() const;
};
class SIADRIVE_EXPORTABLE _CSiaRenter :

View File

@@ -113,7 +113,15 @@ get_access:\
set_access:\
type Set##name(const type& value) { json_doc[#name] = value; return value; }\
protected:\
bool Check##name() { return json_doc.find(#name) != json_doc.end(); }
bool Check##name() { return json_doc.find(#name) != json_doc.end(); }
#define JProperty2(type, name, json_name, get_access, set_access, json_doc) \
get_access:\
type Get##name() const { return json_doc[#json_name].get<type>();}\
set_access:\
type Set##name(const type& value) { json_doc[#json_name] = value; return value; }\
protected:\
bool Check##name() { return json_doc.find(#json_name) != json_doc.end(); }
#define JPropertyCb(type, name, get_access, set_access, json_doc, cb) \
get_access:\

View File

@@ -0,0 +1,60 @@
#ifndef _SIATRANSACTION_H
#define _SIATRANSACTION_H
#include <siacommon.h>
NS_BEGIN(Sia)
NS_BEGIN(Api)
class SIADRIVE_EXPORTABLE CSiaTransaction
{
public:
class CSiaInput
{
public:
CSiaInput(const json& json);
private:
json _json;
JProperty2(std::string, FundType, fundtype, public, private, _json)
JProperty2(bool, WalletAddress, walletaddress, public, private, _json)
JProperty2(std::string, RelatedAddress, relatedaddress, public, private, _json)
JProperty2(std::string, Value, value, public, private, _json)
};
typedef std::shared_ptr<CSiaInput> CSiaInputPtr;
public:
class CSiaOutput
{
public:
CSiaOutput(const json& txData);
private:
json _json;
JProperty2(std::string, FundType, fundtype, public, private, _json)
JProperty2(std::uint64_t, MaturityHeight, maturityheight, public, private, _json)
JProperty2(bool, WalletAddress, walletaddress, public, private, _json)
JProperty2(std::string, RelatedAddress, relatedaddress, public, private, _json)
JProperty2(std::string, Value, value, public, private, _json)
};
typedef std::shared_ptr<CSiaOutput> CSiaOutputPtr;
public:
CSiaTransaction(const json& txData);
private:
json _json;
JProperty2(std::uint64_t, ConfirmationTimeStamp, confirmationtimestamp, public, private, _json)
JProperty2(std::uint64_t, ConfirmationHeight, confirmationheight, public, private, _json)
JProperty2(std::string, Transaction, transaction, public, private, _json)
JProperty2(std::string, TransactionId, transactionid, public, private, _json)
Property(std::vector<CSiaInputPtr>, Inputs, public, private)
Property(std::vector<CSiaOutputPtr>, Outputs, public, private)
};
NS_END(2)
#endif