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