1#include <test/jtx/utility.h>
3#include <test/jtx/Account.h>
5#include <xrpld/rpc/RPCCall.h>
7#include <xrpl/basics/contract.h>
8#include <xrpl/basics/strHex.h>
9#include <xrpl/beast/utility/Journal.h>
10#include <xrpl/json/json_value.h>
11#include <xrpl/ledger/ReadView.h>
12#include <xrpl/protocol/AccountID.h>
13#include <xrpl/protocol/ErrorCodes.h>
14#include <xrpl/protocol/HashPrefix.h>
15#include <xrpl/protocol/Indexes.h>
16#include <xrpl/protocol/Protocol.h>
17#include <xrpl/protocol/SField.h>
18#include <xrpl/protocol/STObject.h>
19#include <xrpl/protocol/STParsedJSON.h>
20#include <xrpl/protocol/SecretKey.h>
21#include <xrpl/protocol/Serializer.h>
22#include <xrpl/protocol/XRPAmount.h>
23#include <xrpl/protocol/jss.h>
36 return std::move(*p.
object);
42 sigObject[jss::SigningPubKey] =
strHex(account.pk().slice());
47 sigObject[jss::TxnSignature] =
strHex(
Slice{sig.data(), sig.size()});
53 sign(jv, account, jv);
66 auto const txType = jv[jss::TransactionType].
asString();
67 if (txType == jss::ConfidentialMPTConvert || txType == jss::ConfidentialMPTConvertBack ||
68 txType == jss::ConfidentialMPTSend || txType == jss::ConfidentialMPTMergeInbox ||
69 txType == jss::ConfidentialMPTClawback)
90 jv[jss::Sequence] = ar->getFieldU32(sfSequence);
97 auto const paramsObj =
rpcCmdToJson(args, jv, apiVersion, j);
103 jv[jss::method] = paramsObj.
isMember(jss::method) ? paramsObj[jss::method].asString() : args[0];
106 if (paramsObj.begin() != paramsObj.end())
109 paramsArray.append(paramsObj);
111 if (paramsObj.isMember(jss::jsonrpc))
112 jv[jss::jsonrpc] = paramsObj[jss::jsonrpc];
113 if (paramsObj.isMember(jss::ripplerpc))
114 jv[jss::ripplerpc] = paramsObj[jss::ripplerpc];
115 if (paramsObj.isMember(jss::id))
116 jv[jss::id] = paramsObj[jss::id];
A generic endpoint for log messages.
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.
void clear()
Remove all object members and array elements.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
virtual SLE::const_pointer 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.
@ Array
array value (ordered list)
@ Object
object value (collection of name/value pairs).
Keylet account(AccountID const &id) noexcept
AccountID root.
void fillFee(json::Value &jv, ReadView const &view)
Set the fee automatically.
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.
json::Value cmdToJSONRPC(std::vector< std::string > const &args, beast::Journal j, unsigned int apiVersion)
Given an xrpld unit test rpc command, return the corresponding JSON.
void fillSeq(json::Value &jv, ReadView const &view)
Set the sequence number automatically.
std::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
std::string strHex(FwdIt begin, FwdIt end)
constexpr std::uint32_t kConfidentialFeeMultiplier
Extra base fee multiplier charged to confidential MPT transactions.
std::string to_string(BaseUInt< Bits, Tag > const &a)
json::Value rpcCmdToJson(std::vector< std::string > const &args, json::Value &retParams, unsigned int apiVersion, beast::Journal j)
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.
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
XRPAmount base
Cost of a reference transaction in drops.