rippled
RPCCall_test.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2018 Ripple Labs Inc.
5  Permission to use, copy, modify, and/or distribute this software for any
6  purpose with or without fee is hereby granted, provided that the above
7  copyright notice and this permission notice appear in all copies.
8  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16 //==============================================================================
17 
18 
19 #include <ripple/net/RPCCall.h>
20 #include <ripple/beast/unit_test.h>
21 #include <ripple/json/json_reader.h>
22 #include <ripple/protocol/ErrorCodes.h>
23 #include <ripple/rpc/impl/RPCHelpers.h>
24 #include <test/jtx.h>
25 
26 #include <initializer_list>
27 #include <vector>
28 #include <boost/algorithm/string.hpp>
29 
30 namespace ripple {
31 namespace test {
32 
34 {
35  char const* const description;
36  int const line;
37  // List of passed arguments.
39 
40  // If it throws, what does it throw?
41  enum Exception
42  {
45  };
47 
48  // Expected JSON response.
49  char const* const exp;
50 
51  RPCCallTestData (char const* description_, int line_,
53  Exception throwsWhat_, char const* exp_)
54  : description (description_)
55  , line (line_)
56  , args (args_)
57  , throwsWhat (throwsWhat_)
58  , exp (exp_)
59  { }
60 
61  RPCCallTestData () = delete;
62  RPCCallTestData (RPCCallTestData const&) = delete;
63  RPCCallTestData (RPCCallTestData&&) = delete;
64  RPCCallTestData& operator= (RPCCallTestData const&) = delete;
66 };
67 
69 {
70 // account_channels ------------------------------------------------------------
71 {
72  "account_channels: minimal.", __LINE__,
73  {
74  "account_channels",
75  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
76  },
78  R"({
79  "method" : "account_channels",
80  "params" : [
81  {
82  "api_version" : %MAX_API_VER%,
83  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
84  }
85  ]
86  })"
87 },
88 {
89  "account_channels: account and ledger hash.", __LINE__,
90  {
91  "account_channels",
92  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
93  "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210"
94  },
96  R"({
97  "method" : "account_channels",
98  "params" : [
99  {
100  "api_version" : %MAX_API_VER%,
101  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
102  "destination_account" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210"
103  }
104  ]
105  })"
106 },
107 {
108  "account_channels: account and ledger index.", __LINE__,
109  {
110  "account_channels",
111  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
112  "closed"
113  },
115  R"({
116  "method" : "account_channels",
117  "params" : [
118  {
119  "api_version" : %MAX_API_VER%,
120  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
121  "destination_account" : "closed"
122  }
123  ]
124  })"
125 },
126 {
127  "account_channels: two accounts.", __LINE__,
128  {
129  "account_channels",
130  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
131  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
132  },
134  R"({
135  "method" : "account_channels",
136  "params" : [
137  {
138  "api_version" : %MAX_API_VER%,
139  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
140  "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
141  }
142  ]
143  })"
144 },
145 {
146  "account_channels: two accounts and ledger hash.", __LINE__,
147  {
148  "account_channels",
149  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
150  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
151  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
152  },
154  R"({
155  "method" : "account_channels",
156  "params" : [
157  {
158  "api_version" : %MAX_API_VER%,
159  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
160  "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
161  "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
162  }
163  ]
164  })"
165 },
166 {
167  "account_channels: two accounts and ledger index.", __LINE__,
168  {
169  "account_channels",
170  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
171  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
172  "90210"
173  },
175  R"({
176  "method" : "account_channels",
177  "params" : [
178  {
179  "api_version" : %MAX_API_VER%,
180  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
181  "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
182  "ledger_index" : 90210
183  }
184  ]
185  })"
186 },
187 {
188  "account_channels: too few arguments.", __LINE__,
189  {
190  "account_channels",
191  },
193  R"({
194  "method" : "account_channels",
195  "params" : [
196  {
197  "error" : "badSyntax",
198  "error_code" : 1,
199  "error_message" : "Syntax error."
200  }
201  ]
202  })"
203 },
204 {
205  "account_channels: too many arguments.", __LINE__,
206  {
207  "account_channels",
208  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
209  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
210  "current",
211  "strict"
212  },
214  R"({
215  "method" : "account_channels",
216  "params" : [
217  {
218  "error" : "badSyntax",
219  "error_code" : 1,
220  "error_message" : "Syntax error."
221  }
222  ]
223  })"
224 },
225 {
226  "account_channels: invalid accountID.", __LINE__,
227  {
228  "account_channels",
229  "", // Note: very few values are detected as bad!
230  },
232  R"({
233  "method" : "account_channels",
234  "params" : [
235  {
236  "error" : "actMalformed",
237  "error_code" : 35,
238  "error_message" : "Account malformed."
239  }
240  ]
241  })"
242 },
243 
244 // account_currencies ----------------------------------------------------------
245 {
246  "account_currencies: minimal.", __LINE__,
247  {
248  "account_currencies",
249  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
250  },
252  R"({
253  "method" : "account_currencies",
254  "params" : [
255  {
256  "api_version" : %MAX_API_VER%,
257  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
258  }
259  ]
260  })"
261 },
262 {
263  "account_currencies: strict.", __LINE__,
264  {
265  "account_currencies",
266  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
267  "strict"
268  },
270  R"({
271  "method" : "account_currencies",
272  "params" : [
273  {
274  "api_version" : %MAX_API_VER%,
275  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
276  "strict" : 1
277  }
278  ]
279  })"
280 },
281 {
282  "account_currencies: ledger index.", __LINE__,
283  {
284  "account_currencies",
285  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
286  "42"
287  },
289  R"({
290  "method" : "account_currencies",
291  "params" : [
292  {
293  "api_version" : %MAX_API_VER%,
294  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
295  "ledger_index" : 42
296  }
297  ]
298  })"
299 },
300 {
301  "account_currencies: validated ledger.", __LINE__,
302  {
303  "account_currencies",
304  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
305  "validated"
306  },
308  R"({
309  "method" : "account_currencies",
310  "params" : [
311  {
312  "api_version" : %MAX_API_VER%,
313  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
314  "ledger_index" : "validated"
315  }
316  ]
317  })"
318 },
319 {
320  "account_currencies: current ledger.", __LINE__,
321  {
322  "account_currencies",
323  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
324  "current",
325  "strict"
326  },
328  R"({
329  "method" : "account_currencies",
330  "params" : [
331  {
332  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
333  "api_version" : %MAX_API_VER%,
334  "ledger_index" : "current",
335  "strict" : 1
336  }
337  ]
338  })"
339 },
340 {
341  "account_currencies: too few arguments.", __LINE__,
342  {
343  "account_currencies",
344  },
346  R"({
347  "method" : "account_currencies",
348  "params" : [
349  {
350  "error" : "badSyntax",
351  "error_code" : 1,
352  "error_message" : "Syntax error."
353  }
354  ]
355  })"
356 },
357 {
358  "account_currencies: too many arguments.", __LINE__,
359  {
360  "account_currencies",
361  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
362  "current",
363  "strict",
364  "spare"
365  },
367  R"({
368  "method" : "account_currencies",
369  "params" : [
370  {
371  "error" : "badSyntax",
372  "error_code" : 1,
373  "error_message" : "Syntax error."
374  }
375  ]
376  })"
377 },
378 {
379  "account_currencies: invalid second argument.", __LINE__,
380  {
381  "account_currencies",
382  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
383  "yup"
384  },
386  R"({
387  "method" : "account_currencies",
388  "params" : [
389  {
390  "api_version" : %MAX_API_VER%,
391  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
392  "ledger_index" : 0
393  }
394  ]
395  })"
396 },
397 {
398  "account_currencies: invalid accountID.", __LINE__,
399  {
400  "account_currencies",
401  "", // Note: very few values are detected as bad!
402  },
404  R"({
405  "method" : "account_currencies",
406  "params" : [
407  {
408  "error" : "actMalformed",
409  "error_code" : 35,
410  "error_message" : "Account malformed."
411  }
412  ]
413  })",
414 },
415 {
416  "account_currencies: floating point first argument.", __LINE__,
417  {
418  "account_currencies",
419  "3.14159",
420  "strict"
421  },
423  R"({
424  "method" : "account_currencies",
425  "params" : [
426  {
427  "api_version" : %MAX_API_VER%,
428  "account" : "3.14159",
429  "strict" : 1
430  }
431  ]
432  })"
433 },
434 
435 // account_info ----------------------------------------------------------------
436 {
437  "account_info: minimal.", __LINE__,
438  {
439  "account_info",
440  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
441  },
443  R"({
444  "method" : "account_info",
445  "params" : [
446  {
447  "api_version" : %MAX_API_VER%,
448  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
449  }
450  ]
451  })"
452 },
453 {
454  "account_info: with numeric ledger index.", __LINE__,
455  {
456  "account_info",
457  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
458  "77777"
459  },
461  R"({
462  "method" : "account_info",
463  "params" : [
464  {
465  "api_version" : %MAX_API_VER%,
466  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
467  "ledger_index" : 77777
468  }
469  ]
470  })"
471 },
472 {
473  "account_info: with text ledger index.", __LINE__,
474  {
475  "account_info",
476  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
477  "closed"
478  },
480  R"({
481  "method" : "account_info",
482  "params" : [
483  {
484  "api_version" : %MAX_API_VER%,
485  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
486  "ledger_index" : "closed"
487  }
488  ]
489  })"
490 },
491 {
492  "account_info: with ledger hash.", __LINE__,
493  {
494  "account_info",
495  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
496  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
497  },
499  R"({
500  "method" : "account_info",
501  "params" : [
502  {
503  "api_version" : %MAX_API_VER%,
504  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
505  "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
506  }
507  ]
508  })"
509 },
510 {
511  "account_info: strict.", __LINE__,
512  {
513  "account_info",
514  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
515  "strict"
516  },
518  R"({
519  "method" : "account_info",
520  "params" : [
521  {
522  "api_version" : %MAX_API_VER%,
523  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
524  "strict" : 1
525  }
526  ]
527  })"
528 },
529 {
530  "account_info: with ledger index and strict.", __LINE__,
531  {
532  "account_info",
533  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
534  "validated",
535  "strict"
536  },
538  R"({
539  "method" : "account_info",
540  "params" : [
541  {
542  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
543  "api_version" : %MAX_API_VER%,
544  "ledger_index" : "validated",
545  "strict" : 1
546  }
547  ]
548  })"
549 },
550 {
551  "account_info: too few arguments.", __LINE__,
552  {
553  "account_info",
554  },
556  R"({
557  "method" : "account_info",
558  "params" : [
559  {
560  "error" : "badSyntax",
561  "error_code" : 1,
562  "error_message" : "Syntax error."
563  }
564  ]
565  })"
566 },
567 {
568  "account_info: too many arguments.", __LINE__,
569  {
570  "account_info",
571  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
572  "current",
573  "strict",
574  "extra"
575  },
577  R"({
578  "method" : "account_info",
579  "params" : [
580  {
581  "error" : "badSyntax",
582  "error_code" : 1,
583  "error_message" : "Syntax error."
584  }
585  ]
586  })"
587 },
588 {
589  "account_info: invalid accountID.", __LINE__,
590  {
591  "account_info",
592  "", // Note: very few values are detected as bad!
593  },
595  R"({
596  "method" : "account_info",
597  "params" : [
598  {
599  "error" : "actMalformed",
600  "error_code" : 35,
601  "error_message" : "Account malformed."
602  }
603  ]
604  })",
605 },
606 
607 // account_lines ---------------------------------------------------------------
608 {
609  "account_lines: minimal.", __LINE__,
610  {
611  "account_lines",
612  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
613  },
615  R"({
616  "method" : "account_lines",
617  "params" : [
618  {
619  "api_version" : %MAX_API_VER%,
620  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
621  }
622  ]
623  })"
624 },
625 {
626  "account_lines: peer.", __LINE__,
627  {
628  "account_lines",
629  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
630  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
631  },
633  R"({
634  "method" : "account_lines",
635  "params" : [
636  {
637  "api_version" : %MAX_API_VER%,
638  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
639  "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
640  }
641  ]
642  })"
643 },
644 {
645  "account_lines: peer and numeric ledger index.", __LINE__,
646  {
647  "account_lines",
648  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
649  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
650  "888888888"
651  },
653  R"({
654  "method" : "account_lines",
655  "params" : [
656  {
657  "api_version" : %MAX_API_VER%,
658  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
659  "ledger_index" : 888888888,
660  "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
661  }
662  ]
663  })"
664 },
665 {
666  "account_lines: peer and text ledger index.", __LINE__,
667  {
668  "account_lines",
669  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
670  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
671  "closed"
672  },
674  R"({
675  "method" : "account_lines",
676  "params" : [
677  {
678  "api_version" : %MAX_API_VER%,
679  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
680  "ledger_index" : "closed",
681  "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
682  }
683  ]
684  })"
685 },
686 {
687  "account_lines: peer and ledger hash.", __LINE__,
688  {
689  "account_lines",
690  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
691  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
692  "FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000"
693  },
695  R"({
696  "method" : "account_lines",
697  "params" : [
698  {
699  "api_version" : %MAX_API_VER%,
700  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
701  "ledger_hash" : "FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000",
702  "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
703  }
704  ]
705  })"
706 },
707 {
708  "account_lines: too few arguments.", __LINE__,
709  {
710  "account_lines",
711  },
713  R"({
714  "method" : "account_lines",
715  "params" : [
716  {
717  "error" : "badSyntax",
718  "error_code" : 1,
719  "error_message" : "Syntax error."
720  }
721  ]
722  })"
723 },
724 {
725  // Note: I believe this _ought_ to be detected as too many arguments.
726  "account_lines: four arguments.", __LINE__,
727  {
728  "account_lines",
729  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
730  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
731  "12345678",
732  "current"
733  },
735  R"({
736  "method" : "account_lines",
737  "params" : [
738  {
739  "api_version" : %MAX_API_VER%,
740  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
741  "ledger_index" : 12345678,
742  "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
743  }
744  ]
745  })"
746 },
747 {
748  // Note: I believe this _ought_ to be detected as too many arguments.
749  "account_lines: five arguments.", __LINE__,
750  {
751  "account_lines",
752  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
753  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
754  "12345678",
755  "current",
756  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
757  },
759  R"({
760  "method" : "account_lines",
761  "params" : [
762  {
763  "api_version" : %MAX_API_VER%,
764  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
765  "ledger_index" : 12345678,
766  "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
767  }
768  ]
769  })"
770 },
771 {
772  "account_lines: too many arguments.", __LINE__,
773  {
774  "account_lines",
775  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
776  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
777  "12345678",
778  "current",
779  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
780  "validated"
781  },
783  R"({
784  "method" : "account_lines",
785  "params" : [
786  {
787  "error" : "badSyntax",
788  "error_code" : 1,
789  "error_message" : "Syntax error."
790  }
791  ]
792  })"
793 },
794 {
795  "account_lines: first invalid accountID.", __LINE__,
796  {
797  "account_lines",
798  "", // Note: very few values are detected as bad!
799  },
801  R"({
802  "method" : "account_lines",
803  "params" : [
804  {
805  "error" : "actMalformed",
806  "error_code" : 35,
807  "error_message" : "Account malformed."
808  }
809  ]
810  })",
811 },
812 {
813  "account_lines: second invalid accountID.", __LINE__,
814  {
815  "account_lines",
816  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
817  "" // Note: very few values are detected as bad!
818  },
820  R"({
821  "method" : "account_lines",
822  "params" : [
823  {
824  "api_version" : %MAX_API_VER%,
825  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
826  }
827  ]
828  })",
829 },
830 {
831  "account_lines: invalid ledger selector.", __LINE__,
832  {
833  "account_lines",
834  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
835  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
836  "not_a_ledger"
837  },
839  R"({
840  "method" : "account_lines",
841  "params" : [
842  {
843  "api_version" : %MAX_API_VER%,
844  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
845  "ledger_index" : 0,
846  "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
847  }
848  ]
849  })",
850 },
851 
852 // account_objects -------------------------------------------------------------
853 {
854  "account_objects: minimal.", __LINE__,
855  {
856  "account_objects",
857  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
858  },
860  R"({
861  "method" : "account_objects",
862  "params" : [
863  {
864  "api_version" : %MAX_API_VER%,
865  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
866  }
867  ]
868  })"
869 },
870 {
871  "account_objects: with numeric ledger index.", __LINE__,
872  {
873  "account_objects",
874  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
875  "77777"
876  },
878  R"({
879  "method" : "account_objects",
880  "params" : [
881  {
882  "api_version" : %MAX_API_VER%,
883  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
884  "ledger_index" : 77777
885  }
886  ]
887  })"
888 },
889 {
890  "account_objects: with text ledger index.", __LINE__,
891  {
892  "account_objects",
893  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
894  "closed"
895  },
897  R"({
898  "method" : "account_objects",
899  "params" : [
900  {
901  "api_version" : %MAX_API_VER%,
902  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
903  "ledger_index" : "closed"
904  }
905  ]
906  })"
907 },
908 {
909  "account_objects: with ledger hash.", __LINE__,
910  {
911  "account_objects",
912  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
913  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
914  },
916  R"({
917  "method" : "account_objects",
918  "params" : [
919  {
920  "api_version" : %MAX_API_VER%,
921  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
922  "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
923  }
924  ]
925  })"
926 },
927 {
928  "account_objects: strict.", __LINE__,
929  {
930  "account_objects",
931  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
932  "strict"
933  },
935  R"({
936  "method" : "account_objects",
937  "params" : [
938  {
939  "api_version" : %MAX_API_VER%,
940  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
941  "strict" : 1
942  }
943  ]
944  })"
945 },
946 {
947  "account_objects: with ledger index and strict.", __LINE__,
948  {
949  "account_objects",
950  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
951  "validated",
952  "strict"
953  },
955  R"({
956  "method" : "account_objects",
957  "params" : [
958  {
959  "api_version" : %MAX_API_VER%,
960  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
961  "ledger_index" : "validated",
962  "strict" : 1
963  }
964  ]
965  })"
966 },
967 {
968  "account_objects: too few arguments.", __LINE__,
969  {
970  "account_objects",
971  },
973  R"({
974  "method" : "account_objects",
975  "params" : [
976  {
977  "error" : "badSyntax",
978  "error_code" : 1,
979  "error_message" : "Syntax error."
980  }
981  ]
982  })"
983 },
984 {
985  // Note: I believe this _ought_ to be detected as too many arguments.
986  "account_objects: four arguments.", __LINE__,
987  {
988  "account_objects",
989  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
990  "current",
991  "extra",
992  "strict",
993  },
995  R"({
996  "method" : "account_objects",
997  "params" : [
998  {
999  "api_version" : %MAX_API_VER%,
1000  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1001  "strict" : 1
1002  }
1003  ]
1004  })"
1005 },
1006 {
1007  // Note: I believe this _ought_ to be detected as too many arguments.
1008  "account_objects: five arguments.", __LINE__,
1009  {
1010  "account_objects",
1011  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1012  "current",
1013  "extra1",
1014  "extra2",
1015  "strict",
1016  },
1018  R"({
1019  "method" : "account_objects",
1020  "params" : [
1021  {
1022  "api_version" : %MAX_API_VER%,
1023  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1024  "strict" : 1
1025  }
1026  ]
1027  })"
1028 },
1029 {
1030  "account_objects: too many arguments.", __LINE__,
1031  {
1032  "account_objects",
1033  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1034  "current",
1035  "extra1",
1036  "extra2",
1037  "extra3",
1038  "strict",
1039  },
1041  R"({
1042  "method" : "account_objects",
1043  "params" : [
1044  {
1045  "error" : "badSyntax",
1046  "error_code" : 1,
1047  "error_message" : "Syntax error."
1048  }
1049  ]
1050  })"
1051 },
1052 {
1053  "account_objects: invalid accountID.", __LINE__,
1054  {
1055  "account_objects",
1056  "", // Note: very few values are detected as bad!
1057  },
1059  R"({
1060  "method" : "account_objects",
1061  "params" : [
1062  {
1063  "error" : "actMalformed",
1064  "error_code" : 35,
1065  "error_message" : "Account malformed."
1066  }
1067  ]
1068  })",
1069 },
1070 {
1071  // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
1072  // cannot currently occur because jvParseLedger() always returns true.
1073  "account_objects: invalid ledger selection 1.", __LINE__,
1074  {
1075  "account_objects",
1076  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1077  "no_ledger"
1078  },
1080  R"({
1081  "method" : "account_objects",
1082  "params" : [
1083  {
1084  "api_version" : %MAX_API_VER%,
1085  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1086  "ledger_index" : 0
1087  }
1088  ]
1089  })",
1090 },
1091 {
1092  // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
1093  // cannot currently occur because jvParseLedger() always returns true.
1094  "account_objects: invalid ledger selection 2.", __LINE__,
1095  {
1096  "account_objects",
1097  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1098  "no_ledger",
1099  "strict"
1100  },
1102  R"({
1103  "method" : "account_objects",
1104  "params" : [
1105  {
1106  "api_version" : %MAX_API_VER%,
1107  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1108  "ledger_index" : 0,
1109  "strict" : 1
1110  }
1111  ]
1112  })",
1113 },
1114 
1115 // account_offers --------------------------------------------------------------
1116 {
1117  "account_offers: minimal.", __LINE__,
1118  {
1119  "account_offers",
1120  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1121  },
1123  R"({
1124  "method" : "account_offers",
1125  "params" : [
1126  {
1127  "api_version" : %MAX_API_VER%,
1128  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1129  }
1130  ]
1131  })"
1132 },
1133 {
1134  "account_offers: with numeric ledger index.", __LINE__,
1135  {
1136  "account_offers",
1137  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1138  "987654321"
1139  },
1141  R"({
1142  "method" : "account_offers",
1143  "params" : [
1144  {
1145  "api_version" : %MAX_API_VER%,
1146  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1147  "ledger_index" : 987654321
1148  }
1149  ]
1150  })"
1151 },
1152 {
1153  "account_offers: with text ledger index.", __LINE__,
1154  {
1155  "account_offers",
1156  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1157  "validated"
1158  },
1160  R"({
1161  "method" : "account_offers",
1162  "params" : [
1163  {
1164  "api_version" : %MAX_API_VER%,
1165  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1166  "ledger_index" : "validated"
1167  }
1168  ]
1169  })"
1170 },
1171 {
1172  "account_offers: with ledger hash.", __LINE__,
1173  {
1174  "account_offers",
1175  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1176  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
1177  },
1179  R"({
1180  "method" : "account_offers",
1181  "params" : [
1182  {
1183  "api_version" : %MAX_API_VER%,
1184  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1185  "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
1186  }
1187  ]
1188  })"
1189 },
1190 {
1191  "account_offers: strict.", __LINE__,
1192  {
1193  "account_offers",
1194  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1195  "strict"
1196  },
1198  R"({
1199  "method" : "account_offers",
1200  "params" : [
1201  {
1202  "api_version" : %MAX_API_VER%,
1203  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1204  "strict" : 1
1205  }
1206  ]
1207  })"
1208 },
1209 {
1210  "account_offers: with ledger index and strict.", __LINE__,
1211  {
1212  "account_offers",
1213  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1214  "validated",
1215  "strict"
1216  },
1218  R"({
1219  "method" : "account_offers",
1220  "params" : [
1221  {
1222  "api_version" : %MAX_API_VER%,
1223  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1224  "ledger_index" : "validated",
1225  "strict" : 1
1226  }
1227  ]
1228  })"
1229 },
1230 {
1231  "account_offers: too few arguments.", __LINE__,
1232  {
1233  "account_offers",
1234  },
1236  R"({
1237  "method" : "account_offers",
1238  "params" : [
1239  {
1240  "error" : "badSyntax",
1241  "error_code" : 1,
1242  "error_message" : "Syntax error."
1243  }
1244  ]
1245  })"
1246 },
1247 {
1248  // Note: I believe this _ought_ to be detected as too many arguments.
1249  "account_offers: four arguments.", __LINE__,
1250  {
1251  "account_offers",
1252  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1253  "current",
1254  "extra",
1255  "strict",
1256  },
1258  R"({
1259  "method" : "account_offers",
1260  "params" : [
1261  {
1262  "api_version" : %MAX_API_VER%,
1263  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1264  "strict" : 1
1265  }
1266  ]
1267  })"
1268 },
1269 {
1270  "account_offers: too many arguments.", __LINE__,
1271  {
1272  "account_offers",
1273  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1274  "current",
1275  "extra1",
1276  "extra2",
1277  "strict",
1278  },
1280  R"({
1281  "method" : "account_offers",
1282  "params" : [
1283  {
1284  "error" : "badSyntax",
1285  "error_code" : 1,
1286  "error_message" : "Syntax error."
1287  }
1288  ]
1289  })"
1290 },
1291 {
1292  "account_offers: invalid accountID.", __LINE__,
1293  {
1294  "account_offers",
1295  "", // Note: very few values are detected as bad!
1296  },
1298  R"({
1299  "method" : "account_offers",
1300  "params" : [
1301  {
1302  "error" : "actMalformed",
1303  "error_code" : 35,
1304  "error_message" : "Account malformed."
1305  }
1306  ]
1307  })",
1308 },
1309 {
1310  // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
1311  // cannot currently occur because jvParseLedger() always returns true.
1312  "account_offers: invalid ledger selection 1.", __LINE__,
1313  {
1314  "account_offers",
1315  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1316  "no_ledger"
1317  },
1319  R"({
1320  "method" : "account_offers",
1321  "params" : [
1322  {
1323  "api_version" : %MAX_API_VER%,
1324  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1325  "ledger_index" : 0
1326  }
1327  ]
1328  })",
1329 },
1330 {
1331  // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
1332  // cannot currently occur because jvParseLedger() always returns true.
1333  "account_offers: invalid ledger selection 2.", __LINE__,
1334  {
1335  "account_offers",
1336  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1337  "no_ledger",
1338  "strict"
1339  },
1341  R"({
1342  "method" : "account_offers",
1343  "params" : [
1344  {
1345  "api_version" : %MAX_API_VER%,
1346  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1347  "ledger_index" : 0,
1348  "strict" : 1
1349  }
1350  ]
1351  })",
1352 },
1353 
1354 // account_tx ------------------------------------------------------------------
1355 {
1356  "account_tx: minimal.", __LINE__,
1357  {
1358  "account_tx",
1359  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1360  },
1362  R"({
1363  "method" : "account_tx",
1364  "params" : [
1365  {
1366  "api_version" : %MAX_API_VER%,
1367  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1368  }
1369  ]
1370  })"
1371 },
1372 {
1373  "account_tx: ledger_index .", __LINE__,
1374  {
1375  "account_tx",
1376  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1377  "444"
1378  },
1380  R"({
1381  "method" : "account_tx",
1382  "params" : [
1383  {
1384  "api_version" : %MAX_API_VER%,
1385  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1386  "ledger_index" : 444
1387  }
1388  ]
1389  })"
1390 },
1391 {
1392  "account_tx: ledger_index plus trailing params.", __LINE__,
1393  {
1394  "account_tx",
1395  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1396  "707",
1397  "descending",
1398  "binary",
1399  "count"
1400  },
1402  R"({
1403  "method" : "account_tx",
1404  "params" : [
1405  {
1406  "api_version" : %MAX_API_VER%,
1407  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1408  "count" : true,
1409  "binary" : true,
1410  "descending" : true,
1411  "ledger_index" : 707
1412  }
1413  ]
1414  })"
1415 },
1416 {
1417  "account_tx: ledger_index_min and _max.", __LINE__,
1418  {
1419  "account_tx",
1420  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1421  "-1",
1422  "-1"
1423  },
1425  R"({
1426  "method" : "account_tx",
1427  "params" : [
1428  {
1429  "api_version" : %MAX_API_VER%,
1430  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1431  "ledger_index_max" : -1,
1432  "ledger_index_min" : -1
1433  }
1434  ]
1435  })"
1436 },
1437 {
1438  "account_tx: ledger_index_min and _max plus trailing params.", __LINE__,
1439  {
1440  "account_tx",
1441  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1442  "-1",
1443  "413",
1444  "binary",
1445  "count",
1446  "descending"
1447  },
1449  R"({
1450  "method" : "account_tx",
1451  "params" : [
1452  {
1453  "api_version" : %MAX_API_VER%,
1454  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1455  "binary" : true,
1456  "count" : true,
1457  "descending" : true,
1458  "ledger_index_max" : 413,
1459  "ledger_index_min" : -1
1460  }
1461  ]
1462  })"
1463 },
1464 {
1465  "account_tx: ledger_index_min and _max plus limit.", __LINE__,
1466  {
1467  "account_tx",
1468  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1469  "247",
1470  "-1",
1471  "300"
1472  },
1474  R"({
1475  "method" : "account_tx",
1476  "params" : [
1477  {
1478  "api_version" : %MAX_API_VER%,
1479  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1480  "ledger_index_max" : -1,
1481  "ledger_index_min" : 247,
1482  "limit" : 300
1483  }
1484  ]
1485  })"
1486 },
1487 {
1488  "account_tx: ledger_index_min and _max, limit, trailing args.", __LINE__,
1489  {
1490  "account_tx",
1491  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1492  "247",
1493  "-1",
1494  "300",
1495  "count",
1496  "descending",
1497  "binary"
1498  },
1500  R"({
1501  "method" : "account_tx",
1502  "params" : [
1503  {
1504  "api_version" : %MAX_API_VER%,
1505  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1506  "binary" : true,
1507  "count" : true,
1508  "descending" : true,
1509  "ledger_index_max" : -1,
1510  "ledger_index_min" : 247,
1511  "limit" : 300
1512  }
1513  ]
1514  })"
1515 },
1516 {
1517  "account_tx: ledger_index_min and _max plus limit and offset.", __LINE__,
1518  {
1519  "account_tx",
1520  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1521  "589",
1522  "590",
1523  "67",
1524  "45"
1525  },
1527  R"({
1528  "method" : "account_tx",
1529  "params" : [
1530  {
1531  "api_version" : %MAX_API_VER%,
1532  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1533  "ledger_index_max" : 590,
1534  "ledger_index_min" : 589,
1535  "limit" : 67,
1536  "offset" : 45
1537  }
1538  ]
1539  })"
1540 },
1541 {
1542  "account_tx: ledger_index_min and _max, limit, offset, trailing.", __LINE__,
1543  {
1544  "account_tx",
1545  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1546  "589",
1547  "590",
1548  "67",
1549  "45",
1550  "descending",
1551  "count"
1552  },
1554  R"({
1555  "method" : "account_tx",
1556  "params" : [
1557  {
1558  "api_version" : %MAX_API_VER%,
1559  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1560  "count" : true,
1561  "descending" : true,
1562  "ledger_index_max" : 590,
1563  "ledger_index_min" : 589,
1564  "limit" : 67,
1565  "offset" : 45
1566  }
1567  ]
1568  })"
1569 },
1570 {
1571  "account_tx: too few arguments.", __LINE__,
1572  {
1573  "account_tx",
1574  },
1576  R"({
1577  "method" : "account_tx",
1578  "params" : [
1579  {
1580  "error" : "badSyntax",
1581  "error_code" : 1,
1582  "error_message" : "Syntax error."
1583  }
1584  ]
1585  })"
1586 },
1587 {
1588  "account_tx: too many arguments.", __LINE__,
1589  {
1590  "account_tx",
1591  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1592  "589",
1593  "590",
1594  "67",
1595  "45",
1596  "extra",
1597  "descending",
1598  "count",
1599  "binary"
1600  },
1602  R"({
1603  "method" : "account_tx",
1604  "params" : [
1605  {
1606  "error" : "badSyntax",
1607  "error_code" : 1,
1608  "error_message" : "Syntax error."
1609  }
1610  ]
1611  })"
1612 },
1613 {
1614  "account_tx: invalid accountID.", __LINE__,
1615  {
1616  "account_tx",
1617  "rHb9CJAWyB4rj9!VRWn96DkukG4bwdtyTh"
1618  },
1620  R"({
1621  "method" : "account_tx",
1622  "params" : [
1623  {
1624  "error" : "actMalformed",
1625  "error_code" : 35,
1626  "error_message" : "Account malformed."
1627  }
1628  ]
1629  })",
1630 },
1631 {
1632  // Note: not currently detected as bad input.
1633  "account_tx: invalid ledger.", __LINE__,
1634  {
1635  "account_tx",
1636  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1637  "-478.7"
1638  },
1640  R"({
1641  "method" : "account_tx",
1642  "params" : [
1643  {
1644  "api_version" : %MAX_API_VER%,
1645  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1646  "ledger_index" : 0
1647  }
1648  ]
1649  })",
1650 },
1651 {
1652  "account_tx: max less than min.", __LINE__,
1653  {
1654  "account_tx",
1655  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1656  "580",
1657  "579"
1658  },
1660  R"({
1661  "method" : "account_tx",
1662  "params" : [
1663  {
1664  "error" : "lgrIdxsInvalid",
1665  "error_code" : 55,
1666  "error_message" : "Ledger indexes invalid."
1667  }
1668  ]
1669  })",
1670 },
1671 {
1672  // Note: this really shouldn't throw, but does at the moment.
1673  "account_tx: non-integer min.", __LINE__,
1674  {
1675  "account_tx",
1676  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1677  "Binary",
1678  "-1"
1679  },
1681  R"()",
1682 },
1683 {
1684  // Note: this really shouldn't throw, but does at the moment.
1685  "account_tx: non-integer max.", __LINE__,
1686  {
1687  "account_tx",
1688  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1689  "-1",
1690  "counts"
1691  },
1693  R"()",
1694 },
1695 {
1696  // Note: this really shouldn't throw, but does at the moment.
1697  "account_tx: non-integer offset.", __LINE__,
1698  {
1699  "account_tx",
1700  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1701  "-1",
1702  "-1",
1703  "decending"
1704  },
1706  R"()",
1707 },
1708 {
1709  // Note: this really shouldn't throw, but does at the moment.
1710  "account_tx: non-integer limit.", __LINE__,
1711  {
1712  "account_tx",
1713  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1714  "-1",
1715  "-1",
1716  "300",
1717  "false"
1718  },
1720  R"()",
1721 },
1722 {
1723  // Note: this really shouldn't throw, but does at the moment.
1724  "account_tx: RIPD-1570.", __LINE__,
1725  {
1726  "account_tx",
1727  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1728  "-1",
1729  "-1",
1730  "2",
1731  "false",
1732  "false",
1733  "false"
1734  },
1736  R"()"
1737 },
1738 
1739 // book_offers -----------------------------------------------------------------
1740 {
1741  "book_offers: minimal no issuer.", __LINE__,
1742  {
1743  "book_offers",
1744  "USD",
1745  "EUR",
1746  },
1748  R"({
1749  "method" : "book_offers",
1750  "params" : [
1751  {
1752  "api_version" : %MAX_API_VER%,
1753  "taker_gets" : {
1754  "currency" : "EUR"
1755  },
1756  "taker_pays" : {
1757  "currency" : "USD"
1758  }
1759  }
1760  ]
1761  })"
1762 },
1763 {
1764  "book_offers: minimal with currency/issuer", __LINE__,
1765  {
1766  "book_offers",
1767  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1768  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1769  },
1771  R"({
1772  "method" : "book_offers",
1773  "params" : [
1774  {
1775  "api_version" : %MAX_API_VER%,
1776  "taker_gets" : {
1777  "currency" : "EUR",
1778  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
1779  },
1780  "taker_pays" : {
1781  "currency" : "USD",
1782  "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1783  }
1784  }
1785  ]
1786  })"
1787 },
1788 {
1789  // Note: documentation suggests that "issuer" is the wrong type.
1790  // Should it be "taker" instead?
1791  "book_offers: add issuer.", __LINE__,
1792  {
1793  "book_offers",
1794  "USD",
1795  "EUR",
1796  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
1797  },
1799  R"({
1800  "method" : "book_offers",
1801  "params" : [
1802  {
1803  "api_version" : %MAX_API_VER%,
1804  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1805  "taker_gets" : {
1806  "currency" : "EUR"
1807  },
1808  "taker_pays" : {
1809  "currency" : "USD"
1810  }
1811  }
1812  ]
1813  })"
1814 },
1815 {
1816  "book_offers: add issuer and numeric ledger index.", __LINE__,
1817  {
1818  "book_offers",
1819  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1820  "EUR",
1821  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1822  "666"
1823  },
1825  R"({
1826  "method" : "book_offers",
1827  "params" : [
1828  {
1829  "api_version" : %MAX_API_VER%,
1830  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1831  "ledger_index" : 666,
1832  "taker_gets" : {
1833  "currency" : "EUR"
1834  },
1835  "taker_pays" : {
1836  "currency" : "USD",
1837  "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1838  }
1839  }
1840  ]
1841  })"
1842 },
1843 {
1844  "book_offers: add issuer and text ledger index.", __LINE__,
1845  {
1846  "book_offers",
1847  "USD",
1848  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1849  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1850  "current"
1851  },
1853  R"({
1854  "method" : "book_offers",
1855  "params" : [
1856  {
1857  "api_version" : %MAX_API_VER%,
1858  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1859  "ledger_index" : "current",
1860  "taker_gets" : {
1861  "currency" : "EUR",
1862  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
1863  },
1864  "taker_pays" : {
1865  "currency" : "USD"
1866  }
1867  }
1868  ]
1869  })"
1870 },
1871 {
1872  "book_offers: add issuer and ledger hash.", __LINE__,
1873  {
1874  "book_offers",
1875  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1876  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1877  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1878  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
1879  },
1881  R"({
1882  "method" : "book_offers",
1883  "params" : [
1884  {
1885  "api_version" : %MAX_API_VER%,
1886  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1887  "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
1888  "taker_gets" : {
1889  "currency" : "EUR",
1890  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
1891  },
1892  "taker_pays" : {
1893  "currency" : "USD",
1894  "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1895  }
1896  }
1897  ]
1898  })"
1899 },
1900 {
1901  "book_offers: issuer, ledger hash, and limit.", __LINE__,
1902  {
1903  "book_offers",
1904  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1905  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1906  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1907  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
1908  "junk", // Note: indexing bug in parseBookOffers() requires junk param.
1909  "200",
1910  },
1912  R"({
1913  "method" : "book_offers",
1914  "params" : [
1915  {
1916  "api_version" : %MAX_API_VER%,
1917  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1918  "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
1919  "limit" : 200,
1920  "proof" : true,
1921  "taker_gets" : {
1922  "currency" : "EUR",
1923  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
1924  },
1925  "taker_pays" : {
1926  "currency" : "USD",
1927  "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1928  }
1929  }
1930  ]
1931  })"
1932 },
1933 {
1934  // Note: parser supports "marker", but the docs don't cover it.
1935  "book_offers: issuer, ledger hash, limit, and marker.", __LINE__,
1936  {
1937  "book_offers",
1938  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1939  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1940  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1941  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
1942  "junk", // Note: indexing bug in parseBookOffers() requires junk param.
1943  "200",
1944  "MyMarker"
1945  },
1947  R"({
1948  "method" : "book_offers",
1949  "params" : [
1950  {
1951  "api_version" : %MAX_API_VER%,
1952  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1953  "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
1954  "limit" : 200,
1955  "marker" : "MyMarker",
1956  "proof" : true,
1957  "taker_gets" : {
1958  "currency" : "EUR",
1959  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
1960  },
1961  "taker_pays" : {
1962  "currency" : "USD",
1963  "issuer" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
1964  }
1965  }
1966  ]
1967  })"
1968 },
1969 {
1970  "book_offers: too few arguments.", __LINE__,
1971  {
1972  "book_offers",
1973  },
1975  R"({
1976  "method" : "book_offers",
1977  "params" : [
1978  {
1979  "error" : "badSyntax",
1980  "error_code" : 1,
1981  "error_message" : "Syntax error."
1982  }
1983  ]
1984  })"
1985 },
1986 {
1987  "book_offers: too many arguments.", __LINE__,
1988  {
1989  "book_offers",
1990  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1991  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1992  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
1993  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
1994  "junk", // Note: indexing bug in parseBookOffers() requires junk param.
1995  "200",
1996  "MyMarker",
1997  "extra"
1998  },
2000  R"({
2001  "method" : "book_offers",
2002  "params" : [
2003  {
2004  "error" : "badSyntax",
2005  "error_code" : 1,
2006  "error_message" : "Syntax error."
2007  }
2008  ]
2009  })"
2010 },
2011 
2012 {
2013  "book_offers: taker pays no currency.", __LINE__,
2014  {
2015  "book_offers",
2016  "/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
2017  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
2018  },
2020  R"({
2021  "method" : "book_offers",
2022  "params" : [
2023  {
2024  "error" : "invalidParams",
2025  "error_code" : 31,
2026  "error_message" : "Invalid currency/issuer '/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'"
2027  }
2028  ]
2029  })"
2030 },
2031 {
2032  "book_offers: taker gets no currency.", __LINE__,
2033  {
2034  "book_offers",
2035  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
2036  "/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
2037  },
2039  R"({
2040  "method" : "book_offers",
2041  "params" : [
2042  {
2043  "error" : "invalidParams",
2044  "error_code" : 31,
2045  "error_message" : "Invalid currency/issuer '/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA'"
2046  }
2047  ]
2048  })"
2049 },
2050 {
2051  "book_offers: invalid issuer.", __LINE__,
2052  {
2053  "book_offers",
2054  "USD",
2055  "EUR",
2056  "not_a_valid_issuer"
2057  },
2059  R"({
2060  "method" : "book_offers",
2061  "params" : [
2062  {
2063  "api_version" : %MAX_API_VER%,
2064  "issuer" : "not_a_valid_issuer",
2065  "taker_gets" : {
2066  "currency" : "EUR"
2067  },
2068  "taker_pays" : {
2069  "currency" : "USD"
2070  }
2071  }
2072  ]
2073  })"
2074 },
2075 {
2076  "book_offers: invalid text ledger index.", __LINE__,
2077  {
2078  "book_offers",
2079  "USD",
2080  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
2081  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
2082  "not_a_ledger"
2083  },
2085  R"({
2086  "method" : "book_offers",
2087  "params" : [
2088  {
2089  "api_version" : %MAX_API_VER%,
2090  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
2091  "ledger_index" : 0,
2092  "taker_gets" : {
2093  "currency" : "EUR",
2094  "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
2095  },
2096  "taker_pays" : {
2097  "currency" : "USD"
2098  }
2099  }
2100  ]
2101  })"
2102 },
2103 {
2104  // Note: this really shouldn't throw, but does at the moment.
2105  "book_offers: non-numeric limit.", __LINE__,
2106  {
2107  "book_offers",
2108  "USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
2109  "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
2110  "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
2111  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
2112  "junk", // Note: indexing bug in parseBookOffers() requires junk param.
2113  "not_a_number",
2114  },
2116  R"()"
2117 },
2118 
2119 // can_delete ------------------------------------------------------------------
2120 {
2121  "can_delete: minimal.", __LINE__,
2122  {
2123  "can_delete",
2124  },
2126  R"({
2127  "method" : "can_delete",
2128  "params" : [
2129  {
2130  "api_version" : %MAX_API_VER%,
2131  }
2132  ]
2133  })"
2134 },
2135 {
2136  "can_delete: ledger index.", __LINE__,
2137  {
2138  "can_delete",
2139  "4294967295",
2140  },
2142  R"({
2143  "method" : "can_delete",
2144  "params" : [
2145  {
2146  "api_version" : %MAX_API_VER%,
2147  "can_delete" : 4294967295
2148  }
2149  ]
2150  })"
2151 },
2152 {
2153  "can_delete: ledger hash.", __LINE__,
2154  {
2155  "can_delete",
2156  "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210",
2157  },
2159  R"({
2160  "method" : "can_delete",
2161  "params" : [
2162  {
2163  "api_version" : %MAX_API_VER%,
2164  "can_delete" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210"
2165  }
2166  ]
2167  })"
2168 },
2169 {
2170  "can_delete: always.", __LINE__,
2171  {
2172  "can_delete",
2173  "always",
2174  },
2176  R"({
2177  "method" : "can_delete",
2178  "params" : [
2179  {
2180  "api_version" : %MAX_API_VER%,
2181  "can_delete" : "always"
2182  }
2183  ]
2184  })"
2185 },
2186 {
2187  "can_delete: never.", __LINE__,
2188  {
2189  "can_delete",
2190  "never",
2191  },
2193  R"({
2194  "method" : "can_delete",
2195  "params" : [
2196  {
2197  "api_version" : %MAX_API_VER%,
2198  "can_delete" : "never"
2199  }
2200  ]
2201  })"
2202 },
2203 {
2204  "can_delete: now.", __LINE__,
2205  {
2206  "can_delete",
2207  "now",
2208  },
2210  R"({
2211  "method" : "can_delete",
2212  "params" : [
2213  {
2214  "api_version" : %MAX_API_VER%,
2215  "can_delete" : "now"
2216  }
2217  ]
2218  })"
2219 },
2220 {
2221  "can_delete: too many arguments.", __LINE__,
2222  {
2223  "can_delete",
2224  "always",
2225  "never"
2226  },
2228  R"({
2229  "method" : "can_delete",
2230  "params" : [
2231  {
2232  "error" : "badSyntax",
2233  "error_code" : 1,
2234  "error_message" : "Syntax error."
2235  }
2236  ]
2237  })"
2238 },
2239 {
2240  "can_delete: invalid argument.", __LINE__,
2241  {
2242  "can_delete",
2243  "invalid"
2244  },
2246  R"({
2247  "method" : "can_delete",
2248  "params" : [
2249  {
2250  "api_version" : %MAX_API_VER%,
2251  "can_delete" : "invalid"
2252  }
2253  ]
2254  })"
2255 },
2256 {
2257  // Note: this should return an error but not throw.
2258  "can_delete: ledger index > 32 bits.", __LINE__,
2259  {
2260  "can_delete",
2261  "4294967296",
2262  },
2264  R"()"
2265 },
2266 {
2267  // Note: this really shouldn't throw since it's a legitimate ledger hash.
2268  "can_delete: ledger hash with no alphas.", __LINE__,
2269  {
2270  "can_delete",
2271  "0123456701234567012345670123456701234567012345670123456701234567",
2272  },
2274  R"()"
2275 },
2276 
2277 // channel_authorize -----------------------------------------------------------
2278 {
2279  "channel_authorize: minimal.", __LINE__,
2280  {
2281  "channel_authorize",
2282  "secret_can_be_anything",
2283  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2284  "18446744073709551615"
2285  },
2287  R"({
2288  "method" : "channel_authorize",
2289  "params" : [
2290  {
2291  "api_version" : %MAX_API_VER%,
2292  "amount" : "18446744073709551615",
2293  "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2294  "secret" : "secret_can_be_anything"
2295  }
2296  ]
2297  })"
2298 },
2299 {
2300  "channel_authorize: too few arguments.", __LINE__,
2301  {
2302  "channel_authorize",
2303  "secret_can_be_anything",
2304  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2305  },
2307  R"({
2308  "method" : "channel_authorize",
2309  "params" : [
2310  {
2311  "error" : "badSyntax",
2312  "error_code" : 1,
2313  "error_message" : "Syntax error."
2314  }
2315  ]
2316  })"
2317 },
2318 {
2319  "channel_authorize: too many arguments.", __LINE__,
2320  {
2321  "channel_authorize",
2322  "secp256k1",
2323  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2324  "2000",
2325  "whatever",
2326  "whenever"
2327  },
2329  R"({
2330  "method" : "channel_authorize",
2331  "params" : [
2332  {
2333  "error" : "badSyntax",
2334  "error_code" : 1,
2335  "error_message" : "Syntax error."
2336  }
2337  ]
2338  })"
2339 },
2340 {
2341  "channel_authorize: bad key type.", __LINE__,
2342  {
2343  "channel_authorize",
2344  "secp257k1",
2345  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2346  "2000",
2347  "whatever"
2348  },
2350  R"({
2351  "method" : "channel_authorize",
2352  "params" : [
2353  {
2354  "error" : "badKeyType",
2355  "error_code" : 1,
2356  "error_message" : "Bad key type."
2357  }
2358  ]
2359  })"
2360 },
2361 {
2362  "channel_authorize: channel_id too short.", __LINE__,
2363  {
2364  "channel_authorize",
2365  "secret_can_be_anything",
2366  "123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2367  "2000"
2368  },
2370  R"({
2371  "method" : "channel_authorize",
2372  "params" : [
2373  {
2374  "error" : "channelMalformed",
2375  "error_code" : 43,
2376  "error_message" : "Payment channel is malformed."
2377  }
2378  ]
2379  })"
2380 },
2381 {
2382  "channel_authorize: channel_id too long.", __LINE__,
2383  {
2384  "channel_authorize",
2385  "secret_can_be_anything",
2386  "10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2387  "2000"
2388  },
2390  R"({
2391  "method" : "channel_authorize",
2392  "params" : [
2393  {
2394  "error" : "channelMalformed",
2395  "error_code" : 43,
2396  "error_message" : "Payment channel is malformed."
2397  }
2398  ]
2399  })"
2400 },
2401 {
2402  "channel_authorize: channel_id not hex.", __LINE__,
2403  {
2404  "channel_authorize",
2405  "secret_can_be_anything",
2406  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEZ",
2407  "2000"
2408  },
2410  R"({
2411  "method" : "channel_authorize",
2412  "params" : [
2413  {
2414  "error" : "channelMalformed",
2415  "error_code" : 43,
2416  "error_message" : "Payment channel is malformed."
2417  }
2418  ]
2419  })"
2420 },
2421 {
2422  "channel_authorize: negative amount.", __LINE__,
2423  {
2424  "channel_authorize",
2425  "secret_can_be_anything",
2426  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2427  "-1"
2428  },
2430  R"({
2431  "method" : "channel_authorize",
2432  "params" : [
2433  {
2434  "error" : "channelAmtMalformed",
2435  "error_code" : 44,
2436  "error_message" : "Payment channel amount is malformed."
2437  }
2438  ]
2439  })"
2440 },
2441 {
2442  "channel_authorize: amount > 64 bits.", __LINE__,
2443  {
2444  "channel_authorize",
2445  "secret_can_be_anything",
2446  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2447  "18446744073709551616"
2448  },
2450  R"({
2451  "method" : "channel_authorize",
2452  "params" : [
2453  {
2454  "error" : "channelAmtMalformed",
2455  "error_code" : 44,
2456  "error_message" : "Payment channel amount is malformed."
2457  }
2458  ]
2459  })"
2460 },
2461 
2462 // channel_verify --------------------------------------------------------------
2463 {
2464  "channel_verify: public key.", __LINE__,
2465  {
2466  "channel_verify",
2467  "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2468  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2469  "0",
2470  "DEADBEEF"
2471  },
2473  R"({
2474  "method" : "channel_verify",
2475  "params" : [
2476  {
2477  "api_version" : %MAX_API_VER%,
2478  "amount" : "0",
2479  "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2480  "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2481  "signature" : "DEADBEEF"
2482  }
2483  ]
2484  })"
2485 },
2486 {
2487  "channel_verify: public key hex.", __LINE__,
2488  {
2489  "channel_verify",
2490  "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
2491  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2492  "18446744073709551615",
2493  "DEADBEEF"
2494  },
2496  R"({
2497  "method" : "channel_verify",
2498  "params" : [
2499  {
2500  "api_version" : %MAX_API_VER%,
2501  "amount" : "18446744073709551615",
2502  "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2503  "public_key" : "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
2504  "signature" : "DEADBEEF"
2505  }
2506  ]
2507  })"
2508 },
2509 {
2510  "channel_verify: too few arguments.", __LINE__,
2511  {
2512  "channel_verify",
2513  "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2514  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
2515  },
2517  R"({
2518  "method" : "channel_verify",
2519  "params" : [
2520  {
2521  "error" : "badSyntax",
2522  "error_code" : 1,
2523  "error_message" : "Syntax error."
2524  }
2525  ]
2526  })"
2527 },
2528 {
2529  "channel_verify: too many arguments.", __LINE__,
2530  {
2531  "channel_verify",
2532  "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2533  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2534  "2000",
2535  "DEADBEEF",
2536  "Whatever"
2537  },
2539  R"({
2540  "method" : "channel_verify",
2541  "params" : [
2542  {
2543  "error" : "badSyntax",
2544  "error_code" : 1,
2545  "error_message" : "Syntax error."
2546  }
2547  ]
2548  })"
2549 },
2550 {
2551  "channel_verify: malformed public key.", __LINE__,
2552  {
2553  "channel_verify",
2554  "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9GoV",
2555  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2556  "2000",
2557  "DEADBEEF"
2558  },
2560  R"({
2561  "method" : "channel_verify",
2562  "params" : [
2563  {
2564  "error" : "publicMalformed",
2565  "error_code" : 60,
2566  "error_message" : "Public key is malformed."
2567  }
2568  ]
2569  })"
2570 },
2571 {
2572  "channel_verify: malformed hex public key.", __LINE__,
2573  {
2574  "channel_verify",
2575  "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F",
2576  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2577  "2000",
2578  "DEADBEEF"
2579  },
2581  R"({
2582  "method" : "channel_verify",
2583  "params" : [
2584  {
2585  "error" : "publicMalformed",
2586  "error_code" : 60,
2587  "error_message" : "Public key is malformed."
2588  }
2589  ]
2590  })"
2591 },
2592 {
2593  "channel_verify: invalid channel id.", __LINE__,
2594  {
2595  "channel_verify",
2596  "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2597  "10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2598  "2000",
2599  "DEADBEEF"
2600  },
2602  R"({
2603  "method" : "channel_verify",
2604  "params" : [
2605  {
2606  "error" : "channelMalformed",
2607  "error_code" : 43,
2608  "error_message" : "Payment channel is malformed."
2609  }
2610  ]
2611  })"
2612 },
2613 {
2614  "channel_verify: short channel id.", __LINE__,
2615  {
2616  "channel_verify",
2617  "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2618  "123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2619  "2000",
2620  "DEADBEEF"
2621  },
2623  R"({
2624  "method" : "channel_verify",
2625  "params" : [
2626  {
2627  "error" : "channelMalformed",
2628  "error_code" : 43,
2629  "error_message" : "Payment channel is malformed."
2630  }
2631  ]
2632  })"
2633 },
2634 {
2635  "channel_verify: amount too small.", __LINE__,
2636  {
2637  "channel_verify",
2638  "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
2639  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2640  "-1",
2641  "DEADBEEF"
2642  },
2644  R"({
2645  "method" : "channel_verify",
2646  "params" : [
2647  {
2648  "error" : "channelAmtMalformed",
2649  "error_code" : 44,
2650  "error_message" : "Payment channel amount is malformed."
2651  }
2652  ]
2653  })"
2654 },
2655 {
2656  "channel_verify: amount too large.", __LINE__,
2657  {
2658  "channel_verify",
2659  "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6",
2660  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2661  "18446744073709551616",
2662  "DEADBEEF"
2663  },
2665  R"({
2666  "method" : "channel_verify",
2667  "params" : [
2668  {
2669  "error" : "channelAmtMalformed",
2670  "error_code" : 44,
2671  "error_message" : "Payment channel amount is malformed."
2672  }
2673  ]
2674  })"
2675 },
2676 {
2677  "channel_verify: non-hex signature.", __LINE__,
2678  {
2679  "channel_verify",
2680  "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2681  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2682  "40000000",
2683  "ThisIsNotHexadecimal"
2684  },
2686  R"({
2687  "method" : "channel_verify",
2688  "params" : [
2689  {
2690  "api_version" : %MAX_API_VER%,
2691  "amount" : "40000000",
2692  "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
2693  "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov",
2694  "signature" : "ThisIsNotHexadecimal"
2695  }
2696  ]
2697  })"
2698 },
2699 
2700 // connect ---------------------------------------------------------------------
2701 {
2702  "connect: minimal.", __LINE__,
2703  {
2704  "connect",
2705  "ThereIsNoCheckingOnTheIPFormat",
2706  },
2708  R"({
2709  "method" : "connect",
2710  "params" : [
2711  {
2712  "api_version" : %MAX_API_VER%,
2713  "ip" : "ThereIsNoCheckingOnTheIPFormat"
2714  }
2715  ]
2716  })"
2717 },
2718 {
2719  "connect: ip and port.", __LINE__,
2720  {
2721  "connect",
2722  "ThereIsNoCheckingOnTheIPFormat",
2723  "6561"
2724  },
2726  R"({
2727  "method" : "connect",
2728  "params" : [
2729  {
2730  "api_version" : %MAX_API_VER%,
2731  "ip" : "ThereIsNoCheckingOnTheIPFormat",
2732  "port" : 6561
2733  }
2734  ]
2735  })"
2736 },
2737 {
2738  "connect: too few arguments.", __LINE__,
2739  {
2740  "connect",
2741  },
2743  R"({
2744  "method" : "connect",
2745  "params" : [
2746  {
2747  "error" : "badSyntax",
2748  "error_code" : 1,
2749  "error_message" : "Syntax error."
2750  }
2751  ]
2752  })"
2753 },
2754 {
2755  "connect: too many arguments.", __LINE__,
2756  {
2757  "connect",
2758  "ThereIsNoCheckingOnTheIPFormat",
2759  "6561",
2760  "extra"
2761  },
2763  R"({
2764  "method" : "connect",
2765  "params" : [
2766  {
2767  "error" : "badSyntax",
2768  "error_code" : 1,
2769  "error_message" : "Syntax error."
2770  }
2771  ]
2772  })"
2773 },
2774 {
2775  // Note: this should return an error but not throw.
2776  "connect: port too small.", __LINE__,
2777  {
2778  "connect",
2779  "ThereIsNoCheckingOnTheIPFormat",
2780  "-1",
2781  },
2783  R"()"
2784 },
2785 {
2786  // Note: this should return an error but not throw.
2787  "connect: port too large.", __LINE__,
2788  {
2789  "connect",
2790  "ThereIsNoCheckingOnTheIPFormat",
2791  "4294967296",
2792  },
2794  R"()"
2795 },
2796 
2797 // consensus_info --------------------------------------------------------------
2798 {
2799  "consensus_info: minimal.", __LINE__,
2800  {
2801  "consensus_info",
2802  },
2804  R"({
2805  "method" : "consensus_info",
2806  "params" : [
2807  {
2808  "api_version" : %MAX_API_VER%
2809  }
2810  ]
2811  })"
2812 },
2813 {
2814  "consensus_info: too many arguments.", __LINE__,
2815  {
2816  "consensus_info",
2817  "whatever"
2818  },
2820  R"({
2821  "method" : "consensus_info",
2822  "params" : [
2823  {
2824  "error" : "badSyntax",
2825  "error_code" : 1,
2826  "error_message" : "Syntax error."
2827  }
2828  ]
2829  })"
2830 },
2831 
2832 // deposit_authorized ----------------------------------------------------------
2833 {
2834  "deposit_authorized: minimal.", __LINE__,
2835  {
2836  "deposit_authorized",
2837  "source_account_NotValidated",
2838  "destination_account_NotValidated",
2839  },
2841  R"({
2842  "method" : "deposit_authorized",
2843  "params" : [
2844  {
2845  "api_version" : %MAX_API_VER%,
2846  "destination_account" : "destination_account_NotValidated",
2847  "source_account" : "source_account_NotValidated"
2848  }
2849  ]
2850  })"
2851 },
2852 {
2853  "deposit_authorized: with text ledger index.", __LINE__,
2854  {
2855  "deposit_authorized",
2856  "source_account_NotValidated",
2857  "destination_account_NotValidated",
2858  "validated"
2859  },
2861  R"({
2862  "method" : "deposit_authorized",
2863  "params" : [
2864  {
2865  "api_version" : %MAX_API_VER%,
2866  "destination_account" : "destination_account_NotValidated",
2867  "ledger_index" : "validated",
2868  "source_account" : "source_account_NotValidated"
2869  }
2870  ]
2871  })"
2872 },
2873 {
2874  "deposit_authorized: with ledger index.", __LINE__,
2875  {
2876  "deposit_authorized",
2877  "source_account_NotValidated",
2878  "destination_account_NotValidated",
2879  "4294967295"
2880  },
2882  R"({
2883  "method" : "deposit_authorized",
2884  "params" : [
2885  {
2886  "api_version" : %MAX_API_VER%,
2887  "destination_account" : "destination_account_NotValidated",
2888  "ledger_index" : 4294967295,
2889  "source_account" : "source_account_NotValidated"
2890  }
2891  ]
2892  })"
2893 },
2894 {
2895  "deposit_authorized: with ledger hash.", __LINE__,
2896  {
2897  "deposit_authorized",
2898  "source_account_NotValidated",
2899  "destination_account_NotValidated",
2900  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
2901  },
2903  R"({
2904  "method" : "deposit_authorized",
2905  "params" : [
2906  {
2907  "api_version" : %MAX_API_VER%,
2908  "destination_account" : "destination_account_NotValidated",
2909  "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
2910  "source_account" : "source_account_NotValidated"
2911  }
2912  ]
2913  })"
2914 },
2915 {
2916  "deposit_authorized: too few arguments.", __LINE__,
2917  {
2918  "deposit_authorized",
2919  "source_account_NotValidated",
2920  },
2922  R"({
2923  "method" : "deposit_authorized",
2924  "params" : [
2925  {
2926  "error" : "badSyntax",
2927  "error_code" : 1,
2928  "error_message" : "Syntax error."
2929  }
2930  ]
2931  })"
2932 },
2933 {
2934  "deposit_authorized: too many arguments.", __LINE__,
2935  {
2936  "deposit_authorized",
2937  "source_account_NotValidated",
2938  "destination_account_NotValidated",
2939  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789",
2940  "spare"
2941  },
2943  R"({
2944  "method" : "deposit_authorized",
2945  "params" : [
2946  {
2947  "error" : "badSyntax",
2948  "error_code" : 1,
2949  "error_message" : "Syntax error."
2950  }
2951  ]
2952  })"
2953 },
2954 {
2955  "deposit_authorized: invalid ledger selection.", __LINE__,
2956  {
2957  "deposit_authorized",
2958  "source_account_NotValidated",
2959  "destination_account_NotValidated",
2960  "NotALedger",
2961  },
2963  R"({
2964  "method" : "deposit_authorized",
2965  "params" : [
2966  {
2967  "api_version" : %MAX_API_VER%,
2968  "destination_account" : "destination_account_NotValidated",
2969  "ledger_index" : 0,
2970  "source_account" : "source_account_NotValidated"
2971  }
2972  ]
2973  })"
2974 },
2975 
2976 // download_shard --------------------------------------------------------------
2977 {
2978  "download_shard: minimal.", __LINE__,
2979  {
2980  "download_shard",
2981  "20",
2982  "url_NotValidated",
2983  },
2985  R"({
2986  "method" : "download_shard",
2987  "params" : [
2988  {
2989  "api_version" : %MAX_API_VER%,
2990  "shards" : [
2991  {
2992  "index" : 20,
2993  "url" : "url_NotValidated"
2994  }
2995  ]
2996  }
2997  ]
2998  })"
2999 },
3000 {
3001  "download_shard:", __LINE__,
3002  {
3003  "download_shard",
3004  "20",
3005  "url_NotValidated",
3006  },
3008  R"({
3009  "method" : "download_shard",
3010  "params" : [
3011  {
3012  "api_version" : %MAX_API_VER%,
3013  "shards" : [
3014  {
3015  "index" : 20,
3016  "url" : "url_NotValidated"
3017  }
3018  ]
3019  }
3020  ]
3021  })"
3022 },
3023 {
3024  "download_shard: many shards.", __LINE__,
3025  {
3026  "download_shard",
3027  "200000000",
3028  "url_NotValidated0",
3029  "199999999",
3030  "url_NotValidated1",
3031  "199999998",
3032  "url_NotValidated2",
3033  "199999997",
3034  "url_NotValidated3",
3035  },
3037  R"({
3038  "method" : "download_shard",
3039  "params" : [
3040  {
3041  "api_version" : %MAX_API_VER%,
3042  "shards" : [
3043  {
3044  "index" : 200000000,
3045  "url" : "url_NotValidated0"
3046  },
3047  {
3048  "index" : 199999999,
3049  "url" : "url_NotValidated1"
3050  },
3051  {
3052  "index" : 199999998,
3053  "url" : "url_NotValidated2"
3054  },
3055  {
3056  "index" : 199999997,
3057  "url" : "url_NotValidated3"
3058  }
3059  ]
3060  }
3061  ]
3062  })"
3063 },
3064 {
3065  "download_shard: many shards.", __LINE__,
3066  {
3067  "download_shard",
3068  "2000000",
3069  "url_NotValidated0",
3070  "2000001",
3071  "url_NotValidated1",
3072  "2000002",
3073  "url_NotValidated2",
3074  "2000003",
3075  "url_NotValidated3",
3076  "2000004",
3077  "url_NotValidated4",
3078  },
3080  R"({
3081  "method" : "download_shard",
3082  "params" : [
3083  {
3084  "api_version" : %MAX_API_VER%,
3085  "shards" : [
3086  {
3087  "index" : 2000000,
3088  "url" : "url_NotValidated0"
3089  },
3090  {
3091  "index" : 2000001,
3092  "url" : "url_NotValidated1"
3093  },
3094  {
3095  "index" : 2000002,
3096  "url" : "url_NotValidated2"
3097  },
3098  {
3099  "index" : 2000003,
3100  "url" : "url_NotValidated3"
3101  },
3102  {
3103  "index" : 2000004,
3104  "url" : "url_NotValidated4"
3105  }
3106  ]
3107  }
3108  ]
3109  })"
3110 },
3111 {
3112  "download_shard: too few arguments.", __LINE__,
3113  {
3114  "download_shard",
3115  "20"
3116  },
3118  R"({
3119  "method" : "download_shard",
3120  "params" : [
3121  {
3122  "error" : "badSyntax",
3123  "error_code" : 1,
3124  "error_message" : "Syntax error."
3125  }
3126  ]
3127  })"
3128 },
3129 {
3130  // Note: this should return an error but not throw.
3131  "download_shard: novalidate too few arguments.", __LINE__,
3132  {
3133  "download_shard",
3134  "novalidate",
3135  "20"
3136  },
3138  R"()"
3139 },
3140 {
3141  "download_shard: novalidate at end.", __LINE__,
3142  {
3143  "download_shard",
3144  "20",
3145  "url_NotValidated",
3146  "novalidate",
3147  },
3149  R"({
3150  "method" : "download_shard",
3151  "params" : [
3152  {
3153  "api_version" : %MAX_API_VER%,
3154  "shards" : [
3155  {
3156  "index" : 20,
3157  "url" : "url_NotValidated"
3158  }
3159  ]
3160  }
3161  ]
3162  })"
3163 },
3164 {
3165  "download_shard: novalidate in middle.", __LINE__,
3166  {
3167  "download_shard",
3168  "20",
3169  "url_NotValidated20",
3170  "novalidate",
3171  "200",
3172  "url_NotValidated200",
3173  },
3175  R"({
3176  "method" : "download_shard",
3177  "params" : [
3178  {
3179  "error" : "invalidParams",
3180  "error_code" : 31,
3181  "error_message" : "Invalid parameters."
3182  }
3183  ]
3184  })"
3185 },
3186 {
3187  // Note: this should return an error but not throw.
3188  "download_shard: arguments swapped.", __LINE__,
3189  {
3190  "download_shard",
3191  "url_NotValidated",
3192  "20",
3193  },
3195  R"()"
3196 },
3197 {
3198  "download_shard: index too small.", __LINE__,
3199  {
3200  "download_shard",
3201  "-1",
3202  "url_NotValidated",
3203  },
3205  R"()"
3206 },
3207 {
3208  "download_shard: index too big.", __LINE__,
3209  {
3210  "download_shard",
3211  "4294967296",
3212  "url_NotValidated",
3213  },
3215  R"()"
3216 },
3217 
3218 // feature ---------------------------------------------------------------------
3219 {
3220  "feature: minimal.", __LINE__,
3221  {
3222  "feature",
3223  },
3225  R"({
3226  "method" : "feature",
3227  "params" : [
3228  {
3229  "api_version" : %MAX_API_VER%,
3230  }
3231  ]
3232  })"
3233 },
3234 {
3235  "feature: with name.", __LINE__,
3236  {
3237  "feature",
3238  "featureNameOrHexIsNotValidated"
3239  },
3241  R"({
3242  "method" : "feature",
3243  "params" : [
3244  {
3245  "api_version" : %MAX_API_VER%,
3246  "feature" : "featureNameOrHexIsNotValidated"
3247  }
3248  ]
3249  })"
3250 },
3251 {
3252  "feature: accept.", __LINE__,
3253  {
3254  "feature",
3255  "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210",
3256  "accept"
3257  },
3259  R"({
3260  "method" : "feature",
3261  "params" : [
3262  {
3263  "api_version" : %MAX_API_VER%,
3264  "feature" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210",
3265  "vetoed" : false
3266  }
3267  ]
3268  })"
3269 },
3270 {
3271  "feature: reject.", __LINE__,
3272  {
3273  "feature",
3274  "0",
3275  "reject"
3276  },
3278  R"({
3279  "method" : "feature",
3280  "params" : [
3281  {
3282  "api_version" : %MAX_API_VER%,
3283  "feature" : "0",
3284  "vetoed" : true
3285  }
3286  ]
3287  })"
3288 },
3289 {
3290  "feature: too many arguments.", __LINE__,
3291  {
3292  "feature",
3293  "featureNameOrHexIsNotValidated",
3294  "accept",
3295  "anotherArg"
3296  },
3298  R"({
3299  "method" : "feature",
3300  "params" : [
3301  {
3302  "error" : "badSyntax",
3303  "error_code" : 1,
3304  "error_message" : "Syntax error."
3305  }
3306  ]
3307  })"
3308 },
3309 {
3310  "feature: neither accept nor reject.", __LINE__,
3311  {
3312  "feature",
3313  "featureNameOrHexIsNotValidated",
3314  "veto",
3315  },
3317  R"({
3318  "method" : "feature",
3319  "params" : [
3320  {
3321  "error" : "invalidParams",
3322  "error_code" : 31,
3323  "error_message" : "Invalid parameters."
3324  }
3325  ]
3326  })"
3327 },
3328 
3329 // fetch_info ------------------------------------------------------------------
3330 {
3331  "fetch_info: minimal.", __LINE__,
3332  {
3333  "fetch_info",
3334  },
3336  R"({
3337  "method" : "fetch_info",
3338  "params" : [
3339  {
3340  "api_version" : %MAX_API_VER%,
3341  }
3342  ]
3343  })"
3344 },
3345 {
3346  "fetch_info: clear.", __LINE__,
3347  {
3348  "fetch_info",
3349  "clear"
3350  },
3352  R"({
3353  "method" : "fetch_info",
3354  "params" : [
3355  {
3356  "api_version" : %MAX_API_VER%,
3357  "clear" : true
3358  }
3359  ]
3360  })"
3361 },
3362 {
3363  "fetch_info: too many arguments.", __LINE__,
3364  {
3365  "fetch_info",
3366  "clear",
3367  "other"
3368  },
3370  R"({
3371  "method" : "fetch_info",
3372  "params" : [
3373  {
3374  "error" : "badSyntax",
3375  "error_code" : 1,
3376  "error_message" : "Syntax error."
3377  }
3378  ]
3379  })"
3380 },
3381 {
3382  "fetch_info: other trailing argument.", __LINE__,
3383  {
3384  "fetch_info",
3385  "too"
3386  },
3388  R"({
3389  "method" : "fetch_info",
3390  "params" : [
3391  {
3392  "api_version" : %MAX_API_VER%,
3393  "too" : true
3394  }
3395  ]
3396  })"
3397 },
3398 
3399 // gateway_balances ------------------------------------------------------------
3400 {
3401  "gateway_balances: minimal.", __LINE__,
3402  {
3403  "gateway_balances",
3404  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
3405  },
3407  R"({
3408  "method" : "gateway_balances",
3409  "params" : [
3410  {
3411  "api_version" : %MAX_API_VER%,
3412  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3413  }
3414  ]
3415  })"
3416 },
3417 {
3418  "gateway_balances: with ledger index.", __LINE__,
3419  {
3420  "gateway_balances",
3421  "890765",
3422  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
3423  },
3425  R"({
3426  "method" : "gateway_balances",
3427  "params" : [
3428  {
3429  "api_version" : %MAX_API_VER%,
3430  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3431  "ledger_index" : "890765"
3432  }
3433  ]
3434  })"
3435 },
3436 {
3437  "gateway_balances: with text ledger index.", __LINE__,
3438  {
3439  "gateway_balances",
3440  "current",
3441  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
3442  },
3444  R"({
3445  "method" : "gateway_balances",
3446  "params" : [
3447  {
3448  "api_version" : %MAX_API_VER%,
3449  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3450  "ledger_index" : "current"
3451  }
3452  ]
3453  })"
3454 },
3455 {
3456  "gateway_balances: with 64 character ledger hash.", __LINE__,
3457  {
3458  "gateway_balances",
3459  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
3460  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
3461  },
3463  R"({
3464  "method" : "gateway_balances",
3465  "params" : [
3466  {
3467  "api_version" : %MAX_API_VER%,
3468  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3469  "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
3470  }
3471  ]
3472  })"
3473 },
3474 {
3475  "gateway_balances: 1 hotwallet.", __LINE__,
3476  {
3477  "gateway_balances",
3478  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3479  "hotwallet_is_not_validated"
3480  },
3482  R"({
3483  "method" : "gateway_balances",
3484  "params" : [
3485  {
3486  "api_version" : %MAX_API_VER%,
3487  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3488  "hotwallet" : [ "hotwallet_is_not_validated" ]
3489  }
3490  ]
3491  })"
3492 },
3493 {
3494  "gateway_balances: 3 hotwallets.", __LINE__,
3495  {
3496  "gateway_balances",
3497  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
3498  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3499  "hotwallet_is_not_validated_1",
3500  "hotwallet_is_not_validated_2",
3501  "hotwallet_is_not_validated_3",
3502  },
3504  R"({
3505  "method" : "gateway_balances",
3506  "params" : [
3507  {
3508  "api_version" : %MAX_API_VER%,
3509  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
3510  "hotwallet" : [
3511  "hotwallet_is_not_validated_1",
3512  "hotwallet_is_not_validated_2",
3513  "hotwallet_is_not_validated_3"
3514  ],
3515  "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
3516  }
3517  ]
3518  })"
3519 },
3520 {
3521  "gateway_balances: too few arguments.", __LINE__,
3522  {
3523  "gateway_balances",
3524  },
3526  R"({
3527  "method" : "gateway_balances",
3528  "params" : [
3529  {
3530  "error" : "badSyntax",
3531  "error_code" : 1,
3532  "error_message" : "Syntax error."
3533  }
3534  ]
3535  })"
3536 },
3537 {
3538  "gateway_balances: empty first argument.", __LINE__,
3539  {
3540  "gateway_balances",
3541  ""
3542  },
3544  R"({
3545  "method" : "gateway_balances",
3546  "params" : [
3547  {
3548  "error" : "invalidParams",
3549  "error_code" : 31,
3550  "error_message" : "Invalid first parameter"
3551  }
3552  ]
3553  })"
3554 },
3555 {
3556  "gateway_balances: with ledger index but no gateway.", __LINE__,
3557  {
3558  "gateway_balances",
3559  "890765",
3560  },
3562  R"({
3563  "method" : "gateway_balances",
3564  "params" : [
3565  {
3566  "error" : "invalidParams",
3567  "error_code" : 31,
3568  "error_message" : "Invalid hotwallet"
3569  }
3570  ]
3571  })"
3572 },
3573 {
3574  "gateway_balances: with text ledger index but no gateway.", __LINE__,
3575  {
3576  "gateway_balances",
3577  "current",
3578  },
3580  R"({
3581  "method" : "gateway_balances",
3582  "params" : [
3583  {
3584  "error" : "invalidParams",
3585  "error_code" : 31,
3586  "error_message" : "Invalid hotwallet"
3587  }
3588  ]
3589  })"
3590 },
3591 {
3592  "gateway_balances: with 64 character ledger hash but no gateway.", __LINE__,
3593  {
3594  "gateway_balances",
3595  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
3596  },
3598  R"({
3599  "method" : "gateway_balances",
3600  "params" : [
3601  {
3602  "error" : "invalidParams",
3603  "error_code" : 31,
3604  "error_message" : "Invalid hotwallet"
3605  }
3606  ]
3607  })"
3608 },
3609 
3610 // get_counts ------------------------------------------------------------------
3611 {
3612  "get_counts: minimal.", __LINE__,
3613  {
3614  "get_counts",
3615  },
3617  R"({
3618  "method" : "get_counts",
3619  "params" : [
3620  {
3621  "api_version" : %MAX_API_VER%,
3622  }
3623  ]
3624  })"
3625 },
3626 {
3627  "get_counts: with maximum count.", __LINE__,
3628  {
3629  "get_counts",
3630  "100"
3631  },
3633  R"({
3634  "method" : "get_counts",
3635  "params" : [
3636  {
3637  "api_version" : %MAX_API_VER%,
3638  "min_count" : 100
3639  }
3640  ]
3641  })"
3642 },
3643 {
3644  "get_counts: too many arguments.", __LINE__,
3645  {
3646  "get_counts",
3647  "100",
3648  "whatever"
3649  },
3651  R"({
3652  "method" : "get_counts",
3653  "params" : [
3654  {
3655  "error" : "badSyntax",
3656  "error_code" : 1,
3657  "error_message" : "Syntax error."
3658  }
3659  ]
3660  })"
3661 },
3662 {
3663  "get_counts: count too small.", __LINE__,
3664  {
3665  "get_counts",
3666  "-1",
3667  },
3669  R"()"
3670 },
3671 {
3672  "get_counts: count too large.", __LINE__,
3673  {
3674  "get_counts",
3675  "4294967296"
3676  },
3678  R"()"
3679 },
3680 
3681 // json ------------------------------------------------------------------------
3682 {
3683  "json: minimal.", __LINE__,
3684  {
3685  "json",
3686  "command",
3687  R"({"json_argument":true})",
3688  },
3690  R"({
3691  "method" : "command",
3692  "params" : [
3693  {
3694  "api_version" : %MAX_API_VER%,
3695  "json_argument" : true,
3696  "method" : "command"
3697  }
3698  ]
3699  })"
3700 },
3701 {
3702  "json: null object.", __LINE__,
3703  {
3704  "json",
3705  "command",
3706  R"({})",
3707  },
3709  R"({
3710  "method" : "command",
3711  "params" : [
3712  {
3713  "api_version" : %MAX_API_VER%,
3714  "method" : "command"
3715  }
3716  ]
3717  })"
3718 },
3719 {
3720  "json: too few arguments.", __LINE__,
3721  {
3722  "json",
3723  "command"
3724  },
3726  R"({
3727  "method" : "json",
3728  "params" : [
3729  {
3730  "error" : "badSyntax",
3731  "error_code" : 1,
3732  "error_message" : "Syntax error."
3733  }
3734  ]
3735  })"
3736 },
3737 {
3738  "json: too many arguments.", __LINE__,
3739  {
3740  "json",
3741  "command",
3742  R"({"json_argument":true})",
3743  "extra"
3744  },
3746  R"({
3747  "method" : "json",
3748  "params" : [
3749  {
3750  "error" : "badSyntax",
3751  "error_code" : 1,
3752  "error_message" : "Syntax error."
3753  }
3754  ]
3755  })"
3756 },
3757 {
3758  "json: array, not object.", __LINE__,
3759  {
3760  "json",
3761  "command",
3762  R"(["arg1","arg2"])",
3763  },
3765  R"({
3766  "method" : "json",
3767  "params" : [
3768  {
3769  "error" : "invalidParams",
3770  "error_code" : 31,
3771  "error_message" : "Invalid parameters."
3772  }
3773  ]
3774  })"
3775 },
3776 {
3777  "json: invalid json (note closing comma).", __LINE__,
3778  {
3779  "json",
3780  "command",
3781  R"({"json_argument":true,})",
3782  },
3784  R"({
3785  "method" : "json",
3786  "params" : [
3787  {
3788  "error" : "invalidParams",
3789  "error_code" : 31,
3790  "error_message" : "Invalid parameters."
3791  }
3792  ]
3793  })"
3794 },
3795 
3796 // json2 -----------------------------------------------------------------------
3797 {
3798  "json2: minimal object.", __LINE__,
3799  {
3800  "json2",
3801  R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"})",
3802  },
3804  R"({
3805  "id" : "A1",
3806  "jsonrpc" : "2.0",
3807  "method" : "call_1",
3808  "params" : [
3809  {
3810  "api_version" : %MAX_API_VER%,
3811  "id" : "A1",
3812  "jsonrpc" : "2.0",
3813  "method" : "call_1",
3814  "ripplerpc" : "2.0"
3815  }
3816  ],
3817  "ripplerpc" : "2.0"
3818  })"
3819 },
3820 {
3821  "json2: object with nested params.", __LINE__,
3822  {
3823  "json2",
3824  R"({
3825  "jsonrpc" : "2.0",
3826  "ripplerpc" : "2.0",
3827  "id" : "A1",
3828  "method" : "call_1",
3829  "params" : [{"inner_arg" : "yup"}]
3830  })",
3831  },
3833  R"({
3834  "id" : "A1",
3835  "jsonrpc" : "2.0",
3836  "method" : "call_1",
3837  "params" : [
3838  {
3839  "api_version" : %MAX_API_VER%,
3840  "0" : {
3841  "inner_arg" : "yup"
3842  },
3843  "id" : "A1",
3844  "jsonrpc" : "2.0",
3845  "method" : "call_1",
3846  "ripplerpc" : "2.0"
3847  }
3848  ],
3849  "ripplerpc" : "2.0"
3850  })"
3851 },
3852 {
3853  "json2: minimal array.", __LINE__,
3854  {
3855  "json2",
3856  R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"}])",
3857  },
3859  R"({
3860  "method" : "json2",
3861  "params" : [
3862  [
3863  {
3864  "api_version" : %MAX_API_VER%,
3865  "id" : "A1",
3866  "jsonrpc" : "2.0",
3867  "method" : "call_1",
3868  "ripplerpc" : "2.0"
3869  }
3870  ]
3871  ]
3872  })"
3873 },
3874 {
3875  "json2: array with object with nested params.", __LINE__,
3876  {
3877  "json2",
3878  R"([
3879  {"jsonrpc":"2.0",
3880  "ripplerpc":"2.0",
3881  "id":"A1",
3882  "method":"call_1",
3883  "params" : [{"inner_arg" : "yup"}]}
3884  ])",
3885  },
3887  R"({
3888  "method" : "json2",
3889  "params" : [
3890  [
3891  {
3892  "api_version" : %MAX_API_VER%,
3893  "0" : {
3894  "inner_arg" : "yup"
3895  },
3896  "id" : "A1",
3897  "jsonrpc" : "2.0",
3898  "method" : "call_1",
3899  "ripplerpc" : "2.0"
3900  }
3901  ]
3902  ]})"
3903 },
3904 {
3905  "json2: too few arguments.", __LINE__,
3906  {
3907  "json2",
3908  },
3910  R"({
3911  "method" : "json2",
3912  "params" : [
3913  {
3914  "error" : "badSyntax",
3915  "error_code" : 1,
3916  "error_message" : "Syntax error."
3917  }
3918  ]
3919  })"
3920 },
3921 {
3922  "json2: too many arguments.", __LINE__,
3923  {
3924  "json2",
3925  R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_this"})",
3926  "extra"
3927  },
3929  R"({
3930  "method" : "json2",
3931  "params" : [
3932  {
3933  "error" : "badSyntax",
3934  "error_code" : 1,
3935  "error_message" : "Syntax error."
3936  }
3937  ]
3938  })"
3939 },
3940 {
3941  "json2: malformed json (note extra comma).", __LINE__,
3942  {
3943  "json2",
3944  R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",})",
3945  },
3947  R"({
3948  "id" : "A1",
3949  "jsonrpc" : "2.0",
3950  "method" : "json2",
3951  "params" : [
3952  {
3953  "error" : "invalidParams",
3954  "error_code" : 31,
3955  "error_message" : "Invalid parameters.",
3956  "id" : "A1",
3957  "jsonrpc" : "2.0",
3958  "ripplerpc" : "2.0"
3959  }
3960  ],
3961  "ripplerpc" : "2.0"
3962  })"
3963 },
3964 {
3965  "json2: omit jsonrpc.", __LINE__,
3966  {
3967  "json2",
3968  R"({"ripplerpc":"2.0","id":"A1","method":"call_1"})",
3969  },
3971  R"({
3972  "id" : "A1",
3973  "method" : "json2",
3974  "params" : [
3975  {
3976  "error" : "invalidParams",
3977  "error_code" : 31,
3978  "error_message" : "Invalid parameters.",
3979  "id" : "A1",
3980  "ripplerpc" : "2.0"
3981  }
3982  ],
3983  "ripplerpc" : "2.0"
3984  })"
3985 },
3986 {
3987  "json2: wrong jsonrpc version.", __LINE__,
3988  {
3989  "json2",
3990  R"({"jsonrpc":"2.1","ripplerpc":"2.0","id":"A1","method":"call_1"})",
3991  },
3993  R"({
3994  "id" : "A1",
3995  "jsonrpc" : "2.1",
3996  "method" : "json2",
3997  "params" : [
3998  {
3999  "error" : "invalidParams",
4000  "error_code" : 31,
4001  "error_message" : "Invalid parameters.",
4002  "id" : "A1",
4003  "jsonrpc" : "2.1",
4004  "ripplerpc" : "2.0"
4005  }
4006  ],
4007  "ripplerpc" : "2.0"
4008  })"
4009 },
4010 {
4011  "json2: omit ripplerpc.", __LINE__,
4012  {
4013  "json2",
4014  R"({"jsonrpc":"2.0","id":"A1","method":"call_1"})",
4015  },
4017  R"({
4018  "id" : "A1",
4019  "jsonrpc" : "2.0",
4020  "method" : "json2",
4021  "params" : [
4022  {
4023  "error" : "invalidParams",
4024  "error_code" : 31,
4025  "error_message" : "Invalid parameters.",
4026  "id" : "A1",
4027  "jsonrpc" : "2.0"
4028  }
4029  ]
4030  })"
4031 },
4032 {
4033  "json2: wrong ripplerpc version.", __LINE__,
4034  {
4035  "json2",
4036  R"({"jsonrpc":"2.0","ripplerpc":"2.00","id":"A1","method":"call_1"})",
4037  },
4039  R"({
4040  "id" : "A1",
4041  "jsonrpc" : "2.0",
4042  "method" : "json2",
4043  "params" : [
4044  {
4045  "error" : "invalidParams",
4046  "error_code" : 31,
4047  "error_message" : "Invalid parameters.",
4048  "id" : "A1",
4049  "jsonrpc" : "2.0",
4050  "ripplerpc" : "2.00"
4051  }
4052  ],
4053  "ripplerpc" : "2.00"
4054  })"
4055 },
4056 {
4057  "json2: omit id.", __LINE__,
4058  {
4059  "json2",
4060  R"({"jsonrpc":"2.0","ripplerpc":"2.0","method":"call_1"})",
4061  },
4063  R"({
4064  "jsonrpc" : "2.0",
4065  "method" : "json2",
4066  "params" : [
4067  {
4068  "error" : "invalidParams",
4069  "error_code" : 31,
4070  "error_message" : "Invalid parameters.",
4071  "jsonrpc" : "2.0",
4072  "ripplerpc" : "2.0"
4073  }
4074  ],
4075  "ripplerpc" : "2.0"
4076  })"
4077 },
4078 {
4079  "json2: omit method.", __LINE__,
4080  {
4081  "json2",
4082  R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1"})",
4083  },
4085  R"({
4086  "id" : "A1",
4087  "jsonrpc" : "2.0",
4088  "method" : "json2",
4089  "params" : [
4090  {
4091  "error" : "invalidParams",
4092  "error_code" : 31,
4093  "error_message" : "Invalid parameters.",
4094  "id" : "A1",
4095  "jsonrpc" : "2.0",
4096  "ripplerpc" : "2.0"
4097  }
4098  ],
4099  "ripplerpc" : "2.0"
4100  })"
4101 },
4102 {
4103  "json2: empty outer array.", __LINE__,
4104  {
4105  "json2",
4106  R"([])",
4107  },
4109  R"({
4110  "method" : "json2",
4111  "params" : [
4112  {
4113  "error" : "invalidParams",
4114  "error_code" : 31,
4115  "error_message" : "Invalid parameters."
4116  }
4117  ]
4118  })"
4119 },
4120 {
4121  "json2: empty inner array.", __LINE__,
4122  {
4123  "json2",
4124  R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",[]}])",
4125  },
4127  R"({
4128  "method" : "json2",
4129  "params" : [
4130  {
4131  "error" : "invalidParams",
4132  "error_code" : 31,
4133  "error_message" : "Invalid parameters."
4134  }
4135  ]
4136  })"
4137 },
4138 {
4139  "json2: array with non-json2 object.", __LINE__,
4140  {
4141  "json2",
4142  R"([
4143  {"jsonrpc" : "2.1",
4144  "ripplerpc" : "2.0",
4145  "id" : "A1",
4146  "method" : "call_1"
4147  }
4148  ])",
4149  },
4151  R"({
4152  "method" : "json2",
4153  "params" : [
4154  {
4155  "error" : "invalidParams",
4156  "error_code" : 31,
4157  "error_message" : "Invalid parameters."
4158  }
4159  ]
4160  })"
4161 },
4162 {
4163  "json2: non-object or -array inner params member.", __LINE__,
4164  {
4165  "json2",
4166  R"({
4167  "jsonrpc" : "2.0",
4168  "ripplerpc" : "2.0",
4169  "id" : "A1",
4170  "method" : "call_1",
4171  "params" : true
4172  })",
4173  },
4175  R"({
4176  "id" : "A1",
4177  "jsonrpc" : "2.0",
4178  "method" : "json2",
4179  "params" : [
4180  {
4181  "error" : "invalidParams",
4182  "error_code" : 31,
4183  "error_message" : "Invalid parameters.",
4184  "id" : "A1",
4185  "jsonrpc" : "2.0",
4186  "ripplerpc" : "2.0"
4187  }
4188  ],
4189  "ripplerpc" : "2.0"
4190  })"
4191 },
4192 
4193 // ledger ----------------------------------------------------------------------
4194 {
4195  "ledger: minimal.", __LINE__,
4196  {
4197  "ledger"
4198  },
4200  R"({
4201  "method" : "ledger",
4202  "params" : [
4203  {
4204  "api_version" : %MAX_API_VER%,
4205  }
4206  ]
4207  })"
4208 },
4209 {
4210  "ledger: ledger index.", __LINE__,
4211  {
4212  "ledger",
4213  "4294967295"
4214  },
4216  R"({
4217  "method" : "ledger",
4218  "params" : [
4219  {
4220  "api_version" : %MAX_API_VER%,
4221  "ledger_index" : 4294967295
4222  }
4223  ]
4224  })"
4225 },
4226 {
4227  "ledger: text ledger index.", __LINE__,
4228  {
4229  "ledger",
4230  "validated"
4231  },
4233  R"({
4234  "method" : "ledger",
4235  "params" : [
4236  {
4237  "api_version" : %MAX_API_VER%,
4238  "ledger_index" : "validated"
4239  }
4240  ]
4241  })"
4242 },
4243 {
4244  "ledger: ledger hash.", __LINE__,
4245  {
4246  "ledger",
4247  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
4248  },
4250  R"({
4251  "method" : "ledger",
4252  "params" : [
4253  {
4254  "api_version" : %MAX_API_VER%,
4255  "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
4256  }
4257  ]
4258  })"
4259 },
4260 {
4261  "ledger: full.", __LINE__,
4262  {
4263  "ledger",
4264  "current",
4265  "full"
4266  },
4268  R"({
4269  "method" : "ledger",
4270  "params" : [
4271  {
4272  "api_version" : %MAX_API_VER%,
4273  "full" : true,
4274  "ledger_index" : "current"
4275  }
4276  ]
4277  })"
4278 },
4279 {
4280  "ledger: tx.", __LINE__,
4281  {
4282  "ledger",
4283  "closed",
4284  "tx"
4285  },
4287  R"({
4288  "method" : "ledger",
4289  "params" : [
4290  {
4291  "api_version" : %MAX_API_VER%,
4292  "expand" : true,
4293  "ledger_index" : "closed",
4294  "transactions" : true
4295  }
4296  ]
4297  })"
4298 },
4299 {
4300  "ledger: too many arguments.", __LINE__,
4301  {
4302  "ledger",
4303  "4294967295",
4304  "spare"
4305  },
4307  R"({
4308  "method" : "ledger",
4309  "params" : [
4310  {
4311  "api_version" : %MAX_API_VER%,
4312  "ledger_index" : 4294967295
4313  }
4314  ]
4315  })"
4316 },
4317 {
4318  "ledger: ledger index too small.", __LINE__,
4319  {
4320  "ledger",
4321  "-1"
4322  },
4324  R"({
4325  "method" : "ledger",
4326  "params" : [
4327  {
4328  "api_version" : %MAX_API_VER%,
4329  "ledger_index" : 0
4330  }
4331  ]
4332  })"
4333 },
4334 {
4335  "ledger: ledger index too big.", __LINE__,
4336  {
4337  "ledger",
4338  "4294967296"
4339  },
4341  R"({
4342  "method" : "ledger",
4343  "params" : [
4344  {
4345  "api_version" : %MAX_API_VER%,
4346  "ledger_index" : 0
4347  }
4348  ]
4349  })"
4350 },
4351 {
4352  "ledger: invalid ledger text.", __LINE__,
4353  {
4354  "ledger",
4355  "latest"
4356  },
4358  R"({
4359  "method" : "ledger",
4360  "params" : [
4361  {
4362  "api_version" : %MAX_API_VER%,
4363  "ledger_index" : 0
4364  }
4365  ]
4366  })"
4367 },
4368 {
4369  "ledger: unsupported final argument.", __LINE__,
4370  {
4371  "ledger",
4372  "current",
4373  "expand"
4374  },
4376  R"({
4377  "method" : "ledger",
4378  "params" : [
4379  {
4380  "api_version" : %MAX_API_VER%,
4381  "ledger_index" : "current"
4382  }
4383  ]
4384  })"
4385 },
4386 
4387 // ledger_closed ---------------------------------------------------------------
4388 {
4389  "ledger_closed: minimal.", __LINE__,
4390  {
4391  "ledger_closed"
4392  },
4394  R"({
4395  "method" : "ledger_closed",
4396  "params" : [
4397  {
4398  "api_version" : %MAX_API_VER%,
4399  }
4400  ]
4401  })"
4402 },
4403 {
4404  "ledger_closed: too many arguments.", __LINE__,
4405  {
4406  "ledger_closed",
4407  "today"
4408  },
4410  R"({
4411  "method" : "ledger_closed",
4412  "params" : [
4413  {
4414  "error" : "badSyntax",
4415  "error_code" : 1,
4416  "error_message" : "Syntax error."
4417  }
4418  ]
4419  })"
4420 },
4421 
4422 // ledger_current --------------------------------------------------------------
4423 {
4424  "ledger_current: minimal.", __LINE__,
4425  {
4426  "ledger_current"
4427  },
4429  R"({
4430  "method" : "ledger_current",
4431  "params" : [
4432  {
4433  "api_version" : %MAX_API_VER%,
4434  }
4435  ]
4436  })"
4437 },
4438 {
4439  "ledger_current: too many arguments.", __LINE__,
4440  {
4441  "ledger_current",
4442  "today"
4443  },
4445  R"({
4446  "method" : "ledger_current",
4447  "params" : [
4448  {
4449  "error" : "badSyntax",
4450  "error_code" : 1,
4451  "error_message" : "Syntax error."
4452  }
4453  ]
4454  })"
4455 },
4456 
4457 // ledger_header ---------------------------------------------------------------
4458 {
4459  "ledger_header: ledger index.", __LINE__,
4460  {
4461  "ledger_header",
4462  "4294967295"
4463  },
4465  R"({
4466  "method" : "ledger_header",
4467  "params" : [
4468  {
4469  "api_version" : %MAX_API_VER%,
4470  "ledger_index" : 4294967295
4471  }
4472  ]
4473  })"
4474 },
4475 {
4476  "ledger_header: ledger hash.", __LINE__,
4477  {
4478  "ledger_header",
4479  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
4480  },
4482  R"({
4483  "method" : "ledger_header",
4484  "params" : [
4485  {
4486  "api_version" : %MAX_API_VER%,
4487  "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
4488  }
4489  ]
4490  })"
4491 },
4492 {
4493  "ledger_header: too few arguments.", __LINE__,
4494  {
4495  "ledger_header",
4496  },
4498  R"({
4499  "method" : "ledger_header",
4500  "params" : [
4501  {
4502  "error" : "badSyntax",
4503  "error_code" : 1,
4504  "error_message" : "Syntax error."
4505  }
4506  ]
4507  })"
4508 },
4509 {
4510  "ledger_header: too many arguments.", __LINE__,
4511  {
4512  "ledger_header",
4513  "4294967295",
4514  "spare"
4515  },
4517  R"({
4518  "method" : "ledger_header",
4519  "params" : [
4520  {
4521  "error" : "badSyntax",
4522  "error_code" : 1,
4523  "error_message" : "Syntax error."
4524  }
4525  ]
4526  })"
4527 },
4528 {
4529  "ledger_header: text ledger index.", __LINE__,
4530  {
4531  "ledger_header",
4532  "current"
4533  },
4535  R"({
4536  "method" : "ledger_header",
4537  "params" : [
4538  {
4539  "api_version" : %MAX_API_VER%,
4540  "ledger_index" : 0
4541  }
4542  ]
4543  })"
4544 },
4545 {
4546  "ledger_header: ledger index too small.", __LINE__,
4547  {
4548  "ledger_header",
4549  "-1"
4550  },
4552  R"({
4553  "method" : "ledger_header",
4554  "params" : [
4555  {
4556  "api_version" : %MAX_API_VER%,
4557  "ledger_index" : 0
4558  }
4559  ]
4560  })"
4561 },
4562 {
4563  "ledger_header: ledger index too big.", __LINE__,
4564  {
4565  "ledger_header",
4566  "4294967296"
4567  },
4569  R"({
4570  "method" : "ledger_header",
4571  "params" : [
4572  {
4573  "api_version" : %MAX_API_VER%,
4574  "ledger_index" : 0
4575  }
4576  ]
4577  })"
4578 },
4579 
4580 // ledger_request --------------------------------------------------------------
4581 {
4582  "ledger_request: ledger index.", __LINE__,
4583  {
4584  "ledger_request",
4585  "4294967295"
4586  },
4588  R"({
4589  "method" : "ledger_request",
4590  "params" : [
4591  {
4592  "api_version" : %MAX_API_VER%,
4593  "ledger_index" : 4294967295
4594  }
4595  ]
4596  })"
4597 },
4598 {
4599  "ledger_request: ledger hash.", __LINE__,
4600  {
4601  "ledger_request",
4602  "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
4603  },
4605  R"({
4606  "method" : "ledger_request",
4607  "params" : [
4608  {
4609  "api_version" : %MAX_API_VER%,
4610  "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"
4611  }
4612  ]
4613  })"
4614 },
4615 {
4616  "ledger_request: too few arguments.", __LINE__,
4617  {
4618  "ledger_request",
4619  },
4621  R"({
4622  "method" : "ledger_request",
4623  "params" : [
4624  {
4625  "error" : "badSyntax",
4626  "error_code" : 1,
4627  "error_message" : "Syntax error."
4628  }
4629  ]
4630  })"
4631 },
4632 {
4633  "ledger_request: too many arguments.", __LINE__,
4634  {
4635  "ledger_request",
4636  "4294967295",
4637  "spare"
4638  },
4640  R"({
4641  "method" : "ledger_request",
4642  "params" : [
4643  {
4644  "error" : "badSyntax",
4645  "error_code" : 1,
4646  "error_message" : "Syntax error."
4647  }
4648  ]
4649  })"
4650 },
4651 {
4652  "ledger_request: text ledger index.", __LINE__,
4653  {
4654  "ledger_request",
4655  "current"
4656  },
4658  R"({
4659  "method" : "ledger_request",
4660  "params" : [
4661  {
4662  "api_version" : %MAX_API_VER%,
4663  "ledger_index" : 0
4664  }
4665  ]
4666  })"
4667 },
4668 {
4669  "ledger_request: ledger index too small.", __LINE__,
4670  {
4671  "ledger_request",
4672  "-1"
4673  },
4675  R"({
4676  "method" : "ledger_request",
4677  "params" : [
4678  {
4679  "api_version" : %MAX_API_VER%,
4680  "ledger_index" : 0
4681  }
4682  ]
4683  })"
4684 },
4685 {
4686  "ledger_request: ledger index too big.", __LINE__,
4687  {
4688  "ledger_request",
4689  "4294967296"
4690  },
4692  R"({
4693  "method" : "ledger_request",
4694  "params" : [
4695  {
4696  "api_version" : %MAX_API_VER%,
4697  "ledger_index" : 0
4698  }
4699  ]
4700  })"
4701 },
4702 
4703 // log_level -------------------------------------------------------------------
4704 {
4705  "log_level: minimal.", __LINE__,
4706  {
4707  "log_level",
4708  },
4710  R"({
4711  "method" : "log_level",
4712  "params" : [
4713  {
4714  "api_version" : %MAX_API_VER%,
4715  }
4716  ]
4717  })"
4718 },
4719 {
4720  "log_level: fatal.", __LINE__,
4721  {
4722  "log_level",
4723  "fatal"
4724  },
4726  R"({
4727  "method" : "log_level",
4728  "params" : [
4729  {
4730  "api_version" : %MAX_API_VER%,
4731  "severity" : "fatal"
4732  }
4733  ]
4734  })"
4735 },
4736 {
4737  "log_level: error.", __LINE__,
4738  {
4739  "log_level",
4740  "error"
4741  },
4743  R"({
4744  "method" : "log_level",
4745  "params" : [
4746  {
4747  "api_version" : %MAX_API_VER%,
4748  "severity" : "error"
4749  }
4750  ]
4751  })"
4752 },
4753 {
4754  "log_level: warn.", __LINE__,
4755  {
4756  "log_level",
4757  "warn"
4758  },
4760  R"({
4761  "method" : "log_level",
4762  "params" : [
4763  {
4764  "api_version" : %MAX_API_VER%,
4765  "severity" : "warn"
4766  }
4767  ]
4768  })"
4769 },
4770 {
4771  "log_level: debug.", __LINE__,
4772  {
4773  "log_level",
4774  "debug"
4775  },
4777  R"({
4778  "method" : "log_level",
4779  "params" : [
4780  {
4781  "api_version" : %MAX_API_VER%,
4782  "severity" : "debug"
4783  }
4784  ]
4785  })"
4786 },
4787 {
4788  "log_level: trace.", __LINE__,
4789  {
4790  "log_level",
4791  "trace"
4792  },
4794  R"({
4795  "method" : "log_level",
4796  "params" : [
4797  {
4798  "api_version" : %MAX_API_VER%,
4799  "severity" : "trace"
4800  }
4801  ]
4802  })"
4803 },
4804 {
4805  "log_level: base partition.", __LINE__,
4806  {
4807  "log_level",
4808  "base",
4809  "trace"
4810  },
4812  R"({
4813  "method" : "log_level",
4814  "params" : [
4815  {
4816  "api_version" : %MAX_API_VER%,
4817  "partition" : "base",
4818  "severity" : "trace"
4819  }
4820  ]
4821  })"
4822 },
4823 {
4824  "log_level: partiton_name.", __LINE__,
4825  {
4826  "log_level",
4827  "partition_name",
4828  "fatal"
4829  },
4831  R"({
4832  "method" : "log_level",
4833  "params" : [
4834  {
4835  "api_version" : %MAX_API_VER%,
4836  "partition" : "partition_name",
4837  "severity" : "fatal"
4838  }
4839  ]
4840  })"
4841 },
4842 {
4843  "log_level: too many arguments.", __LINE__,
4844  {
4845  "log_level",
4846  "partition_name",
4847  "fatal",
4848  "extra"
4849  },
4851  R"({
4852  "method" : "log_level",
4853  "params" : [
4854  {
4855  "error" : "badSyntax",
4856  "error_code" : 1,
4857  "error_message" : "Syntax error."
4858  }
4859  ]
4860  })"
4861 },
4862 {
4863  "log_level: invalid severity.", __LINE__,
4864  {
4865  "log_level",
4866  "err"
4867  },
4869  R"({
4870  "method" : "log_level",
4871  "params" : [
4872  {
4873  "api_version" : %MAX_API_VER%,
4874  "severity" : "err"
4875  }
4876  ]
4877  })"
4878 },
4879 {
4880  "log_level: swap partition name and severity.", __LINE__,
4881  {
4882  "log_level",
4883  "fatal",
4884  "partition_name",
4885  },
4887  R"({
4888  "method" : "log_level",
4889  "params" : [
4890  {
4891  "api_version" : %MAX_API_VER%,
4892  "partition" : "fatal",
4893  "severity" : "partition_name"
4894  }
4895  ]
4896  })"
4897 },
4898 
4899 // logrotate -------------------------------------------------------------------
4900 {
4901  "logrotate: minimal.", __LINE__,
4902  {
4903  "logrotate",
4904  },
4906  R"({
4907  "method" : "logrotate",
4908  "params" : [
4909  {
4910  "api_version" : %MAX_API_VER%,
4911  }
4912  ]
4913  })"
4914 },
4915 {
4916  "logrotate: too many arguments.", __LINE__,
4917  {
4918  "logrotate",
4919  "extra"
4920  },
4922  R"({
4923  "method" : "logrotate",
4924  "params" : [
4925  {
4926  "error" : "badSyntax",
4927  "error_code" : 1,
4928  "error_message" : "Syntax error."
4929  }
4930  ]
4931  })"
4932 },
4933 
4934 // owner_info ------------------------------------------------------------------
4935 {
4936  "owner_info: minimal.", __LINE__,
4937  {
4938  "owner_info",
4939  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
4940  },
4942  R"({
4943  "method" : "owner_info",
4944  "params" : [
4945  {
4946  "api_version" : %MAX_API_VER%,
4947  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
4948  }
4949  ]
4950  })"
4951 },
4952 {
4953  "owner_info: with numeric ledger index.", __LINE__,
4954  {
4955  "owner_info",
4956  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
4957  "987654321"
4958  },
4960  R"({
4961  "method" : "owner_info",
4962  "params" : [
4963  {
4964  "api_version" : %MAX_API_VER%,
4965  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
4966  "ledger_index" : 987654321
4967  }
4968  ]
4969  })"
4970 },
4971 {
4972  "owner_info: with text ledger index.", __LINE__,
4973  {
4974  "owner_info",
4975  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
4976  "validated"
4977  },
4979  R"({
4980  "method" : "owner_info",
4981  "params" : [
4982  {
4983  "api_version" : %MAX_API_VER%,
4984  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
4985  "ledger_index" : "validated"
4986  }
4987  ]
4988  })"
4989 },
4990 {
4991  "owner_info: with ledger hash.", __LINE__,
4992  {
4993  "owner_info",
4994  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
4995  "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
4996  },
4998  R"({
4999  "method" : "owner_info",
5000  "params" : [
5001  {
5002  "api_version" : %MAX_API_VER%,
5003  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5004  "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
5005  }
5006  ]
5007  })"
5008 },
5009 {
5010  "owner_info: strict.", __LINE__,
5011  {
5012  "owner_info",
5013  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5014  "strict"
5015  },
5017  R"({
5018  "method" : "owner_info",
5019  "params" : [
5020  {
5021  "api_version" : %MAX_API_VER%,
5022  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5023  "strict" : 1
5024  }
5025  ]
5026  })"
5027 },
5028 {
5029  "owner_info: with ledger index and strict.", __LINE__,
5030  {
5031  "owner_info",
5032  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5033  "validated",
5034  "strict"
5035  },
5037  R"({
5038  "method" : "owner_info",
5039  "params" : [
5040  {
5041  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5042  "api_version" : %MAX_API_VER%,
5043  "ledger_index" : "validated",
5044  "strict" : 1
5045  }
5046  ]
5047  })"
5048 },
5049 {
5050  "owner_info: too few arguments.", __LINE__,
5051  {
5052  "owner_info",
5053  },
5055  R"({
5056  "method" : "owner_info",
5057  "params" : [
5058  {
5059  "error" : "badSyntax",
5060  "error_code" : 1,
5061  "error_message" : "Syntax error."
5062  }
5063  ]
5064  })"
5065 },
5066 {
5067  "owner_info: too many arguments.", __LINE__,
5068  {
5069  "owner_info",
5070  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5071  "current",
5072  "extra",
5073  "strict",
5074  },
5076  R"({
5077  "method" : "owner_info",
5078  "params" : [
5079  {
5080  "error" : "badSyntax",
5081  "error_code" : 1,
5082  "error_message" : "Syntax error."
5083  }
5084  ]
5085  })"
5086 },
5087 {
5088  "owner_info: invalid accountID.", __LINE__,
5089  {
5090  "owner_info",
5091  "", // Note: very few values are detected as bad!
5092  },
5094  R"({
5095  "method" : "owner_info",
5096  "params" : [
5097  {
5098  "error" : "actMalformed",
5099  "error_code" : 35,
5100  "error_message" : "Account malformed."
5101  }
5102  ]
5103  })",
5104 },
5105 {
5106  // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
5107  // cannot currently occur because jvParseLedger() always returns true.
5108  "owner_info: invalid ledger selection.", __LINE__,
5109  {
5110  "owner_info",
5111  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5112  "no_ledger"
5113  },
5115  R"({
5116  "method" : "owner_info",
5117  "params" : [
5118  {
5119  "api_version" : %MAX_API_VER%,
5120  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5121  "ledger_index" : 0
5122  }
5123  ]
5124  })",
5125 },
5126 {
5127  // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That
5128  // cannot currently occur because jvParseLedger() always returns true.
5129  "owner_info: invalid ledger selection and strict.", __LINE__,
5130  {
5131  "owner_info",
5132  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5133  "no_ledger",
5134  "strict"
5135  },
5137  R"({
5138  "method" : "owner_info",
5139  "params" : [
5140  {
5141  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5142  "api_version" : %MAX_API_VER%,
5143  "ledger_index" : 0,
5144  "strict" : 1
5145  }
5146  ]
5147  })",
5148 },
5149 
5150 // peers -----------------------------------------------------------------------
5151 {
5152  "peers: minimal.", __LINE__,
5153  {
5154  "peers",
5155  },
5157  R"({
5158  "method" : "peers",
5159  "params" : [
5160  {
5161  "api_version" : %MAX_API_VER%,
5162  }
5163  ]
5164  })"
5165 },
5166 {
5167  "peers: too many arguments.", __LINE__,
5168  {
5169  "peers",
5170  "extra"
5171  },
5173  R"({
5174  "method" : "peers",
5175  "params" : [
5176  {
5177  "error" : "badSyntax",
5178  "error_code" : 1,
5179  "error_message" : "Syntax error."
5180  }
5181  ]
5182  })"
5183 },
5184 
5185 // peer_reservations_add -------------------------------------------------------
5186 {
5187  "peer_reservations_add: minimal.", __LINE__,
5188  {
5189  "peer_reservations_add",
5190  "public_key_string"
5191  },
5193  R"({
5194  "method" : "peer_reservations_add",
5195  "params" : [
5196  {
5197  "api_version" : %MAX_API_VER%,
5198  "public_key" : "public_key_string"
5199  }
5200  ]
5201  })"
5202 },
5203 {
5204  "peer_reservations_add: with description.", __LINE__,
5205  {
5206  "peer_reservations_add",
5207  "public_key_string",
5208  "public_key_description"
5209  },
5211  R"({
5212  "method" : "peer_reservations_add",
5213  "params" : [
5214  {
5215  "api_version" : %MAX_API_VER%,
5216  "description" : "public_key_description",
5217  "public_key" : "public_key_string"
5218  }
5219  ]
5220  })"
5221 },
5222 {
5223  "peer_reservations_add: too few arguments.", __LINE__,
5224  {
5225  "peer_reservations_add"
5226  },
5228  R"({
5229  "method" : "peer_reservations_add",
5230  "params" : [
5231  {
5232  "error" : "badSyntax",
5233  "error_code" : 1,
5234  "error_message" : "Syntax error."
5235  }
5236  ]
5237  })"
5238 },
5239 {
5240  "peer_reservations_add: too many arguments.", __LINE__,
5241  {
5242  "peer_reservations_add",
5243  "public_key_string",
5244  "public_key_description",
5245  "spare"
5246  },
5248  R"({
5249  "method" : "peer_reservations_add",
5250  "params" : [
5251  {
5252  "error" : "badSyntax",
5253  "error_code" : 1,
5254  "error_message" : "Syntax error."
5255  }
5256  ]
5257  })"
5258 },
5259 
5260 // peer_reservations_del -------------------------------------------------------
5261 {
5262  "peer_reservations_del: minimal.", __LINE__,
5263  {
5264  "peer_reservations_del",
5265  "public_key_string"
5266  },
5268  R"({
5269  "method" : "peer_reservations_del",
5270  "params" : [
5271  {
5272  "api_version" : %MAX_API_VER%,
5273  "public_key" : "public_key_string"
5274  }
5275  ]
5276  })"
5277 },
5278 {
5279  "peer_reservations_del: too few arguments.", __LINE__,
5280  {
5281  "peer_reservations_del"
5282  },
5284  R"({
5285  "method" : "peer_reservations_del",
5286  "params" : [
5287  {
5288  "error" : "badSyntax",
5289  "error_code" : 1,
5290  "error_message" : "Syntax error."
5291  }
5292  ]
5293  })"
5294 },
5295 {
5296  "peer_reservations_del: too many arguments.", __LINE__,
5297  {
5298  "peer_reservations_del",
5299  "public_key_string",
5300  "public_key_description",
5301  "spare"
5302  },
5304  R"({
5305  "method" : "peer_reservations_del",
5306  "params" : [
5307  {
5308  "error" : "badSyntax",
5309  "error_code" : 1,
5310  "error_message" : "Syntax error."
5311  }
5312  ]
5313  })"
5314 },
5315 
5316 // ping ------------------------------------------------------------------------
5317 {
5318  "ping: minimal.", __LINE__,
5319  {
5320  "ping",
5321  },
5323  R"({
5324  "method" : "ping",
5325  "params" : [
5326  {
5327  "api_version" : %MAX_API_VER%,
5328  }
5329  ]
5330  })"
5331 },
5332 {
5333  "ping: too many arguments.", __LINE__,
5334  {
5335  "ping",
5336  "extra"
5337  },
5339  R"({
5340  "method" : "ping",
5341  "params" : [
5342  {
5343  "error" : "badSyntax",
5344  "error_code" : 1,
5345  "error_message" : "Syntax error."
5346  }
5347  ]
5348  })"
5349 },
5350 
5351 // print -----------------------------------------------------------------------
5352 {
5353  "print: minimal.", __LINE__,
5354  {
5355  "print",
5356  },
5358  R"({
5359  "method" : "print",
5360  "params" : [
5361  {
5362  "api_version" : %MAX_API_VER%,
5363  }
5364  ]
5365  })"
5366 },
5367 {
5368  // The docs indicate that no arguments are allowed. So should this error?
5369  "print: extra argument.", __LINE__,
5370  {
5371  "print",
5372  "extra"
5373  },
5375  R"({
5376  "method" : "print",
5377  "params" : [
5378  {
5379  "api_version" : %MAX_API_VER%,
5380  "params" : [ "extra" ]
5381  }
5382  ]
5383  })"
5384 },
5385 {
5386  "print: too many arguments.", __LINE__,
5387  {
5388  "print",
5389  "extra1",
5390  "extra2"
5391  },
5393  R"({
5394  "method" : "print",
5395  "params" : [
5396  {
5397  "error" : "badSyntax",
5398  "error_code" : 1,
5399  "error_message" : "Syntax error."
5400  }
5401  ]
5402  })"
5403 },
5404 
5405 // random ----------------------------------------------------------------------
5406 {
5407  "random: minimal.", __LINE__,
5408  {
5409  "random",
5410  },
5412  R"({
5413  "method" : "random",
5414  "params" : [
5415  {
5416  "api_version" : %MAX_API_VER%,
5417  }
5418  ]
5419  })"
5420 },
5421 {
5422  "random: too many arguments.", __LINE__,
5423  {
5424  "random",
5425  "extra"
5426  },
5428  R"({
5429  "method" : "random",
5430  "params" : [
5431  {
5432  "error" : "badSyntax",
5433  "error_code" : 1,
5434  "error_message" : "Syntax error."
5435  }
5436  ]
5437  })"
5438 },
5439 
5440 // ripple_path_find ------------------------------------------------------------
5441 {
5442  "ripple_path_find: minimal.", __LINE__,
5443  {
5444  "ripple_path_find",
5445  R"({"json_argument":true})",
5446  },
5448  R"({
5449  "method" : "ripple_path_find",
5450  "params" : [
5451  {
5452  "api_version" : %MAX_API_VER%,
5453  "json_argument" : true
5454  }
5455  ]
5456  })"
5457 },
5458 {
5459  "ripple_path_find: ledger index.", __LINE__,
5460  {
5461  "ripple_path_find",
5462  R"({"json_argument":true})",
5463  "4294967295"
5464  },
5466  R"({
5467  "method" : "ripple_path_find",
5468  "params" : [
5469  {
5470  "api_version" : %MAX_API_VER%,
5471  "json_argument" : true,
5472  "ledger_index" : 4294967295
5473  }
5474  ]
5475  })"
5476 },
5477 {
5478  "ripple_path_find: text ledger index.", __LINE__,
5479  {
5480  "ripple_path_find",
5481  R"({"json_argument":true})",
5482  "closed"
5483  },
5485  R"({
5486  "method" : "ripple_path_find",
5487  "params" : [
5488  {
5489  "api_version" : %MAX_API_VER%,
5490  "json_argument" : true,
5491  "ledger_index" : "closed"
5492  }
5493  ]
5494  })"
5495 },
5496 {
5497  "ripple_path_find: ledger hash.", __LINE__,
5498  {
5499  "ripple_path_find",
5500  R"({"json_argument":true})",
5501  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
5502  },
5504  R"({
5505  "method" : "ripple_path_find",
5506  "params" : [
5507  {
5508  "api_version" : %MAX_API_VER%,
5509  "json_argument" : true,
5510  "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
5511  }
5512  ]
5513  })"
5514 },
5515 
5516 {
5517  "ripple_path_find: too few arguments.", __LINE__,
5518  {
5519  "ripple_path_find",
5520  },
5522  R"({
5523  "method" : "ripple_path_find",
5524  "params" : [
5525  {
5526  "error" : "badSyntax",
5527  "error_code" : 1,
5528  "error_message" : "Syntax error."
5529  }
5530  ]
5531  })"
5532 },
5533 {
5534  "ripple_path_find: too many arguments.", __LINE__,
5535  {
5536  "ripple_path_find",
5537  R"({"json_argument":true})",
5538  "current",
5539  "extra"
5540  },
5542  R"({
5543  "method" : "ripple_path_find",
5544  "params" : [
5545  {
5546  "error" : "badSyntax",
5547  "error_code" : 1,
5548  "error_message" : "Syntax error."
5549  }
5550  ]
5551  })"
5552 },
5553 {
5554  "ripple_path_find: invalid json (note extra comma).", __LINE__,
5555  {
5556  "ripple_path_find",
5557  R"({"json_argument":true,})",
5558  },
5560  R"({
5561  "method" : "ripple_path_find",
5562  "params" : [
5563  {
5564  "error" : "invalidParams",
5565  "error_code" : 31,
5566  "error_message" : "Invalid parameters."
5567  }
5568  ]
5569  })"
5570 },
5571 {
5572  "ripple_path_find: ledger index too small.", __LINE__,
5573  {
5574  "ripple_path_find",
5575  R"({"json_argument":true})",
5576  "-1"
5577  },
5579  R"({
5580  "method" : "ripple_path_find",
5581  "params" : [
5582  {
5583  "api_version" : %MAX_API_VER%,
5584  "json_argument" : true,
5585  "ledger_index" : 0
5586  }
5587  ]
5588  })"
5589 },
5590 {
5591  "ripple_path_find: ledger index too big.", __LINE__,
5592  {
5593  "ripple_path_find",
5594  R"({"json_argument":true})",
5595  "4294967296"
5596  },
5598  R"({
5599  "method" : "ripple_path_find",
5600  "params" : [
5601  {
5602  "api_version" : %MAX_API_VER%,
5603  "json_argument" : true,
5604  "ledger_index" : 0
5605  }
5606  ]
5607  })"
5608 },
5609 {
5610  "ripple_path_find: invalid text ledger index.", __LINE__,
5611  {
5612  "ripple_path_find",
5613  R"({"json_argument":true})",
5614  "cur"
5615  },
5617  R"({
5618  "method" : "ripple_path_find",
5619  "params" : [
5620  {
5621  "api_version" : %MAX_API_VER%,
5622  "json_argument" : true,
5623  "ledger_index" : 0
5624  }
5625  ]
5626  })"
5627 },
5628 
5629 // sign ------------------------------------------------------------------------
5630 {
5631  "sign: minimal.", __LINE__,
5632  {
5633  "sign",
5634  "my_secret",
5635  R"({"json_argument":true})",
5636  },
5638  R"({
5639  "method" : "sign",
5640  "params" : [
5641  {
5642  "api_version" : %MAX_API_VER%,
5643  "secret" : "my_secret",
5644  "tx_json" : {
5645  "json_argument" : true
5646  }
5647  }
5648  ]
5649  })"
5650 },
5651 {
5652  "sign: offline.", __LINE__,
5653  {
5654  "sign",
5655  "my_secret",
5656  R"({"json_argument":true})",
5657  "offline"
5658  },
5660  R"({
5661  "method" : "sign",
5662  "params" : [
5663  {
5664  "api_version" : %MAX_API_VER%,
5665  "offline" : true,
5666  "secret" : "my_secret",
5667  "tx_json" : {
5668  "json_argument" : true
5669  }
5670  }
5671  ]
5672  })"
5673 },
5674 {
5675  "sign: too few arguments.", __LINE__,
5676  {
5677  "sign",
5678  "contents_of_blob"
5679  },
5681  R"({
5682  "method" : "sign",
5683  "params" : [
5684  {
5685  "error" : "badSyntax",
5686  "error_code" : 1,
5687  "error_message" : "Syntax error."
5688  }
5689  ]
5690  })"
5691 },
5692 {
5693  "sign: too many arguments.", __LINE__,
5694  {
5695  "sign",
5696  "my_secret",
5697  R"({"json_argument":true})",
5698  "offline",
5699  "extra"
5700  },
5702  R"({
5703  "method" : "sign",
5704  "params" : [
5705  {
5706  "error" : "badSyntax",
5707  "error_code" : 1,
5708  "error_message" : "Syntax error."
5709  }
5710  ]
5711  })"
5712 },
5713 {
5714  "sign: invalid JSON (note extra comma).", __LINE__,
5715  {
5716  "sign",
5717  "my_secret",
5718  R"({"json_argument":true,})",
5719  },
5721  R"({
5722  "method" : "sign",
5723  "params" : [
5724  {
5725  "error" : "invalidParams",
5726  "error_code" : 31,
5727  "error_message" : "Invalid parameters."
5728  }
5729  ]
5730  })"
5731 },
5732 {
5733  "sign: invalid final argument.", __LINE__,
5734  {
5735  "sign",
5736  "my_secret",
5737  R"({"json_argument":true})",
5738  "offlin"
5739  },
5741  R"({
5742  "method" : "sign",
5743  "params" : [
5744  {
5745  "error" : "invalidParams",
5746  "error_code" : 31,
5747  "error_message" : "Invalid parameters."
5748  }
5749  ]
5750  })"
5751 },
5752 
5753 // sign_for --------------------------------------------------------------------
5754 {
5755  "sign_for: minimal.", __LINE__,
5756  {
5757  "sign_for",
5758  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5759  "my_secret",
5760  R"({"json_argument":true})",
5761  },
5763  R"({
5764  "method" : "sign_for",
5765  "params" : [
5766  {
5767  "api_version" : %MAX_API_VER%,
5768  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5769  "secret" : "my_secret",
5770  "tx_json" : {
5771  "json_argument" : true
5772  }
5773  }
5774  ]
5775  })"
5776 },
5777 {
5778  "sign_for: offline.", __LINE__,
5779  {
5780  "sign_for",
5781  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5782  "my_secret",
5783  R"({"json_argument":true})",
5784  "offline"
5785  },
5787  R"({
5788  "method" : "sign_for",
5789  "params" : [
5790  {
5791  "api_version" : %MAX_API_VER%,
5792  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5793  "offline" : true,
5794  "secret" : "my_secret",
5795  "tx_json" : {
5796  "json_argument" : true
5797  }
5798  }
5799  ]
5800  })"
5801 },
5802 {
5803  "sign_for: too few arguments.", __LINE__,
5804  {
5805  "sign_for",
5806  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5807  "my_secret",
5808  },
5810  R"({
5811  "method" : "sign_for",
5812  "params" : [
5813  {
5814  "error" : "badSyntax",
5815  "error_code" : 1,
5816  "error_message" : "Syntax error."
5817  }
5818  ]
5819  })"
5820 },
5821 {
5822  "sign_for: too many arguments.", __LINE__,
5823  {
5824  "sign_for",
5825  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5826  "my_secret",
5827  R"({"json_argument":true})",
5828  "offline",
5829  "extra"
5830  },
5832  R"({
5833  "method" : "sign_for",
5834  "params" : [
5835  {
5836  "error" : "badSyntax",
5837  "error_code" : 1,
5838  "error_message" : "Syntax error."
5839  }
5840  ]
5841  })"
5842 },
5843 {
5844  "sign_for: invalid json (note extra comma).", __LINE__,
5845  {
5846  "sign_for",
5847  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5848  "my_secret",
5849  R"({"json_argument":true,})",
5850  },
5852  R"({
5853  "method" : "sign_for",
5854  "params" : [
5855  {
5856  "error" : "invalidParams",
5857  "error_code" : 31,
5858  "error_message" : "Invalid parameters."
5859  }
5860  ]
5861  })"
5862 },
5863 {
5864  "sign_for: invalid final argument.", __LINE__,
5865  {
5866  "sign_for",
5867  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
5868  "my_secret",
5869  R"({"json_argument":true})",
5870  "ofline"
5871  },
5873  R"({
5874  "method" : "sign_for",
5875  "params" : [
5876  {
5877  "error" : "invalidParams",
5878  "error_code" : 31,
5879  "error_message" : "Invalid parameters."
5880  }
5881  ]
5882  })"
5883 },
5884 
5885 // submit ----------------------------------------------------------------------
5886 {
5887  "submit: blob.", __LINE__,
5888  {
5889  "submit",
5890  "the blob is unvalidated and may be any length..."
5891  },
5893  R"({
5894  "method" : "submit",
5895  "params" : [
5896  {
5897  "api_version" : %MAX_API_VER%,
5898  "tx_blob" : "the blob is unvalidated and may be any length..."
5899  }
5900  ]
5901  })"
5902 },
5903 {
5904  "submit: json.", __LINE__,
5905  {
5906  "submit",
5907  "my_secret",
5908  R"({"json_argument":true})",
5909  },
5911  R"({
5912  "method" : "submit",
5913  "params" : [
5914  {
5915  "api_version" : %MAX_API_VER%,
5916  "secret" : "my_secret",
5917  "tx_json" : {
5918  "json_argument" : true
5919  }
5920  }
5921  ]
5922  })"
5923 },
5924 {
5925  "submit: too few arguments.", __LINE__,
5926  {
5927  "submit",
5928  },
5930  R"({
5931  "method" : "submit",
5932  "params" : [
5933  {
5934  "error" : "badSyntax",
5935  "error_code" : 1,
5936  "error_message" : "Syntax error."
5937  }
5938  ]
5939  })"
5940 },
5941 {
5942  // Note: I believe this _ought_ to be detected as too many arguments.
5943  "submit: four arguments.", __LINE__,
5944  {
5945  "submit",
5946  "my_secret",
5947  R"({"json_argument":true})",
5948  "offline"
5949  },
5951  R"({
5952  "method" : "submit",
5953  "params" : [
5954  {
5955  "api_version" : %MAX_API_VER%,
5956  "offline" : true,
5957  "secret" : "my_secret",
5958  "tx_json" : {
5959  "json_argument" : true
5960  }
5961  }
5962  ]
5963  })"
5964 },
5965 {
5966  "submit: too many arguments.", __LINE__,
5967  {
5968  "submit",
5969  "my_secret",
5970  R"({"json_argument":true})",
5971  "offline",
5972  "extra"
5973  },
5975  R"({
5976  "method" : "submit",
5977  "params" : [
5978  {
5979  "error" : "badSyntax",
5980  "error_code" : 1,
5981  "error_message" : "Syntax error."
5982  }
5983  ]
5984  })"
5985 },
5986 {
5987  "submit: invalid json (note extra comma).", __LINE__,
5988  {
5989  "submit",
5990  "my_secret",
5991  R"({"json_argument":true,})",
5992  },
5994  R"({
5995  "method" : "submit",
5996  "params" : [
5997  {
5998  "error" : "invalidParams",
5999  "error_code" : 31,
6000  "error_message" : "Invalid parameters."
6001  }
6002  ]
6003  })"
6004 },
6005 {
6006  "submit: last argument not \"offline\".", __LINE__,
6007  {
6008  "submit",
6009  "my_secret",
6010  R"({"json_argument":true})",
6011  "offlne"
6012  },
6014  R"({
6015  "method" : "submit",
6016  "params" : [
6017  {
6018  "error" : "invalidParams",
6019  "error_code" : 31,
6020  "error_message" : "Invalid parameters."
6021  }
6022  ]
6023  })"
6024 },
6025 
6026 // submit_multisigned ----------------------------------------------------------
6027 {
6028  "submit_multisigned: json.", __LINE__,
6029  {
6030  "submit_multisigned",
6031  R"({"json_argument":true})",
6032  },
6034  R"({
6035  "method" : "submit_multisigned",
6036  "params" : [
6037  {
6038  "api_version" : %MAX_API_VER%,
6039  "tx_json" : {
6040  "json_argument" : true
6041  }
6042  }
6043  ]
6044  })"
6045 },
6046 {
6047  "submit_multisigned: too few arguments.", __LINE__,
6048  {
6049  "submit_multisigned",
6050  },
6052  R"({
6053  "method" : "submit_multisigned",
6054  "params" : [
6055  {
6056  "error" : "badSyntax",
6057  "error_code" : 1,
6058  "error_message" : "Syntax error."
6059  }
6060  ]
6061  })"
6062 },
6063 {
6064  "submit_multisigned: too many arguments.", __LINE__,
6065  {
6066  "submit_multisigned",
6067  R"({"json_argument":true})",
6068  "extra"
6069  },
6071  R"({
6072  "method" : "submit_multisigned",
6073  "params" : [
6074  {
6075  "error" : "badSyntax",
6076  "error_code" : 1,
6077  "error_message" : "Syntax error."
6078  }
6079  ]
6080  })"
6081 },
6082 {
6083  "submit_multisigned: invalid json (note extra comma).", __LINE__,
6084  {
6085  "submit_multisigned",
6086  R"({"json_argument":true,})",
6087  },
6089  R"({
6090  "method" : "submit_multisigned",
6091  "params" : [
6092  {
6093  "error" : "invalidParams",
6094  "error_code" : 31,
6095  "error_message" : "Invalid parameters."
6096  }
6097  }
6098  ]
6099  })"
6100 },
6101 
6102 // server_info -----------------------------------------------------------------
6103 {
6104  "server_info: minimal.", __LINE__,
6105  {
6106  "server_info",
6107  },
6109  R"({
6110  "method" : "server_info",
6111  "params" : [
6112  {
6113  "api_version" : %MAX_API_VER%,
6114  }
6115  ]
6116  })"
6117 },
6118 {
6119  "server_info: counters.", __LINE__,
6120  {
6121  "server_info",
6122  "counters"
6123  },
6125  R"({
6126  "method" : "server_info",
6127  "params" : [
6128  {
6129  "api_version" : %MAX_API_VER%,
6130  "counters" : true
6131  }
6132  ]
6133  })"
6134 },
6135 {
6136  "server_info: too many arguments.", __LINE__,
6137  {
6138  "server_info",
6139  "counters",
6140  "extra"
6141  },
6143  R"({
6144  "method" : "server_info",
6145  "params" : [
6146  {
6147  "error" : "badSyntax",
6148  "error_code" : 1,
6149  "error_message" : "Syntax error."
6150  }
6151  ]
6152  })"
6153 },
6154 {
6155  "server_info: non-counters argument.", __LINE__,
6156  {
6157  "server_info",
6158  "counter"
6159  },
6161  R"({
6162  "method" : "server_info",
6163  "params" : [
6164  {
6165  "api_version" : %MAX_API_VER%,
6166  }
6167  ]
6168  })"
6169 },
6170 
6171 // server_state ----------------------------------------------------------------
6172 {
6173  "server_state: minimal.", __LINE__,
6174  {
6175  "server_state",
6176  },
6178  R"({
6179  "method" : "server_state",
6180  "params" : [
6181  {
6182  "api_version" : %MAX_API_VER%,
6183  }
6184  ]
6185  })"
6186 },
6187 {
6188  "server_state: counters.", __LINE__,
6189  {
6190  "server_state",
6191  "counters"
6192  },
6194  R"({
6195  "method" : "server_state",
6196  "params" : [
6197  {
6198  "api_version" : %MAX_API_VER%,
6199  "counters" : true
6200  }
6201  ]
6202  })"
6203 },
6204 {
6205  "server_state: too many arguments.", __LINE__,
6206  {
6207  "server_state",
6208  "counters",
6209  "extra"
6210  },
6212  R"({
6213  "method" : "server_state",
6214  "params" : [
6215  {
6216  "error" : "badSyntax",
6217  "error_code" : 1,
6218  "error_message" : "Syntax error."
6219  }
6220  ]
6221  })"
6222 },
6223 {
6224  "server_state: non-counters argument.", __LINE__,
6225  {
6226  "server_state",
6227  "counter"
6228  },
6230  R"({
6231  "method" : "server_state",
6232  "params" : [
6233  {
6234  "api_version" : %MAX_API_VER%,
6235  }
6236  ]
6237  })"
6238 },
6239 
6240 // stop ------------------------------------------------------------------------
6241 {
6242  "stop: minimal.", __LINE__,
6243  {
6244  "stop",
6245  },
6247  R"({
6248  "method" : "stop",
6249  "params" : [
6250  {
6251  "api_version" : %MAX_API_VER%,
6252  }
6253  ]
6254  })"
6255 },
6256 {
6257  "stop: too many arguments.", __LINE__,
6258  {
6259  "stop",
6260  "extra"
6261  },
6263  R"({
6264  "method" : "stop",
6265  "params" : [
6266  {
6267  "error" : "badSyntax",
6268  "error_code" : 1,
6269  "error_message" : "Syntax error."
6270  }
6271  ]
6272  })"
6273 },
6274 
6275 // transaction_entry -----------------------------------------------------------
6276 {
6277  "transaction_entry: ledger index.", __LINE__,
6278  {
6279  "transaction_entry",
6280  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6281  "4294967295"
6282  },
6284  R"({
6285  "method" : "transaction_entry",
6286  "params" : [
6287  {
6288  "api_version" : %MAX_API_VER%,
6289  "ledger_index" : 4294967295,
6290  "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
6291  }
6292  ]
6293  })"
6294 },
6295 {
6296  "transaction_entry: text ledger index.", __LINE__,
6297  {
6298  "transaction_entry",
6299  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6300  "current"
6301  },
6303  R"({
6304  "method" : "transaction_entry",
6305  "params" : [
6306  {
6307  "api_version" : %MAX_API_VER%,
6308  "ledger_index" : "current",
6309  "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
6310  }
6311  ]
6312  })"
6313 },
6314 {
6315  "transaction_entry: ledger hash.", __LINE__,
6316  {
6317  "transaction_entry",
6318  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6319  "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210"
6320  },
6322  R"({
6323  "method" : "transaction_entry",
6324  "params" : [
6325  {
6326  "api_version" : %MAX_API_VER%,
6327  "ledger_hash" : "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210",
6328  "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"
6329  }
6330  ]
6331  })"
6332 },
6333 {
6334  "transaction_entry: too few arguments.", __LINE__,
6335  {
6336  "transaction_entry",
6337  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6338  },
6340  R"({
6341  "method" : "transaction_entry",
6342  "params" : [
6343  {
6344  "error" : "badSyntax",
6345  "error_code" : 1,
6346  "error_message" : "Syntax error."
6347  }
6348  ]
6349  })"
6350 },
6351 {
6352  "transaction_entry: too many arguments.", __LINE__,
6353  {
6354  "transaction_entry",
6355  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6356  "validated",
6357  "extra"
6358  },
6360  R"({
6361  "method" : "transaction_entry",
6362  "params" : [
6363  {
6364  "error" : "badSyntax",
6365  "error_code" : 1,
6366  "error_message" : "Syntax error."
6367  }
6368  ]
6369  })"
6370 },
6371 {
6372  "transaction_entry: short tx_hash.", __LINE__,
6373  {
6374  "transaction_entry",
6375  "123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6376  "validated",
6377  },
6379  R"({
6380  "method" : "transaction_entry",
6381  "params" : [
6382  {
6383  "error" : "invalidParams",
6384  "error_code" : 31,
6385  "error_message" : "Invalid parameters."
6386  }
6387  ]
6388  })"
6389 },
6390 {
6391  "transaction_entry: long tx_hash.", __LINE__,
6392  {
6393  "transaction_entry",
6394  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUVW",
6395  "validated",
6396  },
6398  R"({
6399  "method" : "transaction_entry",
6400  "params" : [
6401  {
6402  "error" : "invalidParams",
6403  "error_code" : 31,
6404  "error_message" : "Invalid parameters."
6405  }
6406  ]
6407  })"
6408 },
6409 {
6410  "transaction_entry: small ledger index.", __LINE__,
6411  {
6412  "transaction_entry",
6413  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6414  "0",
6415  },
6417  R"({
6418  "method" : "transaction_entry",
6419  "params" : [
6420  {
6421  "error" : "invalidParams",
6422  "error_code" : 31,
6423  "error_message" : "Invalid parameters."
6424  }
6425  ]
6426  })"
6427 },
6428 {
6429  "transaction_entry: large ledger index.", __LINE__,
6430  {
6431  "transaction_entry",
6432  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6433  "4294967296",
6434  },
6436  R"({
6437  "method" : "transaction_entry",
6438  "params" : [
6439  {
6440  "error" : "invalidParams",
6441  "error_code" : 31,
6442  "error_message" : "Invalid parameters."
6443  }
6444  ]
6445  })"
6446 },
6447 {
6448  "transaction_entry: short ledger hash.", __LINE__,
6449  {
6450  "transaction_entry",
6451  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6452  "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA987654321",
6453  },
6455  R"({
6456  "method" : "transaction_entry",
6457  "params" : [
6458  {
6459  "error" : "invalidParams",
6460  "error_code" : 31,
6461  "error_message" : "Invalid parameters."
6462  }
6463  ]
6464  })"
6465 },
6466 {
6467  "transaction_entry: long ledger hash.", __LINE__,
6468  {
6469  "transaction_entry",
6470  "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV",
6471  "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210Z",
6472  },
6474  R"({
6475  "method" : "transaction_entry",
6476  "params" : [
6477  {
6478  "error" : "invalidParams",
6479  "error_code" : 31,
6480  "error_message" : "Invalid parameters."
6481  }
6482  ]
6483  })"
6484 },
6485 
6486 // tx --------------------------------------------------------------------------
6487 {
6488  "tx: minimal.", __LINE__,
6489  {
6490  "tx",
6491  "transaction_hash_is_not_validated"
6492  },
6494  R"({
6495  "method" : "tx",
6496  "params" : [
6497  {
6498  "api_version" : %MAX_API_VER%,
6499  "transaction" : "transaction_hash_is_not_validated"
6500  }
6501  ]
6502  })"
6503 },
6504 {
6505  "tx: binary.", __LINE__,
6506  {
6507  "tx",
6508  "transaction_hash_is_not_validated",
6509  "binary"
6510  },
6512  R"({
6513  "method" : "tx",
6514  "params" : [
6515  {
6516  "api_version" : %MAX_API_VER%,
6517  "binary" : true,
6518  "transaction" : "transaction_hash_is_not_validated"
6519  }
6520  ]
6521  })"
6522 },
6523 {
6524  "tx: too few arguments.", __LINE__,
6525  {
6526  "tx",
6527  },
6529  R"({
6530  "method" : "tx",
6531  "params" : [
6532  {
6533  "error" : "badSyntax",
6534  "error_code" : 1,
6535  "error_message" : "Syntax error."
6536  }
6537  ]
6538  })"
6539 },
6540 {
6541  "tx: too many arguments.", __LINE__,
6542  {
6543  "tx",
6544  "transaction_hash_is_not_validated",
6545  "binary",
6546  "1",
6547  "2",
6548  "extra"
6549  },
6551  R"({
6552  "method" : "tx",
6553  "params" : [
6554  {
6555  "error" : "badSyntax",
6556  "error_code" : 1,
6557  "error_message" : "Syntax error."
6558  }
6559  ]
6560  })"
6561 },
6562 {
6563  "tx: invalid final argument is apparently ignored.", __LINE__,
6564  {
6565  "tx",
6566  "transaction_hash_is_not_validated",
6567  "bin"
6568  },
6570  R"({
6571  "method" : "tx",
6572  "params" : [
6573  {
6574  "api_version" : %MAX_API_VER%,
6575  "transaction" : "transaction_hash_is_not_validated"
6576  }
6577  ]
6578  })"
6579 },
6580 
6581 // tx_account ------------------------------------------------------------------
6582 {
6583  "tx_account: minimal.", __LINE__,
6584  {
6585  "tx_account",
6586  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"
6587  },
6589  R"({
6590  "method" : "tx_account",
6591  "params" : [
6592  {
6593  "api_version" : %MAX_API_VER%,
6594  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6595  }
6596  ]
6597  })"
6598 },
6599 {
6600  "tx_account: ledger_index .", __LINE__,
6601  {
6602  "tx_account",
6603  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6604  "4294967295"
6605  },
6607  R"({
6608  "method" : "tx_account",
6609  "params" : [
6610  {
6611  "api_version" : %MAX_API_VER%,
6612  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6613  "ledger_index" : 4294967295
6614  }
6615  ]
6616  })"
6617 },
6618 {
6619  "tx_account: ledger_index plus trailing params.", __LINE__,
6620  {
6621  "tx_account",
6622  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6623  "707",
6624  "forward",
6625  "binary",
6626  "count"
6627  },
6629  R"({
6630  "method" : "tx_account",
6631  "params" : [
6632  {
6633  "api_version" : %MAX_API_VER%,
6634  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6635  "binary" : true,
6636  "count" : true,
6637  "forward" : true,
6638  "ledger_index" : 707
6639  }
6640  ]
6641  })"
6642 },
6643 {
6644  "tx_account: ledger_index_min and _max.", __LINE__,
6645  {
6646  "tx_account",
6647  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6648  "2147483647",
6649  "2147483647"
6650  },
6652  R"({
6653  "method" : "tx_account",
6654  "params" : [
6655  {
6656  "api_version" : %MAX_API_VER%,
6657  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6658  "ledger_index_max" : 2147483647,
6659  "ledger_index_min" : 2147483647
6660  }
6661  ]
6662  })"
6663 },
6664 {
6665  "tx_account: ledger_index_min and _max plus trailing params.", __LINE__,
6666  {
6667  "tx_account",
6668  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6669  "33333",
6670  "2147483647",
6671  "binary",
6672  "count",
6673  "forward"
6674  },
6676  R"({
6677  "method" : "tx_account",
6678  "params" : [
6679  {
6680  "api_version" : %MAX_API_VER%,
6681  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6682  "binary" : true,
6683  "count" : true,
6684  "forward" : true,
6685  "ledger_index_max" : 2147483647,
6686  "ledger_index_min" : 33333
6687  }
6688  ]
6689  })"
6690 },
6691 {
6692  "tx_account: ledger_index_min and _max plus limit.", __LINE__,
6693  {
6694  "tx_account",
6695  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6696  "-1",
6697  "2147483647",
6698  "2147483647"
6699  },
6701  R"({
6702  "method" : "tx_account",
6703  "params" : [
6704  {
6705  "api_version" : %MAX_API_VER%,
6706  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6707  "ledger_index_max" : 2147483647,
6708  "ledger_index_min" : -1,
6709  "limit" : 2147483647
6710  }
6711  ]
6712  })"
6713 },
6714 {
6715  "tx_account: ledger_index_min and _max, limit, trailing args.", __LINE__,
6716  {
6717  "tx_account",
6718  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6719  "1",
6720  "1",
6721  "-1",
6722  "count",
6723  "forward",
6724  "binary"
6725  },
6727  R"({
6728  "method" : "tx_account",
6729  "params" : [
6730  {
6731  "api_version" : %MAX_API_VER%,
6732  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6733  "binary" : true,
6734  "count" : true,
6735  "forward" : true,
6736  "ledger_index_max" : 1,
6737  "ledger_index_min" : 1,
6738  "limit" : -1
6739  }
6740  ]
6741  })"
6742 },
6743 {
6744  "tx_account: too few arguments.", __LINE__,
6745  {
6746  "tx_account",
6747  },
6749  R"({
6750  "method" : "tx_account",
6751  "params" : [
6752  {
6753  "error" : "badSyntax",
6754  "error_code" : 1,
6755  "error_message" : "Syntax error."
6756  }
6757  ]
6758  })"
6759 },
6760 {
6761  "tx_account: too many arguments.", __LINE__,
6762  {
6763  "tx_account",
6764  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6765  "589",
6766  "590",
6767  "67",
6768  "extra",
6769  "descending",
6770  "count",
6771  "binary"
6772  },
6774  R"({
6775  "method" : "tx_account",
6776  "params" : [
6777  {
6778  "error" : "badSyntax",
6779  "error_code" : 1,
6780  "error_message" : "Syntax error."
6781  }
6782  ]
6783  })"
6784 },
6785 {
6786  "tx_account: invalid accountID.", __LINE__,
6787  {
6788  "tx_account",
6789  "rHb9CJAWyB4rj9!VRWn96DkukG4bwdtyTh"
6790  },
6792  R"({
6793  "method" : "tx_account",
6794  "params" : [
6795  {
6796  "error" : "actMalformed",
6797  "error_code" : 35,
6798  "error_message" : "Account malformed."
6799  }
6800  ]
6801  })",
6802 },
6803 {
6804  // Note: not currently detected as bad input.
6805  "tx_account: invalid ledger.", __LINE__,
6806  {
6807  "tx_account",
6808  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6809  "-478.7"
6810  },
6812  R"({
6813  "method" : "tx_account",
6814  "params" : [
6815  {
6816  "api_version" : %MAX_API_VER%,
6817  "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6818  "ledger_index" : 0
6819  }
6820  ]
6821  })",
6822 },
6823 {
6824  "tx_account: max less than min.", __LINE__,
6825  {
6826  "tx_account",
6827  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6828  "580",
6829  "579"
6830  },
6832  R"({
6833  "method" : "tx_account",
6834  "params" : [
6835  {
6836  "error" : "lgrIdxsInvalid",
6837  "error_code" : 55,
6838  "error_message" : "Ledger indexes invalid."
6839  }
6840  ]
6841  })",
6842 },
6843 {
6844  // Note: this really shouldn't throw, but does at the moment.
6845  "tx_account: min large but still valid.", __LINE__,
6846  {
6847  "tx_account",
6848  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6849  "2147483648",
6850  "2147483648"
6851  },
6853  R"()",
6854 },
6855 {
6856  // Note: this really shouldn't throw, but does at the moment.
6857  "tx_account: max large but still valid.", __LINE__,
6858  {
6859  "tx_account",
6860  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6861  "2147483647",
6862  "2147483648"
6863  },
6865  R"()",
6866 },
6867 {
6868  // Note: this really shouldn't throw, but does at the moment.
6869  "tx_account: large limit.", __LINE__,
6870  {
6871  "tx_account",
6872  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6873  "-1",
6874  "-1",
6875  "2147483648"
6876  },
6878  R"()",
6879 },
6880 {
6881  // Note: this really shouldn't throw, but does at the moment.
6882  "tx_account: non-integer min.", __LINE__,
6883  {
6884  "tx_account",
6885  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6886  "Binary",
6887  "-1"
6888  },
6890  R"()",
6891 },
6892 {
6893  // Note: this really shouldn't throw, but does at the moment.
6894  "tx_account: non-integer max.", __LINE__,
6895  {
6896  "tx_account",
6897  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6898  "-1",
6899  "counts"
6900  },
6902  R"()",
6903 },
6904 {
6905  // Note: this really shouldn't throw, but does at the moment.
6906  "tx_account: non-integer limit.", __LINE__,
6907  {
6908  "tx_account",
6909  "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
6910  "-1",
6911  "-1",
6912  "decending"
6913  },
6915  R"()",
6916 },
6917 
6918 // tx_history ------------------------------------------------------------------
6919 {
6920  "tx_history: minimal.", __LINE__,
6921  {
6922  "tx_history",
6923  "0"
6924  },
6926  R"({
6927  "method" : "tx_history",
6928  "params" : [
6929  {
6930  "api_version" : %MAX_API_VER%,
6931  "start" : 0
6932  }
6933  ]
6934  })"
6935 },
6936 {
6937  "tx_history: too few arguments.", __LINE__,
6938  {
6939  "tx_history",
6940  },
6942  R"({
6943  "method" : "tx_history",
6944  "params" : [
6945  {
6946  "error" : "badSyntax",
6947  "error_code" : 1,
6948  "error_message" : "Syntax error."
6949  }
6950  ]
6951  })"
6952 },
6953 {
6954  "tx_history: too many arguments.", __LINE__,
6955  {
6956  "tx_history",
6957  "0",
6958  "1"
6959  },
6961  R"({
6962  "method" : "tx_history",
6963  "params" : [
6964  {
6965  "error" : "badSyntax",
6966  "error_code" : 1,
6967  "error_message" : "Syntax error."
6968  }
6969  ]
6970  })"
6971 },
6972 {
6973  // Note: this really shouldn't throw, but does at the moment.
6974  "tx_history: start too small.", __LINE__,
6975  {
6976  "tx_history",
6977  "-1"
6978  },
6980  R"()",
6981 },
6982 {
6983  // Note: this really shouldn't throw, but does at the moment.
6984  "tx_history: start too big.", __LINE__,
6985  {
6986  "tx_history",
6987  "4294967296"
6988  },
6990  R"()",
6991 },
6992 {
6993  // Note: this really shouldn't throw, but does at the moment.
6994  "tx_history: start not integer.", __LINE__,
6995  {
6996  "tx_history",
6997  "beginning"
6998  },
7000  R"()",
7001 },
7002 
7003 // unl_list --------------------------------------------------------------------
7004 {
7005  "unl_list: minimal.", __LINE__,
7006  {
7007  "unl_list",
7008  },
7010  R"({
7011  "method" : "unl_list",
7012  "params" : [
7013  {
7014  "api_version" : %MAX_API_VER%,
7015  }
7016  ]
7017  })"
7018 },
7019 {
7020  "unl_list: too many arguments.", __LINE__,
7021  {
7022  "unl_list",
7023  "extra"
7024  },
7026  R"({
7027  "method" : "unl_list",
7028  "params" : [
7029  {
7030  "error" : "badSyntax",
7031  "error_code" : 1,
7032  "error_message" : "Syntax error."
7033  }
7034  ]
7035  })"
7036 },
7037 
7038 // validation_create -----------------------------------------------------------
7039 {
7040  "validation_create: minimal.", __LINE__,
7041  {
7042  "validation_create",
7043  },
7045  R"({
7046  "method" : "validation_create",
7047  "params" : [
7048  {
7049  "api_version" : %MAX_API_VER%,
7050  }
7051  ]
7052  })"
7053 },
7054 {
7055  "validation_create: with secret.", __LINE__,
7056  {
7057  "validation_create",
7058  "the form of the secret is not validated"
7059  },
7061  R"({
7062  "method" : "validation_create",
7063  "params" : [
7064  {
7065  "api_version" : %MAX_API_VER%,
7066  "secret" : "the form of the secret is not validated"
7067  }
7068  ]
7069  })"
7070 },
7071 {
7072  "validation_create: too many arguments.", __LINE__,
7073  {
7074  "validation_create",
7075  "the form of the secret is not validated",
7076  "extra"
7077  },
7079  R"({
7080  "method" : "validation_create",
7081  "params" : [
7082  {
7083  "error" : "badSyntax",
7084  "error_code" : 1,
7085  "error_message" : "Syntax error."
7086  }
7087  ]
7088  })"
7089 },
7090 
7091 // version ---------------------------------------------------------------------
7092 {
7093  "version: minimal.", __LINE__,
7094  {
7095  "version",
7096  },
7098  R"({
7099  "method" : "version",
7100  "params" : [
7101  {
7102  "api_version" : %MAX_API_VER%,
7103  }
7104  ]
7105  })"
7106 },
7107 {
7108  "version: too many arguments.", __LINE__,
7109  {
7110  "version",
7111  "extra"
7112  },
7114  R"({
7115  "method" : "version",
7116  "params" : [
7117  {
7118  "error" : "badSyntax",
7119  "error_code" : 1,
7120  "error_message" : "Syntax error."
7121  }
7122  ]
7123  })"
7124 },
7125 
7126 // wallet_propose --------------------------------------------------------------
7127 {
7128  "wallet_propose: minimal.", __LINE__,
7129  {
7130  "wallet_propose",
7131  },
7133  R"({
7134  "method" : "wallet_propose",
7135  "params" : [
7136  {
7137  "api_version" : %MAX_API_VER%,
7138  }
7139  ]
7140  })"
7141 },
7142 {
7143  "wallet_propose: with passphrase.", __LINE__,
7144  {
7145  "wallet_propose",
7146  "the form of the passphrase is not validated"
7147  },
7149  R"({
7150  "method" : "wallet_propose",
7151  "params" : [
7152  {
7153  "api_version" : %MAX_API_VER%,
7154  "passphrase" : "the form of the passphrase is not validated"
7155  }
7156  ]
7157  })"
7158 },
7159 {
7160  "wallet_propose: too many arguments.", __LINE__,
7161  {
7162  "wallet_propose",
7163  "the form of the passphrase is not validated",
7164  "extra"
7165  },
7167  R"({
7168  "method" : "wallet_propose",
7169  "params" : [
7170  {
7171  "error" : "badSyntax",
7172  "error_code" : 1,
7173  "error_message" : "Syntax error."
7174  }
7175  ]
7176  })"
7177 },
7178 
7179 // internal --------------------------------------------------------------------
7180 {
7181  "internal: minimal.", __LINE__,
7182  {
7183  "internal",
7184  "command_name"
7185  },
7187  R"({
7188  "method" : "internal",
7189  "params" : [
7190  {
7191  "api_version" : %MAX_API_VER%,
7192  "internal_command" : "command_name",
7193  "params" : []
7194  }
7195  ]
7196  })"
7197 },
7198 {
7199  "internal: with parameters.", __LINE__,
7200  {
7201  "internal",
7202  "command_name",
7203  "string_arg",
7204  "1",
7205  "-1",
7206  "4294967296",
7207  "3.14159"
7208  },
7210  R"({
7211  "method" : "internal",
7212  "params" : [
7213  {
7214  "api_version" : %MAX_API_VER%,
7215  "internal_command" : "command_name",
7216  "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ]
7217  }
7218  ]
7219  })"
7220 },
7221 {
7222  "internal: too few arguments.", __LINE__,
7223  {
7224  "internal",
7225  },
7227  R"({
7228  "method" : "internal",
7229  "params" : [
7230  {
7231  "error" : "badSyntax",
7232  "error_code" : 1,
7233  "error_message" : "Syntax error."
7234  }
7235  ]
7236  })"
7237 },
7238 
7239 // path_find -------------------------------------------------------------------
7240 {
7241  "path_find: minimal.", __LINE__,
7242  {
7243  "path_find",
7244  },
7246  R"({
7247  "method" : "path_find",
7248  "params" : [
7249  {
7250  "error" : "noEvents",
7251  "error_code" : 7,
7252  "error_message" : "Current transport does not support events."
7253  }
7254  ]
7255  })"
7256 },
7257 {
7258  "path_find: with arguments.", __LINE__,
7259  {
7260  "path_find",
7261  "string_arg",
7262  "1",
7263  "-1",
7264  "4294967296",
7265  "3.14159"
7266  },
7268  R"({
7269  "method" : "path_find",
7270  "params" : [
7271  {
7272  "error" : "noEvents",
7273  "error_code" : 7,
7274  "error_message" : "Current transport does not support events."
7275  }
7276  ]
7277  })"
7278 },
7279 
7280 // subscribe -------------------------------------------------------------------
7281 {
7282  "subscribe: minimal.", __LINE__,
7283  {
7284  "subscribe",
7285  },
7287  R"({
7288  "method" : "subscribe",
7289  "params" : [
7290  {
7291  "error" : "noEvents",
7292  "error_code" : 7,
7293  "error_message" : "Current transport does not support events."
7294  }
7295  ]
7296  })"
7297 },
7298 {
7299  "subscribe: with arguments.", __LINE__,
7300  {
7301  "subscribe",
7302  "string_arg",
7303  "1",
7304  "-1",
7305  "4294967296",
7306  "3.14159"
7307  },
7309  R"({
7310  "method" : "subscribe",
7311  "params" : [
7312  {
7313  "error" : "noEvents",
7314  "error_code" : 7,
7315  "error_message" : "Current transport does not support events."
7316  }
7317  ]
7318  })"
7319 },
7320 
7321 // unsubscribe -----------------------------------------------------------------
7322 {
7323  "unsubscribe: minimal.", __LINE__,
7324  {
7325  "unsubscribe",
7326  },
7328  R"({
7329  "method" : "unsubscribe",
7330  "params" : [
7331  {
7332  "error" : "noEvents",
7333  "error_code" : 7,
7334  "error_message" : "Current transport does not support events."
7335  }
7336  ]
7337  })"
7338 },
7339 {
7340  "unsubscribe: with arguments.", __LINE__,
7341  {
7342  "unsubscribe",
7343  "string_arg",
7344  "1",
7345  "-1",
7346  "4294967296",
7347  "3.14159"
7348  },
7350  R"({
7351  "method" : "unsubscribe",
7352  "params" : [
7353  {
7354  "error" : "noEvents",
7355  "error_code" : 7,
7356  "error_message" : "Current transport does not support events."
7357  }
7358  ]
7359  })"
7360 },
7361 
7362 // unknown_command -------------------------------------------------------------
7363 {
7364  "unknown_command: minimal.", __LINE__,
7365  {
7366  "unknown_command",
7367  },
7369  R"({
7370  "method" : "unknown_command",
7371  "params" : [
7372  {
7373  "api_version" : %MAX_API_VER%,
7374  }
7375  ]
7376  })"
7377 },
7378 {
7379  "unknown_command: with arguments.", __LINE__,
7380  {
7381  "unknown_command",
7382  "string_arg",
7383  "1",
7384  "-1",
7385  "4294967296",
7386  "3.14159"
7387  },
7389  R"({
7390  "method" : "unknown_command",
7391  "params" : [
7392  {
7393  "api_version" : %MAX_API_VER%,
7394  "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ]
7395  }
7396  ]
7397  })"
7398 },
7399 };
7400 
7401 std::string updateAPIVersionString(const char * const req)
7402 {
7404  static auto place_holder = "%MAX_API_VER%";
7405  std::string jr(req);
7406  boost::replace_all(jr, place_holder, version_str);
7407  return jr;
7408 }
7409 
7410 class RPCCall_test : public beast::unit_test::suite
7411 {
7412 public:
7414  {
7415  testcase << "RPCCall";
7416 
7417  test::jtx::Env env(*this); // Used only for its Journal.
7418 
7419  // For each RPCCall test.
7420  for (RPCCallTestData const& rpcCallTest : rpcCallTestArray)
7421  {
7422  std::vector<std::string> const args {
7423  rpcCallTest.args.begin(), rpcCallTest.args.end()};
7424 
7425  // Note that, over the long term, none of these tests should
7426  // throw. But, for the moment, some of them do. So handle it.
7427  Json::Value got;
7428  try
7429  {
7430  got = cmdLineToJSONRPC (args, env.journal);
7431  }
7432  catch (std::bad_cast const&)
7433  {
7434  if ((rpcCallTest.throwsWhat == RPCCallTestData::bad_cast) &&
7435  (std::strlen (rpcCallTest.exp) == 0))
7436  {
7437  pass();
7438  }
7439  else
7440  {
7441  fail (rpcCallTest.description, __FILE__, rpcCallTest.line);
7442  }
7443  // Try the next test.
7444  continue;
7445  }
7446 
7447  Json::Value exp;
7448  Json::Reader{}.parse (updateAPIVersionString(rpcCallTest.exp), exp);
7449 
7450  // Lambda to remove the "params[0u]:error_code" field if present.
7451  // Error codes are not expected to be stable between releases.
7452  auto rmErrorCode = [] (Json::Value& json)
7453  {
7454  if (json.isMember (jss::params) &&
7455  json[jss::params].isArray() &&
7456  json[jss::params].size() > 0 &&
7457  json[jss::params][0u].isObject())
7458  {
7459  json[jss::params][0u].removeMember (jss::error_code);
7460  }
7461  };
7462  rmErrorCode (got);
7463  rmErrorCode (exp);
7464 
7465  // Pass if we didn't expect a throw and we got what we expected.
7466  if ((rpcCallTest.throwsWhat == RPCCallTestData::no_exception) &&
7467  (got == exp))
7468  {
7469  pass();
7470  }
7471  else
7472  {
7473  fail (rpcCallTest.description, __FILE__, rpcCallTest.line);
7474  }
7475  }
7476  }
7477 
7478  void run() override
7479  {
7480  testRPCCall();
7481  }
7482 };
7483 
7484 BEAST_DEFINE_TESTSUITE(RPCCall,app,ripple);
7485 
7486 } // test
7487 } // ripple
ripple::test::jtx::json
Inject raw JSON.
Definition: jtx_json.h:31
std::strlen
T strlen(T... args)
ripple::test::BEAST_DEFINE_TESTSUITE
BEAST_DEFINE_TESTSUITE(AccountDelete, app, ripple)
ripple::test::RPCCallTestData::no_exception
@ no_exception
Definition: RPCCall_test.cpp:43
std::string
STL class.
vector
ripple::test::RPCCallTestData::args
const std::vector< char const * > args
Definition: RPCCall_test.cpp:38
ripple::test::jtx::Env::journal
const beast::Journal journal
Definition: Env.h:143
Json::Reader
Unserialize a JSON document into a Value.
Definition: json_reader.h:36
std::bad_cast
STL class.
ripple::test::RPCCallTestData::operator=
RPCCallTestData & operator=(RPCCallTestData const &)=delete
ripple::test::RPCCallTestData::RPCCallTestData
RPCCallTestData(char const *description_, int line_, std::initializer_list< char const * > const &args_, Exception throwsWhat_, char const *exp_)
Definition: RPCCall_test.cpp:51
ripple::test::RPCCallTestData::throwsWhat
const Exception throwsWhat
Definition: RPCCall_test.cpp:46
std::to_string
T to_string(T... args)
ripple::RPC::ApiMaximumSupportedVersion
constexpr unsigned int ApiMaximumSupportedVersion
Definition: RPCHelpers.h:202
ripple::test::RPCCallTestData::bad_cast
@ bad_cast
Definition: RPCCall_test.cpp:44
ripple::test::rpcCallTestArray
static const RPCCallTestData rpcCallTestArray[]
Definition: RPCCall_test.cpp:68
ripple::test::RPCCall_test::testRPCCall
void testRPCCall()
Definition: RPCCall_test.cpp:7413
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::RPCCallTestData::Exception
Exception
Definition: RPCCall_test.cpp:41
ripple::test::RPCCallTestData
Definition: RPCCall_test.cpp:33
ripple::cmdLineToJSONRPC
Json::Value cmdLineToJSONRPC(std::vector< std::string > const &args, beast::Journal j)
Given a rippled command line, return the corresponding JSON.
Definition: RPCCall.cpp:1403
ripple::test::RPCCallTestData::exp
char const *const exp
Definition: RPCCall_test.cpp:49
ripple::test::RPCCallTestData::description
char const *const description
Definition: RPCCall_test.cpp:35
std::vector::begin
T begin(T... args)
ripple::test::RPCCallTestData::RPCCallTestData
RPCCallTestData()=delete
Json::Reader::parse
bool parse(std::string const &document, Value &root)
Read a Value from a JSON document.
Definition: json_reader.cpp:76
std::string::end
T end(T... args)
ripple::test::RPCCallTestData::line
const int line
Definition: RPCCall_test.cpp:36
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:117
ripple::test::RPCCall_test::run
void run() override
Definition: RPCCall_test.cpp:7478
Json::Value
Represents a JSON value.
Definition: json_value.h:141
ripple::test::updateAPIVersionString
std::string updateAPIVersionString(const char *const req)
Definition: RPCCall_test.cpp:7401
ripple::test::RPCCall_test
Definition: RPCCall_test.cpp:7410
initializer_list