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.SetHex(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  return rpcLGR_IDXS_INVALID;
218  }
219 
220  std::uint32_t uLedgerMin = uValidatedMin;
221  std::uint32_t uLedgerMax = uValidatedMax;
222  // Does request specify a ledger or ledger range?
223  if (ledgerSpecifier)
224  {
225  auto const status = std::visit(
226  [&](auto const& ls) -> RPC::Status {
227  using T = std::decay_t<decltype(ls)>;
228  if constexpr (std::is_same_v<T, LedgerRange>)
229  {
230  if (ls.min > uValidatedMin)
231  {
232  uLedgerMin = ls.min;
233  }
234  if (ls.max < uValidatedMax)
235  {
236  uLedgerMax = ls.max;
237  }
238  if (uLedgerMax < uLedgerMin)
239  return rpcLGR_IDXS_INVALID;
240  }
241  else
242  {
244  auto const status = getLedger(ledgerView, ls, context);
245  if (!ledgerView)
246  {
247  return status;
248  }
249 
250  bool validated = RPC::isValidated(
251  context.ledgerMaster, *ledgerView, context.app);
252 
253  if (!validated || ledgerView->info().seq > uValidatedMax ||
254  ledgerView->info().seq < uValidatedMin)
255  {
256  return rpcLGR_NOT_VALIDATED;
257  }
258  uLedgerMin = uLedgerMax = ledgerView->info().seq;
259  }
260  return RPC::Status::OK;
261  },
262  *ledgerSpecifier);
263 
264  if (status)
265  return status;
266  }
267  return LedgerRange{uLedgerMin, uLedgerMax};
268 }
269 
272 {
273  AccountTxResult result;
275 
276  auto lgrRange = getLedgerRange(context, args.ledger);
277  if (auto stat = std::get_if<RPC::Status>(&lgrRange))
278  {
279  // An error occurred getting the requested ledger range
280  return {result, *stat};
281  }
282 
283  result.ledgerRange = std::get<LedgerRange>(lgrRange);
284 
285  result.marker = args.marker;
286  if (args.binary)
287  {
288  result.transactions = context.netOps.getTxsAccountB(
289  args.account,
290  result.ledgerRange.min,
291  result.ledgerRange.max,
292  args.forward,
293  result.marker,
294  args.limit,
295  isUnlimited(context.role));
296  }
297  else
298  {
299  result.transactions = context.netOps.getTxsAccount(
300  args.account,
301  result.ledgerRange.min,
302  result.ledgerRange.max,
303  args.forward,
304  result.marker,
305  args.limit,
306  isUnlimited(context.role));
307  }
308 
309  result.limit = args.limit;
310 
311  return {result, rpcSUCCESS};
312 }
313 
314 std::pair<
315  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
316  grpc::Status>
319  AccountTxArgs const& args,
321  org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest> const& context)
322 {
323  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
324  grpc::Status status = grpc::Status::OK;
325 
326  RPC::Status const& error = res.second;
327  if (error.toErrorCode() != rpcSUCCESS)
328  {
329  if (error.toErrorCode() == rpcLGR_NOT_FOUND)
330  {
331  status = {grpc::StatusCode::NOT_FOUND, error.message()};
332  }
333  else
334  {
335  status = {grpc::StatusCode::INVALID_ARGUMENT, error.message()};
336  }
337  }
338  else
339  {
340  AccountTxResult const& result = res.first;
341 
342  // account_tx always returns validated data
343  response.set_validated(true);
344  response.set_limit(result.limit);
345  response.mutable_account()->set_address(
346  context.params.account().address());
347  response.set_ledger_index_min(result.ledgerRange.min);
348  response.set_ledger_index_max(result.ledgerRange.max);
349 
350  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
351  {
352  assert(!args.binary);
353  for (auto const& [txn, txnMeta] : *txnsData)
354  {
355  if (txn)
356  {
357  auto txnProto = response.add_transactions();
358 
359  RPC::convert(
360  *txnProto->mutable_transaction(),
361  txn->getSTransaction());
362 
363  // account_tx always returns validated data
364  txnProto->set_validated(true);
365  txnProto->set_ledger_index(txn->getLedger());
366  auto& hash = txn->getID();
367  txnProto->set_hash(hash.data(), hash.size());
368  auto closeTime =
369  context.app.getLedgerMaster().getCloseTimeBySeq(
370  txn->getLedger());
371  if (closeTime)
372  txnProto->mutable_date()->set_value(
373  closeTime->time_since_epoch().count());
374  if (txnMeta)
375  {
376  RPC::convert(*txnProto->mutable_meta(), txnMeta);
377  if (!txnProto->meta().has_delivered_amount())
378  {
379  if (auto amt = getDeliveredAmount(
380  context,
381  txn->getSTransaction(),
382  *txnMeta,
383  txn->getLedger()))
384  {
385  RPC::convert(
386  *txnProto->mutable_meta()
387  ->mutable_delivered_amount(),
388  *amt);
389  }
390  }
391  }
392  }
393  }
394  }
395  else
396  {
397  assert(args.binary);
398 
399  for (auto const& binaryData :
400  std::get<TxnsDataBinary>(result.transactions))
401  {
402  auto txnProto = response.add_transactions();
403  Blob const& txnBlob = std::get<0>(binaryData);
404  txnProto->set_transaction_binary(
405  txnBlob.data(), txnBlob.size());
406 
407  Blob const& metaBlob = std::get<1>(binaryData);
408  txnProto->set_meta_binary(metaBlob.data(), metaBlob.size());
409 
410  txnProto->set_ledger_index(std::get<2>(binaryData));
411 
412  // account_tx always returns validated data
413  txnProto->set_validated(true);
414 
415  auto closeTime =
416  context.app.getLedgerMaster().getCloseTimeBySeq(
417  std::get<2>(binaryData));
418  if (closeTime)
419  txnProto->mutable_date()->set_value(
420  closeTime->time_since_epoch().count());
421  }
422  }
423 
424  if (result.marker)
425  {
426  response.mutable_marker()->set_ledger_index(
427  result.marker->ledgerSeq);
428  response.mutable_marker()->set_account_sequence(
429  result.marker->txnSeq);
430  }
431  }
432  return {response, status};
433 }
434 
438  AccountTxArgs const& args,
439  RPC::JsonContext const& context)
440 {
441  Json::Value response;
442  RPC::Status const& error = res.second;
443  if (error.toErrorCode() != rpcSUCCESS)
444  {
445  error.inject(response);
446  }
447  else
448  {
449  AccountTxResult const& result = res.first;
450  response[jss::validated] = true;
451  response[jss::limit] = result.limit;
452  response[jss::account] = context.params[jss::account].asString();
453  response[jss::ledger_index_min] = result.ledgerRange.min;
454  response[jss::ledger_index_max] = result.ledgerRange.max;
455 
456  Json::Value& jvTxns = (response[jss::transactions] = Json::arrayValue);
457 
458  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
459  {
460  assert(!args.binary);
461  for (auto const& [txn, txnMeta] : *txnsData)
462  {
463  if (txn)
464  {
465  Json::Value& jvObj = jvTxns.append(Json::objectValue);
466 
467  jvObj[jss::tx] = txn->getJson(JsonOptions::include_date);
468  if (txnMeta)
469  {
470  jvObj[jss::meta] =
471  txnMeta->getJson(JsonOptions::include_date);
472  jvObj[jss::validated] = true;
473  insertDeliveredAmount(
474  jvObj[jss::meta], context, txn, *txnMeta);
475  }
476  }
477  }
478  }
479  else
480  {
481  assert(args.binary);
482 
483  for (auto const& binaryData :
484  std::get<TxnsDataBinary>(result.transactions))
485  {
486  Json::Value& jvObj = jvTxns.append(Json::objectValue);
487 
488  jvObj[jss::tx_blob] = strHex(std::get<0>(binaryData));
489  jvObj[jss::meta] = strHex(std::get<1>(binaryData));
490  jvObj[jss::ledger_index] = std::get<2>(binaryData);
491  jvObj[jss::validated] = true;
492  }
493  }
494 
495  if (result.marker)
496  {
497  response[jss::marker] = Json::objectValue;
498  response[jss::marker][jss::ledger] = result.marker->ledgerSeq;
499  response[jss::marker][jss::seq] = result.marker->txnSeq;
500  }
501  }
502  return response;
503 }
504 
505 // {
506 // account: account,
507 // ledger_index_min: ledger_index // optional, defaults to earliest
508 // ledger_index_max: ledger_index, // optional, defaults to latest
509 // binary: boolean, // optional, defaults to false
510 // forward: boolean, // optional, defaults to false
511 // limit: integer, // optional
512 // marker: object {ledger: ledger_index, seq: txn_sequence} // optional,
513 // resume previous query
514 // }
517 {
518  auto& params = context.params;
519  AccountTxArgs args;
520  Json::Value response;
521 
522  args.limit = params.isMember(jss::limit) ? params[jss::limit].asUInt() : 0;
523  args.binary = params.isMember(jss::binary) && params[jss::binary].asBool();
524  args.forward =
525  params.isMember(jss::forward) && params[jss::forward].asBool();
526 
527  if (!params.isMember(jss::account))
528  return rpcError(rpcINVALID_PARAMS);
529 
530  auto const account =
531  parseBase58<AccountID>(params[jss::account].asString());
532  if (!account)
533  return rpcError(rpcACT_MALFORMED);
534 
535  args.account = *account;
536 
537  auto parseRes = parseLedgerArgs(params);
538  if (auto jv = std::get_if<Json::Value>(&parseRes))
539  {
540  return *jv;
541  }
542  else
543  {
544  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
545  }
546 
547  if (params.isMember(jss::marker))
548  {
549  auto& token = params[jss::marker];
550  if (!token.isMember(jss::ledger) || !token.isMember(jss::seq) ||
551  !token[jss::ledger].isConvertibleTo(Json::ValueType::uintValue) ||
552  !token[jss::seq].isConvertibleTo(Json::ValueType::uintValue))
553  {
554  RPC::Status status{
556  "invalid marker. Provide ledger index via ledger field, and "
557  "transaction sequence number via seq field"};
558  status.inject(response);
559  return response;
560  }
561  args.marker = {token[jss::ledger].asUInt(), token[jss::seq].asUInt()};
562  }
563 
564  auto res = doAccountTxHelp(context, args);
565  return populateJsonResponse(res, args, context);
566 }
567 
568 std::pair<
569  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
570  grpc::Status>
573  context)
574 {
575  // return values
576  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
577  grpc::Status status = grpc::Status::OK;
578  AccountTxArgs args;
579 
580  auto& request = context.params;
581 
582  auto const account = parseBase58<AccountID>(request.account().address());
583  if (!account)
584  {
585  return {
586  {},
587  {grpc::StatusCode::INVALID_ARGUMENT, "Could not decode account"}};
588  }
589 
590  args.account = *account;
591  args.limit = request.limit();
592  args.binary = request.binary();
593  args.forward = request.forward();
594 
595  if (request.has_marker())
596  {
597  args.marker = {
598  request.marker().ledger_index(),
599  request.marker().account_sequence()};
600  }
601 
602  auto parseRes = parseLedgerArgs(request);
603  if (auto stat = std::get_if<grpc::Status>(&parseRes))
604  {
605  return {response, *stat};
606  }
607  else
608  {
609  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
610  }
611 
612  auto res = doAccountTxHelp(context, args);
613  return populateProtoResponse(res, args, context);
614 }
615 
616 } // 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:609
ripple::RPC::Status::OK
static constexpr Code OK
Definition: Status.h:46
ripple::JsonOptions::include_date
@ include_date
ripple::RPC::JsonContext
Definition: Context.h:52
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:317
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:571
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:88
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:462
ripple::doAccountTxHelp
std::pair< AccountTxResult, RPC::Status > doAccountTxHelp(RPC::Context &context, AccountTxArgs const &args)
Definition: AccountTx.cpp:271
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:493
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:897
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::base_uint::SetHex
bool SetHex(const char *psz, bool bStrict=false)
Parse a hex string into a base_uint The input can be:
Definition: base_uint.h:406
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:436
ripple::RPC::isValidated
bool isValidated(LedgerMaster &ledgerMaster, ReadView const &ledger, Application &app)
Definition: RPCHelpers.cpp:414
ripple::rpcACT_MALFORMED
@ rpcACT_MALFORMED
Definition: ErrorCodes.h:90
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:516
ripple::base_uint< 256 >::fromVoid
static base_uint fromVoid(void const *data)
Definition: base_uint.h:213
Json::Value::asUInt
UInt asUInt() const
Definition: json_value.cpp:545
ripple::LedgerRange::max
uint32_t max
Definition: AccountTx.cpp: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:67
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:63
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
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