Files
rippled/src/xrpld/rpc/handlers/admin/signing/Sign.cpp
2026-05-04 10:13:45 -04:00

43 lines
1.1 KiB
C++

#include <xrpld/app/ledger/LedgerMaster.h>
#include <xrpld/rpc/Context.h>
#include <xrpld/rpc/detail/TransactionSign.h>
#include <xrpl/protocol/ErrorCodes.h>
#include <xrpl/resource/Fees.h>
namespace xrpl {
// {
// tx_json: <object>,
// secret: <secret>
// }
Json::Value
doSign(RPC::JsonContext& context)
{
if (context.role != Role::ADMIN && !context.app.config().canSign())
{
return RPC::make_error(rpcNOT_SUPPORTED, "Signing is not supported by this server.");
}
context.loadType = Resource::feeHeavyBurdenRPC;
NetworkOPs::FailHard const failType = NetworkOPs::doFailHard(
context.params.isMember(jss::fail_hard) && context.params[jss::fail_hard].asBool());
auto ret = RPC::transactionSign(
context.params,
context.apiVersion,
failType,
context.role,
context.ledgerMaster.getValidatedLedgerAge(),
context.app);
ret[jss::deprecated] =
"This command has been deprecated and will be "
"removed in a future version of the server. Please "
"migrate to a standalone signing tool.";
return ret;
}
} // namespace xrpl