21#include <test/jtx/Env.h>
22#include <test/jtx/envconfig.h>
24#include <xrpld/app/rdb/backend/SQLiteDatabase.h>
25#include <xrpld/rpc/CTID.h>
27#include <xrpl/protocol/ErrorCodes.h>
28#include <xrpl/protocol/STBase.h>
29#include <xrpl/protocol/STParsedJSON.h>
30#include <xrpl/protocol/jss.h>
31#include <xrpl/protocol/serialize.h>
46 int const expectedSequence,
49 BEAST_EXPECT(result[jss::applied] ==
false);
50 BEAST_EXPECT(result.
isMember(jss::engine_result));
51 BEAST_EXPECT(result.
isMember(jss::engine_result_code));
52 BEAST_EXPECT(result.
isMember(jss::engine_result_message));
59 tx_json = result[jss::tx_json];
63 auto const unHexed =
strUnHex(result[jss::tx_blob].asString());
68 BEAST_EXPECT(tx_json[jss::TransactionType] == tx[jss::TransactionType]);
69 BEAST_EXPECT(tx_json[jss::Account] == tx[jss::Account]);
71 tx_json[jss::SigningPubKey] == tx.
get(jss::SigningPubKey,
""));
73 tx_json[jss::TxnSignature] == tx.
get(jss::TxnSignature,
""));
74 BEAST_EXPECT(tx_json[jss::Fee] == tx.
get(jss::Fee, expectedFee));
76 tx_json[jss::Sequence] == tx.
get(jss::Sequence, expectedSequence));
83 int const expectedSequence,
96 bool testSerialized =
true)
101 params[jss::tx_json] = tx;
102 validate(env.
rpc(
"json",
"simulate",
to_string(params)), tx);
104 params[jss::binary] =
true;
105 validate(env.
rpc(
"json",
"simulate",
to_string(params)), tx);
107 validate(env.
rpc(
"simulate",
to_string(tx),
"binary"), tx);
117 if (BEAST_EXPECT(parsed.
object.has_value()))
120 params[jss::tx_blob] = tx_blob;
121 validate(env.
rpc(
"json",
"simulate",
to_string(params)), tx);
122 params[jss::binary] =
true;
123 validate(env.
rpc(
"json",
"simulate",
to_string(params)), tx);
125 validate(env.
rpc(
"simulate", tx_blob), tx);
126 validate(env.
rpc(
"simulate", tx_blob,
"binary"), tx);
137 if (txResult.
isMember(jss::meta_blob))
139 auto unHexed =
strUnHex(txResult[jss::meta_blob].asString());
145 return txResult[jss::meta];
160 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
162 resp[jss::result][jss::error_message] ==
163 "Neither `tx_blob` nor `tx_json` included.");
169 params[jss::tx_blob] =
"1200";
171 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
173 resp[jss::result][jss::error_message] ==
174 "Can only include one of `tx_blob` and `tx_json`.");
179 params[jss::tx_blob] =
"1200";
180 params[jss::binary] =
"100";
181 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
183 resp[jss::result][jss::error_message] ==
184 "Invalid field 'binary'.");
189 params[jss::tx_blob] =
"12";
191 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
193 resp[jss::result][jss::error_message] ==
194 "Invalid field 'tx_blob'.");
201 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
203 resp[jss::result][jss::error_message] ==
204 "Missing field 'tx.TransactionType'.");
210 tx_json[jss::TransactionType] = jss::Payment;
211 params[jss::tx_json] = tx_json;
213 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
215 resp[jss::result][jss::error_message] ==
216 "Missing field 'tx.Account'.");
221 params[jss::tx_blob] =
"";
223 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
225 resp[jss::result][jss::error_message] ==
226 "Invalid field 'tx_blob'.");
231 params[jss::tx_blob] = 1.1;
233 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
235 resp[jss::result][jss::error_message] ==
236 "Invalid field 'tx_blob'.");
241 params[jss::tx_json] =
"";
243 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
245 resp[jss::result][jss::error_message] ==
246 "Invalid field 'tx_json', not object.");
251 params[jss::seed] =
"doesnt_matter";
253 tx_json[jss::TransactionType] = jss::AccountSet;
255 params[jss::tx_json] = tx_json;
256 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
258 resp[jss::result][jss::error_message] ==
259 "Invalid field 'seed'.");
264 params[jss::secret] =
"doesnt_matter";
266 tx_json[jss::TransactionType] = jss::AccountSet;
268 params[jss::tx_json] = tx_json;
269 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
271 resp[jss::result][jss::error_message] ==
272 "Invalid field 'secret'.");
277 params[jss::seed_hex] =
"doesnt_matter";
279 tx_json[jss::TransactionType] = jss::AccountSet;
281 params[jss::tx_json] = tx_json;
282 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
284 resp[jss::result][jss::error_message] ==
285 "Invalid field 'seed_hex'.");
290 params[jss::passphrase] =
"doesnt_matter";
292 tx_json[jss::TransactionType] = jss::AccountSet;
294 params[jss::tx_json] = tx_json;
295 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
297 resp[jss::result][jss::error_message] ==
298 "Invalid field 'passphrase'.");
304 tx_json[jss::TransactionType] = jss::Payment;
306 params[jss::tx_json] = tx_json;
308 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
310 resp[jss::result][jss::error_exception] ==
311 "Field 'Destination' is required but missing.");
317 tx_json[jss::TransactionType] = jss::AccountSet;
318 tx_json[jss::Account] =
"badAccount";
319 params[jss::tx_json] = tx_json;
321 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
323 resp[jss::result][jss::error] ==
"srcActMalformed",
324 resp[jss::result][jss::error].toStyledString());
326 resp[jss::result][jss::error_message] ==
327 "Invalid field 'tx.Account'.");
333 tx_json[jss::TransactionType] = jss::AccountSet;
334 tx_json[jss::Account] = alice.
human();
335 params[jss::tx_json] = tx_json;
337 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
339 resp[jss::result][jss::error_message] ==
340 "Source account not found.");
346 tx_json[jss::TransactionType] = jss::AccountSet;
348 tx_json[sfSigners] =
"1";
349 params[jss::tx_json] = tx_json;
351 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
353 resp[jss::result][jss::error_message] ==
354 "Invalid field 'tx.Signers'.");
360 tx_json[jss::TransactionType] = jss::AccountSet;
363 tx_json[sfSigners].
append(
"1");
364 params[jss::tx_json] = tx_json;
366 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
368 resp[jss::result][jss::error_message] ==
369 "Invalid field 'tx.Signers[0]'.");
375 tx_json[jss::TransactionType] = jss::AccountSet;
377 tx_json[
"foo"] =
"bar";
378 params[jss::tx_json] = tx_json;
380 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
382 resp[jss::result][jss::error_message] ==
383 "Field 'tx_json.foo' is unknown.");
388 tx_json[jss::TransactionType] = jss::AccountSet;
389 tx_json[jss::Account] = alice.
human();
390 auto const resp = env.
rpc(
"simulate",
to_string(tx_json),
"1");
391 BEAST_EXPECT(resp[jss::error_message] ==
"Invalid parameters.");
397 tx_json[jss::TransactionType] = jss::AccountSet;
399 tx_json[jss::TxnSignature] =
"1200ABCD";
400 params[jss::tx_json] = tx_json;
402 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
404 resp[jss::result][jss::error_message] ==
405 "Transaction should not be signed.");
411 tx_json[jss::TransactionType] = jss::AccountSet;
418 signer[jss::TxnSignature] =
"1200ABCD";
420 signerOuter[sfSigner] =
signer;
421 tx_json[sfSigners].
append(signerOuter);
423 params[jss::tx_json] = tx_json;
425 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
427 resp[jss::result][jss::error_message] ==
428 "Transaction should not be signed.");
440 cfg->section(
"transaction_queue")
441 .
set(
"minimum_txn_in_ledger_standalone",
"3");
451 for (
int i = metrics.txInLedger; i <= metrics.txPerLedger; ++i)
456 params[jss::tx_json] =
noop(alice);
458 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
459 auto const result = resp[jss::result];
460 if (BEAST_EXPECT(result.isMember(jss::error)))
462 BEAST_EXPECT(result[jss::error] ==
"highFee");
463 BEAST_EXPECT(result[jss::error_code] ==
rpcHIGH_FEE);
471 testcase(
"Invalid transaction type");
479 env.
fund(
XRP(1000000), alice, bob);
483 auto const seq = env.
seq(alice);
491 params[jss::tx_json] = jt.jv;
492 auto const resp = env.
rpc(
"json",
"simulate",
to_string(params));
493 BEAST_EXPECT(resp[jss::result][jss::error] ==
"notImpl");
495 resp[jss::result][jss::error_message] ==
"Not implemented.");
508 static auto const newDomain =
"123ABC";
513 auto result = resp[jss::result];
515 result, tx, 1, env.
current()->fees().base);
517 BEAST_EXPECT(result[jss::engine_result] ==
"tesSUCCESS");
518 BEAST_EXPECT(result[jss::engine_result_code] == 0);
520 result[jss::engine_result_message] ==
521 "The simulated transaction would have been applied.");
524 result.isMember(jss::meta) ||
525 result.isMember(jss::meta_blob)))
530 metadata.
isMember(sfAffectedNodes.jsonName)))
533 metadata[sfAffectedNodes.jsonName].
size() == 1);
534 auto node = metadata[sfAffectedNodes.jsonName][0u];
536 node.isMember(sfModifiedNode.jsonName)))
538 auto modifiedNode = node[sfModifiedNode];
540 modifiedNode[sfLedgerEntryType] ==
542 auto finalFields = modifiedNode[sfFinalFields];
543 BEAST_EXPECT(finalFields[sfDomain] == newDomain);
546 BEAST_EXPECT(metadata[sfTransactionIndex.jsonName] == 0);
548 metadata[sfTransactionResult.jsonName] ==
"tesSUCCESS");
555 tx[jss::TransactionType] = jss::AccountSet;
556 tx[sfDomain] = newDomain;
559 testTx(env, tx, validateOutput);
561 tx[sfSigningPubKey] =
"";
562 tx[sfTxnSignature] =
"";
564 tx[sfFee] = env.
current()->fees().base.jsonClipped().asString();
567 testTx(env, tx, validateOutput);
574 testcase(
"Transaction non-tec failure");
584 auto result = resp[jss::result];
586 result, tx, 1, env.
current()->fees().base);
588 BEAST_EXPECT(result[jss::engine_result] ==
"temBAD_AMOUNT");
589 BEAST_EXPECT(result[jss::engine_result_code] == -298);
591 result[jss::engine_result_message] ==
592 "Malformed: Bad amount.");
595 !result.isMember(jss::meta) &&
596 !result.isMember(jss::meta_blob));
602 tx[jss::TransactionType] = jss::Payment;
603 tx[sfDestination] = alice.
human();
607 testTx(env, tx, testSimulation);
609 tx[sfSigningPubKey] =
"";
610 tx[sfTxnSignature] =
"";
612 tx[sfFee] = env.
current()->fees().base.jsonClipped().asString();
615 testTx(env, tx, testSimulation);
622 testcase(
"Transaction tec failure");
632 auto result = resp[jss::result];
634 result, tx, 1, env.
current()->fees().base);
637 result[jss::engine_result] ==
"tecNO_DST_INSUF_XRP");
638 BEAST_EXPECT(result[jss::engine_result_code] == 125);
640 result[jss::engine_result_message] ==
641 "Destination does not exist. Too little XRP sent to "
646 result.isMember(jss::meta) ||
647 result.isMember(jss::meta_blob)))
652 metadata.
isMember(sfAffectedNodes.jsonName)))
655 metadata[sfAffectedNodes.jsonName].
size() == 1);
656 auto node = metadata[sfAffectedNodes.jsonName][0u];
658 node.isMember(sfModifiedNode.jsonName)))
660 auto modifiedNode = node[sfModifiedNode];
662 modifiedNode[sfLedgerEntryType] ==
664 auto finalFields = modifiedNode[sfFinalFields];
666 finalFields[sfBalance] ==
668 100'000'000'000'000'000 -
669 env.
current()->fees().base.drops()));
673 metadata[sfTransactionIndex.jsonName] == 0);
675 metadata[sfTransactionResult.jsonName] ==
676 "tecNO_DST_INSUF_XRP");
683 tx[jss::TransactionType] = jss::Payment;
684 tx[sfDestination] = alice.
human();
688 testTx(env, tx, testSimulation);
690 tx[sfSigningPubKey] =
"";
691 tx[sfTxnSignature] =
"";
693 tx[sfFee] = env.
current()->fees().base.jsonClipped().asString();
696 testTx(env, tx, testSimulation);
703 testcase(
"Successful multi-signed transaction");
707 static auto const newDomain =
"123ABC";
715 env(
signers(alice, 1, {{becky, 1}, {carol, 1}}));
721 auto result = resp[jss::result];
723 result, tx, env.
seq(alice), env.
current()->fees().base * 2);
725 BEAST_EXPECT(result[jss::engine_result] ==
"tesSUCCESS");
726 BEAST_EXPECT(result[jss::engine_result_code] == 0);
728 result[jss::engine_result_message] ==
729 "The simulated transaction would have been applied.");
732 result.isMember(jss::meta) ||
733 result.isMember(jss::meta_blob)))
738 metadata.
isMember(sfAffectedNodes.jsonName)))
741 metadata[sfAffectedNodes.jsonName].
size() == 1);
742 auto node = metadata[sfAffectedNodes.jsonName][0u];
744 node.isMember(sfModifiedNode.jsonName)))
746 auto modifiedNode = node[sfModifiedNode];
748 modifiedNode[sfLedgerEntryType] ==
750 auto finalFields = modifiedNode[sfFinalFields];
751 BEAST_EXPECT(finalFields[sfDomain] == newDomain);
754 BEAST_EXPECT(metadata[sfTransactionIndex.jsonName] == 0);
756 metadata[sfTransactionResult.jsonName] ==
"tesSUCCESS");
762 tx[jss::Account] = alice.
human();
763 tx[jss::TransactionType] = jss::AccountSet;
764 tx[sfDomain] = newDomain;
770 signerOuter[sfSigner] =
signer;
771 tx[sfSigners].
append(signerOuter);
775 testTx(env, tx, validateOutput,
false);
777 tx[sfSigningPubKey] =
"";
778 tx[sfTxnSignature] =
"";
779 tx[sfSequence] = env.
seq(alice);
783 tx[sfSigners][0u][sfSigner][jss::SigningPubKey] =
785 tx[sfSigners][0u][sfSigner][jss::TxnSignature] =
"";
788 testTx(env, tx, validateOutput);
795 testcase(
"Transaction with a key-related failure");
799 static auto const newDomain =
"123ABC";
809 auto result = resp[jss::result];
817 result[jss::engine_result] ==
"tefMASTER_DISABLED");
818 BEAST_EXPECT(result[jss::engine_result_code] == -188);
820 result[jss::engine_result_message] ==
821 "Master key is disabled.");
824 !result.isMember(jss::meta) &&
825 !result.isMember(jss::meta_blob));
831 tx[jss::TransactionType] = jss::AccountSet;
832 tx[sfDomain] = newDomain;
835 testTx(env, tx, testSimulation);
837 tx[sfSigningPubKey] =
"";
838 tx[sfTxnSignature] =
"";
840 tx[sfFee] = env.
current()->fees().base.jsonClipped().asString();
843 testTx(env, tx, testSimulation);
850 testcase(
"Multi-signed transaction with a bad public key");
854 static auto const newDomain =
"123ABC";
863 env(
signers(alice, 1, {{becky, 1}, {carol, 1}}));
868 auto result = resp[jss::result];
870 result, tx, env.
seq(alice), env.
current()->fees().base * 2);
873 result[jss::engine_result] ==
"tefBAD_SIGNATURE",
874 result[jss::engine_result].toStyledString());
875 BEAST_EXPECT(result[jss::engine_result_code] == -186);
877 result[jss::engine_result_message] ==
878 "A signature is provided for a non-signer.");
881 !result.isMember(jss::meta) &&
882 !result.isMember(jss::meta_blob));
887 tx[jss::Account] = alice.
human();
888 tx[jss::TransactionType] = jss::AccountSet;
889 tx[sfDomain] = newDomain;
896 signerOuter[sfSigner] =
signer;
897 tx[sfSigners].
append(signerOuter);
901 testTx(env, tx, validateOutput,
false);
903 tx[sfSigningPubKey] =
"";
904 tx[sfTxnSignature] =
"";
905 tx[sfSequence] = env.
seq(alice);
909 tx[sfSigners][0u][sfSigner][jss::TxnSignature] =
"";
912 testTx(env, tx, validateOutput);
919 testcase(
"Credentials aren't actually deleted on `tecEXPIRED`");
926 Account const subject{
"subject"};
927 Account const issuer{
"issuer"};
929 env.
fund(
XRP(10000), subject, issuer);
932 auto const credType =
"123ABC";
936 env.
current()->info().parentCloseTime.time_since_epoch().count();
937 jv[sfExpiration.jsonName] = t;
944 auto result = resp[jss::result];
946 result, tx, env.
seq(subject), env.
current()->fees().base);
948 BEAST_EXPECT(result[jss::engine_result] ==
"tecEXPIRED");
949 BEAST_EXPECT(result[jss::engine_result_code] == 148);
951 result[jss::engine_result_message] ==
952 "Expiration time is passed.");
955 result.isMember(jss::meta) ||
956 result.isMember(jss::meta_blob)))
961 metadata.
isMember(sfAffectedNodes.jsonName)))
964 metadata[sfAffectedNodes.jsonName].
size() == 5);
969 for (
auto const& node :
970 metadata[sfAffectedNodes.jsonName])
972 if (node.isMember(sfDeletedNode.jsonName) &&
973 node[sfDeletedNode.jsonName]
974 [sfLedgerEntryType.jsonName]
975 .asString() ==
"Credential")
978 node[sfDeletedNode.jsonName]
979 [sfFinalFields.jsonName];
980 found = deleted[jss::Issuer] ==
982 deleted[jss::Subject] ==
984 deleted[
"CredentialType"] ==
996 BEAST_EXPECT(metadata[sfTransactionIndex.jsonName] == 0);
998 metadata[sfTransactionResult.jsonName] ==
"tecEXPIRED");
1005 testTx(env, tx, validateOutput);
1007 tx[sfSigningPubKey] =
"";
1008 tx[sfTxnSignature] =
"";
1009 tx[sfSequence] = env.
seq(subject);
1010 tx[sfFee] = env.
current()->fees().base.jsonClipped().asString();
1013 testTx(env, tx, validateOutput);
1020 jle.isObject() && jle.isMember(jss::result) &&
1021 !jle[jss::result].isMember(jss::error) &&
1022 jle[jss::result].isMember(jss::node) &&
1023 jle[jss::result][jss::node].isMember(
"LedgerEntryType") &&
1024 jle[jss::result][jss::node][
"LedgerEntryType"] == jss::Credential &&
1025 jle[jss::result][jss::node][jss::Issuer] == issuer.human() &&
1026 jle[jss::result][jss::node][jss::Subject] == subject.human() &&
1027 jle[jss::result][jss::node][
"CredentialType"] ==
1037 testcase(
"Successful transaction with a custom network ID");
1039 using namespace jtx;
1041 cfg->NETWORK_ID = 1025;
1044 static auto const newDomain =
"123ABC";
1047 auto validateOutput = [&](
Json::Value const& resp,
1049 auto result = resp[jss::result];
1051 result, tx, 1, env.
current()->fees().base);
1053 BEAST_EXPECT(result[jss::engine_result] ==
"tesSUCCESS");
1054 BEAST_EXPECT(result[jss::engine_result_code] == 0);
1056 result[jss::engine_result_message] ==
1057 "The simulated transaction would have been applied.");
1060 result.isMember(jss::meta) ||
1061 result.isMember(jss::meta_blob)))
1066 metadata.
isMember(sfAffectedNodes.jsonName)))
1069 metadata[sfAffectedNodes.jsonName].
size() == 1);
1070 auto node = metadata[sfAffectedNodes.jsonName][0u];
1072 node.isMember(sfModifiedNode.jsonName)))
1074 auto modifiedNode = node[sfModifiedNode];
1076 modifiedNode[sfLedgerEntryType] ==
1078 auto finalFields = modifiedNode[sfFinalFields];
1079 BEAST_EXPECT(finalFields[sfDomain] == newDomain);
1082 BEAST_EXPECT(metadata[sfTransactionIndex.jsonName] == 0);
1084 metadata[sfTransactionResult.jsonName] ==
"tesSUCCESS");
1091 tx[jss::TransactionType] = jss::AccountSet;
1092 tx[sfDomain] = newDomain;
1095 testTx(env, tx, validateOutput);
1097 tx[sfSigningPubKey] =
"";
1098 tx[sfTxnSignature] =
"";
1100 tx[sfFee] = env.
current()->fees().base.jsonClipped().asString();
1101 tx[sfNetworkID] = 1025;
1104 testTx(env, tx, validateOutput);
Value & append(Value const &value)
Append value to array at the end.
UInt size() const
Number of values in array or object.
Value removeMember(char const *key)
Remove and return the named member.
std::string asString() const
Returns the unquoted string value.
bool isMember(char const *key) const
Return true if the object has a member named key.
Value get(UInt index, Value const &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
testcase_t testcase
Memberspace for declaring test cases.
void fail(String const &reason, char const *file, int line)
Record a failure.
Slice slice() const noexcept
Json::Value getJson(JsonOptions=JsonOptions::none) const override
Holds the serialized result of parsing an input JSON object.
std::optional< STObject > object
The STObject if the parse was successful.
Metrics getMetrics(OpenView const &view) const
Returns fee metrics in reference fee level units.
Json::Value jsonClipped() const
Json::Value getJsonMetadata(Json::Value txResult) const
void testTransactionNonTecFailure()
void testTx(jtx::Env &env, Json::Value const &tx, std::function< void(Json::Value const &, Json::Value const &)> const &validate, bool testSerialized=true)
void testInvalidTransactionType()
void testSuccessfulTransactionNetworkID()
void run() override
Runs the suite.
void testSuccessfulTransaction()
void testTransactionTecFailure()
void testMultisignedBadPubKey()
void testSuccessfulTransactionMultisigned()
void testDeleteExpiredCredentials()
void testTransactionSigningFailure()
void checkBasicReturnValidity(Json::Value const &result, Json::Value const &tx, int const expectedSequence, XRPAmount const &expectedFee)
void checkBasicReturnValidity(Json::Value const &result, Json::Value const &tx, int const expectedSequence, std::string const &expectedFee)
Immutable cryptographic account descriptor.
PublicKey const & pk() const
Return the public key.
std::string const & human() const
Returns the human readable public key.
A transaction testing environment.
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
JTx jtnofill(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
Adds a new Batch Txn on a JTx and autofills.
Set the expected result code for a JTx The test will fail if the code doesn't match.
Set the regular signature on a JTx.
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
Json::Value outer(jtx::Account const &account, uint32_t seq, STAmount const &fee, std::uint32_t flags)
Batch.
XRPAmount calcBatchFee(jtx::Env const &env, uint32_t const &numSigners, uint32_t const &txns=0)
Calculate Batch Fee.
Json::Value create(jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
Json::Value accept(jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
Json::Value ledgerEntry(jtx::Env &env, jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
std::uint32_t ownerCount(Env const &env, Account const &account)
Json::Value regkey(Account const &account, disabled_t)
Disable the regular key.
Json::Value signers(Account const &account, std::uint32_t quorum, std::vector< signer > const &v)
Json::Value fset(Account const &account, std::uint32_t on, std::uint32_t off=0)
Add and/or remove flag.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
XRP_t const XRP
Converts to XRP Issue or STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t tfAllOrNothing
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
constexpr std::uint32_t asfDisableMaster
std::string strHex(FwdIt begin, FwdIt end)
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
std::string to_string(base_uint< Bits, Tag > const &a)
Set the sequence number on a JTx.
A signer in a SignerList.