mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 14:50:54 +00:00
Add ShareTotal to ledger_entry output
This commit is contained in:
@@ -90,6 +90,7 @@ JSS(SendMax); // in: TransactionSign
|
||||
JSS(Sequence); // in/out: TransactionSign; field.
|
||||
JSS(SetFlag); // field.
|
||||
JSS(Share); // out: Vault
|
||||
JSS(ShareTotal); // out: Vault
|
||||
JSS(Signer); // field.
|
||||
JSS(Signers); // field.
|
||||
JSS(SigningPubKey); // field.
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/beast/unit_test/suite.h>
|
||||
#include <xrpl/json/json_forwards.h>
|
||||
#include <xrpl/protocol/Asset.h>
|
||||
#include <xrpl/protocol/Feature.h>
|
||||
#include <xrpl/protocol/STAmount.h>
|
||||
|
||||
@@ -894,6 +894,37 @@ struct LedgerEntry
|
||||
LedgerEntryType expectedType;
|
||||
};
|
||||
|
||||
template <LedgerEntryType Type>
|
||||
static void
|
||||
supplementJson(
|
||||
ReadView const&,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
Json::Value&)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
sle->getType() == Type, "ripple::supplementJson : matching type");
|
||||
}
|
||||
|
||||
template <>
|
||||
void
|
||||
supplementJson<ltVAULT>(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& vault,
|
||||
Json::Value& node)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
vault->getType() == ltVAULT,
|
||||
"ripple::supplementJson<ltVAULT> : matching type");
|
||||
|
||||
auto const share = vault->at(sfMPTokenIssuanceID);
|
||||
auto const sleIssuance = view.read(keylet::mptIssuance(share));
|
||||
if (!sleIssuance)
|
||||
return;
|
||||
|
||||
node[jss::ShareTotal] =
|
||||
Number(sleIssuance->getFieldU64(sfOutstandingAmount));
|
||||
}
|
||||
|
||||
// {
|
||||
// ledger_hash : <ledger>
|
||||
// ledger_index : <ledger_index>
|
||||
@@ -1033,6 +1064,8 @@ doLedgerEntry(RPC::JsonContext& context)
|
||||
else
|
||||
{
|
||||
jvResult[jss::node] = sleNode->getJson(JsonOptions::none);
|
||||
if (sleNode->getType() == ltVAULT)
|
||||
supplementJson<ltVAULT>(*lpLedger, sleNode, jvResult[jss::node]);
|
||||
jvResult[jss::index] = to_string(uNodeIndex);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user