mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -163,10 +163,12 @@ public:
|
||||
static auto const rpcSpec = RpcSpec{
|
||||
{JS(ledger_hash), validation::Uint256HexStringValidator},
|
||||
{JS(ledger_index), validation::LedgerIndexValidator},
|
||||
// validate quoteAsset in accordance to the currency code found in XRPL doc:
|
||||
// validate quoteAsset and base_asset in accordance to the currency code found in XRPL doc:
|
||||
// https://xrpl.org/docs/references/protocol/data-types/currency-formats#currency-codes
|
||||
// usually Clio returns rpcMALFORMED_CURRENCY , return InvalidParam here just to mimic rippled
|
||||
{JS(base_asset), validation::Required{}, validation::Type<std::string>{}},
|
||||
{JS(base_asset),
|
||||
validation::Required{},
|
||||
meta::WithCustomError{validation::CurrencyValidator, Status(RippledError::rpcINVALID_PARAMS)}},
|
||||
{JS(quote_asset),
|
||||
validation::Required{},
|
||||
meta::WithCustomError{validation::CurrencyValidator, Status(RippledError::rpcINVALID_PARAMS)}},
|
||||
|
||||
@@ -144,6 +144,38 @@ generateTestValuesForParametersTest()
|
||||
"invalidParams",
|
||||
"Required field 'base_asset' missing"
|
||||
},
|
||||
GetAggregatePriceParamTestCaseBundle{
|
||||
"invalid_base_asset",
|
||||
R"({
|
||||
"quote_asset" : "USD",
|
||||
"base_asset": "asdf",
|
||||
"oracles":
|
||||
[
|
||||
{
|
||||
"account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD",
|
||||
"oracle_document_id": 2
|
||||
}
|
||||
]
|
||||
})",
|
||||
"invalidParams",
|
||||
"Invalid parameters."
|
||||
},
|
||||
GetAggregatePriceParamTestCaseBundle{
|
||||
"invalid_base_asset2",
|
||||
R"({
|
||||
"quote_asset" : "USD",
|
||||
"base_asset": "+aa",
|
||||
"oracles":
|
||||
[
|
||||
{
|
||||
"account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD",
|
||||
"oracle_document_id": 2
|
||||
}
|
||||
]
|
||||
})",
|
||||
"invalidParams",
|
||||
"Invalid parameters."
|
||||
},
|
||||
GetAggregatePriceParamTestCaseBundle{
|
||||
"no_quote_asset",
|
||||
R"({
|
||||
|
||||
Reference in New Issue
Block a user