|
26 | 26 | #include <xrpl/basics/Blob.h> |
27 | 27 | #include <xrpl/basics/Slice.h> |
28 | 28 | #include <xrpl/basics/base_uint.h> |
| 29 | +#include <xrpl/basics/strHex.h> |
29 | 30 | #include <xrpl/protocol/AccountID.h> |
30 | 31 | #include <xrpl/protocol/SField.h> |
31 | 32 | #include <xrpl/protocol/STObject.h> |
@@ -471,17 +472,19 @@ TEST_F(NFTHelpersTest, NFTDataFromLedgerObject) |
471 | 472 | ripple::Blob const uri1Blob(url1.begin(), url1.end()); |
472 | 473 | ripple::Blob const uri2Blob(url2.begin(), url2.end()); |
473 | 474 |
|
| 475 | + auto const account = getAccountIdWithString(kACCOUNT); |
474 | 476 | auto const nftPage = createNftTokenPage({{kNFT_ID, url1}, {kNFT_ID2, url2}}, std::nullopt); |
475 | 477 | auto const serializerNftPage = nftPage.getSerializer(); |
| 478 | + auto const blob = |
| 479 | + std::string(static_cast<char const*>(serializerNftPage.getDataPtr()), serializerNftPage.getDataLength()); |
476 | 480 |
|
477 | | - int constexpr kSEQ{5}; |
478 | | - auto const account = getAccountIdWithString(kACCOUNT); |
| 481 | + // key is a token made up from owner's account ID followed by unused (in Clio) value described here: |
| 482 | + // https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0020-non-fungible-tokens#tokenpage-id-format |
| 483 | + auto constexpr kEXTRA_BYTES = "000000000000"; |
| 484 | + auto const key = std::string(std::begin(account), std::end(account)) + kEXTRA_BYTES; |
479 | 485 |
|
480 | | - auto const nftDatas = etl::getNFTDataFromObj( |
481 | | - kSEQ, |
482 | | - std::string(reinterpret_cast<char const*>(account.data()), ripple::AccountID::size()), |
483 | | - std::string(static_cast<char const*>(serializerNftPage.getDataPtr()), serializerNftPage.getDataLength()) |
484 | | - ); |
| 486 | + uint32_t constexpr kSEQ{5}; |
| 487 | + auto const nftDatas = etl::getNFTDataFromObj(kSEQ, key, blob); |
485 | 488 |
|
486 | 489 | EXPECT_EQ(nftDatas.size(), 2); |
487 | 490 | EXPECT_EQ(nftDatas[0].tokenID, ripple::uint256(kNFT_ID)); |
|
0 commit comments