JSON API clean up.

This commit is contained in:
Arthur Britto
2013-04-08 16:14:35 -07:00
parent f9b18254ab
commit 85321afd44
2 changed files with 9 additions and 19 deletions

View File

@@ -1,6 +1,10 @@
Critical protocol changes
-------------------------
Mon Apr 8 16:13:12 PDT 2013
* The JSON field "inLedger" changing to "ledger_index"
Previous
* The JSON field "metaData" changing to "meta".
* RPC ledger will no longer take "ledger", use "ledger_hash" or "ledger_index".
* "ledgerClose" events:

View File

@@ -295,35 +295,21 @@ bool Transaction::convertToTransactions(uint32 firstLedgerSeq, uint32 secondLedg
// options 1 to include the date of the transaction
Json::Value Transaction::getJson(int options, bool binary) const
{
Json::Value ret(mTransaction->getJson(0, binary));
if (mInLedger)
if (mInLedger)
{
ret["inLedger"] = mInLedger;
ret["inLedger"] = mInLedger; // Deprecated.
ret["ledger_index"] = mInLedger;
if(options == 1)
if (options == 1)
{
Ledger::pointer ledger=theApp->getLedgerMaster().getLedgerBySeq(mInLedger);
if(ledger)
if (ledger)
ret["date"] = ledger->getCloseTimeNC();
}
}
switch (mStatus)
{
case NEW: ret["status"] = "new"; break;
case INVALID: ret["status"] = "invalid"; break;
case INCLUDED: ret["status"] = "included"; break;
case CONFLICTED: ret["status"] = "conflicted"; break;
case COMMITTED: ret["status"] = "committed"; break;
case HELD: ret["status"] = "held"; break;
case REMOVED: ret["status"] = "removed"; break;
case OBSOLETE: ret["status"] = "obsolete"; break;
case INCOMPLETE: ret["status"] = "incomplete"; break;
default: ret["status"] = "unknown"; break;
}
return ret;
}