add nft_page (#637)

Fixes #638
This commit is contained in:
cyan317
2023-05-15 13:00:35 +01:00
committed by GitHub
parent 9adcaeb21b
commit 14978ca91d
3 changed files with 16 additions and 4 deletions

View File

@@ -189,6 +189,7 @@ tag_invoke(boost::json::value_to_tag<LedgerEntryHandler::Input>, boost::json::va
{JS(payment_channel), ripple::ltPAYCHAN},
{JS(deposit_preauth), ripple::ltDEPOSIT_PREAUTH},
{JS(ticket), ripple::ltTICKET},
{JS(nft_page), ripple::ltNFTOKEN_PAGE},
};
auto const indexFieldType =

View File

@@ -28,7 +28,6 @@ namespace RPC {
/**
* @brief The ledger_entry method returns a single ledger object from the XRP Ledger in its raw format.
* The clio has not supported: nft_page
*
* For more details see: https://xrpl.org/ledger_entry.html
*/
@@ -47,7 +46,6 @@ public:
bool validated = true;
};
// TODO: nft_page has not been implemented
struct Input
{
std::optional<std::string> ledgerHash;
@@ -156,6 +154,7 @@ public:
{JS(ticket_seq), validation::Required{}, validation::Type<uint32_t>{}},
},
}},
{JS(nft_page), validation::Uint256HexStringValidator},
};
return rpcSpec;

View File

@@ -34,6 +34,7 @@ constexpr static auto ACCOUNT2 = "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun";
constexpr static auto RANGEMIN = 10;
constexpr static auto RANGEMAX = 30;
constexpr static auto LEDGERHASH = "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652";
constexpr static auto TOKENID = "000827103B94ECBB7BF0A0A6ED62B3607801A27B65F4679F4AD1D4850000C0EA";
class RPCLedgerEntryTest : public HandlerBaseTest
{
@@ -572,11 +573,11 @@ struct IndexTest : public HandlerBaseTest, public WithParamInterface<std::string
};
};
// content of index, payment_channel, check fields is ledger index
// content of index, payment_channel, check, nft_page fields is ledger index
INSTANTIATE_TEST_CASE_P(
RPCLedgerEntryGroup3,
IndexTest,
Values("index", "payment_channel", "check"),
Values("index", "payment_channel", "check", "nft_page"),
IndexTest::NameGenerator{});
TEST_P(IndexTest, InvalidIndexUint256)
@@ -697,6 +698,17 @@ generateTestValuesForNormalPathTest()
INDEX1),
ripple::uint256{INDEX1},
CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 200, 300, INDEX1, 400)},
NormalPathTestBundle{
"Nft_page",
fmt::format(
R"({{
"binary": true,
"nft_page": "{}"
}})",
INDEX1),
ripple::uint256{INDEX1},
CreateNFTTokenPage(
std::vector{std::make_pair<std::string, std::string>(TOKENID, "www.ok.com")}, std::nullopt)},
NormalPathTestBundle{
"Check",
fmt::format(