20#include <test/jtx/utility.h>
22#include <xrpld/net/RPCCall.h>
24#include <xrpl/basics/contract.h>
25#include <xrpl/json/Object.h>
26#include <xrpl/protocol/ErrorCodes.h>
27#include <xrpl/protocol/HashPrefix.h>
28#include <xrpl/protocol/Indexes.h>
29#include <xrpl/protocol/STParsedJSON.h>
30#include <xrpl/protocol/UintTypes.h>
31#include <xrpl/protocol/jss.h>
43 return std::move(*p.
object);
49 jv[jss::SigningPubKey] =
strHex(account.pk().slice());
70 auto const account = parseBase58<AccountID>(jv[jss::Account].asString());
72 Throw<parse_error>(
"unexpected invalid Account");
75 Throw<parse_error>(
"unexpected missing account root");
76 jv[jss::Sequence] = ar->getFieldU32(sfSequence);
83 unsigned int apiVersion)
86 auto const paramsObj =
rpcCmdToJson(args, jv, apiVersion, j);
92 jv[jss::method] = paramsObj.
isMember(jss::method)
93 ? paramsObj[jss::method].asString()
97 if (paramsObj.begin() != paramsObj.end())
100 paramsArray.append(paramsObj);
102 if (paramsObj.isMember(jss::jsonrpc))
103 jv[jss::jsonrpc] = paramsObj[jss::jsonrpc];
104 if (paramsObj.isMember(jss::ripplerpc))
105 jv[jss::ripplerpc] = paramsObj[jss::ripplerpc];
106 if (paramsObj.isMember(jss::id))
107 jv[jss::id] = paramsObj[jss::id];
void clear()
Remove all object members and array elements.
bool isMember(char const *key) const
Return true if the object has a member named key.
A generic endpoint for log messages.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
void addWithoutSigningFields(Serializer &s) const
Holds the serialized result of parsing an input JSON object.
std::optional< STObject > object
The STObject if the parse was successful.
Json::Value error
On failure, an appropriate set of error values.
Slice slice() const noexcept
An immutable linear range of bytes.
Immutable cryptographic account descriptor.
Set the regular signature on a JTx.
@ objectValue
object value (collection of name/value pairs).
Json::Value & setArray(Json::Value &, Json::StaticString const &key)
Add a new subarray at a named key in a Json object.
Keylet account(AccountID const &id) noexcept
AccountID root.
void fill_seq(Json::Value &jv, ReadView const &view)
Set the sequence number automatically.
void sign(Json::Value &jv, Account const &account)
Sign automatically.
Json::Value cmdToJSONRPC(std::vector< std::string > const &args, beast::Journal j, unsigned int apiVersion)
Given a rippled unit test rpc command, return the corresponding JSON.
STObject parse(Json::Value const &jv)
Convert JSON to STObject.
void fill_fee(Json::Value &jv, ReadView const &view)
Set the fee automatically.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string rpcErrorString(Json::Value const &jv)
Returns a single string with the contents of an RPC error.
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &message)
Generate a signature for a message.
std::string strHex(FwdIt begin, FwdIt end)
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
std::string to_string(base_uint< Bits, Tag > const &a)
@ txSign
inner transaction to sign