xrpld
Loading...
Searching...
No Matches
xrpld/rpc/handlers/admin/signing/Sign.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// secret: <secret>
16// }
17json::Value
19{
20 if (context.role != Role::ADMIN && !context.app.config().canSign())
21 {
22 return RPC::makeError(RpcNotSupported, "Signing is not supported by this server.");
23 }
24
27 context.params.isMember(jss::fail_hard) && context.params[jss::fail_hard].asBool());
28
29 auto ret = RPC::transactionSign(
30 context.params,
31 context.apiVersion,
32 failType,
33 context.role,
35 context.app);
36
37 ret[jss::deprecated] =
38 "This command has been deprecated and will be "
39 "removed in a future version of the server. Please "
40 "migrate to a standalone signing tool.";
41
42 return ret;
43}
44
45} // namespace xrpl
bool asBool() const
bool isMember(char const *key) const
Return true if the object has a member named key.
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 makeError(ErrorCodeI code)
Returns a new json object that reflects the error code.
json::Value transactionSign(json::Value jvRequest, unsigned apiVersion, NetworkOPs::FailHard failType, Role role, std::chrono::seconds validatedLedgerAge, Application &app)
Returns a json::ValueType::Object.
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
json::Value doSign(RPC::JsonContext &context)
@ ADMIN
Definition Role.h:24
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