1#include <test/jtx/utility.h>
3#include <xrpld/rpc/RPCCall.h>
5#include <xrpl/basics/contract.h>
6#include <xrpl/json/Object.h>
7#include <xrpl/protocol/ErrorCodes.h>
8#include <xrpl/protocol/HashPrefix.h>
9#include <xrpl/protocol/Indexes.h>
10#include <xrpl/protocol/STParsedJSON.h>
11#include <xrpl/protocol/UintTypes.h>
12#include <xrpl/protocol/jss.h>
24 return std::move(*p.
object);
30 sigObject[jss::SigningPubKey] =
strHex(account.pk().slice());
41 sign(jv, account, jv);
57 auto const account = parseBase58<AccountID>(jv[jss::Account].asString());
59 Throw<parse_error>(
"unexpected invalid Account");
62 Throw<parse_error>(
"unexpected missing account root");
63 jv[jss::Sequence] = ar->getFieldU32(sfSequence);
70 unsigned int apiVersion)
73 auto const paramsObj =
rpcCmdToJson(args, jv, apiVersion, j);
79 jv[jss::method] = paramsObj.
isMember(jss::method)
80 ? paramsObj[jss::method].asString()
84 if (paramsObj.begin() != paramsObj.end())
87 paramsArray.append(paramsObj);
89 if (paramsObj.isMember(jss::jsonrpc))
90 jv[jss::jsonrpc] = paramsObj[jss::jsonrpc];
91 if (paramsObj.isMember(jss::ripplerpc))
92 jv[jss::ripplerpc] = paramsObj[jss::ripplerpc];
93 if (paramsObj.isMember(jss::id))
94 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, Json::Value &sigObject)
Sign automatically into a specific Json field of the jv object.
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