20#include <xrpld/app/ledger/LedgerMaster.h>
21#include <xrpld/app/misc/Transaction.h>
22#include <xrpld/app/tx/apply.h>
23#include <xrpld/rpc/Context.h>
24#include <xrpld/rpc/detail/TransactionSign.h>
26#include <xrpl/protocol/ErrorCodes.h>
27#include <xrpl/protocol/RPCErr.h>
28#include <xrpl/resource/Fees.h>
66 ret[jss::deprecated] =
67 "Signing support in the 'submit' command has been "
68 "deprecated and will be removed in a future version "
69 "of the server. Please migrate to a standalone "
79 if (!ret || !ret->size())
92 jvResult[jss::error] =
"invalidTransaction";
93 jvResult[jss::error_exception] = e.
what();
102 stTx->getTransactionID(),
111 jvResult[jss::error] =
"invalidTransaction";
112 jvResult[jss::error_exception] =
"fails local checks: " + reason;
120 if (transaction->getStatus() !=
NEW)
122 jvResult[jss::error] =
"invalidTransaction";
123 jvResult[jss::error_exception] =
"fails local checks: " + reason;
137 jvResult[jss::error] =
"internalSubmit";
138 jvResult[jss::error_exception] = e.
what();
146 jvResult[jss::tx_blob] =
147 strHex(transaction->getSTransaction()->getSerializer().peekData());
156 jvResult[jss::engine_result] = sToken;
157 jvResult[jss::engine_result_code] = transaction->getResult();
158 jvResult[jss::engine_result_message] = sHuman;
160 auto const submitResult = transaction->getSubmitResult();
162 jvResult[jss::accepted] = submitResult.any();
163 jvResult[jss::applied] = submitResult.applied;
164 jvResult[jss::broadcast] = submitResult.broadcast;
165 jvResult[jss::queued] = submitResult.queued;
166 jvResult[jss::kept] = submitResult.kept;
168 if (
auto currentLedgerState = transaction->getCurrentLedgerState())
170 jvResult[jss::account_sequence_next] =
171 safe_cast<Json::Value::UInt>(
172 currentLedgerState->accountSeqNext);
173 jvResult[jss::account_sequence_available] =
174 safe_cast<Json::Value::UInt>(
175 currentLedgerState->accountSeqAvail);
176 jvResult[jss::open_ledger_cost] =
177 to_string(currentLedgerState->minFeeRequired);
178 jvResult[jss::validated_ledger_index] =
179 safe_cast<Json::Value::UInt>(
180 currentLedgerState->validatedLedger);
188 jvResult[jss::error] =
"internalJson";
189 jvResult[jss::error_exception] = e.
what();
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.
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