Skip to content

Commit

Permalink
use mptJson
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnxie999 committed Oct 15, 2024
1 parent ac45342 commit af29f41
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/xrpld/rpc/handlers/LedgerEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,18 +668,18 @@ doLedgerEntry(RPC::JsonContext& context)
else if (context.params.isMember(jss::mptoken))
{
expectedType = ltMPTOKEN;
if (!context.params[jss::mptoken].isObject())
auto const& mptJson = context.params[jss::mptoken];
if (!mptJson.isObject())
{
if (!uNodeIndex.parseHex(
context.params[jss::mptoken].asString()))
if (!uNodeIndex.parseHex(mptJson.asString()))
{
uNodeIndex = beast::zero;
jvResult[jss::error] = "malformedRequest";
}
}
else if (
!context.params[jss::mptoken].isMember(jss::mpt_issuance_id) ||
!context.params[jss::mptoken].isMember(jss::account))
!mptJson.isMember(jss::mpt_issuance_id) ||
!mptJson.isMember(jss::account))
{
jvResult[jss::error] = "malformedRequest";
}
Expand All @@ -688,16 +688,15 @@ doLedgerEntry(RPC::JsonContext& context)
try
{
auto const mptIssuanceIdStr =
context.params[jss::mptoken][jss::mpt_issuance_id]
.asString();
mptJson[jss::mpt_issuance_id].asString();

uint192 mptIssuanceID;
if (!mptIssuanceID.parseHex(mptIssuanceIdStr))
Throw<std::runtime_error>(
"Cannot parse mpt_issuance_id");

auto const account = parseBase58<AccountID>(
context.params[jss::mptoken][jss::account].asString());
mptJson[jss::account].asString());

if (!account || account->isZero())
jvResult[jss::error] = "malformedAddress";
Expand Down

0 comments on commit af29f41

Please sign in to comment.