mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -31,7 +31,7 @@ namespace rpc {
|
||||
/**
|
||||
* @brief Default API version to use if no version is specified by clients
|
||||
*/
|
||||
static constexpr uint32_t API_VERSION_DEFAULT = 2u;
|
||||
static constexpr uint32_t API_VERSION_DEFAULT = 1u;
|
||||
|
||||
/**
|
||||
* @brief Minimum API version supported by this build
|
||||
|
||||
@@ -56,10 +56,6 @@ public:
|
||||
if (ctx.method == "subscribe" || ctx.method == "unsubscribe")
|
||||
return false;
|
||||
|
||||
// TODO: if needed, make configurable with json config option
|
||||
if (ctx.apiVersion == 1)
|
||||
return true;
|
||||
|
||||
if (handlerProvider_->isClioOnly(ctx.method))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -80,10 +80,17 @@ AccountInfoHandler::process(AccountInfoHandler::Input input, Context const& ctx)
|
||||
}
|
||||
|
||||
return Output(
|
||||
lgrInfo.seq, ripple::strHex(lgrInfo.hash), sle, isDisallowIncomingEnabled, isClawbackEnabled, signerList);
|
||||
lgrInfo.seq,
|
||||
ripple::strHex(lgrInfo.hash),
|
||||
sle,
|
||||
isDisallowIncomingEnabled,
|
||||
isClawbackEnabled,
|
||||
ctx.apiVersion,
|
||||
signerList);
|
||||
}
|
||||
|
||||
return Output(lgrInfo.seq, ripple::strHex(lgrInfo.hash), sle, isDisallowIncomingEnabled, isClawbackEnabled);
|
||||
return Output(
|
||||
lgrInfo.seq, ripple::strHex(lgrInfo.hash), sle, isDisallowIncomingEnabled, isClawbackEnabled, ctx.apiVersion);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -138,12 +145,10 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, AccountInfoHandl
|
||||
std::cend(output.signerLists.value()),
|
||||
std::back_inserter(signers),
|
||||
[](auto const& signerList) { return toJson(signerList); });
|
||||
// version 2 puts the signer_lists out of the account_data
|
||||
jv.as_object()[JS(signer_lists)] = signers;
|
||||
// this is a temporary fix to support the clients that still expect v1 api(the signer_lists under
|
||||
// account_data)
|
||||
// TODO: we need to deprecate the duplicate later
|
||||
jv.as_object()[JS(account_data)].as_object()[JS(signer_lists)] = std::move(signers);
|
||||
if (output.apiVersion == 1)
|
||||
jv.as_object()[JS(account_data)].as_object()[JS(signer_lists)] = std::move(signers);
|
||||
else
|
||||
jv.as_object()[JS(signer_lists)] = signers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
ripple::STLedgerEntry accountData;
|
||||
bool isDisallowIncomingEnabled = false;
|
||||
bool isClawbackEnabled = false;
|
||||
uint32_t apiVersion;
|
||||
std::optional<std::vector<ripple::STLedgerEntry>> signerLists;
|
||||
// validated should be sent via framework
|
||||
bool validated = true;
|
||||
@@ -54,12 +55,14 @@ public:
|
||||
ripple::STLedgerEntry sle,
|
||||
bool isDisallowIncomingEnabled,
|
||||
bool isClawbackEnabled,
|
||||
uint32_t version,
|
||||
std::optional<std::vector<ripple::STLedgerEntry>> signerLists = std::nullopt)
|
||||
: ledgerIndex(ledgerId)
|
||||
, ledgerHash(std::move(ledgerHash))
|
||||
, accountData(std::move(sle))
|
||||
, isDisallowIncomingEnabled(isDisallowIncomingEnabled)
|
||||
, isClawbackEnabled(isClawbackEnabled)
|
||||
, apiVersion(version)
|
||||
, signerLists(std::move(signerLists))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ LedgerEntryHandler::process(LedgerEntryHandler::Input input, Context const& ctx)
|
||||
else
|
||||
{
|
||||
// Must specify 1 of the following fields to indicate what type
|
||||
if (ctx.apiVersion == 1)
|
||||
return Error{Status{RippledError::rpcINVALID_PARAMS}};
|
||||
return Error{Status{ClioError::rpcUNKNOWN_OPTION}};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user