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