diff --git a/src/ripple/app/ledger/AcceptedLedgerTx.cpp b/src/ripple/app/ledger/AcceptedLedgerTx.cpp index e90b2bcae..20a2c3137 100644 --- a/src/ripple/app/ledger/AcceptedLedgerTx.cpp +++ b/src/ripple/app/ledger/AcceptedLedgerTx.cpp @@ -77,11 +77,11 @@ std::string AcceptedLedgerTx::getEscMeta () const void AcceptedLedgerTx::buildJson () { mJson = Json::objectValue; - mJson[jss::transaction] = mTxn->getJson (0); + mJson[jss::transaction] = mTxn->getJson (JsonOptions::none); if (mMeta) { - mJson[jss::meta] = mMeta->getJson (0); + mJson[jss::meta] = mMeta->getJson (JsonOptions::none); mJson[jss::raw_meta] = strHex (mRawMeta); } diff --git a/src/ripple/app/ledger/Ledger.cpp b/src/ripple/app/ledger/Ledger.cpp index 53a76a1f6..cf764f4ae 100644 --- a/src/ripple/app/ledger/Ledger.cpp +++ b/src/ripple/app/ledger/Ledger.cpp @@ -928,7 +928,7 @@ static bool saveValidatedLedger ( << "Transaction in ledger " << seq << " affects no accounts"; JLOG (j.warn()) - << vt.second->getTxn()->getJson(0); + << vt.second->getTxn()->getJson(JsonOptions::none); } *db << diff --git a/src/ripple/app/ledger/LedgerHistory.cpp b/src/ripple/app/ledger/LedgerHistory.cpp index a470a0153..fd097b59d 100644 --- a/src/ripple/app/ledger/LedgerHistory.cpp +++ b/src/ripple/app/ledger/LedgerHistory.cpp @@ -153,7 +153,7 @@ log_one( { JLOG (j.debug()) << "MISMATCH on TX " << tx << ": " << msg << " is missing this transaction:\n" << - metaData->getJson (0); + metaData->getJson (JsonOptions::none); } else { @@ -242,9 +242,9 @@ log_metadata_difference( JLOG (j.debug()) << "MISMATCH on TX " << tx << ": Different result, index and nodes!"; JLOG (j.debug()) << " Built:\n" << - builtMetaData->getJson (0); + builtMetaData->getJson (JsonOptions::none); JLOG (j.debug()) << " Valid:\n" << - validMetaData->getJson (0); + validMetaData->getJson (JsonOptions::none); } else if (result_diff) { @@ -252,10 +252,10 @@ log_metadata_difference( ": Different result and nodes!"; JLOG (j.debug()) << " Built:" << " Result: " << builtMetaData->getResult () << - " Nodes:\n" << builtNodes.getJson (0); + " Nodes:\n" << builtNodes.getJson (JsonOptions::none); JLOG (j.debug()) << " Valid:" << " Result: " << validMetaData->getResult () << - " Nodes:\n" << validNodes.getJson (0); + " Nodes:\n" << validNodes.getJson (JsonOptions::none); } else if (index_diff) { @@ -263,19 +263,19 @@ log_metadata_difference( ": Different index and nodes!"; JLOG (j.debug()) << " Built:" << " Index: " << builtMetaData->getIndex () << - " Nodes:\n" << builtNodes.getJson (0); + " Nodes:\n" << builtNodes.getJson (JsonOptions::none); JLOG (j.debug()) << " Valid:" << " Index: " << validMetaData->getIndex () << - " Nodes:\n" << validNodes.getJson (0); + " Nodes:\n" << validNodes.getJson (JsonOptions::none); } else // nodes_diff { JLOG (j.debug()) << "MISMATCH on TX " << tx << ": Different nodes!"; JLOG (j.debug()) << " Built:" << - " Nodes:\n" << builtNodes.getJson (0); + " Nodes:\n" << builtNodes.getJson (JsonOptions::none); JLOG (j.debug()) << " Valid:" << - " Nodes:\n" << validNodes.getJson (0); + " Nodes:\n" << validNodes.getJson (JsonOptions::none); } } } @@ -283,13 +283,13 @@ log_metadata_difference( { JLOG (j.error()) << "MISMATCH on TX " << tx << ": Metadata Difference (built has none)\n" << - validMetaData->getJson (0); + validMetaData->getJson (JsonOptions::none); } else // builtMetaData != nullptr { JLOG (j.error()) << "MISMATCH on TX " << tx << ": Metadata Difference (valid has none)\n" << - builtMetaData->getJson (0); + builtMetaData->getJson (JsonOptions::none); } } diff --git a/src/ripple/app/ledger/impl/LedgerToJson.cpp b/src/ripple/app/ledger/impl/LedgerToJson.cpp index 13404272a..26943b494 100644 --- a/src/ripple/app/ledger/impl/LedgerToJson.cpp +++ b/src/ripple/app/ledger/impl/LedgerToJson.cpp @@ -120,10 +120,10 @@ fillJsonTx( } else { - copyFrom(txJson, txn->getJson(0)); + copyFrom(txJson, txn->getJson(JsonOptions::none)); if (stMeta) { - txJson[jss::metaData] = stMeta->getJson(0); + txJson[jss::metaData] = stMeta->getJson(JsonOptions::none); if (txnType == ttPAYMENT || txnType == ttCHECK_CASH) { // Insert delivered amount @@ -197,7 +197,7 @@ void fillJsonState(Object& json, LedgerFill const& fill) obj[jss::tx_blob] = serializeHex(*sle); } else if (expanded) - array.append(sle->getJson(0)); + array.append(sle->getJson(JsonOptions::none)); else array.append(to_string(sle->key())); } diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 77bf99081..7477d4cec 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -1225,7 +1225,8 @@ Json::Value NetworkOPsImp::getOwnerInfo ( if (!jvObjects.isMember (jss::offers)) jvObjects[jss::offers] = Json::Value (Json::arrayValue); - jvObjects[jss::offers].append (sleCur->getJson (0)); + jvObjects[jss::offers].append ( + sleCur->getJson (JsonOptions::none)); break; case ltRIPPLE_STATE: @@ -1235,7 +1236,8 @@ Json::Value NetworkOPsImp::getOwnerInfo ( Json::Value (Json::arrayValue); } - jvObjects[jss::ripple_lines].append (sleCur->getJson (0)); + jvObjects[jss::ripple_lines].append ( + sleCur->getJson (JsonOptions::none)); break; case ltACCOUNT_ROOT: @@ -2515,7 +2517,7 @@ Json::Value NetworkOPsImp::transJson( transResultInfo (terResult, sToken, sHuman); jvObj[jss::type] = "transaction"; - jvObj[jss::transaction] = stTxn.getJson (0); + jvObj[jss::transaction] = stTxn.getJson (JsonOptions::none); if (bValidated) { @@ -2566,7 +2568,7 @@ void NetworkOPsImp::pubValidatedTransaction ( if (auto const txMeta = alTx.getMeta()) { - jvObj[jss::meta] = txMeta->getJson(0); + jvObj[jss::meta] = txMeta->getJson(JsonOptions::none); RPC::insertDeliveredAmount( jvObj[jss::meta], *alAccepted, stTxn, *txMeta); } @@ -2685,7 +2687,7 @@ void NetworkOPsImp::pubAccountTransaction ( { if (auto const txMeta = alTx.getMeta()) { - jvObj[jss::meta] = txMeta->getJson(0); + jvObj[jss::meta] = txMeta->getJson(JsonOptions::none); RPC::insertDeliveredAmount( jvObj[jss::meta], *lpCurrent, stTxn, *txMeta); } @@ -3134,7 +3136,7 @@ void NetworkOPsImp::getBookPage ( } } - Json::Value jvOffer = sleOffer->getJson (0); + Json::Value jvOffer = sleOffer->getJson (JsonOptions::none); STAmount saTakerGetsFunded; STAmount saOwnerFundsLimit = saOwnerFunds; @@ -3284,7 +3286,7 @@ void NetworkOPsImp::getBookPage ( } } - Json::Value jvOffer = sleOffer->getJson (0); + Json::Value jvOffer = sleOffer->getJson (JsonOptions::none); STAmount saTakerGetsFunded; STAmount saOwnerFundsLimit = saOwnerFunds; diff --git a/src/ripple/app/misc/Transaction.h b/src/ripple/app/misc/Transaction.h index aad12b011..9fe77f3dc 100644 --- a/src/ripple/app/misc/Transaction.h +++ b/src/ripple/app/misc/Transaction.h @@ -154,7 +154,7 @@ public: mApplying = false; } - Json::Value getJson (int options, bool binary = false) const; + Json::Value getJson (JsonOptions options, bool binary = false) const; static Transaction::pointer load (uint256 const& id, Application& app); diff --git a/src/ripple/app/misc/impl/Transaction.cpp b/src/ripple/app/misc/impl/Transaction.cpp index 2c99dbdd3..1f84e7c49 100644 --- a/src/ripple/app/misc/impl/Transaction.cpp +++ b/src/ripple/app/misc/impl/Transaction.cpp @@ -144,16 +144,16 @@ Transaction::pointer Transaction::load(uint256 const& id, Application& app) } // options 1 to include the date of the transaction -Json::Value Transaction::getJson (int options, bool binary) const +Json::Value Transaction::getJson (JsonOptions options, bool binary) const { - Json::Value ret (mTransaction->getJson (0, binary)); + Json::Value ret (mTransaction->getJson (JsonOptions::none, binary)); if (mInLedger) { ret[jss::inLedger] = mInLedger; // Deprecated. ret[jss::ledger_index] = mInLedger; - if (options == 1) + if (options == JsonOptions::include_date) { auto ct = mApp.getLedgerMaster(). getCloseTimeBySeq (mInLedger); diff --git a/src/ripple/app/paths/PathRequest.cpp b/src/ripple/app/paths/PathRequest.cpp index 75046c3fc..d08f1c28a 100644 --- a/src/ripple/app/paths/PathRequest.cpp +++ b/src/ripple/app/paths/PathRequest.cpp @@ -585,11 +585,13 @@ PathRequest::findPaths (std::shared_ptr const& cache, { Json::Value jvEntry (Json::objectValue); rc.actualAmountIn.setIssuer (sourceAccount); - jvEntry[jss::source_amount] = rc.actualAmountIn.getJson (0); - jvEntry[jss::paths_computed] = ps.getJson(0); + jvEntry[jss::source_amount] = + rc.actualAmountIn.getJson (JsonOptions::none); + jvEntry[jss::paths_computed] = ps.getJson(JsonOptions::none); if (convert_all_) - jvEntry[jss::destination_amount] = rc.actualAmountOut.getJson(0); + jvEntry[jss::destination_amount] = + rc.actualAmountOut.getJson(JsonOptions::none); if (hasCompletion ()) { @@ -643,7 +645,8 @@ Json::Value PathRequest::doUpdate( newStatus[jss::source_account] = app_.accountIDCache().toBase58(*raSrcAccount); newStatus[jss::destination_account] = app_.accountIDCache().toBase58(*raDstAccount); - newStatus[jss::destination_amount] = saDstAmount.getJson (0); + newStatus[jss::destination_amount] = + saDstAmount.getJson (JsonOptions::none); newStatus[jss::full_reply] = ! fast; if (jvId) diff --git a/src/ripple/app/paths/PathState.cpp b/src/ripple/app/paths/PathState.cpp index 89715f813..2aab1c769 100644 --- a/src/ripple/app/paths/PathState.cpp +++ b/src/ripple/app/paths/PathState.cpp @@ -432,7 +432,7 @@ TER PathState::expandPath ( // Sender is always issuer for non-XRP. JLOG (j_.trace()) - << "expandPath> " << spSourcePath.getJson (0); + << "expandPath> " << spSourcePath.getJson (JsonOptions::none); terStatus = tesSUCCESS; @@ -835,22 +835,22 @@ Json::Value PathState::getJson () const jvPathState[jss::nodes] = jvNodes; if (saInReq) - jvPathState["in_req"] = saInReq.getJson (0); + jvPathState["in_req"] = saInReq.getJson (JsonOptions::none); if (saInAct) - jvPathState["in_act"] = saInAct.getJson (0); + jvPathState["in_act"] = saInAct.getJson (JsonOptions::none); if (saInPass) - jvPathState["in_pass"] = saInPass.getJson (0); + jvPathState["in_pass"] = saInPass.getJson (JsonOptions::none); if (saOutReq) - jvPathState["out_req"] = saOutReq.getJson (0); + jvPathState["out_req"] = saOutReq.getJson (JsonOptions::none); if (saOutAct) - jvPathState["out_act"] = saOutAct.getJson (0); + jvPathState["out_act"] = saOutAct.getJson (JsonOptions::none); if (saOutPass) - jvPathState["out_pass"] = saOutPass.getJson (0); + jvPathState["out_pass"] = saOutPass.getJson (JsonOptions::none); if (uQuality) jvPathState["uQuality"] = boost::lexical_cast(uQuality); diff --git a/src/ripple/app/paths/Pathfinder.cpp b/src/ripple/app/paths/Pathfinder.cpp index 82e107cd5..593b2c719 100644 --- a/src/ripple/app/paths/Pathfinder.cpp +++ b/src/ripple/app/paths/Pathfinder.cpp @@ -383,7 +383,7 @@ TER Pathfinder::getPathLiquidity ( { JLOG (j_.info()) << "checkpath: exception (" << e.what() << ") " << - path.getJson (0); + path.getJson (JsonOptions::none); return tefEXCEPTION; } } @@ -512,13 +512,13 @@ void Pathfinder::rankPaths ( JLOG (j_.debug()) << "findPaths: dropping : " << transToken (resultCode) << - ": " << currentPath.getJson (0); + ": " << currentPath.getJson (JsonOptions::none); } else { JLOG (j_.debug()) << "findPaths: quality: " << uQuality << - ": " << currentPath.getJson (0); + ": " << currentPath.getJson (JsonOptions::none); rankedPaths.push_back ({uQuality, currentPath.size (), liquidity, i}); @@ -656,12 +656,14 @@ Pathfinder::getBestPaths ( // We found an extra path that can move the whole amount. fullLiquidityPath = (startsWithIssuer ? removeIssuer (path) : path); JLOG (j_.debug()) << - "Found extra full path: " << fullLiquidityPath.getJson (0); + "Found extra full path: " << + fullLiquidityPath.getJson (JsonOptions::none); } else { JLOG (j_.debug()) << - "Skipping a non-filling path: " << path.getJson (0); + "Skipping a non-filling path: " << + path.getJson (JsonOptions::none); } } @@ -674,7 +676,8 @@ Pathfinder::getBestPaths ( else { JLOG (j_.debug()) << - "findPaths: RESULTS: " << bestPaths.getJson (0); + "findPaths: RESULTS: " << + bestPaths.getJson (JsonOptions::none); } return bestPaths; } @@ -906,7 +909,7 @@ void Pathfinder::addLink ( JLOG (j_.trace()) << "addLink< flags=" << addFlags << " onXRP=" << bOnXRP; - JLOG (j_.trace()) << currentPath.getJson (0); + JLOG (j_.trace()) << currentPath.getJson (JsonOptions::none); if (addFlags & afADD_ACCOUNTS) { @@ -916,7 +919,8 @@ void Pathfinder::addLink ( if (mDstAmount.native () && !currentPath.empty ()) { // non-default path to XRP destination JLOG (j_.trace()) - << "complete path found ax: " << currentPath.getJson(0); + << "complete path found ax: " + << currentPath.getJson(JsonOptions::none); addUniquePath (mCompletePaths, currentPath); } } @@ -990,7 +994,7 @@ void Pathfinder::addLink ( { JLOG (j_.trace()) << "complete path found ae: " - << currentPath.getJson (0); + << currentPath.getJson (JsonOptions::none); addUniquePath (mCompletePaths, currentPath); } @@ -1110,7 +1114,7 @@ void Pathfinder::addLink ( // complete JLOG (j_.trace()) << "complete path found bx: " - << currentPath.getJson(0); + << currentPath.getJson(JsonOptions::none); addUniquePath (mCompletePaths, newPath); } else @@ -1153,7 +1157,7 @@ void Pathfinder::addLink ( { // with the destination account, this path is complete JLOG (j_.trace()) << "complete path found ba: " - << currentPath.getJson(0); + << currentPath.getJson(JsonOptions::none); addUniquePath (mCompletePaths, newPath); } else diff --git a/src/ripple/app/paths/impl/PaySteps.cpp b/src/ripple/app/paths/impl/PaySteps.cpp index dc299657d..edaac72ed 100644 --- a/src/ripple/app/paths/impl/PaySteps.cpp +++ b/src/ripple/app/paths/impl/PaySteps.cpp @@ -779,7 +779,8 @@ toStrands ( { lastFailTer = ter; JLOG (j.trace()) - << "failed to add path: ter: " << ter << "path: " << p.getJson(0); + << "failed to add path: ter: " << ter + << "path: " << p.getJson(JsonOptions::none); if (isTemMalformed (ter)) return {ter, std::vector{}}; } diff --git a/src/ripple/app/tx/impl/ApplyContext.cpp b/src/ripple/app/tx/impl/ApplyContext.cpp index 3468b04a9..6d479c8bb 100644 --- a/src/ripple/app/tx/impl/ApplyContext.cpp +++ b/src/ripple/app/tx/impl/ApplyContext.cpp @@ -121,7 +121,7 @@ ApplyContext::checkInvariantsHelper( { JLOG(journal.fatal()) << "Transaction has failed one or more invariants: " << - to_string(tx.getJson (0)); + to_string(tx.getJson (JsonOptions::none)); return failInvariantCheck (result); } @@ -131,7 +131,7 @@ ApplyContext::checkInvariantsHelper( JLOG(journal.fatal()) << "Transaction caused an exception in an invariant" << ", ex: " << ex.what() << - ", tx: " << to_string(tx.getJson (0)); + ", tx: " << to_string(tx.getJson (JsonOptions::none)); return failInvariantCheck (result); } diff --git a/src/ripple/app/tx/impl/Transactor.cpp b/src/ripple/app/tx/impl/Transactor.cpp index 5c7fd6781..fd7df0cbd 100644 --- a/src/ripple/app/tx/impl/Transactor.cpp +++ b/src/ripple/app/tx/impl/Transactor.cpp @@ -635,8 +635,8 @@ Transactor::operator()() { JLOG(j_.fatal()) << "Transaction serdes mismatch"; - JLOG(j_.info()) << to_string(ctx_.tx.getJson (0)); - JLOG(j_.fatal()) << s2.getJson (0); + JLOG(j_.info()) << to_string(ctx_.tx.getJson (JsonOptions::none)); + JLOG(j_.fatal()) << s2.getJson (JsonOptions::none); assert (false); } } diff --git a/src/ripple/ledger/TxMeta.h b/src/ripple/ledger/TxMeta.h index 9c2abfbd1..d5ea4ad0a 100644 --- a/src/ripple/ledger/TxMeta.h +++ b/src/ripple/ledger/TxMeta.h @@ -102,7 +102,7 @@ public: boost::container::flat_set getAffectedAccounts(beast::Journal j) const; - Json::Value getJson (int p) const + Json::Value getJson (JsonOptions p) const { return getAsObject ().getJson (p); } diff --git a/src/ripple/ledger/impl/ApplyStateTable.cpp b/src/ripple/ledger/impl/ApplyStateTable.cpp index 90c68c95a..aa04f2962 100644 --- a/src/ripple/ledger/impl/ApplyStateTable.cpp +++ b/src/ripple/ledger/impl/ApplyStateTable.cpp @@ -246,7 +246,7 @@ ApplyStateTable::apply (OpenView& to, // VFALCO For diagnostics do we want to show // metadata even when the base view is open? JLOG(j.trace()) << - "metadata " << meta.getJson (0); + "metadata " << meta.getJson (JsonOptions::none); } to.rawTxInsert( tx.getTransactionID(), diff --git a/src/ripple/ledger/impl/TxMeta.cpp b/src/ripple/ledger/impl/TxMeta.cpp index 3ed98ba96..482c5d93b 100644 --- a/src/ripple/ledger/impl/TxMeta.cpp +++ b/src/ripple/ledger/impl/TxMeta.cpp @@ -151,7 +151,8 @@ TxMeta::getAffectedAccounts(beast::Journal j) const } else { - JLOG (j.fatal()) << "limit is not amount " << field.getJson (0); + JLOG (j.fatal()) << "limit is not amount " + << field.getJson (JsonOptions::none); } } } diff --git a/src/ripple/protocol/STAmount.h b/src/ripple/protocol/STAmount.h index 4041ee6f6..e4d4cbd03 100644 --- a/src/ripple/protocol/STAmount.h +++ b/src/ripple/protocol/STAmount.h @@ -270,7 +270,7 @@ public: getText() const override; Json::Value - getJson (int) const override; + getJson (JsonOptions) const override; void add (Serializer& s) const override; diff --git a/src/ripple/protocol/STArray.h b/src/ripple/protocol/STArray.h index f45f46318..3cd13505d 100644 --- a/src/ripple/protocol/STArray.h +++ b/src/ripple/protocol/STArray.h @@ -147,7 +147,7 @@ public: virtual std::string getFullText () const override; virtual std::string getText () const override; - virtual Json::Value getJson (int index) const override; + virtual Json::Value getJson (JsonOptions index) const override; virtual void add (Serializer & s) const override; void sort (bool (*compare) (const STObject & o1, const STObject & o2)); diff --git a/src/ripple/protocol/STBase.h b/src/ripple/protocol/STBase.h index 804fca475..dfbee47ed 100644 --- a/src/ripple/protocol/STBase.h +++ b/src/ripple/protocol/STBase.h @@ -31,6 +31,11 @@ #include namespace ripple { +enum class JsonOptions { + none = 0, + include_date = 1 +}; + // VFALCO TODO fix this restriction on copy assignment. // // CAUTION: Do not create a vector (or similar container) of any object derived @@ -121,7 +126,7 @@ public: virtual Json::Value - getJson (int /*options*/) const; + getJson (JsonOptions /*options*/) const; virtual void diff --git a/src/ripple/protocol/STInteger.h b/src/ripple/protocol/STInteger.h index 5f127701f..f52ec135b 100644 --- a/src/ripple/protocol/STInteger.h +++ b/src/ripple/protocol/STInteger.h @@ -58,7 +58,7 @@ public: getSType () const override; Json::Value - getJson (int) const override; + getJson (JsonOptions) const override; std::string getText () const override; diff --git a/src/ripple/protocol/STLedgerEntry.h b/src/ripple/protocol/STLedgerEntry.h index 83ffdc559..6fb98bb6a 100644 --- a/src/ripple/protocol/STLedgerEntry.h +++ b/src/ripple/protocol/STLedgerEntry.h @@ -76,7 +76,7 @@ public: std::string getText () const override; - Json::Value getJson (int options) const override; + Json::Value getJson (JsonOptions options) const override; /** Returns the 'key' (or 'index') of this item. The key identifies this entry's position in diff --git a/src/ripple/protocol/STObject.h b/src/ripple/protocol/STObject.h index 24610c556..37a36ac0d 100644 --- a/src/ripple/protocol/STObject.h +++ b/src/ripple/protocol/STObject.h @@ -358,7 +358,7 @@ public: virtual std::string getText () const override; // TODO(tom): options should be an enum. - virtual Json::Value getJson (int options) const override; + virtual Json::Value getJson (JsonOptions options) const override; template std::size_t diff --git a/src/ripple/protocol/STPathSet.h b/src/ripple/protocol/STPathSet.h index b14fcd282..66230ce9c 100644 --- a/src/ripple/protocol/STPathSet.h +++ b/src/ripple/protocol/STPathSet.h @@ -241,7 +241,7 @@ public: AccountID const& issuer) const; Json::Value - getJson (int) const; + getJson (JsonOptions) const; std::vector::const_iterator begin () const @@ -322,7 +322,7 @@ public: add (Serializer& s) const override; Json::Value - getJson (int) const override; + getJson (JsonOptions) const override; SerializedTypeID getSType () const override diff --git a/src/ripple/protocol/STTx.h b/src/ripple/protocol/STTx.h index 769cc5c26..de6ff5f97 100644 --- a/src/ripple/protocol/STTx.h +++ b/src/ripple/protocol/STTx.h @@ -122,8 +122,8 @@ public: return tid_; } - Json::Value getJson (int options) const override; - Json::Value getJson (int options, bool binary) const; + Json::Value getJson (JsonOptions options) const override; + Json::Value getJson (JsonOptions options, bool binary) const; void sign ( PublicKey const& publicKey, diff --git a/src/ripple/protocol/STValidation.h b/src/ripple/protocol/STValidation.h index a998c9254..f09c02190 100644 --- a/src/ripple/protocol/STValidation.h +++ b/src/ripple/protocol/STValidation.h @@ -76,14 +76,16 @@ public: if (publicKeyType(makeSlice(spk)) != KeyType::secp256k1) { JLOG (debugLog().error()) - << "Invalid public key in validation" << getJson (0); + << "Invalid public key in validation" + << getJson (JsonOptions::none); Throw ("Invalid public key in validation"); } if (checkSignature && !isValid ()) { JLOG (debugLog().error()) - << "Invalid signature in validation" << getJson (0); + << "Invalid signature in validation" + << getJson (JsonOptions::none); Throw ("Invalid signature in validation"); } diff --git a/src/ripple/protocol/STVector256.h b/src/ripple/protocol/STVector256.h index 193eebbd6..5856bcf5a 100644 --- a/src/ripple/protocol/STVector256.h +++ b/src/ripple/protocol/STVector256.h @@ -70,7 +70,7 @@ public: add (Serializer& s) const override; Json::Value - getJson (int) const override; + getJson (JsonOptions) const override; bool isEquivalent (const STBase& t) const override; diff --git a/src/ripple/protocol/impl/STAmount.cpp b/src/ripple/protocol/impl/STAmount.cpp index 73c4a84e1..9bfb88336 100644 --- a/src/ripple/protocol/impl/STAmount.cpp +++ b/src/ripple/protocol/impl/STAmount.cpp @@ -584,7 +584,7 @@ STAmount::getText () const } Json::Value -STAmount::getJson (int) const +STAmount::getJson (JsonOptions) const { Json::Value elem; setJson (elem); diff --git a/src/ripple/protocol/impl/STArray.cpp b/src/ripple/protocol/impl/STArray.cpp index 33f9f540d..578d343d6 100644 --- a/src/ripple/protocol/impl/STArray.cpp +++ b/src/ripple/protocol/impl/STArray.cpp @@ -138,7 +138,7 @@ std::string STArray::getText () const return r; } -Json::Value STArray::getJson (int p) const +Json::Value STArray::getJson (JsonOptions p) const { Json::Value v = Json::arrayValue; for (auto const& object: v_) diff --git a/src/ripple/protocol/impl/STBase.cpp b/src/ripple/protocol/impl/STBase.cpp index f4028373a..4f61322f8 100644 --- a/src/ripple/protocol/impl/STBase.cpp +++ b/src/ripple/protocol/impl/STBase.cpp @@ -95,7 +95,7 @@ STBase::getText() const } Json::Value -STBase::getJson (int /*options*/) const +STBase::getJson (JsonOptions /*options*/) const { return getText(); } diff --git a/src/ripple/protocol/impl/STInteger.cpp b/src/ripple/protocol/impl/STInteger.cpp index a31899e08..aa02aa1a8 100644 --- a/src/ripple/protocol/impl/STInteger.cpp +++ b/src/ripple/protocol/impl/STInteger.cpp @@ -61,7 +61,7 @@ STUInt8::getText () const template <> Json::Value -STUInt8::getJson (int) const +STUInt8::getJson (JsonOptions) const { if (getFName () == sfTransactionResult) { @@ -119,7 +119,7 @@ STUInt16::getText () const template <> Json::Value -STUInt16::getJson (int) const +STUInt16::getJson (JsonOptions) const { if (getFName () == sfLedgerEntryType) { @@ -166,7 +166,7 @@ STUInt32::getText () const template <> Json::Value -STUInt32::getJson (int) const +STUInt32::getJson (JsonOptions) const { return value_; } @@ -195,7 +195,7 @@ STUInt64::getText () const template <> Json::Value -STUInt64::getJson (int) const +STUInt64::getJson (JsonOptions) const { return strHex (value_); } diff --git a/src/ripple/protocol/impl/STLedgerEntry.cpp b/src/ripple/protocol/impl/STLedgerEntry.cpp index 27121517d..9ec83be12 100644 --- a/src/ripple/protocol/impl/STLedgerEntry.cpp +++ b/src/ripple/protocol/impl/STLedgerEntry.cpp @@ -106,7 +106,7 @@ std::string STLedgerEntry::getText () const % STObject::getText ()); } -Json::Value STLedgerEntry::getJson (int options) const +Json::Value STLedgerEntry::getJson (JsonOptions options) const { Json::Value ret (STObject::getJson (options)); diff --git a/src/ripple/protocol/impl/STObject.cpp b/src/ripple/protocol/impl/STObject.cpp index 46a53b349..752b2155f 100644 --- a/src/ripple/protocol/impl/STObject.cpp +++ b/src/ripple/protocol/impl/STObject.cpp @@ -654,7 +654,7 @@ void STObject::setFieldArray (SField const& field, STArray const& v) setFieldUsingAssignment (field, v); } -Json::Value STObject::getJson (int options) const +Json::Value STObject::getJson (JsonOptions options) const { Json::Value ret (Json::objectValue); diff --git a/src/ripple/protocol/impl/STPathSet.cpp b/src/ripple/protocol/impl/STPathSet.cpp index 411550a4b..479527b76 100644 --- a/src/ripple/protocol/impl/STPathSet.cpp +++ b/src/ripple/protocol/impl/STPathSet.cpp @@ -149,7 +149,7 @@ STPath::hasSeen ( } Json::Value -STPath::getJson (int) const +STPath::getJson (JsonOptions) const { Json::Value ret (Json::arrayValue); @@ -177,7 +177,7 @@ STPath::getJson (int) const } Json::Value -STPathSet::getJson (int options) const +STPathSet::getJson (JsonOptions options) const { Json::Value ret (Json::arrayValue); for (auto it: value) diff --git a/src/ripple/protocol/impl/STTx.cpp b/src/ripple/protocol/impl/STTx.cpp index 65f274f30..961a010f8 100644 --- a/src/ripple/protocol/impl/STTx.cpp +++ b/src/ripple/protocol/impl/STTx.cpp @@ -203,14 +203,14 @@ std::pair STTx::checkSign(bool allowMultiSign) const return ret; } -Json::Value STTx::getJson (int) const +Json::Value STTx::getJson (JsonOptions) const { - Json::Value ret = STObject::getJson (0); + Json::Value ret = STObject::getJson (JsonOptions::none); ret[jss::hash] = to_string (getTransactionID ()); return ret; } -Json::Value STTx::getJson (int options, bool binary) const +Json::Value STTx::getJson (JsonOptions options, bool binary) const { if (binary) { diff --git a/src/ripple/protocol/impl/STVector256.cpp b/src/ripple/protocol/impl/STVector256.cpp index e52d91488..8ea1bade4 100644 --- a/src/ripple/protocol/impl/STVector256.cpp +++ b/src/ripple/protocol/impl/STVector256.cpp @@ -58,7 +58,7 @@ STVector256::isEquivalent (const STBase& t) const } Json::Value -STVector256::getJson (int) const +STVector256::getJson (JsonOptions) const { Json::Value ret (Json::arrayValue); diff --git a/src/ripple/rpc/handlers/AccountInfo.cpp b/src/ripple/rpc/handlers/AccountInfo.cpp index 7fb7d2955..01fdb0032 100644 --- a/src/ripple/rpc/handlers/AccountInfo.cpp +++ b/src/ripple/rpc/handlers/AccountInfo.cpp @@ -104,7 +104,7 @@ Json::Value doAccountInfo (RPC::Context& context) // multiple SignerLists on one account. auto const sleSigners = ledger->read (keylet::signers (accountID)); if (sleSigners) - jvSignerList.append (sleSigners->getJson (0)); + jvSignerList.append (sleSigners->getJson (JsonOptions::none)); result[jss::account_data][jss::signer_lists] = std::move(jvSignerList); diff --git a/src/ripple/rpc/handlers/AccountTx.cpp b/src/ripple/rpc/handlers/AccountTx.cpp index 0929f7542..390fca4cf 100644 --- a/src/ripple/rpc/handlers/AccountTx.cpp +++ b/src/ripple/rpc/handlers/AccountTx.cpp @@ -162,11 +162,12 @@ Json::Value doAccountTx (RPC::Context& context) Json::Value& jvObj = jvTxns.append (Json::objectValue); if (it.first) - jvObj[jss::tx] = it.first->getJson (1); + jvObj[jss::tx] = + it.first->getJson (JsonOptions::include_date); if (it.second) { - auto meta = it.second->getJson (1); + auto meta = it.second->getJson (JsonOptions::include_date); insertDeliveredAmount (meta, context, it.first, *it.second); jvObj[jss::meta] = std::move(meta); diff --git a/src/ripple/rpc/handlers/AccountTxOld.cpp b/src/ripple/rpc/handlers/AccountTxOld.cpp index de73671ff..bfa51820f 100644 --- a/src/ripple/rpc/handlers/AccountTxOld.cpp +++ b/src/ripple/rpc/handlers/AccountTxOld.cpp @@ -177,13 +177,14 @@ Json::Value doAccountTxOld (RPC::Context& context) Json::Value& jvObj = jvTxns.append (Json::objectValue); if (it->first) - jvObj[jss::tx] = it->first->getJson (1); + jvObj[jss::tx] = + it->first->getJson (JsonOptions::include_date); if (it->second) { std::uint32_t uLedgerIndex = it->second->getLgrSeq (); - auto meta = it->second->getJson(0); + auto meta = it->second->getJson(JsonOptions::none); insertDeliveredAmount(meta, context, it->first, *it->second); jvObj[jss::meta] = std::move(meta); diff --git a/src/ripple/rpc/handlers/LedgerData.cpp b/src/ripple/rpc/handlers/LedgerData.cpp index 3d19fa24d..7f5632b01 100644 --- a/src/ripple/rpc/handlers/LedgerData.cpp +++ b/src/ripple/rpc/handlers/LedgerData.cpp @@ -116,7 +116,7 @@ Json::Value doLedgerData (RPC::Context& context) } else { - Json::Value& entry = nodes.append (sle->getJson (0)); + Json::Value& entry = nodes.append (sle->getJson (JsonOptions::none)); entry[jss::index] = to_string(sle->key()); } } diff --git a/src/ripple/rpc/handlers/LedgerEntry.cpp b/src/ripple/rpc/handlers/LedgerEntry.cpp index a494fb953..336ece187 100644 --- a/src/ripple/rpc/handlers/LedgerEntry.cpp +++ b/src/ripple/rpc/handlers/LedgerEntry.cpp @@ -288,7 +288,7 @@ Json::Value doLedgerEntry (RPC::Context& context) } else { - jvResult[jss::node] = sleNode->getJson (0); + jvResult[jss::node] = sleNode->getJson (JsonOptions::none); jvResult[jss::index] = to_string (uNodeIndex); } } diff --git a/src/ripple/rpc/handlers/NoRippleCheck.cpp b/src/ripple/rpc/handlers/NoRippleCheck.cpp index 14d438acc..fdd264e58 100644 --- a/src/ripple/rpc/handlers/NoRippleCheck.cpp +++ b/src/ripple/rpc/handlers/NoRippleCheck.cpp @@ -165,7 +165,8 @@ Json::Value doNoRippleCheck (RPC::Context& context) Json::Value& tx = jvTransactions.append (Json::objectValue); tx["TransactionType"] = jss::TrustSet; - tx["LimitAmount"] = limitAmount.getJson (0); + tx["LimitAmount"] = + limitAmount.getJson (JsonOptions::none); tx["Flags"] = bNoRipple ? tfClearNoRipple : tfSetNoRipple; fillTransaction(context, tx, accountID, seq, *ledger); diff --git a/src/ripple/rpc/handlers/Submit.cpp b/src/ripple/rpc/handlers/Submit.cpp index 0668ed0e4..9417be05e 100644 --- a/src/ripple/rpc/handlers/Submit.cpp +++ b/src/ripple/rpc/handlers/Submit.cpp @@ -134,7 +134,7 @@ Json::Value doSubmit (RPC::Context& context) try { - jvResult[jss::tx_json] = tpTrans->getJson (0); + jvResult[jss::tx_json] = tpTrans->getJson (JsonOptions::none); jvResult[jss::tx_blob] = strHex ( tpTrans->getSTransaction ()->getSerializer ().peekData ()); diff --git a/src/ripple/rpc/handlers/TransactionEntry.cpp b/src/ripple/rpc/handlers/TransactionEntry.cpp index dd7fd9238..d79a7486d 100644 --- a/src/ripple/rpc/handlers/TransactionEntry.cpp +++ b/src/ripple/rpc/handlers/TransactionEntry.cpp @@ -65,9 +65,10 @@ Json::Value doTransactionEntry (RPC::Context& context) } else { - jvResult[jss::tx_json] = tx.first->getJson (0); + jvResult[jss::tx_json] = tx.first->getJson (JsonOptions::none); if (tx.second) - jvResult[jss::metadata] = tx.second->getJson (0); + jvResult[jss::metadata] = + tx.second->getJson (JsonOptions::none); // 'accounts' // 'engine_...' // 'ledger_...' diff --git a/src/ripple/rpc/handlers/Tx.cpp b/src/ripple/rpc/handlers/Tx.cpp index ef5d383d5..6bb8e612c 100644 --- a/src/ripple/rpc/handlers/Tx.cpp +++ b/src/ripple/rpc/handlers/Tx.cpp @@ -103,7 +103,7 @@ Json::Value doTx (RPC::Context& context) if (!txn) return rpcError (rpcTXN_NOT_FOUND); - Json::Value ret = txn->getJson (1, binary); + Json::Value ret = txn->getJson (JsonOptions::include_date, binary); if (txn->getLedger () == 0) return ret; @@ -130,7 +130,7 @@ Json::Value doTx (RPC::Context& context) auto txMeta = std::make_shared( txn->getID(), lgr->seq(), *rawMeta); okay = true; - auto meta = txMeta->getJson (0); + auto meta = txMeta->getJson (JsonOptions::none); insertDeliveredAmount (meta, context, txn, *txMeta); ret[jss::meta] = std::move(meta); } diff --git a/src/ripple/rpc/handlers/TxHistory.cpp b/src/ripple/rpc/handlers/TxHistory.cpp index bdfe6f9ac..05400bc8a 100644 --- a/src/ripple/rpc/handlers/TxHistory.cpp +++ b/src/ripple/rpc/handlers/TxHistory.cpp @@ -81,7 +81,7 @@ Json::Value doTxHistory (RPC::Context& context) if (auto trans = Transaction::transactionFromSQL ( ledgerSeq, status, rawTxn, context.app)) - txs.append (trans->getJson (0)); + txs.append (trans->getJson (JsonOptions::none)); } } diff --git a/src/ripple/rpc/impl/DeliveredAmount.cpp b/src/ripple/rpc/impl/DeliveredAmount.cpp index 4d1c925a9..8be5ce3c3 100644 --- a/src/ripple/rpc/impl/DeliveredAmount.cpp +++ b/src/ripple/rpc/impl/DeliveredAmount.cpp @@ -72,7 +72,8 @@ insertDeliveredAmount( if (transactionMeta.hasDeliveredAmount()) { meta[jss::delivered_amount] = - transactionMeta.getDeliveredAmount().getJson(1); + transactionMeta.getDeliveredAmount() + .getJson(JsonOptions::include_date); return; } @@ -92,7 +93,8 @@ insertDeliveredAmount( getCloseTime() > NetClock::time_point{446000000s}) { meta[jss::delivered_amount] = - serializedTx->getFieldAmount(sfAmount).getJson(1); + serializedTx->getFieldAmount(sfAmount) + .getJson(JsonOptions::include_date); return; } } diff --git a/src/ripple/rpc/impl/RPCHelpers.cpp b/src/ripple/rpc/impl/RPCHelpers.cpp index 3162ffc7d..85ae18f60 100644 --- a/src/ripple/rpc/impl/RPCHelpers.cpp +++ b/src/ripple/rpc/impl/RPCHelpers.cpp @@ -119,7 +119,7 @@ getAccountObjects(ReadView const& ledger, AccountID const& account, auto const sleNode = ledger.read(keylet::child(*iter)); if (type == ltINVALID || sleNode->getType () == type) { - jvObjects.append (sleNode->getJson (0)); + jvObjects.append (sleNode->getJson (JsonOptions::none)); if (++i == limit) { @@ -397,7 +397,7 @@ parseAccountIds(Json::Value const& jvArray) void injectSLE(Json::Value& jv, SLE const& sle) { - jv = sle.getJson(0); + jv = sle.getJson(JsonOptions::none); if (sle.getType() == ltACCOUNT_ROOT) { if (sle.isFieldPresent(sfEmailHash)) diff --git a/src/ripple/rpc/impl/TransactionSign.cpp b/src/ripple/rpc/impl/TransactionSign.cpp index bc9136a2b..a9ba0bc67 100644 --- a/src/ripple/rpc/impl/TransactionSign.cpp +++ b/src/ripple/rpc/impl/TransactionSign.cpp @@ -227,10 +227,10 @@ static Json::Value checkPayment( auto j = app.journal ("RPCHandler"); JLOG (j.debug()) << "transactionSign: build_path: " - << result.getJson (0); + << result.getJson (JsonOptions::none); if (! result.empty ()) - tx_json[jss::Paths] = result.getJson (0); + tx_json[jss::Paths] = result.getJson (JsonOptions::none); } } return Json::Value(); @@ -629,7 +629,7 @@ static Json::Value transactionFormatResultImpl (Transaction::pointer tpTrans) Json::Value jvResult; try { - jvResult[jss::tx_json] = tpTrans->getJson (0); + jvResult[jss::tx_json] = tpTrans->getJson (JsonOptions::none); jvResult[jss::tx_blob] = strHex ( tpTrans->getSTransaction ()->getSerializer ().peekData ()); diff --git a/src/test/app/Check_test.cpp b/src/test/app/Check_test.cpp index 25875b05c..d96fcef8c 100644 --- a/src/test/app/Check_test.cpp +++ b/src/test/app/Check_test.cpp @@ -38,7 +38,7 @@ create (jtx::Account const& account, { Json::Value jv; jv[sfAccount.jsonName] = account.human(); - jv[sfSendMax.jsonName] = sendMax.getJson(0); + jv[sfSendMax.jsonName] = sendMax.getJson(JsonOptions::none); jv[sfDestination.jsonName] = dest.human(); jv[sfTransactionType.jsonName] = jss::CheckCreate; jv[sfFlags.jsonName] = tfUniversal; @@ -60,7 +60,7 @@ cash (jtx::Account const& dest, { Json::Value jv; jv[sfAccount.jsonName] = dest.human(); - jv[sfAmount.jsonName] = amount.getJson(0); + jv[sfAmount.jsonName] = amount.getJson(JsonOptions::none); jv[sfCheckID.jsonName] = to_string (checkId); jv[sfTransactionType.jsonName] = jss::CheckCash; jv[sfFlags.jsonName] = tfUniversal; @@ -73,7 +73,7 @@ cash (jtx::Account const& dest, { Json::Value jv; jv[sfAccount.jsonName] = dest.human(); - jv[sfDeliverMin.jsonName] = atLeast.value.getJson(0); + jv[sfDeliverMin.jsonName] = atLeast.value.getJson(JsonOptions::none); jv[sfCheckID.jsonName] = to_string (checkId); jv[sfTransactionType.jsonName] = jss::CheckCash; jv[sfFlags.jsonName] = tfUniversal; @@ -206,7 +206,8 @@ class Check_test : public beast::unit_test::suite void verifyDeliveredAmount (test::jtx::Env& env, STAmount const& amount) { // Get the hash for the most recent transaction. - std::string const txHash {env.tx()->getJson (0)[jss::hash].asString()}; + std::string const txHash { + env.tx()->getJson (JsonOptions::none)[jss::hash].asString()}; // Verify DeliveredAmount and delivered_amount metadata are correct. env.close(); @@ -218,8 +219,10 @@ class Check_test : public beast::unit_test::suite // DeliveredAmount and delivered_amount should both be present and // equal amount. - BEAST_EXPECT (meta[sfDeliveredAmount.jsonName] == amount.getJson (0)); - BEAST_EXPECT (meta[jss::delivered_amount] == amount.getJson (0)); + BEAST_EXPECT (meta[sfDeliveredAmount.jsonName] == + amount.getJson (JsonOptions::none)); + BEAST_EXPECT (meta[jss::delivered_amount] == + amount.getJson (JsonOptions::none)); } void testEnabled() @@ -1407,7 +1410,7 @@ class Check_test : public beast::unit_test::suite // Both Amount and DeliverMin present. { Json::Value tx {check::cash (bob, chkId, amount)}; - tx[sfDeliverMin.jsonName] = amount.getJson(0); + tx[sfDeliverMin.jsonName] = amount.getJson(JsonOptions::none); env (tx, ter (temMALFORMED)); env.close(); } @@ -1826,7 +1829,7 @@ class Check_test : public beast::unit_test::suite // Get the hash for the most recent transaction. std::string const txHash { - env.tx()->getJson (0)[jss::hash].asString()}; + env.tx()->getJson (JsonOptions::none)[jss::hash].asString()}; // DeliveredAmount and delivered_amount are either present or // not present in the metadata returned by "tx" based on fix1623. diff --git a/src/test/app/Discrepancy_test.cpp b/src/test/app/Discrepancy_test.cpp index a868ad5e5..859e3f55a 100644 --- a/src/test/app/Discrepancy_test.cpp +++ b/src/test/app/Discrepancy_test.cpp @@ -99,7 +99,8 @@ class Discrepancy_test : public beast::unit_test::suite Json::Value jrq2; jrq2[jss::binary] = false; - jrq2[jss::transaction] = env.tx()->getJson(0)[jss::hash]; + jrq2[jss::transaction] = + env.tx()->getJson(JsonOptions::none)[jss::hash]; jrq2[jss::id] = 3; auto jrr = env.rpc ("json", "tx", to_string(jrq2))[jss::result]; uint64_t fee { jrr[jss::Fee].asUInt() }; diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 6d95040cd..dea507e53 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -175,7 +175,7 @@ struct Escrow_test : public beast::unit_test::suite jv[jss::Flags] = tfUniversal; jv[jss::Account] = account.human(); jv[jss::Destination] = to.human(); - jv[jss::Amount] = amount.getJson(0); + jv[jss::Amount] = amount.getJson(JsonOptions::none); return jv; } diff --git a/src/test/app/Freeze_test.cpp b/src/test/app/Freeze_test.cpp index bd478181a..36f73101a 100644 --- a/src/test/app/Freeze_test.cpp +++ b/src/test/app/Freeze_test.cpp @@ -110,13 +110,15 @@ class Freeze_test : public beast::unit_test::suite // Is created via a TrustSet with SetFreeze flag // test: sets LowFreeze | HighFreeze flags env(trust(G1, bob["USD"](0), tfSetFreeze)); - auto affected = env.meta()->getJson(0)[sfAffectedNodes.fieldName]; + auto affected = env.meta()-> + getJson(JsonOptions::none)[sfAffectedNodes.fieldName]; if(! BEAST_EXPECT(checkArraySize(affected, 2u))) return; auto ff = affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName]; BEAST_EXPECT( - ff[sfLowLimit.fieldName] == G1["USD"](0).value().getJson(0)); + ff[sfLowLimit.fieldName] == + G1["USD"](0).value().getJson(JsonOptions::none)); BEAST_EXPECT(ff[jss::Flags].asUInt() & lsfLowFreeze); BEAST_EXPECT(! (ff[jss::Flags].asUInt() & lsfHighFreeze)); env.close(); @@ -126,16 +128,18 @@ class Freeze_test : public beast::unit_test::suite // Account with line frozen by issuer // test: can buy more assets on that line env(offer(bob, G1["USD"](5), XRP(25))); - auto affected = env.meta()->getJson(0)[sfAffectedNodes.fieldName]; + auto affected = env.meta()-> + getJson(JsonOptions::none)[sfAffectedNodes.fieldName]; if(! BEAST_EXPECT(checkArraySize(affected, 5u))) return; auto ff = affected[3u][sfModifiedNode.fieldName][sfFinalFields.fieldName]; BEAST_EXPECT( - ff[sfHighLimit.fieldName] == bob["USD"](100).value().getJson(0)); + ff[sfHighLimit.fieldName] == + bob["USD"](100).value().getJson(JsonOptions::none)); auto amt = STAmount{Issue{to_currency("USD"), noAccount()}, -15} - .value().getJson(0); + .value().getJson(JsonOptions::none); BEAST_EXPECT(ff[sfBalance.fieldName] == amt); env.close(); } @@ -193,13 +197,15 @@ class Freeze_test : public beast::unit_test::suite //Is cleared via a TrustSet with ClearFreeze flag // test: sets LowFreeze | HighFreeze flags env(trust(G1, bob["USD"](0), tfClearFreeze)); - auto affected = env.meta()->getJson(0)[sfAffectedNodes.fieldName]; + auto affected = env.meta()-> + getJson(JsonOptions::none)[sfAffectedNodes.fieldName]; if(! BEAST_EXPECT(checkArraySize(affected, 2u))) return; auto ff = affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName]; BEAST_EXPECT( - ff[sfLowLimit.fieldName] == G1["USD"](0).value().getJson(0)); + ff[sfLowLimit.fieldName] == + G1["USD"](0).value().getJson(JsonOptions::none)); BEAST_EXPECT(! (ff[jss::Flags].asUInt() & lsfLowFreeze)); BEAST_EXPECT(! (ff[jss::Flags].asUInt() & lsfHighFreeze)); env.close(); @@ -409,7 +415,8 @@ class Freeze_test : public beast::unit_test::suite // test: trustlines can't be frozen env(trust(G1, A1["USD"](0), tfSetFreeze)); - auto affected = env.meta()->getJson(0)[sfAffectedNodes.fieldName]; + auto affected = + env.meta()->getJson(JsonOptions::none)[sfAffectedNodes.fieldName]; if(! BEAST_EXPECT(checkArraySize(affected, 1u))) return; @@ -457,7 +464,8 @@ class Freeze_test : public beast::unit_test::suite if(! BEAST_EXPECT(checkArraySize(offers, 1u))) return; BEAST_EXPECT( - offers[0u][jss::taker_gets] == G1["USD"](999).value().getJson(0)); + offers[0u][jss::taker_gets] == + G1["USD"](999).value().getJson(JsonOptions::none)); // test: someone else creates an offer providing liquidity env(offer(A4, XRP(999), G1["USD"](999))); @@ -465,13 +473,15 @@ class Freeze_test : public beast::unit_test::suite // test: owner of partially consumed offers line is frozen env(trust(G1, A3["USD"](0), tfSetFreeze)); - auto affected = env.meta()->getJson(0)[sfAffectedNodes.fieldName]; + auto affected = + env.meta()->getJson(JsonOptions::none)[sfAffectedNodes.fieldName]; if(! BEAST_EXPECT(checkArraySize(affected, 2u))) return; auto ff = affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName]; BEAST_EXPECT( - ff[sfHighLimit.fieldName] == G1["USD"](0).value().getJson(0)); + ff[sfHighLimit.fieldName] == + G1["USD"](0).value().getJson(JsonOptions::none)); BEAST_EXPECT(! (ff[jss::Flags].asUInt() & lsfLowFreeze)); BEAST_EXPECT(ff[jss::Flags].asUInt() & lsfHighFreeze); env.close(); @@ -493,20 +503,23 @@ class Freeze_test : public beast::unit_test::suite // removal buy successful OfferCreate // test: freeze the new offer env(trust(G1, A4["USD"](0), tfSetFreeze)); - affected = env.meta()->getJson(0)[sfAffectedNodes.fieldName]; + affected = + env.meta()->getJson(JsonOptions::none)[sfAffectedNodes.fieldName]; if(! BEAST_EXPECT(checkArraySize(affected, 2u))) return; ff = affected[0u][sfModifiedNode.fieldName][sfFinalFields.fieldName]; BEAST_EXPECT( - ff[sfLowLimit.fieldName] == G1["USD"](0).value().getJson(0)); + ff[sfLowLimit.fieldName] == + G1["USD"](0).value().getJson(JsonOptions::none)); BEAST_EXPECT(ff[jss::Flags].asUInt() & lsfLowFreeze); BEAST_EXPECT(! (ff[jss::Flags].asUInt() & lsfHighFreeze)); env.close(); // test: can no longer create a crossing offer env(offer(A2, G1["USD"](999), XRP(999))); - affected = env.meta()->getJson(0)[sfAffectedNodes.fieldName]; + affected = + env.meta()->getJson(JsonOptions::none)[sfAffectedNodes.fieldName]; if(! BEAST_EXPECT(checkArraySize(affected, 8u))) return; auto created = affected[5u][sfCreatedNode.fieldName]; diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 6fa7b66ff..b494b90f7 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -1516,7 +1516,8 @@ public: BEAST_EXPECT( jro[jss::node][jss::TakerGets] == XRP (500).value ().getText ()); BEAST_EXPECT( - jro[jss::node][jss::TakerPays] == USD (100).value ().getJson (0)); + jro[jss::node][jss::TakerPays] == + USD (100).value ().getJson (JsonOptions::none)); env (pay (alice, alice, XRP (500)), sendmax (USD (100))); @@ -1610,7 +1611,8 @@ public: BEAST_EXPECT( jro[jss::node][jss::TakerGets] == XRP (300).value ().getText ()); BEAST_EXPECT( - jro[jss::node][jss::TakerPays] == USD (60).value ().getJson (0)); + jro[jss::node][jss::TakerPays] == + USD (60).value ().getJson (JsonOptions::none)); // the balance between alice and gw is 160 USD..200 less the 40 taken // by the offer @@ -1706,7 +1708,8 @@ public: auto jro = ledgerEntryOffer (env, carol, carolOfferSeq); BEAST_EXPECT( - jro[jss::node][jss::TakerGets] == USD (25).value ().getJson (0)); + jro[jss::node][jss::TakerGets] == + USD (25).value ().getJson (JsonOptions::none)); BEAST_EXPECT( jro[jss::node][jss::TakerPays] == XRP (250).value ().getText ()); } @@ -1760,7 +1763,8 @@ public: BEAST_EXPECT( jro[jss::node][jss::TakerGets] == XRP (250).value ().getText ()); BEAST_EXPECT( - jro[jss::node][jss::TakerPays] == USD (25).value ().getJson (0)); + jro[jss::node][jss::TakerPays] == + USD (25).value ().getJson (JsonOptions::none)); } void @@ -1823,12 +1827,13 @@ public: BEAST_EXPECT( jro[jss::node][jss::TakerGets] == XRP (200).value ().getText ()); BEAST_EXPECT( - jro[jss::node][jss::TakerPays] == USD (20).value ().getJson (0)); + jro[jss::node][jss::TakerPays] == + USD (20).value ().getJson (JsonOptions::none)); jro = ledgerEntryOffer (env, dan, danOfferSeq); BEAST_EXPECT( jro[jss::node][jss::TakerGets] == - gw2["EUR"] (20).value ().getJson (0)); + gw2["EUR"] (20).value ().getJson (JsonOptions::none)); BEAST_EXPECT( jro[jss::node][jss::TakerPays] == XRP (200).value ().getText ()); } @@ -2151,7 +2156,7 @@ public: payment[jss::tx_json][jss::Fee] = std::to_string( env.current ()->fees ().base); payment[jss::tx_json][jss::SendMax] = - bob ["XTS"] (1.5).value ().getJson (0); + bob ["XTS"] (1.5).value ().getJson (JsonOptions::none); auto jrr = wsc->invoke("submit", payment); BEAST_EXPECT(jrr[jss::status] == "success"); BEAST_EXPECT(jrr[jss::result][jss::engine_result] == "tesSUCCESS"); diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index 4c2a3081b..fb444e3c9 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -237,9 +237,10 @@ public: params[jss::command] = "ripple_path_find"; params[jss::source_account] = toBase58 (src); params[jss::destination_account] = toBase58 (dst); - params[jss::destination_amount] = saDstAmount.getJson(0); + params[jss::destination_amount] = + saDstAmount.getJson(JsonOptions::none); if(saSendMax) - params[jss::send_max] = saSendMax->getJson(0); + params[jss::send_max] = saSendMax->getJson(JsonOptions::none); if(saSrcCurrency) { auto& sc = params[jss::source_currencies] = Json::arrayValue; @@ -803,7 +804,7 @@ public: })", jv); auto const jv_l = env.le(keylet::line(Account("bob").id(), - Account("alice")["USD"].issue()))->getJson(0); + Account("alice")["USD"].issue()))->getJson(JsonOptions::none); for (auto it = jv.begin(); it != jv.end(); ++it) BEAST_EXPECT(*it == jv_l[it.memberName()]); } @@ -842,7 +843,7 @@ public: })", jv); auto const jv_l = env.le(keylet::line(Account("bob").id(), - Account("alice")["USD"].issue()))->getJson(0); + Account("alice")["USD"].issue()))->getJson(JsonOptions::none); for (auto it = jv.begin(); it != jv.end(); ++it) BEAST_EXPECT(*it == jv_l[it.memberName()]); @@ -890,7 +891,7 @@ public: })", jv); auto const jv_l = env.le(keylet::line(Account("alice").id(), - Account("bob")["USD"].issue()))->getJson(0); + Account("bob")["USD"].issue()))->getJson(JsonOptions::none); for (auto it = jv.begin(); it != jv.end(); ++it) BEAST_EXPECT(*it == jv_l[it.memberName()]); diff --git a/src/test/app/PayChan_test.cpp b/src/test/app/PayChan_test.cpp index 4033fd953..01453dc90 100644 --- a/src/test/app/PayChan_test.cpp +++ b/src/test/app/PayChan_test.cpp @@ -113,7 +113,7 @@ struct PayChan_test : public beast::unit_test::suite jv[jss::Flags] = tfUniversal; jv[jss::Account] = account.human (); jv[jss::Destination] = to.human (); - jv[jss::Amount] = amount.getJson (0); + jv[jss::Amount] = amount.getJson (JsonOptions::none); jv["SettleDelay"] = settleDelay.count (); jv["PublicKey"] = strHex (pk.slice ()); if (cancelAfter) @@ -136,7 +136,7 @@ struct PayChan_test : public beast::unit_test::suite jv[jss::Flags] = tfUniversal; jv[jss::Account] = account.human (); jv["Channel"] = to_string (channel); - jv[jss::Amount] = amount.getJson (0); + jv[jss::Amount] = amount.getJson (JsonOptions::none); if (expiration) jv["Expiration"] = expiration->time_since_epoch ().count (); return jv; @@ -158,9 +158,9 @@ struct PayChan_test : public beast::unit_test::suite jv[jss::Account] = account.human (); jv["Channel"] = to_string (channel); if (amount) - jv[jss::Amount] = amount->getJson (0); + jv[jss::Amount] = amount->getJson (JsonOptions::none); if (balance) - jv["Balance"] = balance->getJson (0); + jv["Balance"] = balance->getJson (JsonOptions::none); if (signature) jv["Signature"] = strHex (*signature); if (pk) diff --git a/src/test/app/SetAuth_test.cpp b/src/test/app/SetAuth_test.cpp index 7dbf31dd1..ff89073e2 100644 --- a/src/test/app/SetAuth_test.cpp +++ b/src/test/app/SetAuth_test.cpp @@ -39,7 +39,7 @@ struct SetAuth_test : public beast::unit_test::suite Json::Value jv; jv[jss::Account] = account.human(); jv[jss::LimitAmount] = STAmount( - { to_currency(currency), dest }).getJson(0); + { to_currency(currency), dest }).getJson(JsonOptions::none); jv[jss::TransactionType] = jss::TrustSet; jv[jss::Flags] = tfSetfAuth; return jv; diff --git a/src/test/app/SetTrust_test.cpp b/src/test/app/SetTrust_test.cpp index 0e2dfb43e..2770a5280 100644 --- a/src/test/app/SetTrust_test.cpp +++ b/src/test/app/SetTrust_test.cpp @@ -104,7 +104,7 @@ public: { Json::Value jv; jv[jss::Account] = a.human(); - jv[jss::LimitAmount] = amt.getJson(0); + jv[jss::LimitAmount] = amt.getJson(JsonOptions::none); jv[jss::TransactionType] = jss::TrustSet; jv[jss::Flags] = 0; return jv; diff --git a/src/test/app/Ticket_test.cpp b/src/test/app/Ticket_test.cpp index 46b212411..ba9ec3ded 100644 --- a/src/test/app/Ticket_test.cpp +++ b/src/test/app/Ticket_test.cpp @@ -51,10 +51,10 @@ class Ticket_test : public beast::unit_test::suite bool expiration = false) { using namespace std::string_literals; - auto const& tx = env.tx ()->getJson (0); + auto const& tx = env.tx ()->getJson (JsonOptions::none); bool is_cancel = tx[jss::TransactionType] == jss::TicketCancel; - auto const& jvm = env.meta ()->getJson (0); + auto const& jvm = env.meta ()->getJson (JsonOptions::none); std::array retval; // these are the affected nodes that we expect for @@ -315,7 +315,7 @@ class Ticket_test : public beast::unit_test::suite env (ticket::create (env.master, expire)); // in the case of past expiration, we only get // one meta node entry returned - auto const& jvm = env.meta ()->getJson (0); + auto const& jvm = env.meta ()->getJson (JsonOptions::none); BEAST_EXPECT(jvm.isMember(sfAffectedNodes.fieldName)); BEAST_EXPECT(jvm[sfAffectedNodes.fieldName].isArray()); BEAST_EXPECT(jvm[sfAffectedNodes.fieldName].size() == 1); diff --git a/src/test/jtx/PathSet.h b/src/test/jtx/PathSet.h index 9ca17eae1..cb94ea049 100644 --- a/src/test/jtx/PathSet.h +++ b/src/test/jtx/PathSet.h @@ -104,7 +104,7 @@ Path& Path::addHelper (First&& first, Rest&&... rest) inline Json::Value Path::json () const { - return path.getJson (0); + return path.getJson (JsonOptions::none); } class PathSet @@ -126,7 +126,7 @@ public: Json::Value json () const { Json::Value v; - v["Paths"] = paths.getJson (0); + v["Paths"] = paths.getJson (JsonOptions::none); return v; } private: diff --git a/src/test/jtx/impl/delivermin.cpp b/src/test/jtx/impl/delivermin.cpp index d46d676e4..04d209858 100644 --- a/src/test/jtx/impl/delivermin.cpp +++ b/src/test/jtx/impl/delivermin.cpp @@ -27,7 +27,7 @@ namespace jtx { void delivermin::operator()(Env& env, JTx& jt) const { - jt.jv[jss::DeliverMin] = amount_.getJson(0); + jt.jv[jss::DeliverMin] = amount_.getJson(JsonOptions::none); } } // jtx diff --git a/src/test/jtx/impl/fee.cpp b/src/test/jtx/impl/fee.cpp index 4106c0cbb..0415fcd71 100644 --- a/src/test/jtx/impl/fee.cpp +++ b/src/test/jtx/impl/fee.cpp @@ -32,7 +32,7 @@ fee::operator()(Env&, JTx& jt) const jt.fill_fee = false; if (amount_) jt[jss::Fee] = - amount_->getJson(0); + amount_->getJson(JsonOptions::none); } } // jtx diff --git a/src/test/jtx/impl/offer.cpp b/src/test/jtx/impl/offer.cpp index e0ff46ffa..0a78421ea 100644 --- a/src/test/jtx/impl/offer.cpp +++ b/src/test/jtx/impl/offer.cpp @@ -30,8 +30,8 @@ offer (Account const& account, { Json::Value jv; jv[jss::Account] = account.human(); - jv[jss::TakerPays] = in.getJson(0); - jv[jss::TakerGets] = out.getJson(0); + jv[jss::TakerPays] = in.getJson(JsonOptions::none); + jv[jss::TakerGets] = out.getJson(JsonOptions::none); if (flags) jv[jss::Flags] = flags; jv[jss::TransactionType] = jss::OfferCreate; diff --git a/src/test/jtx/impl/paths.cpp b/src/test/jtx/impl/paths.cpp index f6b3067d8..ead767e86 100644 --- a/src/test/jtx/impl/paths.cpp +++ b/src/test/jtx/impl/paths.cpp @@ -50,7 +50,7 @@ paths::operator()(Env& env, JTx& jt) const // VFALCO TODO API to allow caller to examine the STPathSet // VFALCO isDefault should be renamed to empty() if (! found.isDefault()) - jv[jss::Paths] = found.getJson(0); + jv[jss::Paths] = found.getJson(JsonOptions::none); } //------------------------------------------------------------------------------ diff --git a/src/test/jtx/impl/pay.cpp b/src/test/jtx/impl/pay.cpp index dc062d009..074a377f5 100644 --- a/src/test/jtx/impl/pay.cpp +++ b/src/test/jtx/impl/pay.cpp @@ -33,7 +33,7 @@ pay (Account const& account, amount.to(to); Json::Value jv; jv[jss::Account] = account.human(); - jv[jss::Amount] = amount.value.getJson(0); + jv[jss::Amount] = amount.value.getJson(JsonOptions::none); jv[jss::Destination] = to.human(); jv[jss::TransactionType] = jss::Payment; jv[jss::Flags] = tfUniversal; diff --git a/src/test/jtx/impl/sendmax.cpp b/src/test/jtx/impl/sendmax.cpp index 43e498223..ba884cc67 100644 --- a/src/test/jtx/impl/sendmax.cpp +++ b/src/test/jtx/impl/sendmax.cpp @@ -27,7 +27,7 @@ namespace jtx { void sendmax::operator()(Env& env, JTx& jt) const { - jt.jv[jss::SendMax] = amount_.getJson(0); + jt.jv[jss::SendMax] = amount_.getJson(JsonOptions::none); } } // jtx diff --git a/src/test/jtx/impl/trust.cpp b/src/test/jtx/impl/trust.cpp index 8179d69d5..bfe520685 100644 --- a/src/test/jtx/impl/trust.cpp +++ b/src/test/jtx/impl/trust.cpp @@ -36,7 +36,7 @@ trust (Account const& account, "trust() requires IOU"); Json::Value jv; jv[jss::Account] = account.human(); - jv[jss::LimitAmount] = amount.getJson(0); + jv[jss::LimitAmount] = amount.getJson(JsonOptions::none); jv[jss::TransactionType] = jss::TrustSet; jv[jss::Flags] = flags; return jv; @@ -54,7 +54,7 @@ trust (Account const& account, Json::Value jv; jv[jss::Account] = account.human(); { - auto& ja = jv[jss::LimitAmount] = amount.getJson(0); + auto& ja = jv[jss::LimitAmount] = amount.getJson(JsonOptions::none); ja[jss::issuer] = peer.human(); } jv[jss::TransactionType] = jss::TrustSet; diff --git a/src/test/protocol/STObject_test.cpp b/src/test/protocol/STObject_test.cpp index 3b07c9a0a..95146a220 100644 --- a/src/test/protocol/STObject_test.cpp +++ b/src/test/protocol/STObject_test.cpp @@ -89,7 +89,7 @@ public: STParsedJSONObject parsed ("test", jsonObject); BEAST_EXPECT(parsed.object); std::string const& serialized ( - to_string (parsed.object->getJson(0))); + to_string (parsed.object->getJson(JsonOptions::none))); BEAST_EXPECT(serialized == json); } else @@ -114,7 +114,7 @@ public: if (BEAST_EXPECT(parsed.object)) { std::string const& serialized( - to_string(parsed.object->getJson(0))); + to_string(parsed.object->getJson(JsonOptions::none))); BEAST_EXPECT(serialized == goodJson); } } @@ -138,7 +138,7 @@ public: if (BEAST_EXPECT(parsed.object)) { std::string const& serialized( - to_string(parsed.object->getJson(0))); + to_string(parsed.object->getJson(JsonOptions::none))); BEAST_EXPECT(serialized == expectedJson); } } @@ -311,8 +311,8 @@ public: if (object1.getSerializer () == object2.getSerializer ()) { log << - "O1: " << object1.getJson (0) << '\n' << - "O2: " << object2.getJson (0) << std::endl; + "O1: " << object1.getJson (JsonOptions::none) << '\n' << + "O2: " << object2.getJson (JsonOptions::none) << std::endl; fail ("STObject error 4"); } else diff --git a/src/test/protocol/STTx_test.cpp b/src/test/protocol/STTx_test.cpp index 6bf39eaaf..c8098fb62 100644 --- a/src/test/protocol/STTx_test.cpp +++ b/src/test/protocol/STTx_test.cpp @@ -1477,8 +1477,8 @@ public: if (copy != j) { log << - "j=" << j.getJson (0) << '\n' << - "copy=" << copy.getJson (0) << std::endl; + "j=" << j.getJson (JsonOptions::none) << '\n' << + "copy=" << copy.getJson (JsonOptions::none) << std::endl; fail ("Transaction fails serialize/deserialize test"); } else @@ -1486,15 +1486,16 @@ public: pass (); } - STParsedJSONObject parsed ("test", j.getJson (0)); + STParsedJSONObject parsed ("test", j.getJson (JsonOptions::none)); if (!parsed.object) fail ("Unable to build object from json"); if (STObject (j) != parsed.object) { log << - "ORIG: " << j.getJson (0) << '\n' << - "BUILT " << parsed.object->getJson (0) << std::endl; + "ORIG: " << j.getJson (JsonOptions::none) << '\n' << + "BUILT " << parsed.object->getJson (JsonOptions::none) + << std::endl; fail ("Built a different transaction"); } else diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index 517384f6e..4bca32780 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -384,7 +384,8 @@ public: // gw writes a check for USD(10) to alice. Json::Value jvCheck; jvCheck[sfAccount.jsonName] = gw.human(); - jvCheck[sfSendMax.jsonName] = USD(10).value().getJson(0); + jvCheck[sfSendMax.jsonName] = + USD(10).value().getJson(JsonOptions::none); jvCheck[sfDestination.jsonName] = alice.human(); jvCheck[sfTransactionType.jsonName] = jss::CheckCreate; jvCheck[sfFlags.jsonName] = tfUniversal; @@ -420,7 +421,8 @@ public: jvEscrow[jss::Flags] = tfUniversal; jvEscrow[jss::Account] = gw.human(); jvEscrow[jss::Destination] = gw.human(); - jvEscrow[jss::Amount] = XRP(100).value().getJson(0); + jvEscrow[jss::Amount] = + XRP(100).value().getJson(JsonOptions::none); jvEscrow[sfFinishAfter.jsonName] = env.now().time_since_epoch().count() + 1; env (jvEscrow); @@ -456,7 +458,8 @@ public: jvPayChan[jss::Flags] = tfUniversal; jvPayChan[jss::Account] = gw.human (); jvPayChan[jss::Destination] = alice.human (); - jvPayChan[jss::Amount] = XRP (300).value().getJson (0); + jvPayChan[jss::Amount] = + XRP (300).value().getJson (JsonOptions::none); jvPayChan[sfSettleDelay.jsonName] = 24 * 60 * 60; jvPayChan[sfPublicKey.jsonName] = strHex (gw.pk().slice ()); env (jvPayChan); diff --git a/src/test/rpc/AmendmentBlocked_test.cpp b/src/test/rpc/AmendmentBlocked_test.cpp index b0d7b65ed..a9067c8de 100644 --- a/src/test/rpc/AmendmentBlocked_test.cpp +++ b/src/test/rpc/AmendmentBlocked_test.cpp @@ -66,7 +66,8 @@ class AmendmentBlocked_test : public beast::unit_test::suite pf_req[jss::subcommand] = "create"; pf_req[jss::source_account] = alice.human(); pf_req[jss::destination_account] = bob.human(); - pf_req[jss::destination_amount] = bob["USD"](20).value ().getJson (0); + pf_req[jss::destination_amount] = + bob["USD"](20).value ().getJson (JsonOptions::none); jr = wsc->invoke("path_find", pf_req) [jss::result]; BEAST_EXPECT (jr.isMember (jss::alternatives) && jr[jss::alternatives].isArray() && diff --git a/src/test/rpc/Book_test.cpp b/src/test/rpc/Book_test.cpp index aed2460c6..749252b0d 100644 --- a/src/test/rpc/Book_test.cpp +++ b/src/test/rpc/Book_test.cpp @@ -97,8 +97,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -165,9 +167,9 @@ public: BEAST_EXPECT(jv[jss::result].isMember(jss::offers) && jv[jss::result][jss::offers].size() == 1); BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerGets] == - XRP(200).value().getJson(0)); + XRP(200).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerPays] == - USD(100).value().getJson(0)); + USD(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(! jv[jss::result].isMember(jss::asks)); BEAST_EXPECT(! jv[jss::result].isMember(jss::bids)); } @@ -184,8 +186,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -260,8 +264,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -277,8 +283,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == XRP(75).value().getJson(0) && - t[jss::TakerPays] == USD(100).value().getJson(0); + t[jss::TakerGets] == + XRP(75).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + USD(100).value().getJson(JsonOptions::none); })); } @@ -340,13 +348,13 @@ public: BEAST_EXPECT(jv[jss::result].isMember(jss::bids) && jv[jss::result][jss::bids].size() == 1); BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerGets] == - USD(100).value().getJson(0)); + USD(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerPays] == - XRP(500).value().getJson(0)); + XRP(500).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerGets] == - XRP(200).value().getJson(0)); + XRP(200).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerPays] == - USD(100).value().getJson(0)); + USD(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(! jv[jss::result].isMember(jss::offers)); } @@ -362,8 +370,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -379,8 +389,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == XRP(75).value().getJson(0) && - t[jss::TakerPays] == USD(100).value().getJson(0); + t[jss::TakerGets] == + XRP(75).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + USD(100).value().getJson(JsonOptions::none); })); } @@ -455,8 +467,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -480,8 +494,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == JPY(100).value().getJson(0) && - t[jss::TakerPays] == CNY(700).value().getJson(0); + t[jss::TakerGets] == + JPY(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + CNY(700).value().getJson(JsonOptions::none); })); } @@ -566,13 +582,13 @@ public: BEAST_EXPECT(jv[jss::result].isMember(jss::offers) && jv[jss::result][jss::offers].size() == 2); BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerGets] == - XRP(200).value().getJson(0)); + XRP(200).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::offers][0u][jss::TakerPays] == - USD(100).value().getJson(0)); + USD(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::offers][1u][jss::TakerGets] == - CNY(200).value().getJson(0)); + CNY(200).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::offers][1u][jss::TakerPays] == - JPY(100).value().getJson(0)); + JPY(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(! jv[jss::result].isMember(jss::asks)); BEAST_EXPECT(! jv[jss::result].isMember(jss::bids)); } @@ -589,8 +605,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -614,8 +632,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == JPY(100).value().getJson(0) && - t[jss::TakerPays] == CNY(700).value().getJson(0); + t[jss::TakerGets] == + JPY(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + CNY(700).value().getJson(JsonOptions::none); })); } @@ -701,8 +721,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -718,8 +740,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == XRP(75).value().getJson(0) && - t[jss::TakerPays] == USD(100).value().getJson(0); + t[jss::TakerGets] == + XRP(75).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + USD(100).value().getJson(JsonOptions::none); })); } @@ -735,8 +759,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == JPY(100).value().getJson(0) && - t[jss::TakerPays] == CNY(700).value().getJson(0); + t[jss::TakerGets] == + JPY(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + CNY(700).value().getJson(JsonOptions::none); })); } @@ -752,8 +778,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == CNY(75).value().getJson(0) && - t[jss::TakerPays] == JPY(100).value().getJson(0); + t[jss::TakerGets] == + CNY(75).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + JPY(100).value().getJson(JsonOptions::none); })); } @@ -835,21 +863,21 @@ public: BEAST_EXPECT(jv[jss::result].isMember(jss::bids) && jv[jss::result][jss::bids].size() == 2); BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerGets] == - USD(100).value().getJson(0)); + USD(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::asks][0u][jss::TakerPays] == - XRP(500).value().getJson(0)); + XRP(500).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::asks][1u][jss::TakerGets] == - JPY(100).value().getJson(0)); + JPY(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::asks][1u][jss::TakerPays] == - CNY(500).value().getJson(0)); + CNY(500).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerGets] == - XRP(200).value().getJson(0)); + XRP(200).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::bids][0u][jss::TakerPays] == - USD(100).value().getJson(0)); + USD(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::bids][1u][jss::TakerGets] == - CNY(200).value().getJson(0)); + CNY(200).value().getJson(JsonOptions::none)); BEAST_EXPECT(jv[jss::result][jss::bids][1u][jss::TakerPays] == - JPY(100).value().getJson(0)); + JPY(100).value().getJson(JsonOptions::none)); BEAST_EXPECT(! jv[jss::result].isMember(jss::offers)); } @@ -865,8 +893,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(100).value().getJson(0) && - t[jss::TakerPays] == XRP(700).value().getJson(0); + t[jss::TakerGets] == + USD(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + XRP(700).value().getJson(JsonOptions::none); })); } @@ -882,8 +912,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == XRP(75).value().getJson(0) && - t[jss::TakerPays] == USD(100).value().getJson(0); + t[jss::TakerGets] == + XRP(75).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + USD(100).value().getJson(JsonOptions::none); })); } @@ -899,8 +931,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == JPY(100).value().getJson(0) && - t[jss::TakerPays] == CNY(700).value().getJson(0); + t[jss::TakerGets] == + JPY(100).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + CNY(700).value().getJson(JsonOptions::none); })); } @@ -916,8 +950,10 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == CNY(75).value().getJson(0) && - t[jss::TakerPays] == JPY(100).value().getJson(0); + t[jss::TakerGets] == + CNY(75).value().getJson(JsonOptions::none) && + t[jss::TakerPays] == + JPY(100).value().getJson(JsonOptions::none); })); } @@ -1008,8 +1044,10 @@ public: BEAST_EXPECT(jrOffer[sfLedgerEntryType.fieldName] == jss::Offer); BEAST_EXPECT(jrOffer[sfOwnerNode.fieldName] == "0000000000000000"); BEAST_EXPECT(jrOffer[sfSequence.fieldName] == 3); - BEAST_EXPECT(jrOffer[jss::TakerGets] == USD(10).value().getJson(0)); - BEAST_EXPECT(jrOffer[jss::TakerPays] == XRP(4000).value().getJson(0)); + BEAST_EXPECT(jrOffer[jss::TakerGets] == + USD(10).value().getJson(JsonOptions::none)); + BEAST_EXPECT(jrOffer[jss::TakerPays] == + XRP(4000).value().getJson(JsonOptions::none)); BEAST_EXPECT(jrOffer[jss::owner_funds] == "100"); BEAST_EXPECT(jrOffer[jss::quality] == "400000000"); @@ -1019,9 +1057,11 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(10).value().getJson(0) && + t[jss::TakerGets] == + USD(10).value().getJson(JsonOptions::none) && t[jss::owner_funds] == "100" && - t[jss::TakerPays] == XRP(4000).value().getJson(0); + t[jss::TakerPays] == + XRP(4000).value().getJson(JsonOptions::none); })); env(offer(bob, XRP(2000), USD(5))); @@ -1032,9 +1072,11 @@ public: { auto const& t = jv[jss::transaction]; return t[jss::TransactionType] == jss::OfferCreate && - t[jss::TakerGets] == USD(5).value().getJson(0) && + t[jss::TakerGets] == + USD(5).value().getJson(JsonOptions::none) && t[jss::owner_funds] == "50" && - t[jss::TakerPays] == XRP(2000).value().getJson(0); + t[jss::TakerPays] == + XRP(2000).value().getJson(JsonOptions::none); })); jv = wsc->invoke("book_offers", jvParams); @@ -1057,8 +1099,10 @@ public: BEAST_EXPECT(jrNextOffer[sfLedgerEntryType.fieldName] == jss::Offer); BEAST_EXPECT(jrNextOffer[sfOwnerNode.fieldName] == "0000000000000000"); BEAST_EXPECT(jrNextOffer[sfSequence.fieldName] == 3); - BEAST_EXPECT(jrNextOffer[jss::TakerGets] == USD(5).value().getJson(0)); - BEAST_EXPECT(jrNextOffer[jss::TakerPays] == XRP(2000).value().getJson(0)); + BEAST_EXPECT(jrNextOffer[jss::TakerGets] == + USD(5).value().getJson(JsonOptions::none)); + BEAST_EXPECT(jrNextOffer[jss::TakerPays] == + XRP(2000).value().getJson(JsonOptions::none)); BEAST_EXPECT(jrNextOffer[jss::owner_funds] == "50"); BEAST_EXPECT(jrNextOffer[jss::quality] == "400000000"); @@ -1090,8 +1134,8 @@ public: return false; auto const& t = (*maybeJv)[jss::transaction]; if (t[jss::TransactionType] != jss::OfferCreate || - t[jss::TakerGets] != takerGets.value().getJson(0) || - t[jss::TakerPays] != takerPays.value().getJson(0)) + t[jss::TakerGets] != takerGets.value().getJson(JsonOptions::none) || + t[jss::TakerPays] != takerPays.value().getJson(JsonOptions::none)) return false; // Make sure no other message is waiting return wsc->getMsg(timeout) == boost::none; diff --git a/src/test/rpc/LedgerData_test.cpp b/src/test/rpc/LedgerData_test.cpp index 9bdc3c55e..4c2b69ed1 100644 --- a/src/test/rpc/LedgerData_test.cpp +++ b/src/test/rpc/LedgerData_test.cpp @@ -303,7 +303,7 @@ public: jv[jss::Flags] = tfUniversal; jv[jss::Account] = Account{"bob5"}.human(); jv[jss::Destination] = Account{"bob6"}.human(); - jv[jss::Amount] = XRP(50).value().getJson(0); + jv[jss::Amount] = XRP(50).value().getJson(JsonOptions::none); jv[sfFinishAfter.fieldName] = NetClock::time_point{env.now() + 10s} .time_since_epoch().count(); @@ -316,7 +316,7 @@ public: jv[jss::Flags] = tfUniversal; jv[jss::Account] = Account{"bob6"}.human (); jv[jss::Destination] = Account{"bob7"}.human (); - jv[jss::Amount] = XRP(100).value().getJson (0); + jv[jss::Amount] = XRP(100).value().getJson (JsonOptions::none); jv[jss::SettleDelay] = NetClock::duration{10s}.count(); jv[sfPublicKey.fieldName] = strHex (Account{"bob6"}.pk().slice ()); jv[sfCancelAfter.fieldName] = diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index 5421859f1..3d2944c6a 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -340,7 +340,7 @@ class LedgerRPC_test : public beast::unit_test::suite { Json::Value jv; jv[sfAccount.jsonName] = account.human(); - jv[sfSendMax.jsonName] = sendMax.getJson(0); + jv[sfSendMax.jsonName] = sendMax.getJson(JsonOptions::none); jv[sfDestination.jsonName] = dest.human(); jv[sfTransactionType.jsonName] = jss::CheckCreate; jv[sfFlags.jsonName] = tfUniversal; @@ -665,7 +665,7 @@ class LedgerRPC_test : public beast::unit_test::suite jv[jss::Flags] = tfUniversal; jv[jss::Account] = account.human(); jv[jss::Destination] = to.human(); - jv[jss::Amount] = amount.getJson(0); + jv[jss::Amount] = amount.getJson(JsonOptions::none); jv[sfFinishAfter.jsonName] = cancelAfter.time_since_epoch().count() + 2; return jv; @@ -853,7 +853,7 @@ class LedgerRPC_test : public beast::unit_test::suite jv[jss::TransactionType] = jss::PaymentChannelCreate; jv[jss::Account] = account.human(); jv[jss::Destination] = to.human(); - jv[jss::Amount] = amount.getJson (0); + jv[jss::Amount] = amount.getJson (JsonOptions::none); jv[sfSettleDelay.jsonName] = settleDelay.count(); jv[sfPublicKey.jsonName] = strHex (pk.slice()); return jv; diff --git a/src/test/rpc/NoRippleCheck_test.cpp b/src/test/rpc/NoRippleCheck_test.cpp index 7bc928708..a128cf102 100644 --- a/src/test/rpc/NoRippleCheck_test.cpp +++ b/src/test/rpc/NoRippleCheck_test.cpp @@ -219,7 +219,7 @@ class NoRippleCheck_test : public beast::unit_test::suite jss::TrustSet); BEAST_EXPECT ( result[jss::transactions][txs.size()-1][jss::LimitAmount] == - gw["USD"](100).value ().getJson (0)); + gw["USD"](100).value ().getJson (JsonOptions::none)); } else { diff --git a/src/test/rpc/OwnerInfo_test.cpp b/src/test/rpc/OwnerInfo_test.cpp index 2758da9ec..b862acf6e 100644 --- a/src/test/rpc/OwnerInfo_test.cpp +++ b/src/test/rpc/OwnerInfo_test.cpp @@ -121,24 +121,24 @@ class OwnerInfo_test : public beast::unit_test::suite BEAST_EXPECT ( lines[0u][sfBalance.fieldName] == (STAmount{Issue{to_currency("CNY"), noAccount()}, 0} - .value().getJson(0))); + .value().getJson(JsonOptions::none))); BEAST_EXPECT ( lines[0u][sfHighLimit.fieldName] == - alice["CNY"](1000).value().getJson(0)); + alice["CNY"](1000).value().getJson(JsonOptions::none)); BEAST_EXPECT ( lines[0u][sfLowLimit.fieldName] == - gw["CNY"](0).value().getJson(0)); + gw["CNY"](0).value().getJson(JsonOptions::none)); BEAST_EXPECT ( lines[1u][sfBalance.fieldName] == (STAmount{Issue{to_currency("USD"), noAccount()}, 0} - .value().getJson(0))); + .value().getJson(JsonOptions::none))); BEAST_EXPECT ( lines[1u][sfHighLimit.fieldName] == - alice["USD"](1000).value().getJson(0)); + alice["USD"](1000).value().getJson(JsonOptions::none)); BEAST_EXPECT ( lines[1u][sfLowLimit.fieldName] == - USD(0).value().getJson(0)); + USD(0).value().getJson(JsonOptions::none)); if (! BEAST_EXPECT (result[jss::accepted].isMember(jss::offers))) return; @@ -149,9 +149,11 @@ class OwnerInfo_test : public beast::unit_test::suite BEAST_EXPECT ( offers[0u][jss::Account] == alice.human()); BEAST_EXPECT ( - offers[0u][sfTakerGets.fieldName] == XRP(1000).value().getJson(0)); + offers[0u][sfTakerGets.fieldName] == + XRP(1000).value().getJson(JsonOptions::none)); BEAST_EXPECT ( - offers[0u][sfTakerPays.fieldName] == USD(1).value().getJson(0)); + offers[0u][sfTakerPays.fieldName] == + USD(1).value().getJson(JsonOptions::none)); // current ledger entry @@ -164,24 +166,24 @@ class OwnerInfo_test : public beast::unit_test::suite BEAST_EXPECT ( lines[0u][sfBalance.fieldName] == (STAmount{Issue{to_currency("CNY"), noAccount()}, -50} - .value().getJson(0))); + .value().getJson(JsonOptions::none))); BEAST_EXPECT ( lines[0u][sfHighLimit.fieldName] == - alice["CNY"](1000).value().getJson(0)); + alice["CNY"](1000).value().getJson(JsonOptions::none)); BEAST_EXPECT ( lines[0u][sfLowLimit.fieldName] == - gw["CNY"](0).value().getJson(0)); + gw["CNY"](0).value().getJson(JsonOptions::none)); BEAST_EXPECT ( lines[1u][sfBalance.fieldName] == (STAmount{Issue{to_currency("USD"), noAccount()}, -50} - .value().getJson(0))); + .value().getJson(JsonOptions::none))); BEAST_EXPECT ( lines[1u][sfHighLimit.fieldName] == - alice["USD"](1000).value().getJson(0)); + alice["USD"](1000).value().getJson(JsonOptions::none)); BEAST_EXPECT ( lines[1u][sfLowLimit.fieldName] == - gw["USD"](0).value().getJson(0)); + gw["USD"](0).value().getJson(JsonOptions::none)); if (! BEAST_EXPECT (result[jss::current].isMember(jss::offers))) return; @@ -195,9 +197,11 @@ class OwnerInfo_test : public beast::unit_test::suite BEAST_EXPECT ( offers[0u][jss::Account] == alice.human()); BEAST_EXPECT ( - offers[0u][sfTakerGets.fieldName] == XRP(1000).value().getJson(0)); + offers[0u][sfTakerGets.fieldName] == + XRP(1000).value().getJson(JsonOptions::none)); BEAST_EXPECT ( - offers[0u][sfTakerPays.fieldName] == CNY(2).value().getJson(0)); + offers[0u][sfTakerPays.fieldName] == + CNY(2).value().getJson(JsonOptions::none)); } public: diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 6222cdf10..284ce4dc5 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -565,7 +565,9 @@ public: Json::Value jv; jv[jss::books] = Json::arrayValue; jv[jss::books][0u] = Json::objectValue; - jv[jss::books][0u][jss::taker_pays] = Account{"gateway"}["USD"](1).value().getJson(1); + jv[jss::books][0u][jss::taker_pays] = + Account{"gateway"}["USD"](1).value() + .getJson(JsonOptions::include_date); jv[jss::books][0u][jss::taker_gets] = Json::objectValue; auto jr = wsc->invoke(method, jv) [jss::result]; // NOTE: this error is slightly incongruous with the @@ -578,7 +580,9 @@ public: Json::Value jv; jv[jss::books] = Json::arrayValue; jv[jss::books][0u] = Json::objectValue; - jv[jss::books][0u][jss::taker_pays] = Account{"gateway"}["USD"](1).value().getJson(1); + jv[jss::books][0u][jss::taker_pays] = + Account{"gateway"}["USD"](1).value() + .getJson(JsonOptions::include_date); jv[jss::books][0u][jss::taker_gets][jss::currency] = "ZZZZ"; auto jr = wsc->invoke(method, jv) [jss::result]; // NOTE: this error is slightly incongruous with the @@ -591,7 +595,9 @@ public: Json::Value jv; jv[jss::books] = Json::arrayValue; jv[jss::books][0u] = Json::objectValue; - jv[jss::books][0u][jss::taker_pays] = Account{"gateway"}["USD"](1).value().getJson(1); + jv[jss::books][0u][jss::taker_pays] = + Account{"gateway"}["USD"](1).value() + .getJson(JsonOptions::include_date); jv[jss::books][0u][jss::taker_gets][jss::currency] = "USD"; jv[jss::books][0u][jss::taker_gets][jss::issuer] = 1; auto jr = wsc->invoke(method, jv) [jss::result]; @@ -603,7 +609,9 @@ public: Json::Value jv; jv[jss::books] = Json::arrayValue; jv[jss::books][0u] = Json::objectValue; - jv[jss::books][0u][jss::taker_pays] = Account{"gateway"}["USD"](1).value().getJson(1); + jv[jss::books][0u][jss::taker_pays] = + Account{"gateway"}["USD"](1).value() + .getJson(JsonOptions::include_date); jv[jss::books][0u][jss::taker_gets][jss::currency] = "USD"; jv[jss::books][0u][jss::taker_gets][jss::issuer] = Account{"gateway"}.human() + "DEAD"; auto jr = wsc->invoke(method, jv) [jss::result]; @@ -615,8 +623,12 @@ public: Json::Value jv; jv[jss::books] = Json::arrayValue; jv[jss::books][0u] = Json::objectValue; - jv[jss::books][0u][jss::taker_pays] = Account{"gateway"}["USD"](1).value().getJson(1); - jv[jss::books][0u][jss::taker_gets] = Account{"gateway"}["USD"](1).value().getJson(1); + jv[jss::books][0u][jss::taker_pays] = + Account{"gateway"}["USD"](1).value() + .getJson(JsonOptions::include_date); + jv[jss::books][0u][jss::taker_gets] = + Account{"gateway"}["USD"](1).value() + .getJson(JsonOptions::include_date); auto jr = wsc->invoke(method, jv) [jss::result]; BEAST_EXPECT(jr[jss::error] == "badMarket"); BEAST_EXPECT(jr[jss::error_message] == "No such market."); diff --git a/src/test/rpc/TransactionHistory_test.cpp b/src/test/rpc/TransactionHistory_test.cpp index c933dc33d..37da6a318 100644 --- a/src/test/rpc/TransactionHistory_test.cpp +++ b/src/test/rpc/TransactionHistory_test.cpp @@ -91,7 +91,7 @@ class TransactionHistory_test : public beast::unit_test::suite // search for a tx in history matching the last offer bool const txFound = [&] { - auto const toFind = env.tx()->getJson(0); + auto const toFind = env.tx()->getJson(JsonOptions::none); for (auto tx : result[jss::txs]) { tx.removeMember(jss::inLedger);