xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
rpc
handlers
admin
signing
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
11
namespace
xrpl
{
12
13
// {
14
// tx_json: <object>,
15
// secret: <secret>
16
// }
17
json::Value
18
doSign
(
rpc::JsonContext
& context)
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
25
context.
loadType
=
resource::kFeeHeavyBurdenRpc
;
26
NetworkOPs::FailHard
const
failType =
NetworkOPs::doFailHard
(
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
,
34
context.
ledgerMaster
.
getValidatedLedgerAge
(),
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
json::Value::asBool
bool asBool() const
Definition
json_value.cpp:708
json::Value::isMember
bool isMember(char const *key) const
Return true if the object has a member named key.
Definition
json_value.cpp:1049
xrpl::Application::config
virtual Config & config()=0
xrpl::Config::canSign
bool canSign() const
Definition
src/xrpld/core/Config.h:372
xrpl::LedgerMaster::getValidatedLedgerAge
std::chrono::seconds getValidatedLedgerAge()
Definition
LedgerMaster.cpp:229
xrpl::NetworkOPs::doFailHard
static FailHard doFailHard(bool noMeansDont)
Definition
NetworkOPs.h:88
xrpl::NetworkOPs::FailHard
FailHard
Definition
NetworkOPs.h:86
xrpl::resource::kFeeHeavyBurdenRpc
Charge const kFeeHeavyBurdenRpc
xrpl::rpc::transactionSign
json::Value transactionSign(json::Value jvRequest, unsigned apiVersion, NetworkOPs::FailHard failType, Role role, std::chrono::seconds validatedLedgerAge, Application &app)
Returns a json::ValueType::Object.
Definition
TransactionSign.cpp:1008
xrpl::rpc::makeError
json::Value makeError(ErrorCodeI code)
Returns a new json object that reflects the error code.
Definition
ErrorCodes.cpp:190
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::RpcNotSupported
@ RpcNotSupported
Definition
ErrorCodes.h:115
xrpl::Role::ADMIN
@ ADMIN
Definition
Role.h:27
xrpl::doSign
json::Value doSign(rpc::JsonContext &context)
Definition
xrpld/rpc/handlers/admin/signing/Sign.cpp:18
xrpl::rpc::Context::loadType
resource::Charge & loadType
Definition
Context.h:30
xrpl::rpc::Context::role
Role role
Definition
Context.h:34
xrpl::rpc::Context::apiVersion
unsigned int apiVersion
Definition
Context.h:37
xrpl::rpc::Context::app
Application & app
Definition
Context.h:29
xrpl::rpc::Context::ledgerMaster
LedgerMaster & ledgerMaster
Definition
Context.h:32
xrpl::rpc::JsonContext
Definition
Context.h:41
xrpl::rpc::JsonContext::params
json::Value params
Definition
Context.h:51
Generated by
1.17.0