rippled
AccountTx.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012-2014 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/app/ledger/LedgerMaster.h>
21 #include <ripple/app/main/Application.h>
22 #include <ripple/app/misc/NetworkOPs.h>
23 #include <ripple/app/misc/Transaction.h>
24 #include <ripple/app/rdb/backend/PostgresDatabase.h>
25 #include <ripple/app/rdb/backend/SQLiteDatabase.h>
26 #include <ripple/core/Pg.h>
27 #include <ripple/json/json_reader.h>
28 #include <ripple/json/json_value.h>
29 #include <ripple/ledger/ReadView.h>
30 #include <ripple/net/RPCErr.h>
31 #include <ripple/protocol/ErrorCodes.h>
32 #include <ripple/protocol/UintTypes.h>
33 #include <ripple/protocol/jss.h>
34 #include <ripple/resource/Fees.h>
35 #include <ripple/rpc/Context.h>
36 #include <ripple/rpc/DeliveredAmount.h>
37 #include <ripple/rpc/Role.h>
38 #include <ripple/rpc/impl/GRPCHelpers.h>
39 #include <ripple/rpc/impl/RPCHelpers.h>
40 
41 #include <grpcpp/grpcpp.h>
42 
43 namespace ripple {
44 
50 
53 
54 // parses args into a ledger specifier, or returns a grpc status object on error
57  org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest const& params)
58 {
59  grpc::Status status;
60  if (params.has_ledger_range())
61  {
62  uint32_t min = params.ledger_range().ledger_index_min();
63  uint32_t max = params.ledger_range().ledger_index_max();
64 
65  // if min is set but not max, need to set max
66  if (min != 0 && max == 0)
67  {
68  max = UINT32_MAX;
69  }
70 
71  return LedgerRange{min, max};
72  }
73  else if (params.has_ledger_specifier())
74  {
75  LedgerSpecifier ledger;
76 
77  auto& specifier = params.ledger_specifier();
78  using LedgerCase = org::xrpl::rpc::v1::LedgerSpecifier::LedgerCase;
79  LedgerCase ledgerCase = specifier.ledger_case();
80 
81  if (ledgerCase == LedgerCase::kShortcut)
82  {
83  using LedgerSpecifier = org::xrpl::rpc::v1::LedgerSpecifier;
84 
85  if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_VALIDATED)
86  ledger = LedgerShortcut::VALIDATED;
87  else if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_CLOSED)
88  ledger = LedgerShortcut::CLOSED;
89  else if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_CURRENT)
90  ledger = LedgerShortcut::CURRENT;
91  else
92  return {};
93  }
94  else if (ledgerCase == LedgerCase::kSequence)
95  {
96  ledger = specifier.sequence();
97  }
98  else if (ledgerCase == LedgerCase::kHash)
99  {
100  if (auto hash = uint256::fromVoidChecked(specifier.hash()))
101  {
102  ledger = *hash;
103  }
104  else
105  {
106  grpc::Status errorStatus{
107  grpc::StatusCode::INVALID_ARGUMENT,
108  "ledger hash malformed"};
109  return errorStatus;
110  }
111  }
112  return ledger;
113  }
115 }
116 
117 // parses args into a ledger specifier, or returns a Json object on error
120 {
121  Json::Value response;
122  if (params.isMember(jss::ledger_index_min) ||
123  params.isMember(jss::ledger_index_max))
124  {
125  uint32_t min = params.isMember(jss::ledger_index_min) &&
126  params[jss::ledger_index_min].asInt() >= 0
127  ? params[jss::ledger_index_min].asUInt()
128  : 0;
129  uint32_t max = params.isMember(jss::ledger_index_max) &&
130  params[jss::ledger_index_max].asInt() >= 0
131  ? params[jss::ledger_index_max].asUInt()
132  : UINT32_MAX;
133 
134  return LedgerRange{min, max};
135  }
136  else if (params.isMember(jss::ledger_hash))
137  {
138  auto& hashValue = params[jss::ledger_hash];
139  if (!hashValue.isString())
140  {
141  RPC::Status status{rpcINVALID_PARAMS, "ledgerHashNotString"};
142  status.inject(response);
143  return response;
144  }
145 
146  LedgerHash hash;
147  if (!hash.parseHex(hashValue.asString()))
148  {
149  RPC::Status status{rpcINVALID_PARAMS, "ledgerHashMalformed"};
150  status.inject(response);
151  return response;
152  }
153  return hash;
154  }
155  else if (params.isMember(jss::ledger_index))
156  {
157  LedgerSpecifier ledger;
158  if (params[jss::ledger_index].isNumeric())
159  ledger = params[jss::ledger_index].asUInt();
160  else
161  {
162  std::string ledgerStr = params[jss::ledger_index].asString();
163 
164  if (ledgerStr == "current" || ledgerStr.empty())
165  ledger = LedgerShortcut::CURRENT;
166  else if (ledgerStr == "closed")
167  ledger = LedgerShortcut::CLOSED;
168  else if (ledgerStr == "validated")
169  ledger = LedgerShortcut::VALIDATED;
170  else
171  {
172  RPC::Status status{
173  rpcINVALID_PARAMS, "ledger_index string malformed"};
174  status.inject(response);
175  return response;
176  }
177  }
178  return ledger;
179  }
181 }
182 
185  RPC::Context& context,
186  std::optional<LedgerSpecifier> const& ledgerSpecifier)
187 {
188  std::uint32_t uValidatedMin;
189  std::uint32_t uValidatedMax;
190  bool bValidated =
191  context.ledgerMaster.getValidatedRange(uValidatedMin, uValidatedMax);
192 
193  if (!bValidated)
194  {
195  // Don't have a validated ledger range.
196  if (context.apiVersion == 1)
197  return rpcLGR_IDXS_INVALID;
198  return rpcNOT_SYNCED;
199  }
200 
201  std::uint32_t uLedgerMin = uValidatedMin;
202  std::uint32_t uLedgerMax = uValidatedMax;
203  // Does request specify a ledger or ledger range?
204  if (ledgerSpecifier)
205  {
206  auto const status = std::visit(
207  [&](auto const& ls) -> RPC::Status {
208  using T = std::decay_t<decltype(ls)>;
209  if constexpr (std::is_same_v<T, LedgerRange>)
210  {
211  if (ls.min > uValidatedMin)
212  {
213  uLedgerMin = ls.min;
214  }
215  if (ls.max < uValidatedMax)
216  {
217  uLedgerMax = ls.max;
218  }
219  if (uLedgerMax < uLedgerMin)
220  {
221  if (context.apiVersion == 1)
222  return rpcLGR_IDXS_INVALID;
223  return rpcINVALID_LGR_RANGE;
224  }
225  }
226  else
227  {
229  auto const status = getLedger(ledgerView, ls, context);
230  if (!ledgerView)
231  {
232  return status;
233  }
234 
235  bool validated = RPC::isValidated(
236  context.ledgerMaster, *ledgerView, context.app);
237 
238  if (!validated || ledgerView->info().seq > uValidatedMax ||
239  ledgerView->info().seq < uValidatedMin)
240  {
241  return rpcLGR_NOT_VALIDATED;
242  }
243  uLedgerMin = uLedgerMax = ledgerView->info().seq;
244  }
245  return RPC::Status::OK;
246  },
247  *ledgerSpecifier);
248 
249  if (status)
250  return status;
251  }
252  return LedgerRange{uLedgerMin, uLedgerMax};
253 }
254 
257 {
259  if (context.app.config().reporting())
260  {
261  auto const db = dynamic_cast<PostgresDatabase*>(
262  &context.app.getRelationalDatabase());
263 
264  if (!db)
265  Throw<std::runtime_error>("Failed to get relational database");
266 
267  return db->getAccountTx(args);
268  }
269 
270  AccountTxResult result;
271 
272  auto lgrRange = getLedgerRange(context, args.ledger);
273  if (auto stat = std::get_if<RPC::Status>(&lgrRange))
274  {
275  // An error occurred getting the requested ledger range
276  return {result, *stat};
277  }
278 
279  result.ledgerRange = std::get<LedgerRange>(lgrRange);
280 
281  result.marker = args.marker;
282 
284  args.account,
285  result.ledgerRange.min,
286  result.ledgerRange.max,
287  result.marker,
288  args.limit,
289  isUnlimited(context.role)};
290 
291  auto const db =
292  dynamic_cast<SQLiteDatabase*>(&context.app.getRelationalDatabase());
293 
294  if (!db)
295  Throw<std::runtime_error>("Failed to get relational database");
296 
297  if (args.binary)
298  {
299  if (args.forward)
300  {
301  auto [tx, marker] = db->oldestAccountTxPageB(options);
302  result.transactions = tx;
303  result.marker = marker;
304  }
305  else
306  {
307  auto [tx, marker] = db->newestAccountTxPageB(options);
308  result.transactions = tx;
309  result.marker = marker;
310  }
311  }
312  else
313  {
314  if (args.forward)
315  {
316  auto [tx, marker] = db->oldestAccountTxPage(options);
317  result.transactions = tx;
318  result.marker = marker;
319  }
320  else
321  {
322  auto [tx, marker] = db->newestAccountTxPage(options);
323  result.transactions = tx;
324  result.marker = marker;
325  }
326  }
327 
328  result.limit = args.limit;
329  JLOG(context.j.debug()) << __func__ << " : finished";
330 
331  return {result, rpcSUCCESS};
332 }
333 
334 std::pair<
335  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
336  grpc::Status>
339  AccountTxArgs const& args,
341  org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest> const& context)
342 {
343  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
344  grpc::Status status = grpc::Status::OK;
345 
346  RPC::Status const& error = res.second;
347  if (error.toErrorCode() != rpcSUCCESS)
348  {
349  if (error.toErrorCode() == rpcLGR_NOT_FOUND)
350  {
351  status = {grpc::StatusCode::NOT_FOUND, error.message()};
352  }
353  else if (error.toErrorCode() == rpcNOT_SYNCED)
354  {
355  status = {grpc::StatusCode::FAILED_PRECONDITION, error.message()};
356  }
357  else
358  {
359  status = {grpc::StatusCode::INVALID_ARGUMENT, error.message()};
360  }
361  }
362  else
363  {
364  AccountTxResult const& result = res.first;
365 
366  // account_tx always returns validated data
367  response.set_validated(true);
368  response.set_limit(result.limit);
369  response.mutable_account()->set_address(
370  context.params.account().address());
371  response.set_ledger_index_min(result.ledgerRange.min);
372  response.set_ledger_index_max(result.ledgerRange.max);
373 
374  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
375  {
376  assert(!args.binary);
377  for (auto const& [txn, txnMeta] : *txnsData)
378  {
379  if (txn)
380  {
381  auto txnProto = response.add_transactions();
382 
383  RPC::convert(
384  *txnProto->mutable_transaction(),
385  txn->getSTransaction());
386 
387  // account_tx always returns validated data
388  txnProto->set_validated(true);
389  txnProto->set_ledger_index(txn->getLedger());
390  auto& hash = txn->getID();
391  txnProto->set_hash(hash.data(), hash.size());
392  auto closeTime =
393  context.app.getLedgerMaster().getCloseTimeBySeq(
394  txn->getLedger());
395  if (closeTime)
396  txnProto->mutable_date()->set_value(
397  closeTime->time_since_epoch().count());
398  if (txnMeta)
399  {
400  RPC::convert(*txnProto->mutable_meta(), txnMeta);
401  if (!txnProto->meta().has_delivered_amount())
402  {
403  if (auto amt = getDeliveredAmount(
404  context,
405  txn->getSTransaction(),
406  *txnMeta,
407  txn->getLedger()))
408  {
409  RPC::convert(
410  *txnProto->mutable_meta()
411  ->mutable_delivered_amount(),
412  *amt);
413  }
414  }
415  }
416  }
417  }
418  }
419  else
420  {
421  assert(args.binary);
422 
423  for (auto const& binaryData :
424  std::get<TxnsDataBinary>(result.transactions))
425  {
426  auto txnProto = response.add_transactions();
427  Blob const& txnBlob = std::get<0>(binaryData);
428  txnProto->set_transaction_binary(
429  txnBlob.data(), txnBlob.size());
430 
431  Blob const& metaBlob = std::get<1>(binaryData);
432  txnProto->set_meta_binary(metaBlob.data(), metaBlob.size());
433 
434  txnProto->set_ledger_index(std::get<2>(binaryData));
435 
436  // account_tx always returns validated data
437  txnProto->set_validated(true);
438 
439  auto closeTime =
440  context.app.getLedgerMaster().getCloseTimeBySeq(
441  std::get<2>(binaryData));
442  if (closeTime)
443  txnProto->mutable_date()->set_value(
444  closeTime->time_since_epoch().count());
445  }
446  }
447 
448  if (result.marker)
449  {
450  response.mutable_marker()->set_ledger_index(
451  result.marker->ledgerSeq);
452  response.mutable_marker()->set_account_sequence(
453  result.marker->txnSeq);
454  }
455  }
456  return {response, status};
457 }
458 
462  AccountTxArgs const& args,
463  RPC::JsonContext const& context)
464 {
465  Json::Value response;
466  RPC::Status const& error = res.second;
467  if (error.toErrorCode() != rpcSUCCESS)
468  {
469  error.inject(response);
470  }
471  else
472  {
473  AccountTxResult const& result = res.first;
474  response[jss::validated] = true;
475  response[jss::limit] = result.limit;
476  response[jss::account] = context.params[jss::account].asString();
477  response[jss::ledger_index_min] = result.ledgerRange.min;
478  response[jss::ledger_index_max] = result.ledgerRange.max;
479 
480  Json::Value& jvTxns = (response[jss::transactions] = Json::arrayValue);
481 
482  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
483  {
484  assert(!args.binary);
485  for (auto const& [txn, txnMeta] : *txnsData)
486  {
487  if (txn)
488  {
489  Json::Value& jvObj = jvTxns.append(Json::objectValue);
490 
491  jvObj[jss::tx] = txn->getJson(JsonOptions::include_date);
492  if (txnMeta)
493  {
494  jvObj[jss::meta] =
495  txnMeta->getJson(JsonOptions::include_date);
496  jvObj[jss::validated] = true;
497  insertDeliveredAmount(
498  jvObj[jss::meta], context, txn, *txnMeta);
499  }
500  }
501  }
502  }
503  else
504  {
505  assert(args.binary);
506 
507  for (auto const& binaryData :
508  std::get<TxnsDataBinary>(result.transactions))
509  {
510  Json::Value& jvObj = jvTxns.append(Json::objectValue);
511 
512  jvObj[jss::tx_blob] = strHex(std::get<0>(binaryData));
513  jvObj[jss::meta] = strHex(std::get<1>(binaryData));
514  jvObj[jss::ledger_index] = std::get<2>(binaryData);
515  jvObj[jss::validated] = true;
516  }
517  }
518 
519  if (result.marker)
520  {
521  response[jss::marker] = Json::objectValue;
522  response[jss::marker][jss::ledger] = result.marker->ledgerSeq;
523  response[jss::marker][jss::seq] = result.marker->txnSeq;
524  }
525  if (context.app.config().reporting())
526  response["used_postgres"] = true;
527  }
528 
529  JLOG(context.j.debug()) << __func__ << " : finished";
530  return response;
531 }
532 
533 // {
534 // account: account,
535 // ledger_index_min: ledger_index // optional, defaults to earliest
536 // ledger_index_max: ledger_index, // optional, defaults to latest
537 // binary: boolean, // optional, defaults to false
538 // forward: boolean, // optional, defaults to false
539 // limit: integer, // optional
540 // marker: object {ledger: ledger_index, seq: txn_sequence} // optional,
541 // resume previous query
542 // }
545 {
546  if (!context.app.config().useTxTables())
547  return rpcError(rpcNOT_ENABLED);
548 
549  auto& params = context.params;
550  AccountTxArgs args;
551  Json::Value response;
552 
553  args.limit = params.isMember(jss::limit) ? params[jss::limit].asUInt() : 0;
554  args.binary = params.isMember(jss::binary) && params[jss::binary].asBool();
555  args.forward =
556  params.isMember(jss::forward) && params[jss::forward].asBool();
557 
558  if (!params.isMember(jss::account))
559  return rpcError(rpcINVALID_PARAMS);
560 
561  auto const account =
562  parseBase58<AccountID>(params[jss::account].asString());
563  if (!account)
564  return rpcError(rpcACT_MALFORMED);
565 
566  args.account = *account;
567 
568  auto parseRes = parseLedgerArgs(params);
569  if (auto jv = std::get_if<Json::Value>(&parseRes))
570  {
571  return *jv;
572  }
573  else
574  {
575  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
576  }
577 
578  if (params.isMember(jss::marker))
579  {
580  auto& token = params[jss::marker];
581  if (!token.isMember(jss::ledger) || !token.isMember(jss::seq) ||
582  !token[jss::ledger].isConvertibleTo(Json::ValueType::uintValue) ||
583  !token[jss::seq].isConvertibleTo(Json::ValueType::uintValue))
584  {
585  RPC::Status status{
587  "invalid marker. Provide ledger index via ledger field, and "
588  "transaction sequence number via seq field"};
589  status.inject(response);
590  return response;
591  }
592  args.marker = {token[jss::ledger].asUInt(), token[jss::seq].asUInt()};
593  }
594 
595  auto res = doAccountTxHelp(context, args);
596  JLOG(context.j.debug()) << __func__ << " populating response";
597  return populateJsonResponse(res, args, context);
598 }
599 
600 std::pair<
601  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
602  grpc::Status>
605  context)
606 {
607  if (!context.app.config().useTxTables())
608  {
609  return {
610  {},
611  {grpc::StatusCode::UNIMPLEMENTED, "Not enabled in configuration."}};
612  }
613 
614  // return values
615  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
616  grpc::Status status = grpc::Status::OK;
617  AccountTxArgs args;
618 
619  auto& request = context.params;
620 
621  auto const account = parseBase58<AccountID>(request.account().address());
622  if (!account)
623  {
624  return {
625  {},
626  {grpc::StatusCode::INVALID_ARGUMENT, "Could not decode account"}};
627  }
628 
629  args.account = *account;
630  args.limit = request.limit();
631  args.binary = request.binary();
632  args.forward = request.forward();
633 
634  if (request.has_marker())
635  {
636  args.marker = {
637  request.marker().ledger_index(),
638  request.marker().account_sequence()};
639  }
640 
641  auto parseRes = parseLedgerArgs(request);
642  if (auto stat = std::get_if<grpc::Status>(&parseRes))
643  {
644  return {response, *stat};
645  }
646  else
647  {
648  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
649  }
650 
651  auto res = doAccountTxHelp(context, args);
652  return populateProtoResponse(res, args, context);
653 }
654 
655 } // namespace ripple
ripple::SQLiteDatabase
Definition: SQLiteDatabase.h:27
ripple::ReadView::info
virtual LedgerInfo const & info() const =0
Returns information about the ledger.
ripple::LedgerMaster::getValidatedRange
bool getValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
Definition: LedgerMaster.cpp:629
ripple::RPC::Status::OK
static constexpr Code OK
Definition: Status.h:46
ripple::JsonOptions::include_date
@ include_date
ripple::RPC::JsonContext
Definition: Context.h:53
ripple::RelationalDatabase::txnMetaLedgerType
std::tuple< Blob, Blob, std::uint32_t > txnMetaLedgerType
Definition: RelationalDatabase.h:87
ripple::rpcLGR_IDXS_INVALID
@ rpcLGR_IDXS_INVALID
Definition: ErrorCodes.h:112
std::string
STL class.
std::shared_ptr
STL class.
ripple::rpcINVALID_PARAMS
@ rpcINVALID_PARAMS
Definition: ErrorCodes.h:84
ripple::rpcError
Json::Value rpcError(int iError)
Definition: RPCErr.cpp:29
ripple::Resource::feeMediumBurdenRPC
const Charge feeMediumBurdenRPC
ripple::RelationalDatabase::AccountTxArgs
Definition: RelationalDatabase.h:96
Json::arrayValue
@ arrayValue
array value (ordered list)
Definition: json_value.h:42
std::pair
ripple::RPC::LedgerShortcut
LedgerShortcut
Definition: RPCHelpers.h:128
ripple::RelationalDatabase::AccountTxArgs::binary
bool binary
Definition: RelationalDatabase.h:100
ripple::RelationalDatabase::LedgerSpecifier
std::variant< LedgerRange, LedgerShortcut, LedgerSequence, LedgerHash > LedgerSpecifier
Definition: RelationalDatabase.h:94
ripple::RPC::Context::loadType
Resource::Charge & loadType
Definition: Context.h:43
std::vector< unsigned char >
std::vector::size
T size(T... args)
ripple::populateProtoResponse
std::pair< org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse, grpc::Status > populateProtoResponse(std::pair< AccountTxResult, RPC::Status > const &res, AccountTxArgs const &args, RPC::GRPCContext< org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest > const &context)
Definition: AccountTx.cpp:337
ripple::doAccountTxGrpc
std::pair< org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse, grpc::Status > doAccountTxGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest > &context)
Definition: AccountTx.cpp:603
ripple::RPC::Context::ledgerMaster
LedgerMaster & ledgerMaster
Definition: Context.h:45
ripple::RelationalDatabase::AccountTxs
std::vector< AccountTx > AccountTxs
Definition: RelationalDatabase.h:86
ripple::RelationalDatabase::AccountTxResult::transactions
std::variant< AccountTxs, MetaTxsList > transactions
Definition: RelationalDatabase.h:108
std::tuple
ripple::LedgerInfo::seq
LedgerIndex seq
Definition: ReadView.h:93
ripple::RPC::Context::role
Role role
Definition: Context.h:47
ripple::base_uint< 256 >::fromVoidChecked
static std::optional< base_uint > fromVoidChecked(T const &from)
Definition: base_uint.h:312
ripple::RelationalDatabase::AccountTxArgs::account
AccountID account
Definition: RelationalDatabase.h:98
ripple::rpcLGR_NOT_FOUND
@ rpcLGR_NOT_FOUND
Definition: ErrorCodes.h:72
ripple::RelationalDatabase::AccountTxResult
Definition: RelationalDatabase.h:106
ripple::doAccountTxHelp
std::pair< AccountTxResult, RPC::Status > doAccountTxHelp(RPC::Context &context, AccountTxArgs const &args)
Definition: AccountTx.cpp:256
ripple::RPC::Context::j
const beast::Journal j
Definition: Context.h:41
ripple::getLedgerRange
std::variant< LedgerRange, RPC::Status > getLedgerRange(RPC::Context &context, std::optional< LedgerSpecifier > const &ledgerSpecifier)
Definition: AccountTx.cpp:184
ripple::RelationalDatabase::AccountTxResult::ledgerRange
LedgerRange ledgerRange
Definition: RelationalDatabase.h:109
ripple::base_uint< 256 >
ripple::RPC::convert
void convert(org::xrpl::rpc::v1::TransactionResult &to, TER from)
Definition: GRPCHelpers.cpp:1108
ripple::rpcSUCCESS
@ rpcSUCCESS
Definition: ErrorCodes.h:44
Json::Value::append
Value & append(const Value &value)
Append value to array at the end.
Definition: json_value.cpp:882
ripple::Config::reporting
bool reporting() const
Definition: Config.h:316
Json::objectValue
@ objectValue
object value (collection of name/value pairs).
Definition: json_value.h:43
ripple::RelationalDatabase::MetaTxsList
std::vector< txnMetaLedgerType > MetaTxsList
Definition: RelationalDatabase.h:88
ripple::RelationalDatabase::LedgerShortcut
RPC::LedgerShortcut LedgerShortcut
Definition: RelationalDatabase.h:92
ripple::Application::config
virtual Config & config()=0
ripple::RelationalDatabase::AccountTxArgs::marker
std::optional< AccountTxMarker > marker
Definition: RelationalDatabase.h:103
ripple::RelationalDatabase::AccountTxArgs::limit
uint32_t limit
Definition: RelationalDatabase.h:102
ripple::RPC::GRPCContext
Definition: Context.h:70
ripple::Application::getRelationalDatabase
virtual RelationalDatabase & getRelationalDatabase()=0
ripple::Config::useTxTables
bool useTxTables() const
Definition: Config.h:322
ripple::RelationalDatabase::AccountTxResult::marker
std::optional< AccountTxMarker > marker
Definition: RelationalDatabase.h:111
ripple::RPC::Context::app
Application & app
Definition: Context.h:42
ripple::rpcNOT_ENABLED
@ rpcNOT_ENABLED
Definition: ErrorCodes.h:59
ripple::TxnsDataBinary
RelationalDatabase::MetaTxsList TxnsDataBinary
Definition: PostgresDatabase.cpp:47
Json::Value::isMember
bool isMember(const char *key) const
Return true if the object has a member named key.
Definition: json_value.cpp:932
std::uint32_t
ripple::RPC::Status
Status represents the results of an operation that might fail.
Definition: Status.h:39
std::decay_t
ripple::isUnlimited
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
Definition: Role.cpp:124
ripple::RelationalDatabase::AccountTxArgs::forward
bool forward
Definition: RelationalDatabase.h:101
ripple::RPC::GRPCContext::params
RequestType params
Definition: Context.h:72
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::populateJsonResponse
Json::Value populateJsonResponse(std::pair< AccountTxResult, RPC::Status > const &res, AccountTxArgs const &args, RPC::JsonContext const &context)
Definition: AccountTx.cpp:460
ripple::RPC::isValidated
bool isValidated(LedgerMaster &ledgerMaster, ReadView const &ledger, Application &app)
Definition: RPCHelpers.cpp:510
ripple::rpcACT_MALFORMED
@ rpcACT_MALFORMED
Definition: ErrorCodes.h:90
ripple::rpcLGR_NOT_VALIDATED
@ rpcLGR_NOT_VALIDATED
Definition: ErrorCodes.h:73
ripple::doAccountTxJson
Json::Value doAccountTxJson(RPC::JsonContext &context)
Definition: AccountTx.cpp:544
ripple::LedgerRange::max
uint32_t max
Definition: RelationalDatabase.h:45
Json::Value::asUInt
UInt asUInt() const
Definition: json_value.cpp:545
ripple::PostgresDatabase
Definition: PostgresDatabase.h:27
ripple::RPC::Context::apiVersion
unsigned int apiVersion
Definition: Context.h:50
std::visit
T visit(T... args)
std::string::empty
T empty(T... args)
ripple::parseLedgerArgs
std::variant< std::optional< LedgerSpecifier >, grpc::Status > parseLedgerArgs(org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest const &params)
Definition: AccountTx.cpp:56
std::optional
beast::Journal::debug
Stream debug() const
Definition: Journal.h:315
Json::Value::asInt
Int asInt() const
Definition: json_value.cpp:503
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:45
ripple::rpcINVALID_LGR_RANGE
@ rpcINVALID_LGR_RANGE
Definition: ErrorCodes.h:136
ripple::TxnsData
RelationalDatabase::AccountTxs TxnsData
Definition: PostgresDatabase.cpp:46
ripple::RelationalDatabase::AccountTxArgs::ledger
std::optional< LedgerSpecifier > ledger
Definition: RelationalDatabase.h:99
ripple::LedgerRange
Definition: RelationalDatabase.h:42
ripple::base_uint::parseHex
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition: base_uint.h:489
ripple::LedgerRange::min
uint32_t min
Definition: RelationalDatabase.h:44
ripple::RelationalDatabase::AccountTxResult::limit
uint32_t limit
Definition: RelationalDatabase.h:110
ripple::RPC::JsonContext::params
Json::Value params
Definition: Context.h:64
std::vector::data
T data(T... args)
ripple::RPC::Context
The context of information needed to call an RPC.
Definition: Context.h:39
ripple::RelationalDatabase::AccountTxPageOptions
Definition: RelationalDatabase.h:74
ripple::rpcNOT_SYNCED
@ rpcNOT_SYNCED
Definition: ErrorCodes.h:67
Json::Value
Represents a JSON value.
Definition: json_value.h:145
std::variant
Json::Value::asString
std::string asString() const
Returns the unquoted string value.
Definition: json_value.cpp:469