xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
rpc
handlers
admin
signing
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
11
namespace
xrpl
{
12
13
// {
14
// tx_json: <object>,
15
// account: <signing account>
16
// secret: <secret of signing account>
17
// }
18
json::Value
19
doSignFor
(
rpc::JsonContext
& context)
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
26
context.
loadType
=
resource::kFeeHeavyBurdenRpc
;
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
,
35
context.
ledgerMaster
.
getValidatedLedgerAge
(),
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
json::Value::asBool
bool asBool() const
Definition
json_value.cpp:708
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::resource::kFeeHeavyBurdenRpc
Charge const kFeeHeavyBurdenRpc
xrpl::rpc::transactionSignFor
json::Value transactionSignFor(json::Value jvRequest, unsigned apiVersion, NetworkOPs::FailHard failType, Role role, std::chrono::seconds validatedLedgerAge, Application &app)
Returns a json::ValueType::Object.
Definition
TransactionSign.cpp:1171
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::doSignFor
json::Value doSignFor(rpc::JsonContext &context)
Definition
SignFor.cpp:19
xrpl::Role::ADMIN
@ ADMIN
Definition
Role.h:27
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