xrpld
Loading...
Searching...
No Matches
SignFor.cpp
1#include <xrpld/app/ledger/LedgerMaster.h>
2#include <xrpld/rpc/Context.h>
3#include <xrpld/rpc/Role.h>
4#include <xrpld/rpc/detail/TransactionSign.h>
5
6#include <xrpl/json/json_value.h>
7#include <xrpl/protocol/ErrorCodes.h>
8#include <xrpl/protocol/jss.h>
9#include <xrpl/resource/Fees.h>
10
11namespace xrpl {
12
13// {
14// tx_json: <object>,
15// account: <signing account>
16// secret: <secret of signing account>
17// }
18json::Value
20{
21 if (context.role != Role::ADMIN && !context.app.config().canSign())
22 {
23 return RPC::makeError(RpcNotSupported, "Signing is not supported by this server.");
24 }
25
27 auto const failHard = context.params[jss::fail_hard].asBool();
28 auto const failType = NetworkOPs::doFailHard(failHard);
29
30 auto ret = RPC::transactionSignFor(
31 context.params,
32 context.apiVersion,
33 failType,
34 context.role,
36 context.app);
37
38 ret[jss::deprecated] =
39 "This command has been deprecated and will be "
40 "removed in a future version of the server. Please "
41 "migrate to a standalone signing tool.";
42 return ret;
43}
44
45} // namespace xrpl
bool asBool() const
virtual Config & config()=0
bool canSign() const
Definition Config.h:328
std::chrono::seconds getValidatedLedgerAge()
static FailHard doFailHard(bool noMeansDont)
Definition NetworkOPs.h:77
json::Value transactionSignFor(json::Value jvRequest, unsigned apiVersion, NetworkOPs::FailHard failType, Role role, std::chrono::seconds validatedLedgerAge, Application &app)
Returns a json::ValueType::Object.
json::Value makeError(ErrorCodeI code)
Returns a new json object that reflects the error code.
Charge const kFeeHeavyBurdenRpc
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
@ RpcNotSupported
Definition ErrorCodes.h:114
@ ADMIN
Definition Role.h:24
json::Value doSignFor(RPC::JsonContext &context)
Definition SignFor.cpp:19
Application & app
Definition Context.h:21
Resource::Charge & loadType
Definition Context.h:22
unsigned int apiVersion
Definition Context.h:29
LedgerMaster & ledgerMaster
Definition Context.h:24
json::Value params
Definition Context.h:43