1#include <test/jtx/utility.h>
3#include <xrpld/rpc/RPCCall.h>
5#include <xrpl/basics/contract.h>
6#include <xrpl/protocol/ErrorCodes.h>
7#include <xrpl/protocol/HashPrefix.h>
8#include <xrpl/protocol/Indexes.h>
9#include <xrpl/protocol/STParsedJSON.h>
10#include <xrpl/protocol/UintTypes.h>
11#include <xrpl/protocol/jss.h>
23 return std::move(*p.
object);
29 sigObject[jss::SigningPubKey] =
strHex(account.pk().slice());
40 sign(jv, account, jv);
56 auto const account = parseBase58<AccountID>(jv[jss::Account].asString());
58 Throw<parse_error>(
"unexpected invalid Account");
61 Throw<parse_error>(
"unexpected missing account root");
62 jv[jss::Sequence] = ar->getFieldU32(sfSequence);
69 unsigned int apiVersion)
72 auto const paramsObj =
rpcCmdToJson(args, jv, apiVersion, j);
78 jv[jss::method] = paramsObj.
isMember(jss::method)
79 ? paramsObj[jss::method].asString()
83 if (paramsObj.begin() != paramsObj.end())
86 paramsArray.
append(paramsObj);
88 if (paramsObj.isMember(jss::jsonrpc))
89 jv[jss::jsonrpc] = paramsObj[jss::jsonrpc];
90 if (paramsObj.isMember(jss::ripplerpc))
91 jv[jss::ripplerpc] = paramsObj[jss::ripplerpc];
92 if (paramsObj.isMember(jss::id))
93 jv[jss::id] = paramsObj[jss::id];
Value & append(Value const &value)
Append value to array at the end.
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 Fees const & fees() const =0
Returns the fees for the base ledger.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
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.
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
Keylet account(AccountID const &id) noexcept
AccountID root.
void fill_seq(Json::Value &jv, ReadView const &view)
Set the sequence number 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.
void sign(Json::Value &jv, Account const &account, Json::Value &sigObject)
Sign automatically into a specific Json field of the jv object.
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 to_string(base_uint< Bits, Tag > const &a)
std::string strHex(FwdIt begin, FwdIt end)
std::string rpcErrorString(Json::Value const &jv)
Returns a single string with the contents of an RPC error.
@ txSign
inner transaction to sign
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &message)
Generate a signature for a message.
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)