mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-22 12:45:52 +00:00
@@ -90,6 +90,9 @@ AccountChannelsHandler::process(AccountChannelsHandler::Input input, Context con
|
||||
auto const next = ngTraverseOwnedNodes(
|
||||
*sharedPtrBackend_, *accountID, lgrInfo.seq, input.limit, input.marker, ctx.yield, addToResponse);
|
||||
|
||||
if (auto status = std::get_if<Status>(&next))
|
||||
return Error{*status};
|
||||
|
||||
response.account = input.account;
|
||||
response.limit = input.limit;
|
||||
response.ledgerHash = ripple::strHex(lgrInfo.hash);
|
||||
|
||||
@@ -132,6 +132,10 @@ AccountLinesHandler::process(AccountLinesHandler::Input input, Context const& ct
|
||||
|
||||
auto const next = ngTraverseOwnedNodes(
|
||||
*sharedPtrBackend_, *accountID, lgrInfo.seq, input.limit, input.marker, ctx.yield, addToResponse);
|
||||
|
||||
if (auto status = std::get_if<Status>(&next))
|
||||
return Error{*status};
|
||||
|
||||
auto const nextMarker = std::get<AccountCursor>(next);
|
||||
|
||||
response.account = input.account;
|
||||
@@ -183,6 +187,7 @@ void
|
||||
tag_invoke(boost::json::value_from_tag, boost::json::value& jv, AccountLinesHandler::Output const& output)
|
||||
{
|
||||
auto obj = boost::json::object{
|
||||
{JS(account), output.account},
|
||||
{JS(ledger_hash), output.ledgerHash},
|
||||
{JS(ledger_index), output.ledgerIndex},
|
||||
{JS(validated), output.validated},
|
||||
|
||||
@@ -60,6 +60,7 @@ void
|
||||
tag_invoke(boost::json::value_from_tag, boost::json::value& jv, TransactionEntryHandler::Output const& output)
|
||||
{
|
||||
jv = {
|
||||
{JS(validated), output.validated},
|
||||
{JS(metadata), output.metadata},
|
||||
{JS(tx_json), output.tx},
|
||||
{JS(ledger_index), output.ledgerIndex},
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <rpc/RPCHelpers.h>
|
||||
#include <rpc/handlers/Tx.h>
|
||||
|
||||
namespace RPC {
|
||||
@@ -84,17 +83,17 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, TxHandler::Outpu
|
||||
if (output.tx)
|
||||
{
|
||||
obj = *output.tx;
|
||||
obj["meta"] = *output.meta;
|
||||
obj[JS(meta)] = *output.meta;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj["meta"] = *output.metaStr;
|
||||
obj["tx"] = *output.txStr;
|
||||
obj["hash"] = output.hash;
|
||||
obj[JS(meta)] = *output.metaStr;
|
||||
obj[JS(tx)] = *output.txStr;
|
||||
obj[JS(hash)] = output.hash;
|
||||
}
|
||||
|
||||
obj["date"] = output.date;
|
||||
obj["ledger_index"] = output.ledgerIndex;
|
||||
obj[JS(validated)] = output.validated;
|
||||
obj[JS(date)] = output.date;
|
||||
obj[JS(ledger_index)] = output.ledgerIndex;
|
||||
|
||||
jv = std::move(obj);
|
||||
}
|
||||
@@ -105,16 +104,16 @@ tag_invoke(boost::json::value_to_tag<TxHandler::Input>, boost::json::value const
|
||||
auto input = TxHandler::Input{};
|
||||
auto const& jsonObject = jv.as_object();
|
||||
|
||||
input.transaction = jv.at("transaction").as_string().c_str();
|
||||
input.transaction = jv.at(JS(transaction)).as_string().c_str();
|
||||
|
||||
if (jsonObject.contains("binary"))
|
||||
input.binary = jv.at("binary").as_bool();
|
||||
if (jsonObject.contains(JS(binary)))
|
||||
input.binary = jv.at(JS(binary)).as_bool();
|
||||
|
||||
if (jsonObject.contains("min_ledger"))
|
||||
input.minLedger = jv.at("min_ledger").as_int64();
|
||||
if (jsonObject.contains(JS(min_ledger)))
|
||||
input.minLedger = jv.at(JS(min_ledger)).as_int64();
|
||||
|
||||
if (jsonObject.contains("max_ledger"))
|
||||
input.maxLedger = jv.at("max_ledger").as_int64();
|
||||
if (jsonObject.contains(JS(max_ledger)))
|
||||
input.maxLedger = jv.at(JS(max_ledger)).as_int64();
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <backend/BackendInterface.h>
|
||||
#include <rpc/RPCHelpers.h>
|
||||
#include <rpc/common/Types.h>
|
||||
#include <rpc/common/Validators.h>
|
||||
|
||||
@@ -60,10 +61,10 @@ public:
|
||||
spec() const
|
||||
{
|
||||
static const RpcSpec rpcSpec = {
|
||||
{"transaction", validation::Required{}, validation::Uint256HexStringValidator},
|
||||
{"binary", validation::Type<bool>{}},
|
||||
{"min_ledger", validation::Type<uint32_t>{}},
|
||||
{"max_ledger", validation::Type<uint32_t>{}},
|
||||
{JS(transaction), validation::Required{}, validation::Uint256HexStringValidator},
|
||||
{JS(binary), validation::Type<bool>{}},
|
||||
{JS(min_ledger), validation::Type<uint32_t>{}},
|
||||
{JS(max_ledger), validation::Type<uint32_t>{}},
|
||||
};
|
||||
|
||||
return rpcSpec;
|
||||
|
||||
@@ -429,6 +429,7 @@ TEST_F(RPCAccountLinesHandlerTest, DefaultParameterTest)
|
||||
ACCOUNT));
|
||||
auto const correctOutput =
|
||||
R"({
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"ledger_hash": "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
||||
"ledger_index": 30,
|
||||
"validated": true,
|
||||
@@ -624,6 +625,7 @@ TEST_F(RPCAccountLinesHandlerTest, EmptyChannel)
|
||||
TEST_F(RPCAccountLinesHandlerTest, OptionalResponseField)
|
||||
{
|
||||
constexpr static auto correctOutput = R"({
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"ledger_hash": "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
||||
"ledger_index": 30,
|
||||
"validated": true,
|
||||
|
||||
@@ -213,7 +213,8 @@ TEST_F(RPCTransactionEntryHandlerTest, NormalPath)
|
||||
"hash":"2E2FBAAFF767227FE4381C4BE9855986A6B9F96C62F6E443731AB36F7BBB8A08"
|
||||
},
|
||||
"ledger_index":30,
|
||||
"ledger_hash":"E6DBAFC99223B42257915A63DFC6B0C032D4070F9A574B255AD97466726FC322"
|
||||
"ledger_hash":"E6DBAFC99223B42257915A63DFC6B0C032D4070F9A574B255AD97466726FC322",
|
||||
"validated":true
|
||||
})";
|
||||
auto const rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||
TransactionAndMetadata tx;
|
||||
|
||||
@@ -193,7 +193,8 @@ TEST_F(RPCTxTest, DefaultParameter)
|
||||
"TransactionResult":"tesSUCCESS"
|
||||
},
|
||||
"date":123456,
|
||||
"ledger_index":100
|
||||
"ledger_index":100,
|
||||
"validated": true
|
||||
})";
|
||||
auto const rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||
TransactionAndMetadata tx;
|
||||
@@ -225,7 +226,8 @@ TEST_F(RPCTxTest, ReturnBinary)
|
||||
"tx":"120007240000006464400000000000012C65D5071AFD498D00000158415500000000C1F76FF6ECB0BAC600000000D31252CF902EF8DD8451243869B38667CBD89DF368400000000000000273047465737481144B4E9C06F24296074F7BC48F92A97916C6DC5EA9",
|
||||
"hash":"05FB0EB4B899F056FA095537C5817163801F544BAFCEA39C995D76DB4D16F9DD",
|
||||
"date":123456,
|
||||
"ledger_index":100
|
||||
"ledger_index":100,
|
||||
"validated": true
|
||||
})";
|
||||
auto const rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||
TransactionAndMetadata tx;
|
||||
|
||||
Reference in New Issue
Block a user