mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 11:55:51 +00:00
Compare commits
1 Commits
8c8a7ff3b8
...
release/2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4940d463dc |
@@ -29,6 +29,7 @@
|
|||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <ripple/basics/base_uint.h>
|
#include <ripple/basics/base_uint.h>
|
||||||
#include <ripple/protocol/AccountID.h>
|
#include <ripple/protocol/AccountID.h>
|
||||||
|
#include <ripple/protocol/ErrorCodes.h>
|
||||||
#include <ripple/protocol/UintTypes.h>
|
#include <ripple/protocol/UintTypes.h>
|
||||||
#include <ripple/protocol/tokens.h>
|
#include <ripple/protocol/tokens.h>
|
||||||
|
|
||||||
@@ -140,8 +141,12 @@ CustomValidator CurrencyValidator =
|
|||||||
if (!value.is_string())
|
if (!value.is_string())
|
||||||
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
|
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
|
||||||
|
|
||||||
|
auto const currencyStr = boost::json::value_to<std::string>(value);
|
||||||
|
if (currencyStr.empty())
|
||||||
|
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "IsEmpty"}};
|
||||||
|
|
||||||
ripple::Currency currency;
|
ripple::Currency currency;
|
||||||
if (!ripple::to_currency(currency, boost::json::value_to<std::string>(value)))
|
if (!ripple::to_currency(currency, currencyStr))
|
||||||
return Error{Status{ClioError::rpcMALFORMED_CURRENCY, "malformedCurrency"}};
|
return Error{Status{ClioError::rpcMALFORMED_CURRENCY, "malformedCurrency"}};
|
||||||
|
|
||||||
return MaybeError{};
|
return MaybeError{};
|
||||||
|
|||||||
@@ -160,6 +160,22 @@ generateTestValuesForParametersTest()
|
|||||||
"invalidParams",
|
"invalidParams",
|
||||||
"Invalid parameters."
|
"Invalid parameters."
|
||||||
},
|
},
|
||||||
|
GetAggregatePriceParamTestCaseBundle{
|
||||||
|
"emtpy_base_asset",
|
||||||
|
R"({
|
||||||
|
"quote_asset" : "USD",
|
||||||
|
"base_asset": "",
|
||||||
|
"oracles":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD",
|
||||||
|
"oracle_document_id": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})",
|
||||||
|
"invalidParams",
|
||||||
|
"Invalid parameters."
|
||||||
|
},
|
||||||
GetAggregatePriceParamTestCaseBundle{
|
GetAggregatePriceParamTestCaseBundle{
|
||||||
"invalid_base_asset2",
|
"invalid_base_asset2",
|
||||||
R"({
|
R"({
|
||||||
@@ -207,6 +223,22 @@ generateTestValuesForParametersTest()
|
|||||||
"invalidParams",
|
"invalidParams",
|
||||||
"Invalid parameters."
|
"Invalid parameters."
|
||||||
},
|
},
|
||||||
|
GetAggregatePriceParamTestCaseBundle{
|
||||||
|
"empty_quote_asset",
|
||||||
|
R"({
|
||||||
|
"quote_asset" : "",
|
||||||
|
"base_asset": "USD",
|
||||||
|
"oracles":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD",
|
||||||
|
"oracle_document_id": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})",
|
||||||
|
"invalidParams",
|
||||||
|
"Invalid parameters."
|
||||||
|
},
|
||||||
GetAggregatePriceParamTestCaseBundle{
|
GetAggregatePriceParamTestCaseBundle{
|
||||||
"invalid_quote_asset2",
|
"invalid_quote_asset2",
|
||||||
R"({
|
R"({
|
||||||
|
|||||||
Reference in New Issue
Block a user