20#include <xrpld/app/ledger/LedgerMaster.h>
21#include <xrpld/app/misc/HashRouter.h>
22#include <xrpld/app/misc/Transaction.h>
23#include <xrpld/app/tx/apply.h>
24#include <xrpld/rpc/Context.h>
25#include <xrpld/rpc/GRPCHandlers.h>
26#include <xrpld/rpc/detail/RPCHelpers.h>
27#include <xrpld/rpc/detail/TransactionSign.h>
28#include <xrpl/protocol/ErrorCodes.h>
29#include <xrpl/protocol/RPCErr.h>
30#include <xrpl/resource/Fees.h>
68 ret[jss::deprecated] =
69 "Signing support in the 'submit' command has been "
70 "deprecated and will be removed in a future version "
71 "of the server. Please migrate to a standalone "
81 if (!ret || !ret->size())
90 stTx = std::make_shared<STTx const>(
std::ref(sitTrans));
94 jvResult[jss::error] =
"invalidTransaction";
95 jvResult[jss::error_exception] = e.
what();
104 stTx->getTransactionID(),
113 jvResult[jss::error] =
"invalidTransaction";
114 jvResult[jss::error_exception] =
"fails local checks: " + reason;
121 auto transaction = std::make_shared<Transaction>(stTx, reason, context.
app);
122 if (transaction->getStatus() !=
NEW)
124 jvResult[jss::error] =
"invalidTransaction";
125 jvResult[jss::error_exception] =
"fails local checks: " + reason;
139 jvResult[jss::error] =
"internalSubmit";
140 jvResult[jss::error_exception] = e.
what();
148 jvResult[jss::tx_blob] =
149 strHex(transaction->getSTransaction()->getSerializer().peekData());
158 jvResult[jss::engine_result] = sToken;
159 jvResult[jss::engine_result_code] = transaction->getResult();
160 jvResult[jss::engine_result_message] = sHuman;
162 auto const submitResult = transaction->getSubmitResult();
164 jvResult[jss::accepted] = submitResult.any();
165 jvResult[jss::applied] = submitResult.applied;
166 jvResult[jss::broadcast] = submitResult.broadcast;
167 jvResult[jss::queued] = submitResult.queued;
168 jvResult[jss::kept] = submitResult.kept;
170 if (
auto currentLedgerState = transaction->getCurrentLedgerState())
172 jvResult[jss::account_sequence_next] =
173 safe_cast<Json::Value::UInt>(
174 currentLedgerState->accountSeqNext);
175 jvResult[jss::account_sequence_available] =
176 safe_cast<Json::Value::UInt>(
177 currentLedgerState->accountSeqAvail);
178 jvResult[jss::open_ledger_cost] =
179 to_string(currentLedgerState->minFeeRequired);
180 jvResult[jss::validated_ledger_index] =
181 safe_cast<Json::Value::UInt>(
182 currentLedgerState->validatedLedger);
190 jvResult[jss::error] =
"internalJson";
191 jvResult[jss::error_exception] = e.
what();
std::string asString() const
Returns the unquoted string value.
bool isMember(const char *key) const
Return true if the object has a member named key.
virtual Config & config()=0
virtual bool checkSigs() const =0
virtual HashRouter & getHashRouter()=0
std::shared_ptr< ReadView const > getCurrentLedger()
std::chrono::seconds getValidatedLedgerAge()
static FailHard doFailHard(bool noMeansDont)
virtual void processTransaction(std::shared_ptr< Transaction > &transaction, bool bUnlimited, bool bLocal, FailHard failType)=0
Process transactions as they arrive from the network or which are submitted by clients.
Json::Value make_error(error_code_i code)
Returns a new json object that reflects the error code.
Json::Value transactionSubmit(Json::Value jvRequest, unsigned apiVersion, NetworkOPs::FailHard failType, Role role, std::chrono::seconds validatedLedgerAge, Application &app, ProcessTransactionFn const &processTransaction)
Returns a Json::objectValue.
ProcessTransactionFn getProcessTxnFn(NetworkOPs &netOPs)
Charge const feeMediumBurdenRPC
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
static NetworkOPs::FailHard getFailHard(RPC::JsonContext const &context)
Json::Value rpcError(int iError)
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
Json::Value doSubmit(RPC::JsonContext &)
std::string strHex(FwdIt begin, FwdIt end)
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
void forceValidity(HashRouter &router, uint256 const &txid, Validity validity)
Sets the validity of a given transaction in the cache.
@ Valid
Signature and local checks are good / passed.
@ SigGoodOnly
Signature is good, but local checks fail.
std::string to_string(base_uint< Bits, Tag > const &a)
std::pair< Validity, std::string > checkValidity(HashRouter &router, STTx const &tx, Rules const &rules, Config const &config)
Checks transaction signature and local checks.
bool transResultInfo(TER code, std::string &token, std::string &text)
Resource::Charge & loadType
LedgerMaster & ledgerMaster