|
| 1 | +package org.xrpl.xrpl4j.model.ledger; |
| 2 | + |
| 3 | +import org.json.JSONException; |
| 4 | +import org.junit.jupiter.api.Test; |
| 5 | +import org.xrpl.xrpl4j.model.AbstractJsonTest; |
| 6 | +import org.xrpl.xrpl4j.model.flags.NfTokenOfferFlags; |
| 7 | +import org.xrpl.xrpl4j.model.transactions.Address; |
| 8 | +import org.xrpl.xrpl4j.model.transactions.Hash256; |
| 9 | +import org.xrpl.xrpl4j.model.transactions.NfTokenId; |
| 10 | +import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; |
| 11 | +import com.fasterxml.jackson.core.JsonProcessingException; |
| 12 | +import com.google.common.primitives.UnsignedInteger; |
| 13 | +import com.google.common.primitives.UnsignedLong; |
| 14 | + |
| 15 | +class NfTokenOfferObjectJsonTests extends AbstractJsonTest{ |
| 16 | + @Test |
| 17 | + void testFullJson() throws JSONException, JsonProcessingException { |
| 18 | + String json = "{\n" + // |
| 19 | + "\"Amount\": \"0\",\n" + // |
| 20 | + "\"Destination\": \"rPt4GkSQ2Zi2c8NPSJ6SeLGyernWPvWpf6\",\n" + // |
| 21 | + "\"Flags\": 1,\n" + // |
| 22 | + "\"LedgerEntryType\": \"NFTokenOffer\",\n" + // |
| 23 | + "\"NFTokenID\": \"0008001EFB09BCE5738AE4C7ECEAADD69DB80B16F0DAF7AE619C329B00232900\",\n" + // |
| 24 | + "\"NFTokenOfferNode\": \"0\",\n" + // |
| 25 | + "\"Owner\": \"rpQqJo7thmNWAJCDne6jp2WreZ9VQgrbAd\",\n" + // |
| 26 | + "\"OwnerNode\": \"0\",\n" + // |
| 27 | + "\"PreviousTxnID\": \"0B447AB1C8793CB5976E15EC888CA8C8CFF0C1A2865E6F21F3D257372A1E84C5\",\n" + // |
| 28 | + "\"PreviousTxnLgrSeq\": 2305005,\n" + // |
| 29 | + "\"index\": \"DD5BB396D4901E69CAD478A1CFDEFBC6154E58D9CEF211513376E3C2CE3CEF46\"\n" + // |
| 30 | + "}"; |
| 31 | + |
| 32 | + NfTokenOfferObject nftOffer = NfTokenOfferObject.builder() |
| 33 | + .amount(XrpCurrencyAmount.of(UnsignedLong.valueOf("0"))) |
| 34 | + .destination(Address.of("rPt4GkSQ2Zi2c8NPSJ6SeLGyernWPvWpf6")) |
| 35 | + .flags(NfTokenOfferFlags.of(1)) |
| 36 | + .nfTokenId(NfTokenId.of("0008001EFB09BCE5738AE4C7ECEAADD69DB80B16F0DAF7AE619C329B00232900")) |
| 37 | + .offerNode("1") |
| 38 | + .owner(Address.of("rpQqJo7thmNWAJCDne6jp2WreZ9VQgrbAd")) |
| 39 | + .ownerNode("0") |
| 40 | + .previousTransactionId(Hash256.of("0B447AB1C8793CB5976E15EC888CA8C8CFF0C1A2865E6F21F3D257372A1E84C5")) |
| 41 | + .previousTransactionLedgerSequence(UnsignedInteger.valueOf("2305005")) |
| 42 | + .index(Hash256.of("DD5BB396D4901E69CAD478A1CFDEFBC6154E58D9CEF211513376E3C2CE3CEF46")) |
| 43 | + .build(); |
| 44 | + |
| 45 | + assertCanSerializeAndDeserialize(nftOffer, json); |
| 46 | + } |
| 47 | +} |
0 commit comments