From bbdaddc33eb0f97c35ded4b2435a8918befd1c49 Mon Sep 17 00:00:00 2001 From: bthomee Date: Thu, 20 Nov 2025 03:40:19 -0800 Subject: [PATCH] deploy: a3d4be4eafce09c8a26fa81489fd59d4fd4a4b97 --- Env_8cpp_source.html | 2 +- Main_8cpp_source.html | 2 +- RPCCall_8cpp_source.html | 2875 +++---- RPCCall_8h_source.html | 8 +- RPCCall__test_8cpp_source.html | 8833 +++++++++++---------- RPCSub_8cpp_source.html | 2 +- classripple_1_1RPCParser.html | 78 +- classripple_1_1test_1_1RPCCall__test.html | 6 +- namespaceripple.html | 6 +- namespaceripple_1_1RPCCall.html | 4 +- namespaceripple_1_1test.html | 4 +- structripple_1_1RPCCallImp.html | 8 +- utility_8cpp_source.html | 2 +- 13 files changed, 5925 insertions(+), 5905 deletions(-) diff --git a/Env_8cpp_source.html b/Env_8cpp_source.html index b79a25e941..d75227572c 100644 --- a/Env_8cpp_source.html +++ b/Env_8cpp_source.html @@ -941,7 +941,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
std::string transHuman(TER code)
Definition TER.cpp:254
std::shared_ptr< STTx const > sterilize(STTx const &stx)
Sterilize a transaction.
Definition STTx.cpp:842
-
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, unsigned int apiVersion, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition RPCCall.cpp:1473
+
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, unsigned int apiVersion, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition RPCCall.cpp:1489
bool isXRP(AccountID const &c)
Definition AccountID.h:71
@ telENV_RPC_FAILED
Definition TER.h:49
@ rpcSUCCESS
Definition ErrorCodes.h:25
diff --git a/Main_8cpp_source.html b/Main_8cpp_source.html index 1ad3cb6d90..17e4c2c5da 100644 --- a/Main_8cpp_source.html +++ b/Main_8cpp_source.html @@ -988,7 +988,7 @@ $(document).ready(function() { init_codefold(0); });
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
std::string const & getVersionString()
Server version.
Definition BuildInfo.cpp:49
-
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1626
+
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1642
std::atomic< bool > envUseIPv4
Definition envconfig.cpp:9
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
diff --git a/RPCCall_8cpp_source.html b/RPCCall_8cpp_source.html index 9dd484dd0e..cb8b21648b 100644 --- a/RPCCall_8cpp_source.html +++ b/RPCCall_8cpp_source.html @@ -435,1479 +435,1495 @@ $(document).ready(function() { init_codefold(0); });
332
333 if (jvParams.size() >= 5)
334 {
-
335 int iLimit = jvParams[5u].asInt();
-
336
-
337 if (iLimit > 0)
-
338 jvRequest[jss::limit] = iLimit;
-
339 }
-
340
-
341 if (jvParams.size() >= 6 && jvParams[5u].asInt())
-
342 {
-
343 jvRequest[jss::proof] = true;
-
344 }
-
345
-
346 if (jvParams.size() == 7)
-
347 jvRequest[jss::marker] = jvParams[6u];
-
348
-
349 return jvRequest;
-
350 }
+
335 try
+
336 {
+
337 int iLimit = jvParams[4u].asInt();
+
338
+
339 if (iLimit > 0)
+
340 jvRequest[jss::limit] = iLimit;
+
341 }
+
342 catch (std::exception const&)
+
343 {
+
344 return RPC::invalid_field_error(jss::limit);
+
345 }
+
346 }
+
347
+
348 if (jvParams.size() >= 6)
+
349 {
+
350 try
+
351 {
+
352 int bProof = jvParams[5u].asInt();
+
353 if (bProof)
+
354 jvRequest[jss::proof] = true;
+
355 }
+
356 catch (std::exception const&)
+
357 {
+
358 return RPC::invalid_field_error(jss::proof);
+
359 }
+
360 }
+
361
+
362 if (jvParams.size() == 7)
+
363 jvRequest[jss::marker] = jvParams[6u];
+
364
+
365 return jvRequest;
+
366 }
-
351
-
352 // can_delete [<ledgerid>|<ledgerhash>|now|always|never]
-
353 Json::Value
-
- -
355 {
- -
357
-
358 if (!jvParams.size())
-
359 return jvRequest;
-
360
-
361 std::string input = jvParams[0u].asString();
-
362 if (input.find_first_not_of("0123456789") == std::string::npos)
-
363 jvRequest["can_delete"] = jvParams[0u].asUInt();
-
364 else
-
365 jvRequest["can_delete"] = input;
-
366
-
367 return jvRequest;
-
368 }
-
-
369
-
370 // connect <ip[:port]> [port]
-
371 Json::Value
-
-
372 parseConnect(Json::Value const& jvParams)
-
373 {
- -
375 std::string ip = jvParams[0u].asString();
-
376 if (jvParams.size() == 2)
-
377 {
-
378 jvRequest[jss::ip] = ip;
-
379 jvRequest[jss::port] = jvParams[1u].asUInt();
-
380 return jvRequest;
-
381 }
+
367
+
368 // can_delete [<ledgerid>|<ledgerhash>|now|always|never]
+ +
+ +
371 {
+ +
373
+
374 if (!jvParams.size())
+
375 return jvRequest;
+
376
+
377 std::string input = jvParams[0u].asString();
+
378 if (input.find_first_not_of("0123456789") == std::string::npos)
+
379 jvRequest["can_delete"] = jvParams[0u].asUInt();
+
380 else
+
381 jvRequest["can_delete"] = input;
382
-
383 // handle case where there is one argument of the form ip:port
-
384 if (std::count(ip.begin(), ip.end(), ':') == 1)
-
385 {
-
386 std::size_t colon = ip.find_last_of(":");
-
387 jvRequest[jss::ip] = std::string{ip, 0, colon};
-
388 jvRequest[jss::port] =
-
389 Json::Value{std::string{ip, colon + 1}}.asUInt();
-
390 return jvRequest;
-
391 }
-
392
-
393 // default case, no port
-
394 jvRequest[jss::ip] = ip;
-
395 return jvRequest;
-
396 }
+
383 return jvRequest;
+
384 }
-
397
-
398 // deposit_authorized <source_account> <destination_account>
-
399 // [<ledger> [<credentials>, ...]]
- -
- -
402 {
- -
404 jvRequest[jss::source_account] = jvParams[0u].asString();
-
405 jvRequest[jss::destination_account] = jvParams[1u].asString();
-
406
-
407 if (jvParams.size() >= 3)
-
408 jvParseLedger(jvRequest, jvParams[2u].asString());
-
409
-
410 // 8 credentials max
-
411 if ((jvParams.size() >= 4) && (jvParams.size() <= 11))
-
412 {
-
413 jvRequest[jss::credentials] = Json::Value(Json::arrayValue);
-
414 for (uint32_t i = 3; i < jvParams.size(); ++i)
-
415 jvRequest[jss::credentials].append(jvParams[i].asString());
-
416 }
-
417
-
418 return jvRequest;
-
419 }
+
385
+
386 // connect <ip[:port]> [port]
+ +
+
388 parseConnect(Json::Value const& jvParams)
+
389 {
+ +
391 std::string ip = jvParams[0u].asString();
+
392 if (jvParams.size() == 2)
+
393 {
+
394 jvRequest[jss::ip] = ip;
+
395 jvRequest[jss::port] = jvParams[1u].asUInt();
+
396 return jvRequest;
+
397 }
+
398
+
399 // handle case where there is one argument of the form ip:port
+
400 if (std::count(ip.begin(), ip.end(), ':') == 1)
+
401 {
+
402 std::size_t colon = ip.find_last_of(":");
+
403 jvRequest[jss::ip] = std::string{ip, 0, colon};
+
404 jvRequest[jss::port] =
+
405 Json::Value{std::string{ip, colon + 1}}.asUInt();
+
406 return jvRequest;
+
407 }
+
408
+
409 // default case, no port
+
410 jvRequest[jss::ip] = ip;
+
411 return jvRequest;
+
412 }
-
420
-
421 // Return an error for attemping to subscribe/unsubscribe via RPC.
- -
-
423 parseEvented(Json::Value const& jvParams)
-
424 {
-
425 return rpcError(rpcNO_EVENTS);
-
426 }
-
-
427
-
428 // feature [<feature>] [accept|reject]
- -
-
430 parseFeature(Json::Value const& jvParams)
-
431 {
- +
413
+
414 // deposit_authorized <source_account> <destination_account>
+
415 // [<ledger> [<credentials>, ...]]
+ +
+ +
418 {
+ +
420 jvRequest[jss::source_account] = jvParams[0u].asString();
+
421 jvRequest[jss::destination_account] = jvParams[1u].asString();
+
422
+
423 if (jvParams.size() >= 3)
+
424 jvParseLedger(jvRequest, jvParams[2u].asString());
+
425
+
426 // 8 credentials max
+
427 if ((jvParams.size() >= 4) && (jvParams.size() <= 11))
+
428 {
+
429 jvRequest[jss::credentials] = Json::Value(Json::arrayValue);
+
430 for (uint32_t i = 3; i < jvParams.size(); ++i)
+
431 jvRequest[jss::credentials].append(jvParams[i].asString());
+
432 }
433
-
434 if (jvParams.size() > 0)
-
435 jvRequest[jss::feature] = jvParams[0u].asString();
+
434 return jvRequest;
+
435 }
+
436
-
437 if (jvParams.size() > 1)
-
438 {
-
439 auto const action = jvParams[1u].asString();
-
440
-
441 // This may look reversed, but it's intentional: jss::vetoed
-
442 // determines whether an amendment is vetoed - so "reject" means
-
443 // that jss::vetoed is true.
-
444 if (boost::iequals(action, "reject"))
-
445 jvRequest[jss::vetoed] = Json::Value(true);
-
446 else if (boost::iequals(action, "accept"))
-
447 jvRequest[jss::vetoed] = Json::Value(false);
-
448 else
- -
450 }
-
451
-
452 return jvRequest;
-
453 }
+
437 // Return an error for attemping to subscribe/unsubscribe via RPC.
+ +
+
439 parseEvented(Json::Value const& jvParams)
+
440 {
+
441 return rpcError(rpcNO_EVENTS);
+
442 }
-
454
-
455 // get_counts [<min_count>]
- -
- -
458 {
- -
460
-
461 if (jvParams.size())
-
462 jvRequest[jss::min_count] = jvParams[0u].asUInt();
-
463
-
464 return jvRequest;
-
465 }
+
443
+
444 // feature [<feature>] [accept|reject]
+ +
+
446 parseFeature(Json::Value const& jvParams)
+
447 {
+ +
449
+
450 if (jvParams.size() > 0)
+
451 jvRequest[jss::feature] = jvParams[0u].asString();
+
452
+
453 if (jvParams.size() > 1)
+
454 {
+
455 auto const action = jvParams[1u].asString();
+
456
+
457 // This may look reversed, but it's intentional: jss::vetoed
+
458 // determines whether an amendment is vetoed - so "reject" means
+
459 // that jss::vetoed is true.
+
460 if (boost::iequals(action, "reject"))
+
461 jvRequest[jss::vetoed] = Json::Value(true);
+
462 else if (boost::iequals(action, "accept"))
+
463 jvRequest[jss::vetoed] = Json::Value(false);
+
464 else
+ +
466 }
+
467
+
468 return jvRequest;
+
469 }
-
466
-
467 // sign_for <account> <secret> <json> offline
-
468 // sign_for <account> <secret> <json>
- -
-
470 parseSignFor(Json::Value const& jvParams)
-
471 {
-
472 bool const bOffline =
-
473 4 == jvParams.size() && jvParams[3u].asString() == "offline";
-
474
-
475 if (3 == jvParams.size() || bOffline)
-
476 {
-
477 Json::Value txJSON;
-
478 Json::Reader reader;
-
479 if (reader.parse(jvParams[2u].asString(), txJSON))
-
480 {
-
481 // sign_for txJSON.
- -
483
-
484 jvRequest[jss::account] = jvParams[0u].asString();
-
485 jvRequest[jss::secret] = jvParams[1u].asString();
-
486 jvRequest[jss::tx_json] = txJSON;
-
487
-
488 if (bOffline)
-
489 jvRequest[jss::offline] = true;
+
470
+
471 // get_counts [<min_count>]
+ +
+ +
474 {
+ +
476
+
477 if (jvParams.size())
+
478 jvRequest[jss::min_count] = jvParams[0u].asUInt();
+
479
+
480 return jvRequest;
+
481 }
+
+
482
+
483 // sign_for <account> <secret> <json> offline
+
484 // sign_for <account> <secret> <json>
+ +
+
486 parseSignFor(Json::Value const& jvParams)
+
487 {
+
488 bool const bOffline =
+
489 4 == jvParams.size() && jvParams[3u].asString() == "offline";
490
-
491 return jvRequest;
-
492 }
-
493 }
- -
495 }
-
-
496
-
497 // json <command> <json>
- -
-
499 parseJson(Json::Value const& jvParams)
-
500 {
-
501 Json::Reader reader;
-
502 Json::Value jvRequest;
+
491 if (3 == jvParams.size() || bOffline)
+
492 {
+
493 Json::Value txJSON;
+
494 Json::Reader reader;
+
495 if (reader.parse(jvParams[2u].asString(), txJSON))
+
496 {
+
497 // sign_for txJSON.
+ +
499
+
500 jvRequest[jss::account] = jvParams[0u].asString();
+
501 jvRequest[jss::secret] = jvParams[1u].asString();
+
502 jvRequest[jss::tx_json] = txJSON;
503
-
504 JLOG(j_.trace()) << "RPC method: " << jvParams[0u];
-
505 JLOG(j_.trace()) << "RPC json: " << jvParams[1u];
+
504 if (bOffline)
+
505 jvRequest[jss::offline] = true;
506
-
507 if (reader.parse(jvParams[1u].asString(), jvRequest))
-
508 {
-
509 if (!jvRequest.isObjectOrNull())
- -
511
-
512 jvRequest[jss::method] = jvParams[0u];
-
513
-
514 return jvRequest;
-
515 }
-
516
- -
518 }
+
507 return jvRequest;
+
508 }
+
509 }
+ +
511 }
+
512
+
513 // json <command> <json>
+ +
+
515 parseJson(Json::Value const& jvParams)
+
516 {
+
517 Json::Reader reader;
+
518 Json::Value jvRequest;
519
-
520 bool
-
- -
522 {
-
523 if (jv.isArray())
+
520 JLOG(j_.trace()) << "RPC method: " << jvParams[0u];
+
521 JLOG(j_.trace()) << "RPC json: " << jvParams[1u];
+
522
+
523 if (reader.parse(jvParams[1u].asString(), jvRequest))
524 {
-
525 if (jv.size() == 0)
-
526 return false;
-
527 for (auto const& j : jv)
-
528 {
-
529 if (!isValidJson2(j))
-
530 return false;
-
531 }
-
532 return true;
-
533 }
-
534 if (jv.isObject())
-
535 {
-
536 if (jv.isMember(jss::jsonrpc) && jv[jss::jsonrpc] == "2.0" &&
-
537 jv.isMember(jss::ripplerpc) && jv[jss::ripplerpc] == "2.0" &&
-
538 jv.isMember(jss::id) && jv.isMember(jss::method))
-
539 {
-
540 if (jv.isMember(jss::params) &&
-
541 !(jv[jss::params].isNull() || jv[jss::params].isArray() ||
-
542 jv[jss::params].isObject()))
-
543 return false;
-
544 return true;
-
545 }
-
546 }
-
547 return false;
-
548 }
+
525 if (!jvRequest.isObjectOrNull())
+ +
527
+
528 jvRequest[jss::method] = jvParams[0u];
+
529
+
530 return jvRequest;
+
531 }
+
532
+ +
534 }
-
549
- -
-
551 parseJson2(Json::Value const& jvParams)
-
552 {
-
553 Json::Reader reader;
-
554 Json::Value jv;
-
555 bool valid_parse = reader.parse(jvParams[0u].asString(), jv);
-
556 if (valid_parse && isValidJson2(jv))
-
557 {
-
558 if (jv.isObject())
-
559 {
- -
561 if (jv.isMember(jss::params))
-
562 {
-
563 auto const& params = jv[jss::params];
-
564 for (auto i = params.begin(); i != params.end(); ++i)
-
565 jv1[i.key().asString()] = *i;
-
566 }
-
567 jv1[jss::jsonrpc] = jv[jss::jsonrpc];
-
568 jv1[jss::ripplerpc] = jv[jss::ripplerpc];
-
569 jv1[jss::id] = jv[jss::id];
-
570 jv1[jss::method] = jv[jss::method];
-
571 return jv1;
-
572 }
-
573 // else jv.isArray()
- -
575 for (Json::UInt j = 0; j < jv.size(); ++j)
-
576 {
-
577 if (jv[j].isMember(jss::params))
+
535
+
536 bool
+
+ +
538 {
+
539 if (jv.isArray())
+
540 {
+
541 if (jv.size() == 0)
+
542 return false;
+
543 for (auto const& j : jv)
+
544 {
+
545 if (!isValidJson2(j))
+
546 return false;
+
547 }
+
548 return true;
+
549 }
+
550 if (jv.isObject())
+
551 {
+
552 if (jv.isMember(jss::jsonrpc) && jv[jss::jsonrpc] == "2.0" &&
+
553 jv.isMember(jss::ripplerpc) && jv[jss::ripplerpc] == "2.0" &&
+
554 jv.isMember(jss::id) && jv.isMember(jss::method))
+
555 {
+
556 if (jv.isMember(jss::params) &&
+
557 !(jv[jss::params].isNull() || jv[jss::params].isArray() ||
+
558 jv[jss::params].isObject()))
+
559 return false;
+
560 return true;
+
561 }
+
562 }
+
563 return false;
+
564 }
+
+
565
+ +
+
567 parseJson2(Json::Value const& jvParams)
+
568 {
+
569 Json::Reader reader;
+
570 Json::Value jv;
+
571 bool valid_parse = reader.parse(jvParams[0u].asString(), jv);
+
572 if (valid_parse && isValidJson2(jv))
+
573 {
+
574 if (jv.isObject())
+
575 {
+ +
577 if (jv.isMember(jss::params))
578 {
-
579 auto const& params = jv[j][jss::params];
+
579 auto const& params = jv[jss::params];
580 for (auto i = params.begin(); i != params.end(); ++i)
-
581 jv1[j][i.key().asString()] = *i;
+
581 jv1[i.key().asString()] = *i;
582 }
-
583 jv1[j][jss::jsonrpc] = jv[j][jss::jsonrpc];
-
584 jv1[j][jss::ripplerpc] = jv[j][jss::ripplerpc];
-
585 jv1[j][jss::id] = jv[j][jss::id];
-
586 jv1[j][jss::method] = jv[j][jss::method];
-
587 }
-
588 return jv1;
-
589 }
-
590 auto jv_error = rpcError(rpcINVALID_PARAMS);
-
591 if (jv.isMember(jss::jsonrpc))
-
592 jv_error[jss::jsonrpc] = jv[jss::jsonrpc];
-
593 if (jv.isMember(jss::ripplerpc))
-
594 jv_error[jss::ripplerpc] = jv[jss::ripplerpc];
-
595 if (jv.isMember(jss::id))
-
596 jv_error[jss::id] = jv[jss::id];
-
597 return jv_error;
-
598 }
-
-
599
-
600 // ledger [id|index|current|closed|validated] [full|tx]
- -
-
602 parseLedger(Json::Value const& jvParams)
-
603 {
- -
605
-
606 if (!jvParams.size())
-
607 {
-
608 return jvRequest;
-
609 }
-
610
-
611 jvParseLedger(jvRequest, jvParams[0u].asString());
-
612
-
613 if (2 == jvParams.size())
-
614 {
-
615 if (jvParams[1u].asString() == "full")
-
616 {
-
617 jvRequest[jss::full] = true;
-
618 }
-
619 else if (jvParams[1u].asString() == "tx")
-
620 {
-
621 jvRequest[jss::transactions] = true;
-
622 jvRequest[jss::expand] = true;
-
623 }
-
624 }
-
625
-
626 return jvRequest;
-
627 }
+
583 jv1[jss::jsonrpc] = jv[jss::jsonrpc];
+
584 jv1[jss::ripplerpc] = jv[jss::ripplerpc];
+
585 jv1[jss::id] = jv[jss::id];
+
586 jv1[jss::method] = jv[jss::method];
+
587 return jv1;
+
588 }
+
589 // else jv.isArray()
+ +
591 for (Json::UInt j = 0; j < jv.size(); ++j)
+
592 {
+
593 if (jv[j].isMember(jss::params))
+
594 {
+
595 auto const& params = jv[j][jss::params];
+
596 for (auto i = params.begin(); i != params.end(); ++i)
+
597 jv1[j][i.key().asString()] = *i;
+
598 }
+
599 jv1[j][jss::jsonrpc] = jv[j][jss::jsonrpc];
+
600 jv1[j][jss::ripplerpc] = jv[j][jss::ripplerpc];
+
601 jv1[j][jss::id] = jv[j][jss::id];
+
602 jv1[j][jss::method] = jv[j][jss::method];
+
603 }
+
604 return jv1;
+
605 }
+
606 auto jv_error = rpcError(rpcINVALID_PARAMS);
+
607 if (jv.isMember(jss::jsonrpc))
+
608 jv_error[jss::jsonrpc] = jv[jss::jsonrpc];
+
609 if (jv.isMember(jss::ripplerpc))
+
610 jv_error[jss::ripplerpc] = jv[jss::ripplerpc];
+
611 if (jv.isMember(jss::id))
+
612 jv_error[jss::id] = jv[jss::id];
+
613 return jv_error;
+
614 }
+
615
+
616 // ledger [id|index|current|closed|validated] [full|tx]
+ +
+
618 parseLedger(Json::Value const& jvParams)
+
619 {
+ +
621
+
622 if (!jvParams.size())
+
623 {
+
624 return jvRequest;
+
625 }
+
626
+
627 jvParseLedger(jvRequest, jvParams[0u].asString());
628
-
629 // ledger_header <id>|<index>
- -
-
631 parseLedgerId(Json::Value const& jvParams)
-
632 {
- -
634
-
635 std::string strLedger = jvParams[0u].asString();
-
636
-
637 if (strLedger.length() == 64)
-
638 {
-
639 jvRequest[jss::ledger_hash] = strLedger;
+
629 if (2 == jvParams.size())
+
630 {
+
631 if (jvParams[1u].asString() == "full")
+
632 {
+
633 jvRequest[jss::full] = true;
+
634 }
+
635 else if (jvParams[1u].asString() == "tx")
+
636 {
+
637 jvRequest[jss::transactions] = true;
+
638 jvRequest[jss::expand] = true;
+
639 }
640 }
-
641 else
-
642 {
-
643 jvRequest[jss::ledger_index] =
-
644 beast::lexicalCast<std::uint32_t>(strLedger);
-
645 }
-
646
-
647 return jvRequest;
-
648 }
+
641
+
642 return jvRequest;
+
643 }
-
649
-
650 // ledger_entry [id] [<index>]
- -
- -
653 {
- -
655
-
656 jvRequest[jss::index] = jvParams[0u].asString();
-
657
-
658 if (jvParams.size() == 2 &&
-
659 !jvParseLedger(jvRequest, jvParams[1u].asString()))
- -
661
-
662 return jvRequest;
-
663 }
+
644
+
645 // ledger_header <id>|<index>
+ +
+
647 parseLedgerId(Json::Value const& jvParams)
+
648 {
+ +
650
+
651 std::string strLedger = jvParams[0u].asString();
+
652
+
653 if (strLedger.length() == 64)
+
654 {
+
655 jvRequest[jss::ledger_hash] = strLedger;
+
656 }
+
657 else
+
658 {
+
659 jvRequest[jss::ledger_index] =
+
660 beast::lexicalCast<std::uint32_t>(strLedger);
+
661 }
+
662
+
663 return jvRequest;
+
664 }
-
664
-
665 // log_level: Get log levels
-
666 // log_level <severity>: Set master log level to the
-
667 // specified severity log_level <partition> <severity>: Set specified
-
668 // partition to specified severity
- -
-
670 parseLogLevel(Json::Value const& jvParams)
-
671 {
- +
665
+
666 // ledger_entry [id] [<index>]
+ +
+ +
669 {
+ +
671
+
672 jvRequest[jss::index] = jvParams[0u].asString();
673
-
674 if (jvParams.size() == 1)
-
675 {
-
676 jvRequest[jss::severity] = jvParams[0u].asString();
-
677 }
-
678 else if (jvParams.size() == 2)
-
679 {
-
680 jvRequest[jss::partition] = jvParams[0u].asString();
-
681 jvRequest[jss::severity] = jvParams[1u].asString();
-
682 }
-
683
-
684 return jvRequest;
-
685 }
+
674 if (jvParams.size() == 2 &&
+
675 !jvParseLedger(jvRequest, jvParams[1u].asString()))
+ +
677
+
678 return jvRequest;
+
679 }
-
686
-
687 // owner_info <account>
-
688 // account_info <account> [<ledger>]
-
689 // account_offers <account> [<ledger>]
- -
- -
692 {
-
693 return parseAccountRaw1(jvParams);
-
694 }
+
680
+
681 // log_level: Get log levels
+
682 // log_level <severity>: Set master log level to the
+
683 // specified severity log_level <partition> <severity>: Set specified
+
684 // partition to specified severity
+ +
+
686 parseLogLevel(Json::Value const& jvParams)
+
687 {
+ +
689
+
690 if (jvParams.size() == 1)
+
691 {
+
692 jvRequest[jss::severity] = jvParams[0u].asString();
+
693 }
+
694 else if (jvParams.size() == 2)
+
695 {
+
696 jvRequest[jss::partition] = jvParams[0u].asString();
+
697 jvRequest[jss::severity] = jvParams[1u].asString();
+
698 }
+
699
+
700 return jvRequest;
+
701 }
-
695
- -
- -
698 {
-
699 return parseAccountRaw1(jvParams);
-
700 }
+
702
+
703 // owner_info <account>
+
704 // account_info <account> [<ledger>]
+
705 // account_offers <account> [<ledger>]
+ +
+ +
708 {
+
709 return parseAccountRaw1(jvParams);
+
710 }
-
701
-
702 // account_lines <account> <account>|"" [<ledger>]
- -
- -
705 {
-
706 return parseAccountRaw2(jvParams, jss::peer);
-
707 }
+
711
+ +
+ +
714 {
+
715 return parseAccountRaw1(jvParams);
+
716 }
-
708
-
709 // account_channels <account> <account>|"" [<ledger>]
- -
- -
712 {
-
713 return parseAccountRaw2(jvParams, jss::destination_account);
-
714 }
+
717
+
718 // account_lines <account> <account>|"" [<ledger>]
+ +
+ +
721 {
+
722 return parseAccountRaw2(jvParams, jss::peer);
+
723 }
-
715
-
716 // channel_authorize: <private_key> [<key_type>] <channel_id> <drops>
- -
- -
719 {
- -
721
-
722 unsigned int index = 0;
-
723
-
724 if (jvParams.size() == 4)
-
725 {
-
726 jvRequest[jss::passphrase] = jvParams[index];
-
727 index++;
-
728
-
729 if (!keyTypeFromString(jvParams[index].asString()))
- -
731 jvRequest[jss::key_type] = jvParams[index];
-
732 index++;
-
733 }
-
734 else
-
735 {
-
736 jvRequest[jss::secret] = jvParams[index];
-
737 index++;
-
738 }
+
724
+
725 // account_channels <account> <account>|"" [<ledger>]
+ +
+ +
728 {
+
729 return parseAccountRaw2(jvParams, jss::destination_account);
+
730 }
+
+
731
+
732 // channel_authorize: <private_key> [<key_type>] <channel_id> <drops>
+ +
+ +
735 {
+ +
737
+
738 unsigned int index = 0;
739
-
740 {
-
741 // verify the channel id is a valid 256 bit number
-
742 uint256 channelId;
-
743 if (!channelId.parseHex(jvParams[index].asString()))
- -
745 jvRequest[jss::channel_id] = to_string(channelId);
-
746 index++;
-
747 }
-
748
-
749 if (!jvParams[index].isString() ||
-
750 !to_uint64(jvParams[index].asString()))
- -
752 jvRequest[jss::amount] = jvParams[index];
-
753
-
754 // If additional parameters are appended, be sure to increment index
-
755 // here
-
756
-
757 return jvRequest;
-
758 }
+
740 if (jvParams.size() == 4)
+
741 {
+
742 jvRequest[jss::passphrase] = jvParams[index];
+
743 index++;
+
744
+
745 if (!keyTypeFromString(jvParams[index].asString()))
+ +
747 jvRequest[jss::key_type] = jvParams[index];
+
748 index++;
+
749 }
+
750 else
+
751 {
+
752 jvRequest[jss::secret] = jvParams[index];
+
753 index++;
+
754 }
+
755
+
756 {
+
757 // verify the channel id is a valid 256 bit number
+
758 uint256 channelId;
+
759 if (!channelId.parseHex(jvParams[index].asString()))
+ +
761 jvRequest[jss::channel_id] = to_string(channelId);
+
762 index++;
+
763 }
+
764
+
765 if (!jvParams[index].isString() ||
+
766 !to_uint64(jvParams[index].asString()))
+ +
768 jvRequest[jss::amount] = jvParams[index];
+
769
+
770 // If additional parameters are appended, be sure to increment index
+
771 // here
+
772
+
773 return jvRequest;
+
774 }
-
759
-
760 // channel_verify <public_key> <channel_id> <drops> <signature>
- -
- -
763 {
-
764 std::string const strPk = jvParams[0u].asString();
-
765
-
766 if (!validPublicKey(strPk))
- -
768
- -
770
-
771 jvRequest[jss::public_key] = strPk;
-
772 {
-
773 // verify the channel id is a valid 256 bit number
-
774 uint256 channelId;
-
775 if (!channelId.parseHex(jvParams[1u].asString()))
- -
777 }
-
778 jvRequest[jss::channel_id] = jvParams[1u].asString();
-
779
-
780 if (!jvParams[2u].isString() || !to_uint64(jvParams[2u].asString()))
- -
782 jvRequest[jss::amount] = jvParams[2u];
-
783
-
784 jvRequest[jss::signature] = jvParams[3u].asString();
-
785
-
786 return jvRequest;
-
787 }
-
-
788
- -
-
790 parseAccountRaw2(Json::Value const& jvParams, char const* const acc2Field)
-
791 {
-
792 std::array<char const* const, 2> accFields{{jss::account, acc2Field}};
-
793 auto const nParams = jvParams.size();
- -
795 for (auto i = 0; i < nParams; ++i)
-
796 {
-
797 std::string strParam = jvParams[i].asString();
-
798
-
799 if (i == 1 && strParam.empty())
-
800 continue;
+
775
+
776 // channel_verify <public_key> <channel_id> <drops> <signature>
+ +
+ +
779 {
+
780 std::string const strPk = jvParams[0u].asString();
+
781
+
782 if (!validPublicKey(strPk))
+ +
784
+ +
786
+
787 jvRequest[jss::public_key] = strPk;
+
788 {
+
789 // verify the channel id is a valid 256 bit number
+
790 uint256 channelId;
+
791 if (!channelId.parseHex(jvParams[1u].asString()))
+ +
793 }
+
794 jvRequest[jss::channel_id] = jvParams[1u].asString();
+
795
+
796 if (!jvParams[2u].isString() || !to_uint64(jvParams[2u].asString()))
+ +
798 jvRequest[jss::amount] = jvParams[2u];
+
799
+
800 jvRequest[jss::signature] = jvParams[3u].asString();
801
-
802 // Parameters 0 and 1 are accounts
-
803 if (i < 2)
-
804 {
-
805 if (parseBase58<AccountID>(strParam))
-
806 {
-
807 jvRequest[accFields[i]] = std::move(strParam);
-
808 }
-
809 else
-
810 {
- -
812 }
-
813 }
-
814 else
-
815 {
-
816 if (jvParseLedger(jvRequest, strParam))
-
817 return jvRequest;
- -
819 }
-
820 }
-
821
-
822 return jvRequest;
-
823 }
+
802 return jvRequest;
+
803 }
-
824
-
825 // TODO: Get index from an alternate syntax: rXYZ:<index>
- -
- -
828 {
-
829 std::string strIdent = jvParams[0u].asString();
-
830 unsigned int iCursor = jvParams.size();
-
831
-
832 if (!parseBase58<AccountID>(strIdent))
- -
834
-
835 // Get info on account.
- +
804
+ +
+
806 parseAccountRaw2(Json::Value const& jvParams, char const* const acc2Field)
+
807 {
+
808 std::array<char const* const, 2> accFields{{jss::account, acc2Field}};
+
809 auto const nParams = jvParams.size();
+ +
811 for (auto i = 0; i < nParams; ++i)
+
812 {
+
813 std::string strParam = jvParams[i].asString();
+
814
+
815 if (i == 1 && strParam.empty())
+
816 continue;
+
817
+
818 // Parameters 0 and 1 are accounts
+
819 if (i < 2)
+
820 {
+
821 if (parseBase58<AccountID>(strParam))
+
822 {
+
823 jvRequest[accFields[i]] = std::move(strParam);
+
824 }
+
825 else
+
826 {
+ +
828 }
+
829 }
+
830 else
+
831 {
+
832 if (jvParseLedger(jvRequest, strParam))
+
833 return jvRequest;
+ +
835 }
+
836 }
837
-
838 jvRequest[jss::account] = strIdent;
-
839
-
840 if (iCursor == 2 && !jvParseLedger(jvRequest, jvParams[1u].asString()))
- -
842
-
843 return jvRequest;
-
844 }
+
838 return jvRequest;
+
839 }
-
845
- -
-
847 parseVault(Json::Value const& jvParams)
-
848 {
-
849 std::string strVaultID = jvParams[0u].asString();
-
850 uint256 id = beast::zero;
-
851 if (!id.parseHex(strVaultID))
- +
840
+
841 // TODO: Get index from an alternate syntax: rXYZ:<index>
+ +
+ +
844 {
+
845 std::string strIdent = jvParams[0u].asString();
+
846 unsigned int iCursor = jvParams.size();
+
847
+
848 if (!parseBase58<AccountID>(strIdent))
+ +
850
+
851 // Get info on account.
+
853
- -
855 jvRequest[jss::vault_id] = strVaultID;
-
856
-
857 if (jvParams.size() > 1)
-
858 jvParseLedger(jvRequest, jvParams[1u].asString());
-
859
-
860 return jvRequest;
-
861 }
-
-
862
-
863 // peer_reservations_add <public_key> [<name>]
- -
- -
866 {
-
867 Json::Value jvRequest;
-
868 jvRequest[jss::public_key] = jvParams[0u].asString();
-
869 if (jvParams.size() > 1)
-
870 {
-
871 jvRequest[jss::description] = jvParams[1u].asString();
-
872 }
-
873 return jvRequest;
-
874 }
+
854 jvRequest[jss::account] = strIdent;
+
855
+
856 if (iCursor == 2 && !jvParseLedger(jvRequest, jvParams[1u].asString()))
+ +
858
+
859 return jvRequest;
+
860 }
+
861
+ +
+
863 parseVault(Json::Value const& jvParams)
+
864 {
+
865 std::string strVaultID = jvParams[0u].asString();
+
866 uint256 id = beast::zero;
+
867 if (!id.parseHex(strVaultID))
+ +
869
+ +
871 jvRequest[jss::vault_id] = strVaultID;
+
872
+
873 if (jvParams.size() > 1)
+
874 jvParseLedger(jvRequest, jvParams[1u].asString());
875
-
876 // peer_reservations_del <public_key>
- -
- -
879 {
-
880 Json::Value jvRequest;
-
881 jvRequest[jss::public_key] = jvParams[0u].asString();
-
882 return jvRequest;
-
883 }
+
876 return jvRequest;
+
877 }
-
884
-
885 // ripple_path_find <json> [<ledger>]
- -
- -
888 {
-
889 Json::Reader reader;
- -
891 bool bLedger = 2 == jvParams.size();
-
892
-
893 JLOG(j_.trace()) << "RPC json: " << jvParams[0u];
-
894
-
895 if (reader.parse(jvParams[0u].asString(), jvRequest))
-
896 {
-
897 if (bLedger)
-
898 {
-
899 jvParseLedger(jvRequest, jvParams[1u].asString());
-
900 }
-
901
-
902 return jvRequest;
-
903 }
-
904
- -
906 }
+
878
+
879 // peer_reservations_add <public_key> [<name>]
+ +
+ +
882 {
+
883 Json::Value jvRequest;
+
884 jvRequest[jss::public_key] = jvParams[0u].asString();
+
885 if (jvParams.size() > 1)
+
886 {
+
887 jvRequest[jss::description] = jvParams[1u].asString();
+
888 }
+
889 return jvRequest;
+
890 }
-
907
-
908 // simulate any transaction on the network
-
909 //
-
910 // simulate <tx_blob> [binary]
-
911 // simulate <tx_json> [binary]
- -
-
913 parseSimulate(Json::Value const& jvParams)
-
914 {
-
915 Json::Value txJSON;
-
916 Json::Reader reader;
- -
918
-
919 if (reader.parse(jvParams[0u].asString(), txJSON))
-
920 {
-
921 jvRequest[jss::tx_json] = txJSON;
-
922 }
-
923 else
-
924 {
-
925 jvRequest[jss::tx_blob] = jvParams[0u].asString();
-
926 }
-
927
-
928 if (jvParams.size() == 2)
-
929 {
-
930 if (!jvParams[1u].isString() || jvParams[1u].asString() != "binary")
- -
932 jvRequest[jss::binary] = true;
-
933 }
+
891
+
892 // peer_reservations_del <public_key>
+ +
+ +
895 {
+
896 Json::Value jvRequest;
+
897 jvRequest[jss::public_key] = jvParams[0u].asString();
+
898 return jvRequest;
+
899 }
+
+
900
+
901 // ripple_path_find <json> [<ledger>]
+ +
+ +
904 {
+
905 Json::Reader reader;
+ +
907 bool bLedger = 2 == jvParams.size();
+
908
+
909 JLOG(j_.trace()) << "RPC json: " << jvParams[0u];
+
910
+
911 if (reader.parse(jvParams[0u].asString(), jvRequest))
+
912 {
+
913 if (bLedger)
+
914 {
+
915 jvParseLedger(jvRequest, jvParams[1u].asString());
+
916 }
+
917
+
918 return jvRequest;
+
919 }
+
920
+ +
922 }
+
+
923
+
924 // simulate any transaction on the network
+
925 //
+
926 // simulate <tx_blob> [binary]
+
927 // simulate <tx_json> [binary]
+ +
+
929 parseSimulate(Json::Value const& jvParams)
+
930 {
+
931 Json::Value txJSON;
+
932 Json::Reader reader;
+
934
-
935 return jvRequest;
-
936 }
+
935 if (reader.parse(jvParams[0u].asString(), txJSON))
+
936 {
+
937 jvRequest[jss::tx_json] = txJSON;
+
938 }
+
939 else
+
940 {
+
941 jvRequest[jss::tx_blob] = jvParams[0u].asString();
+
942 }
+
943
+
944 if (jvParams.size() == 2)
+
945 {
+
946 if (!jvParams[1u].isString() || jvParams[1u].asString() != "binary")
+ +
948 jvRequest[jss::binary] = true;
+
949 }
+
950
+
951 return jvRequest;
+
952 }
-
937
-
938 // sign/submit any transaction to the network
-
939 //
-
940 // sign <private_key> <json> offline
-
941 // submit <private_key> <json>
-
942 // submit <tx_blob>
- -
- -
945 {
-
946 Json::Value txJSON;
-
947 Json::Reader reader;
-
948 bool const bOffline =
-
949 jvParams.size() >= 3 && jvParams[2u].asString() == "offline";
-
950 std::optional<std::string> const field =
-
951 [&jvParams, bOffline]() -> std::optional<std::string> {
-
952 if (jvParams.size() < 3)
-
953 return std::nullopt;
-
954 if (jvParams.size() < 4 && bOffline)
-
955 return std::nullopt;
-
956 Json::UInt index = bOffline ? 3u : 2u;
-
957 return jvParams[index].asString();
-
958 }();
-
959
-
960 if (1 == jvParams.size())
-
961 {
-
962 // Submitting tx_blob
-
963
- -
965
-
966 jvRequest[jss::tx_blob] = jvParams[0u].asString();
-
967
-
968 return jvRequest;
-
969 }
-
970 else if (
-
971 (jvParams.size() >= 2 || bOffline) &&
-
972 reader.parse(jvParams[1u].asString(), txJSON))
-
973 {
-
974 // Signing or submitting tx_json.
- -
976
-
977 jvRequest[jss::secret] = jvParams[0u].asString();
-
978 jvRequest[jss::tx_json] = txJSON;
+
953
+
954 // sign/submit any transaction to the network
+
955 //
+
956 // sign <private_key> <json> offline
+
957 // submit <private_key> <json>
+
958 // submit <tx_blob>
+ +
+ +
961 {
+
962 Json::Value txJSON;
+
963 Json::Reader reader;
+
964 bool const bOffline =
+
965 jvParams.size() >= 3 && jvParams[2u].asString() == "offline";
+
966 std::optional<std::string> const field =
+
967 [&jvParams, bOffline]() -> std::optional<std::string> {
+
968 if (jvParams.size() < 3)
+
969 return std::nullopt;
+
970 if (jvParams.size() < 4 && bOffline)
+
971 return std::nullopt;
+
972 Json::UInt index = bOffline ? 3u : 2u;
+
973 return jvParams[index].asString();
+
974 }();
+
975
+
976 if (1 == jvParams.size())
+
977 {
+
978 // Submitting tx_blob
979
-
980 if (bOffline)
-
981 jvRequest[jss::offline] = true;
-
982
-
983 if (field)
-
984 jvRequest[jss::signature_target] = *field;
-
985
-
986 return jvRequest;
-
987 }
-
988
- -
990 }
+ +
981
+
982 jvRequest[jss::tx_blob] = jvParams[0u].asString();
+
983
+
984 return jvRequest;
+
985 }
+
986 else if (
+
987 (jvParams.size() >= 2 || bOffline) &&
+
988 reader.parse(jvParams[1u].asString(), txJSON))
+
989 {
+
990 // Signing or submitting tx_json.
+ +
992
+
993 jvRequest[jss::secret] = jvParams[0u].asString();
+
994 jvRequest[jss::tx_json] = txJSON;
+
995
+
996 if (bOffline)
+
997 jvRequest[jss::offline] = true;
+
998
+
999 if (field)
+
1000 jvRequest[jss::signature_target] = *field;
+
1001
+
1002 return jvRequest;
+
1003 }
+
1004
+ +
1006 }
-
991
-
992 // submit any multisigned transaction to the network
-
993 //
-
994 // submit_multisigned <json>
- -
- -
997 {
-
998 if (1 == jvParams.size())
-
999 {
-
1000 Json::Value txJSON;
-
1001 Json::Reader reader;
-
1002 if (reader.parse(jvParams[0u].asString(), txJSON))
-
1003 {
-
1004 Json::Value jvRequest{Json::objectValue};
-
1005 jvRequest[jss::tx_json] = txJSON;
-
1006 return jvRequest;
-
1007 }
-
1008 }
-
1009
- -
1011 }
-
-
1012
-
1013 // transaction_entry <tx_hash> <ledger_hash/ledger_index>
- -
- -
1016 {
-
1017 // Parameter count should have already been verified.
-
1018 XRPL_ASSERT(
-
1019 jvParams.size() == 2,
-
1020 "ripple::RPCParser::parseTransactionEntry : valid parameter count");
-
1021
-
1022 std::string const txHash = jvParams[0u].asString();
-
1023 if (txHash.length() != 64)
- +
1007
+
1008 // submit any multisigned transaction to the network
+
1009 //
+
1010 // submit_multisigned <json>
+ +
+ +
1013 {
+
1014 if (1 == jvParams.size())
+
1015 {
+
1016 Json::Value txJSON;
+
1017 Json::Reader reader;
+
1018 if (reader.parse(jvParams[0u].asString(), txJSON))
+
1019 {
+
1020 Json::Value jvRequest{Json::objectValue};
+
1021 jvRequest[jss::tx_json] = txJSON;
+
1022 return jvRequest;
+
1023 }
+
1024 }
1025
-
1026 Json::Value jvRequest{Json::objectValue};
-
1027 jvRequest[jss::tx_hash] = txHash;
+ +
1027 }
+
1028
-
1029 jvParseLedger(jvRequest, jvParams[1u].asString());
-
1030
-
1031 // jvParseLedger inserts a "ledger_index" of 0 if it doesn't
-
1032 // find a match.
-
1033 if (jvRequest.isMember(jss::ledger_index) &&
-
1034 jvRequest[jss::ledger_index] == 0)
- -
1036
-
1037 return jvRequest;
-
1038 }
+
1029 // transaction_entry <tx_hash> <ledger_hash/ledger_index>
+ +
+ +
1032 {
+
1033 // Parameter count should have already been verified.
+
1034 XRPL_ASSERT(
+
1035 jvParams.size() == 2,
+
1036 "ripple::RPCParser::parseTransactionEntry : valid parameter count");
+
1037
+
1038 std::string const txHash = jvParams[0u].asString();
+
1039 if (txHash.length() != 64)
+ +
1041
+
1042 Json::Value jvRequest{Json::objectValue};
+
1043 jvRequest[jss::tx_hash] = txHash;
+
1044
+
1045 jvParseLedger(jvRequest, jvParams[1u].asString());
+
1046
+
1047 // jvParseLedger inserts a "ledger_index" of 0 if it doesn't
+
1048 // find a match.
+
1049 if (jvRequest.isMember(jss::ledger_index) &&
+
1050 jvRequest[jss::ledger_index] == 0)
+ +
1052
+
1053 return jvRequest;
+
1054 }
-
1039
-
1040 // tx <transaction_id>
- -
-
1042 parseTx(Json::Value const& jvParams)
-
1043 {
-
1044 Json::Value jvRequest{Json::objectValue};
-
1045
-
1046 if (jvParams.size() == 2 || jvParams.size() == 4)
-
1047 {
-
1048 if (jvParams[1u].asString() == jss::binary)
-
1049 jvRequest[jss::binary] = true;
-
1050 }
-
1051
-
1052 if (jvParams.size() >= 3)
-
1053 {
-
1054 auto const offset = jvParams.size() == 3 ? 0 : 1;
1055
-
1056 jvRequest[jss::min_ledger] = jvParams[1u + offset].asString();
-
1057 jvRequest[jss::max_ledger] = jvParams[2u + offset].asString();
-
1058 }
-
1059
-
1060 if (jvParams[0u].asString().length() == 16)
-
1061 jvRequest[jss::ctid] = jvParams[0u].asString();
-
1062 else
-
1063 jvRequest[jss::transaction] = jvParams[0u].asString();
-
1064
-
1065 return jvRequest;
-
1066 }
-
+
1056 // tx <transaction_id>
+ +
+
1058 parseTx(Json::Value const& jvParams)
+
1059 {
+
1060 Json::Value jvRequest{Json::objectValue};
+
1061
+
1062 if (jvParams.size() == 2 || jvParams.size() == 4)
+
1063 {
+
1064 if (jvParams[1u].asString() == jss::binary)
+
1065 jvRequest[jss::binary] = true;
+
1066 }
1067
-
1068 // tx_history <index>
- -
- -
1071 {
-
1072 Json::Value jvRequest{Json::objectValue};
-
1073
-
1074 jvRequest[jss::start] = jvParams[0u].asUInt();
+
1068 if (jvParams.size() >= 3)
+
1069 {
+
1070 auto const offset = jvParams.size() == 3 ? 0 : 1;
+
1071
+
1072 jvRequest[jss::min_ledger] = jvParams[1u + offset].asString();
+
1073 jvRequest[jss::max_ledger] = jvParams[2u + offset].asString();
+
1074 }
1075
-
1076 return jvRequest;
-
1077 }
+
1076 if (jvParams[0u].asString().length() == 16)
+
1077 jvRequest[jss::ctid] = jvParams[0u].asString();
+
1078 else
+
1079 jvRequest[jss::transaction] = jvParams[0u].asString();
+
1080
+
1081 return jvRequest;
+
1082 }
-
1078
-
1079 // validation_create [<pass_phrase>|<seed>|<seed_key>]
-
1080 //
-
1081 // NOTE: It is poor security to specify secret information on the command
-
1082 // line. This information might be saved in the command shell history file
-
1083 // (e.g. .bash_history) and it may be leaked via the process status command
-
1084 // (i.e. ps).
+
1083
+
1084 // tx_history <index>
- +
1087 {
1088 Json::Value jvRequest{Json::objectValue};
1089
-
1090 if (jvParams.size())
-
1091 jvRequest[jss::secret] = jvParams[0u].asString();
-
1092
-
1093 return jvRequest;
-
1094 }
+
1090 jvRequest[jss::start] = jvParams[0u].asUInt();
+
1091
+
1092 return jvRequest;
+
1093 }
-
1095
-
1096 // wallet_propose [<passphrase>]
-
1097 // <passphrase> is only for testing. Master seeds should only be generated
-
1098 // randomly.
- -
- -
1101 {
-
1102 Json::Value jvRequest{Json::objectValue};
-
1103
-
1104 if (jvParams.size())
-
1105 jvRequest[jss::passphrase] = jvParams[0u].asString();
-
1106
-
1107 return jvRequest;
-
1108 }
+
1094
+
1095 // validation_create [<pass_phrase>|<seed>|<seed_key>]
+
1096 //
+
1097 // NOTE: It is poor security to specify secret information on the command
+
1098 // line. This information might be saved in the command shell history file
+
1099 // (e.g. .bash_history) and it may be leaked via the process status command
+
1100 // (i.e. ps).
+ +
+ +
1103 {
+
1104 Json::Value jvRequest{Json::objectValue};
+
1105
+
1106 if (jvParams.size())
+
1107 jvRequest[jss::secret] = jvParams[0u].asString();
+
1108
+
1109 return jvRequest;
+
1110 }
-
1109
-
1110 // parse gateway balances
-
1111 // gateway_balances [<ledger>] <issuer_account> [ <hotwallet> [ <hotwallet>
-
1112 // ]]
-
1113
- -
- -
1116 {
-
1117 unsigned int index = 0;
-
1118 unsigned int const size = jvParams.size();
+
1111
+
1112 // wallet_propose [<passphrase>]
+
1113 // <passphrase> is only for testing. Master seeds should only be generated
+
1114 // randomly.
+ +
+ +
1117 {
+
1118 Json::Value jvRequest{Json::objectValue};
1119
-
1120 Json::Value jvRequest{Json::objectValue};
-
1121
-
1122 std::string param = jvParams[index++].asString();
-
1123 if (param.empty())
-
1124 return RPC::make_param_error("Invalid first parameter");
+
1120 if (jvParams.size())
+
1121 jvRequest[jss::passphrase] = jvParams[0u].asString();
+
1122
+
1123 return jvRequest;
+
1124 }
+
1125
-
1126 if (param[0] != 'r')
-
1127 {
-
1128 if (param.size() == 64)
-
1129 jvRequest[jss::ledger_hash] = param;
-
1130 else
-
1131 jvRequest[jss::ledger_index] = param;
-
1132
-
1133 if (size <= index)
-
1134 return RPC::make_param_error("Invalid hotwallet");
+
1126 // parse gateway balances
+
1127 // gateway_balances [<ledger>] <issuer_account> [ <hotwallet> [ <hotwallet>
+
1128 // ]]
+
1129
+ +
+ +
1132 {
+
1133 unsigned int index = 0;
+
1134 unsigned int const size = jvParams.size();
1135
-
1136 param = jvParams[index++].asString();
-
1137 }
-
1138
-
1139 jvRequest[jss::account] = param;
-
1140
-
1141 if (index < size)
-
1142 {
-
1143 Json::Value& hotWallets =
-
1144 (jvRequest["hotwallet"] = Json::arrayValue);
-
1145 while (index < size)
-
1146 hotWallets.append(jvParams[index++].asString());
-
1147 }
+
1136 Json::Value jvRequest{Json::objectValue};
+
1137
+
1138 std::string param = jvParams[index++].asString();
+
1139 if (param.empty())
+
1140 return RPC::make_param_error("Invalid first parameter");
+
1141
+
1142 if (param[0] != 'r')
+
1143 {
+
1144 if (param.size() == 64)
+
1145 jvRequest[jss::ledger_hash] = param;
+
1146 else
+
1147 jvRequest[jss::ledger_index] = param;
1148
-
1149 return jvRequest;
-
1150 }
-
+
1149 if (size <= index)
+
1150 return RPC::make_param_error("Invalid hotwallet");
1151
-
1152 // server_definitions [hash]
- -
- -
1155 {
-
1156 Json::Value jvRequest{Json::objectValue};
-
1157
-
1158 if (jvParams.size() == 1)
-
1159 {
-
1160 jvRequest[jss::hash] = jvParams[0u].asString();
-
1161 }
-
1162
-
1163 return jvRequest;
-
1164 }
+
1152 param = jvParams[index++].asString();
+
1153 }
+
1154
+
1155 jvRequest[jss::account] = param;
+
1156
+
1157 if (index < size)
+
1158 {
+
1159 Json::Value& hotWallets =
+
1160 (jvRequest["hotwallet"] = Json::arrayValue);
+
1161 while (index < size)
+
1162 hotWallets.append(jvParams[index++].asString());
+
1163 }
+
1164
+
1165 return jvRequest;
+
1166 }
-
1165
-
1166 // server_info [counters]
- -
- -
1169 {
-
1170 Json::Value jvRequest(Json::objectValue);
-
1171 if (jvParams.size() == 1 && jvParams[0u].asString() == "counters")
-
1172 jvRequest[jss::counters] = true;
-
1173 return jvRequest;
-
1174 }
-
-
1175
-
1176public:
-
1177 //--------------------------------------------------------------------------
+
1167
+
1168 // server_definitions [hash]
+ +
+ +
1171 {
+
1172 Json::Value jvRequest{Json::objectValue};
+
1173
+
1174 if (jvParams.size() == 1)
+
1175 {
+
1176 jvRequest[jss::hash] = jvParams[0u].asString();
+
1177 }
1178
-
-
1179 explicit RPCParser(unsigned apiVersion, beast::Journal j)
-
1180 : apiVersion_(apiVersion), j_(j)
-
1181 {
-
1182 }
+
1179 return jvRequest;
+
1180 }
+
+
1181
+
1182 // server_info [counters]
+ +
+ +
1185 {
+
1186 Json::Value jvRequest(Json::objectValue);
+
1187 if (jvParams.size() == 1 && jvParams[0u].asString() == "counters")
+
1188 jvRequest[jss::counters] = true;
+
1189 return jvRequest;
+
1190 }
+
+
1191
+
1192public:
+
1193 //--------------------------------------------------------------------------
+
1194
+
+
1195 explicit RPCParser(unsigned apiVersion, beast::Journal j)
+
1196 : apiVersion_(apiVersion), j_(j)
+
1197 {
+
1198 }
-
1183
-
1184 //--------------------------------------------------------------------------
-
1185
-
1186 // Convert a rpc method and params to a request.
-
1187 // <-- { method: xyz, params: [... ] } or { error: ..., ... }
- -
- -
1190 std::string strMethod,
-
1191 Json::Value jvParams,
-
1192 bool allowAnyCommand)
-
1193 {
-
1194 if (auto stream = j_.trace())
-
1195 {
-
1196 stream << "Method: '" << strMethod << "'";
-
1197 stream << "Params: " << jvParams;
-
1198 }
1199
-
1200 struct Command
-
1201 {
-
1202 char const* name;
-
1203 parseFuncPtr parse;
-
1204 int minParams;
-
1205 int maxParams;
-
1206 };
-
1207
-
1208 static constexpr Command commands[] = {
-
1209 // Request-response methods
-
1210 // - Returns an error, or the request.
-
1211 // - To modify the method, provide a new method in the request.
-
1212 {"account_currencies", &RPCParser::parseAccountCurrencies, 1, 3},
-
1213 {"account_info", &RPCParser::parseAccountItems, 1, 3},
-
1214 {"account_lines", &RPCParser::parseAccountLines, 1, 5},
-
1215 {"account_channels", &RPCParser::parseAccountChannels, 1, 3},
-
1216 {"account_nfts", &RPCParser::parseAccountItems, 1, 5},
-
1217 {"account_objects", &RPCParser::parseAccountItems, 1, 5},
-
1218 {"account_offers", &RPCParser::parseAccountItems, 1, 4},
-
1219 {"account_tx", &RPCParser::parseAccountTransactions, 1, 8},
-
1220 {"amm_info", &RPCParser::parseAsIs, 1, 2},
-
1221 {"vault_info", &RPCParser::parseVault, 1, 2},
-
1222 {"book_changes", &RPCParser::parseLedgerId, 1, 1},
-
1223 {"book_offers", &RPCParser::parseBookOffers, 2, 7},
-
1224 {"can_delete", &RPCParser::parseCanDelete, 0, 1},
-
1225 {"channel_authorize", &RPCParser::parseChannelAuthorize, 3, 4},
-
1226 {"channel_verify", &RPCParser::parseChannelVerify, 4, 4},
-
1227 {"connect", &RPCParser::parseConnect, 1, 2},
-
1228 {"consensus_info", &RPCParser::parseAsIs, 0, 0},
-
1229 {"deposit_authorized", &RPCParser::parseDepositAuthorized, 2, 11},
-
1230 {"feature", &RPCParser::parseFeature, 0, 2},
-
1231 {"fetch_info", &RPCParser::parseFetchInfo, 0, 1},
-
1232 {"gateway_balances", &RPCParser::parseGatewayBalances, 1, -1},
-
1233 {"get_counts", &RPCParser::parseGetCounts, 0, 1},
-
1234 {"json", &RPCParser::parseJson, 2, 2},
-
1235 {"json2", &RPCParser::parseJson2, 1, 1},
-
1236 {"ledger", &RPCParser::parseLedger, 0, 2},
-
1237 {"ledger_accept", &RPCParser::parseAsIs, 0, 0},
-
1238 {"ledger_closed", &RPCParser::parseAsIs, 0, 0},
-
1239 {"ledger_current", &RPCParser::parseAsIs, 0, 0},
-
1240 {"ledger_entry", &RPCParser::parseLedgerEntry, 1, 2},
-
1241 {"ledger_header", &RPCParser::parseLedgerId, 1, 1},
-
1242 {"ledger_request", &RPCParser::parseLedgerId, 1, 1},
-
1243 {"log_level", &RPCParser::parseLogLevel, 0, 2},
-
1244 {"logrotate", &RPCParser::parseAsIs, 0, 0},
-
1245 {"manifest", &RPCParser::parseManifest, 1, 1},
-
1246 {"owner_info", &RPCParser::parseAccountItems, 1, 3},
-
1247 {"peers", &RPCParser::parseAsIs, 0, 0},
-
1248 {"ping", &RPCParser::parseAsIs, 0, 0},
-
1249 {"print", &RPCParser::parseAsIs, 0, 1},
-
1250 // { "profile", &RPCParser::parseProfile, 1, 9
-
1251 // },
-
1252 {"random", &RPCParser::parseAsIs, 0, 0},
-
1253 {"peer_reservations_add",
- -
1255 1,
-
1256 2},
-
1257 {"peer_reservations_del",
- -
1259 1,
-
1260 1},
-
1261 {"peer_reservations_list", &RPCParser::parseAsIs, 0, 0},
-
1262 {"ripple_path_find", &RPCParser::parseRipplePathFind, 1, 2},
-
1263 {"server_definitions", &RPCParser::parseServerDefinitions, 0, 1},
-
1264 {"server_info", &RPCParser::parseServerInfo, 0, 1},
-
1265 {"server_state", &RPCParser::parseServerInfo, 0, 1},
-
1266 {"sign", &RPCParser::parseSignSubmit, 2, 4},
-
1267 {"sign_for", &RPCParser::parseSignFor, 3, 4},
-
1268 {"stop", &RPCParser::parseAsIs, 0, 0},
-
1269 {"simulate", &RPCParser::parseSimulate, 1, 2},
-
1270 {"submit", &RPCParser::parseSignSubmit, 1, 4},
-
1271 {"submit_multisigned", &RPCParser::parseSubmitMultiSigned, 1, 1},
-
1272 {"transaction_entry", &RPCParser::parseTransactionEntry, 2, 2},
-
1273 {"tx", &RPCParser::parseTx, 1, 4},
-
1274 {"tx_history", &RPCParser::parseTxHistory, 1, 1},
-
1275 {"unl_list", &RPCParser::parseAsIs, 0, 0},
-
1276 {"validation_create", &RPCParser::parseValidationCreate, 0, 1},
-
1277 {"validator_info", &RPCParser::parseAsIs, 0, 0},
-
1278 {"version", &RPCParser::parseAsIs, 0, 0},
-
1279 {"wallet_propose", &RPCParser::parseWalletPropose, 0, 1},
-
1280 {"internal", &RPCParser::parseInternal, 1, -1},
-
1281
-
1282 // Evented methods
-
1283 {"path_find", &RPCParser::parseEvented, -1, -1},
-
1284 {"subscribe", &RPCParser::parseEvented, -1, -1},
-
1285 {"unsubscribe", &RPCParser::parseEvented, -1, -1},
-
1286 };
-
1287
-
1288 auto const count = jvParams.size();
-
1289
-
1290 for (auto const& command : commands)
-
1291 {
-
1292 if (strMethod == command.name)
-
1293 {
-
1294 if ((command.minParams >= 0 && count < command.minParams) ||
-
1295 (command.maxParams >= 0 && count > command.maxParams))
-
1296 {
-
1297 JLOG(j_.debug())
-
1298 << "Wrong number of parameters for " << command.name
-
1299 << " minimum=" << command.minParams
-
1300 << " maximum=" << command.maxParams
-
1301 << " actual=" << count;
-
1302
-
1303 return rpcError(rpcBAD_SYNTAX);
-
1304 }
+
1200 //--------------------------------------------------------------------------
+
1201
+
1202 // Convert a rpc method and params to a request.
+
1203 // <-- { method: xyz, params: [... ] } or { error: ..., ... }
+ +
+ +
1206 std::string strMethod,
+
1207 Json::Value jvParams,
+
1208 bool allowAnyCommand)
+
1209 {
+
1210 if (auto stream = j_.trace())
+
1211 {
+
1212 stream << "Method: '" << strMethod << "'";
+
1213 stream << "Params: " << jvParams;
+
1214 }
+
1215
+
1216 struct Command
+
1217 {
+
1218 char const* name;
+
1219 parseFuncPtr parse;
+
1220 int minParams;
+
1221 int maxParams;
+
1222 };
+
1223
+
1224 static constexpr Command commands[] = {
+
1225 // Request-response methods
+
1226 // - Returns an error, or the request.
+
1227 // - To modify the method, provide a new method in the request.
+
1228 {"account_currencies", &RPCParser::parseAccountCurrencies, 1, 3},
+
1229 {"account_info", &RPCParser::parseAccountItems, 1, 3},
+
1230 {"account_lines", &RPCParser::parseAccountLines, 1, 5},
+
1231 {"account_channels", &RPCParser::parseAccountChannels, 1, 3},
+
1232 {"account_nfts", &RPCParser::parseAccountItems, 1, 5},
+
1233 {"account_objects", &RPCParser::parseAccountItems, 1, 5},
+
1234 {"account_offers", &RPCParser::parseAccountItems, 1, 4},
+
1235 {"account_tx", &RPCParser::parseAccountTransactions, 1, 8},
+
1236 {"amm_info", &RPCParser::parseAsIs, 1, 2},
+
1237 {"vault_info", &RPCParser::parseVault, 1, 2},
+
1238 {"book_changes", &RPCParser::parseLedgerId, 1, 1},
+
1239 {"book_offers", &RPCParser::parseBookOffers, 2, 7},
+
1240 {"can_delete", &RPCParser::parseCanDelete, 0, 1},
+
1241 {"channel_authorize", &RPCParser::parseChannelAuthorize, 3, 4},
+
1242 {"channel_verify", &RPCParser::parseChannelVerify, 4, 4},
+
1243 {"connect", &RPCParser::parseConnect, 1, 2},
+
1244 {"consensus_info", &RPCParser::parseAsIs, 0, 0},
+
1245 {"deposit_authorized", &RPCParser::parseDepositAuthorized, 2, 11},
+
1246 {"feature", &RPCParser::parseFeature, 0, 2},
+
1247 {"fetch_info", &RPCParser::parseFetchInfo, 0, 1},
+
1248 {"gateway_balances", &RPCParser::parseGatewayBalances, 1, -1},
+
1249 {"get_counts", &RPCParser::parseGetCounts, 0, 1},
+
1250 {"json", &RPCParser::parseJson, 2, 2},
+
1251 {"json2", &RPCParser::parseJson2, 1, 1},
+
1252 {"ledger", &RPCParser::parseLedger, 0, 2},
+
1253 {"ledger_accept", &RPCParser::parseAsIs, 0, 0},
+
1254 {"ledger_closed", &RPCParser::parseAsIs, 0, 0},
+
1255 {"ledger_current", &RPCParser::parseAsIs, 0, 0},
+
1256 {"ledger_entry", &RPCParser::parseLedgerEntry, 1, 2},
+
1257 {"ledger_header", &RPCParser::parseLedgerId, 1, 1},
+
1258 {"ledger_request", &RPCParser::parseLedgerId, 1, 1},
+
1259 {"log_level", &RPCParser::parseLogLevel, 0, 2},
+
1260 {"logrotate", &RPCParser::parseAsIs, 0, 0},
+
1261 {"manifest", &RPCParser::parseManifest, 1, 1},
+
1262 {"owner_info", &RPCParser::parseAccountItems, 1, 3},
+
1263 {"peers", &RPCParser::parseAsIs, 0, 0},
+
1264 {"ping", &RPCParser::parseAsIs, 0, 0},
+
1265 {"print", &RPCParser::parseAsIs, 0, 1},
+
1266 // { "profile", &RPCParser::parseProfile, 1, 9
+
1267 // },
+
1268 {"random", &RPCParser::parseAsIs, 0, 0},
+
1269 {"peer_reservations_add",
+ +
1271 1,
+
1272 2},
+
1273 {"peer_reservations_del",
+ +
1275 1,
+
1276 1},
+
1277 {"peer_reservations_list", &RPCParser::parseAsIs, 0, 0},
+
1278 {"ripple_path_find", &RPCParser::parseRipplePathFind, 1, 2},
+
1279 {"server_definitions", &RPCParser::parseServerDefinitions, 0, 1},
+
1280 {"server_info", &RPCParser::parseServerInfo, 0, 1},
+
1281 {"server_state", &RPCParser::parseServerInfo, 0, 1},
+
1282 {"sign", &RPCParser::parseSignSubmit, 2, 4},
+
1283 {"sign_for", &RPCParser::parseSignFor, 3, 4},
+
1284 {"stop", &RPCParser::parseAsIs, 0, 0},
+
1285 {"simulate", &RPCParser::parseSimulate, 1, 2},
+
1286 {"submit", &RPCParser::parseSignSubmit, 1, 4},
+
1287 {"submit_multisigned", &RPCParser::parseSubmitMultiSigned, 1, 1},
+
1288 {"transaction_entry", &RPCParser::parseTransactionEntry, 2, 2},
+
1289 {"tx", &RPCParser::parseTx, 1, 4},
+
1290 {"tx_history", &RPCParser::parseTxHistory, 1, 1},
+
1291 {"unl_list", &RPCParser::parseAsIs, 0, 0},
+
1292 {"validation_create", &RPCParser::parseValidationCreate, 0, 1},
+
1293 {"validator_info", &RPCParser::parseAsIs, 0, 0},
+
1294 {"version", &RPCParser::parseAsIs, 0, 0},
+
1295 {"wallet_propose", &RPCParser::parseWalletPropose, 0, 1},
+
1296 {"internal", &RPCParser::parseInternal, 1, -1},
+
1297
+
1298 // Evented methods
+
1299 {"path_find", &RPCParser::parseEvented, -1, -1},
+
1300 {"subscribe", &RPCParser::parseEvented, -1, -1},
+
1301 {"unsubscribe", &RPCParser::parseEvented, -1, -1},
+
1302 };
+
1303
+
1304 auto const count = jvParams.size();
1305
-
1306 return (this->*(command.parse))(jvParams);
-
1307 }
-
1308 }
-
1309
-
1310 // The command could not be found
-
1311 if (!allowAnyCommand)
- -
1313
-
1314 return parseAsIs(jvParams);
-
1315 }
+
1306 for (auto const& command : commands)
+
1307 {
+
1308 if (strMethod == command.name)
+
1309 {
+
1310 if ((command.minParams >= 0 && count < command.minParams) ||
+
1311 (command.maxParams >= 0 && count > command.maxParams))
+
1312 {
+
1313 JLOG(j_.debug())
+
1314 << "Wrong number of parameters for " << command.name
+
1315 << " minimum=" << command.minParams
+
1316 << " maximum=" << command.maxParams
+
1317 << " actual=" << count;
+
1318
+
1319 return rpcError(rpcBAD_SYNTAX);
+
1320 }
+
1321
+
1322 return (this->*(command.parse))(jvParams);
+
1323 }
+
1324 }
+
1325
+
1326 // The command could not be found
+
1327 if (!allowAnyCommand)
+ +
1329
+
1330 return parseAsIs(jvParams);
+
1331 }
-
1316};
+
1332};
-
1317
-
1318//------------------------------------------------------------------------------
-
1319
-
1320//
-
1321// JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility,
-
1322// but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were
-
1323// unspecified (HTTP errors and contents of 'error').
-
1324//
-
1325// 1.0 spec: http://json-rpc.org/wiki/specification
-
1326// 1.2 spec: http://groups.google.com/group/json-rpc/web/json-rpc-over-http
-
1327//
-
1328
- -
- -
1331 std::string const& strMethod,
-
1332 Json::Value const& params,
-
1333 Json::Value const& id)
-
1334{
-
1335 Json::Value request;
-
1336 request[jss::method] = strMethod;
-
1337 request[jss::params] = params;
-
1338 request[jss::id] = id;
-
1339 return to_string(request) + "\n";
-
1340}
+
1333
+
1334//------------------------------------------------------------------------------
+
1335
+
1336//
+
1337// JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility,
+
1338// but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were
+
1339// unspecified (HTTP errors and contents of 'error').
+
1340//
+
1341// 1.0 spec: http://json-rpc.org/wiki/specification
+
1342// 1.2 spec: http://groups.google.com/group/json-rpc/web/json-rpc-over-http
+
1343//
+
1344
+ +
+ +
1347 std::string const& strMethod,
+
1348 Json::Value const& params,
+
1349 Json::Value const& id)
+
1350{
+
1351 Json::Value request;
+
1352 request[jss::method] = strMethod;
+
1353 request[jss::params] = params;
+
1354 request[jss::id] = id;
+
1355 return to_string(request) + "\n";
+
1356}
-
1341
-
1342namespace {
-
1343// Special local exception type thrown when request can't be parsed.
-
1344class RequestNotParseable : public std::runtime_error
-
1345{
-
1346 using std::runtime_error::runtime_error; // Inherit constructors
-
1347};
-
1348}; // namespace
-
1349
-
- -
1351{
-
1352 explicit RPCCallImp() = default;
-
1353
-
1354 // VFALCO NOTE Is this a to-do comment or a doc comment?
-
1355 // Place the async result somewhere useful.
-
1356 static void
-
-
1357 callRPCHandler(Json::Value* jvOutput, Json::Value const& jvInput)
-
1358 {
-
1359 (*jvOutput) = jvInput;
-
1360 }
+
1357
+
1358namespace {
+
1359// Special local exception type thrown when request can't be parsed.
+
1360class RequestNotParseable : public std::runtime_error
+
1361{
+
1362 using std::runtime_error::runtime_error; // Inherit constructors
+
1363};
+
1364}; // namespace
+
1365
+
+ +
1367{
+
1368 explicit RPCCallImp() = default;
+
1369
+
1370 // VFALCO NOTE Is this a to-do comment or a doc comment?
+
1371 // Place the async result somewhere useful.
+
1372 static void
+
+
1373 callRPCHandler(Json::Value* jvOutput, Json::Value const& jvInput)
+
1374 {
+
1375 (*jvOutput) = jvInput;
+
1376 }
-
1361
-
1362 static bool
-
- -
1364 std::function<void(Json::Value const& jvInput)> callbackFuncP,
-
1365 boost::system::error_code const& ecResult,
-
1366 int iStatus,
-
1367 std::string const& strData,
- -
1369 {
-
1370 if (callbackFuncP)
-
1371 {
-
1372 // Only care about the result, if we care to deliver it
-
1373 // callbackFuncP.
-
1374
-
1375 // Receive reply
-
1376 if (strData.empty())
-
1377 Throw<std::runtime_error>(
-
1378 "no response from server. Please "
-
1379 "ensure that the rippled server is running in another "
-
1380 "process.");
-
1381
-
1382 // Parse reply
-
1383 JLOG(j.debug()) << "RPC reply: " << strData << std::endl;
-
1384 if (strData.find("Unable to parse request") == 0 ||
-
1385 strData.find(jss::invalid_API_version.c_str()) == 0)
-
1386 Throw<RequestNotParseable>(strData);
-
1387 Json::Reader reader;
-
1388 Json::Value jvReply;
-
1389 if (!reader.parse(strData, jvReply))
-
1390 Throw<std::runtime_error>("couldn't parse reply from server");
-
1391
-
1392 if (!jvReply)
+
1377
+
1378 static bool
+
+ +
1380 std::function<void(Json::Value const& jvInput)> callbackFuncP,
+
1381 boost::system::error_code const& ecResult,
+
1382 int iStatus,
+
1383 std::string const& strData,
+ +
1385 {
+
1386 if (callbackFuncP)
+
1387 {
+
1388 // Only care about the result, if we care to deliver it
+
1389 // callbackFuncP.
+
1390
+
1391 // Receive reply
+
1392 if (strData.empty())
1393 Throw<std::runtime_error>(
-
1394 "expected reply to have result, error and id properties");
-
1395
- +
1394 "no response from server. Please "
+
1395 "ensure that the rippled server is running in another "
+
1396 "process.");
1397
-
1398 jvResult["result"] = jvReply;
-
1399
-
1400 (callbackFuncP)(jvResult);
-
1401 }
-
1402
-
1403 return false;
-
1404 }
-
-
1405
-
1406 // Build the request.
-
1407 static void
-
- -
1409 std::string const& strMethod,
-
1410 Json::Value const& jvParams,
- -
1412 std::string const& strPath,
-
1413 boost::asio::streambuf& sb,
-
1414 std::string const& strHost,
- -
1416 {
-
1417 JLOG(j.debug()) << "requestRPC: strPath='" << strPath << "'";
+
1398 // Parse reply
+
1399 JLOG(j.debug()) << "RPC reply: " << strData << std::endl;
+
1400 if (strData.find("Unable to parse request") == 0 ||
+
1401 strData.find(jss::invalid_API_version.c_str()) == 0)
+
1402 Throw<RequestNotParseable>(strData);
+
1403 Json::Reader reader;
+
1404 Json::Value jvReply;
+
1405 if (!reader.parse(strData, jvReply))
+
1406 Throw<std::runtime_error>("couldn't parse reply from server");
+
1407
+
1408 if (!jvReply)
+
1409 Throw<std::runtime_error>(
+
1410 "expected reply to have result, error and id properties");
+
1411
+ +
1413
+
1414 jvResult["result"] = jvReply;
+
1415
+
1416 (callbackFuncP)(jvResult);
+
1417 }
1418
-
1419 std::ostream osRequest(&sb);
-
1420 osRequest << createHTTPPost(
-
1421 strHost,
-
1422 strPath,
-
1423 JSONRPCRequest(strMethod, jvParams, Json::Value(1)),
-
1424 headers);
-
1425 }
+
1419 return false;
+
1420 }
-
1426};
+
1421
+
1422 // Build the request.
+
1423 static void
+
+ +
1425 std::string const& strMethod,
+
1426 Json::Value const& jvParams,
+ +
1428 std::string const& strPath,
+
1429 boost::asio::streambuf& sb,
+
1430 std::string const& strHost,
+ +
1432 {
+
1433 JLOG(j.debug()) << "requestRPC: strPath='" << strPath << "'";
+
1434
+
1435 std::ostream osRequest(&sb);
+
1436 osRequest << createHTTPPost(
+
1437 strHost,
+
1438 strPath,
+
1439 JSONRPCRequest(strMethod, jvParams, Json::Value(1)),
+
1440 headers);
+
1441 }
-
1427
-
1428//------------------------------------------------------------------------------
-
1429
-
1430// Used internally by rpcClient.
- -
- -
1433 std::vector<std::string> const& args,
-
1434 Json::Value& retParams,
-
1435 unsigned int apiVersion,
- -
1437{
-
1438 Json::Value jvRequest(Json::objectValue);
-
1439
-
1440 RPCParser rpParser(apiVersion, j);
-
1441 Json::Value jvRpcParams(Json::arrayValue);
-
1442
-
1443 for (int i = 1; i != args.size(); i++)
-
1444 jvRpcParams.append(args[i]);
+
1442};
+
+
1443
+
1444//------------------------------------------------------------------------------
1445
-
1446 retParams = Json::Value(Json::objectValue);
-
1447
-
1448 retParams[jss::method] = args[0];
-
1449 retParams[jss::params] = jvRpcParams;
-
1450
-
1451 jvRequest = rpParser.parseCommand(args[0], jvRpcParams, true);
-
1452
-
1453 auto insert_api_version = [apiVersion](Json::Value& jr) {
-
1454 if (jr.isObject() && !jr.isMember(jss::error) &&
-
1455 !jr.isMember(jss::api_version))
-
1456 {
-
1457 jr[jss::api_version] = apiVersion;
-
1458 }
-
1459 };
-
1460
-
1461 if (jvRequest.isObject())
-
1462 insert_api_version(jvRequest);
-
1463 else if (jvRequest.isArray())
-
1464 std::for_each(jvRequest.begin(), jvRequest.end(), insert_api_version);
-
1465
-
1466 JLOG(j.trace()) << "RPC Request: " << jvRequest << std::endl;
-
1467 return jvRequest;
-
1468}
+
1446// Used internally by rpcClient.
+ +
+ +
1449 std::vector<std::string> const& args,
+
1450 Json::Value& retParams,
+
1451 unsigned int apiVersion,
+ +
1453{
+
1454 Json::Value jvRequest(Json::objectValue);
+
1455
+
1456 RPCParser rpParser(apiVersion, j);
+
1457 Json::Value jvRpcParams(Json::arrayValue);
+
1458
+
1459 for (int i = 1; i != args.size(); i++)
+
1460 jvRpcParams.append(args[i]);
+
1461
+
1462 retParams = Json::Value(Json::objectValue);
+
1463
+
1464 retParams[jss::method] = args[0];
+
1465 retParams[jss::params] = jvRpcParams;
+
1466
+
1467 jvRequest = rpParser.parseCommand(args[0], jvRpcParams, true);
+
1468
+
1469 auto insert_api_version = [apiVersion](Json::Value& jr) {
+
1470 if (jr.isObject() && !jr.isMember(jss::error) &&
+
1471 !jr.isMember(jss::api_version))
+
1472 {
+
1473 jr[jss::api_version] = apiVersion;
+
1474 }
+
1475 };
+
1476
+
1477 if (jvRequest.isObject())
+
1478 insert_api_version(jvRequest);
+
1479 else if (jvRequest.isArray())
+
1480 std::for_each(jvRequest.begin(), jvRequest.end(), insert_api_version);
+
1481
+
1482 JLOG(j.trace()) << "RPC Request: " << jvRequest << std::endl;
+
1483 return jvRequest;
+
1484}
-
1469
-
1470//------------------------------------------------------------------------------
-
1471
- -
- -
1474 std::vector<std::string> const& args,
-
1475 Config const& config,
-
1476 Logs& logs,
-
1477 unsigned int apiVersion,
- -
1479{
-
1480 static_assert(
-
1481 rpcBAD_SYNTAX == 1 && rpcSUCCESS == 0,
-
1482 "Expect specific rpc enum values.");
-
1483 if (args.empty())
-
1484 return {rpcBAD_SYNTAX, {}}; // rpcBAD_SYNTAX = print usage
1485
-
1486 int nRet = rpcSUCCESS;
-
1487 Json::Value jvOutput;
-
1488 Json::Value jvRequest(Json::objectValue);
-
1489
-
1490 try
-
1491 {
- -
1493 jvRequest =
-
1494 rpcCmdToJson(args, jvRpc, apiVersion, logs.journal("RPCParser"));
-
1495
-
1496 if (jvRequest.isMember(jss::error))
-
1497 {
-
1498 jvOutput = jvRequest;
-
1499 jvOutput["rpc"] = jvRpc;
-
1500 }
-
1501 else
-
1502 {
- -
1504 try
-
1505 {
-
1506 setup = setup_ServerHandler(
-
1507 config,
-
1508 beast::logstream{logs.journal("HTTPClient").warn()});
-
1509 }
-
1510 catch (std::exception const&)
-
1511 {
-
1512 // ignore any exceptions, so the command
-
1513 // line client works without a config file
-
1514 }
-
1515
-
1516 if (config.rpc_ip)
-
1517 {
-
1518 setup.client.ip = config.rpc_ip->address().to_string();
-
1519 setup.client.port = config.rpc_ip->port();
-
1520 }
-
1521
-
1522 Json::Value jvParams(Json::arrayValue);
-
1523
-
1524 if (!setup.client.admin_user.empty())
-
1525 jvRequest["admin_user"] = setup.client.admin_user;
-
1526
-
1527 if (!setup.client.admin_password.empty())
-
1528 jvRequest["admin_password"] = setup.client.admin_password;
-
1529
-
1530 if (jvRequest.isObject())
-
1531 jvParams.append(jvRequest);
-
1532 else if (jvRequest.isArray())
+
1486//------------------------------------------------------------------------------
+
1487
+ +
+ +
1490 std::vector<std::string> const& args,
+
1491 Config const& config,
+
1492 Logs& logs,
+
1493 unsigned int apiVersion,
+ +
1495{
+
1496 static_assert(
+
1497 rpcBAD_SYNTAX == 1 && rpcSUCCESS == 0,
+
1498 "Expect specific rpc enum values.");
+
1499 if (args.empty())
+
1500 return {rpcBAD_SYNTAX, {}}; // rpcBAD_SYNTAX = print usage
+
1501
+
1502 int nRet = rpcSUCCESS;
+
1503 Json::Value jvOutput;
+
1504 Json::Value jvRequest(Json::objectValue);
+
1505
+
1506 try
+
1507 {
+ +
1509 jvRequest =
+
1510 rpcCmdToJson(args, jvRpc, apiVersion, logs.journal("RPCParser"));
+
1511
+
1512 if (jvRequest.isMember(jss::error))
+
1513 {
+
1514 jvOutput = jvRequest;
+
1515 jvOutput["rpc"] = jvRpc;
+
1516 }
+
1517 else
+
1518 {
+ +
1520 try
+
1521 {
+
1522 setup = setup_ServerHandler(
+
1523 config,
+
1524 beast::logstream{logs.journal("HTTPClient").warn()});
+
1525 }
+
1526 catch (std::exception const&)
+
1527 {
+
1528 // ignore any exceptions, so the command
+
1529 // line client works without a config file
+
1530 }
+
1531
+
1532 if (config.rpc_ip)
1533 {
-
1534 for (Json::UInt i = 0; i < jvRequest.size(); ++i)
-
1535 jvParams.append(jvRequest[i]);
+
1534 setup.client.ip = config.rpc_ip->address().to_string();
+
1535 setup.client.port = config.rpc_ip->port();
1536 }
1537
-
1538 {
-
1539 boost::asio::io_context isService;
- -
1541 isService,
-
1542 setup.client.ip,
-
1543 setup.client.port,
-
1544 setup.client.user,
-
1545 setup.client.password,
-
1546 "",
-
1547 jvRequest.isMember(
-
1548 jss::method) // Allow parser to rewrite method.
-
1549 ? jvRequest[jss::method].asString()
-
1550 : jvRequest.isArray() ? "batch" : args[0],
-
1551 jvParams, // Parsed, execute.
-
1552 setup.client.secure != 0, // Use SSL
-
1553 config.quiet(),
-
1554 logs,
-
1555 std::bind(
- -
1557 &jvOutput,
-
1558 std::placeholders::_1),
-
1559 headers);
-
1560 isService.run(); // This blocks until there are no more
-
1561 // outstanding async calls.
-
1562 }
-
1563 if (jvOutput.isMember("result"))
-
1564 {
-
1565 // Had a successful JSON-RPC 2.0 call.
-
1566 jvOutput = jvOutput["result"];
-
1567
-
1568 // jvOutput may report a server side error.
-
1569 // It should report "status".
-
1570 }
-
1571 else
-
1572 {
-
1573 // Transport error.
-
1574 Json::Value jvRpcError = jvOutput;
-
1575
-
1576 jvOutput = rpcError(rpcJSON_RPC);
-
1577 jvOutput["result"] = jvRpcError;
+
1538 Json::Value jvParams(Json::arrayValue);
+
1539
+
1540 if (!setup.client.admin_user.empty())
+
1541 jvRequest["admin_user"] = setup.client.admin_user;
+
1542
+
1543 if (!setup.client.admin_password.empty())
+
1544 jvRequest["admin_password"] = setup.client.admin_password;
+
1545
+
1546 if (jvRequest.isObject())
+
1547 jvParams.append(jvRequest);
+
1548 else if (jvRequest.isArray())
+
1549 {
+
1550 for (Json::UInt i = 0; i < jvRequest.size(); ++i)
+
1551 jvParams.append(jvRequest[i]);
+
1552 }
+
1553
+
1554 {
+
1555 boost::asio::io_context isService;
+ +
1557 isService,
+
1558 setup.client.ip,
+
1559 setup.client.port,
+
1560 setup.client.user,
+
1561 setup.client.password,
+
1562 "",
+
1563 jvRequest.isMember(
+
1564 jss::method) // Allow parser to rewrite method.
+
1565 ? jvRequest[jss::method].asString()
+
1566 : jvRequest.isArray() ? "batch" : args[0],
+
1567 jvParams, // Parsed, execute.
+
1568 setup.client.secure != 0, // Use SSL
+
1569 config.quiet(),
+
1570 logs,
+
1571 std::bind(
+ +
1573 &jvOutput,
+
1574 std::placeholders::_1),
+
1575 headers);
+
1576 isService.run(); // This blocks until there are no more
+
1577 // outstanding async calls.
1578 }
-
1579
-
1580 // If had an error, supply invocation in result.
-
1581 if (jvOutput.isMember(jss::error))
-
1582 {
-
1583 jvOutput["rpc"] =
-
1584 jvRpc; // How the command was seen as method + params.
-
1585 jvOutput["request_sent"] =
-
1586 jvRequest; // How the command was translated.
-
1587 }
-
1588 }
-
1589
-
1590 if (jvOutput.isMember(jss::error))
-
1591 {
-
1592 jvOutput[jss::status] = "error";
-
1593 if (jvOutput.isMember(jss::error_code))
-
1594 nRet = std::stoi(jvOutput[jss::error_code].asString());
-
1595 else if (jvOutput[jss::error].isMember(jss::error_code))
-
1596 nRet =
-
1597 std::stoi(jvOutput[jss::error][jss::error_code].asString());
-
1598 else
-
1599 nRet = rpcBAD_SYNTAX;
-
1600 }
-
1601
-
1602 // YYY We could have a command line flag for single line output for
-
1603 // scripts. YYY We would intercept output here and simplify it.
-
1604 }
-
1605 catch (RequestNotParseable& e)
-
1606 {
-
1607 jvOutput = rpcError(rpcINVALID_PARAMS);
-
1608 jvOutput["error_what"] = e.what();
-
1609 nRet = rpcINVALID_PARAMS;
-
1610 }
-
1611 catch (std::exception& e)
-
1612 {
-
1613 jvOutput = rpcError(rpcINTERNAL);
-
1614 jvOutput["error_what"] = e.what();
-
1615 nRet = rpcINTERNAL;
-
1616 }
+
1579 if (jvOutput.isMember("result"))
+
1580 {
+
1581 // Had a successful JSON-RPC 2.0 call.
+
1582 jvOutput = jvOutput["result"];
+
1583
+
1584 // jvOutput may report a server side error.
+
1585 // It should report "status".
+
1586 }
+
1587 else
+
1588 {
+
1589 // Transport error.
+
1590 Json::Value jvRpcError = jvOutput;
+
1591
+
1592 jvOutput = rpcError(rpcJSON_RPC);
+
1593 jvOutput["result"] = jvRpcError;
+
1594 }
+
1595
+
1596 // If had an error, supply invocation in result.
+
1597 if (jvOutput.isMember(jss::error))
+
1598 {
+
1599 jvOutput["rpc"] =
+
1600 jvRpc; // How the command was seen as method + params.
+
1601 jvOutput["request_sent"] =
+
1602 jvRequest; // How the command was translated.
+
1603 }
+
1604 }
+
1605
+
1606 if (jvOutput.isMember(jss::error))
+
1607 {
+
1608 jvOutput[jss::status] = "error";
+
1609 if (jvOutput.isMember(jss::error_code))
+
1610 nRet = std::stoi(jvOutput[jss::error_code].asString());
+
1611 else if (jvOutput[jss::error].isMember(jss::error_code))
+
1612 nRet =
+
1613 std::stoi(jvOutput[jss::error][jss::error_code].asString());
+
1614 else
+
1615 nRet = rpcBAD_SYNTAX;
+
1616 }
1617
-
1618 return {nRet, std::move(jvOutput)};
-
1619}
-
-
1620
-
1621//------------------------------------------------------------------------------
-
1622
-
-
1623namespace RPCCall {
-
1624
-
1625int
-
- -
1627 Config const& config,
-
1628 std::vector<std::string> const& vCmd,
-
1629 Logs& logs)
-
1630{
-
1631 auto const result =
-
1632 rpcClient(vCmd, config, logs, RPC::apiCommandLineVersion);
+
1618 // YYY We could have a command line flag for single line output for
+
1619 // scripts. YYY We would intercept output here and simplify it.
+
1620 }
+
1621 catch (RequestNotParseable& e)
+
1622 {
+
1623 jvOutput = rpcError(rpcINVALID_PARAMS);
+
1624 jvOutput["error_what"] = e.what();
+
1625 nRet = rpcINVALID_PARAMS;
+
1626 }
+
1627 catch (std::exception& e)
+
1628 {
+
1629 jvOutput = rpcError(rpcINTERNAL);
+
1630 jvOutput["error_what"] = e.what();
+
1631 nRet = rpcINTERNAL;
+
1632 }
1633
-
1634 std::cout << result.second.toStyledString();
-
1635
-
1636 return result.first;
-
1637}
+
1634 return {nRet, std::move(jvOutput)};
+
1635}
+
1636
+
1637//------------------------------------------------------------------------------
1638
-
1639//------------------------------------------------------------------------------
+
+
1639namespace RPCCall {
1640
-
1641void
+
1641int
- -
1643 boost::asio::io_context& io_context,
-
1644 std::string const& strIp,
-
1645 std::uint16_t const iPort,
-
1646 std::string const& strUsername,
-
1647 std::string const& strPassword,
-
1648 std::string const& strPath,
-
1649 std::string const& strMethod,
-
1650 Json::Value const& jvParams,
-
1651 bool const bSSL,
-
1652 bool const quiet,
-
1653 Logs& logs,
-
1654 std::function<void(Json::Value const& jvInput)> callbackFuncP,
- -
1656{
-
1657 auto j = logs.journal("HTTPClient");
-
1658
-
1659 // Connect to localhost
-
1660 if (!quiet)
-
1661 {
-
1662 JLOG(j.info()) << (bSSL ? "Securely connecting to " : "Connecting to ")
-
1663 << strIp << ":" << iPort << std::endl;
-
1664 }
-
1665
-
1666 // HTTP basic authentication
-
1667 headers["Authorization"] =
-
1668 std::string("Basic ") + base64_encode(strUsername + ":" + strPassword);
-
1669
-
1670 // Send request
-
1671
-
1672 // Number of bytes to try to receive if no
-
1673 // Content-Length header received
-
1674 constexpr auto RPC_REPLY_MAX_BYTES = megabytes(256);
-
1675
-
1676 using namespace std::chrono_literals;
-
1677 auto constexpr RPC_WEBHOOK_TIMEOUT = 30s;
-
1678
- -
1680 bSSL,
-
1681 io_context,
-
1682 strIp,
-
1683 iPort,
-
1684 std::bind(
- -
1686 strMethod,
-
1687 jvParams,
-
1688 headers,
-
1689 strPath,
-
1690 std::placeholders::_1,
-
1691 std::placeholders::_2,
-
1692 j),
-
1693 RPC_REPLY_MAX_BYTES,
-
1694 RPC_WEBHOOK_TIMEOUT,
-
1695 std::bind(
- -
1697 callbackFuncP,
-
1698 std::placeholders::_1,
-
1699 std::placeholders::_2,
-
1700 std::placeholders::_3,
-
1701 j),
-
1702 j);
-
1703}
+ +
1643 Config const& config,
+
1644 std::vector<std::string> const& vCmd,
+
1645 Logs& logs)
+
1646{
+
1647 auto const result =
+
1648 rpcClient(vCmd, config, logs, RPC::apiCommandLineVersion);
+
1649
+
1650 std::cout << result.second.toStyledString();
+
1651
+
1652 return result.first;
+
1653}
-
1704
-
1705} // namespace RPCCall
+
1654
+
1655//------------------------------------------------------------------------------
+
1656
+
1657void
+
+ +
1659 boost::asio::io_context& io_context,
+
1660 std::string const& strIp,
+
1661 std::uint16_t const iPort,
+
1662 std::string const& strUsername,
+
1663 std::string const& strPassword,
+
1664 std::string const& strPath,
+
1665 std::string const& strMethod,
+
1666 Json::Value const& jvParams,
+
1667 bool const bSSL,
+
1668 bool const quiet,
+
1669 Logs& logs,
+
1670 std::function<void(Json::Value const& jvInput)> callbackFuncP,
+ +
1672{
+
1673 auto j = logs.journal("HTTPClient");
+
1674
+
1675 // Connect to localhost
+
1676 if (!quiet)
+
1677 {
+
1678 JLOG(j.info()) << (bSSL ? "Securely connecting to " : "Connecting to ")
+
1679 << strIp << ":" << iPort << std::endl;
+
1680 }
+
1681
+
1682 // HTTP basic authentication
+
1683 headers["Authorization"] =
+
1684 std::string("Basic ") + base64_encode(strUsername + ":" + strPassword);
+
1685
+
1686 // Send request
+
1687
+
1688 // Number of bytes to try to receive if no
+
1689 // Content-Length header received
+
1690 constexpr auto RPC_REPLY_MAX_BYTES = megabytes(256);
+
1691
+
1692 using namespace std::chrono_literals;
+
1693 auto constexpr RPC_WEBHOOK_TIMEOUT = 30s;
+
1694
+ +
1696 bSSL,
+
1697 io_context,
+
1698 strIp,
+
1699 iPort,
+
1700 std::bind(
+ +
1702 strMethod,
+
1703 jvParams,
+
1704 headers,
+
1705 strPath,
+
1706 std::placeholders::_1,
+
1707 std::placeholders::_2,
+
1708 j),
+
1709 RPC_REPLY_MAX_BYTES,
+
1710 RPC_WEBHOOK_TIMEOUT,
+
1711 std::bind(
+ +
1713 callbackFuncP,
+
1714 std::placeholders::_1,
+
1715 std::placeholders::_2,
+
1716 std::placeholders::_3,
+
1717 j),
+
1718 j);
+
1719}
-
1706
-
1707} // namespace ripple
+
1720
+
1721} // namespace RPCCall
+
+
1722
+
1723} // namespace ripple
@@ -1940,57 +1956,57 @@ $(document).ready(function() { init_codefold(0); });
Manages partitions for logging.
Definition Log.h:33
beast::Journal journal(std::string const &name)
Definition Log.cpp:141
-
Json::Value parseLedger(Json::Value const &jvParams)
Definition RPCCall.cpp:602
-
Json::Value parseValidationCreate(Json::Value const &jvParams)
Definition RPCCall.cpp:1086
+
Json::Value parseLedger(Json::Value const &jvParams)
Definition RPCCall.cpp:618
+
Json::Value parseValidationCreate(Json::Value const &jvParams)
Definition RPCCall.cpp:1102
Json::Value parseBookOffers(Json::Value const &jvParams)
Definition RPCCall.cpp:297
-
Json::Value parseTxHistory(Json::Value const &jvParams)
Definition RPCCall.cpp:1070
-
Json::Value parseLedgerId(Json::Value const &jvParams)
Definition RPCCall.cpp:631
-
Json::Value parseCommand(std::string strMethod, Json::Value jvParams, bool allowAnyCommand)
Definition RPCCall.cpp:1189
-
Json::Value parseGatewayBalances(Json::Value const &jvParams)
Definition RPCCall.cpp:1115
-
RPCParser(unsigned apiVersion, beast::Journal j)
Definition RPCCall.cpp:1179
-
Json::Value parseAccountItems(Json::Value const &jvParams)
Definition RPCCall.cpp:691
+
Json::Value parseTxHistory(Json::Value const &jvParams)
Definition RPCCall.cpp:1086
+
Json::Value parseLedgerId(Json::Value const &jvParams)
Definition RPCCall.cpp:647
+
Json::Value parseCommand(std::string strMethod, Json::Value jvParams, bool allowAnyCommand)
Definition RPCCall.cpp:1205
+
Json::Value parseGatewayBalances(Json::Value const &jvParams)
Definition RPCCall.cpp:1131
+
RPCParser(unsigned apiVersion, beast::Journal j)
Definition RPCCall.cpp:1195
+
Json::Value parseAccountItems(Json::Value const &jvParams)
Definition RPCCall.cpp:707
unsigned const apiVersion_
Definition RPCCall.cpp:73
-
Json::Value parseJson(Json::Value const &jvParams)
Definition RPCCall.cpp:499
-
Json::Value parseAccountRaw1(Json::Value const &jvParams)
Definition RPCCall.cpp:827
+
Json::Value parseJson(Json::Value const &jvParams)
Definition RPCCall.cpp:515
+
Json::Value parseAccountRaw1(Json::Value const &jvParams)
Definition RPCCall.cpp:843
Json::Value parseFetchInfo(Json::Value const &jvParams)
Definition RPCCall.cpp:208
-
Json::Value parseSubmitMultiSigned(Json::Value const &jvParams)
Definition RPCCall.cpp:996
-
Json::Value parseAccountChannels(Json::Value const &jvParams)
Definition RPCCall.cpp:711
+
Json::Value parseSubmitMultiSigned(Json::Value const &jvParams)
Definition RPCCall.cpp:1012
+
Json::Value parseAccountChannels(Json::Value const &jvParams)
Definition RPCCall.cpp:727
Json::Value parseInternal(Json::Value const &jvParams)
Definition RPCCall.cpp:172
static Json::Value jvParseCurrencyIssuer(std::string const &strCurrencyIssuer)
Definition RPCCall.cpp:102
-
Json::Value parseSimulate(Json::Value const &jvParams)
Definition RPCCall.cpp:913
-
Json::Value parseEvented(Json::Value const &jvParams)
Definition RPCCall.cpp:423
-
Json::Value parseDepositAuthorized(Json::Value const &jvParams)
Definition RPCCall.cpp:401
+
Json::Value parseSimulate(Json::Value const &jvParams)
Definition RPCCall.cpp:929
+
Json::Value parseEvented(Json::Value const &jvParams)
Definition RPCCall.cpp:439
+
Json::Value parseDepositAuthorized(Json::Value const &jvParams)
Definition RPCCall.cpp:417
Json::Value parseAccountTransactions(Json::Value const &jvParams)
Definition RPCCall.cpp:222
-
Json::Value parseChannelVerify(Json::Value const &jvParams)
Definition RPCCall.cpp:762
-
Json::Value parseGetCounts(Json::Value const &jvParams)
Definition RPCCall.cpp:457
-
Json::Value parseLogLevel(Json::Value const &jvParams)
Definition RPCCall.cpp:670
-
bool isValidJson2(Json::Value const &jv)
Definition RPCCall.cpp:521
-
Json::Value parseConnect(Json::Value const &jvParams)
Definition RPCCall.cpp:372
+
Json::Value parseChannelVerify(Json::Value const &jvParams)
Definition RPCCall.cpp:778
+
Json::Value parseGetCounts(Json::Value const &jvParams)
Definition RPCCall.cpp:473
+
Json::Value parseLogLevel(Json::Value const &jvParams)
Definition RPCCall.cpp:686
+
bool isValidJson2(Json::Value const &jv)
Definition RPCCall.cpp:537
+
Json::Value parseConnect(Json::Value const &jvParams)
Definition RPCCall.cpp:388
static bool validPublicKey(std::string const &strPk, TokenType type=TokenType::AccountPublic)
Definition RPCCall.cpp:139
Json::Value(RPCParser::*)(Json::Value const &jvParams) parseFuncPtr
Definition RPCCall.cpp:158
beast::Journal const j_
Definition RPCCall.cpp:74
-
Json::Value parseCanDelete(Json::Value const &jvParams)
Definition RPCCall.cpp:354
-
Json::Value parseWalletPropose(Json::Value const &jvParams)
Definition RPCCall.cpp:1100
-
Json::Value parseJson2(Json::Value const &jvParams)
Definition RPCCall.cpp:551
-
Json::Value parseChannelAuthorize(Json::Value const &jvParams)
Definition RPCCall.cpp:718
-
Json::Value parseAccountCurrencies(Json::Value const &jvParams)
Definition RPCCall.cpp:697
-
Json::Value parsePeerReservationsDel(Json::Value const &jvParams)
Definition RPCCall.cpp:878
-
Json::Value parseVault(Json::Value const &jvParams)
Definition RPCCall.cpp:847
-
Json::Value parseLedgerEntry(Json::Value const &jvParams)
Definition RPCCall.cpp:652
-
Json::Value parseTx(Json::Value const &jvParams)
Definition RPCCall.cpp:1042
-
Json::Value parseServerInfo(Json::Value const &jvParams)
Definition RPCCall.cpp:1168
+
Json::Value parseCanDelete(Json::Value const &jvParams)
Definition RPCCall.cpp:370
+
Json::Value parseWalletPropose(Json::Value const &jvParams)
Definition RPCCall.cpp:1116
+
Json::Value parseJson2(Json::Value const &jvParams)
Definition RPCCall.cpp:567
+
Json::Value parseChannelAuthorize(Json::Value const &jvParams)
Definition RPCCall.cpp:734
+
Json::Value parseAccountCurrencies(Json::Value const &jvParams)
Definition RPCCall.cpp:713
+
Json::Value parsePeerReservationsDel(Json::Value const &jvParams)
Definition RPCCall.cpp:894
+
Json::Value parseVault(Json::Value const &jvParams)
Definition RPCCall.cpp:863
+
Json::Value parseLedgerEntry(Json::Value const &jvParams)
Definition RPCCall.cpp:668
+
Json::Value parseTx(Json::Value const &jvParams)
Definition RPCCall.cpp:1058
+
Json::Value parseServerInfo(Json::Value const &jvParams)
Definition RPCCall.cpp:1184
Json::Value parseAsIs(Json::Value const &jvParams)
Definition RPCCall.cpp:161
-
Json::Value parsePeerReservationsAdd(Json::Value const &jvParams)
Definition RPCCall.cpp:865
-
Json::Value parseRipplePathFind(Json::Value const &jvParams)
Definition RPCCall.cpp:887
-
Json::Value parseServerDefinitions(Json::Value const &jvParams)
Definition RPCCall.cpp:1154
-
Json::Value parseTransactionEntry(Json::Value const &jvParams)
Definition RPCCall.cpp:1015
-
Json::Value parseFeature(Json::Value const &jvParams)
Definition RPCCall.cpp:430
+
Json::Value parsePeerReservationsAdd(Json::Value const &jvParams)
Definition RPCCall.cpp:881
+
Json::Value parseRipplePathFind(Json::Value const &jvParams)
Definition RPCCall.cpp:903
+
Json::Value parseServerDefinitions(Json::Value const &jvParams)
Definition RPCCall.cpp:1170
+
Json::Value parseTransactionEntry(Json::Value const &jvParams)
Definition RPCCall.cpp:1031
+
Json::Value parseFeature(Json::Value const &jvParams)
Definition RPCCall.cpp:446
Json::Value parseManifest(Json::Value const &jvParams)
Definition RPCCall.cpp:188
-
Json::Value parseAccountRaw2(Json::Value const &jvParams, char const *const acc2Field)
Definition RPCCall.cpp:790
+
Json::Value parseAccountRaw2(Json::Value const &jvParams, char const *const acc2Field)
Definition RPCCall.cpp:806
static bool jvParseLedger(Json::Value &jvRequest, std::string const &strLedger)
Definition RPCCall.cpp:79
-
Json::Value parseSignSubmit(Json::Value const &jvParams)
Definition RPCCall.cpp:944
-
Json::Value parseAccountLines(Json::Value const &jvParams)
Definition RPCCall.cpp:704
-
Json::Value parseSignFor(Json::Value const &jvParams)
Definition RPCCall.cpp:470
+
Json::Value parseSignSubmit(Json::Value const &jvParams)
Definition RPCCall.cpp:960
+
Json::Value parseAccountLines(Json::Value const &jvParams)
Definition RPCCall.cpp:720
+
Json::Value parseSignFor(Json::Value const &jvParams)
Definition RPCCall.cpp:486
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition base_uint.h:484
T count(T... args)
@@ -2011,15 +2027,16 @@ $(document).ready(function() { init_codefold(0); });
@ arrayValue
array value (ordered list)
Definition json_value.h:26
@ objectValue
object value (collection of name/value pairs).
Definition json_value.h:27
unsigned int UInt
-
void fromNetwork(boost::asio::io_context &io_context, std::string const &strIp, std::uint16_t const iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, bool const bSSL, bool const quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition RPCCall.cpp:1642
-
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1626
+
void fromNetwork(boost::asio::io_context &io_context, std::string const &strIp, std::uint16_t const iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, bool const bSSL, bool const quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition RPCCall.cpp:1658
+
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1642
+
Json::Value invalid_field_error(std::string const &name)
Definition ErrorCodes.h:306
Json::Value make_param_error(std::string const &message)
Returns a new json object that indicates invalid parameters.
Definition ErrorCodes.h:252
static constexpr auto apiCommandLineVersion
Definition ApiVersion.h:45
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
std::optional< KeyType > keyTypeFromString(std::string const &s)
Definition KeyType.h:15
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition AccountID.cpp:95
constexpr auto megabytes(T value) noexcept
-
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, unsigned int apiVersion, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition RPCCall.cpp:1473
+
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, unsigned int apiVersion, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition RPCCall.cpp:1489
static std::string const & systemName()
TokenType
Definition tokens.h:19
@@ -2048,8 +2065,8 @@ $(document).ready(function() { init_codefold(0); });
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition Slice.h:225
ServerHandler::Setup setup_ServerHandler(Config const &config, std::ostream &&log)
std::string base64_encode(std::uint8_t const *data, std::size_t len)
-
std::string JSONRPCRequest(std::string const &strMethod, Json::Value const &params, Json::Value const &id)
Definition RPCCall.cpp:1330
-
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition RPCCall.cpp:1432
+
std::string JSONRPCRequest(std::string const &strMethod, Json::Value const &params, Json::Value const &id)
Definition RPCCall.cpp:1346
+
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition RPCCall.cpp:1448
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:611
@@ -2058,11 +2075,11 @@ $(document).ready(function() { init_codefold(0); });
T stoi(T... args)
T str(T... args)
- -
static void callRPCHandler(Json::Value *jvOutput, Json::Value const &jvInput)
Definition RPCCall.cpp:1357
-
static bool onResponse(std::function< void(Json::Value const &jvInput)> callbackFuncP, boost::system::error_code const &ecResult, int iStatus, std::string const &strData, beast::Journal j)
Definition RPCCall.cpp:1363
+ +
static void callRPCHandler(Json::Value *jvOutput, Json::Value const &jvInput)
Definition RPCCall.cpp:1373
+
static bool onResponse(std::function< void(Json::Value const &jvInput)> callbackFuncP, boost::system::error_code const &ecResult, int iStatus, std::string const &strData, beast::Journal j)
Definition RPCCall.cpp:1379
RPCCallImp()=default
-
static void onRequest(std::string const &strMethod, Json::Value const &jvParams, std::unordered_map< std::string, std::string > const &headers, std::string const &strPath, boost::asio::streambuf &sb, std::string const &strHost, beast::Journal j)
Definition RPCCall.cpp:1408
+
static void onRequest(std::string const &strMethod, Json::Value const &jvParams, std::unordered_map< std::string, std::string > const &headers, std::string const &strPath, boost::asio::streambuf &sb, std::string const &strHost, beast::Journal j)
Definition RPCCall.cpp:1424
diff --git a/RPCCall_8h_source.html b/RPCCall_8h_source.html index 467c481fd5..486829d5b9 100644 --- a/RPCCall_8h_source.html +++ b/RPCCall_8h_source.html @@ -154,11 +154,11 @@ $(document).ready(function() { init_codefold(0); }); -
void fromNetwork(boost::asio::io_context &io_context, std::string const &strIp, std::uint16_t const iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, bool const bSSL, bool const quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition RPCCall.cpp:1642
-
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1626
+
void fromNetwork(boost::asio::io_context &io_context, std::string const &strIp, std::uint16_t const iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, bool const bSSL, bool const quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition RPCCall.cpp:1658
+
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1642
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
-
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, unsigned int apiVersion, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition RPCCall.cpp:1473
-
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition RPCCall.cpp:1432
+
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, unsigned int apiVersion, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition RPCCall.cpp:1489
+
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition RPCCall.cpp:1448
diff --git a/RPCCall__test_8cpp_source.html b/RPCCall__test_8cpp_source.html index 1888234704..4cccb1efbe 100644 --- a/RPCCall__test_8cpp_source.html +++ b/RPCCall__test_8cpp_source.html @@ -1674,4424 +1674,4427 @@ $(document).ready(function() { init_codefold(0); });
1584 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1585 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1586 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
1587 "junk", // Note: indexing bug in parseBookOffers() requires junk
-
1588 // param.
-
1589 "200",
-
1590 },
- -
1592 R"({
-
1593 "method" : "book_offers",
-
1594 "params" : [
-
1595 {
-
1596 "api_version" : %API_VER%,
-
1597 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1598 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
1599 "limit" : 200,
-
1600 "proof" : true,
-
1601 "taker_gets" : {
-
1602 "currency" : "EUR",
-
1603 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
-
1604 },
-
1605 "taker_pays" : {
-
1606 "currency" : "USD",
-
1607 "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
-
1608 }
-
1609 }
-
1610 ]
-
1611 })"},
-
1612 {// Note: parser supports "marker", but the docs don't cover it.
-
1613 "book_offers: issuer, ledger hash, limit, and marker.",
-
1614 __LINE__,
-
1615 {"book_offers",
-
1616 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
1617 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1618 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1619 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
1620 "junk", // Note: indexing bug in parseBookOffers() requires junk param.
-
1621 "200",
-
1622 "MyMarker"},
- -
1624 R"({
-
1625 "method" : "book_offers",
-
1626 "params" : [
-
1627 {
-
1628 "api_version" : %API_VER%,
-
1629 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1630 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
1631 "limit" : 200,
-
1632 "marker" : "MyMarker",
-
1633 "proof" : true,
-
1634 "taker_gets" : {
-
1635 "currency" : "EUR",
-
1636 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
-
1637 },
-
1638 "taker_pays" : {
-
1639 "currency" : "USD",
-
1640 "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
-
1641 }
-
1642 }
-
1643 ]
-
1644 })"},
-
1645 {"book_offers: too few arguments.",
-
1646 __LINE__,
-
1647 {
-
1648 "book_offers",
-
1649 },
- -
1651 R"({
-
1652 "method" : "book_offers",
-
1653 "params" : [
-
1654 {
-
1655 "error" : "badSyntax",
-
1656 "error_code" : 1,
-
1657 "error_message" : "Syntax error."
-
1658 }
-
1659 ]
-
1660 })"},
-
1661 {"book_offers: too many arguments.",
-
1662 __LINE__,
-
1663 {"book_offers",
-
1664 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
1665 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1666 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1667 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
1668 "junk", // Note: indexing bug in parseBookOffers() requires junk param.
-
1669 "200",
-
1670 "MyMarker",
-
1671 "extra"},
- -
1673 R"({
-
1674 "method" : "book_offers",
-
1675 "params" : [
-
1676 {
-
1677 "error" : "badSyntax",
-
1678 "error_code" : 1,
-
1679 "error_message" : "Syntax error."
-
1680 }
-
1681 ]
-
1682 })"},
-
1683
-
1684 {"book_offers: taker pays no currency.",
-
1685 __LINE__,
-
1686 {
-
1687 "book_offers",
-
1688 "/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
1689 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1690 },
- -
1692 R"({
-
1693 "method" : "book_offers",
-
1694 "params" : [
-
1695 {
-
1696 "error" : "invalidParams",
-
1697 "error_code" : 31,
-
1698 "error_message" : "Invalid currency/issuer '/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'"
-
1699 }
-
1700 ]
-
1701 })"},
-
1702 {"book_offers: taker gets no currency.",
-
1703 __LINE__,
-
1704 {
-
1705 "book_offers",
-
1706 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
1707 "/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1708 },
- -
1710 R"({
-
1711 "method" : "book_offers",
-
1712 "params" : [
-
1713 {
-
1714 "error" : "invalidParams",
-
1715 "error_code" : 31,
-
1716 "error_message" : "Invalid currency/issuer '/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA'"
-
1717 }
-
1718 ]
-
1719 })"},
-
1720 {"book_offers: invalid issuer.",
-
1721 __LINE__,
-
1722 {"book_offers", "USD", "EUR", "not_a_valid_issuer"},
- -
1724 R"({
-
1725 "method" : "book_offers",
-
1726 "params" : [
-
1727 {
-
1728 "api_version" : %API_VER%,
-
1729 "issuer" : "not_a_valid_issuer",
-
1730 "taker_gets" : {
-
1731 "currency" : "EUR"
-
1732 },
-
1733 "taker_pays" : {
-
1734 "currency" : "USD"
-
1735 }
-
1736 }
-
1737 ]
-
1738 })"},
-
1739 {"book_offers: invalid text ledger index.",
-
1740 __LINE__,
-
1741 {"book_offers",
-
1742 "USD",
-
1743 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1744 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1745 "not_a_ledger"},
- -
1747 R"({
-
1748 "method" : "book_offers",
-
1749 "params" : [
-
1750 {
-
1751 "api_version" : %API_VER%,
-
1752 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1753 "ledger_index" : 0,
-
1754 "taker_gets" : {
-
1755 "currency" : "EUR",
-
1756 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
-
1757 },
-
1758 "taker_pays" : {
-
1759 "currency" : "USD"
-
1760 }
-
1761 }
-
1762 ]
-
1763 })"},
-
1764 {// Note: this really shouldn't throw, but does at the moment.
-
1765 "book_offers: non-numeric limit.",
-
1766 __LINE__,
-
1767 {
-
1768 "book_offers",
-
1769 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
1770 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1771 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
-
1772 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
1773 "junk", // Note: indexing bug in parseBookOffers() requires junk
-
1774 // param.
-
1775 "not_a_number",
-
1776 },
- -
1778 R"()"},
-
1779
-
1780 // can_delete
-
1781 // ------------------------------------------------------------------
-
1782 {"can_delete: minimal.",
-
1783 __LINE__,
-
1784 {
-
1785 "can_delete",
-
1786 },
- -
1788 R"({
-
1789 "method" : "can_delete",
-
1790 "params" : [
-
1791 {
-
1792 "api_version" : %API_VER%,
-
1793 }
-
1794 ]
-
1795 })"},
-
1796 {"can_delete: ledger index.",
-
1797 __LINE__,
-
1798 {
-
1799 "can_delete",
-
1800 "4294967295",
-
1801 },
- -
1803 R"({
-
1804 "method" : "can_delete",
-
1805 "params" : [
-
1806 {
-
1807 "api_version" : %API_VER%,
-
1808 "can_delete" : 4294967295
-
1809 }
-
1810 ]
-
1811 })"},
-
1812 {"can_delete: ledger hash.",
-
1813 __LINE__,
-
1814 {
-
1815 "can_delete",
-
1816 "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210",
-
1817 },
- -
1819 R"({
-
1820 "method" : "can_delete",
-
1821 "params" : [
-
1822 {
-
1823 "api_version" : %API_VER%,
-
1824 "can_delete" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210"
-
1825 }
-
1826 ]
-
1827 })"},
-
1828 {"can_delete: always.",
-
1829 __LINE__,
-
1830 {
-
1831 "can_delete",
-
1832 "always",
-
1833 },
- -
1835 R"({
-
1836 "method" : "can_delete",
-
1837 "params" : [
-
1838 {
-
1839 "api_version" : %API_VER%,
-
1840 "can_delete" : "always"
-
1841 }
-
1842 ]
-
1843 })"},
-
1844 {"can_delete: never.",
-
1845 __LINE__,
-
1846 {
-
1847 "can_delete",
-
1848 "never",
-
1849 },
- -
1851 R"({
-
1852 "method" : "can_delete",
-
1853 "params" : [
-
1854 {
-
1855 "api_version" : %API_VER%,
-
1856 "can_delete" : "never"
-
1857 }
-
1858 ]
-
1859 })"},
-
1860 {"can_delete: now.",
-
1861 __LINE__,
-
1862 {
-
1863 "can_delete",
-
1864 "now",
-
1865 },
- -
1867 R"({
-
1868 "method" : "can_delete",
-
1869 "params" : [
-
1870 {
-
1871 "api_version" : %API_VER%,
-
1872 "can_delete" : "now"
-
1873 }
-
1874 ]
-
1875 })"},
-
1876 {"can_delete: too many arguments.",
-
1877 __LINE__,
-
1878 {"can_delete", "always", "never"},
- -
1880 R"({
-
1881 "method" : "can_delete",
-
1882 "params" : [
-
1883 {
-
1884 "error" : "badSyntax",
-
1885 "error_code" : 1,
-
1886 "error_message" : "Syntax error."
-
1887 }
-
1888 ]
-
1889 })"},
-
1890 {"can_delete: invalid argument.",
-
1891 __LINE__,
-
1892 {"can_delete", "invalid"},
- -
1894 R"({
-
1895 "method" : "can_delete",
-
1896 "params" : [
-
1897 {
-
1898 "api_version" : %API_VER%,
-
1899 "can_delete" : "invalid"
-
1900 }
-
1901 ]
-
1902 })"},
-
1903 {// Note: this should return an error but not throw.
-
1904 "can_delete: ledger index > 32 bits.",
-
1905 __LINE__,
-
1906 {
-
1907 "can_delete",
-
1908 "4294967296",
-
1909 },
- -
1911 R"()"},
-
1912 {// Note: this really shouldn't throw since it's a legitimate ledger hash.
-
1913 "can_delete: ledger hash with no alphas.",
-
1914 __LINE__,
-
1915 {
-
1916 "can_delete",
-
1917 "0123456701234567012345670123456701234567012345670123456701234567",
-
1918 },
- -
1920 R"()"},
-
1921
-
1922 // channel_authorize
-
1923 // -----------------------------------------------------------
-
1924 {"channel_authorize: minimal.",
-
1925 __LINE__,
-
1926 {"channel_authorize",
-
1927 "secret_can_be_anything",
-
1928 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
1929 "18446744073709551615"},
- -
1931 R"({
-
1932 "method" : "channel_authorize",
-
1933 "params" : [
-
1934 {
-
1935 "api_version" : %API_VER%,
-
1936 "amount" : "18446744073709551615",
-
1937 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
1938 "secret" : "secret_can_be_anything"
-
1939 }
-
1940 ]
-
1941 })"},
-
1942 {"channel_authorize: too few arguments.",
-
1943 __LINE__,
-
1944 {
-
1945 "channel_authorize",
-
1946 "secret_can_be_anything",
-
1947 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
1948 },
- -
1950 R"({
-
1951 "method" : "channel_authorize",
-
1952 "params" : [
-
1953 {
-
1954 "error" : "badSyntax",
-
1955 "error_code" : 1,
-
1956 "error_message" : "Syntax error."
-
1957 }
-
1958 ]
-
1959 })"},
-
1960 {"channel_authorize: too many arguments.",
-
1961 __LINE__,
-
1962 {"channel_authorize",
-
1963 "secp256k1",
-
1964 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
1965 "2000",
-
1966 "whatever",
-
1967 "whenever"},
- -
1969 R"({
-
1970 "method" : "channel_authorize",
-
1971 "params" : [
-
1972 {
-
1973 "error" : "badSyntax",
-
1974 "error_code" : 1,
-
1975 "error_message" : "Syntax error."
-
1976 }
-
1977 ]
-
1978 })"},
-
1979 {"channel_authorize: bad key type.",
-
1980 __LINE__,
-
1981 {"channel_authorize",
-
1982 "secp257k1",
-
1983 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
1984 "2000",
-
1985 "whatever"},
- -
1987 R"({
-
1988 "method" : "channel_authorize",
-
1989 "params" : [
-
1990 {
-
1991 "error" : "badKeyType",
-
1992 "error_code" : 1,
-
1993 "error_message" : "Bad key type."
-
1994 }
-
1995 ]
-
1996 })"},
-
1997 {"channel_authorize: channel_id too short.",
-
1998 __LINE__,
-
1999 {"channel_authorize",
-
2000 "secret_can_be_anything",
-
2001 "123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2002 "2000"},
- -
2004 R"({
-
2005 "method" : "channel_authorize",
-
2006 "params" : [
-
2007 {
-
2008 "error" : "channelMalformed",
-
2009 "error_code" : 43,
-
2010 "error_message" : "Payment channel is malformed."
-
2011 }
-
2012 ]
-
2013 })"},
-
2014 {"channel_authorize: channel_id too long.",
-
2015 __LINE__,
-
2016 {"channel_authorize",
-
2017 "secret_can_be_anything",
-
2018 "10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2019 "2000"},
- -
2021 R"({
-
2022 "method" : "channel_authorize",
-
2023 "params" : [
-
2024 {
-
2025 "error" : "channelMalformed",
-
2026 "error_code" : 43,
-
2027 "error_message" : "Payment channel is malformed."
-
2028 }
-
2029 ]
-
2030 })"},
-
2031 {"channel_authorize: channel_id not hex.",
-
2032 __LINE__,
-
2033 {"channel_authorize",
-
2034 "secret_can_be_anything",
-
2035 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEZ",
-
2036 "2000"},
- -
2038 R"({
-
2039 "method" : "channel_authorize",
-
2040 "params" : [
-
2041 {
-
2042 "error" : "channelMalformed",
-
2043 "error_code" : 43,
-
2044 "error_message" : "Payment channel is malformed."
-
2045 }
-
2046 ]
-
2047 })"},
-
2048 {"channel_authorize: negative amount.",
-
2049 __LINE__,
-
2050 {"channel_authorize",
-
2051 "secret_can_be_anything",
-
2052 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2053 "-1"},
- -
2055 R"({
-
2056 "method" : "channel_authorize",
-
2057 "params" : [
-
2058 {
-
2059 "error" : "channelAmtMalformed",
-
2060 "error_code" : 44,
-
2061 "error_message" : "Payment channel amount is malformed."
-
2062 }
-
2063 ]
-
2064 })"},
-
2065 {"channel_authorize: amount > 64 bits.",
-
2066 __LINE__,
-
2067 {"channel_authorize",
-
2068 "secret_can_be_anything",
-
2069 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2070 "18446744073709551616"},
- -
2072 R"({
-
2073 "method" : "channel_authorize",
-
2074 "params" : [
-
2075 {
-
2076 "error" : "channelAmtMalformed",
-
2077 "error_code" : 44,
-
2078 "error_message" : "Payment channel amount is malformed."
-
2079 }
-
2080 ]
-
2081 })"},
-
2082
-
2083 // channel_verify
-
2084 // --------------------------------------------------------------
-
2085 {"channel_verify: public key.",
-
2086 __LINE__,
-
2087 {"channel_verify",
-
2088 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2089 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2090 "0",
-
2091 "DEADBEEF"},
- -
2093 R"({
-
2094 "method" : "channel_verify",
-
2095 "params" : [
-
2096 {
-
2097 "api_version" : %API_VER%,
-
2098 "amount" : "0",
-
2099 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2100 "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2101 "signature" : "DEADBEEF"
-
2102 }
-
2103 ]
-
2104 })"},
-
2105 {"channel_verify: public key hex.",
-
2106 __LINE__,
-
2107 {"channel_verify",
-
2108 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
-
2109 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2110 "18446744073709551615",
-
2111 "DEADBEEF"},
- -
2113 R"({
-
2114 "method" : "channel_verify",
-
2115 "params" : [
-
2116 {
-
2117 "api_version" : %API_VER%,
-
2118 "amount" : "18446744073709551615",
-
2119 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2120 "public_key" : "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
-
2121 "signature" : "DEADBEEF"
-
2122 }
-
2123 ]
-
2124 })"},
-
2125 {"channel_verify: too few arguments.",
-
2126 __LINE__,
-
2127 {"channel_verify",
-
2128 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2129 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"},
- -
2131 R"({
-
2132 "method" : "channel_verify",
-
2133 "params" : [
-
2134 {
-
2135 "error" : "badSyntax",
-
2136 "error_code" : 1,
-
2137 "error_message" : "Syntax error."
-
2138 }
-
2139 ]
-
2140 })"},
-
2141 {"channel_verify: too many arguments.",
-
2142 __LINE__,
-
2143 {"channel_verify",
-
2144 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2145 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2146 "2000",
-
2147 "DEADBEEF",
-
2148 "Whatever"},
- -
2150 R"({
-
2151 "method" : "channel_verify",
-
2152 "params" : [
-
2153 {
-
2154 "error" : "badSyntax",
-
2155 "error_code" : 1,
-
2156 "error_message" : "Syntax error."
-
2157 }
-
2158 ]
-
2159 })"},
-
2160 {"channel_verify: malformed public key.",
-
2161 __LINE__,
-
2162 {"channel_verify",
-
2163 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9GoV",
-
2164 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2165 "2000",
-
2166 "DEADBEEF"},
- -
2168 R"({
-
2169 "method" : "channel_verify",
-
2170 "params" : [
-
2171 {
-
2172 "error" : "publicMalformed",
-
2173 "error_code" : 60,
-
2174 "error_message" : "Public key is malformed."
-
2175 }
-
2176 ]
-
2177 })"},
-
2178 {"channel_verify: malformed hex public key.",
-
2179 __LINE__,
-
2180 {"channel_verify",
-
2181 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F",
-
2182 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2183 "2000",
-
2184 "DEADBEEF"},
- -
2186 R"({
-
2187 "method" : "channel_verify",
-
2188 "params" : [
-
2189 {
-
2190 "error" : "publicMalformed",
-
2191 "error_code" : 60,
-
2192 "error_message" : "Public key is malformed."
-
2193 }
-
2194 ]
-
2195 })"},
-
2196 {"channel_verify: invalid channel id.",
-
2197 __LINE__,
-
2198 {"channel_verify",
-
2199 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2200 "10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2201 "2000",
-
2202 "DEADBEEF"},
- -
2204 R"({
-
2205 "method" : "channel_verify",
-
2206 "params" : [
-
2207 {
-
2208 "error" : "channelMalformed",
-
2209 "error_code" : 43,
-
2210 "error_message" : "Payment channel is malformed."
-
2211 }
-
2212 ]
-
2213 })"},
-
2214 {"channel_verify: short channel id.",
-
2215 __LINE__,
-
2216 {"channel_verify",
-
2217 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2218 "123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2219 "2000",
-
2220 "DEADBEEF"},
- -
2222 R"({
-
2223 "method" : "channel_verify",
-
2224 "params" : [
-
2225 {
-
2226 "error" : "channelMalformed",
-
2227 "error_code" : 43,
-
2228 "error_message" : "Payment channel is malformed."
-
2229 }
-
2230 ]
-
2231 })"},
-
2232 {"channel_verify: amount too small.",
-
2233 __LINE__,
-
2234 {"channel_verify",
-
2235 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
-
2236 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2237 "-1",
-
2238 "DEADBEEF"},
- -
2240 R"({
-
2241 "method" : "channel_verify",
-
2242 "params" : [
-
2243 {
-
2244 "error" : "channelAmtMalformed",
-
2245 "error_code" : 44,
-
2246 "error_message" : "Payment channel amount is malformed."
-
2247 }
-
2248 ]
-
2249 })"},
-
2250 {"channel_verify: amount too large.",
-
2251 __LINE__,
-
2252 {"channel_verify",
-
2253 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
-
2254 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2255 "18446744073709551616",
-
2256 "DEADBEEF"},
- -
2258 R"({
-
2259 "method" : "channel_verify",
-
2260 "params" : [
-
2261 {
-
2262 "error" : "channelAmtMalformed",
-
2263 "error_code" : 44,
-
2264 "error_message" : "Payment channel amount is malformed."
-
2265 }
-
2266 ]
-
2267 })"},
-
2268 {"channel_verify: non-hex signature.",
-
2269 __LINE__,
-
2270 {"channel_verify",
-
2271 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2272 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2273 "40000000",
-
2274 "ThisIsNotHexadecimal"},
- -
2276 R"({
-
2277 "method" : "channel_verify",
-
2278 "params" : [
-
2279 {
-
2280 "api_version" : %API_VER%,
-
2281 "amount" : "40000000",
-
2282 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
-
2283 "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
-
2284 "signature" : "ThisIsNotHexadecimal"
-
2285 }
-
2286 ]
-
2287 })"},
-
2288
-
2289 // connect
-
2290 // ---------------------------------------------------------------------
-
2291 {"connect: minimal.",
-
2292 __LINE__,
-
2293 {
-
2294 "connect",
-
2295 "ThereIsNoCheckingOnTheIPFormat",
-
2296 },
- -
2298 R"({
-
2299 "method" : "connect",
-
2300 "params" : [
-
2301 {
-
2302 "api_version" : %API_VER%,
-
2303 "ip" : "ThereIsNoCheckingOnTheIPFormat"
-
2304 }
-
2305 ]
-
2306 })"},
-
2307 {"connect: ip and port.",
-
2308 __LINE__,
-
2309 {"connect", "ThereIsNoCheckingOnTheIPFormat", "6561"},
- -
2311 R"({
-
2312 "method" : "connect",
-
2313 "params" : [
-
2314 {
-
2315 "api_version" : %API_VER%,
-
2316 "ip" : "ThereIsNoCheckingOnTheIPFormat",
-
2317 "port" : 6561
-
2318 }
-
2319 ]
-
2320 })"},
-
2321 {"connect: too few arguments.",
-
2322 __LINE__,
-
2323 {
-
2324 "connect",
-
2325 },
- -
2327 R"({
-
2328 "method" : "connect",
-
2329 "params" : [
-
2330 {
-
2331 "error" : "badSyntax",
-
2332 "error_code" : 1,
-
2333 "error_message" : "Syntax error."
-
2334 }
-
2335 ]
-
2336 })"},
-
2337 {"connect: too many arguments.",
-
2338 __LINE__,
-
2339 {"connect", "ThereIsNoCheckingOnTheIPFormat", "6561", "extra"},
- -
2341 R"({
-
2342 "method" : "connect",
-
2343 "params" : [
-
2344 {
-
2345 "error" : "badSyntax",
-
2346 "error_code" : 1,
-
2347 "error_message" : "Syntax error."
-
2348 }
-
2349 ]
-
2350 })"},
-
2351 {// Note: this should return an error but not throw.
-
2352 "connect: port too small.",
-
2353 __LINE__,
-
2354 {
-
2355 "connect",
-
2356 "ThereIsNoCheckingOnTheIPFormat",
-
2357 "-1",
-
2358 },
- -
2360 R"()"},
-
2361 {// Note: this should return an error but not throw.
-
2362 "connect: port too large.",
-
2363 __LINE__,
-
2364 {
-
2365 "connect",
-
2366 "ThereIsNoCheckingOnTheIPFormat",
-
2367 "4294967296",
-
2368 },
- -
2370 R"()"},
-
2371
-
2372 // consensus_info
-
2373 // --------------------------------------------------------------
-
2374 {"consensus_info: minimal.",
-
2375 __LINE__,
-
2376 {
-
2377 "consensus_info",
-
2378 },
- -
2380 R"({
-
2381 "method" : "consensus_info",
-
2382 "params" : [
-
2383 {
-
2384 "api_version" : %API_VER%
-
2385 }
-
2386 ]
-
2387 })"},
-
2388 {"consensus_info: too many arguments.",
-
2389 __LINE__,
-
2390 {"consensus_info", "whatever"},
- -
2392 R"({
-
2393 "method" : "consensus_info",
-
2394 "params" : [
-
2395 {
-
2396 "error" : "badSyntax",
-
2397 "error_code" : 1,
-
2398 "error_message" : "Syntax error."
-
2399 }
-
2400 ]
-
2401 })"},
-
2402
-
2403 // deposit_authorized
-
2404 // ----------------------------------------------------------
-
2405 {"deposit_authorized: minimal.",
-
2406 __LINE__,
-
2407 {
-
2408 "deposit_authorized",
-
2409 "source_account_NotValidated",
-
2410 "destination_account_NotValidated",
-
2411 },
- -
2413 R"({
-
2414 "method" : "deposit_authorized",
-
2415 "params" : [
-
2416 {
-
2417 "api_version" : %API_VER%,
-
2418 "destination_account" : "destination_account_NotValidated",
-
2419 "source_account" : "source_account_NotValidated"
-
2420 }
-
2421 ]
-
2422 })"},
-
2423 {"deposit_authorized: with text ledger index.",
-
2424 __LINE__,
-
2425 {"deposit_authorized",
-
2426 "source_account_NotValidated",
-
2427 "destination_account_NotValidated",
-
2428 "validated"},
- -
2430 R"({
-
2431 "method" : "deposit_authorized",
-
2432 "params" : [
-
2433 {
-
2434 "api_version" : %API_VER%,
-
2435 "destination_account" : "destination_account_NotValidated",
-
2436 "ledger_index" : "validated",
-
2437 "source_account" : "source_account_NotValidated"
-
2438 }
-
2439 ]
-
2440 })"},
-
2441 {"deposit_authorized: with ledger index.",
-
2442 __LINE__,
-
2443 {"deposit_authorized",
-
2444 "source_account_NotValidated",
-
2445 "destination_account_NotValidated",
-
2446 "4294967295",
-
2447 "cred1",
-
2448 "cred2",
-
2449 "cred3",
-
2450 "cred4",
-
2451 "cred5",
-
2452 "cred6",
-
2453 "cred7",
-
2454 "cred8"},
- -
2456 R"({
-
2457 "method" : "deposit_authorized",
-
2458 "params" : [
-
2459 {
-
2460 "api_version" : %API_VER%,
-
2461 "destination_account" : "destination_account_NotValidated",
-
2462 "ledger_index" : 4294967295,
-
2463 "source_account" : "source_account_NotValidated",
-
2464 "credentials": ["cred1", "cred2", "cred3", "cred4", "cred5", "cred6", "cred7", "cred8"]
-
2465 }
-
2466 ]
-
2467 })"},
-
2468 {"deposit_authorized: with ledger hash.",
-
2469 __LINE__,
-
2470 {"deposit_authorized",
-
2471 "source_account_NotValidated",
-
2472 "destination_account_NotValidated",
-
2473 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
- -
2475 R"({
-
2476 "method" : "deposit_authorized",
-
2477 "params" : [
-
2478 {
-
2479 "api_version" : %API_VER%,
-
2480 "destination_account" : "destination_account_NotValidated",
-
2481 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
2482 "source_account" : "source_account_NotValidated"
-
2483 }
-
2484 ]
-
2485 })"},
-
2486 {"deposit_authorized: too few arguments.",
-
2487 __LINE__,
-
2488 {
-
2489 "deposit_authorized",
-
2490 "source_account_NotValidated",
-
2491 },
- -
2493 R"({
-
2494 "method" : "deposit_authorized",
-
2495 "params" : [
-
2496 {
-
2497 "error" : "badSyntax",
-
2498 "error_code" : 1,
-
2499 "error_message" : "Syntax error."
-
2500 }
-
2501 ]
-
2502 })"},
-
2503 {"deposit_authorized: too many arguments.",
-
2504 __LINE__,
-
2505 {"deposit_authorized",
-
2506 "source_account_NotValidated",
-
2507 "destination_account_NotValidated",
-
2508 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
-
2509 "cred1",
-
2510 "cred2",
-
2511 "cred3",
-
2512 "cred4",
-
2513 "cred5",
-
2514 "cred6",
-
2515 "cred7",
-
2516 "cred8",
-
2517 "too_much"},
- -
2519 R"({
-
2520 "method" : "deposit_authorized",
-
2521 "params" : [
-
2522 {
-
2523 "error" : "badSyntax",
-
2524 "error_code" : 1,
-
2525 "error_message" : "Syntax error."
-
2526 }
-
2527 ]
-
2528 })"},
-
2529 {"deposit_authorized: invalid ledger selection.",
-
2530 __LINE__,
-
2531 {
-
2532 "deposit_authorized",
-
2533 "source_account_NotValidated",
-
2534 "destination_account_NotValidated",
-
2535 "NotALedger",
-
2536 },
- -
2538 R"({
-
2539 "method" : "deposit_authorized",
-
2540 "params" : [
-
2541 {
-
2542 "api_version" : %API_VER%,
-
2543 "destination_account" : "destination_account_NotValidated",
-
2544 "ledger_index" : 0,
-
2545 "source_account" : "source_account_NotValidated"
-
2546 }
-
2547 ]
-
2548 })"},
-
2549
-
2550 // feature
-
2551 // ---------------------------------------------------------------------
-
2552 {"feature: minimal.",
-
2553 __LINE__,
-
2554 {
-
2555 "feature",
-
2556 },
- -
2558 R"({
-
2559 "method" : "feature",
-
2560 "params" : [
-
2561 {
-
2562 "api_version" : %API_VER%,
-
2563 }
-
2564 ]
-
2565 })"},
-
2566 {"feature: with name.",
-
2567 __LINE__,
-
2568 {"feature", "featureNameOrHexIsNotValidated"},
- -
2570 R"({
-
2571 "method" : "feature",
-
2572 "params" : [
-
2573 {
-
2574 "api_version" : %API_VER%,
-
2575 "feature" : "featureNameOrHexIsNotValidated"
-
2576 }
-
2577 ]
-
2578 })"},
-
2579 {"feature: accept.",
-
2580 __LINE__,
-
2581 {"feature",
-
2582 "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA98"
-
2583 "76543210",
-
2584 "accept"},
- -
2586 R"({
-
2587 "method" : "feature",
-
2588 "params" : [
-
2589 {
-
2590 "api_version" : %API_VER%,
-
2591 "feature" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210",
-
2592 "vetoed" : false
-
2593 }
-
2594 ]
-
2595 })"},
-
2596 {"feature: reject.",
-
2597 __LINE__,
-
2598 {"feature", "0", "reject"},
- -
2600 R"({
-
2601 "method" : "feature",
-
2602 "params" : [
-
2603 {
-
2604 "api_version" : %API_VER%,
-
2605 "feature" : "0",
-
2606 "vetoed" : true
-
2607 }
-
2608 ]
-
2609 })"},
-
2610 {"feature: too many arguments.",
-
2611 __LINE__,
-
2612 {"feature", "featureNameOrHexIsNotValidated", "accept", "anotherArg"},
- -
2614 R"({
-
2615 "method" : "feature",
-
2616 "params" : [
-
2617 {
-
2618 "error" : "badSyntax",
-
2619 "error_code" : 1,
-
2620 "error_message" : "Syntax error."
-
2621 }
-
2622 ]
-
2623 })"},
-
2624 {"feature: neither accept nor reject.",
-
2625 __LINE__,
-
2626 {
-
2627 "feature",
-
2628 "featureNameOrHexIsNotValidated",
-
2629 "veto",
-
2630 },
- -
2632 R"({
-
2633 "method" : "feature",
-
2634 "params" : [
-
2635 {
-
2636 "error" : "invalidParams",
-
2637 "error_code" : 31,
-
2638 "error_message" : "Invalid parameters."
-
2639 }
-
2640 ]
-
2641 })"},
-
2642
-
2643 // fetch_info
-
2644 // ------------------------------------------------------------------
-
2645 {"fetch_info: minimal.",
-
2646 __LINE__,
-
2647 {
-
2648 "fetch_info",
-
2649 },
- -
2651 R"({
-
2652 "method" : "fetch_info",
-
2653 "params" : [
-
2654 {
-
2655 "api_version" : %API_VER%,
-
2656 }
-
2657 ]
-
2658 })"},
-
2659 {"fetch_info: clear.",
-
2660 __LINE__,
-
2661 {"fetch_info", "clear"},
- -
2663 R"({
-
2664 "method" : "fetch_info",
-
2665 "params" : [
-
2666 {
-
2667 "api_version" : %API_VER%,
-
2668 "clear" : true
-
2669 }
-
2670 ]
-
2671 })"},
-
2672 {"fetch_info: too many arguments.",
-
2673 __LINE__,
-
2674 {"fetch_info", "clear", "other"},
- -
2676 R"({
-
2677 "method" : "fetch_info",
-
2678 "params" : [
-
2679 {
-
2680 "error" : "badSyntax",
-
2681 "error_code" : 1,
-
2682 "error_message" : "Syntax error."
-
2683 }
-
2684 ]
-
2685 })"},
-
2686 {"fetch_info: other trailing argument.",
-
2687 __LINE__,
-
2688 {"fetch_info", "too"},
- -
2690 R"({
-
2691 "method" : "fetch_info",
-
2692 "params" : [
-
2693 {
-
2694 "api_version" : %API_VER%,
-
2695 "too" : true
-
2696 }
-
2697 ]
-
2698 })"},
-
2699
-
2700 // gateway_balances
-
2701 // ------------------------------------------------------------
-
2702 {"gateway_balances: minimal.",
-
2703 __LINE__,
-
2704 {"gateway_balances", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
- -
2706 R"({
-
2707 "method" : "gateway_balances",
-
2708 "params" : [
-
2709 {
-
2710 "api_version" : %API_VER%,
-
2711 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2712 }
-
2713 ]
-
2714 })"},
-
2715 {"gateway_balances: with ledger index.",
-
2716 __LINE__,
-
2717 {"gateway_balances", "890765", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
- -
2719 R"({
-
2720 "method" : "gateway_balances",
-
2721 "params" : [
-
2722 {
-
2723 "api_version" : %API_VER%,
-
2724 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2725 "ledger_index" : "890765"
-
2726 }
-
2727 ]
-
2728 })"},
-
2729 {"gateway_balances: with text ledger index.",
-
2730 __LINE__,
-
2731 {"gateway_balances", "current", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
- -
2733 R"({
-
2734 "method" : "gateway_balances",
-
2735 "params" : [
-
2736 {
-
2737 "api_version" : %API_VER%,
-
2738 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2739 "ledger_index" : "current"
-
2740 }
-
2741 ]
-
2742 })"},
-
2743 {"gateway_balances: with 64 character ledger hash.",
-
2744 __LINE__,
-
2745 {"gateway_balances",
-
2746 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
2747 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
- -
2749 R"({
-
2750 "method" : "gateway_balances",
-
2751 "params" : [
-
2752 {
-
2753 "api_version" : %API_VER%,
-
2754 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2755 "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
-
2756 }
-
2757 ]
-
2758 })"},
-
2759 {"gateway_balances: 1 hotwallet.",
-
2760 __LINE__,
-
2761 {"gateway_balances",
-
2762 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2763 "hotwallet_is_not_validated"},
- -
2765 R"({
-
2766 "method" : "gateway_balances",
-
2767 "params" : [
-
2768 {
-
2769 "api_version" : %API_VER%,
-
2770 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2771 "hotwallet" : [ "hotwallet_is_not_validated" ]
-
2772 }
-
2773 ]
-
2774 })"},
-
2775 {"gateway_balances: 3 hotwallets.",
-
2776 __LINE__,
-
2777 {
-
2778 "gateway_balances",
-
2779 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
2780 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2781 "hotwallet_is_not_validated_1",
-
2782 "hotwallet_is_not_validated_2",
-
2783 "hotwallet_is_not_validated_3",
-
2784 },
- -
2786 R"({
-
2787 "method" : "gateway_balances",
-
2788 "params" : [
-
2789 {
-
2790 "api_version" : %API_VER%,
-
2791 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
2792 "hotwallet" : [
-
2793 "hotwallet_is_not_validated_1",
-
2794 "hotwallet_is_not_validated_2",
-
2795 "hotwallet_is_not_validated_3"
-
2796 ],
-
2797 "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
-
2798 }
-
2799 ]
-
2800 })"},
-
2801 {"gateway_balances: too few arguments.",
-
2802 __LINE__,
-
2803 {
-
2804 "gateway_balances",
-
2805 },
- -
2807 R"({
-
2808 "method" : "gateway_balances",
-
2809 "params" : [
-
2810 {
-
2811 "error" : "badSyntax",
-
2812 "error_code" : 1,
-
2813 "error_message" : "Syntax error."
-
2814 }
-
2815 ]
-
2816 })"},
-
2817 {"gateway_balances: empty first argument.",
-
2818 __LINE__,
-
2819 {"gateway_balances", ""},
- -
2821 R"({
-
2822 "method" : "gateway_balances",
-
2823 "params" : [
-
2824 {
-
2825 "error" : "invalidParams",
-
2826 "error_code" : 31,
-
2827 "error_message" : "Invalid first parameter"
-
2828 }
-
2829 ]
-
2830 })"},
-
2831 {"gateway_balances: with ledger index but no gateway.",
-
2832 __LINE__,
-
2833 {
-
2834 "gateway_balances",
-
2835 "890765",
-
2836 },
- -
2838 R"({
-
2839 "method" : "gateway_balances",
-
2840 "params" : [
-
2841 {
-
2842 "error" : "invalidParams",
-
2843 "error_code" : 31,
-
2844 "error_message" : "Invalid hotwallet"
-
2845 }
-
2846 ]
-
2847 })"},
-
2848 {"gateway_balances: with text ledger index but no gateway.",
-
2849 __LINE__,
-
2850 {
-
2851 "gateway_balances",
-
2852 "current",
-
2853 },
- -
2855 R"({
-
2856 "method" : "gateway_balances",
-
2857 "params" : [
-
2858 {
-
2859 "error" : "invalidParams",
-
2860 "error_code" : 31,
-
2861 "error_message" : "Invalid hotwallet"
-
2862 }
-
2863 ]
-
2864 })"},
-
2865 {"gateway_balances: with 64 character ledger hash but no gateway.",
-
2866 __LINE__,
-
2867 {
-
2868 "gateway_balances",
-
2869 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
2870 },
- -
2872 R"({
-
2873 "method" : "gateway_balances",
-
2874 "params" : [
-
2875 {
-
2876 "error" : "invalidParams",
-
2877 "error_code" : 31,
-
2878 "error_message" : "Invalid hotwallet"
-
2879 }
-
2880 ]
-
2881 })"},
-
2882
-
2883 // get_counts
-
2884 // ------------------------------------------------------------------
-
2885 {"get_counts: minimal.",
-
2886 __LINE__,
-
2887 {
-
2888 "get_counts",
-
2889 },
- -
2891 R"({
-
2892 "method" : "get_counts",
-
2893 "params" : [
-
2894 {
-
2895 "api_version" : %API_VER%,
-
2896 }
-
2897 ]
-
2898 })"},
-
2899 {"get_counts: with maximum count.",
-
2900 __LINE__,
-
2901 {"get_counts", "100"},
- -
2903 R"({
-
2904 "method" : "get_counts",
-
2905 "params" : [
-
2906 {
-
2907 "api_version" : %API_VER%,
-
2908 "min_count" : 100
-
2909 }
-
2910 ]
-
2911 })"},
-
2912 {"get_counts: too many arguments.",
-
2913 __LINE__,
-
2914 {"get_counts", "100", "whatever"},
- -
2916 R"({
-
2917 "method" : "get_counts",
-
2918 "params" : [
-
2919 {
-
2920 "error" : "badSyntax",
-
2921 "error_code" : 1,
-
2922 "error_message" : "Syntax error."
-
2923 }
-
2924 ]
-
2925 })"},
-
2926 {"get_counts: count too small.",
-
2927 __LINE__,
-
2928 {
-
2929 "get_counts",
-
2930 "-1",
-
2931 },
- -
2933 R"()"},
-
2934 {"get_counts: count too large.",
-
2935 __LINE__,
-
2936 {"get_counts", "4294967296"},
- -
2938 R"()"},
-
2939
-
2940 // json
-
2941 // ------------------------------------------------------------------------
-
2942 {"json: minimal.",
-
2943 __LINE__,
-
2944 {
-
2945 "json",
-
2946 "command",
-
2947 R"({"json_argument":true})",
-
2948 },
- -
2950 R"({
-
2951 "method" : "command",
-
2952 "params" : [
-
2953 {
-
2954 "api_version" : %API_VER%,
-
2955 "json_argument" : true,
-
2956 "method" : "command"
-
2957 }
-
2958 ]
-
2959 })"},
-
2960 {"json: null object.",
-
2961 __LINE__,
-
2962 {
-
2963 "json",
-
2964 "command",
-
2965 R"({})",
-
2966 },
- -
2968 R"({
-
2969 "method" : "command",
-
2970 "params" : [
-
2971 {
-
2972 "api_version" : %API_VER%,
-
2973 "method" : "command"
-
2974 }
-
2975 ]
-
2976 })"},
-
2977 {"json: too few arguments.",
-
2978 __LINE__,
-
2979 {"json", "command"},
- -
2981 R"({
-
2982 "method" : "json",
-
2983 "params" : [
-
2984 {
-
2985 "error" : "badSyntax",
-
2986 "error_code" : 1,
-
2987 "error_message" : "Syntax error."
-
2988 }
-
2989 ]
-
2990 })"},
-
2991 {"json: too many arguments.",
-
2992 __LINE__,
-
2993 {"json", "command", R"({"json_argument":true})", "extra"},
- -
2995 R"({
-
2996 "method" : "json",
-
2997 "params" : [
-
2998 {
-
2999 "error" : "badSyntax",
-
3000 "error_code" : 1,
-
3001 "error_message" : "Syntax error."
-
3002 }
-
3003 ]
-
3004 })"},
-
3005 {"json: array, not object.",
-
3006 __LINE__,
-
3007 {
-
3008 "json",
-
3009 "command",
-
3010 R"(["arg1","arg2"])",
-
3011 },
- -
3013 R"({
-
3014 "method" : "json",
-
3015 "params" : [
-
3016 {
-
3017 "error" : "invalidParams",
-
3018 "error_code" : 31,
-
3019 "error_message" : "Invalid parameters."
-
3020 }
-
3021 ]
-
3022 })"},
-
3023 {"json: invalid json (note closing comma).",
-
3024 __LINE__,
-
3025 {
-
3026 "json",
-
3027 "command",
-
3028 R"({"json_argument":true,})",
-
3029 },
- -
3031 R"({
-
3032 "method" : "json",
-
3033 "params" : [
-
3034 {
-
3035 "error" : "invalidParams",
-
3036 "error_code" : 31,
-
3037 "error_message" : "Invalid parameters."
-
3038 }
-
3039 ]
-
3040 })"},
-
3041
-
3042 // json2
-
3043 // -----------------------------------------------------------------------
-
3044 {"json2: minimal object.",
-
3045 __LINE__,
-
3046 {
-
3047 "json2",
-
3048 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"})",
-
3049 },
- -
3051 R"({
-
3052 "id" : "A1",
-
3053 "jsonrpc" : "2.0",
-
3054 "method" : "call_1",
-
3055 "params" : [
-
3056 {
-
3057 "api_version" : %API_VER%,
-
3058 "id" : "A1",
-
3059 "jsonrpc" : "2.0",
-
3060 "method" : "call_1",
-
3061 "ripplerpc" : "2.0"
-
3062 }
-
3063 ],
-
3064 "ripplerpc" : "2.0"
-
3065 })"},
-
3066 {"json2: object with nested params.",
-
3067 __LINE__,
-
3068 {
-
3069 "json2",
-
3070 R"({
-
3071 "jsonrpc" : "2.0",
-
3072 "ripplerpc" : "2.0",
-
3073 "id" : "A1",
-
3074 "method" : "call_1",
-
3075 "params" : [{"inner_arg" : "yup"}]
-
3076 })",
-
3077 },
- -
3079 R"({
-
3080 "id" : "A1",
-
3081 "jsonrpc" : "2.0",
-
3082 "method" : "call_1",
-
3083 "params" : [
-
3084 {
-
3085 "api_version" : %API_VER%,
-
3086 "0" : {
-
3087 "inner_arg" : "yup"
-
3088 },
-
3089 "id" : "A1",
-
3090 "jsonrpc" : "2.0",
-
3091 "method" : "call_1",
-
3092 "ripplerpc" : "2.0"
-
3093 }
-
3094 ],
-
3095 "ripplerpc" : "2.0"
-
3096 })"},
-
3097 {"json2: minimal array.",
-
3098 __LINE__,
-
3099 {
-
3100 "json2",
-
3101 R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"}])",
-
3102 },
- -
3104 R"({
-
3105 "method" : "json2",
-
3106 "params" : [
-
3107 [
-
3108 {
-
3109 "api_version" : %API_VER%,
-
3110 "id" : "A1",
-
3111 "jsonrpc" : "2.0",
-
3112 "method" : "call_1",
-
3113 "ripplerpc" : "2.0"
-
3114 }
-
3115 ]
-
3116 ]
-
3117 })"},
-
3118 {"json2: array with object with nested params.",
-
3119 __LINE__,
-
3120 {
-
3121 "json2",
-
3122 R"([
-
3123 {"jsonrpc":"2.0",
-
3124 "ripplerpc":"2.0",
-
3125 "id":"A1",
-
3126 "method":"call_1",
-
3127 "params" : [{"inner_arg" : "yup"}]}
-
3128 ])",
-
3129 },
- -
3131 R"({
-
3132 "method" : "json2",
-
3133 "params" : [
-
3134 [
-
3135 {
-
3136 "api_version" : %API_VER%,
-
3137 "0" : {
-
3138 "inner_arg" : "yup"
-
3139 },
-
3140 "id" : "A1",
-
3141 "jsonrpc" : "2.0",
-
3142 "method" : "call_1",
-
3143 "ripplerpc" : "2.0"
-
3144 }
-
3145 ]
-
3146 ]})"},
-
3147 {"json2: too few arguments.",
-
3148 __LINE__,
-
3149 {
-
3150 "json2",
-
3151 },
- -
3153 R"({
-
3154 "method" : "json2",
-
3155 "params" : [
-
3156 {
-
3157 "error" : "badSyntax",
-
3158 "error_code" : 1,
-
3159 "error_message" : "Syntax error."
-
3160 }
-
3161 ]
-
3162 })"},
-
3163 {"json2: too many arguments.",
-
3164 __LINE__,
-
3165 {"json2",
-
3166 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_this"})",
-
3167 "extra"},
- -
3169 R"({
-
3170 "method" : "json2",
-
3171 "params" : [
-
3172 {
-
3173 "error" : "badSyntax",
-
3174 "error_code" : 1,
-
3175 "error_message" : "Syntax error."
-
3176 }
-
3177 ]
-
3178 })"},
-
3179 {"json2: malformed json (note extra comma).",
-
3180 __LINE__,
-
3181 {
-
3182 "json2",
-
3183 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",})",
-
3184 },
- -
3186 R"({
-
3187 "id" : "A1",
-
3188 "jsonrpc" : "2.0",
-
3189 "method" : "json2",
-
3190 "params" : [
-
3191 {
-
3192 "error" : "invalidParams",
-
3193 "error_code" : 31,
-
3194 "error_message" : "Invalid parameters.",
-
3195 "id" : "A1",
-
3196 "jsonrpc" : "2.0",
-
3197 "ripplerpc" : "2.0"
-
3198 }
-
3199 ],
-
3200 "ripplerpc" : "2.0"
-
3201 })"},
-
3202 {"json2: omit jsonrpc.",
-
3203 __LINE__,
-
3204 {
-
3205 "json2",
-
3206 R"({"ripplerpc":"2.0","id":"A1","method":"call_1"})",
-
3207 },
- -
3209 R"({
-
3210 "id" : "A1",
-
3211 "method" : "json2",
-
3212 "params" : [
-
3213 {
-
3214 "error" : "invalidParams",
-
3215 "error_code" : 31,
-
3216 "error_message" : "Invalid parameters.",
-
3217 "id" : "A1",
-
3218 "ripplerpc" : "2.0"
-
3219 }
-
3220 ],
-
3221 "ripplerpc" : "2.0"
-
3222 })"},
-
3223 {"json2: wrong jsonrpc version.",
-
3224 __LINE__,
-
3225 {
-
3226 "json2",
-
3227 R"({"jsonrpc":"2.1","ripplerpc":"2.0","id":"A1","method":"call_1"})",
-
3228 },
- -
3230 R"({
-
3231 "id" : "A1",
-
3232 "jsonrpc" : "2.1",
-
3233 "method" : "json2",
-
3234 "params" : [
-
3235 {
-
3236 "error" : "invalidParams",
-
3237 "error_code" : 31,
-
3238 "error_message" : "Invalid parameters.",
-
3239 "id" : "A1",
-
3240 "jsonrpc" : "2.1",
-
3241 "ripplerpc" : "2.0"
-
3242 }
-
3243 ],
-
3244 "ripplerpc" : "2.0"
-
3245 })"},
-
3246 {"json2: omit ripplerpc.",
-
3247 __LINE__,
-
3248 {
-
3249 "json2",
-
3250 R"({"jsonrpc":"2.0","id":"A1","method":"call_1"})",
-
3251 },
- -
3253 R"({
-
3254 "id" : "A1",
-
3255 "jsonrpc" : "2.0",
-
3256 "method" : "json2",
-
3257 "params" : [
-
3258 {
-
3259 "error" : "invalidParams",
-
3260 "error_code" : 31,
-
3261 "error_message" : "Invalid parameters.",
-
3262 "id" : "A1",
-
3263 "jsonrpc" : "2.0"
-
3264 }
-
3265 ]
-
3266 })"},
-
3267 {"json2: wrong ripplerpc version.",
-
3268 __LINE__,
-
3269 {
-
3270 "json2",
-
3271 R"({"jsonrpc":"2.0","ripplerpc":"2.00","id":"A1","method":"call_1"})",
-
3272 },
- -
3274 R"({
-
3275 "id" : "A1",
-
3276 "jsonrpc" : "2.0",
-
3277 "method" : "json2",
-
3278 "params" : [
-
3279 {
-
3280 "error" : "invalidParams",
-
3281 "error_code" : 31,
-
3282 "error_message" : "Invalid parameters.",
-
3283 "id" : "A1",
-
3284 "jsonrpc" : "2.0",
-
3285 "ripplerpc" : "2.00"
-
3286 }
-
3287 ],
-
3288 "ripplerpc" : "2.00"
-
3289 })"},
-
3290 {"json2: omit id.",
-
3291 __LINE__,
-
3292 {
-
3293 "json2",
-
3294 R"({"jsonrpc":"2.0","ripplerpc":"2.0","method":"call_1"})",
-
3295 },
- -
3297 R"({
-
3298 "jsonrpc" : "2.0",
-
3299 "method" : "json2",
-
3300 "params" : [
-
3301 {
-
3302 "error" : "invalidParams",
-
3303 "error_code" : 31,
-
3304 "error_message" : "Invalid parameters.",
-
3305 "jsonrpc" : "2.0",
-
3306 "ripplerpc" : "2.0"
-
3307 }
-
3308 ],
-
3309 "ripplerpc" : "2.0"
-
3310 })"},
-
3311 {"json2: omit method.",
-
3312 __LINE__,
-
3313 {
-
3314 "json2",
-
3315 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1"})",
-
3316 },
- -
3318 R"({
-
3319 "id" : "A1",
-
3320 "jsonrpc" : "2.0",
-
3321 "method" : "json2",
-
3322 "params" : [
-
3323 {
-
3324 "error" : "invalidParams",
-
3325 "error_code" : 31,
-
3326 "error_message" : "Invalid parameters.",
-
3327 "id" : "A1",
-
3328 "jsonrpc" : "2.0",
-
3329 "ripplerpc" : "2.0"
-
3330 }
-
3331 ],
-
3332 "ripplerpc" : "2.0"
-
3333 })"},
-
3334 {"json2: empty outer array.",
-
3335 __LINE__,
-
3336 {
-
3337 "json2",
-
3338 R"([])",
-
3339 },
- -
3341 R"({
-
3342 "method" : "json2",
-
3343 "params" : [
-
3344 {
-
3345 "error" : "invalidParams",
-
3346 "error_code" : 31,
-
3347 "error_message" : "Invalid parameters."
-
3348 }
-
3349 ]
-
3350 })"},
-
3351 {"json2: empty inner array.",
-
3352 __LINE__,
-
3353 {
-
3354 "json2",
-
3355 R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",[]}])",
-
3356 },
- -
3358 R"({
-
3359 "method" : "json2",
-
3360 "params" : [
-
3361 {
-
3362 "error" : "invalidParams",
-
3363 "error_code" : 31,
-
3364 "error_message" : "Invalid parameters."
-
3365 }
-
3366 ]
-
3367 })"},
-
3368 {"json2: array with non-json2 object.",
-
3369 __LINE__,
-
3370 {
-
3371 "json2",
-
3372 R"([
-
3373 {"jsonrpc" : "2.1",
-
3374 "ripplerpc" : "2.0",
-
3375 "id" : "A1",
-
3376 "method" : "call_1"
-
3377 }
-
3378 ])",
-
3379 },
- -
3381 R"({
-
3382 "method" : "json2",
-
3383 "params" : [
-
3384 {
-
3385 "error" : "invalidParams",
-
3386 "error_code" : 31,
-
3387 "error_message" : "Invalid parameters."
-
3388 }
-
3389 ]
-
3390 })"},
-
3391 {"json2: non-object or -array inner params member.",
-
3392 __LINE__,
-
3393 {
-
3394 "json2",
-
3395 R"({
-
3396 "jsonrpc" : "2.0",
-
3397 "ripplerpc" : "2.0",
-
3398 "id" : "A1",
-
3399 "method" : "call_1",
-
3400 "params" : true
-
3401 })",
-
3402 },
- -
3404 R"({
-
3405 "id" : "A1",
-
3406 "jsonrpc" : "2.0",
-
3407 "method" : "json2",
-
3408 "params" : [
-
3409 {
-
3410 "error" : "invalidParams",
-
3411 "error_code" : 31,
-
3412 "error_message" : "Invalid parameters.",
-
3413 "id" : "A1",
-
3414 "jsonrpc" : "2.0",
-
3415 "ripplerpc" : "2.0"
-
3416 }
-
3417 ],
-
3418 "ripplerpc" : "2.0"
-
3419 })"},
-
3420
-
3421 // ledger
-
3422 // ----------------------------------------------------------------------
-
3423 {"ledger: minimal.",
-
3424 __LINE__,
-
3425 {"ledger"},
- -
3427 R"({
-
3428 "method" : "ledger",
-
3429 "params" : [
-
3430 {
-
3431 "api_version" : %API_VER%,
-
3432 }
-
3433 ]
-
3434 })"},
-
3435 {"ledger: ledger index.",
-
3436 __LINE__,
-
3437 {"ledger", "4294967295"},
- -
3439 R"({
-
3440 "method" : "ledger",
-
3441 "params" : [
-
3442 {
-
3443 "api_version" : %API_VER%,
-
3444 "ledger_index" : 4294967295
-
3445 }
-
3446 ]
-
3447 })"},
-
3448 {"ledger: text ledger index.",
-
3449 __LINE__,
-
3450 {"ledger", "validated"},
- -
3452 R"({
-
3453 "method" : "ledger",
-
3454 "params" : [
-
3455 {
-
3456 "api_version" : %API_VER%,
-
3457 "ledger_index" : "validated"
-
3458 }
-
3459 ]
-
3460 })"},
-
3461 {"ledger: ledger hash.",
-
3462 __LINE__,
-
3463 {"ledger",
-
3464 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
- -
3466 R"({
-
3467 "method" : "ledger",
-
3468 "params" : [
-
3469 {
-
3470 "api_version" : %API_VER%,
-
3471 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
-
3472 }
-
3473 ]
-
3474 })"},
-
3475 {"ledger: full.",
-
3476 __LINE__,
-
3477 {"ledger", "current", "full"},
- -
3479 R"({
-
3480 "method" : "ledger",
-
3481 "params" : [
-
3482 {
-
3483 "api_version" : %API_VER%,
-
3484 "full" : true,
-
3485 "ledger_index" : "current"
-
3486 }
-
3487 ]
-
3488 })"},
-
3489 {"ledger: tx.",
-
3490 __LINE__,
-
3491 {"ledger", "closed", "tx"},
- -
3493 R"({
-
3494 "method" : "ledger",
-
3495 "params" : [
-
3496 {
-
3497 "api_version" : %API_VER%,
-
3498 "expand" : true,
-
3499 "ledger_index" : "closed",
-
3500 "transactions" : true
-
3501 }
-
3502 ]
-
3503 })"},
-
3504 {"ledger: too many arguments.",
-
3505 __LINE__,
-
3506 {"ledger", "4294967295", "spare"},
- -
3508 R"({
-
3509 "method" : "ledger",
-
3510 "params" : [
-
3511 {
-
3512 "api_version" : %API_VER%,
-
3513 "ledger_index" : 4294967295
-
3514 }
-
3515 ]
-
3516 })"},
-
3517 {"ledger: ledger index too small.",
-
3518 __LINE__,
-
3519 {"ledger", "-1"},
- -
3521 R"({
-
3522 "method" : "ledger",
-
3523 "params" : [
-
3524 {
-
3525 "api_version" : %API_VER%,
-
3526 "ledger_index" : 0
-
3527 }
-
3528 ]
-
3529 })"},
-
3530 {"ledger: ledger index too big.",
-
3531 __LINE__,
-
3532 {"ledger", "4294967296"},
- -
3534 R"({
-
3535 "method" : "ledger",
-
3536 "params" : [
-
3537 {
-
3538 "api_version" : %API_VER%,
-
3539 "ledger_index" : 0
-
3540 }
-
3541 ]
-
3542 })"},
-
3543 {"ledger: invalid ledger text.",
-
3544 __LINE__,
-
3545 {"ledger", "latest"},
- -
3547 R"({
-
3548 "method" : "ledger",
-
3549 "params" : [
-
3550 {
-
3551 "api_version" : %API_VER%,
-
3552 "ledger_index" : 0
-
3553 }
-
3554 ]
-
3555 })"},
-
3556 {"ledger: unsupported final argument.",
-
3557 __LINE__,
-
3558 {"ledger", "current", "expand"},
- -
3560 R"({
-
3561 "method" : "ledger",
-
3562 "params" : [
-
3563 {
-
3564 "api_version" : %API_VER%,
-
3565 "ledger_index" : "current"
-
3566 }
-
3567 ]
-
3568 })"},
-
3569
-
3570 // ledger_closed
-
3571 // ---------------------------------------------------------------
-
3572 {"ledger_closed: minimal.",
-
3573 __LINE__,
-
3574 {"ledger_closed"},
- -
3576 R"({
-
3577 "method" : "ledger_closed",
-
3578 "params" : [
-
3579 {
-
3580 "api_version" : %API_VER%,
-
3581 }
-
3582 ]
-
3583 })"},
-
3584 {"ledger_closed: too many arguments.",
-
3585 __LINE__,
-
3586 {"ledger_closed", "today"},
- -
3588 R"({
-
3589 "method" : "ledger_closed",
-
3590 "params" : [
-
3591 {
-
3592 "error" : "badSyntax",
-
3593 "error_code" : 1,
-
3594 "error_message" : "Syntax error."
-
3595 }
-
3596 ]
-
3597 })"},
-
3598
-
3599 // ledger_current
-
3600 // --------------------------------------------------------------
-
3601 {"ledger_current: minimal.",
-
3602 __LINE__,
-
3603 {"ledger_current"},
- -
3605 R"({
-
3606 "method" : "ledger_current",
-
3607 "params" : [
-
3608 {
-
3609 "api_version" : %API_VER%,
-
3610 }
-
3611 ]
-
3612 })"},
-
3613 {"ledger_current: too many arguments.",
-
3614 __LINE__,
-
3615 {"ledger_current", "today"},
- -
3617 R"({
-
3618 "method" : "ledger_current",
-
3619 "params" : [
-
3620 {
-
3621 "error" : "badSyntax",
-
3622 "error_code" : 1,
-
3623 "error_message" : "Syntax error."
-
3624 }
-
3625 ]
-
3626 })"},
-
3627
-
3628 // ledger_header
-
3629 // ---------------------------------------------------------------
-
3630 {"ledger_header: ledger index.",
-
3631 __LINE__,
-
3632 {"ledger_header", "4294967295"},
- -
3634 R"({
-
3635 "method" : "ledger_header",
-
3636 "params" : [
-
3637 {
-
3638 "api_version" : %API_VER%,
-
3639 "ledger_index" : 4294967295
-
3640 }
-
3641 ]
-
3642 })"},
-
3643 {"ledger_header: ledger hash.",
-
3644 __LINE__,
-
3645 {"ledger_header",
-
3646 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
- -
3648 R"({
-
3649 "method" : "ledger_header",
-
3650 "params" : [
-
3651 {
-
3652 "api_version" : %API_VER%,
-
3653 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
-
3654 }
-
3655 ]
-
3656 })"},
-
3657 {"ledger_header: too few arguments.",
-
3658 __LINE__,
-
3659 {
-
3660 "ledger_header",
-
3661 },
- -
3663 R"({
-
3664 "method" : "ledger_header",
-
3665 "params" : [
-
3666 {
-
3667 "error" : "badSyntax",
-
3668 "error_code" : 1,
-
3669 "error_message" : "Syntax error."
-
3670 }
-
3671 ]
-
3672 })"},
-
3673 {"ledger_header: too many arguments.",
-
3674 __LINE__,
-
3675 {"ledger_header", "4294967295", "spare"},
- -
3677 R"({
-
3678 "method" : "ledger_header",
-
3679 "params" : [
-
3680 {
-
3681 "error" : "badSyntax",
-
3682 "error_code" : 1,
-
3683 "error_message" : "Syntax error."
-
3684 }
-
3685 ]
-
3686 })"},
-
3687 {"ledger_header: text ledger index.",
-
3688 __LINE__,
-
3689 {"ledger_header", "current"},
- -
3691 R"({
-
3692 "method" : "ledger_header",
-
3693 "params" : [
-
3694 {
-
3695 "api_version" : %API_VER%,
-
3696 "ledger_index" : 0
-
3697 }
-
3698 ]
-
3699 })"},
-
3700 {"ledger_header: ledger index too small.",
-
3701 __LINE__,
-
3702 {"ledger_header", "-1"},
- -
3704 R"({
-
3705 "method" : "ledger_header",
-
3706 "params" : [
-
3707 {
-
3708 "api_version" : %API_VER%,
-
3709 "ledger_index" : 0
-
3710 }
-
3711 ]
-
3712 })"},
-
3713 {"ledger_header: ledger index too big.",
-
3714 __LINE__,
-
3715 {"ledger_header", "4294967296"},
- -
3717 R"({
-
3718 "method" : "ledger_header",
-
3719 "params" : [
-
3720 {
-
3721 "api_version" : %API_VER%,
-
3722 "ledger_index" : 0
-
3723 }
-
3724 ]
-
3725 })"},
-
3726
-
3727 // ledger_request
-
3728 // --------------------------------------------------------------
-
3729 {"ledger_request: ledger index.",
-
3730 __LINE__,
-
3731 {"ledger_request", "4294967295"},
- -
3733 R"({
-
3734 "method" : "ledger_request",
-
3735 "params" : [
-
3736 {
-
3737 "api_version" : %API_VER%,
-
3738 "ledger_index" : 4294967295
-
3739 }
-
3740 ]
-
3741 })"},
-
3742 {"ledger_request: ledger hash.",
-
3743 __LINE__,
-
3744 {"ledger_request",
-
3745 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
- -
3747 R"({
-
3748 "method" : "ledger_request",
-
3749 "params" : [
-
3750 {
-
3751 "api_version" : %API_VER%,
-
3752 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
-
3753 }
-
3754 ]
-
3755 })"},
-
3756 {"ledger_request: too few arguments.",
-
3757 __LINE__,
-
3758 {
-
3759 "ledger_request",
-
3760 },
- -
3762 R"({
-
3763 "method" : "ledger_request",
-
3764 "params" : [
-
3765 {
-
3766 "error" : "badSyntax",
-
3767 "error_code" : 1,
-
3768 "error_message" : "Syntax error."
-
3769 }
-
3770 ]
-
3771 })"},
-
3772 {"ledger_request: too many arguments.",
-
3773 __LINE__,
-
3774 {"ledger_request", "4294967295", "spare"},
- -
3776 R"({
-
3777 "method" : "ledger_request",
-
3778 "params" : [
-
3779 {
-
3780 "error" : "badSyntax",
-
3781 "error_code" : 1,
-
3782 "error_message" : "Syntax error."
-
3783 }
-
3784 ]
-
3785 })"},
-
3786 {"ledger_request: text ledger index.",
-
3787 __LINE__,
-
3788 {"ledger_request", "current"},
- -
3790 R"({
-
3791 "method" : "ledger_request",
-
3792 "params" : [
-
3793 {
-
3794 "api_version" : %API_VER%,
-
3795 "ledger_index" : 0
-
3796 }
-
3797 ]
-
3798 })"},
-
3799 {"ledger_request: ledger index too small.",
-
3800 __LINE__,
-
3801 {"ledger_request", "-1"},
- -
3803 R"({
-
3804 "method" : "ledger_request",
-
3805 "params" : [
-
3806 {
-
3807 "api_version" : %API_VER%,
-
3808 "ledger_index" : 0
-
3809 }
-
3810 ]
-
3811 })"},
-
3812 {"ledger_request: ledger index too big.",
-
3813 __LINE__,
-
3814 {"ledger_request", "4294967296"},
- -
3816 R"({
-
3817 "method" : "ledger_request",
-
3818 "params" : [
-
3819 {
-
3820 "api_version" : %API_VER%,
-
3821 "ledger_index" : 0
-
3822 }
-
3823 ]
-
3824 })"},
-
3825
-
3826 // log_level
-
3827 // -------------------------------------------------------------------
-
3828 {"log_level: minimal.",
-
3829 __LINE__,
-
3830 {
-
3831 "log_level",
-
3832 },
- -
3834 R"({
-
3835 "method" : "log_level",
-
3836 "params" : [
-
3837 {
-
3838 "api_version" : %API_VER%,
-
3839 }
-
3840 ]
-
3841 })"},
-
3842 {"log_level: fatal.",
-
3843 __LINE__,
-
3844 {"log_level", "fatal"},
- -
3846 R"({
-
3847 "method" : "log_level",
-
3848 "params" : [
-
3849 {
-
3850 "api_version" : %API_VER%,
-
3851 "severity" : "fatal"
-
3852 }
-
3853 ]
-
3854 })"},
-
3855 {"log_level: error.",
-
3856 __LINE__,
-
3857 {"log_level", "error"},
- -
3859 R"({
-
3860 "method" : "log_level",
-
3861 "params" : [
-
3862 {
-
3863 "api_version" : %API_VER%,
-
3864 "severity" : "error"
-
3865 }
-
3866 ]
-
3867 })"},
-
3868 {"log_level: warn.",
-
3869 __LINE__,
-
3870 {"log_level", "warn"},
- -
3872 R"({
-
3873 "method" : "log_level",
-
3874 "params" : [
-
3875 {
-
3876 "api_version" : %API_VER%,
-
3877 "severity" : "warn"
-
3878 }
-
3879 ]
-
3880 })"},
-
3881 {"log_level: debug.",
-
3882 __LINE__,
-
3883 {"log_level", "debug"},
- -
3885 R"({
-
3886 "method" : "log_level",
-
3887 "params" : [
-
3888 {
-
3889 "api_version" : %API_VER%,
-
3890 "severity" : "debug"
-
3891 }
-
3892 ]
-
3893 })"},
-
3894 {"log_level: trace.",
-
3895 __LINE__,
-
3896 {"log_level", "trace"},
- -
3898 R"({
-
3899 "method" : "log_level",
-
3900 "params" : [
-
3901 {
-
3902 "api_version" : %API_VER%,
-
3903 "severity" : "trace"
-
3904 }
-
3905 ]
-
3906 })"},
-
3907 {"log_level: base partition.",
-
3908 __LINE__,
-
3909 {"log_level", "base", "trace"},
- -
3911 R"({
-
3912 "method" : "log_level",
-
3913 "params" : [
-
3914 {
-
3915 "api_version" : %API_VER%,
-
3916 "partition" : "base",
-
3917 "severity" : "trace"
-
3918 }
-
3919 ]
-
3920 })"},
-
3921 {"log_level: partiton_name.",
-
3922 __LINE__,
-
3923 {"log_level", "partition_name", "fatal"},
- -
3925 R"({
-
3926 "method" : "log_level",
-
3927 "params" : [
-
3928 {
-
3929 "api_version" : %API_VER%,
-
3930 "partition" : "partition_name",
-
3931 "severity" : "fatal"
-
3932 }
-
3933 ]
-
3934 })"},
-
3935 {"log_level: too many arguments.",
-
3936 __LINE__,
-
3937 {"log_level", "partition_name", "fatal", "extra"},
- -
3939 R"({
-
3940 "method" : "log_level",
-
3941 "params" : [
-
3942 {
-
3943 "error" : "badSyntax",
-
3944 "error_code" : 1,
-
3945 "error_message" : "Syntax error."
-
3946 }
-
3947 ]
-
3948 })"},
-
3949 {"log_level: invalid severity.",
-
3950 __LINE__,
-
3951 {"log_level", "err"},
- -
3953 R"({
-
3954 "method" : "log_level",
-
3955 "params" : [
-
3956 {
-
3957 "api_version" : %API_VER%,
-
3958 "severity" : "err"
-
3959 }
-
3960 ]
-
3961 })"},
-
3962 {"log_level: swap partition name and severity.",
-
3963 __LINE__,
-
3964 {
-
3965 "log_level",
-
3966 "fatal",
-
3967 "partition_name",
-
3968 },
- -
3970 R"({
-
3971 "method" : "log_level",
-
3972 "params" : [
-
3973 {
-
3974 "api_version" : %API_VER%,
-
3975 "partition" : "fatal",
-
3976 "severity" : "partition_name"
-
3977 }
-
3978 ]
-
3979 })"},
-
3980
-
3981 // logrotate
-
3982 // -------------------------------------------------------------------
-
3983 {"logrotate: minimal.",
-
3984 __LINE__,
-
3985 {
-
3986 "logrotate",
-
3987 },
- -
3989 R"({
-
3990 "method" : "logrotate",
-
3991 "params" : [
-
3992 {
-
3993 "api_version" : %API_VER%,
-
3994 }
-
3995 ]
-
3996 })"},
-
3997 {"logrotate: too many arguments.",
-
3998 __LINE__,
-
3999 {"logrotate", "extra"},
- -
4001 R"({
-
4002 "method" : "logrotate",
-
4003 "params" : [
-
4004 {
-
4005 "error" : "badSyntax",
-
4006 "error_code" : 1,
-
4007 "error_message" : "Syntax error."
-
4008 }
-
4009 ]
-
4010 })"},
-
4011
-
4012 // owner_info
-
4013 // ------------------------------------------------------------------
-
4014 {"owner_info: minimal.",
-
4015 __LINE__,
-
4016 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
- -
4018 R"({
-
4019 "method" : "owner_info",
-
4020 "params" : [
-
4021 {
-
4022 "api_version" : %API_VER%,
-
4023 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
-
4024 }
-
4025 ]
-
4026 })"},
-
4027 {"owner_info: with numeric ledger index.",
-
4028 __LINE__,
-
4029 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "987654321"},
- -
4031 R"({
-
4032 "method" : "owner_info",
-
4033 "params" : [
-
4034 {
-
4035 "api_version" : %API_VER%,
-
4036 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4037 "ledger_index" : 987654321
-
4038 }
-
4039 ]
-
4040 })"},
-
4041 {"owner_info: with text ledger index.",
-
4042 __LINE__,
-
4043 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"},
- -
4045 R"({
-
4046 "method" : "owner_info",
-
4047 "params" : [
-
4048 {
-
4049 "api_version" : %API_VER%,
-
4050 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4051 "ledger_index" : "validated"
-
4052 }
-
4053 ]
-
4054 })"},
-
4055 {"owner_info: with ledger hash.",
-
4056 __LINE__,
-
4057 {"owner_info",
-
4058 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4059 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"},
- -
4061 R"({
-
4062 "method" : "owner_info",
-
4063 "params" : [
-
4064 {
-
4065 "api_version" : %API_VER%,
-
4066 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4067 "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
-
4068 }
-
4069 ]
-
4070 })"},
-
4071 {"owner_info: with ledger index.",
-
4072 __LINE__,
-
4073 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"},
- -
4075 R"({
-
4076 "method" : "owner_info",
-
4077 "params" : [
-
4078 {
-
4079 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4080 "api_version" : %API_VER%,
-
4081 "ledger_index" : "validated"
-
4082 }
-
4083 ]
-
4084 })"},
-
4085 {"owner_info: too few arguments.",
-
4086 __LINE__,
-
4087 {
-
4088 "owner_info",
-
4089 },
- -
4091 R"({
-
4092 "method" : "owner_info",
-
4093 "params" : [
-
4094 {
-
4095 "error" : "badSyntax",
-
4096 "error_code" : 1,
-
4097 "error_message" : "Syntax error."
-
4098 }
-
4099 ]
-
4100 })"},
-
4101 {"owner_info: too many arguments.",
-
4102 __LINE__,
-
4103 {
-
4104 "owner_info",
-
4105 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4106 "current",
-
4107 "extra1",
-
4108 "extra2",
-
4109 },
- -
4111 R"({
-
4112 "method" : "owner_info",
-
4113 "params" : [
-
4114 {
-
4115 "error" : "badSyntax",
-
4116 "error_code" : 1,
-
4117 "error_message" : "Syntax error."
-
4118 }
-
4119 ]
-
4120 })"},
-
4121 {
-
4122 "owner_info: invalid accountID.",
-
4123 __LINE__,
-
4124 {
-
4125 "owner_info",
-
4126 "", // Note: very few values are detected as bad!
-
4127 },
- -
4129 R"({
-
4130 "method" : "owner_info",
-
4131 "params" : [
-
4132 {
-
4133 "error" : "actMalformed",
-
4134 "error_code" : 35,
-
4135 "error_message" : "Account malformed."
-
4136 }
-
4137 ]
-
4138 })",
-
4139 },
-
4140 {
-
4141 // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
-
4142 // cannot currently occur because jvParseLedger() always returns true.
-
4143 "owner_info: invalid ledger selection.",
-
4144 __LINE__,
-
4145 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"},
- -
4147 R"({
-
4148 "method" : "owner_info",
-
4149 "params" : [
-
4150 {
-
4151 "api_version" : %API_VER%,
-
4152 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4153 "ledger_index" : 0
-
4154 }
-
4155 ]
-
4156 })",
-
4157 },
-
4158 {
-
4159 // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
-
4160 // cannot currently occur because jvParseLedger() always returns true.
-
4161 "owner_info: invalid ledger selection.",
-
4162 __LINE__,
-
4163 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"},
- -
4165 R"({
-
4166 "method" : "owner_info",
-
4167 "params" : [
-
4168 {
-
4169 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4170 "api_version" : %API_VER%,
-
4171 "ledger_index" : 0
-
4172 }
-
4173 ]
-
4174 })",
-
4175 },
-
4176
-
4177 // peers
-
4178 // -----------------------------------------------------------------------
-
4179 {"peers: minimal.",
-
4180 __LINE__,
-
4181 {
-
4182 "peers",
-
4183 },
- -
4185 R"({
-
4186 "method" : "peers",
-
4187 "params" : [
-
4188 {
-
4189 "api_version" : %API_VER%,
-
4190 }
-
4191 ]
-
4192 })"},
-
4193 {"peers: too many arguments.",
-
4194 __LINE__,
-
4195 {"peers", "extra"},
- -
4197 R"({
-
4198 "method" : "peers",
-
4199 "params" : [
-
4200 {
-
4201 "error" : "badSyntax",
-
4202 "error_code" : 1,
-
4203 "error_message" : "Syntax error."
-
4204 }
-
4205 ]
-
4206 })"},
-
4207
-
4208 // peer_reservations_add
-
4209 // -------------------------------------------------------
-
4210 {"peer_reservations_add: minimal.",
-
4211 __LINE__,
-
4212 {"peer_reservations_add", "public_key_string"},
- -
4214 R"({
-
4215 "method" : "peer_reservations_add",
-
4216 "params" : [
-
4217 {
-
4218 "api_version" : %API_VER%,
-
4219 "public_key" : "public_key_string"
-
4220 }
-
4221 ]
-
4222 })"},
-
4223 {"peer_reservations_add: with description.",
-
4224 __LINE__,
-
4225 {"peer_reservations_add", "public_key_string", "public_key_description"},
- -
4227 R"({
-
4228 "method" : "peer_reservations_add",
-
4229 "params" : [
-
4230 {
-
4231 "api_version" : %API_VER%,
-
4232 "description" : "public_key_description",
-
4233 "public_key" : "public_key_string"
-
4234 }
-
4235 ]
-
4236 })"},
-
4237 {"peer_reservations_add: too few arguments.",
-
4238 __LINE__,
-
4239 {"peer_reservations_add"},
- -
4241 R"({
-
4242 "method" : "peer_reservations_add",
-
4243 "params" : [
-
4244 {
-
4245 "error" : "badSyntax",
-
4246 "error_code" : 1,
-
4247 "error_message" : "Syntax error."
-
4248 }
-
4249 ]
-
4250 })"},
-
4251 {"peer_reservations_add: too many arguments.",
-
4252 __LINE__,
-
4253 {"peer_reservations_add",
-
4254 "public_key_string",
-
4255 "public_key_description",
-
4256 "spare"},
- -
4258 R"({
-
4259 "method" : "peer_reservations_add",
-
4260 "params" : [
-
4261 {
-
4262 "error" : "badSyntax",
-
4263 "error_code" : 1,
-
4264 "error_message" : "Syntax error."
-
4265 }
-
4266 ]
-
4267 })"},
-
4268
-
4269 // peer_reservations_del
-
4270 // -------------------------------------------------------
-
4271 {"peer_reservations_del: minimal.",
-
4272 __LINE__,
-
4273 {"peer_reservations_del", "public_key_string"},
- -
4275 R"({
-
4276 "method" : "peer_reservations_del",
-
4277 "params" : [
-
4278 {
-
4279 "api_version" : %API_VER%,
-
4280 "public_key" : "public_key_string"
-
4281 }
-
4282 ]
-
4283 })"},
-
4284 {"peer_reservations_del: too few arguments.",
-
4285 __LINE__,
-
4286 {"peer_reservations_del"},
- -
4288 R"({
-
4289 "method" : "peer_reservations_del",
-
4290 "params" : [
-
4291 {
-
4292 "error" : "badSyntax",
-
4293 "error_code" : 1,
-
4294 "error_message" : "Syntax error."
-
4295 }
-
4296 ]
-
4297 })"},
-
4298 {"peer_reservations_del: too many arguments.",
-
4299 __LINE__,
-
4300 {"peer_reservations_del",
-
4301 "public_key_string",
-
4302 "public_key_description",
-
4303 "spare"},
- -
4305 R"({
-
4306 "method" : "peer_reservations_del",
-
4307 "params" : [
-
4308 {
-
4309 "error" : "badSyntax",
-
4310 "error_code" : 1,
-
4311 "error_message" : "Syntax error."
-
4312 }
-
4313 ]
-
4314 })"},
-
4315
-
4316 // ping
-
4317 // ------------------------------------------------------------------------
-
4318 {"ping: minimal.",
-
4319 __LINE__,
-
4320 {
-
4321 "ping",
-
4322 },
- -
4324 R"({
-
4325 "method" : "ping",
-
4326 "params" : [
-
4327 {
-
4328 "api_version" : %API_VER%,
-
4329 }
-
4330 ]
-
4331 })"},
-
4332 {"ping: too many arguments.",
-
4333 __LINE__,
-
4334 {"ping", "extra"},
- -
4336 R"({
-
4337 "method" : "ping",
-
4338 "params" : [
-
4339 {
-
4340 "error" : "badSyntax",
-
4341 "error_code" : 1,
-
4342 "error_message" : "Syntax error."
-
4343 }
-
4344 ]
-
4345 })"},
-
4346
-
4347 // print
-
4348 // -----------------------------------------------------------------------
-
4349 {"print: minimal.",
-
4350 __LINE__,
-
4351 {
-
4352 "print",
-
4353 },
- -
4355 R"({
-
4356 "method" : "print",
-
4357 "params" : [
-
4358 {
-
4359 "api_version" : %API_VER%,
-
4360 }
-
4361 ]
-
4362 })"},
-
4363 {// The docs indicate that no arguments are allowed. So should this error?
-
4364 "print: extra argument.",
-
4365 __LINE__,
-
4366 {"print", "extra"},
- -
4368 R"({
-
4369 "method" : "print",
-
4370 "params" : [
-
4371 {
-
4372 "api_version" : %API_VER%,
-
4373 "params" : [ "extra" ]
-
4374 }
-
4375 ]
-
4376 })"},
-
4377 {"print: too many arguments.",
-
4378 __LINE__,
-
4379 {"print", "extra1", "extra2"},
- -
4381 R"({
-
4382 "method" : "print",
-
4383 "params" : [
-
4384 {
-
4385 "error" : "badSyntax",
-
4386 "error_code" : 1,
-
4387 "error_message" : "Syntax error."
-
4388 }
-
4389 ]
-
4390 })"},
-
4391
-
4392 // random
-
4393 // ----------------------------------------------------------------------
-
4394 {"random: minimal.",
-
4395 __LINE__,
-
4396 {
-
4397 "random",
-
4398 },
- -
4400 R"({
-
4401 "method" : "random",
-
4402 "params" : [
-
4403 {
-
4404 "api_version" : %API_VER%,
-
4405 }
-
4406 ]
-
4407 })"},
-
4408 {"random: too many arguments.",
-
4409 __LINE__,
-
4410 {"random", "extra"},
- -
4412 R"({
-
4413 "method" : "random",
-
4414 "params" : [
-
4415 {
-
4416 "error" : "badSyntax",
-
4417 "error_code" : 1,
-
4418 "error_message" : "Syntax error."
-
4419 }
-
4420 ]
-
4421 })"},
-
4422
-
4423 // ripple_path_find
-
4424 // ------------------------------------------------------------
-
4425 {"ripple_path_find: minimal.",
-
4426 __LINE__,
-
4427 {
-
4428 "ripple_path_find",
-
4429 R"({"json_argument":true})",
-
4430 },
- -
4432 R"({
-
4433 "method" : "ripple_path_find",
-
4434 "params" : [
-
4435 {
-
4436 "api_version" : %API_VER%,
-
4437 "json_argument" : true
-
4438 }
-
4439 ]
-
4440 })"},
-
4441 {"ripple_path_find: ledger index.",
-
4442 __LINE__,
-
4443 {"ripple_path_find", R"({"json_argument":true})", "4294967295"},
- -
4445 R"({
-
4446 "method" : "ripple_path_find",
-
4447 "params" : [
-
4448 {
-
4449 "api_version" : %API_VER%,
-
4450 "json_argument" : true,
-
4451 "ledger_index" : 4294967295
-
4452 }
-
4453 ]
-
4454 })"},
-
4455 {"ripple_path_find: text ledger index.",
-
4456 __LINE__,
-
4457 {"ripple_path_find", R"({"json_argument":true})", "closed"},
- -
4459 R"({
-
4460 "method" : "ripple_path_find",
-
4461 "params" : [
-
4462 {
-
4463 "api_version" : %API_VER%,
-
4464 "json_argument" : true,
-
4465 "ledger_index" : "closed"
-
4466 }
-
4467 ]
-
4468 })"},
-
4469 {"ripple_path_find: ledger hash.",
-
4470 __LINE__,
-
4471 {"ripple_path_find",
-
4472 R"({"json_argument":true})",
-
4473 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"},
- -
4475 R"({
-
4476 "method" : "ripple_path_find",
-
4477 "params" : [
-
4478 {
-
4479 "api_version" : %API_VER%,
-
4480 "json_argument" : true,
-
4481 "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
-
4482 }
-
4483 ]
-
4484 })"},
-
4485
-
4486 {"ripple_path_find: too few arguments.",
-
4487 __LINE__,
-
4488 {
-
4489 "ripple_path_find",
-
4490 },
- -
4492 R"({
-
4493 "method" : "ripple_path_find",
-
4494 "params" : [
-
4495 {
-
4496 "error" : "badSyntax",
-
4497 "error_code" : 1,
-
4498 "error_message" : "Syntax error."
-
4499 }
-
4500 ]
-
4501 })"},
-
4502 {"ripple_path_find: too many arguments.",
-
4503 __LINE__,
-
4504 {"ripple_path_find", R"({"json_argument":true})", "current", "extra"},
- -
4506 R"({
-
4507 "method" : "ripple_path_find",
-
4508 "params" : [
-
4509 {
-
4510 "error" : "badSyntax",
-
4511 "error_code" : 1,
-
4512 "error_message" : "Syntax error."
-
4513 }
-
4514 ]
-
4515 })"},
-
4516 {"ripple_path_find: invalid json (note extra comma).",
-
4517 __LINE__,
-
4518 {
-
4519 "ripple_path_find",
-
4520 R"({"json_argument":true,})",
-
4521 },
- -
4523 R"({
-
4524 "method" : "ripple_path_find",
-
4525 "params" : [
-
4526 {
-
4527 "error" : "invalidParams",
-
4528 "error_code" : 31,
-
4529 "error_message" : "Invalid parameters."
-
4530 }
-
4531 ]
-
4532 })"},
-
4533 {"ripple_path_find: ledger index too small.",
-
4534 __LINE__,
-
4535 {"ripple_path_find", R"({"json_argument":true})", "-1"},
- -
4537 R"({
-
4538 "method" : "ripple_path_find",
-
4539 "params" : [
-
4540 {
-
4541 "api_version" : %API_VER%,
-
4542 "json_argument" : true,
-
4543 "ledger_index" : 0
-
4544 }
-
4545 ]
-
4546 })"},
-
4547 {"ripple_path_find: ledger index too big.",
-
4548 __LINE__,
-
4549 {"ripple_path_find", R"({"json_argument":true})", "4294967296"},
- -
4551 R"({
-
4552 "method" : "ripple_path_find",
-
4553 "params" : [
-
4554 {
-
4555 "api_version" : %API_VER%,
-
4556 "json_argument" : true,
-
4557 "ledger_index" : 0
-
4558 }
-
4559 ]
-
4560 })"},
-
4561 {"ripple_path_find: invalid text ledger index.",
-
4562 __LINE__,
-
4563 {"ripple_path_find", R"({"json_argument":true})", "cur"},
- -
4565 R"({
-
4566 "method" : "ripple_path_find",
-
4567 "params" : [
-
4568 {
-
4569 "api_version" : %API_VER%,
-
4570 "json_argument" : true,
-
4571 "ledger_index" : 0
-
4572 }
-
4573 ]
-
4574 })"},
-
4575
-
4576 // sign
-
4577 // ------------------------------------------------------------------------
-
4578 {"sign: minimal.",
-
4579 __LINE__,
-
4580 {
-
4581 "sign",
-
4582 "my_secret",
-
4583 R"({"json_argument":true})",
-
4584 },
- -
4586 R"({
-
4587 "method" : "sign",
-
4588 "params" : [
-
4589 {
-
4590 "api_version" : %API_VER%,
-
4591 "secret" : "my_secret",
-
4592 "tx_json" : {
-
4593 "json_argument" : true
-
4594 }
-
4595 }
-
4596 ]
-
4597 })"},
-
4598 {"sign: offline.",
-
4599 __LINE__,
-
4600 {"sign", "my_secret", R"({"json_argument":true})", "offline"},
- -
4602 R"({
-
4603 "method" : "sign",
-
4604 "params" : [
-
4605 {
-
4606 "api_version" : %API_VER%,
-
4607 "offline" : true,
-
4608 "secret" : "my_secret",
-
4609 "tx_json" : {
-
4610 "json_argument" : true
-
4611 }
-
4612 }
-
4613 ]
-
4614 })"},
-
4615 {"sign: too few arguments.",
-
4616 __LINE__,
-
4617 {"sign", "contents_of_blob"},
- -
4619 R"({
-
4620 "method" : "sign",
-
4621 "params" : [
-
4622 {
-
4623 "error" : "badSyntax",
-
4624 "error_code" : 1,
-
4625 "error_message" : "Syntax error."
-
4626 }
-
4627 ]
-
4628 })"},
-
4629 {"sign: offline flag with signature_target.",
-
4630 __LINE__,
-
4631 {"sign", "my_secret", R"({"json_argument":true})", "offline", "extra"},
- -
4633 R"({
-
4634 "method" : "sign",
-
4635 "params" : [
-
4636 {
-
4637 "api_version" : %API_VER%,
-
4638 "offline" : true,
-
4639 "secret" : "my_secret",
-
4640 "signature_target" : "extra",
-
4641 "tx_json" :
-
4642 {
-
4643 "json_argument" : true
-
4644 }
-
4645 }
-
4646 ]
-
4647 })"},
-
4648 {"sign: too many arguments.",
-
4649 __LINE__,
-
4650 {"sign",
-
4651 "my_secret",
-
4652 R"({"json_argument":true})",
-
4653 "offline",
-
4654 "CounterpartySignature",
-
4655 "extra"},
- -
4657 R"({
-
4658 "method" : "sign",
-
4659 "params" : [
-
4660 {
-
4661 "error" : "badSyntax",
-
4662 "error_code" : 1,
-
4663 "error_message" : "Syntax error."
-
4664 }
-
4665 ]
-
4666 })"},
-
4667 {"sign: invalid JSON (note extra comma).",
-
4668 __LINE__,
-
4669 {
-
4670 "sign",
-
4671 "my_secret",
-
4672 R"({"json_argument":true,})",
-
4673 },
- -
4675 R"({
-
4676 "method" : "sign",
-
4677 "params" : [
-
4678 {
-
4679 "error" : "invalidParams",
-
4680 "error_code" : 31,
-
4681 "error_message" : "Invalid parameters."
-
4682 }
-
4683 ]
-
4684 })"},
-
4685 {"sign: misspelled offline flag interpreted as signature_target.",
-
4686 __LINE__,
-
4687 {"sign", "my_secret", R"({"json_argument":true})", "offlin"},
- -
4689 R"({
-
4690 "method" : "sign",
-
4691 "params" : [
-
4692 {
-
4693 "api_version" : %API_VER%,
-
4694 "secret" : "my_secret",
-
4695 "signature_target" : "offlin",
-
4696 "tx_json" :
-
4697 {
-
4698 "json_argument" : true
-
4699 }
-
4700 }
-
4701 ]
-
4702 })"},
-
4703
-
4704 // sign_for
-
4705 // --------------------------------------------------------------------
-
4706 {"sign_for: minimal.",
-
4707 __LINE__,
-
4708 {
-
4709 "sign_for",
-
4710 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4711 "my_secret",
-
4712 R"({"json_argument":true})",
-
4713 },
- -
4715 R"({
-
4716 "method" : "sign_for",
-
4717 "params" : [
-
4718 {
-
4719 "api_version" : %API_VER%,
-
4720 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4721 "secret" : "my_secret",
-
4722 "tx_json" : {
-
4723 "json_argument" : true
-
4724 }
-
4725 }
-
4726 ]
-
4727 })"},
-
4728 {"sign_for: offline.",
-
4729 __LINE__,
-
4730 {"sign_for",
-
4731 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4732 "my_secret",
-
4733 R"({"json_argument":true})",
-
4734 "offline"},
- -
4736 R"({
-
4737 "method" : "sign_for",
-
4738 "params" : [
-
4739 {
-
4740 "api_version" : %API_VER%,
-
4741 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4742 "offline" : true,
-
4743 "secret" : "my_secret",
-
4744 "tx_json" : {
-
4745 "json_argument" : true
-
4746 }
-
4747 }
-
4748 ]
-
4749 })"},
-
4750 {"sign_for: too few arguments.",
-
4751 __LINE__,
-
4752 {
-
4753 "sign_for",
-
4754 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4755 "my_secret",
-
4756 },
- -
4758 R"({
-
4759 "method" : "sign_for",
-
4760 "params" : [
-
4761 {
-
4762 "error" : "badSyntax",
-
4763 "error_code" : 1,
-
4764 "error_message" : "Syntax error."
-
4765 }
-
4766 ]
-
4767 })"},
-
4768 {"sign_for: too many arguments.",
-
4769 __LINE__,
-
4770 {"sign_for",
-
4771 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4772 "my_secret",
-
4773 R"({"json_argument":true})",
-
4774 "offline",
-
4775 "extra"},
- -
4777 R"({
-
4778 "method" : "sign_for",
-
4779 "params" : [
-
4780 {
-
4781 "error" : "badSyntax",
-
4782 "error_code" : 1,
-
4783 "error_message" : "Syntax error."
-
4784 }
-
4785 ]
-
4786 })"},
-
4787 {"sign_for: invalid json (note extra comma).",
-
4788 __LINE__,
-
4789 {
-
4790 "sign_for",
-
4791 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4792 "my_secret",
-
4793 R"({"json_argument":true,})",
-
4794 },
- -
4796 R"({
-
4797 "method" : "sign_for",
-
4798 "params" : [
-
4799 {
-
4800 "error" : "invalidParams",
-
4801 "error_code" : 31,
-
4802 "error_message" : "Invalid parameters."
-
4803 }
-
4804 ]
-
4805 })"},
-
4806 {"sign_for: invalid final argument.",
-
4807 __LINE__,
-
4808 {"sign_for",
-
4809 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
-
4810 "my_secret",
-
4811 R"({"json_argument":true})",
-
4812 "ofline"},
- -
4814 R"({
-
4815 "method" : "sign_for",
-
4816 "params" : [
-
4817 {
-
4818 "error" : "invalidParams",
-
4819 "error_code" : 31,
-
4820 "error_message" : "Invalid parameters."
-
4821 }
-
4822 ]
-
4823 })"},
-
4824
-
4825 // submit
-
4826 // ----------------------------------------------------------------------
-
4827 {"submit: blob.",
-
4828 __LINE__,
-
4829 {"submit", "the blob is unvalidated and may be any length..."},
- -
4831 R"({
-
4832 "method" : "submit",
-
4833 "params" : [
-
4834 {
-
4835 "api_version" : %API_VER%,
-
4836 "tx_blob" : "the blob is unvalidated and may be any length..."
-
4837 }
-
4838 ]
-
4839 })"},
-
4840 {"submit: json.",
-
4841 __LINE__,
-
4842 {
-
4843 "submit",
-
4844 "my_secret",
-
4845 R"({"json_argument":true})",
-
4846 },
- -
4848 R"({
-
4849 "method" : "submit",
-
4850 "params" : [
-
4851 {
-
4852 "api_version" : %API_VER%,
-
4853 "secret" : "my_secret",
-
4854 "tx_json" : {
-
4855 "json_argument" : true
-
4856 }
-
4857 }
-
4858 ]
-
4859 })"},
-
4860 {"submit: too few arguments.",
-
4861 __LINE__,
-
4862 {
-
4863 "submit",
-
4864 },
- -
4866 R"({
-
4867 "method" : "submit",
-
4868 "params" : [
-
4869 {
-
4870 "error" : "badSyntax",
-
4871 "error_code" : 1,
-
4872 "error_message" : "Syntax error."
-
4873 }
-
4874 ]
-
4875 })"},
-
4876 {// Note: I believe this _ought_ to be detected as too many arguments.
-
4877 "submit: four arguments.",
-
4878 __LINE__,
-
4879 {"submit", "my_secret", R"({"json_argument":true})", "offline"},
- -
4881 R"({
-
4882 "method" : "submit",
-
4883 "params" : [
-
4884 {
-
4885 "api_version" : %API_VER%,
-
4886 "offline" : true,
-
4887 "secret" : "my_secret",
-
4888 "tx_json" : {
-
4889 "json_argument" : true
-
4890 }
-
4891 }
-
4892 ]
-
4893 })"},
-
4894 {"submit: offline flag with signature_target.",
-
4895 __LINE__,
-
4896 {"submit", "my_secret", R"({"json_argument":true})", "offline", "extra"},
- -
4898 R"({
-
4899 "method" : "submit",
-
4900 "params" : [
-
4901 {
-
4902 "api_version" : %API_VER%,
-
4903 "offline" : true,
-
4904 "secret" : "my_secret",
-
4905 "signature_target" : "extra",
-
4906 "tx_json" :
-
4907 {
-
4908 "json_argument" : true
-
4909 }
-
4910 }
-
4911 ]
-
4912 })"},
-
4913 {"submit: too many arguments.",
-
4914 __LINE__,
-
4915 {"submit",
-
4916 "my_secret",
-
4917 R"({"json_argument":true})",
-
4918 "offline",
-
4919 "CounterpartySignature",
-
4920 "extra"},
- -
4922 R"({
-
4923 "method" : "submit",
-
4924 "params" : [
-
4925 {
-
4926 "error" : "badSyntax",
-
4927 "error_code" : 1,
-
4928 "error_message" : "Syntax error."
-
4929 }
-
4930 ]
-
4931 })"},
-
4932 {"submit: invalid json (note extra comma).",
-
4933 __LINE__,
-
4934 {
-
4935 "submit",
-
4936 "my_secret",
-
4937 R"({"json_argument":true,})",
-
4938 },
- -
4940 R"({
-
4941 "method" : "submit",
-
4942 "params" : [
-
4943 {
-
4944 "error" : "invalidParams",
-
4945 "error_code" : 31,
-
4946 "error_message" : "Invalid parameters."
-
4947 }
-
4948 ]
-
4949 })"},
-
4950 {"submit: misspelled offline flag interpreted as signature_target.",
-
4951 __LINE__,
-
4952 {"submit", "my_secret", R"({"json_argument":true})", "offlne"},
- -
4954 R"({
-
4955 "method" : "submit",
-
4956 "params" : [
-
4957 {
-
4958 "api_version" : %API_VER%,
-
4959 "secret" : "my_secret",
-
4960 "signature_target" : "offlne",
-
4961 "tx_json" :
-
4962 {
-
4963 "json_argument" : true
-
4964 }
-
4965 }
-
4966 ]
-
4967 })"},
-
4968
-
4969 // submit_multisigned
-
4970 // ----------------------------------------------------------
-
4971 {"submit_multisigned: json.",
-
4972 __LINE__,
-
4973 {
-
4974 "submit_multisigned",
-
4975 R"({"json_argument":true})",
-
4976 },
- -
4978 R"({
-
4979 "method" : "submit_multisigned",
-
4980 "params" : [
-
4981 {
-
4982 "api_version" : %API_VER%,
-
4983 "tx_json" : {
-
4984 "json_argument" : true
-
4985 }
-
4986 }
-
4987 ]
-
4988 })"},
-
4989 {"submit_multisigned: too few arguments.",
-
4990 __LINE__,
-
4991 {
-
4992 "submit_multisigned",
-
4993 },
- -
4995 R"({
-
4996 "method" : "submit_multisigned",
-
4997 "params" : [
-
4998 {
-
4999 "error" : "badSyntax",
-
5000 "error_code" : 1,
-
5001 "error_message" : "Syntax error."
-
5002 }
-
5003 ]
-
5004 })"},
-
5005 {"submit_multisigned: too many arguments.",
-
5006 __LINE__,
-
5007 {"submit_multisigned", R"({"json_argument":true})", "extra"},
- -
5009 R"({
-
5010 "method" : "submit_multisigned",
-
5011 "params" : [
-
5012 {
-
5013 "error" : "badSyntax",
-
5014 "error_code" : 1,
-
5015 "error_message" : "Syntax error."
-
5016 }
-
5017 ]
-
5018 })"},
-
5019 {"submit_multisigned: invalid json (note extra comma).",
-
5020 __LINE__,
-
5021 {
-
5022 "submit_multisigned",
-
5023 R"({"json_argument":true,})",
-
5024 },
- -
5026 R"({
-
5027 "method" : "submit_multisigned",
-
5028 "params" : [
-
5029 {
-
5030 "error" : "invalidParams",
-
5031 "error_code" : 31,
-
5032 "error_message" : "Invalid parameters."
-
5033 }
-
5034 }
-
5035 ]
-
5036 })"},
-
5037
-
5038 // server_info
-
5039 // -----------------------------------------------------------------
-
5040 {"server_info: minimal.",
-
5041 __LINE__,
-
5042 {
-
5043 "server_info",
-
5044 },
- -
5046 R"({
-
5047 "method" : "server_info",
-
5048 "params" : [
-
5049 {
-
5050 "api_version" : %API_VER%,
-
5051 }
-
5052 ]
-
5053 })"},
-
5054 {"server_info: counters.",
-
5055 __LINE__,
-
5056 {"server_info", "counters"},
- -
5058 R"({
-
5059 "method" : "server_info",
-
5060 "params" : [
-
5061 {
-
5062 "api_version" : %API_VER%,
-
5063 "counters" : true
-
5064 }
-
5065 ]
-
5066 })"},
-
5067 {"server_info: too many arguments.",
-
5068 __LINE__,
-
5069 {"server_info", "counters", "extra"},
- -
5071 R"({
-
5072 "method" : "server_info",
-
5073 "params" : [
-
5074 {
-
5075 "error" : "badSyntax",
-
5076 "error_code" : 1,
-
5077 "error_message" : "Syntax error."
-
5078 }
-
5079 ]
-
5080 })"},
-
5081 {"server_info: non-counters argument.",
-
5082 __LINE__,
-
5083 {"server_info", "counter"},
- -
5085 R"({
-
5086 "method" : "server_info",
-
5087 "params" : [
-
5088 {
-
5089 "api_version" : %API_VER%,
-
5090 }
-
5091 ]
-
5092 })"},
-
5093
-
5094 // server_state
-
5095 // ----------------------------------------------------------------
-
5096 {"server_state: minimal.",
-
5097 __LINE__,
-
5098 {
-
5099 "server_state",
-
5100 },
- -
5102 R"({
-
5103 "method" : "server_state",
-
5104 "params" : [
-
5105 {
-
5106 "api_version" : %API_VER%,
-
5107 }
-
5108 ]
-
5109 })"},
-
5110 {"server_state: counters.",
-
5111 __LINE__,
-
5112 {"server_state", "counters"},
- -
5114 R"({
-
5115 "method" : "server_state",
-
5116 "params" : [
-
5117 {
-
5118 "api_version" : %API_VER%,
-
5119 "counters" : true
-
5120 }
-
5121 ]
-
5122 })"},
-
5123 {"server_state: too many arguments.",
-
5124 __LINE__,
-
5125 {"server_state", "counters", "extra"},
- -
5127 R"({
-
5128 "method" : "server_state",
-
5129 "params" : [
-
5130 {
-
5131 "error" : "badSyntax",
-
5132 "error_code" : 1,
-
5133 "error_message" : "Syntax error."
-
5134 }
-
5135 ]
-
5136 })"},
-
5137 {"server_state: non-counters argument.",
-
5138 __LINE__,
-
5139 {"server_state", "counter"},
- -
5141 R"({
-
5142 "method" : "server_state",
-
5143 "params" : [
-
5144 {
-
5145 "api_version" : %API_VER%,
-
5146 }
-
5147 ]
-
5148 })"},
-
5149
-
5150 // stop
-
5151 // ------------------------------------------------------------------------
-
5152 {"stop: minimal.",
-
5153 __LINE__,
-
5154 {
-
5155 "stop",
-
5156 },
- -
5158 R"({
-
5159 "method" : "stop",
-
5160 "params" : [
-
5161 {
-
5162 "api_version" : %API_VER%,
-
5163 }
-
5164 ]
-
5165 })"},
-
5166 {"stop: too many arguments.",
-
5167 __LINE__,
-
5168 {"stop", "extra"},
- -
5170 R"({
-
5171 "method" : "stop",
-
5172 "params" : [
-
5173 {
-
5174 "error" : "badSyntax",
-
5175 "error_code" : 1,
-
5176 "error_message" : "Syntax error."
-
5177 }
-
5178 ]
-
5179 })"},
-
5180
-
5181 // transaction_entry
-
5182 // -----------------------------------------------------------
-
5183 {"transaction_entry: ledger index.",
-
5184 __LINE__,
-
5185 {"transaction_entry",
-
5186 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5187 "4294967295"},
- -
5189 R"({
-
5190 "method" : "transaction_entry",
-
5191 "params" : [
-
5192 {
-
5193 "api_version" : %API_VER%,
-
5194 "ledger_index" : 4294967295,
-
5195 "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
-
5196 }
-
5197 ]
-
5198 })"},
-
5199 {"transaction_entry: text ledger index.",
-
5200 __LINE__,
-
5201 {"transaction_entry",
-
5202 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5203 "current"},
- -
5205 R"({
-
5206 "method" : "transaction_entry",
-
5207 "params" : [
-
5208 {
-
5209 "api_version" : %API_VER%,
-
5210 "ledger_index" : "current",
-
5211 "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
-
5212 }
-
5213 ]
-
5214 })"},
-
5215 {"transaction_entry: ledger hash.",
-
5216 __LINE__,
-
5217 {"transaction_entry",
-
5218 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5219 "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210"},
- -
5221 R"({
-
5222 "method" : "transaction_entry",
-
5223 "params" : [
-
5224 {
-
5225 "api_version" : %API_VER%,
-
5226 "ledger_hash" : "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210",
-
5227 "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
-
5228 }
-
5229 ]
-
5230 })"},
-
5231 {"transaction_entry: too few arguments.",
-
5232 __LINE__,
-
5233 {
-
5234 "transaction_entry",
-
5235 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5236 },
- -
5238 R"({
-
5239 "method" : "transaction_entry",
-
5240 "params" : [
-
5241 {
-
5242 "error" : "badSyntax",
-
5243 "error_code" : 1,
-
5244 "error_message" : "Syntax error."
-
5245 }
-
5246 ]
-
5247 })"},
-
5248 {"transaction_entry: too many arguments.",
-
5249 __LINE__,
-
5250 {"transaction_entry",
-
5251 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5252 "validated",
-
5253 "extra"},
- -
5255 R"({
-
5256 "method" : "transaction_entry",
-
5257 "params" : [
-
5258 {
-
5259 "error" : "badSyntax",
-
5260 "error_code" : 1,
-
5261 "error_message" : "Syntax error."
-
5262 }
-
5263 ]
-
5264 })"},
-
5265 {"transaction_entry: short tx_hash.",
-
5266 __LINE__,
-
5267 {
-
5268 "transaction_entry",
-
5269 "123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5270 "validated",
-
5271 },
- -
5273 R"({
-
5274 "method" : "transaction_entry",
-
5275 "params" : [
-
5276 {
-
5277 "error" : "invalidParams",
-
5278 "error_code" : 31,
-
5279 "error_message" : "Invalid parameters."
-
5280 }
-
5281 ]
-
5282 })"},
-
5283 {"transaction_entry: long tx_hash.",
-
5284 __LINE__,
-
5285 {
-
5286 "transaction_entry",
-
5287 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUVW",
-
5288 "validated",
-
5289 },
- -
5291 R"({
-
5292 "method" : "transaction_entry",
-
5293 "params" : [
-
5294 {
-
5295 "error" : "invalidParams",
-
5296 "error_code" : 31,
-
5297 "error_message" : "Invalid parameters."
-
5298 }
-
5299 ]
-
5300 })"},
-
5301 {"transaction_entry: small ledger index.",
-
5302 __LINE__,
-
5303 {
-
5304 "transaction_entry",
-
5305 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5306 "0",
-
5307 },
- -
5309 R"({
-
5310 "method" : "transaction_entry",
-
5311 "params" : [
-
5312 {
-
5313 "error" : "invalidParams",
-
5314 "error_code" : 31,
-
5315 "error_message" : "Invalid parameters."
-
5316 }
-
5317 ]
-
5318 })"},
-
5319 {"transaction_entry: large ledger index.",
-
5320 __LINE__,
-
5321 {
-
5322 "transaction_entry",
-
5323 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5324 "4294967296",
-
5325 },
- -
5327 R"({
-
5328 "method" : "transaction_entry",
-
5329 "params" : [
-
5330 {
-
5331 "error" : "invalidParams",
-
5332 "error_code" : 31,
-
5333 "error_message" : "Invalid parameters."
-
5334 }
-
5335 ]
-
5336 })"},
-
5337 {"transaction_entry: short ledger hash.",
-
5338 __LINE__,
-
5339 {
-
5340 "transaction_entry",
-
5341 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5342 "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA987654321",
-
5343 },
- -
5345 R"({
-
5346 "method" : "transaction_entry",
-
5347 "params" : [
-
5348 {
-
5349 "error" : "invalidParams",
-
5350 "error_code" : 31,
-
5351 "error_message" : "Invalid parameters."
-
5352 }
-
5353 ]
-
5354 })"},
-
5355 {"transaction_entry: long ledger hash.",
-
5356 __LINE__,
-
5357 {
-
5358 "transaction_entry",
-
5359 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
-
5360 "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210Z",
-
5361 },
- -
5363 R"({
-
5364 "method" : "transaction_entry",
-
5365 "params" : [
-
5366 {
-
5367 "error" : "invalidParams",
-
5368 "error_code" : 31,
-
5369 "error_message" : "Invalid parameters."
-
5370 }
-
5371 ]
-
5372 })"},
-
5373
-
5374 // tx
-
5375 // --------------------------------------------------------------------------
-
5376 {"tx: ctid. minimal",
-
5377 __LINE__,
-
5378 {"tx", "FFFFFFFFFFFFFFFF", "1", "2"},
- -
5380 R"({
-
5381 "method" : "tx",
-
5382 "params" : [
-
5383 {
-
5384 "api_version" : %API_VER%,
-
5385 "ctid" : "FFFFFFFFFFFFFFFF",
-
5386 "max_ledger" : "2",
-
5387 "min_ledger" : "1"
-
5388 }
-
5389 ]
-
5390 })"},
-
5391 {"tx: ctid. binary",
-
5392 __LINE__,
-
5393 {"tx", "FFFFFFFFFFFFFFFF", "binary", "1", "2"},
- -
5395 R"({
-
5396 "method" : "tx",
-
5397 "params" : [
-
5398 {
-
5399 "api_version" : %API_VER%,
-
5400 "binary" : true,
-
5401 "ctid" : "FFFFFFFFFFFFFFFF",
-
5402 "max_ledger" : "2",
-
5403 "min_ledger" : "1"
-
5404 }
-
5405 ]
-
5406 })"},
-
5407 {"tx: minimal.",
-
5408 __LINE__,
-
5409 {"tx", "transaction_hash_is_not_validated"},
- -
5411 R"({
-
5412 "method" : "tx",
-
5413 "params" : [
-
5414 {
-
5415 "api_version" : %API_VER%,
-
5416 "transaction" : "transaction_hash_is_not_validated"
-
5417 }
-
5418 ]
-
5419 })"},
-
5420 {"tx: binary.",
-
5421 __LINE__,
-
5422 {"tx", "transaction_hash_is_not_validated", "binary"},
- -
5424 R"({
-
5425 "method" : "tx",
-
5426 "params" : [
-
5427 {
-
5428 "api_version" : %API_VER%,
-
5429 "binary" : true,
-
5430 "transaction" : "transaction_hash_is_not_validated"
-
5431 }
-
5432 ]
-
5433 })"},
-
5434 {"tx: too few arguments.",
-
5435 __LINE__,
-
5436 {
-
5437 "tx",
-
5438 },
- -
5440 R"({
-
5441 "method" : "tx",
-
5442 "params" : [
-
5443 {
-
5444 "error" : "badSyntax",
-
5445 "error_code" : 1,
-
5446 "error_message" : "Syntax error."
-
5447 }
-
5448 ]
-
5449 })"},
-
5450 {"tx: too many arguments.",
-
5451 __LINE__,
-
5452 {"tx", "transaction_hash_is_not_validated", "binary", "1", "2", "extra"},
- -
5454 R"({
-
5455 "method" : "tx",
-
5456 "params" : [
-
5457 {
-
5458 "error" : "badSyntax",
-
5459 "error_code" : 1,
-
5460 "error_message" : "Syntax error."
-
5461 }
-
5462 ]
-
5463 })"},
-
5464 {"tx: invalid final argument is apparently ignored.",
-
5465 __LINE__,
-
5466 {"tx", "transaction_hash_is_not_validated", "bin"},
- -
5468 R"({
-
5469 "method" : "tx",
-
5470 "params" : [
-
5471 {
-
5472 "api_version" : %API_VER%,
-
5473 "transaction" : "transaction_hash_is_not_validated"
-
5474 }
-
5475 ]
-
5476 })"},
-
5477
-
5478 // tx_history
-
5479 // ------------------------------------------------------------------
-
5480 {"tx_history: minimal.",
-
5481 __LINE__,
-
5482 {"tx_history", "0"},
- -
5484 R"({
-
5485 "method" : "tx_history",
-
5486 "params" : [
-
5487 {
-
5488 "api_version" : %API_VER%,
-
5489 "start" : 0
-
5490 }
-
5491 ]
-
5492 })"},
-
5493 {"tx_history: too few arguments.",
-
5494 __LINE__,
-
5495 {
-
5496 "tx_history",
-
5497 },
- -
5499 R"({
-
5500 "method" : "tx_history",
-
5501 "params" : [
-
5502 {
-
5503 "error" : "badSyntax",
-
5504 "error_code" : 1,
-
5505 "error_message" : "Syntax error."
-
5506 }
-
5507 ]
-
5508 })"},
-
5509 {"tx_history: too many arguments.",
-
5510 __LINE__,
-
5511 {"tx_history", "0", "1"},
- -
5513 R"({
-
5514 "method" : "tx_history",
-
5515 "params" : [
-
5516 {
-
5517 "error" : "badSyntax",
-
5518 "error_code" : 1,
-
5519 "error_message" : "Syntax error."
-
5520 }
-
5521 ]
-
5522 })"},
-
5523 {
-
5524 // Note: this really shouldn't throw, but does at the moment.
-
5525 "tx_history: start too small.",
-
5526 __LINE__,
-
5527 {"tx_history", "-1"},
- -
5529 R"()",
-
5530 },
-
5531 {
-
5532 // Note: this really shouldn't throw, but does at the moment.
-
5533 "tx_history: start too big.",
-
5534 __LINE__,
-
5535 {"tx_history", "4294967296"},
- -
5537 R"()",
-
5538 },
-
5539 {
-
5540 // Note: this really shouldn't throw, but does at the moment.
-
5541 "tx_history: start not integer.",
-
5542 __LINE__,
-
5543 {"tx_history", "beginning"},
- -
5545 R"()",
-
5546 },
-
5547
-
5548 // unl_list
-
5549 // --------------------------------------------------------------------
-
5550 {"unl_list: minimal.",
-
5551 __LINE__,
-
5552 {
-
5553 "unl_list",
-
5554 },
- -
5556 R"({
-
5557 "method" : "unl_list",
-
5558 "params" : [
-
5559 {
-
5560 "api_version" : %API_VER%,
-
5561 }
-
5562 ]
-
5563 })"},
-
5564 {"unl_list: too many arguments.",
-
5565 __LINE__,
-
5566 {"unl_list", "extra"},
- -
5568 R"({
-
5569 "method" : "unl_list",
-
5570 "params" : [
-
5571 {
-
5572 "error" : "badSyntax",
-
5573 "error_code" : 1,
-
5574 "error_message" : "Syntax error."
-
5575 }
-
5576 ]
-
5577 })"},
-
5578
-
5579 // validation_create
-
5580 // -----------------------------------------------------------
-
5581 {"validation_create: minimal.",
-
5582 __LINE__,
-
5583 {
-
5584 "validation_create",
-
5585 },
- -
5587 R"({
-
5588 "method" : "validation_create",
-
5589 "params" : [
-
5590 {
-
5591 "api_version" : %API_VER%,
-
5592 }
-
5593 ]
-
5594 })"},
-
5595 {"validation_create: with secret.",
-
5596 __LINE__,
-
5597 {"validation_create", "the form of the secret is not validated"},
- -
5599 R"({
-
5600 "method" : "validation_create",
-
5601 "params" : [
-
5602 {
-
5603 "api_version" : %API_VER%,
-
5604 "secret" : "the form of the secret is not validated"
-
5605 }
-
5606 ]
-
5607 })"},
-
5608 {"validation_create: too many arguments.",
-
5609 __LINE__,
-
5610 {"validation_create", "the form of the secret is not validated", "extra"},
- -
5612 R"({
-
5613 "method" : "validation_create",
-
5614 "params" : [
-
5615 {
-
5616 "error" : "badSyntax",
-
5617 "error_code" : 1,
-
5618 "error_message" : "Syntax error."
-
5619 }
-
5620 ]
-
5621 })"},
-
5622
-
5623 // version
-
5624 // ---------------------------------------------------------------------
-
5625 {"version: minimal.",
-
5626 __LINE__,
-
5627 {
-
5628 "version",
-
5629 },
- -
5631 R"({
-
5632 "method" : "version",
-
5633 "params" : [
-
5634 {
-
5635 "api_version" : %API_VER%,
-
5636 }
-
5637 ]
-
5638 })"},
-
5639 {"version: too many arguments.",
-
5640 __LINE__,
-
5641 {"version", "extra"},
- -
5643 R"({
-
5644 "method" : "version",
-
5645 "params" : [
-
5646 {
-
5647 "error" : "badSyntax",
-
5648 "error_code" : 1,
-
5649 "error_message" : "Syntax error."
-
5650 }
-
5651 ]
-
5652 })"},
-
5653
-
5654 // wallet_propose
-
5655 // --------------------------------------------------------------
-
5656 {"wallet_propose: minimal.",
-
5657 __LINE__,
-
5658 {
-
5659 "wallet_propose",
-
5660 },
- -
5662 R"({
-
5663 "method" : "wallet_propose",
-
5664 "params" : [
-
5665 {
-
5666 "api_version" : %API_VER%,
-
5667 }
-
5668 ]
-
5669 })"},
-
5670 {"wallet_propose: with passphrase.",
-
5671 __LINE__,
-
5672 {"wallet_propose", "the form of the passphrase is not validated"},
- -
5674 R"({
-
5675 "method" : "wallet_propose",
-
5676 "params" : [
-
5677 {
-
5678 "api_version" : %API_VER%,
-
5679 "passphrase" : "the form of the passphrase is not validated"
-
5680 }
-
5681 ]
-
5682 })"},
-
5683 {"wallet_propose: too many arguments.",
-
5684 __LINE__,
-
5685 {"wallet_propose", "the form of the passphrase is not validated", "extra"},
- -
5687 R"({
-
5688 "method" : "wallet_propose",
-
5689 "params" : [
-
5690 {
-
5691 "error" : "badSyntax",
-
5692 "error_code" : 1,
-
5693 "error_message" : "Syntax error."
-
5694 }
-
5695 ]
-
5696 })"},
-
5697
-
5698 // internal
-
5699 // --------------------------------------------------------------------
-
5700 {"internal: minimal.",
-
5701 __LINE__,
-
5702 {"internal", "command_name"},
- -
5704 R"({
-
5705 "method" : "internal",
-
5706 "params" : [
-
5707 {
-
5708 "api_version" : %API_VER%,
-
5709 "internal_command" : "command_name",
-
5710 "params" : []
-
5711 }
-
5712 ]
-
5713 })"},
-
5714 {"internal: with parameters.",
-
5715 __LINE__,
-
5716 {"internal",
-
5717 "command_name",
-
5718 "string_arg",
-
5719 "1",
-
5720 "-1",
-
5721 "4294967296",
-
5722 "3.14159"},
- -
5724 R"({
-
5725 "method" : "internal",
-
5726 "params" : [
-
5727 {
-
5728 "api_version" : %API_VER%,
-
5729 "internal_command" : "command_name",
-
5730 "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ]
-
5731 }
-
5732 ]
-
5733 })"},
-
5734 {"internal: too few arguments.",
-
5735 __LINE__,
-
5736 {
-
5737 "internal",
-
5738 },
- -
5740 R"({
-
5741 "method" : "internal",
-
5742 "params" : [
-
5743 {
-
5744 "error" : "badSyntax",
-
5745 "error_code" : 1,
-
5746 "error_message" : "Syntax error."
-
5747 }
-
5748 ]
-
5749 })"},
-
5750
-
5751 // path_find
-
5752 // -------------------------------------------------------------------
-
5753 {"path_find: minimal.",
-
5754 __LINE__,
-
5755 {
-
5756 "path_find",
-
5757 },
- -
5759 R"({
-
5760 "method" : "path_find",
-
5761 "params" : [
-
5762 {
-
5763 "error" : "noEvents",
-
5764 "error_code" : 7,
-
5765 "error_message" : "Current transport does not support events."
-
5766 }
-
5767 ]
-
5768 })"},
-
5769 {"path_find: with arguments.",
-
5770 __LINE__,
-
5771 {"path_find", "string_arg", "1", "-1", "4294967296", "3.14159"},
- -
5773 R"({
-
5774 "method" : "path_find",
-
5775 "params" : [
-
5776 {
-
5777 "error" : "noEvents",
-
5778 "error_code" : 7,
-
5779 "error_message" : "Current transport does not support events."
-
5780 }
-
5781 ]
-
5782 })"},
-
5783
-
5784 // subscribe
-
5785 // -------------------------------------------------------------------
-
5786 {"subscribe: minimal.",
-
5787 __LINE__,
-
5788 {
-
5789 "subscribe",
-
5790 },
- -
5792 R"({
-
5793 "method" : "subscribe",
-
5794 "params" : [
-
5795 {
-
5796 "error" : "noEvents",
-
5797 "error_code" : 7,
-
5798 "error_message" : "Current transport does not support events."
-
5799 }
-
5800 ]
-
5801 })"},
-
5802 {"subscribe: with arguments.",
-
5803 __LINE__,
-
5804 {"subscribe", "string_arg", "1", "-1", "4294967296", "3.14159"},
- -
5806 R"({
-
5807 "method" : "subscribe",
-
5808 "params" : [
-
5809 {
-
5810 "error" : "noEvents",
-
5811 "error_code" : 7,
-
5812 "error_message" : "Current transport does not support events."
-
5813 }
-
5814 ]
-
5815 })"},
-
5816
-
5817 // unsubscribe
-
5818 // -----------------------------------------------------------------
-
5819 {"unsubscribe: minimal.",
-
5820 __LINE__,
-
5821 {
-
5822 "unsubscribe",
-
5823 },
- -
5825 R"({
-
5826 "method" : "unsubscribe",
-
5827 "params" : [
-
5828 {
-
5829 "error" : "noEvents",
-
5830 "error_code" : 7,
-
5831 "error_message" : "Current transport does not support events."
-
5832 }
-
5833 ]
-
5834 })"},
-
5835 {"unsubscribe: with arguments.",
-
5836 __LINE__,
-
5837 {"unsubscribe", "string_arg", "1", "-1", "4294967296", "3.14159"},
- -
5839 R"({
-
5840 "method" : "unsubscribe",
-
5841 "params" : [
-
5842 {
-
5843 "error" : "noEvents",
-
5844 "error_code" : 7,
-
5845 "error_message" : "Current transport does not support events."
-
5846 }
-
5847 ]
-
5848 })"},
-
5849
-
5850 // unknown_command
-
5851 // -------------------------------------------------------------
-
5852 {"unknown_command: minimal.",
-
5853 __LINE__,
-
5854 {
-
5855 "unknown_command",
-
5856 },
- -
5858 R"({
-
5859 "method" : "unknown_command",
-
5860 "params" : [
-
5861 {
-
5862 "api_version" : %API_VER%,
-
5863 }
-
5864 ]
-
5865 })"},
-
5866 {"unknown_command: with arguments.",
-
5867 __LINE__,
-
5868 {"unknown_command", "string_arg", "1", "-1", "4294967296", "3.14159"},
- -
5870 R"({
-
5871 "method" : "unknown_command",
-
5872 "params" : [
-
5873 {
-
5874 "api_version" : %API_VER%,
-
5875 "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ]
-
5876 }
-
5877 ]
-
5878 })"},
-
5879};
+
1587 "200",
+
1588 },
+ +
1590 R"({
+
1591 "method" : "book_offers",
+
1592 "params" : [
+
1593 {
+
1594 "api_version" : %API_VER%,
+
1595 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1596 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
+
1597 "limit" : 200,
+
1598 "taker_gets" : {
+
1599 "currency" : "EUR",
+
1600 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
+
1601 },
+
1602 "taker_pays" : {
+
1603 "currency" : "USD",
+
1604 "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
+
1605 }
+
1606 }
+
1607 ]
+
1608 })"},
+
1609 {// Note: parser supports "marker", but the docs don't cover it.
+
1610 "book_offers: issuer, ledger hash, limit, and marker.",
+
1611 __LINE__,
+
1612 {"book_offers",
+
1613 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
1614 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1615 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1616 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
+
1617 "200",
+
1618 "0",
+
1619 "MyMarker"},
+ +
1621 R"({
+
1622 "method" : "book_offers",
+
1623 "params" : [
+
1624 {
+
1625 "api_version" : %API_VER%,
+
1626 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1627 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
+
1628 "limit" : 200,
+
1629 "marker" : "MyMarker",
+
1630 "taker_gets" : {
+
1631 "currency" : "EUR",
+
1632 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
+
1633 },
+
1634 "taker_pays" : {
+
1635 "currency" : "USD",
+
1636 "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
+
1637 }
+
1638 }
+
1639 ]
+
1640 })"},
+
1641 {"book_offers: too few arguments.",
+
1642 __LINE__,
+
1643 {
+
1644 "book_offers",
+
1645 },
+ +
1647 R"({
+
1648 "method" : "book_offers",
+
1649 "params" : [
+
1650 {
+
1651 "error" : "badSyntax",
+
1652 "error_code" : 1,
+
1653 "error_message" : "Syntax error."
+
1654 }
+
1655 ]
+
1656 })"},
+
1657 {"book_offers: too many arguments.",
+
1658 __LINE__,
+
1659 {"book_offers",
+
1660 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
1661 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1662 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1663 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
+
1664 "200",
+
1665 "0",
+
1666 "MyMarker",
+
1667 "extra"},
+ +
1669 R"({
+
1670 "method" : "book_offers",
+
1671 "params" : [
+
1672 {
+
1673 "error" : "badSyntax",
+
1674 "error_code" : 1,
+
1675 "error_message" : "Syntax error."
+
1676 }
+
1677 ]
+
1678 })"},
+
1679
+
1680 {"book_offers: taker pays no currency.",
+
1681 __LINE__,
+
1682 {
+
1683 "book_offers",
+
1684 "/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
1685 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1686 },
+ +
1688 R"({
+
1689 "method" : "book_offers",
+
1690 "params" : [
+
1691 {
+
1692 "error" : "invalidParams",
+
1693 "error_code" : 31,
+
1694 "error_message" : "Invalid currency/issuer '/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'"
+
1695 }
+
1696 ]
+
1697 })"},
+
1698 {"book_offers: taker gets no currency.",
+
1699 __LINE__,
+
1700 {
+
1701 "book_offers",
+
1702 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
1703 "/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1704 },
+ +
1706 R"({
+
1707 "method" : "book_offers",
+
1708 "params" : [
+
1709 {
+
1710 "error" : "invalidParams",
+
1711 "error_code" : 31,
+
1712 "error_message" : "Invalid currency/issuer '/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA'"
+
1713 }
+
1714 ]
+
1715 })"},
+
1716 {"book_offers: invalid issuer.",
+
1717 __LINE__,
+
1718 {"book_offers", "USD", "EUR", "not_a_valid_issuer"},
+ +
1720 R"({
+
1721 "method" : "book_offers",
+
1722 "params" : [
+
1723 {
+
1724 "api_version" : %API_VER%,
+
1725 "issuer" : "not_a_valid_issuer",
+
1726 "taker_gets" : {
+
1727 "currency" : "EUR"
+
1728 },
+
1729 "taker_pays" : {
+
1730 "currency" : "USD"
+
1731 }
+
1732 }
+
1733 ]
+
1734 })"},
+
1735 {"book_offers: invalid text ledger index.",
+
1736 __LINE__,
+
1737 {"book_offers",
+
1738 "USD",
+
1739 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1740 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1741 "not_a_ledger"},
+ +
1743 R"({
+
1744 "method" : "book_offers",
+
1745 "params" : [
+
1746 {
+
1747 "api_version" : %API_VER%,
+
1748 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1749 "ledger_index" : 0,
+
1750 "taker_gets" : {
+
1751 "currency" : "EUR",
+
1752 "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
+
1753 },
+
1754 "taker_pays" : {
+
1755 "currency" : "USD"
+
1756 }
+
1757 }
+
1758 ]
+
1759 })"},
+
1760 {// Note: this really shouldn't throw, but does at the moment.
+
1761 "book_offers: non-numeric limit.",
+
1762 __LINE__,
+
1763 {
+
1764 "book_offers",
+
1765 "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
1766 "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1767 "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
+
1768 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
+
1769 "not_a_number",
+
1770 },
+ +
1772 R"({
+
1773 "method" : "book_offers",
+
1774 "params" : [
+
1775 {
+
1776 "error" : "invalidParams",
+
1777 "error_code" : 31,
+
1778 "error_message" : "Invalid field 'limit'."
+
1779 }
+
1780 ]
+
1781 })"},
+
1782
+
1783 // can_delete
+
1784 // ------------------------------------------------------------------
+
1785 {"can_delete: minimal.",
+
1786 __LINE__,
+
1787 {
+
1788 "can_delete",
+
1789 },
+ +
1791 R"({
+
1792 "method" : "can_delete",
+
1793 "params" : [
+
1794 {
+
1795 "api_version" : %API_VER%,
+
1796 }
+
1797 ]
+
1798 })"},
+
1799 {"can_delete: ledger index.",
+
1800 __LINE__,
+
1801 {
+
1802 "can_delete",
+
1803 "4294967295",
+
1804 },
+ +
1806 R"({
+
1807 "method" : "can_delete",
+
1808 "params" : [
+
1809 {
+
1810 "api_version" : %API_VER%,
+
1811 "can_delete" : 4294967295
+
1812 }
+
1813 ]
+
1814 })"},
+
1815 {"can_delete: ledger hash.",
+
1816 __LINE__,
+
1817 {
+
1818 "can_delete",
+
1819 "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210",
+
1820 },
+ +
1822 R"({
+
1823 "method" : "can_delete",
+
1824 "params" : [
+
1825 {
+
1826 "api_version" : %API_VER%,
+
1827 "can_delete" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210"
+
1828 }
+
1829 ]
+
1830 })"},
+
1831 {"can_delete: always.",
+
1832 __LINE__,
+
1833 {
+
1834 "can_delete",
+
1835 "always",
+
1836 },
+ +
1838 R"({
+
1839 "method" : "can_delete",
+
1840 "params" : [
+
1841 {
+
1842 "api_version" : %API_VER%,
+
1843 "can_delete" : "always"
+
1844 }
+
1845 ]
+
1846 })"},
+
1847 {"can_delete: never.",
+
1848 __LINE__,
+
1849 {
+
1850 "can_delete",
+
1851 "never",
+
1852 },
+ +
1854 R"({
+
1855 "method" : "can_delete",
+
1856 "params" : [
+
1857 {
+
1858 "api_version" : %API_VER%,
+
1859 "can_delete" : "never"
+
1860 }
+
1861 ]
+
1862 })"},
+
1863 {"can_delete: now.",
+
1864 __LINE__,
+
1865 {
+
1866 "can_delete",
+
1867 "now",
+
1868 },
+ +
1870 R"({
+
1871 "method" : "can_delete",
+
1872 "params" : [
+
1873 {
+
1874 "api_version" : %API_VER%,
+
1875 "can_delete" : "now"
+
1876 }
+
1877 ]
+
1878 })"},
+
1879 {"can_delete: too many arguments.",
+
1880 __LINE__,
+
1881 {"can_delete", "always", "never"},
+ +
1883 R"({
+
1884 "method" : "can_delete",
+
1885 "params" : [
+
1886 {
+
1887 "error" : "badSyntax",
+
1888 "error_code" : 1,
+
1889 "error_message" : "Syntax error."
+
1890 }
+
1891 ]
+
1892 })"},
+
1893 {"can_delete: invalid argument.",
+
1894 __LINE__,
+
1895 {"can_delete", "invalid"},
+ +
1897 R"({
+
1898 "method" : "can_delete",
+
1899 "params" : [
+
1900 {
+
1901 "api_version" : %API_VER%,
+
1902 "can_delete" : "invalid"
+
1903 }
+
1904 ]
+
1905 })"},
+
1906 {// Note: this should return an error but not throw.
+
1907 "can_delete: ledger index > 32 bits.",
+
1908 __LINE__,
+
1909 {
+
1910 "can_delete",
+
1911 "4294967296",
+
1912 },
+ +
1914 R"()"},
+
1915 {// Note: this really shouldn't throw since it's a legitimate ledger hash.
+
1916 "can_delete: ledger hash with no alphas.",
+
1917 __LINE__,
+
1918 {
+
1919 "can_delete",
+
1920 "0123456701234567012345670123456701234567012345670123456701234567",
+
1921 },
+ +
1923 R"()"},
+
1924
+
1925 // channel_authorize
+
1926 // -----------------------------------------------------------
+
1927 {"channel_authorize: minimal.",
+
1928 __LINE__,
+
1929 {"channel_authorize",
+
1930 "secret_can_be_anything",
+
1931 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
1932 "18446744073709551615"},
+ +
1934 R"({
+
1935 "method" : "channel_authorize",
+
1936 "params" : [
+
1937 {
+
1938 "api_version" : %API_VER%,
+
1939 "amount" : "18446744073709551615",
+
1940 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
1941 "secret" : "secret_can_be_anything"
+
1942 }
+
1943 ]
+
1944 })"},
+
1945 {"channel_authorize: too few arguments.",
+
1946 __LINE__,
+
1947 {
+
1948 "channel_authorize",
+
1949 "secret_can_be_anything",
+
1950 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
1951 },
+ +
1953 R"({
+
1954 "method" : "channel_authorize",
+
1955 "params" : [
+
1956 {
+
1957 "error" : "badSyntax",
+
1958 "error_code" : 1,
+
1959 "error_message" : "Syntax error."
+
1960 }
+
1961 ]
+
1962 })"},
+
1963 {"channel_authorize: too many arguments.",
+
1964 __LINE__,
+
1965 {"channel_authorize",
+
1966 "secp256k1",
+
1967 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
1968 "2000",
+
1969 "whatever",
+
1970 "whenever"},
+ +
1972 R"({
+
1973 "method" : "channel_authorize",
+
1974 "params" : [
+
1975 {
+
1976 "error" : "badSyntax",
+
1977 "error_code" : 1,
+
1978 "error_message" : "Syntax error."
+
1979 }
+
1980 ]
+
1981 })"},
+
1982 {"channel_authorize: bad key type.",
+
1983 __LINE__,
+
1984 {"channel_authorize",
+
1985 "secp257k1",
+
1986 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
1987 "2000",
+
1988 "whatever"},
+ +
1990 R"({
+
1991 "method" : "channel_authorize",
+
1992 "params" : [
+
1993 {
+
1994 "error" : "badKeyType",
+
1995 "error_code" : 1,
+
1996 "error_message" : "Bad key type."
+
1997 }
+
1998 ]
+
1999 })"},
+
2000 {"channel_authorize: channel_id too short.",
+
2001 __LINE__,
+
2002 {"channel_authorize",
+
2003 "secret_can_be_anything",
+
2004 "123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2005 "2000"},
+ +
2007 R"({
+
2008 "method" : "channel_authorize",
+
2009 "params" : [
+
2010 {
+
2011 "error" : "channelMalformed",
+
2012 "error_code" : 43,
+
2013 "error_message" : "Payment channel is malformed."
+
2014 }
+
2015 ]
+
2016 })"},
+
2017 {"channel_authorize: channel_id too long.",
+
2018 __LINE__,
+
2019 {"channel_authorize",
+
2020 "secret_can_be_anything",
+
2021 "10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2022 "2000"},
+ +
2024 R"({
+
2025 "method" : "channel_authorize",
+
2026 "params" : [
+
2027 {
+
2028 "error" : "channelMalformed",
+
2029 "error_code" : 43,
+
2030 "error_message" : "Payment channel is malformed."
+
2031 }
+
2032 ]
+
2033 })"},
+
2034 {"channel_authorize: channel_id not hex.",
+
2035 __LINE__,
+
2036 {"channel_authorize",
+
2037 "secret_can_be_anything",
+
2038 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEZ",
+
2039 "2000"},
+ +
2041 R"({
+
2042 "method" : "channel_authorize",
+
2043 "params" : [
+
2044 {
+
2045 "error" : "channelMalformed",
+
2046 "error_code" : 43,
+
2047 "error_message" : "Payment channel is malformed."
+
2048 }
+
2049 ]
+
2050 })"},
+
2051 {"channel_authorize: negative amount.",
+
2052 __LINE__,
+
2053 {"channel_authorize",
+
2054 "secret_can_be_anything",
+
2055 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2056 "-1"},
+ +
2058 R"({
+
2059 "method" : "channel_authorize",
+
2060 "params" : [
+
2061 {
+
2062 "error" : "channelAmtMalformed",
+
2063 "error_code" : 44,
+
2064 "error_message" : "Payment channel amount is malformed."
+
2065 }
+
2066 ]
+
2067 })"},
+
2068 {"channel_authorize: amount > 64 bits.",
+
2069 __LINE__,
+
2070 {"channel_authorize",
+
2071 "secret_can_be_anything",
+
2072 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2073 "18446744073709551616"},
+ +
2075 R"({
+
2076 "method" : "channel_authorize",
+
2077 "params" : [
+
2078 {
+
2079 "error" : "channelAmtMalformed",
+
2080 "error_code" : 44,
+
2081 "error_message" : "Payment channel amount is malformed."
+
2082 }
+
2083 ]
+
2084 })"},
+
2085
+
2086 // channel_verify
+
2087 // --------------------------------------------------------------
+
2088 {"channel_verify: public key.",
+
2089 __LINE__,
+
2090 {"channel_verify",
+
2091 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2092 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2093 "0",
+
2094 "DEADBEEF"},
+ +
2096 R"({
+
2097 "method" : "channel_verify",
+
2098 "params" : [
+
2099 {
+
2100 "api_version" : %API_VER%,
+
2101 "amount" : "0",
+
2102 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2103 "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2104 "signature" : "DEADBEEF"
+
2105 }
+
2106 ]
+
2107 })"},
+
2108 {"channel_verify: public key hex.",
+
2109 __LINE__,
+
2110 {"channel_verify",
+
2111 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
+
2112 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2113 "18446744073709551615",
+
2114 "DEADBEEF"},
+ +
2116 R"({
+
2117 "method" : "channel_verify",
+
2118 "params" : [
+
2119 {
+
2120 "api_version" : %API_VER%,
+
2121 "amount" : "18446744073709551615",
+
2122 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2123 "public_key" : "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
+
2124 "signature" : "DEADBEEF"
+
2125 }
+
2126 ]
+
2127 })"},
+
2128 {"channel_verify: too few arguments.",
+
2129 __LINE__,
+
2130 {"channel_verify",
+
2131 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2132 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"},
+ +
2134 R"({
+
2135 "method" : "channel_verify",
+
2136 "params" : [
+
2137 {
+
2138 "error" : "badSyntax",
+
2139 "error_code" : 1,
+
2140 "error_message" : "Syntax error."
+
2141 }
+
2142 ]
+
2143 })"},
+
2144 {"channel_verify: too many arguments.",
+
2145 __LINE__,
+
2146 {"channel_verify",
+
2147 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2148 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2149 "2000",
+
2150 "DEADBEEF",
+
2151 "Whatever"},
+ +
2153 R"({
+
2154 "method" : "channel_verify",
+
2155 "params" : [
+
2156 {
+
2157 "error" : "badSyntax",
+
2158 "error_code" : 1,
+
2159 "error_message" : "Syntax error."
+
2160 }
+
2161 ]
+
2162 })"},
+
2163 {"channel_verify: malformed public key.",
+
2164 __LINE__,
+
2165 {"channel_verify",
+
2166 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9GoV",
+
2167 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2168 "2000",
+
2169 "DEADBEEF"},
+ +
2171 R"({
+
2172 "method" : "channel_verify",
+
2173 "params" : [
+
2174 {
+
2175 "error" : "publicMalformed",
+
2176 "error_code" : 60,
+
2177 "error_message" : "Public key is malformed."
+
2178 }
+
2179 ]
+
2180 })"},
+
2181 {"channel_verify: malformed hex public key.",
+
2182 __LINE__,
+
2183 {"channel_verify",
+
2184 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F",
+
2185 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2186 "2000",
+
2187 "DEADBEEF"},
+ +
2189 R"({
+
2190 "method" : "channel_verify",
+
2191 "params" : [
+
2192 {
+
2193 "error" : "publicMalformed",
+
2194 "error_code" : 60,
+
2195 "error_message" : "Public key is malformed."
+
2196 }
+
2197 ]
+
2198 })"},
+
2199 {"channel_verify: invalid channel id.",
+
2200 __LINE__,
+
2201 {"channel_verify",
+
2202 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2203 "10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2204 "2000",
+
2205 "DEADBEEF"},
+ +
2207 R"({
+
2208 "method" : "channel_verify",
+
2209 "params" : [
+
2210 {
+
2211 "error" : "channelMalformed",
+
2212 "error_code" : 43,
+
2213 "error_message" : "Payment channel is malformed."
+
2214 }
+
2215 ]
+
2216 })"},
+
2217 {"channel_verify: short channel id.",
+
2218 __LINE__,
+
2219 {"channel_verify",
+
2220 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2221 "123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2222 "2000",
+
2223 "DEADBEEF"},
+ +
2225 R"({
+
2226 "method" : "channel_verify",
+
2227 "params" : [
+
2228 {
+
2229 "error" : "channelMalformed",
+
2230 "error_code" : 43,
+
2231 "error_message" : "Payment channel is malformed."
+
2232 }
+
2233 ]
+
2234 })"},
+
2235 {"channel_verify: amount too small.",
+
2236 __LINE__,
+
2237 {"channel_verify",
+
2238 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
+
2239 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2240 "-1",
+
2241 "DEADBEEF"},
+ +
2243 R"({
+
2244 "method" : "channel_verify",
+
2245 "params" : [
+
2246 {
+
2247 "error" : "channelAmtMalformed",
+
2248 "error_code" : 44,
+
2249 "error_message" : "Payment channel amount is malformed."
+
2250 }
+
2251 ]
+
2252 })"},
+
2253 {"channel_verify: amount too large.",
+
2254 __LINE__,
+
2255 {"channel_verify",
+
2256 "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
+
2257 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2258 "18446744073709551616",
+
2259 "DEADBEEF"},
+ +
2261 R"({
+
2262 "method" : "channel_verify",
+
2263 "params" : [
+
2264 {
+
2265 "error" : "channelAmtMalformed",
+
2266 "error_code" : 44,
+
2267 "error_message" : "Payment channel amount is malformed."
+
2268 }
+
2269 ]
+
2270 })"},
+
2271 {"channel_verify: non-hex signature.",
+
2272 __LINE__,
+
2273 {"channel_verify",
+
2274 "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2275 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2276 "40000000",
+
2277 "ThisIsNotHexadecimal"},
+ +
2279 R"({
+
2280 "method" : "channel_verify",
+
2281 "params" : [
+
2282 {
+
2283 "api_version" : %API_VER%,
+
2284 "amount" : "40000000",
+
2285 "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
+
2286 "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
+
2287 "signature" : "ThisIsNotHexadecimal"
+
2288 }
+
2289 ]
+
2290 })"},
+
2291
+
2292 // connect
+
2293 // ---------------------------------------------------------------------
+
2294 {"connect: minimal.",
+
2295 __LINE__,
+
2296 {
+
2297 "connect",
+
2298 "ThereIsNoCheckingOnTheIPFormat",
+
2299 },
+ +
2301 R"({
+
2302 "method" : "connect",
+
2303 "params" : [
+
2304 {
+
2305 "api_version" : %API_VER%,
+
2306 "ip" : "ThereIsNoCheckingOnTheIPFormat"
+
2307 }
+
2308 ]
+
2309 })"},
+
2310 {"connect: ip and port.",
+
2311 __LINE__,
+
2312 {"connect", "ThereIsNoCheckingOnTheIPFormat", "6561"},
+ +
2314 R"({
+
2315 "method" : "connect",
+
2316 "params" : [
+
2317 {
+
2318 "api_version" : %API_VER%,
+
2319 "ip" : "ThereIsNoCheckingOnTheIPFormat",
+
2320 "port" : 6561
+
2321 }
+
2322 ]
+
2323 })"},
+
2324 {"connect: too few arguments.",
+
2325 __LINE__,
+
2326 {
+
2327 "connect",
+
2328 },
+ +
2330 R"({
+
2331 "method" : "connect",
+
2332 "params" : [
+
2333 {
+
2334 "error" : "badSyntax",
+
2335 "error_code" : 1,
+
2336 "error_message" : "Syntax error."
+
2337 }
+
2338 ]
+
2339 })"},
+
2340 {"connect: too many arguments.",
+
2341 __LINE__,
+
2342 {"connect", "ThereIsNoCheckingOnTheIPFormat", "6561", "extra"},
+ +
2344 R"({
+
2345 "method" : "connect",
+
2346 "params" : [
+
2347 {
+
2348 "error" : "badSyntax",
+
2349 "error_code" : 1,
+
2350 "error_message" : "Syntax error."
+
2351 }
+
2352 ]
+
2353 })"},
+
2354 {// Note: this should return an error but not throw.
+
2355 "connect: port too small.",
+
2356 __LINE__,
+
2357 {
+
2358 "connect",
+
2359 "ThereIsNoCheckingOnTheIPFormat",
+
2360 "-1",
+
2361 },
+ +
2363 R"()"},
+
2364 {// Note: this should return an error but not throw.
+
2365 "connect: port too large.",
+
2366 __LINE__,
+
2367 {
+
2368 "connect",
+
2369 "ThereIsNoCheckingOnTheIPFormat",
+
2370 "4294967296",
+
2371 },
+ +
2373 R"()"},
+
2374
+
2375 // consensus_info
+
2376 // --------------------------------------------------------------
+
2377 {"consensus_info: minimal.",
+
2378 __LINE__,
+
2379 {
+
2380 "consensus_info",
+
2381 },
+ +
2383 R"({
+
2384 "method" : "consensus_info",
+
2385 "params" : [
+
2386 {
+
2387 "api_version" : %API_VER%
+
2388 }
+
2389 ]
+
2390 })"},
+
2391 {"consensus_info: too many arguments.",
+
2392 __LINE__,
+
2393 {"consensus_info", "whatever"},
+ +
2395 R"({
+
2396 "method" : "consensus_info",
+
2397 "params" : [
+
2398 {
+
2399 "error" : "badSyntax",
+
2400 "error_code" : 1,
+
2401 "error_message" : "Syntax error."
+
2402 }
+
2403 ]
+
2404 })"},
+
2405
+
2406 // deposit_authorized
+
2407 // ----------------------------------------------------------
+
2408 {"deposit_authorized: minimal.",
+
2409 __LINE__,
+
2410 {
+
2411 "deposit_authorized",
+
2412 "source_account_NotValidated",
+
2413 "destination_account_NotValidated",
+
2414 },
+ +
2416 R"({
+
2417 "method" : "deposit_authorized",
+
2418 "params" : [
+
2419 {
+
2420 "api_version" : %API_VER%,
+
2421 "destination_account" : "destination_account_NotValidated",
+
2422 "source_account" : "source_account_NotValidated"
+
2423 }
+
2424 ]
+
2425 })"},
+
2426 {"deposit_authorized: with text ledger index.",
+
2427 __LINE__,
+
2428 {"deposit_authorized",
+
2429 "source_account_NotValidated",
+
2430 "destination_account_NotValidated",
+
2431 "validated"},
+ +
2433 R"({
+
2434 "method" : "deposit_authorized",
+
2435 "params" : [
+
2436 {
+
2437 "api_version" : %API_VER%,
+
2438 "destination_account" : "destination_account_NotValidated",
+
2439 "ledger_index" : "validated",
+
2440 "source_account" : "source_account_NotValidated"
+
2441 }
+
2442 ]
+
2443 })"},
+
2444 {"deposit_authorized: with ledger index.",
+
2445 __LINE__,
+
2446 {"deposit_authorized",
+
2447 "source_account_NotValidated",
+
2448 "destination_account_NotValidated",
+
2449 "4294967295",
+
2450 "cred1",
+
2451 "cred2",
+
2452 "cred3",
+
2453 "cred4",
+
2454 "cred5",
+
2455 "cred6",
+
2456 "cred7",
+
2457 "cred8"},
+ +
2459 R"({
+
2460 "method" : "deposit_authorized",
+
2461 "params" : [
+
2462 {
+
2463 "api_version" : %API_VER%,
+
2464 "destination_account" : "destination_account_NotValidated",
+
2465 "ledger_index" : 4294967295,
+
2466 "source_account" : "source_account_NotValidated",
+
2467 "credentials": ["cred1", "cred2", "cred3", "cred4", "cred5", "cred6", "cred7", "cred8"]
+
2468 }
+
2469 ]
+
2470 })"},
+
2471 {"deposit_authorized: with ledger hash.",
+
2472 __LINE__,
+
2473 {"deposit_authorized",
+
2474 "source_account_NotValidated",
+
2475 "destination_account_NotValidated",
+
2476 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
+ +
2478 R"({
+
2479 "method" : "deposit_authorized",
+
2480 "params" : [
+
2481 {
+
2482 "api_version" : %API_VER%,
+
2483 "destination_account" : "destination_account_NotValidated",
+
2484 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
+
2485 "source_account" : "source_account_NotValidated"
+
2486 }
+
2487 ]
+
2488 })"},
+
2489 {"deposit_authorized: too few arguments.",
+
2490 __LINE__,
+
2491 {
+
2492 "deposit_authorized",
+
2493 "source_account_NotValidated",
+
2494 },
+ +
2496 R"({
+
2497 "method" : "deposit_authorized",
+
2498 "params" : [
+
2499 {
+
2500 "error" : "badSyntax",
+
2501 "error_code" : 1,
+
2502 "error_message" : "Syntax error."
+
2503 }
+
2504 ]
+
2505 })"},
+
2506 {"deposit_authorized: too many arguments.",
+
2507 __LINE__,
+
2508 {"deposit_authorized",
+
2509 "source_account_NotValidated",
+
2510 "destination_account_NotValidated",
+
2511 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
+
2512 "cred1",
+
2513 "cred2",
+
2514 "cred3",
+
2515 "cred4",
+
2516 "cred5",
+
2517 "cred6",
+
2518 "cred7",
+
2519 "cred8",
+
2520 "too_much"},
+ +
2522 R"({
+
2523 "method" : "deposit_authorized",
+
2524 "params" : [
+
2525 {
+
2526 "error" : "badSyntax",
+
2527 "error_code" : 1,
+
2528 "error_message" : "Syntax error."
+
2529 }
+
2530 ]
+
2531 })"},
+
2532 {"deposit_authorized: invalid ledger selection.",
+
2533 __LINE__,
+
2534 {
+
2535 "deposit_authorized",
+
2536 "source_account_NotValidated",
+
2537 "destination_account_NotValidated",
+
2538 "NotALedger",
+
2539 },
+ +
2541 R"({
+
2542 "method" : "deposit_authorized",
+
2543 "params" : [
+
2544 {
+
2545 "api_version" : %API_VER%,
+
2546 "destination_account" : "destination_account_NotValidated",
+
2547 "ledger_index" : 0,
+
2548 "source_account" : "source_account_NotValidated"
+
2549 }
+
2550 ]
+
2551 })"},
+
2552
+
2553 // feature
+
2554 // ---------------------------------------------------------------------
+
2555 {"feature: minimal.",
+
2556 __LINE__,
+
2557 {
+
2558 "feature",
+
2559 },
+ +
2561 R"({
+
2562 "method" : "feature",
+
2563 "params" : [
+
2564 {
+
2565 "api_version" : %API_VER%,
+
2566 }
+
2567 ]
+
2568 })"},
+
2569 {"feature: with name.",
+
2570 __LINE__,
+
2571 {"feature", "featureNameOrHexIsNotValidated"},
+ +
2573 R"({
+
2574 "method" : "feature",
+
2575 "params" : [
+
2576 {
+
2577 "api_version" : %API_VER%,
+
2578 "feature" : "featureNameOrHexIsNotValidated"
+
2579 }
+
2580 ]
+
2581 })"},
+
2582 {"feature: accept.",
+
2583 __LINE__,
+
2584 {"feature",
+
2585 "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA98"
+
2586 "76543210",
+
2587 "accept"},
+ +
2589 R"({
+
2590 "method" : "feature",
+
2591 "params" : [
+
2592 {
+
2593 "api_version" : %API_VER%,
+
2594 "feature" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210",
+
2595 "vetoed" : false
+
2596 }
+
2597 ]
+
2598 })"},
+
2599 {"feature: reject.",
+
2600 __LINE__,
+
2601 {"feature", "0", "reject"},
+ +
2603 R"({
+
2604 "method" : "feature",
+
2605 "params" : [
+
2606 {
+
2607 "api_version" : %API_VER%,
+
2608 "feature" : "0",
+
2609 "vetoed" : true
+
2610 }
+
2611 ]
+
2612 })"},
+
2613 {"feature: too many arguments.",
+
2614 __LINE__,
+
2615 {"feature", "featureNameOrHexIsNotValidated", "accept", "anotherArg"},
+ +
2617 R"({
+
2618 "method" : "feature",
+
2619 "params" : [
+
2620 {
+
2621 "error" : "badSyntax",
+
2622 "error_code" : 1,
+
2623 "error_message" : "Syntax error."
+
2624 }
+
2625 ]
+
2626 })"},
+
2627 {"feature: neither accept nor reject.",
+
2628 __LINE__,
+
2629 {
+
2630 "feature",
+
2631 "featureNameOrHexIsNotValidated",
+
2632 "veto",
+
2633 },
+ +
2635 R"({
+
2636 "method" : "feature",
+
2637 "params" : [
+
2638 {
+
2639 "error" : "invalidParams",
+
2640 "error_code" : 31,
+
2641 "error_message" : "Invalid parameters."
+
2642 }
+
2643 ]
+
2644 })"},
+
2645
+
2646 // fetch_info
+
2647 // ------------------------------------------------------------------
+
2648 {"fetch_info: minimal.",
+
2649 __LINE__,
+
2650 {
+
2651 "fetch_info",
+
2652 },
+ +
2654 R"({
+
2655 "method" : "fetch_info",
+
2656 "params" : [
+
2657 {
+
2658 "api_version" : %API_VER%,
+
2659 }
+
2660 ]
+
2661 })"},
+
2662 {"fetch_info: clear.",
+
2663 __LINE__,
+
2664 {"fetch_info", "clear"},
+ +
2666 R"({
+
2667 "method" : "fetch_info",
+
2668 "params" : [
+
2669 {
+
2670 "api_version" : %API_VER%,
+
2671 "clear" : true
+
2672 }
+
2673 ]
+
2674 })"},
+
2675 {"fetch_info: too many arguments.",
+
2676 __LINE__,
+
2677 {"fetch_info", "clear", "other"},
+ +
2679 R"({
+
2680 "method" : "fetch_info",
+
2681 "params" : [
+
2682 {
+
2683 "error" : "badSyntax",
+
2684 "error_code" : 1,
+
2685 "error_message" : "Syntax error."
+
2686 }
+
2687 ]
+
2688 })"},
+
2689 {"fetch_info: other trailing argument.",
+
2690 __LINE__,
+
2691 {"fetch_info", "too"},
+ +
2693 R"({
+
2694 "method" : "fetch_info",
+
2695 "params" : [
+
2696 {
+
2697 "api_version" : %API_VER%,
+
2698 "too" : true
+
2699 }
+
2700 ]
+
2701 })"},
+
2702
+
2703 // gateway_balances
+
2704 // ------------------------------------------------------------
+
2705 {"gateway_balances: minimal.",
+
2706 __LINE__,
+
2707 {"gateway_balances", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
+ +
2709 R"({
+
2710 "method" : "gateway_balances",
+
2711 "params" : [
+
2712 {
+
2713 "api_version" : %API_VER%,
+
2714 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2715 }
+
2716 ]
+
2717 })"},
+
2718 {"gateway_balances: with ledger index.",
+
2719 __LINE__,
+
2720 {"gateway_balances", "890765", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
+ +
2722 R"({
+
2723 "method" : "gateway_balances",
+
2724 "params" : [
+
2725 {
+
2726 "api_version" : %API_VER%,
+
2727 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2728 "ledger_index" : "890765"
+
2729 }
+
2730 ]
+
2731 })"},
+
2732 {"gateway_balances: with text ledger index.",
+
2733 __LINE__,
+
2734 {"gateway_balances", "current", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
+ +
2736 R"({
+
2737 "method" : "gateway_balances",
+
2738 "params" : [
+
2739 {
+
2740 "api_version" : %API_VER%,
+
2741 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2742 "ledger_index" : "current"
+
2743 }
+
2744 ]
+
2745 })"},
+
2746 {"gateway_balances: with 64 character ledger hash.",
+
2747 __LINE__,
+
2748 {"gateway_balances",
+
2749 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
2750 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
+ +
2752 R"({
+
2753 "method" : "gateway_balances",
+
2754 "params" : [
+
2755 {
+
2756 "api_version" : %API_VER%,
+
2757 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2758 "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
+
2759 }
+
2760 ]
+
2761 })"},
+
2762 {"gateway_balances: 1 hotwallet.",
+
2763 __LINE__,
+
2764 {"gateway_balances",
+
2765 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2766 "hotwallet_is_not_validated"},
+ +
2768 R"({
+
2769 "method" : "gateway_balances",
+
2770 "params" : [
+
2771 {
+
2772 "api_version" : %API_VER%,
+
2773 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2774 "hotwallet" : [ "hotwallet_is_not_validated" ]
+
2775 }
+
2776 ]
+
2777 })"},
+
2778 {"gateway_balances: 3 hotwallets.",
+
2779 __LINE__,
+
2780 {
+
2781 "gateway_balances",
+
2782 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
2783 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2784 "hotwallet_is_not_validated_1",
+
2785 "hotwallet_is_not_validated_2",
+
2786 "hotwallet_is_not_validated_3",
+
2787 },
+ +
2789 R"({
+
2790 "method" : "gateway_balances",
+
2791 "params" : [
+
2792 {
+
2793 "api_version" : %API_VER%,
+
2794 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
2795 "hotwallet" : [
+
2796 "hotwallet_is_not_validated_1",
+
2797 "hotwallet_is_not_validated_2",
+
2798 "hotwallet_is_not_validated_3"
+
2799 ],
+
2800 "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
+
2801 }
+
2802 ]
+
2803 })"},
+
2804 {"gateway_balances: too few arguments.",
+
2805 __LINE__,
+
2806 {
+
2807 "gateway_balances",
+
2808 },
+ +
2810 R"({
+
2811 "method" : "gateway_balances",
+
2812 "params" : [
+
2813 {
+
2814 "error" : "badSyntax",
+
2815 "error_code" : 1,
+
2816 "error_message" : "Syntax error."
+
2817 }
+
2818 ]
+
2819 })"},
+
2820 {"gateway_balances: empty first argument.",
+
2821 __LINE__,
+
2822 {"gateway_balances", ""},
+ +
2824 R"({
+
2825 "method" : "gateway_balances",
+
2826 "params" : [
+
2827 {
+
2828 "error" : "invalidParams",
+
2829 "error_code" : 31,
+
2830 "error_message" : "Invalid first parameter"
+
2831 }
+
2832 ]
+
2833 })"},
+
2834 {"gateway_balances: with ledger index but no gateway.",
+
2835 __LINE__,
+
2836 {
+
2837 "gateway_balances",
+
2838 "890765",
+
2839 },
+ +
2841 R"({
+
2842 "method" : "gateway_balances",
+
2843 "params" : [
+
2844 {
+
2845 "error" : "invalidParams",
+
2846 "error_code" : 31,
+
2847 "error_message" : "Invalid hotwallet"
+
2848 }
+
2849 ]
+
2850 })"},
+
2851 {"gateway_balances: with text ledger index but no gateway.",
+
2852 __LINE__,
+
2853 {
+
2854 "gateway_balances",
+
2855 "current",
+
2856 },
+ +
2858 R"({
+
2859 "method" : "gateway_balances",
+
2860 "params" : [
+
2861 {
+
2862 "error" : "invalidParams",
+
2863 "error_code" : 31,
+
2864 "error_message" : "Invalid hotwallet"
+
2865 }
+
2866 ]
+
2867 })"},
+
2868 {"gateway_balances: with 64 character ledger hash but no gateway.",
+
2869 __LINE__,
+
2870 {
+
2871 "gateway_balances",
+
2872 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
2873 },
+ +
2875 R"({
+
2876 "method" : "gateway_balances",
+
2877 "params" : [
+
2878 {
+
2879 "error" : "invalidParams",
+
2880 "error_code" : 31,
+
2881 "error_message" : "Invalid hotwallet"
+
2882 }
+
2883 ]
+
2884 })"},
+
2885
+
2886 // get_counts
+
2887 // ------------------------------------------------------------------
+
2888 {"get_counts: minimal.",
+
2889 __LINE__,
+
2890 {
+
2891 "get_counts",
+
2892 },
+ +
2894 R"({
+
2895 "method" : "get_counts",
+
2896 "params" : [
+
2897 {
+
2898 "api_version" : %API_VER%,
+
2899 }
+
2900 ]
+
2901 })"},
+
2902 {"get_counts: with maximum count.",
+
2903 __LINE__,
+
2904 {"get_counts", "100"},
+ +
2906 R"({
+
2907 "method" : "get_counts",
+
2908 "params" : [
+
2909 {
+
2910 "api_version" : %API_VER%,
+
2911 "min_count" : 100
+
2912 }
+
2913 ]
+
2914 })"},
+
2915 {"get_counts: too many arguments.",
+
2916 __LINE__,
+
2917 {"get_counts", "100", "whatever"},
+ +
2919 R"({
+
2920 "method" : "get_counts",
+
2921 "params" : [
+
2922 {
+
2923 "error" : "badSyntax",
+
2924 "error_code" : 1,
+
2925 "error_message" : "Syntax error."
+
2926 }
+
2927 ]
+
2928 })"},
+
2929 {"get_counts: count too small.",
+
2930 __LINE__,
+
2931 {
+
2932 "get_counts",
+
2933 "-1",
+
2934 },
+ +
2936 R"()"},
+
2937 {"get_counts: count too large.",
+
2938 __LINE__,
+
2939 {"get_counts", "4294967296"},
+ +
2941 R"()"},
+
2942
+
2943 // json
+
2944 // ------------------------------------------------------------------------
+
2945 {"json: minimal.",
+
2946 __LINE__,
+
2947 {
+
2948 "json",
+
2949 "command",
+
2950 R"({"json_argument":true})",
+
2951 },
+ +
2953 R"({
+
2954 "method" : "command",
+
2955 "params" : [
+
2956 {
+
2957 "api_version" : %API_VER%,
+
2958 "json_argument" : true,
+
2959 "method" : "command"
+
2960 }
+
2961 ]
+
2962 })"},
+
2963 {"json: null object.",
+
2964 __LINE__,
+
2965 {
+
2966 "json",
+
2967 "command",
+
2968 R"({})",
+
2969 },
+ +
2971 R"({
+
2972 "method" : "command",
+
2973 "params" : [
+
2974 {
+
2975 "api_version" : %API_VER%,
+
2976 "method" : "command"
+
2977 }
+
2978 ]
+
2979 })"},
+
2980 {"json: too few arguments.",
+
2981 __LINE__,
+
2982 {"json", "command"},
+ +
2984 R"({
+
2985 "method" : "json",
+
2986 "params" : [
+
2987 {
+
2988 "error" : "badSyntax",
+
2989 "error_code" : 1,
+
2990 "error_message" : "Syntax error."
+
2991 }
+
2992 ]
+
2993 })"},
+
2994 {"json: too many arguments.",
+
2995 __LINE__,
+
2996 {"json", "command", R"({"json_argument":true})", "extra"},
+ +
2998 R"({
+
2999 "method" : "json",
+
3000 "params" : [
+
3001 {
+
3002 "error" : "badSyntax",
+
3003 "error_code" : 1,
+
3004 "error_message" : "Syntax error."
+
3005 }
+
3006 ]
+
3007 })"},
+
3008 {"json: array, not object.",
+
3009 __LINE__,
+
3010 {
+
3011 "json",
+
3012 "command",
+
3013 R"(["arg1","arg2"])",
+
3014 },
+ +
3016 R"({
+
3017 "method" : "json",
+
3018 "params" : [
+
3019 {
+
3020 "error" : "invalidParams",
+
3021 "error_code" : 31,
+
3022 "error_message" : "Invalid parameters."
+
3023 }
+
3024 ]
+
3025 })"},
+
3026 {"json: invalid json (note closing comma).",
+
3027 __LINE__,
+
3028 {
+
3029 "json",
+
3030 "command",
+
3031 R"({"json_argument":true,})",
+
3032 },
+ +
3034 R"({
+
3035 "method" : "json",
+
3036 "params" : [
+
3037 {
+
3038 "error" : "invalidParams",
+
3039 "error_code" : 31,
+
3040 "error_message" : "Invalid parameters."
+
3041 }
+
3042 ]
+
3043 })"},
+
3044
+
3045 // json2
+
3046 // -----------------------------------------------------------------------
+
3047 {"json2: minimal object.",
+
3048 __LINE__,
+
3049 {
+
3050 "json2",
+
3051 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"})",
+
3052 },
+ +
3054 R"({
+
3055 "id" : "A1",
+
3056 "jsonrpc" : "2.0",
+
3057 "method" : "call_1",
+
3058 "params" : [
+
3059 {
+
3060 "api_version" : %API_VER%,
+
3061 "id" : "A1",
+
3062 "jsonrpc" : "2.0",
+
3063 "method" : "call_1",
+
3064 "ripplerpc" : "2.0"
+
3065 }
+
3066 ],
+
3067 "ripplerpc" : "2.0"
+
3068 })"},
+
3069 {"json2: object with nested params.",
+
3070 __LINE__,
+
3071 {
+
3072 "json2",
+
3073 R"({
+
3074 "jsonrpc" : "2.0",
+
3075 "ripplerpc" : "2.0",
+
3076 "id" : "A1",
+
3077 "method" : "call_1",
+
3078 "params" : [{"inner_arg" : "yup"}]
+
3079 })",
+
3080 },
+ +
3082 R"({
+
3083 "id" : "A1",
+
3084 "jsonrpc" : "2.0",
+
3085 "method" : "call_1",
+
3086 "params" : [
+
3087 {
+
3088 "api_version" : %API_VER%,
+
3089 "0" : {
+
3090 "inner_arg" : "yup"
+
3091 },
+
3092 "id" : "A1",
+
3093 "jsonrpc" : "2.0",
+
3094 "method" : "call_1",
+
3095 "ripplerpc" : "2.0"
+
3096 }
+
3097 ],
+
3098 "ripplerpc" : "2.0"
+
3099 })"},
+
3100 {"json2: minimal array.",
+
3101 __LINE__,
+
3102 {
+
3103 "json2",
+
3104 R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"}])",
+
3105 },
+ +
3107 R"({
+
3108 "method" : "json2",
+
3109 "params" : [
+
3110 [
+
3111 {
+
3112 "api_version" : %API_VER%,
+
3113 "id" : "A1",
+
3114 "jsonrpc" : "2.0",
+
3115 "method" : "call_1",
+
3116 "ripplerpc" : "2.0"
+
3117 }
+
3118 ]
+
3119 ]
+
3120 })"},
+
3121 {"json2: array with object with nested params.",
+
3122 __LINE__,
+
3123 {
+
3124 "json2",
+
3125 R"([
+
3126 {"jsonrpc":"2.0",
+
3127 "ripplerpc":"2.0",
+
3128 "id":"A1",
+
3129 "method":"call_1",
+
3130 "params" : [{"inner_arg" : "yup"}]}
+
3131 ])",
+
3132 },
+ +
3134 R"({
+
3135 "method" : "json2",
+
3136 "params" : [
+
3137 [
+
3138 {
+
3139 "api_version" : %API_VER%,
+
3140 "0" : {
+
3141 "inner_arg" : "yup"
+
3142 },
+
3143 "id" : "A1",
+
3144 "jsonrpc" : "2.0",
+
3145 "method" : "call_1",
+
3146 "ripplerpc" : "2.0"
+
3147 }
+
3148 ]
+
3149 ]})"},
+
3150 {"json2: too few arguments.",
+
3151 __LINE__,
+
3152 {
+
3153 "json2",
+
3154 },
+ +
3156 R"({
+
3157 "method" : "json2",
+
3158 "params" : [
+
3159 {
+
3160 "error" : "badSyntax",
+
3161 "error_code" : 1,
+
3162 "error_message" : "Syntax error."
+
3163 }
+
3164 ]
+
3165 })"},
+
3166 {"json2: too many arguments.",
+
3167 __LINE__,
+
3168 {"json2",
+
3169 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_this"})",
+
3170 "extra"},
+ +
3172 R"({
+
3173 "method" : "json2",
+
3174 "params" : [
+
3175 {
+
3176 "error" : "badSyntax",
+
3177 "error_code" : 1,
+
3178 "error_message" : "Syntax error."
+
3179 }
+
3180 ]
+
3181 })"},
+
3182 {"json2: malformed json (note extra comma).",
+
3183 __LINE__,
+
3184 {
+
3185 "json2",
+
3186 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",})",
+
3187 },
+ +
3189 R"({
+
3190 "id" : "A1",
+
3191 "jsonrpc" : "2.0",
+
3192 "method" : "json2",
+
3193 "params" : [
+
3194 {
+
3195 "error" : "invalidParams",
+
3196 "error_code" : 31,
+
3197 "error_message" : "Invalid parameters.",
+
3198 "id" : "A1",
+
3199 "jsonrpc" : "2.0",
+
3200 "ripplerpc" : "2.0"
+
3201 }
+
3202 ],
+
3203 "ripplerpc" : "2.0"
+
3204 })"},
+
3205 {"json2: omit jsonrpc.",
+
3206 __LINE__,
+
3207 {
+
3208 "json2",
+
3209 R"({"ripplerpc":"2.0","id":"A1","method":"call_1"})",
+
3210 },
+ +
3212 R"({
+
3213 "id" : "A1",
+
3214 "method" : "json2",
+
3215 "params" : [
+
3216 {
+
3217 "error" : "invalidParams",
+
3218 "error_code" : 31,
+
3219 "error_message" : "Invalid parameters.",
+
3220 "id" : "A1",
+
3221 "ripplerpc" : "2.0"
+
3222 }
+
3223 ],
+
3224 "ripplerpc" : "2.0"
+
3225 })"},
+
3226 {"json2: wrong jsonrpc version.",
+
3227 __LINE__,
+
3228 {
+
3229 "json2",
+
3230 R"({"jsonrpc":"2.1","ripplerpc":"2.0","id":"A1","method":"call_1"})",
+
3231 },
+ +
3233 R"({
+
3234 "id" : "A1",
+
3235 "jsonrpc" : "2.1",
+
3236 "method" : "json2",
+
3237 "params" : [
+
3238 {
+
3239 "error" : "invalidParams",
+
3240 "error_code" : 31,
+
3241 "error_message" : "Invalid parameters.",
+
3242 "id" : "A1",
+
3243 "jsonrpc" : "2.1",
+
3244 "ripplerpc" : "2.0"
+
3245 }
+
3246 ],
+
3247 "ripplerpc" : "2.0"
+
3248 })"},
+
3249 {"json2: omit ripplerpc.",
+
3250 __LINE__,
+
3251 {
+
3252 "json2",
+
3253 R"({"jsonrpc":"2.0","id":"A1","method":"call_1"})",
+
3254 },
+ +
3256 R"({
+
3257 "id" : "A1",
+
3258 "jsonrpc" : "2.0",
+
3259 "method" : "json2",
+
3260 "params" : [
+
3261 {
+
3262 "error" : "invalidParams",
+
3263 "error_code" : 31,
+
3264 "error_message" : "Invalid parameters.",
+
3265 "id" : "A1",
+
3266 "jsonrpc" : "2.0"
+
3267 }
+
3268 ]
+
3269 })"},
+
3270 {"json2: wrong ripplerpc version.",
+
3271 __LINE__,
+
3272 {
+
3273 "json2",
+
3274 R"({"jsonrpc":"2.0","ripplerpc":"2.00","id":"A1","method":"call_1"})",
+
3275 },
+ +
3277 R"({
+
3278 "id" : "A1",
+
3279 "jsonrpc" : "2.0",
+
3280 "method" : "json2",
+
3281 "params" : [
+
3282 {
+
3283 "error" : "invalidParams",
+
3284 "error_code" : 31,
+
3285 "error_message" : "Invalid parameters.",
+
3286 "id" : "A1",
+
3287 "jsonrpc" : "2.0",
+
3288 "ripplerpc" : "2.00"
+
3289 }
+
3290 ],
+
3291 "ripplerpc" : "2.00"
+
3292 })"},
+
3293 {"json2: omit id.",
+
3294 __LINE__,
+
3295 {
+
3296 "json2",
+
3297 R"({"jsonrpc":"2.0","ripplerpc":"2.0","method":"call_1"})",
+
3298 },
+ +
3300 R"({
+
3301 "jsonrpc" : "2.0",
+
3302 "method" : "json2",
+
3303 "params" : [
+
3304 {
+
3305 "error" : "invalidParams",
+
3306 "error_code" : 31,
+
3307 "error_message" : "Invalid parameters.",
+
3308 "jsonrpc" : "2.0",
+
3309 "ripplerpc" : "2.0"
+
3310 }
+
3311 ],
+
3312 "ripplerpc" : "2.0"
+
3313 })"},
+
3314 {"json2: omit method.",
+
3315 __LINE__,
+
3316 {
+
3317 "json2",
+
3318 R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1"})",
+
3319 },
+ +
3321 R"({
+
3322 "id" : "A1",
+
3323 "jsonrpc" : "2.0",
+
3324 "method" : "json2",
+
3325 "params" : [
+
3326 {
+
3327 "error" : "invalidParams",
+
3328 "error_code" : 31,
+
3329 "error_message" : "Invalid parameters.",
+
3330 "id" : "A1",
+
3331 "jsonrpc" : "2.0",
+
3332 "ripplerpc" : "2.0"
+
3333 }
+
3334 ],
+
3335 "ripplerpc" : "2.0"
+
3336 })"},
+
3337 {"json2: empty outer array.",
+
3338 __LINE__,
+
3339 {
+
3340 "json2",
+
3341 R"([])",
+
3342 },
+ +
3344 R"({
+
3345 "method" : "json2",
+
3346 "params" : [
+
3347 {
+
3348 "error" : "invalidParams",
+
3349 "error_code" : 31,
+
3350 "error_message" : "Invalid parameters."
+
3351 }
+
3352 ]
+
3353 })"},
+
3354 {"json2: empty inner array.",
+
3355 __LINE__,
+
3356 {
+
3357 "json2",
+
3358 R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",[]}])",
+
3359 },
+ +
3361 R"({
+
3362 "method" : "json2",
+
3363 "params" : [
+
3364 {
+
3365 "error" : "invalidParams",
+
3366 "error_code" : 31,
+
3367 "error_message" : "Invalid parameters."
+
3368 }
+
3369 ]
+
3370 })"},
+
3371 {"json2: array with non-json2 object.",
+
3372 __LINE__,
+
3373 {
+
3374 "json2",
+
3375 R"([
+
3376 {"jsonrpc" : "2.1",
+
3377 "ripplerpc" : "2.0",
+
3378 "id" : "A1",
+
3379 "method" : "call_1"
+
3380 }
+
3381 ])",
+
3382 },
+ +
3384 R"({
+
3385 "method" : "json2",
+
3386 "params" : [
+
3387 {
+
3388 "error" : "invalidParams",
+
3389 "error_code" : 31,
+
3390 "error_message" : "Invalid parameters."
+
3391 }
+
3392 ]
+
3393 })"},
+
3394 {"json2: non-object or -array inner params member.",
+
3395 __LINE__,
+
3396 {
+
3397 "json2",
+
3398 R"({
+
3399 "jsonrpc" : "2.0",
+
3400 "ripplerpc" : "2.0",
+
3401 "id" : "A1",
+
3402 "method" : "call_1",
+
3403 "params" : true
+
3404 })",
+
3405 },
+ +
3407 R"({
+
3408 "id" : "A1",
+
3409 "jsonrpc" : "2.0",
+
3410 "method" : "json2",
+
3411 "params" : [
+
3412 {
+
3413 "error" : "invalidParams",
+
3414 "error_code" : 31,
+
3415 "error_message" : "Invalid parameters.",
+
3416 "id" : "A1",
+
3417 "jsonrpc" : "2.0",
+
3418 "ripplerpc" : "2.0"
+
3419 }
+
3420 ],
+
3421 "ripplerpc" : "2.0"
+
3422 })"},
+
3423
+
3424 // ledger
+
3425 // ----------------------------------------------------------------------
+
3426 {"ledger: minimal.",
+
3427 __LINE__,
+
3428 {"ledger"},
+ +
3430 R"({
+
3431 "method" : "ledger",
+
3432 "params" : [
+
3433 {
+
3434 "api_version" : %API_VER%,
+
3435 }
+
3436 ]
+
3437 })"},
+
3438 {"ledger: ledger index.",
+
3439 __LINE__,
+
3440 {"ledger", "4294967295"},
+ +
3442 R"({
+
3443 "method" : "ledger",
+
3444 "params" : [
+
3445 {
+
3446 "api_version" : %API_VER%,
+
3447 "ledger_index" : 4294967295
+
3448 }
+
3449 ]
+
3450 })"},
+
3451 {"ledger: text ledger index.",
+
3452 __LINE__,
+
3453 {"ledger", "validated"},
+ +
3455 R"({
+
3456 "method" : "ledger",
+
3457 "params" : [
+
3458 {
+
3459 "api_version" : %API_VER%,
+
3460 "ledger_index" : "validated"
+
3461 }
+
3462 ]
+
3463 })"},
+
3464 {"ledger: ledger hash.",
+
3465 __LINE__,
+
3466 {"ledger",
+
3467 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
+ +
3469 R"({
+
3470 "method" : "ledger",
+
3471 "params" : [
+
3472 {
+
3473 "api_version" : %API_VER%,
+
3474 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
+
3475 }
+
3476 ]
+
3477 })"},
+
3478 {"ledger: full.",
+
3479 __LINE__,
+
3480 {"ledger", "current", "full"},
+ +
3482 R"({
+
3483 "method" : "ledger",
+
3484 "params" : [
+
3485 {
+
3486 "api_version" : %API_VER%,
+
3487 "full" : true,
+
3488 "ledger_index" : "current"
+
3489 }
+
3490 ]
+
3491 })"},
+
3492 {"ledger: tx.",
+
3493 __LINE__,
+
3494 {"ledger", "closed", "tx"},
+ +
3496 R"({
+
3497 "method" : "ledger",
+
3498 "params" : [
+
3499 {
+
3500 "api_version" : %API_VER%,
+
3501 "expand" : true,
+
3502 "ledger_index" : "closed",
+
3503 "transactions" : true
+
3504 }
+
3505 ]
+
3506 })"},
+
3507 {"ledger: too many arguments.",
+
3508 __LINE__,
+
3509 {"ledger", "4294967295", "spare"},
+ +
3511 R"({
+
3512 "method" : "ledger",
+
3513 "params" : [
+
3514 {
+
3515 "api_version" : %API_VER%,
+
3516 "ledger_index" : 4294967295
+
3517 }
+
3518 ]
+
3519 })"},
+
3520 {"ledger: ledger index too small.",
+
3521 __LINE__,
+
3522 {"ledger", "-1"},
+ +
3524 R"({
+
3525 "method" : "ledger",
+
3526 "params" : [
+
3527 {
+
3528 "api_version" : %API_VER%,
+
3529 "ledger_index" : 0
+
3530 }
+
3531 ]
+
3532 })"},
+
3533 {"ledger: ledger index too big.",
+
3534 __LINE__,
+
3535 {"ledger", "4294967296"},
+ +
3537 R"({
+
3538 "method" : "ledger",
+
3539 "params" : [
+
3540 {
+
3541 "api_version" : %API_VER%,
+
3542 "ledger_index" : 0
+
3543 }
+
3544 ]
+
3545 })"},
+
3546 {"ledger: invalid ledger text.",
+
3547 __LINE__,
+
3548 {"ledger", "latest"},
+ +
3550 R"({
+
3551 "method" : "ledger",
+
3552 "params" : [
+
3553 {
+
3554 "api_version" : %API_VER%,
+
3555 "ledger_index" : 0
+
3556 }
+
3557 ]
+
3558 })"},
+
3559 {"ledger: unsupported final argument.",
+
3560 __LINE__,
+
3561 {"ledger", "current", "expand"},
+ +
3563 R"({
+
3564 "method" : "ledger",
+
3565 "params" : [
+
3566 {
+
3567 "api_version" : %API_VER%,
+
3568 "ledger_index" : "current"
+
3569 }
+
3570 ]
+
3571 })"},
+
3572
+
3573 // ledger_closed
+
3574 // ---------------------------------------------------------------
+
3575 {"ledger_closed: minimal.",
+
3576 __LINE__,
+
3577 {"ledger_closed"},
+ +
3579 R"({
+
3580 "method" : "ledger_closed",
+
3581 "params" : [
+
3582 {
+
3583 "api_version" : %API_VER%,
+
3584 }
+
3585 ]
+
3586 })"},
+
3587 {"ledger_closed: too many arguments.",
+
3588 __LINE__,
+
3589 {"ledger_closed", "today"},
+ +
3591 R"({
+
3592 "method" : "ledger_closed",
+
3593 "params" : [
+
3594 {
+
3595 "error" : "badSyntax",
+
3596 "error_code" : 1,
+
3597 "error_message" : "Syntax error."
+
3598 }
+
3599 ]
+
3600 })"},
+
3601
+
3602 // ledger_current
+
3603 // --------------------------------------------------------------
+
3604 {"ledger_current: minimal.",
+
3605 __LINE__,
+
3606 {"ledger_current"},
+ +
3608 R"({
+
3609 "method" : "ledger_current",
+
3610 "params" : [
+
3611 {
+
3612 "api_version" : %API_VER%,
+
3613 }
+
3614 ]
+
3615 })"},
+
3616 {"ledger_current: too many arguments.",
+
3617 __LINE__,
+
3618 {"ledger_current", "today"},
+ +
3620 R"({
+
3621 "method" : "ledger_current",
+
3622 "params" : [
+
3623 {
+
3624 "error" : "badSyntax",
+
3625 "error_code" : 1,
+
3626 "error_message" : "Syntax error."
+
3627 }
+
3628 ]
+
3629 })"},
+
3630
+
3631 // ledger_header
+
3632 // ---------------------------------------------------------------
+
3633 {"ledger_header: ledger index.",
+
3634 __LINE__,
+
3635 {"ledger_header", "4294967295"},
+ +
3637 R"({
+
3638 "method" : "ledger_header",
+
3639 "params" : [
+
3640 {
+
3641 "api_version" : %API_VER%,
+
3642 "ledger_index" : 4294967295
+
3643 }
+
3644 ]
+
3645 })"},
+
3646 {"ledger_header: ledger hash.",
+
3647 __LINE__,
+
3648 {"ledger_header",
+
3649 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
+ +
3651 R"({
+
3652 "method" : "ledger_header",
+
3653 "params" : [
+
3654 {
+
3655 "api_version" : %API_VER%,
+
3656 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
+
3657 }
+
3658 ]
+
3659 })"},
+
3660 {"ledger_header: too few arguments.",
+
3661 __LINE__,
+
3662 {
+
3663 "ledger_header",
+
3664 },
+ +
3666 R"({
+
3667 "method" : "ledger_header",
+
3668 "params" : [
+
3669 {
+
3670 "error" : "badSyntax",
+
3671 "error_code" : 1,
+
3672 "error_message" : "Syntax error."
+
3673 }
+
3674 ]
+
3675 })"},
+
3676 {"ledger_header: too many arguments.",
+
3677 __LINE__,
+
3678 {"ledger_header", "4294967295", "spare"},
+ +
3680 R"({
+
3681 "method" : "ledger_header",
+
3682 "params" : [
+
3683 {
+
3684 "error" : "badSyntax",
+
3685 "error_code" : 1,
+
3686 "error_message" : "Syntax error."
+
3687 }
+
3688 ]
+
3689 })"},
+
3690 {"ledger_header: text ledger index.",
+
3691 __LINE__,
+
3692 {"ledger_header", "current"},
+ +
3694 R"({
+
3695 "method" : "ledger_header",
+
3696 "params" : [
+
3697 {
+
3698 "api_version" : %API_VER%,
+
3699 "ledger_index" : 0
+
3700 }
+
3701 ]
+
3702 })"},
+
3703 {"ledger_header: ledger index too small.",
+
3704 __LINE__,
+
3705 {"ledger_header", "-1"},
+ +
3707 R"({
+
3708 "method" : "ledger_header",
+
3709 "params" : [
+
3710 {
+
3711 "api_version" : %API_VER%,
+
3712 "ledger_index" : 0
+
3713 }
+
3714 ]
+
3715 })"},
+
3716 {"ledger_header: ledger index too big.",
+
3717 __LINE__,
+
3718 {"ledger_header", "4294967296"},
+ +
3720 R"({
+
3721 "method" : "ledger_header",
+
3722 "params" : [
+
3723 {
+
3724 "api_version" : %API_VER%,
+
3725 "ledger_index" : 0
+
3726 }
+
3727 ]
+
3728 })"},
+
3729
+
3730 // ledger_request
+
3731 // --------------------------------------------------------------
+
3732 {"ledger_request: ledger index.",
+
3733 __LINE__,
+
3734 {"ledger_request", "4294967295"},
+ +
3736 R"({
+
3737 "method" : "ledger_request",
+
3738 "params" : [
+
3739 {
+
3740 "api_version" : %API_VER%,
+
3741 "ledger_index" : 4294967295
+
3742 }
+
3743 ]
+
3744 })"},
+
3745 {"ledger_request: ledger hash.",
+
3746 __LINE__,
+
3747 {"ledger_request",
+
3748 "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"},
+ +
3750 R"({
+
3751 "method" : "ledger_request",
+
3752 "params" : [
+
3753 {
+
3754 "api_version" : %API_VER%,
+
3755 "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
+
3756 }
+
3757 ]
+
3758 })"},
+
3759 {"ledger_request: too few arguments.",
+
3760 __LINE__,
+
3761 {
+
3762 "ledger_request",
+
3763 },
+ +
3765 R"({
+
3766 "method" : "ledger_request",
+
3767 "params" : [
+
3768 {
+
3769 "error" : "badSyntax",
+
3770 "error_code" : 1,
+
3771 "error_message" : "Syntax error."
+
3772 }
+
3773 ]
+
3774 })"},
+
3775 {"ledger_request: too many arguments.",
+
3776 __LINE__,
+
3777 {"ledger_request", "4294967295", "spare"},
+ +
3779 R"({
+
3780 "method" : "ledger_request",
+
3781 "params" : [
+
3782 {
+
3783 "error" : "badSyntax",
+
3784 "error_code" : 1,
+
3785 "error_message" : "Syntax error."
+
3786 }
+
3787 ]
+
3788 })"},
+
3789 {"ledger_request: text ledger index.",
+
3790 __LINE__,
+
3791 {"ledger_request", "current"},
+ +
3793 R"({
+
3794 "method" : "ledger_request",
+
3795 "params" : [
+
3796 {
+
3797 "api_version" : %API_VER%,
+
3798 "ledger_index" : 0
+
3799 }
+
3800 ]
+
3801 })"},
+
3802 {"ledger_request: ledger index too small.",
+
3803 __LINE__,
+
3804 {"ledger_request", "-1"},
+ +
3806 R"({
+
3807 "method" : "ledger_request",
+
3808 "params" : [
+
3809 {
+
3810 "api_version" : %API_VER%,
+
3811 "ledger_index" : 0
+
3812 }
+
3813 ]
+
3814 })"},
+
3815 {"ledger_request: ledger index too big.",
+
3816 __LINE__,
+
3817 {"ledger_request", "4294967296"},
+ +
3819 R"({
+
3820 "method" : "ledger_request",
+
3821 "params" : [
+
3822 {
+
3823 "api_version" : %API_VER%,
+
3824 "ledger_index" : 0
+
3825 }
+
3826 ]
+
3827 })"},
+
3828
+
3829 // log_level
+
3830 // -------------------------------------------------------------------
+
3831 {"log_level: minimal.",
+
3832 __LINE__,
+
3833 {
+
3834 "log_level",
+
3835 },
+ +
3837 R"({
+
3838 "method" : "log_level",
+
3839 "params" : [
+
3840 {
+
3841 "api_version" : %API_VER%,
+
3842 }
+
3843 ]
+
3844 })"},
+
3845 {"log_level: fatal.",
+
3846 __LINE__,
+
3847 {"log_level", "fatal"},
+ +
3849 R"({
+
3850 "method" : "log_level",
+
3851 "params" : [
+
3852 {
+
3853 "api_version" : %API_VER%,
+
3854 "severity" : "fatal"
+
3855 }
+
3856 ]
+
3857 })"},
+
3858 {"log_level: error.",
+
3859 __LINE__,
+
3860 {"log_level", "error"},
+ +
3862 R"({
+
3863 "method" : "log_level",
+
3864 "params" : [
+
3865 {
+
3866 "api_version" : %API_VER%,
+
3867 "severity" : "error"
+
3868 }
+
3869 ]
+
3870 })"},
+
3871 {"log_level: warn.",
+
3872 __LINE__,
+
3873 {"log_level", "warn"},
+ +
3875 R"({
+
3876 "method" : "log_level",
+
3877 "params" : [
+
3878 {
+
3879 "api_version" : %API_VER%,
+
3880 "severity" : "warn"
+
3881 }
+
3882 ]
+
3883 })"},
+
3884 {"log_level: debug.",
+
3885 __LINE__,
+
3886 {"log_level", "debug"},
+ +
3888 R"({
+
3889 "method" : "log_level",
+
3890 "params" : [
+
3891 {
+
3892 "api_version" : %API_VER%,
+
3893 "severity" : "debug"
+
3894 }
+
3895 ]
+
3896 })"},
+
3897 {"log_level: trace.",
+
3898 __LINE__,
+
3899 {"log_level", "trace"},
+ +
3901 R"({
+
3902 "method" : "log_level",
+
3903 "params" : [
+
3904 {
+
3905 "api_version" : %API_VER%,
+
3906 "severity" : "trace"
+
3907 }
+
3908 ]
+
3909 })"},
+
3910 {"log_level: base partition.",
+
3911 __LINE__,
+
3912 {"log_level", "base", "trace"},
+ +
3914 R"({
+
3915 "method" : "log_level",
+
3916 "params" : [
+
3917 {
+
3918 "api_version" : %API_VER%,
+
3919 "partition" : "base",
+
3920 "severity" : "trace"
+
3921 }
+
3922 ]
+
3923 })"},
+
3924 {"log_level: partiton_name.",
+
3925 __LINE__,
+
3926 {"log_level", "partition_name", "fatal"},
+ +
3928 R"({
+
3929 "method" : "log_level",
+
3930 "params" : [
+
3931 {
+
3932 "api_version" : %API_VER%,
+
3933 "partition" : "partition_name",
+
3934 "severity" : "fatal"
+
3935 }
+
3936 ]
+
3937 })"},
+
3938 {"log_level: too many arguments.",
+
3939 __LINE__,
+
3940 {"log_level", "partition_name", "fatal", "extra"},
+ +
3942 R"({
+
3943 "method" : "log_level",
+
3944 "params" : [
+
3945 {
+
3946 "error" : "badSyntax",
+
3947 "error_code" : 1,
+
3948 "error_message" : "Syntax error."
+
3949 }
+
3950 ]
+
3951 })"},
+
3952 {"log_level: invalid severity.",
+
3953 __LINE__,
+
3954 {"log_level", "err"},
+ +
3956 R"({
+
3957 "method" : "log_level",
+
3958 "params" : [
+
3959 {
+
3960 "api_version" : %API_VER%,
+
3961 "severity" : "err"
+
3962 }
+
3963 ]
+
3964 })"},
+
3965 {"log_level: swap partition name and severity.",
+
3966 __LINE__,
+
3967 {
+
3968 "log_level",
+
3969 "fatal",
+
3970 "partition_name",
+
3971 },
+ +
3973 R"({
+
3974 "method" : "log_level",
+
3975 "params" : [
+
3976 {
+
3977 "api_version" : %API_VER%,
+
3978 "partition" : "fatal",
+
3979 "severity" : "partition_name"
+
3980 }
+
3981 ]
+
3982 })"},
+
3983
+
3984 // logrotate
+
3985 // -------------------------------------------------------------------
+
3986 {"logrotate: minimal.",
+
3987 __LINE__,
+
3988 {
+
3989 "logrotate",
+
3990 },
+ +
3992 R"({
+
3993 "method" : "logrotate",
+
3994 "params" : [
+
3995 {
+
3996 "api_version" : %API_VER%,
+
3997 }
+
3998 ]
+
3999 })"},
+
4000 {"logrotate: too many arguments.",
+
4001 __LINE__,
+
4002 {"logrotate", "extra"},
+ +
4004 R"({
+
4005 "method" : "logrotate",
+
4006 "params" : [
+
4007 {
+
4008 "error" : "badSyntax",
+
4009 "error_code" : 1,
+
4010 "error_message" : "Syntax error."
+
4011 }
+
4012 ]
+
4013 })"},
+
4014
+
4015 // owner_info
+
4016 // ------------------------------------------------------------------
+
4017 {"owner_info: minimal.",
+
4018 __LINE__,
+
4019 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"},
+ +
4021 R"({
+
4022 "method" : "owner_info",
+
4023 "params" : [
+
4024 {
+
4025 "api_version" : %API_VER%,
+
4026 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
+
4027 }
+
4028 ]
+
4029 })"},
+
4030 {"owner_info: with numeric ledger index.",
+
4031 __LINE__,
+
4032 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "987654321"},
+ +
4034 R"({
+
4035 "method" : "owner_info",
+
4036 "params" : [
+
4037 {
+
4038 "api_version" : %API_VER%,
+
4039 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4040 "ledger_index" : 987654321
+
4041 }
+
4042 ]
+
4043 })"},
+
4044 {"owner_info: with text ledger index.",
+
4045 __LINE__,
+
4046 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"},
+ +
4048 R"({
+
4049 "method" : "owner_info",
+
4050 "params" : [
+
4051 {
+
4052 "api_version" : %API_VER%,
+
4053 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4054 "ledger_index" : "validated"
+
4055 }
+
4056 ]
+
4057 })"},
+
4058 {"owner_info: with ledger hash.",
+
4059 __LINE__,
+
4060 {"owner_info",
+
4061 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4062 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"},
+ +
4064 R"({
+
4065 "method" : "owner_info",
+
4066 "params" : [
+
4067 {
+
4068 "api_version" : %API_VER%,
+
4069 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4070 "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
+
4071 }
+
4072 ]
+
4073 })"},
+
4074 {"owner_info: with ledger index.",
+
4075 __LINE__,
+
4076 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"},
+ +
4078 R"({
+
4079 "method" : "owner_info",
+
4080 "params" : [
+
4081 {
+
4082 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4083 "api_version" : %API_VER%,
+
4084 "ledger_index" : "validated"
+
4085 }
+
4086 ]
+
4087 })"},
+
4088 {"owner_info: too few arguments.",
+
4089 __LINE__,
+
4090 {
+
4091 "owner_info",
+
4092 },
+ +
4094 R"({
+
4095 "method" : "owner_info",
+
4096 "params" : [
+
4097 {
+
4098 "error" : "badSyntax",
+
4099 "error_code" : 1,
+
4100 "error_message" : "Syntax error."
+
4101 }
+
4102 ]
+
4103 })"},
+
4104 {"owner_info: too many arguments.",
+
4105 __LINE__,
+
4106 {
+
4107 "owner_info",
+
4108 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4109 "current",
+
4110 "extra1",
+
4111 "extra2",
+
4112 },
+ +
4114 R"({
+
4115 "method" : "owner_info",
+
4116 "params" : [
+
4117 {
+
4118 "error" : "badSyntax",
+
4119 "error_code" : 1,
+
4120 "error_message" : "Syntax error."
+
4121 }
+
4122 ]
+
4123 })"},
+
4124 {
+
4125 "owner_info: invalid accountID.",
+
4126 __LINE__,
+
4127 {
+
4128 "owner_info",
+
4129 "", // Note: very few values are detected as bad!
+
4130 },
+ +
4132 R"({
+
4133 "method" : "owner_info",
+
4134 "params" : [
+
4135 {
+
4136 "error" : "actMalformed",
+
4137 "error_code" : 35,
+
4138 "error_message" : "Account malformed."
+
4139 }
+
4140 ]
+
4141 })",
+
4142 },
+
4143 {
+
4144 // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
+
4145 // cannot currently occur because jvParseLedger() always returns true.
+
4146 "owner_info: invalid ledger selection.",
+
4147 __LINE__,
+
4148 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"},
+ +
4150 R"({
+
4151 "method" : "owner_info",
+
4152 "params" : [
+
4153 {
+
4154 "api_version" : %API_VER%,
+
4155 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4156 "ledger_index" : 0
+
4157 }
+
4158 ]
+
4159 })",
+
4160 },
+
4161 {
+
4162 // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
+
4163 // cannot currently occur because jvParseLedger() always returns true.
+
4164 "owner_info: invalid ledger selection.",
+
4165 __LINE__,
+
4166 {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"},
+ +
4168 R"({
+
4169 "method" : "owner_info",
+
4170 "params" : [
+
4171 {
+
4172 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4173 "api_version" : %API_VER%,
+
4174 "ledger_index" : 0
+
4175 }
+
4176 ]
+
4177 })",
+
4178 },
+
4179
+
4180 // peers
+
4181 // -----------------------------------------------------------------------
+
4182 {"peers: minimal.",
+
4183 __LINE__,
+
4184 {
+
4185 "peers",
+
4186 },
+ +
4188 R"({
+
4189 "method" : "peers",
+
4190 "params" : [
+
4191 {
+
4192 "api_version" : %API_VER%,
+
4193 }
+
4194 ]
+
4195 })"},
+
4196 {"peers: too many arguments.",
+
4197 __LINE__,
+
4198 {"peers", "extra"},
+ +
4200 R"({
+
4201 "method" : "peers",
+
4202 "params" : [
+
4203 {
+
4204 "error" : "badSyntax",
+
4205 "error_code" : 1,
+
4206 "error_message" : "Syntax error."
+
4207 }
+
4208 ]
+
4209 })"},
+
4210
+
4211 // peer_reservations_add
+
4212 // -------------------------------------------------------
+
4213 {"peer_reservations_add: minimal.",
+
4214 __LINE__,
+
4215 {"peer_reservations_add", "public_key_string"},
+ +
4217 R"({
+
4218 "method" : "peer_reservations_add",
+
4219 "params" : [
+
4220 {
+
4221 "api_version" : %API_VER%,
+
4222 "public_key" : "public_key_string"
+
4223 }
+
4224 ]
+
4225 })"},
+
4226 {"peer_reservations_add: with description.",
+
4227 __LINE__,
+
4228 {"peer_reservations_add", "public_key_string", "public_key_description"},
+ +
4230 R"({
+
4231 "method" : "peer_reservations_add",
+
4232 "params" : [
+
4233 {
+
4234 "api_version" : %API_VER%,
+
4235 "description" : "public_key_description",
+
4236 "public_key" : "public_key_string"
+
4237 }
+
4238 ]
+
4239 })"},
+
4240 {"peer_reservations_add: too few arguments.",
+
4241 __LINE__,
+
4242 {"peer_reservations_add"},
+ +
4244 R"({
+
4245 "method" : "peer_reservations_add",
+
4246 "params" : [
+
4247 {
+
4248 "error" : "badSyntax",
+
4249 "error_code" : 1,
+
4250 "error_message" : "Syntax error."
+
4251 }
+
4252 ]
+
4253 })"},
+
4254 {"peer_reservations_add: too many arguments.",
+
4255 __LINE__,
+
4256 {"peer_reservations_add",
+
4257 "public_key_string",
+
4258 "public_key_description",
+
4259 "spare"},
+ +
4261 R"({
+
4262 "method" : "peer_reservations_add",
+
4263 "params" : [
+
4264 {
+
4265 "error" : "badSyntax",
+
4266 "error_code" : 1,
+
4267 "error_message" : "Syntax error."
+
4268 }
+
4269 ]
+
4270 })"},
+
4271
+
4272 // peer_reservations_del
+
4273 // -------------------------------------------------------
+
4274 {"peer_reservations_del: minimal.",
+
4275 __LINE__,
+
4276 {"peer_reservations_del", "public_key_string"},
+ +
4278 R"({
+
4279 "method" : "peer_reservations_del",
+
4280 "params" : [
+
4281 {
+
4282 "api_version" : %API_VER%,
+
4283 "public_key" : "public_key_string"
+
4284 }
+
4285 ]
+
4286 })"},
+
4287 {"peer_reservations_del: too few arguments.",
+
4288 __LINE__,
+
4289 {"peer_reservations_del"},
+ +
4291 R"({
+
4292 "method" : "peer_reservations_del",
+
4293 "params" : [
+
4294 {
+
4295 "error" : "badSyntax",
+
4296 "error_code" : 1,
+
4297 "error_message" : "Syntax error."
+
4298 }
+
4299 ]
+
4300 })"},
+
4301 {"peer_reservations_del: too many arguments.",
+
4302 __LINE__,
+
4303 {"peer_reservations_del",
+
4304 "public_key_string",
+
4305 "public_key_description",
+
4306 "spare"},
+ +
4308 R"({
+
4309 "method" : "peer_reservations_del",
+
4310 "params" : [
+
4311 {
+
4312 "error" : "badSyntax",
+
4313 "error_code" : 1,
+
4314 "error_message" : "Syntax error."
+
4315 }
+
4316 ]
+
4317 })"},
+
4318
+
4319 // ping
+
4320 // ------------------------------------------------------------------------
+
4321 {"ping: minimal.",
+
4322 __LINE__,
+
4323 {
+
4324 "ping",
+
4325 },
+ +
4327 R"({
+
4328 "method" : "ping",
+
4329 "params" : [
+
4330 {
+
4331 "api_version" : %API_VER%,
+
4332 }
+
4333 ]
+
4334 })"},
+
4335 {"ping: too many arguments.",
+
4336 __LINE__,
+
4337 {"ping", "extra"},
+ +
4339 R"({
+
4340 "method" : "ping",
+
4341 "params" : [
+
4342 {
+
4343 "error" : "badSyntax",
+
4344 "error_code" : 1,
+
4345 "error_message" : "Syntax error."
+
4346 }
+
4347 ]
+
4348 })"},
+
4349
+
4350 // print
+
4351 // -----------------------------------------------------------------------
+
4352 {"print: minimal.",
+
4353 __LINE__,
+
4354 {
+
4355 "print",
+
4356 },
+ +
4358 R"({
+
4359 "method" : "print",
+
4360 "params" : [
+
4361 {
+
4362 "api_version" : %API_VER%,
+
4363 }
+
4364 ]
+
4365 })"},
+
4366 {// The docs indicate that no arguments are allowed. So should this error?
+
4367 "print: extra argument.",
+
4368 __LINE__,
+
4369 {"print", "extra"},
+ +
4371 R"({
+
4372 "method" : "print",
+
4373 "params" : [
+
4374 {
+
4375 "api_version" : %API_VER%,
+
4376 "params" : [ "extra" ]
+
4377 }
+
4378 ]
+
4379 })"},
+
4380 {"print: too many arguments.",
+
4381 __LINE__,
+
4382 {"print", "extra1", "extra2"},
+ +
4384 R"({
+
4385 "method" : "print",
+
4386 "params" : [
+
4387 {
+
4388 "error" : "badSyntax",
+
4389 "error_code" : 1,
+
4390 "error_message" : "Syntax error."
+
4391 }
+
4392 ]
+
4393 })"},
+
4394
+
4395 // random
+
4396 // ----------------------------------------------------------------------
+
4397 {"random: minimal.",
+
4398 __LINE__,
+
4399 {
+
4400 "random",
+
4401 },
+ +
4403 R"({
+
4404 "method" : "random",
+
4405 "params" : [
+
4406 {
+
4407 "api_version" : %API_VER%,
+
4408 }
+
4409 ]
+
4410 })"},
+
4411 {"random: too many arguments.",
+
4412 __LINE__,
+
4413 {"random", "extra"},
+ +
4415 R"({
+
4416 "method" : "random",
+
4417 "params" : [
+
4418 {
+
4419 "error" : "badSyntax",
+
4420 "error_code" : 1,
+
4421 "error_message" : "Syntax error."
+
4422 }
+
4423 ]
+
4424 })"},
+
4425
+
4426 // ripple_path_find
+
4427 // ------------------------------------------------------------
+
4428 {"ripple_path_find: minimal.",
+
4429 __LINE__,
+
4430 {
+
4431 "ripple_path_find",
+
4432 R"({"json_argument":true})",
+
4433 },
+ +
4435 R"({
+
4436 "method" : "ripple_path_find",
+
4437 "params" : [
+
4438 {
+
4439 "api_version" : %API_VER%,
+
4440 "json_argument" : true
+
4441 }
+
4442 ]
+
4443 })"},
+
4444 {"ripple_path_find: ledger index.",
+
4445 __LINE__,
+
4446 {"ripple_path_find", R"({"json_argument":true})", "4294967295"},
+ +
4448 R"({
+
4449 "method" : "ripple_path_find",
+
4450 "params" : [
+
4451 {
+
4452 "api_version" : %API_VER%,
+
4453 "json_argument" : true,
+
4454 "ledger_index" : 4294967295
+
4455 }
+
4456 ]
+
4457 })"},
+
4458 {"ripple_path_find: text ledger index.",
+
4459 __LINE__,
+
4460 {"ripple_path_find", R"({"json_argument":true})", "closed"},
+ +
4462 R"({
+
4463 "method" : "ripple_path_find",
+
4464 "params" : [
+
4465 {
+
4466 "api_version" : %API_VER%,
+
4467 "json_argument" : true,
+
4468 "ledger_index" : "closed"
+
4469 }
+
4470 ]
+
4471 })"},
+
4472 {"ripple_path_find: ledger hash.",
+
4473 __LINE__,
+
4474 {"ripple_path_find",
+
4475 R"({"json_argument":true})",
+
4476 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"},
+ +
4478 R"({
+
4479 "method" : "ripple_path_find",
+
4480 "params" : [
+
4481 {
+
4482 "api_version" : %API_VER%,
+
4483 "json_argument" : true,
+
4484 "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
+
4485 }
+
4486 ]
+
4487 })"},
+
4488
+
4489 {"ripple_path_find: too few arguments.",
+
4490 __LINE__,
+
4491 {
+
4492 "ripple_path_find",
+
4493 },
+ +
4495 R"({
+
4496 "method" : "ripple_path_find",
+
4497 "params" : [
+
4498 {
+
4499 "error" : "badSyntax",
+
4500 "error_code" : 1,
+
4501 "error_message" : "Syntax error."
+
4502 }
+
4503 ]
+
4504 })"},
+
4505 {"ripple_path_find: too many arguments.",
+
4506 __LINE__,
+
4507 {"ripple_path_find", R"({"json_argument":true})", "current", "extra"},
+ +
4509 R"({
+
4510 "method" : "ripple_path_find",
+
4511 "params" : [
+
4512 {
+
4513 "error" : "badSyntax",
+
4514 "error_code" : 1,
+
4515 "error_message" : "Syntax error."
+
4516 }
+
4517 ]
+
4518 })"},
+
4519 {"ripple_path_find: invalid json (note extra comma).",
+
4520 __LINE__,
+
4521 {
+
4522 "ripple_path_find",
+
4523 R"({"json_argument":true,})",
+
4524 },
+ +
4526 R"({
+
4527 "method" : "ripple_path_find",
+
4528 "params" : [
+
4529 {
+
4530 "error" : "invalidParams",
+
4531 "error_code" : 31,
+
4532 "error_message" : "Invalid parameters."
+
4533 }
+
4534 ]
+
4535 })"},
+
4536 {"ripple_path_find: ledger index too small.",
+
4537 __LINE__,
+
4538 {"ripple_path_find", R"({"json_argument":true})", "-1"},
+ +
4540 R"({
+
4541 "method" : "ripple_path_find",
+
4542 "params" : [
+
4543 {
+
4544 "api_version" : %API_VER%,
+
4545 "json_argument" : true,
+
4546 "ledger_index" : 0
+
4547 }
+
4548 ]
+
4549 })"},
+
4550 {"ripple_path_find: ledger index too big.",
+
4551 __LINE__,
+
4552 {"ripple_path_find", R"({"json_argument":true})", "4294967296"},
+ +
4554 R"({
+
4555 "method" : "ripple_path_find",
+
4556 "params" : [
+
4557 {
+
4558 "api_version" : %API_VER%,
+
4559 "json_argument" : true,
+
4560 "ledger_index" : 0
+
4561 }
+
4562 ]
+
4563 })"},
+
4564 {"ripple_path_find: invalid text ledger index.",
+
4565 __LINE__,
+
4566 {"ripple_path_find", R"({"json_argument":true})", "cur"},
+ +
4568 R"({
+
4569 "method" : "ripple_path_find",
+
4570 "params" : [
+
4571 {
+
4572 "api_version" : %API_VER%,
+
4573 "json_argument" : true,
+
4574 "ledger_index" : 0
+
4575 }
+
4576 ]
+
4577 })"},
+
4578
+
4579 // sign
+
4580 // ------------------------------------------------------------------------
+
4581 {"sign: minimal.",
+
4582 __LINE__,
+
4583 {
+
4584 "sign",
+
4585 "my_secret",
+
4586 R"({"json_argument":true})",
+
4587 },
+ +
4589 R"({
+
4590 "method" : "sign",
+
4591 "params" : [
+
4592 {
+
4593 "api_version" : %API_VER%,
+
4594 "secret" : "my_secret",
+
4595 "tx_json" : {
+
4596 "json_argument" : true
+
4597 }
+
4598 }
+
4599 ]
+
4600 })"},
+
4601 {"sign: offline.",
+
4602 __LINE__,
+
4603 {"sign", "my_secret", R"({"json_argument":true})", "offline"},
+ +
4605 R"({
+
4606 "method" : "sign",
+
4607 "params" : [
+
4608 {
+
4609 "api_version" : %API_VER%,
+
4610 "offline" : true,
+
4611 "secret" : "my_secret",
+
4612 "tx_json" : {
+
4613 "json_argument" : true
+
4614 }
+
4615 }
+
4616 ]
+
4617 })"},
+
4618 {"sign: too few arguments.",
+
4619 __LINE__,
+
4620 {"sign", "contents_of_blob"},
+ +
4622 R"({
+
4623 "method" : "sign",
+
4624 "params" : [
+
4625 {
+
4626 "error" : "badSyntax",
+
4627 "error_code" : 1,
+
4628 "error_message" : "Syntax error."
+
4629 }
+
4630 ]
+
4631 })"},
+
4632 {"sign: offline flag with signature_target.",
+
4633 __LINE__,
+
4634 {"sign", "my_secret", R"({"json_argument":true})", "offline", "extra"},
+ +
4636 R"({
+
4637 "method" : "sign",
+
4638 "params" : [
+
4639 {
+
4640 "api_version" : %API_VER%,
+
4641 "offline" : true,
+
4642 "secret" : "my_secret",
+
4643 "signature_target" : "extra",
+
4644 "tx_json" :
+
4645 {
+
4646 "json_argument" : true
+
4647 }
+
4648 }
+
4649 ]
+
4650 })"},
+
4651 {"sign: too many arguments.",
+
4652 __LINE__,
+
4653 {"sign",
+
4654 "my_secret",
+
4655 R"({"json_argument":true})",
+
4656 "offline",
+
4657 "CounterpartySignature",
+
4658 "extra"},
+ +
4660 R"({
+
4661 "method" : "sign",
+
4662 "params" : [
+
4663 {
+
4664 "error" : "badSyntax",
+
4665 "error_code" : 1,
+
4666 "error_message" : "Syntax error."
+
4667 }
+
4668 ]
+
4669 })"},
+
4670 {"sign: invalid JSON (note extra comma).",
+
4671 __LINE__,
+
4672 {
+
4673 "sign",
+
4674 "my_secret",
+
4675 R"({"json_argument":true,})",
+
4676 },
+ +
4678 R"({
+
4679 "method" : "sign",
+
4680 "params" : [
+
4681 {
+
4682 "error" : "invalidParams",
+
4683 "error_code" : 31,
+
4684 "error_message" : "Invalid parameters."
+
4685 }
+
4686 ]
+
4687 })"},
+
4688 {"sign: misspelled offline flag interpreted as signature_target.",
+
4689 __LINE__,
+
4690 {"sign", "my_secret", R"({"json_argument":true})", "offlin"},
+ +
4692 R"({
+
4693 "method" : "sign",
+
4694 "params" : [
+
4695 {
+
4696 "api_version" : %API_VER%,
+
4697 "secret" : "my_secret",
+
4698 "signature_target" : "offlin",
+
4699 "tx_json" :
+
4700 {
+
4701 "json_argument" : true
+
4702 }
+
4703 }
+
4704 ]
+
4705 })"},
+
4706
+
4707 // sign_for
+
4708 // --------------------------------------------------------------------
+
4709 {"sign_for: minimal.",
+
4710 __LINE__,
+
4711 {
+
4712 "sign_for",
+
4713 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4714 "my_secret",
+
4715 R"({"json_argument":true})",
+
4716 },
+ +
4718 R"({
+
4719 "method" : "sign_for",
+
4720 "params" : [
+
4721 {
+
4722 "api_version" : %API_VER%,
+
4723 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4724 "secret" : "my_secret",
+
4725 "tx_json" : {
+
4726 "json_argument" : true
+
4727 }
+
4728 }
+
4729 ]
+
4730 })"},
+
4731 {"sign_for: offline.",
+
4732 __LINE__,
+
4733 {"sign_for",
+
4734 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4735 "my_secret",
+
4736 R"({"json_argument":true})",
+
4737 "offline"},
+ +
4739 R"({
+
4740 "method" : "sign_for",
+
4741 "params" : [
+
4742 {
+
4743 "api_version" : %API_VER%,
+
4744 "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4745 "offline" : true,
+
4746 "secret" : "my_secret",
+
4747 "tx_json" : {
+
4748 "json_argument" : true
+
4749 }
+
4750 }
+
4751 ]
+
4752 })"},
+
4753 {"sign_for: too few arguments.",
+
4754 __LINE__,
+
4755 {
+
4756 "sign_for",
+
4757 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4758 "my_secret",
+
4759 },
+ +
4761 R"({
+
4762 "method" : "sign_for",
+
4763 "params" : [
+
4764 {
+
4765 "error" : "badSyntax",
+
4766 "error_code" : 1,
+
4767 "error_message" : "Syntax error."
+
4768 }
+
4769 ]
+
4770 })"},
+
4771 {"sign_for: too many arguments.",
+
4772 __LINE__,
+
4773 {"sign_for",
+
4774 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4775 "my_secret",
+
4776 R"({"json_argument":true})",
+
4777 "offline",
+
4778 "extra"},
+ +
4780 R"({
+
4781 "method" : "sign_for",
+
4782 "params" : [
+
4783 {
+
4784 "error" : "badSyntax",
+
4785 "error_code" : 1,
+
4786 "error_message" : "Syntax error."
+
4787 }
+
4788 ]
+
4789 })"},
+
4790 {"sign_for: invalid json (note extra comma).",
+
4791 __LINE__,
+
4792 {
+
4793 "sign_for",
+
4794 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4795 "my_secret",
+
4796 R"({"json_argument":true,})",
+
4797 },
+ +
4799 R"({
+
4800 "method" : "sign_for",
+
4801 "params" : [
+
4802 {
+
4803 "error" : "invalidParams",
+
4804 "error_code" : 31,
+
4805 "error_message" : "Invalid parameters."
+
4806 }
+
4807 ]
+
4808 })"},
+
4809 {"sign_for: invalid final argument.",
+
4810 __LINE__,
+
4811 {"sign_for",
+
4812 "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
+
4813 "my_secret",
+
4814 R"({"json_argument":true})",
+
4815 "ofline"},
+ +
4817 R"({
+
4818 "method" : "sign_for",
+
4819 "params" : [
+
4820 {
+
4821 "error" : "invalidParams",
+
4822 "error_code" : 31,
+
4823 "error_message" : "Invalid parameters."
+
4824 }
+
4825 ]
+
4826 })"},
+
4827
+
4828 // submit
+
4829 // ----------------------------------------------------------------------
+
4830 {"submit: blob.",
+
4831 __LINE__,
+
4832 {"submit", "the blob is unvalidated and may be any length..."},
+ +
4834 R"({
+
4835 "method" : "submit",
+
4836 "params" : [
+
4837 {
+
4838 "api_version" : %API_VER%,
+
4839 "tx_blob" : "the blob is unvalidated and may be any length..."
+
4840 }
+
4841 ]
+
4842 })"},
+
4843 {"submit: json.",
+
4844 __LINE__,
+
4845 {
+
4846 "submit",
+
4847 "my_secret",
+
4848 R"({"json_argument":true})",
+
4849 },
+ +
4851 R"({
+
4852 "method" : "submit",
+
4853 "params" : [
+
4854 {
+
4855 "api_version" : %API_VER%,
+
4856 "secret" : "my_secret",
+
4857 "tx_json" : {
+
4858 "json_argument" : true
+
4859 }
+
4860 }
+
4861 ]
+
4862 })"},
+
4863 {"submit: too few arguments.",
+
4864 __LINE__,
+
4865 {
+
4866 "submit",
+
4867 },
+ +
4869 R"({
+
4870 "method" : "submit",
+
4871 "params" : [
+
4872 {
+
4873 "error" : "badSyntax",
+
4874 "error_code" : 1,
+
4875 "error_message" : "Syntax error."
+
4876 }
+
4877 ]
+
4878 })"},
+
4879 {// Note: I believe this _ought_ to be detected as too many arguments.
+
4880 "submit: four arguments.",
+
4881 __LINE__,
+
4882 {"submit", "my_secret", R"({"json_argument":true})", "offline"},
+ +
4884 R"({
+
4885 "method" : "submit",
+
4886 "params" : [
+
4887 {
+
4888 "api_version" : %API_VER%,
+
4889 "offline" : true,
+
4890 "secret" : "my_secret",
+
4891 "tx_json" : {
+
4892 "json_argument" : true
+
4893 }
+
4894 }
+
4895 ]
+
4896 })"},
+
4897 {"submit: offline flag with signature_target.",
+
4898 __LINE__,
+
4899 {"submit", "my_secret", R"({"json_argument":true})", "offline", "extra"},
+ +
4901 R"({
+
4902 "method" : "submit",
+
4903 "params" : [
+
4904 {
+
4905 "api_version" : %API_VER%,
+
4906 "offline" : true,
+
4907 "secret" : "my_secret",
+
4908 "signature_target" : "extra",
+
4909 "tx_json" :
+
4910 {
+
4911 "json_argument" : true
+
4912 }
+
4913 }
+
4914 ]
+
4915 })"},
+
4916 {"submit: too many arguments.",
+
4917 __LINE__,
+
4918 {"submit",
+
4919 "my_secret",
+
4920 R"({"json_argument":true})",
+
4921 "offline",
+
4922 "CounterpartySignature",
+
4923 "extra"},
+ +
4925 R"({
+
4926 "method" : "submit",
+
4927 "params" : [
+
4928 {
+
4929 "error" : "badSyntax",
+
4930 "error_code" : 1,
+
4931 "error_message" : "Syntax error."
+
4932 }
+
4933 ]
+
4934 })"},
+
4935 {"submit: invalid json (note extra comma).",
+
4936 __LINE__,
+
4937 {
+
4938 "submit",
+
4939 "my_secret",
+
4940 R"({"json_argument":true,})",
+
4941 },
+ +
4943 R"({
+
4944 "method" : "submit",
+
4945 "params" : [
+
4946 {
+
4947 "error" : "invalidParams",
+
4948 "error_code" : 31,
+
4949 "error_message" : "Invalid parameters."
+
4950 }
+
4951 ]
+
4952 })"},
+
4953 {"submit: misspelled offline flag interpreted as signature_target.",
+
4954 __LINE__,
+
4955 {"submit", "my_secret", R"({"json_argument":true})", "offlne"},
+ +
4957 R"({
+
4958 "method" : "submit",
+
4959 "params" : [
+
4960 {
+
4961 "api_version" : %API_VER%,
+
4962 "secret" : "my_secret",
+
4963 "signature_target" : "offlne",
+
4964 "tx_json" :
+
4965 {
+
4966 "json_argument" : true
+
4967 }
+
4968 }
+
4969 ]
+
4970 })"},
+
4971
+
4972 // submit_multisigned
+
4973 // ----------------------------------------------------------
+
4974 {"submit_multisigned: json.",
+
4975 __LINE__,
+
4976 {
+
4977 "submit_multisigned",
+
4978 R"({"json_argument":true})",
+
4979 },
+ +
4981 R"({
+
4982 "method" : "submit_multisigned",
+
4983 "params" : [
+
4984 {
+
4985 "api_version" : %API_VER%,
+
4986 "tx_json" : {
+
4987 "json_argument" : true
+
4988 }
+
4989 }
+
4990 ]
+
4991 })"},
+
4992 {"submit_multisigned: too few arguments.",
+
4993 __LINE__,
+
4994 {
+
4995 "submit_multisigned",
+
4996 },
+ +
4998 R"({
+
4999 "method" : "submit_multisigned",
+
5000 "params" : [
+
5001 {
+
5002 "error" : "badSyntax",
+
5003 "error_code" : 1,
+
5004 "error_message" : "Syntax error."
+
5005 }
+
5006 ]
+
5007 })"},
+
5008 {"submit_multisigned: too many arguments.",
+
5009 __LINE__,
+
5010 {"submit_multisigned", R"({"json_argument":true})", "extra"},
+ +
5012 R"({
+
5013 "method" : "submit_multisigned",
+
5014 "params" : [
+
5015 {
+
5016 "error" : "badSyntax",
+
5017 "error_code" : 1,
+
5018 "error_message" : "Syntax error."
+
5019 }
+
5020 ]
+
5021 })"},
+
5022 {"submit_multisigned: invalid json (note extra comma).",
+
5023 __LINE__,
+
5024 {
+
5025 "submit_multisigned",
+
5026 R"({"json_argument":true,})",
+
5027 },
+ +
5029 R"({
+
5030 "method" : "submit_multisigned",
+
5031 "params" : [
+
5032 {
+
5033 "error" : "invalidParams",
+
5034 "error_code" : 31,
+
5035 "error_message" : "Invalid parameters."
+
5036 }
+
5037 }
+
5038 ]
+
5039 })"},
+
5040
+
5041 // server_info
+
5042 // -----------------------------------------------------------------
+
5043 {"server_info: minimal.",
+
5044 __LINE__,
+
5045 {
+
5046 "server_info",
+
5047 },
+ +
5049 R"({
+
5050 "method" : "server_info",
+
5051 "params" : [
+
5052 {
+
5053 "api_version" : %API_VER%,
+
5054 }
+
5055 ]
+
5056 })"},
+
5057 {"server_info: counters.",
+
5058 __LINE__,
+
5059 {"server_info", "counters"},
+ +
5061 R"({
+
5062 "method" : "server_info",
+
5063 "params" : [
+
5064 {
+
5065 "api_version" : %API_VER%,
+
5066 "counters" : true
+
5067 }
+
5068 ]
+
5069 })"},
+
5070 {"server_info: too many arguments.",
+
5071 __LINE__,
+
5072 {"server_info", "counters", "extra"},
+ +
5074 R"({
+
5075 "method" : "server_info",
+
5076 "params" : [
+
5077 {
+
5078 "error" : "badSyntax",
+
5079 "error_code" : 1,
+
5080 "error_message" : "Syntax error."
+
5081 }
+
5082 ]
+
5083 })"},
+
5084 {"server_info: non-counters argument.",
+
5085 __LINE__,
+
5086 {"server_info", "counter"},
+ +
5088 R"({
+
5089 "method" : "server_info",
+
5090 "params" : [
+
5091 {
+
5092 "api_version" : %API_VER%,
+
5093 }
+
5094 ]
+
5095 })"},
+
5096
+
5097 // server_state
+
5098 // ----------------------------------------------------------------
+
5099 {"server_state: minimal.",
+
5100 __LINE__,
+
5101 {
+
5102 "server_state",
+
5103 },
+ +
5105 R"({
+
5106 "method" : "server_state",
+
5107 "params" : [
+
5108 {
+
5109 "api_version" : %API_VER%,
+
5110 }
+
5111 ]
+
5112 })"},
+
5113 {"server_state: counters.",
+
5114 __LINE__,
+
5115 {"server_state", "counters"},
+ +
5117 R"({
+
5118 "method" : "server_state",
+
5119 "params" : [
+
5120 {
+
5121 "api_version" : %API_VER%,
+
5122 "counters" : true
+
5123 }
+
5124 ]
+
5125 })"},
+
5126 {"server_state: too many arguments.",
+
5127 __LINE__,
+
5128 {"server_state", "counters", "extra"},
+ +
5130 R"({
+
5131 "method" : "server_state",
+
5132 "params" : [
+
5133 {
+
5134 "error" : "badSyntax",
+
5135 "error_code" : 1,
+
5136 "error_message" : "Syntax error."
+
5137 }
+
5138 ]
+
5139 })"},
+
5140 {"server_state: non-counters argument.",
+
5141 __LINE__,
+
5142 {"server_state", "counter"},
+ +
5144 R"({
+
5145 "method" : "server_state",
+
5146 "params" : [
+
5147 {
+
5148 "api_version" : %API_VER%,
+
5149 }
+
5150 ]
+
5151 })"},
+
5152
+
5153 // stop
+
5154 // ------------------------------------------------------------------------
+
5155 {"stop: minimal.",
+
5156 __LINE__,
+
5157 {
+
5158 "stop",
+
5159 },
+ +
5161 R"({
+
5162 "method" : "stop",
+
5163 "params" : [
+
5164 {
+
5165 "api_version" : %API_VER%,
+
5166 }
+
5167 ]
+
5168 })"},
+
5169 {"stop: too many arguments.",
+
5170 __LINE__,
+
5171 {"stop", "extra"},
+ +
5173 R"({
+
5174 "method" : "stop",
+
5175 "params" : [
+
5176 {
+
5177 "error" : "badSyntax",
+
5178 "error_code" : 1,
+
5179 "error_message" : "Syntax error."
+
5180 }
+
5181 ]
+
5182 })"},
+
5183
+
5184 // transaction_entry
+
5185 // -----------------------------------------------------------
+
5186 {"transaction_entry: ledger index.",
+
5187 __LINE__,
+
5188 {"transaction_entry",
+
5189 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5190 "4294967295"},
+ +
5192 R"({
+
5193 "method" : "transaction_entry",
+
5194 "params" : [
+
5195 {
+
5196 "api_version" : %API_VER%,
+
5197 "ledger_index" : 4294967295,
+
5198 "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
+
5199 }
+
5200 ]
+
5201 })"},
+
5202 {"transaction_entry: text ledger index.",
+
5203 __LINE__,
+
5204 {"transaction_entry",
+
5205 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5206 "current"},
+ +
5208 R"({
+
5209 "method" : "transaction_entry",
+
5210 "params" : [
+
5211 {
+
5212 "api_version" : %API_VER%,
+
5213 "ledger_index" : "current",
+
5214 "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
+
5215 }
+
5216 ]
+
5217 })"},
+
5218 {"transaction_entry: ledger hash.",
+
5219 __LINE__,
+
5220 {"transaction_entry",
+
5221 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5222 "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210"},
+ +
5224 R"({
+
5225 "method" : "transaction_entry",
+
5226 "params" : [
+
5227 {
+
5228 "api_version" : %API_VER%,
+
5229 "ledger_hash" : "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210",
+
5230 "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
+
5231 }
+
5232 ]
+
5233 })"},
+
5234 {"transaction_entry: too few arguments.",
+
5235 __LINE__,
+
5236 {
+
5237 "transaction_entry",
+
5238 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5239 },
+ +
5241 R"({
+
5242 "method" : "transaction_entry",
+
5243 "params" : [
+
5244 {
+
5245 "error" : "badSyntax",
+
5246 "error_code" : 1,
+
5247 "error_message" : "Syntax error."
+
5248 }
+
5249 ]
+
5250 })"},
+
5251 {"transaction_entry: too many arguments.",
+
5252 __LINE__,
+
5253 {"transaction_entry",
+
5254 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5255 "validated",
+
5256 "extra"},
+ +
5258 R"({
+
5259 "method" : "transaction_entry",
+
5260 "params" : [
+
5261 {
+
5262 "error" : "badSyntax",
+
5263 "error_code" : 1,
+
5264 "error_message" : "Syntax error."
+
5265 }
+
5266 ]
+
5267 })"},
+
5268 {"transaction_entry: short tx_hash.",
+
5269 __LINE__,
+
5270 {
+
5271 "transaction_entry",
+
5272 "123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5273 "validated",
+
5274 },
+ +
5276 R"({
+
5277 "method" : "transaction_entry",
+
5278 "params" : [
+
5279 {
+
5280 "error" : "invalidParams",
+
5281 "error_code" : 31,
+
5282 "error_message" : "Invalid parameters."
+
5283 }
+
5284 ]
+
5285 })"},
+
5286 {"transaction_entry: long tx_hash.",
+
5287 __LINE__,
+
5288 {
+
5289 "transaction_entry",
+
5290 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUVW",
+
5291 "validated",
+
5292 },
+ +
5294 R"({
+
5295 "method" : "transaction_entry",
+
5296 "params" : [
+
5297 {
+
5298 "error" : "invalidParams",
+
5299 "error_code" : 31,
+
5300 "error_message" : "Invalid parameters."
+
5301 }
+
5302 ]
+
5303 })"},
+
5304 {"transaction_entry: small ledger index.",
+
5305 __LINE__,
+
5306 {
+
5307 "transaction_entry",
+
5308 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5309 "0",
+
5310 },
+ +
5312 R"({
+
5313 "method" : "transaction_entry",
+
5314 "params" : [
+
5315 {
+
5316 "error" : "invalidParams",
+
5317 "error_code" : 31,
+
5318 "error_message" : "Invalid parameters."
+
5319 }
+
5320 ]
+
5321 })"},
+
5322 {"transaction_entry: large ledger index.",
+
5323 __LINE__,
+
5324 {
+
5325 "transaction_entry",
+
5326 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5327 "4294967296",
+
5328 },
+ +
5330 R"({
+
5331 "method" : "transaction_entry",
+
5332 "params" : [
+
5333 {
+
5334 "error" : "invalidParams",
+
5335 "error_code" : 31,
+
5336 "error_message" : "Invalid parameters."
+
5337 }
+
5338 ]
+
5339 })"},
+
5340 {"transaction_entry: short ledger hash.",
+
5341 __LINE__,
+
5342 {
+
5343 "transaction_entry",
+
5344 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5345 "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA987654321",
+
5346 },
+ +
5348 R"({
+
5349 "method" : "transaction_entry",
+
5350 "params" : [
+
5351 {
+
5352 "error" : "invalidParams",
+
5353 "error_code" : 31,
+
5354 "error_message" : "Invalid parameters."
+
5355 }
+
5356 ]
+
5357 })"},
+
5358 {"transaction_entry: long ledger hash.",
+
5359 __LINE__,
+
5360 {
+
5361 "transaction_entry",
+
5362 "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
+
5363 "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210Z",
+
5364 },
+ +
5366 R"({
+
5367 "method" : "transaction_entry",
+
5368 "params" : [
+
5369 {
+
5370 "error" : "invalidParams",
+
5371 "error_code" : 31,
+
5372 "error_message" : "Invalid parameters."
+
5373 }
+
5374 ]
+
5375 })"},
+
5376
+
5377 // tx
+
5378 // --------------------------------------------------------------------------
+
5379 {"tx: ctid. minimal",
+
5380 __LINE__,
+
5381 {"tx", "FFFFFFFFFFFFFFFF", "1", "2"},
+ +
5383 R"({
+
5384 "method" : "tx",
+
5385 "params" : [
+
5386 {
+
5387 "api_version" : %API_VER%,
+
5388 "ctid" : "FFFFFFFFFFFFFFFF",
+
5389 "max_ledger" : "2",
+
5390 "min_ledger" : "1"
+
5391 }
+
5392 ]
+
5393 })"},
+
5394 {"tx: ctid. binary",
+
5395 __LINE__,
+
5396 {"tx", "FFFFFFFFFFFFFFFF", "binary", "1", "2"},
+ +
5398 R"({
+
5399 "method" : "tx",
+
5400 "params" : [
+
5401 {
+
5402 "api_version" : %API_VER%,
+
5403 "binary" : true,
+
5404 "ctid" : "FFFFFFFFFFFFFFFF",
+
5405 "max_ledger" : "2",
+
5406 "min_ledger" : "1"
+
5407 }
+
5408 ]
+
5409 })"},
+
5410 {"tx: minimal.",
+
5411 __LINE__,
+
5412 {"tx", "transaction_hash_is_not_validated"},
+ +
5414 R"({
+
5415 "method" : "tx",
+
5416 "params" : [
+
5417 {
+
5418 "api_version" : %API_VER%,
+
5419 "transaction" : "transaction_hash_is_not_validated"
+
5420 }
+
5421 ]
+
5422 })"},
+
5423 {"tx: binary.",
+
5424 __LINE__,
+
5425 {"tx", "transaction_hash_is_not_validated", "binary"},
+ +
5427 R"({
+
5428 "method" : "tx",
+
5429 "params" : [
+
5430 {
+
5431 "api_version" : %API_VER%,
+
5432 "binary" : true,
+
5433 "transaction" : "transaction_hash_is_not_validated"
+
5434 }
+
5435 ]
+
5436 })"},
+
5437 {"tx: too few arguments.",
+
5438 __LINE__,
+
5439 {
+
5440 "tx",
+
5441 },
+ +
5443 R"({
+
5444 "method" : "tx",
+
5445 "params" : [
+
5446 {
+
5447 "error" : "badSyntax",
+
5448 "error_code" : 1,
+
5449 "error_message" : "Syntax error."
+
5450 }
+
5451 ]
+
5452 })"},
+
5453 {"tx: too many arguments.",
+
5454 __LINE__,
+
5455 {"tx", "transaction_hash_is_not_validated", "binary", "1", "2", "extra"},
+ +
5457 R"({
+
5458 "method" : "tx",
+
5459 "params" : [
+
5460 {
+
5461 "error" : "badSyntax",
+
5462 "error_code" : 1,
+
5463 "error_message" : "Syntax error."
+
5464 }
+
5465 ]
+
5466 })"},
+
5467 {"tx: invalid final argument is apparently ignored.",
+
5468 __LINE__,
+
5469 {"tx", "transaction_hash_is_not_validated", "bin"},
+ +
5471 R"({
+
5472 "method" : "tx",
+
5473 "params" : [
+
5474 {
+
5475 "api_version" : %API_VER%,
+
5476 "transaction" : "transaction_hash_is_not_validated"
+
5477 }
+
5478 ]
+
5479 })"},
+
5480
+
5481 // tx_history
+
5482 // ------------------------------------------------------------------
+
5483 {"tx_history: minimal.",
+
5484 __LINE__,
+
5485 {"tx_history", "0"},
+ +
5487 R"({
+
5488 "method" : "tx_history",
+
5489 "params" : [
+
5490 {
+
5491 "api_version" : %API_VER%,
+
5492 "start" : 0
+
5493 }
+
5494 ]
+
5495 })"},
+
5496 {"tx_history: too few arguments.",
+
5497 __LINE__,
+
5498 {
+
5499 "tx_history",
+
5500 },
+ +
5502 R"({
+
5503 "method" : "tx_history",
+
5504 "params" : [
+
5505 {
+
5506 "error" : "badSyntax",
+
5507 "error_code" : 1,
+
5508 "error_message" : "Syntax error."
+
5509 }
+
5510 ]
+
5511 })"},
+
5512 {"tx_history: too many arguments.",
+
5513 __LINE__,
+
5514 {"tx_history", "0", "1"},
+ +
5516 R"({
+
5517 "method" : "tx_history",
+
5518 "params" : [
+
5519 {
+
5520 "error" : "badSyntax",
+
5521 "error_code" : 1,
+
5522 "error_message" : "Syntax error."
+
5523 }
+
5524 ]
+
5525 })"},
+
5526 {
+
5527 // Note: this really shouldn't throw, but does at the moment.
+
5528 "tx_history: start too small.",
+
5529 __LINE__,
+
5530 {"tx_history", "-1"},
+ +
5532 R"()",
+
5533 },
+
5534 {
+
5535 // Note: this really shouldn't throw, but does at the moment.
+
5536 "tx_history: start too big.",
+
5537 __LINE__,
+
5538 {"tx_history", "4294967296"},
+ +
5540 R"()",
+
5541 },
+
5542 {
+
5543 // Note: this really shouldn't throw, but does at the moment.
+
5544 "tx_history: start not integer.",
+
5545 __LINE__,
+
5546 {"tx_history", "beginning"},
+ +
5548 R"()",
+
5549 },
+
5550
+
5551 // unl_list
+
5552 // --------------------------------------------------------------------
+
5553 {"unl_list: minimal.",
+
5554 __LINE__,
+
5555 {
+
5556 "unl_list",
+
5557 },
+ +
5559 R"({
+
5560 "method" : "unl_list",
+
5561 "params" : [
+
5562 {
+
5563 "api_version" : %API_VER%,
+
5564 }
+
5565 ]
+
5566 })"},
+
5567 {"unl_list: too many arguments.",
+
5568 __LINE__,
+
5569 {"unl_list", "extra"},
+ +
5571 R"({
+
5572 "method" : "unl_list",
+
5573 "params" : [
+
5574 {
+
5575 "error" : "badSyntax",
+
5576 "error_code" : 1,
+
5577 "error_message" : "Syntax error."
+
5578 }
+
5579 ]
+
5580 })"},
+
5581
+
5582 // validation_create
+
5583 // -----------------------------------------------------------
+
5584 {"validation_create: minimal.",
+
5585 __LINE__,
+
5586 {
+
5587 "validation_create",
+
5588 },
+ +
5590 R"({
+
5591 "method" : "validation_create",
+
5592 "params" : [
+
5593 {
+
5594 "api_version" : %API_VER%,
+
5595 }
+
5596 ]
+
5597 })"},
+
5598 {"validation_create: with secret.",
+
5599 __LINE__,
+
5600 {"validation_create", "the form of the secret is not validated"},
+ +
5602 R"({
+
5603 "method" : "validation_create",
+
5604 "params" : [
+
5605 {
+
5606 "api_version" : %API_VER%,
+
5607 "secret" : "the form of the secret is not validated"
+
5608 }
+
5609 ]
+
5610 })"},
+
5611 {"validation_create: too many arguments.",
+
5612 __LINE__,
+
5613 {"validation_create", "the form of the secret is not validated", "extra"},
+ +
5615 R"({
+
5616 "method" : "validation_create",
+
5617 "params" : [
+
5618 {
+
5619 "error" : "badSyntax",
+
5620 "error_code" : 1,
+
5621 "error_message" : "Syntax error."
+
5622 }
+
5623 ]
+
5624 })"},
+
5625
+
5626 // version
+
5627 // ---------------------------------------------------------------------
+
5628 {"version: minimal.",
+
5629 __LINE__,
+
5630 {
+
5631 "version",
+
5632 },
+ +
5634 R"({
+
5635 "method" : "version",
+
5636 "params" : [
+
5637 {
+
5638 "api_version" : %API_VER%,
+
5639 }
+
5640 ]
+
5641 })"},
+
5642 {"version: too many arguments.",
+
5643 __LINE__,
+
5644 {"version", "extra"},
+ +
5646 R"({
+
5647 "method" : "version",
+
5648 "params" : [
+
5649 {
+
5650 "error" : "badSyntax",
+
5651 "error_code" : 1,
+
5652 "error_message" : "Syntax error."
+
5653 }
+
5654 ]
+
5655 })"},
+
5656
+
5657 // wallet_propose
+
5658 // --------------------------------------------------------------
+
5659 {"wallet_propose: minimal.",
+
5660 __LINE__,
+
5661 {
+
5662 "wallet_propose",
+
5663 },
+ +
5665 R"({
+
5666 "method" : "wallet_propose",
+
5667 "params" : [
+
5668 {
+
5669 "api_version" : %API_VER%,
+
5670 }
+
5671 ]
+
5672 })"},
+
5673 {"wallet_propose: with passphrase.",
+
5674 __LINE__,
+
5675 {"wallet_propose", "the form of the passphrase is not validated"},
+ +
5677 R"({
+
5678 "method" : "wallet_propose",
+
5679 "params" : [
+
5680 {
+
5681 "api_version" : %API_VER%,
+
5682 "passphrase" : "the form of the passphrase is not validated"
+
5683 }
+
5684 ]
+
5685 })"},
+
5686 {"wallet_propose: too many arguments.",
+
5687 __LINE__,
+
5688 {"wallet_propose", "the form of the passphrase is not validated", "extra"},
+ +
5690 R"({
+
5691 "method" : "wallet_propose",
+
5692 "params" : [
+
5693 {
+
5694 "error" : "badSyntax",
+
5695 "error_code" : 1,
+
5696 "error_message" : "Syntax error."
+
5697 }
+
5698 ]
+
5699 })"},
+
5700
+
5701 // internal
+
5702 // --------------------------------------------------------------------
+
5703 {"internal: minimal.",
+
5704 __LINE__,
+
5705 {"internal", "command_name"},
+ +
5707 R"({
+
5708 "method" : "internal",
+
5709 "params" : [
+
5710 {
+
5711 "api_version" : %API_VER%,
+
5712 "internal_command" : "command_name",
+
5713 "params" : []
+
5714 }
+
5715 ]
+
5716 })"},
+
5717 {"internal: with parameters.",
+
5718 __LINE__,
+
5719 {"internal",
+
5720 "command_name",
+
5721 "string_arg",
+
5722 "1",
+
5723 "-1",
+
5724 "4294967296",
+
5725 "3.14159"},
+ +
5727 R"({
+
5728 "method" : "internal",
+
5729 "params" : [
+
5730 {
+
5731 "api_version" : %API_VER%,
+
5732 "internal_command" : "command_name",
+
5733 "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ]
+
5734 }
+
5735 ]
+
5736 })"},
+
5737 {"internal: too few arguments.",
+
5738 __LINE__,
+
5739 {
+
5740 "internal",
+
5741 },
+ +
5743 R"({
+
5744 "method" : "internal",
+
5745 "params" : [
+
5746 {
+
5747 "error" : "badSyntax",
+
5748 "error_code" : 1,
+
5749 "error_message" : "Syntax error."
+
5750 }
+
5751 ]
+
5752 })"},
+
5753
+
5754 // path_find
+
5755 // -------------------------------------------------------------------
+
5756 {"path_find: minimal.",
+
5757 __LINE__,
+
5758 {
+
5759 "path_find",
+
5760 },
+ +
5762 R"({
+
5763 "method" : "path_find",
+
5764 "params" : [
+
5765 {
+
5766 "error" : "noEvents",
+
5767 "error_code" : 7,
+
5768 "error_message" : "Current transport does not support events."
+
5769 }
+
5770 ]
+
5771 })"},
+
5772 {"path_find: with arguments.",
+
5773 __LINE__,
+
5774 {"path_find", "string_arg", "1", "-1", "4294967296", "3.14159"},
+ +
5776 R"({
+
5777 "method" : "path_find",
+
5778 "params" : [
+
5779 {
+
5780 "error" : "noEvents",
+
5781 "error_code" : 7,
+
5782 "error_message" : "Current transport does not support events."
+
5783 }
+
5784 ]
+
5785 })"},
+
5786
+
5787 // subscribe
+
5788 // -------------------------------------------------------------------
+
5789 {"subscribe: minimal.",
+
5790 __LINE__,
+
5791 {
+
5792 "subscribe",
+
5793 },
+ +
5795 R"({
+
5796 "method" : "subscribe",
+
5797 "params" : [
+
5798 {
+
5799 "error" : "noEvents",
+
5800 "error_code" : 7,
+
5801 "error_message" : "Current transport does not support events."
+
5802 }
+
5803 ]
+
5804 })"},
+
5805 {"subscribe: with arguments.",
+
5806 __LINE__,
+
5807 {"subscribe", "string_arg", "1", "-1", "4294967296", "3.14159"},
+ +
5809 R"({
+
5810 "method" : "subscribe",
+
5811 "params" : [
+
5812 {
+
5813 "error" : "noEvents",
+
5814 "error_code" : 7,
+
5815 "error_message" : "Current transport does not support events."
+
5816 }
+
5817 ]
+
5818 })"},
+
5819
+
5820 // unsubscribe
+
5821 // -----------------------------------------------------------------
+
5822 {"unsubscribe: minimal.",
+
5823 __LINE__,
+
5824 {
+
5825 "unsubscribe",
+
5826 },
+ +
5828 R"({
+
5829 "method" : "unsubscribe",
+
5830 "params" : [
+
5831 {
+
5832 "error" : "noEvents",
+
5833 "error_code" : 7,
+
5834 "error_message" : "Current transport does not support events."
+
5835 }
+
5836 ]
+
5837 })"},
+
5838 {"unsubscribe: with arguments.",
+
5839 __LINE__,
+
5840 {"unsubscribe", "string_arg", "1", "-1", "4294967296", "3.14159"},
+ +
5842 R"({
+
5843 "method" : "unsubscribe",
+
5844 "params" : [
+
5845 {
+
5846 "error" : "noEvents",
+
5847 "error_code" : 7,
+
5848 "error_message" : "Current transport does not support events."
+
5849 }
+
5850 ]
+
5851 })"},
+
5852
+
5853 // unknown_command
+
5854 // -------------------------------------------------------------
+
5855 {"unknown_command: minimal.",
+
5856 __LINE__,
+
5857 {
+
5858 "unknown_command",
+
5859 },
+ +
5861 R"({
+
5862 "method" : "unknown_command",
+
5863 "params" : [
+
5864 {
+
5865 "api_version" : %API_VER%,
+
5866 }
+
5867 ]
+
5868 })"},
+
5869 {"unknown_command: with arguments.",
+
5870 __LINE__,
+
5871 {"unknown_command", "string_arg", "1", "-1", "4294967296", "3.14159"},
+ +
5873 R"({
+
5874 "method" : "unknown_command",
+
5875 "params" : [
+
5876 {
+
5877 "api_version" : %API_VER%,
+
5878 "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ]
+
5879 }
+
5880 ]
+
5881 })"},
+
5882};
-
5880
- -
-
5882updateAPIVersionString(char const* const req, unsigned apiVersion)
-
5883{
-
5884 std::string const version_str = std::to_string(apiVersion);
-
5885 static auto const place_holder = "%API_VER%";
-
5886 std::string jr(req);
-
5887 boost::replace_all(jr, place_holder, version_str);
-
5888 return jr;
-
5889}
+
5883
+ +
+
5885updateAPIVersionString(char const* const req, unsigned apiVersion)
+
5886{
+
5887 std::string const version_str = std::to_string(apiVersion);
+
5888 static auto const place_holder = "%API_VER%";
+
5889 std::string jr(req);
+
5890 boost::replace_all(jr, place_holder, version_str);
+
5891 return jr;
+
5892}
-
5890
- -
-
5892makeNetworkConfig(uint32_t networkID)
-
5893{
-
5894 using namespace test::jtx;
-
5895 return envconfig([&](std::unique_ptr<Config> cfg) {
-
5896 cfg->NETWORK_ID = networkID;
-
5897 return cfg;
-
5898 });
-
5899}
+
5893
+ +
+
5895makeNetworkConfig(uint32_t networkID)
+
5896{
+
5897 using namespace test::jtx;
+
5898 return envconfig([&](std::unique_ptr<Config> cfg) {
+
5899 cfg->NETWORK_ID = networkID;
+
5900 return cfg;
+
5901 });
+
5902}
-
5900
-
- -
5902{
-
5903public:
-
5904 void
-
-
5905 testRPCCall(unsigned apiVersion)
-
5906 {
-
5907 testcase << "RPCCall API version " << apiVersion;
-
5908 if (!BEAST_EXPECT(
-
5909 apiVersion >= RPC::apiMinimumSupportedVersion &&
-
5910 apiVersion <= RPC::apiMaximumValidVersion))
-
5911 return;
-
5912
-
5913 test::jtx::Env env(
-
5914 *this, makeNetworkConfig(11111)); // Used only for its Journal.
+
5903
+
+ +
5905{
+
5906public:
+
5907 void
+
+
5908 testRPCCall(unsigned apiVersion)
+
5909 {
+
5910 testcase << "RPCCall API version " << apiVersion;
+
5911 if (!BEAST_EXPECT(
+
5912 apiVersion >= RPC::apiMinimumSupportedVersion &&
+
5913 apiVersion <= RPC::apiMaximumValidVersion))
+
5914 return;
5915
-
5916 // For each RPCCall test.
-
5917 for (RPCCallTestData const& rpcCallTest : rpcCallTestArray)
-
5918 {
-
5919 if (!BEAST_EXPECT(!rpcCallTest.exp.empty()))
-
5920 break;
-
5921
-
5922 std::vector<std::string> const args{
-
5923 rpcCallTest.args.begin(), rpcCallTest.args.end()};
+
5916 test::jtx::Env env(
+
5917 *this, makeNetworkConfig(11111)); // Used only for its Journal.
+
5918
+
5919 // For each RPCCall test.
+
5920 for (RPCCallTestData const& rpcCallTest : rpcCallTestArray)
+
5921 {
+
5922 if (!BEAST_EXPECT(!rpcCallTest.exp.empty()))
+
5923 break;
5924
-
5925 char const* const expVersioned =
-
5926 (apiVersion - RPC::apiMinimumSupportedVersion) <
-
5927 rpcCallTest.exp.size()
-
5928 ? rpcCallTest.exp[apiVersion - RPC::apiMinimumSupportedVersion]
-
5929 : rpcCallTest.exp.back();
-
5930
-
5931 // Note that, over the long term, none of these tests should
-
5932 // throw. But, for the moment, some of them do. So handle it.
-
5933 Json::Value got;
-
5934 try
-
5935 {
-
5936 got = jtx::cmdToJSONRPC(args, env.journal, apiVersion);
-
5937 }
-
5938 catch (std::bad_cast const&)
-
5939 {
-
5940 if ((rpcCallTest.throwsWhat == RPCCallTestData::bad_cast) &&
-
5941 (std::strlen(expVersioned) == 0))
-
5942 {
-
5943 pass();
-
5944 }
-
5945 else
-
5946 {
-
5947 fail(rpcCallTest.description, __FILE__, rpcCallTest.line);
-
5948 }
-
5949 // Try the next test.
-
5950 continue;
-
5951 }
-
5952
-
5953 Json::Value exp;
- -
5955 updateAPIVersionString(expVersioned, apiVersion), exp);
-
5956
-
5957 // Lambda to remove the "params[0u]:error_code" field if present.
-
5958 // Error codes are not expected to be stable between releases.
-
5959 auto rmErrorCode = [](Json::Value& json) {
-
5960 if (json.isMember(jss::params) && json[jss::params].isArray() &&
-
5961 json[jss::params].size() > 0 &&
-
5962 json[jss::params][0u].isObject())
-
5963 {
-
5964 json[jss::params][0u].removeMember(jss::error_code);
-
5965 }
-
5966 };
-
5967 rmErrorCode(got);
-
5968 rmErrorCode(exp);
-
5969
-
5970 // Pass if we didn't expect a throw and we got what we expected.
-
5971 if ((rpcCallTest.throwsWhat == RPCCallTestData::no_exception) &&
-
5972 (got == exp))
-
5973 {
-
5974 pass();
-
5975 }
-
5976 else
-
5977 {
-
5978 fail(rpcCallTest.description, __FILE__, rpcCallTest.line);
-
5979 }
-
5980 }
-
5981 }
+
5925 std::vector<std::string> const args{
+
5926 rpcCallTest.args.begin(), rpcCallTest.args.end()};
+
5927
+
5928 char const* const expVersioned =
+
5929 (apiVersion - RPC::apiMinimumSupportedVersion) <
+
5930 rpcCallTest.exp.size()
+
5931 ? rpcCallTest.exp[apiVersion - RPC::apiMinimumSupportedVersion]
+
5932 : rpcCallTest.exp.back();
+
5933
+
5934 // Note that, over the long term, none of these tests should
+
5935 // throw. But, for the moment, some of them do. So handle it.
+
5936 Json::Value got;
+
5937 try
+
5938 {
+
5939 got = jtx::cmdToJSONRPC(args, env.journal, apiVersion);
+
5940 }
+
5941 catch (std::bad_cast const&)
+
5942 {
+
5943 if ((rpcCallTest.throwsWhat == RPCCallTestData::bad_cast) &&
+
5944 (std::strlen(expVersioned) == 0))
+
5945 {
+
5946 pass();
+
5947 }
+
5948 else
+
5949 {
+
5950 fail(rpcCallTest.description, __FILE__, rpcCallTest.line);
+
5951 }
+
5952 // Try the next test.
+
5953 continue;
+
5954 }
+
5955
+
5956 Json::Value exp;
+ +
5958 updateAPIVersionString(expVersioned, apiVersion), exp);
+
5959
+
5960 // Lambda to remove the "params[0u]:error_code" field if present.
+
5961 // Error codes are not expected to be stable between releases.
+
5962 auto rmErrorCode = [](Json::Value& json) {
+
5963 if (json.isMember(jss::params) && json[jss::params].isArray() &&
+
5964 json[jss::params].size() > 0 &&
+
5965 json[jss::params][0u].isObject())
+
5966 {
+
5967 json[jss::params][0u].removeMember(jss::error_code);
+
5968 }
+
5969 };
+
5970 rmErrorCode(got);
+
5971 rmErrorCode(exp);
+
5972
+
5973 // Pass if we didn't expect a throw and we got what we expected.
+
5974 if ((rpcCallTest.throwsWhat == RPCCallTestData::no_exception) &&
+
5975 (got == exp))
+
5976 {
+
5977 pass();
+
5978 }
+
5979 else
+
5980 {
+
5981 fail(rpcCallTest.description, __FILE__, rpcCallTest.line);
+
5982 }
+
5983 }
+
5984 }
-
5982
-
5983 void
-
-
5984 run() override
-
5985 {
- -
5987 }
+
5985
+
5986 void
+
+
5987 run() override
+
5988 {
+ +
5990 }
-
5988};
+
5991};
-
5989
-
5990BEAST_DEFINE_TESTSUITE(RPCCall, rpc, ripple);
-
5991
-
5992} // namespace test
-
5993} // namespace ripple
+
5992
+
5993BEAST_DEFINE_TESTSUITE(RPCCall, rpc, ripple);
+
5994
+
5995} // namespace test
+
5996} // namespace ripple
T begin(T... args)
@@ -6103,9 +6106,9 @@ $(document).ready(function() { init_codefold(0); });
void pass()
Record a successful test condition.
Definition suite.h:508
testcase_t testcase
Memberspace for declaring test cases.
Definition suite.h:152
void fail(String const &reason, char const *file, int line)
Record a failure.
Definition suite.h:530
- -
void testRPCCall(unsigned apiVersion)
-
void run() override
Runs the suite.
+ +
void testRPCCall(unsigned apiVersion)
+
void run() override
Runs the suite.
A transaction testing environment.
Definition Env.h:102
beast::Journal const journal
Definition Env.h:143
Inject raw JSON.
Definition jtx_json.h:14
@@ -6116,9 +6119,9 @@ $(document).ready(function() { init_codefold(0); });
static constexpr auto apiMinimumSupportedVersion
Definition ApiVersion.h:42
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Definition envconfig.h:35
Json::Value cmdToJSONRPC(std::vector< std::string > const &args, beast::Journal j, unsigned int apiVersion)
Given a rippled unit test rpc command, return the corresponding JSON.
Definition utility.cpp:67
-
std::string updateAPIVersionString(char const *const req, unsigned apiVersion)
+
std::string updateAPIVersionString(char const *const req, unsigned apiVersion)
static RPCCallTestData const rpcCallTestArray[]
-
std::unique_ptr< Config > makeNetworkConfig(uint32_t networkID)
+
std::unique_ptr< Config > makeNetworkConfig(uint32_t networkID)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
void forAllApiVersions(Fn const &fn, Args &&... args)
Definition ApiVersion.h:158
T strlen(T... args)
diff --git a/RPCSub_8cpp_source.html b/RPCSub_8cpp_source.html index a99fa3d519..86ba83e765 100644 --- a/RPCSub_8cpp_source.html +++ b/RPCSub_8cpp_source.html @@ -348,7 +348,7 @@ $(document).ready(function() { init_codefold(0); });
T is_same_v
T make_pair(T... args)
-
void fromNetwork(boost::asio::io_context &io_context, std::string const &strIp, std::uint16_t const iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, bool const bSSL, bool const quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition RPCCall.cpp:1642
+
void fromNetwork(boost::asio::io_context &io_context, std::string const &strIp, std::uint16_t const iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, bool const bSSL, bool const quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition RPCCall.cpp:1658
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
bool parseUrl(parsedURL &pUrl, std::string const &strUrl)
std::shared_ptr< RPCSub > make_RPCSub(InfoSub::Source &source, boost::asio::io_context &io_context, JobQueue &jobQueue, std::string const &strUrl, std::string const &strUsername, std::string const &strPassword, Logs &logs)
Definition RPCSub.cpp:189
diff --git a/classripple_1_1RPCParser.html b/classripple_1_1RPCParser.html index c8c3f5ef8e..99556a83af 100644 --- a/classripple_1_1RPCParser.html +++ b/classripple_1_1RPCParser.html @@ -276,7 +276,7 @@ Private Attributes
-

Definition at line 1179 of file RPCCall.cpp.

+

Definition at line 1195 of file RPCCall.cpp.

@@ -577,7 +577,7 @@ Private Attributes
-

Definition at line 354 of file RPCCall.cpp.

+

Definition at line 370 of file RPCCall.cpp.

@@ -605,7 +605,7 @@ Private Attributes
-

Definition at line 372 of file RPCCall.cpp.

+

Definition at line 388 of file RPCCall.cpp.

@@ -633,7 +633,7 @@ Private Attributes
-

Definition at line 401 of file RPCCall.cpp.

+

Definition at line 417 of file RPCCall.cpp.

@@ -661,7 +661,7 @@ Private Attributes
-

Definition at line 423 of file RPCCall.cpp.

+

Definition at line 439 of file RPCCall.cpp.

@@ -689,7 +689,7 @@ Private Attributes
-

Definition at line 430 of file RPCCall.cpp.

+

Definition at line 446 of file RPCCall.cpp.

@@ -717,7 +717,7 @@ Private Attributes
-

Definition at line 457 of file RPCCall.cpp.

+

Definition at line 473 of file RPCCall.cpp.

@@ -745,7 +745,7 @@ Private Attributes
-

Definition at line 470 of file RPCCall.cpp.

+

Definition at line 486 of file RPCCall.cpp.

@@ -773,7 +773,7 @@ Private Attributes
-

Definition at line 499 of file RPCCall.cpp.

+

Definition at line 515 of file RPCCall.cpp.

@@ -801,7 +801,7 @@ Private Attributes
-

Definition at line 521 of file RPCCall.cpp.

+

Definition at line 537 of file RPCCall.cpp.

@@ -829,7 +829,7 @@ Private Attributes
-

Definition at line 551 of file RPCCall.cpp.

+

Definition at line 567 of file RPCCall.cpp.

@@ -857,7 +857,7 @@ Private Attributes
-

Definition at line 602 of file RPCCall.cpp.

+

Definition at line 618 of file RPCCall.cpp.

@@ -885,7 +885,7 @@ Private Attributes
-

Definition at line 631 of file RPCCall.cpp.

+

Definition at line 647 of file RPCCall.cpp.

@@ -913,7 +913,7 @@ Private Attributes
-

Definition at line 652 of file RPCCall.cpp.

+

Definition at line 668 of file RPCCall.cpp.

@@ -941,7 +941,7 @@ Private Attributes
-

Definition at line 670 of file RPCCall.cpp.

+

Definition at line 686 of file RPCCall.cpp.

@@ -969,7 +969,7 @@ Private Attributes
-

Definition at line 691 of file RPCCall.cpp.

+

Definition at line 707 of file RPCCall.cpp.

@@ -997,7 +997,7 @@ Private Attributes
-

Definition at line 697 of file RPCCall.cpp.

+

Definition at line 713 of file RPCCall.cpp.

@@ -1025,7 +1025,7 @@ Private Attributes
-

Definition at line 704 of file RPCCall.cpp.

+

Definition at line 720 of file RPCCall.cpp.

@@ -1053,7 +1053,7 @@ Private Attributes
-

Definition at line 711 of file RPCCall.cpp.

+

Definition at line 727 of file RPCCall.cpp.

@@ -1081,7 +1081,7 @@ Private Attributes
-

Definition at line 718 of file RPCCall.cpp.

+

Definition at line 734 of file RPCCall.cpp.

@@ -1109,7 +1109,7 @@ Private Attributes
-

Definition at line 762 of file RPCCall.cpp.

+

Definition at line 778 of file RPCCall.cpp.

@@ -1147,7 +1147,7 @@ Private Attributes
-

Definition at line 790 of file RPCCall.cpp.

+

Definition at line 806 of file RPCCall.cpp.

@@ -1175,7 +1175,7 @@ Private Attributes
-

Definition at line 827 of file RPCCall.cpp.

+

Definition at line 843 of file RPCCall.cpp.

@@ -1203,7 +1203,7 @@ Private Attributes
-

Definition at line 847 of file RPCCall.cpp.

+

Definition at line 863 of file RPCCall.cpp.

@@ -1231,7 +1231,7 @@ Private Attributes
-

Definition at line 865 of file RPCCall.cpp.

+

Definition at line 881 of file RPCCall.cpp.

@@ -1259,7 +1259,7 @@ Private Attributes
-

Definition at line 878 of file RPCCall.cpp.

+

Definition at line 894 of file RPCCall.cpp.

@@ -1287,7 +1287,7 @@ Private Attributes
-

Definition at line 887 of file RPCCall.cpp.

+

Definition at line 903 of file RPCCall.cpp.

@@ -1315,7 +1315,7 @@ Private Attributes
-

Definition at line 913 of file RPCCall.cpp.

+

Definition at line 929 of file RPCCall.cpp.

@@ -1343,7 +1343,7 @@ Private Attributes
-

Definition at line 944 of file RPCCall.cpp.

+

Definition at line 960 of file RPCCall.cpp.

@@ -1371,7 +1371,7 @@ Private Attributes
-

Definition at line 996 of file RPCCall.cpp.

+

Definition at line 1012 of file RPCCall.cpp.

@@ -1399,7 +1399,7 @@ Private Attributes
-

Definition at line 1015 of file RPCCall.cpp.

+

Definition at line 1031 of file RPCCall.cpp.

@@ -1427,7 +1427,7 @@ Private Attributes
-

Definition at line 1042 of file RPCCall.cpp.

+

Definition at line 1058 of file RPCCall.cpp.

@@ -1455,7 +1455,7 @@ Private Attributes
-

Definition at line 1070 of file RPCCall.cpp.

+

Definition at line 1086 of file RPCCall.cpp.

@@ -1483,7 +1483,7 @@ Private Attributes
-

Definition at line 1086 of file RPCCall.cpp.

+

Definition at line 1102 of file RPCCall.cpp.

@@ -1511,7 +1511,7 @@ Private Attributes
-

Definition at line 1100 of file RPCCall.cpp.

+

Definition at line 1116 of file RPCCall.cpp.

@@ -1539,7 +1539,7 @@ Private Attributes
-

Definition at line 1115 of file RPCCall.cpp.

+

Definition at line 1131 of file RPCCall.cpp.

@@ -1567,7 +1567,7 @@ Private Attributes
-

Definition at line 1154 of file RPCCall.cpp.

+

Definition at line 1170 of file RPCCall.cpp.

@@ -1595,7 +1595,7 @@ Private Attributes
-

Definition at line 1168 of file RPCCall.cpp.

+

Definition at line 1184 of file RPCCall.cpp.

@@ -1631,7 +1631,7 @@ Private Attributes
-

Definition at line 1189 of file RPCCall.cpp.

+

Definition at line 1205 of file RPCCall.cpp.

diff --git a/classripple_1_1test_1_1RPCCall__test.html b/classripple_1_1test_1_1RPCCall__test.html index b65bdd5650..c8df5b6a4f 100644 --- a/classripple_1_1test_1_1RPCCall__test.html +++ b/classripple_1_1test_1_1RPCCall__test.html @@ -242,7 +242,7 @@ Private Attributes

Detailed Description

-

Definition at line 5901 of file RPCCall_test.cpp.

+

Definition at line 5904 of file RPCCall_test.cpp.

Member Function Documentation

◆ testRPCCall()

@@ -260,7 +260,7 @@ Private Attributes
-

Definition at line 5905 of file RPCCall_test.cpp.

+

Definition at line 5908 of file RPCCall_test.cpp.

@@ -291,7 +291,7 @@ Private Attributes

Implements beast::unit_test::suite.

-

Definition at line 5984 of file RPCCall_test.cpp.

+

Definition at line 5987 of file RPCCall_test.cpp.

diff --git a/namespaceripple.html b/namespaceripple.html index 2542273189..4d88acaad1 100644 --- a/namespaceripple.html +++ b/namespaceripple.html @@ -46501,7 +46501,7 @@ template<typename Predicate >
-

Definition at line 1330 of file RPCCall.cpp.

+

Definition at line 1346 of file RPCCall.cpp.

@@ -46543,7 +46543,7 @@ template<typename Predicate >
-

Definition at line 1432 of file RPCCall.cpp.

+

Definition at line 1448 of file RPCCall.cpp.

@@ -46594,7 +46594,7 @@ template<typename Predicate >

Internal invocation of RPC client.

Used by both rippled command line as well as rippled unit tests

-

Definition at line 1473 of file RPCCall.cpp.

+

Definition at line 1489 of file RPCCall.cpp.

diff --git a/namespaceripple_1_1RPCCall.html b/namespaceripple_1_1RPCCall.html index 5f0a4c7ae2..510ebcffdc 100644 --- a/namespaceripple_1_1RPCCall.html +++ b/namespaceripple_1_1RPCCall.html @@ -124,7 +124,7 @@ Functions
-

Definition at line 1626 of file RPCCall.cpp.

+

Definition at line 1642 of file RPCCall.cpp.

@@ -220,7 +220,7 @@ Functions
-

Definition at line 1642 of file RPCCall.cpp.

+

Definition at line 1658 of file RPCCall.cpp.

diff --git a/namespaceripple_1_1test.html b/namespaceripple_1_1test.html index 26ecdbb2e8..4681796bc5 100644 --- a/namespaceripple_1_1test.html +++ b/namespaceripple_1_1test.html @@ -7405,7 +7405,7 @@ template<typename PreVote = decltype(defaultPreVote)>
-

Definition at line 5882 of file RPCCall_test.cpp.

+

Definition at line 5885 of file RPCCall_test.cpp.

@@ -7425,7 +7425,7 @@ template<typename PreVote = decltype(defaultPreVote)>
-

Definition at line 5892 of file RPCCall_test.cpp.

+

Definition at line 5895 of file RPCCall_test.cpp.

diff --git a/structripple_1_1RPCCallImp.html b/structripple_1_1RPCCallImp.html index 73ed5eb80f..08b4fb73bb 100644 --- a/structripple_1_1RPCCallImp.html +++ b/structripple_1_1RPCCallImp.html @@ -97,7 +97,7 @@ Static Public Member Functions

Detailed Description

-

Definition at line 1350 of file RPCCall.cpp.

+

Definition at line 1366 of file RPCCall.cpp.

Constructor & Destructor Documentation

◆ RPCCallImp()

@@ -159,7 +159,7 @@ Static Public Member Functions
-

Definition at line 1357 of file RPCCall.cpp.

+

Definition at line 1373 of file RPCCall.cpp.

@@ -215,7 +215,7 @@ Static Public Member Functions
-

Definition at line 1363 of file RPCCall.cpp.

+

Definition at line 1379 of file RPCCall.cpp.

@@ -283,7 +283,7 @@ Static Public Member Functions
-

Definition at line 1408 of file RPCCall.cpp.

+

Definition at line 1424 of file RPCCall.cpp.

diff --git a/utility_8cpp_source.html b/utility_8cpp_source.html index f3feb0297c..2477562f72 100644 --- a/utility_8cpp_source.html +++ b/utility_8cpp_source.html @@ -222,7 +222,7 @@ $(document).ready(function() { init_codefold(0); });
std::string rpcErrorString(Json::Value const &jv)
Returns a single string with the contents of an RPC error.
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &message)
Generate a signature for a message.
std::string strHex(FwdIt begin, FwdIt end)
Definition strHex.h:11
-
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition RPCCall.cpp:1432
+
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition RPCCall.cpp:1448
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:611
@ txSign
inner transaction to sign
XRPAmount base