mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Introduce MPT support (XLS-33d): (#5143)
Amendment: - MPTokensV1 New Transactions: - MPTokenIssuanceCreate - MPTokenIssuanceDestroy - MPTokenIssuanceSet - MPTokenAuthorize Modified Transactions: - Payment - Clawback New Objects: - MPTokenIssuance - MPToken API updates: - ledger_entry - account_objects - ledger_data Other: - Add += and -= operators to ValueProxy Read full spec: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033d-multi-purpose-tokens --------- Co-authored-by: Shawn Xie <shawnxie920@gmail.com> Co-authored-by: Howard Hinnant <howard.hinnant@gmail.com> Co-authored-by: Ed Hennis <ed@ripple.com> Co-authored-by: John Freeman <jfreeman08@gmail.com>
This commit is contained in:
committed by
GitHub
parent
63209c2646
commit
23c37fa506
@@ -644,6 +644,72 @@ doLedgerEntry(RPC::JsonContext& context)
|
||||
uNodeIndex = keylet::oracle(*account, *documentID).key;
|
||||
}
|
||||
}
|
||||
else if (context.params.isMember(jss::mpt_issuance))
|
||||
{
|
||||
expectedType = ltMPTOKEN_ISSUANCE;
|
||||
auto const unparsedMPTIssuanceID =
|
||||
context.params[jss::mpt_issuance];
|
||||
if (unparsedMPTIssuanceID.isString())
|
||||
{
|
||||
uint192 mptIssuanceID;
|
||||
if (!mptIssuanceID.parseHex(unparsedMPTIssuanceID.asString()))
|
||||
{
|
||||
uNodeIndex = beast::zero;
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
}
|
||||
else
|
||||
uNodeIndex = keylet::mptIssuance(mptIssuanceID).key;
|
||||
}
|
||||
else
|
||||
{
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
}
|
||||
}
|
||||
else if (context.params.isMember(jss::mptoken))
|
||||
{
|
||||
expectedType = ltMPTOKEN;
|
||||
auto const& mptJson = context.params[jss::mptoken];
|
||||
if (!mptJson.isObject())
|
||||
{
|
||||
if (!uNodeIndex.parseHex(mptJson.asString()))
|
||||
{
|
||||
uNodeIndex = beast::zero;
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
}
|
||||
}
|
||||
else if (
|
||||
!mptJson.isMember(jss::mpt_issuance_id) ||
|
||||
!mptJson.isMember(jss::account))
|
||||
{
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
auto const mptIssuanceIdStr =
|
||||
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>(
|
||||
mptJson[jss::account].asString());
|
||||
|
||||
if (!account || account->isZero())
|
||||
jvResult[jss::error] = "malformedAddress";
|
||||
else
|
||||
uNodeIndex =
|
||||
keylet::mptoken(mptIssuanceID, *account).key;
|
||||
}
|
||||
catch (std::runtime_error const&)
|
||||
{
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (context.params.isMember("params") &&
|
||||
|
||||
Reference in New Issue
Block a user