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/json/json_value.h>
25 #include <ripple/ledger/ReadView.h>
26 #include <ripple/net/RPCErr.h>
27 #include <ripple/protocol/ErrorCodes.h>
28 #include <ripple/protocol/UintTypes.h>
29 #include <ripple/protocol/jss.h>
30 #include <ripple/resource/Fees.h>
31 #include <ripple/rpc/Context.h>
32 #include <ripple/rpc/DeliveredAmount.h>
33 #include <ripple/rpc/Role.h>
34 #include <ripple/rpc/impl/GRPCHelpers.h>
35 #include <ripple/rpc/impl/RPCHelpers.h>
36 
37 #include <grpcpp/grpcpp.h>
38 
39 namespace ripple {
40 
41 using LedgerSequence = uint32_t;
42 using LedgerHash = uint256;
44 
46 
48 {
49  uint32_t min;
50  uint32_t max;
51 };
52 
53 using LedgerSpecifier =
55 
57 {
60  bool binary = false;
61  bool forward = false;
62  uint32_t limit = 0;
64 };
65 
69 
71 {
74  uint32_t limit;
76 };
77 
78 // parses args into a ledger specifier, or returns a grpc status object on error
81  org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest const& params)
82 {
83  grpc::Status status;
84  if (params.has_ledger_range())
85  {
86  uint32_t min = params.ledger_range().ledger_index_min();
87  uint32_t max = params.ledger_range().ledger_index_max();
88 
89  // if min is set but not max, need to set max
90  if (min != 0 && max == 0)
91  {
92  max = UINT32_MAX;
93  }
94 
95  return LedgerRange{min, max};
96  }
97  else if (params.has_ledger_specifier())
98  {
99  LedgerSpecifier ledger;
100 
101  auto& specifier = params.ledger_specifier();
102  using LedgerCase = org::xrpl::rpc::v1::LedgerSpecifier::LedgerCase;
103  LedgerCase ledgerCase = specifier.ledger_case();
104 
105  if (ledgerCase == LedgerCase::kShortcut)
106  {
107  using LedgerSpecifier = org::xrpl::rpc::v1::LedgerSpecifier;
108 
109  if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_VALIDATED)
110  ledger = LedgerShortcut::VALIDATED;
111  else if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_CLOSED)
112  ledger = LedgerShortcut::CLOSED;
113  else if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_CURRENT)
114  ledger = LedgerShortcut::CURRENT;
115  else
116  return {};
117  }
118  else if (ledgerCase == LedgerCase::kSequence)
119  {
120  ledger = specifier.sequence();
121  }
122  else if (ledgerCase == LedgerCase::kHash)
123  {
124  if (uint256::size() != specifier.hash().size())
125  {
126  grpc::Status errorStatus{
127  grpc::StatusCode::INVALID_ARGUMENT,
128  "ledger hash malformed"};
129  return errorStatus;
130  }
131  ledger = uint256::fromVoid(specifier.hash().data());
132  }
133  return ledger;
134  }
136 }
137 
138 // parses args into a ledger specifier, or returns a Json object on error
141 {
142  Json::Value response;
143  if (params.isMember(jss::ledger_index_min) ||
144  params.isMember(jss::ledger_index_max))
145  {
146  uint32_t min = params.isMember(jss::ledger_index_min) &&
147  params[jss::ledger_index_min].asInt() >= 0
148  ? params[jss::ledger_index_min].asUInt()
149  : 0;
150  uint32_t max = params.isMember(jss::ledger_index_max) &&
151  params[jss::ledger_index_max].asInt() >= 0
152  ? params[jss::ledger_index_max].asUInt()
153  : UINT32_MAX;
154 
155  return LedgerRange{min, max};
156  }
157  else if (params.isMember(jss::ledger_hash))
158  {
159  auto& hashValue = params[jss::ledger_hash];
160  if (!hashValue.isString())
161  {
162  RPC::Status status{rpcINVALID_PARAMS, "ledgerHashNotString"};
163  status.inject(response);
164  return response;
165  }
166 
167  LedgerHash hash;
168  if (!hash.parseHex(hashValue.asString()))
169  {
170  RPC::Status status{rpcINVALID_PARAMS, "ledgerHashMalformed"};
171  status.inject(response);
172  return response;
173  }
174  return hash;
175  }
176  else if (params.isMember(jss::ledger_index))
177  {
178  LedgerSpecifier ledger;
179  if (params[jss::ledger_index].isNumeric())
180  ledger = params[jss::ledger_index].asUInt();
181  else
182  {
183  std::string ledgerStr = params[jss::ledger_index].asString();
184 
185  if (ledgerStr == "current" || ledgerStr.empty())
186  ledger = LedgerShortcut::CURRENT;
187  else if (ledgerStr == "closed")
188  ledger = LedgerShortcut::CLOSED;
189  else if (ledgerStr == "validated")
190  ledger = LedgerShortcut::VALIDATED;
191  else
192  {
193  RPC::Status status{
194  rpcINVALID_PARAMS, "ledger_index string malformed"};
195  status.inject(response);
196  return response;
197  }
198  }
199  return ledger;
200  }
202 }
203 
206  RPC::Context& context,
207  std::optional<LedgerSpecifier> const& ledgerSpecifier)
208 {
209  std::uint32_t uValidatedMin;
210  std::uint32_t uValidatedMax;
211  bool bValidated =
212  context.ledgerMaster.getValidatedRange(uValidatedMin, uValidatedMax);
213 
214  if (!bValidated)
215  {
216  // Don't have a validated ledger range.
217  if (context.apiVersion == 1)
218  return rpcLGR_IDXS_INVALID;
219  return rpcNOT_SYNCED;
220  }
221 
222  std::uint32_t uLedgerMin = uValidatedMin;
223  std::uint32_t uLedgerMax = uValidatedMax;
224  // Does request specify a ledger or ledger range?
225  if (ledgerSpecifier)
226  {
227  auto const status = std::visit(
228  [&](auto const& ls) -> RPC::Status {
229  using T = std::decay_t<decltype(ls)>;
230  if constexpr (std::is_same_v<T, LedgerRange>)
231  {
232  if (ls.min > uValidatedMin)
233  {
234  uLedgerMin = ls.min;
235  }
236  if (ls.max < uValidatedMax)
237  {
238  uLedgerMax = ls.max;
239  }
240  if (uLedgerMax < uLedgerMin)
241  {
242  if (context.apiVersion == 1)
243  return rpcLGR_IDXS_INVALID;
244  return rpcINVALID_LGR_RANGE;
245  }
246  }
247  else
248  {
250  auto const status = getLedger(ledgerView, ls, context);
251  if (!ledgerView)
252  {
253  return status;
254  }
255 
256  bool validated = RPC::isValidated(
257  context.ledgerMaster, *ledgerView, context.app);
258 
259  if (!validated || ledgerView->info().seq > uValidatedMax ||
260  ledgerView->info().seq < uValidatedMin)
261  {
262  return rpcLGR_NOT_VALIDATED;
263  }
264  uLedgerMin = uLedgerMax = ledgerView->info().seq;
265  }
266  return RPC::Status::OK;
267  },
268  *ledgerSpecifier);
269 
270  if (status)
271  return status;
272  }
273  return LedgerRange{uLedgerMin, uLedgerMax};
274 }
275 
278 {
279  AccountTxResult result;
281 
282  auto lgrRange = getLedgerRange(context, args.ledger);
283  if (auto stat = std::get_if<RPC::Status>(&lgrRange))
284  {
285  // An error occurred getting the requested ledger range
286  return {result, *stat};
287  }
288 
289  result.ledgerRange = std::get<LedgerRange>(lgrRange);
290 
291  result.marker = args.marker;
292  if (args.binary)
293  {
294  result.transactions = context.netOps.getTxsAccountB(
295  args.account,
296  result.ledgerRange.min,
297  result.ledgerRange.max,
298  args.forward,
299  result.marker,
300  args.limit,
301  isUnlimited(context.role));
302  }
303  else
304  {
305  result.transactions = context.netOps.getTxsAccount(
306  args.account,
307  result.ledgerRange.min,
308  result.ledgerRange.max,
309  args.forward,
310  result.marker,
311  args.limit,
312  isUnlimited(context.role));
313  }
314 
315  result.limit = args.limit;
316 
317  return {result, rpcSUCCESS};
318 }
319 
320 std::pair<
321  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
322  grpc::Status>
325  AccountTxArgs const& args,
327  org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest> const& context)
328 {
329  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
330  grpc::Status status = grpc::Status::OK;
331 
332  RPC::Status const& error = res.second;
333  if (error.toErrorCode() != rpcSUCCESS)
334  {
335  if (error.toErrorCode() == rpcLGR_NOT_FOUND)
336  {
337  status = {grpc::StatusCode::NOT_FOUND, error.message()};
338  }
339  else if (error.toErrorCode() == rpcNOT_SYNCED)
340  {
341  status = {grpc::StatusCode::FAILED_PRECONDITION, error.message()};
342  }
343  else
344  {
345  status = {grpc::StatusCode::INVALID_ARGUMENT, error.message()};
346  }
347  }
348  else
349  {
350  AccountTxResult const& result = res.first;
351 
352  // account_tx always returns validated data
353  response.set_validated(true);
354  response.set_limit(result.limit);
355  response.mutable_account()->set_address(
356  context.params.account().address());
357  response.set_ledger_index_min(result.ledgerRange.min);
358  response.set_ledger_index_max(result.ledgerRange.max);
359 
360  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
361  {
362  assert(!args.binary);
363  for (auto const& [txn, txnMeta] : *txnsData)
364  {
365  if (txn)
366  {
367  auto txnProto = response.add_transactions();
368 
369  RPC::convert(
370  *txnProto->mutable_transaction(),
371  txn->getSTransaction());
372 
373  // account_tx always returns validated data
374  txnProto->set_validated(true);
375  txnProto->set_ledger_index(txn->getLedger());
376  auto& hash = txn->getID();
377  txnProto->set_hash(hash.data(), hash.size());
378  auto closeTime =
379  context.app.getLedgerMaster().getCloseTimeBySeq(
380  txn->getLedger());
381  if (closeTime)
382  txnProto->mutable_date()->set_value(
383  closeTime->time_since_epoch().count());
384  if (txnMeta)
385  {
386  RPC::convert(*txnProto->mutable_meta(), txnMeta);
387  if (!txnProto->meta().has_delivered_amount())
388  {
389  if (auto amt = getDeliveredAmount(
390  context,
391  txn->getSTransaction(),
392  *txnMeta,
393  txn->getLedger()))
394  {
395  RPC::convert(
396  *txnProto->mutable_meta()
397  ->mutable_delivered_amount(),
398  *amt);
399  }
400  }
401  }
402  }
403  }
404  }
405  else
406  {
407  assert(args.binary);
408 
409  for (auto const& binaryData :
410  std::get<TxnsDataBinary>(result.transactions))
411  {
412  auto txnProto = response.add_transactions();
413  Blob const& txnBlob = std::get<0>(binaryData);
414  txnProto->set_transaction_binary(
415  txnBlob.data(), txnBlob.size());
416 
417  Blob const& metaBlob = std::get<1>(binaryData);
418  txnProto->set_meta_binary(metaBlob.data(), metaBlob.size());
419 
420  txnProto->set_ledger_index(std::get<2>(binaryData));
421 
422  // account_tx always returns validated data
423  txnProto->set_validated(true);
424 
425  auto closeTime =
426  context.app.getLedgerMaster().getCloseTimeBySeq(
427  std::get<2>(binaryData));
428  if (closeTime)
429  txnProto->mutable_date()->set_value(
430  closeTime->time_since_epoch().count());
431  }
432  }
433 
434  if (result.marker)
435  {
436  response.mutable_marker()->set_ledger_index(
437  result.marker->ledgerSeq);
438  response.mutable_marker()->set_account_sequence(
439  result.marker->txnSeq);
440  }
441  }
442  return {response, status};
443 }
444 
448  AccountTxArgs const& args,
449  RPC::JsonContext const& context)
450 {
451  Json::Value response;
452  RPC::Status const& error = res.second;
453  if (error.toErrorCode() != rpcSUCCESS)
454  {
455  error.inject(response);
456  }
457  else
458  {
459  AccountTxResult const& result = res.first;
460  response[jss::validated] = true;
461  response[jss::limit] = result.limit;
462  response[jss::account] = context.params[jss::account].asString();
463  response[jss::ledger_index_min] = result.ledgerRange.min;
464  response[jss::ledger_index_max] = result.ledgerRange.max;
465 
466  Json::Value& jvTxns = (response[jss::transactions] = Json::arrayValue);
467 
468  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
469  {
470  assert(!args.binary);
471  for (auto const& [txn, txnMeta] : *txnsData)
472  {
473  if (txn)
474  {
475  Json::Value& jvObj = jvTxns.append(Json::objectValue);
476 
477  jvObj[jss::tx] = txn->getJson(JsonOptions::include_date);
478  if (txnMeta)
479  {
480  jvObj[jss::meta] =
481  txnMeta->getJson(JsonOptions::include_date);
482  jvObj[jss::validated] = true;
483  insertDeliveredAmount(
484  jvObj[jss::meta], context, txn, *txnMeta);
485  }
486  }
487  }
488  }
489  else
490  {
491  assert(args.binary);
492 
493  for (auto const& binaryData :
494  std::get<TxnsDataBinary>(result.transactions))
495  {
496  Json::Value& jvObj = jvTxns.append(Json::objectValue);
497 
498  jvObj[jss::tx_blob] = strHex(std::get<0>(binaryData));
499  jvObj[jss::meta] = strHex(std::get<1>(binaryData));
500  jvObj[jss::ledger_index] = std::get<2>(binaryData);
501  jvObj[jss::validated] = true;
502  }
503  }
504 
505  if (result.marker)
506  {
507  response[jss::marker] = Json::objectValue;
508  response[jss::marker][jss::ledger] = result.marker->ledgerSeq;
509  response[jss::marker][jss::seq] = result.marker->txnSeq;
510  }
511  }
512  return response;
513 }
514 
515 // {
516 // account: account,
517 // ledger_index_min: ledger_index // optional, defaults to earliest
518 // ledger_index_max: ledger_index, // optional, defaults to latest
519 // binary: boolean, // optional, defaults to false
520 // forward: boolean, // optional, defaults to false
521 // limit: integer, // optional
522 // marker: object {ledger: ledger_index, seq: txn_sequence} // optional,
523 // resume previous query
524 // }
527 {
528  auto& params = context.params;
529  AccountTxArgs args;
530  Json::Value response;
531 
532  args.limit = params.isMember(jss::limit) ? params[jss::limit].asUInt() : 0;
533  args.binary = params.isMember(jss::binary) && params[jss::binary].asBool();
534  args.forward =
535  params.isMember(jss::forward) && params[jss::forward].asBool();
536 
537  if (!params.isMember(jss::account))
538  return rpcError(rpcINVALID_PARAMS);
539 
540  auto const account =
541  parseBase58<AccountID>(params[jss::account].asString());
542  if (!account)
543  return rpcError(rpcACT_MALFORMED);
544 
545  args.account = *account;
546 
547  auto parseRes = parseLedgerArgs(params);
548  if (auto jv = std::get_if<Json::Value>(&parseRes))
549  {
550  return *jv;
551  }
552  else
553  {
554  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
555  }
556 
557  if (params.isMember(jss::marker))
558  {
559  auto& token = params[jss::marker];
560  if (!token.isMember(jss::ledger) || !token.isMember(jss::seq) ||
561  !token[jss::ledger].isConvertibleTo(Json::ValueType::uintValue) ||
562  !token[jss::seq].isConvertibleTo(Json::ValueType::uintValue))
563  {
564  RPC::Status status{
566  "invalid marker. Provide ledger index via ledger field, and "
567  "transaction sequence number via seq field"};
568  status.inject(response);
569  return response;
570  }
571  args.marker = {token[jss::ledger].asUInt(), token[jss::seq].asUInt()};
572  }
573 
574  auto res = doAccountTxHelp(context, args);
575  return populateJsonResponse(res, args, context);
576 }
577 
578 std::pair<
579  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
580  grpc::Status>
583  context)
584 {
585  // return values
586  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
587  grpc::Status status = grpc::Status::OK;
588  AccountTxArgs args;
589 
590  auto& request = context.params;
591 
592  auto const account = parseBase58<AccountID>(request.account().address());
593  if (!account)
594  {
595  return {
596  {},
597  {grpc::StatusCode::INVALID_ARGUMENT, "Could not decode account"}};
598  }
599 
600  args.account = *account;
601  args.limit = request.limit();
602  args.binary = request.binary();
603  args.forward = request.forward();
604 
605  if (request.has_marker())
606  {
607  args.marker = {
608  request.marker().ledger_index(),
609  request.marker().account_sequence()};
610  }
611 
612  auto parseRes = parseLedgerArgs(request);
613  if (auto stat = std::get_if<grpc::Status>(&parseRes))
614  {
615  return {response, *stat};
616  }
617  else
618  {
619  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
620  }
621 
622  auto res = doAccountTxHelp(context, args);
623  return populateProtoResponse(res, args, context);
624 }
625 
626 } // namespace ripple
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:610
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::NetworkOPs::AccountTxs
std::vector< AccountTx > AccountTxs
Definition: NetworkOPs.h:256
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::Resource::feeMediumBurdenRPC
const Charge feeMediumBurdenRPC
ripple::NetworkOPs::txnMetaLedgerType
std::tuple< Blob, Blob, std::uint32_t > txnMetaLedgerType
Definition: NetworkOPs.h:278
ripple::AccountTxArgs::binary
bool binary
Definition: AccountTx.cpp:60
Json::arrayValue
@ arrayValue
array value (ordered list)
Definition: json_value.h:42
std::pair
ripple::RPC::LedgerShortcut
LedgerShortcut
Definition: RPCHelpers.h:111
ripple::RPC::Context::loadType
Resource::Charge & loadType
Definition: Context.h:43
ripple::AccountTxResult::marker
std::optional< AccountTxMarker > marker
Definition: AccountTx.cpp:75
std::vector
STL class.
ripple::LedgerSequence
uint32_t LedgerSequence
Definition: AccountTx.cpp:41
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:323
ripple::AccountTxArgs::marker
std::optional< AccountTxMarker > marker
Definition: AccountTx.cpp:63
ripple::doAccountTxGrpc
std::pair< org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse, grpc::Status > doAccountTxGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest > &context)
Definition: AccountTx.cpp:581
ripple::RPC::Context::ledgerMaster
LedgerMaster & ledgerMaster
Definition: Context.h:45
ripple::AccountTxArgs::ledger
std::optional< LedgerSpecifier > ledger
Definition: AccountTx.cpp:59
std::tuple
ripple::LedgerInfo::seq
LedgerIndex seq
Definition: ReadView.h:92
ripple::RPC::Context::role
Role role
Definition: Context.h:47
ripple::rpcLGR_NOT_FOUND
@ rpcLGR_NOT_FOUND
Definition: ErrorCodes.h:72
ripple::AccountTxResult::ledgerRange
LedgerRange ledgerRange
Definition: AccountTx.cpp:73
ripple::base_uint< 256 >::size
constexpr static std::size_t size()
Definition: base_uint.h:426
ripple::doAccountTxHelp
std::pair< AccountTxResult, RPC::Status > doAccountTxHelp(RPC::Context &context, AccountTxArgs const &args)
Definition: AccountTx.cpp:277
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:457
ripple::getLedgerRange
std::variant< LedgerRange, RPC::Status > getLedgerRange(RPC::Context &context, std::optional< LedgerSpecifier > const &ledgerSpecifier)
Definition: AccountTx.cpp:205
ripple::AccountTxResult::limit
uint32_t limit
Definition: AccountTx.cpp:74
ripple::base_uint< 256 >
ripple::RPC::convert
void convert(org::xrpl::rpc::v1::TransactionResult &to, TER from)
Definition: GRPCHelpers.cpp:961
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::NetworkOPs::MetaTxsList
std::vector< txnMetaLedgerType > MetaTxsList
Definition: NetworkOPs.h:279
Json::objectValue
@ objectValue
object value (collection of name/value pairs).
Definition: json_value.h:43
ripple::RPC::GRPCContext
Definition: Context.h:70
ripple::RPC::Context::app
Application & app
Definition: Context.h:42
ripple::NetworkOPs::getTxsAccount
virtual AccountTxs getTxsAccount(AccountID const &account, std::int32_t minLedger, std::int32_t maxLedger, bool forward, std::optional< AccountTxMarker > &marker, int limit, bool bUnlimited)=0
Json::Value::isMember
bool isMember(const char *key) const
Return true if the object has a member named key.
Definition: json_value.cpp:932
ripple::AccountTxArgs
Definition: AccountTx.cpp:56
std::uint32_t
ripple::rpcError
Json::Value rpcError(int iError, Json::Value jvResult)
Definition: RPCErr.cpp:29
ripple::NetworkOPs::AccountTxMarker
Definition: NetworkOPs.h:247
ripple::RPC::Status
Status represents the results of an operation that might fail.
Definition: Status.h:39
ripple::RPC::Context::netOps
NetworkOPs & netOps
Definition: Context.h:44
std::decay_t
ripple::isUnlimited
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
Definition: Role.cpp:94
ripple::AccountTxResult
Definition: AccountTx.cpp:70
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::AccountTxArgs::limit
uint32_t limit
Definition: AccountTx.cpp:62
ripple::populateJsonResponse
Json::Value populateJsonResponse(std::pair< AccountTxResult, RPC::Status > const &res, AccountTxArgs const &args, RPC::JsonContext const &context)
Definition: AccountTx.cpp:446
ripple::RPC::isValidated
bool isValidated(LedgerMaster &ledgerMaster, ReadView const &ledger, Application &app)
Definition: RPCHelpers.cpp:419
ripple::rpcACT_MALFORMED
@ rpcACT_MALFORMED
Definition: ErrorCodes.h:90
ripple::base_uint::parseHex
bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition: base_uint.h:384
ripple::AccountTxArgs::account
AccountID account
Definition: AccountTx.cpp:58
ripple::rpcLGR_NOT_VALIDATED
@ rpcLGR_NOT_VALIDATED
Definition: ErrorCodes.h:73
ripple::doAccountTxJson
Json::Value doAccountTxJson(RPC::JsonContext &context)
Definition: AccountTx.cpp:526
ripple::base_uint< 256 >::fromVoid
static base_uint fromVoid(void const *data)
Definition: base_uint.h:223
Json::Value::asUInt
UInt asUInt() const
Definition: json_value.cpp:545
ripple::LedgerRange::max
uint32_t max
Definition: AccountTx.cpp:50
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:80
std::optional
Json::Value::asInt
Int asInt() const
Definition: json_value.cpp:503
ripple::AccountTxArgs::forward
bool forward
Definition: AccountTx.cpp:61
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::LedgerRange
Definition: AccountTx.cpp:47
ripple::LedgerRange::min
uint32_t min
Definition: AccountTx.cpp:49
ripple::RPC::JsonContext::params
Json::Value params
Definition: Context.h:64
ripple::NetworkOPs::getTxsAccountB
virtual MetaTxsList getTxsAccountB(AccountID const &account, std::int32_t minLedger, std::int32_t maxLedger, bool forward, std::optional< AccountTxMarker > &marker, int limit, bool bUnlimited)=0
std::vector::data
T data(T... args)
ripple::RPC::Context
The context of information needed to call an RPC.
Definition: Context.h:39
ripple::rpcNOT_SYNCED
@ rpcNOT_SYNCED
Definition: ErrorCodes.h:67
Json::Value
Represents a JSON value.
Definition: json_value.h:145
ripple::AccountTxResult::transactions
std::variant< TxnsData, TxnsDataBinary > transactions
Definition: AccountTx.cpp:72
std::variant
Json::Value::asString
std::string asString() const
Returns the unquoted string value.
Definition: json_value.cpp:469