Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing nft_offer enum (#541) #545

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ enum AccountObjectType {
/**
* State account object type.
*/
STATE("state");
STATE("state"),
/**
* NFT offer object type.
*/
NFT_OFFER("nft_offer");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.xrpl.xrpl4j.model.ledger;

import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.xrpl.xrpl4j.model.AbstractJsonTest;
import org.xrpl.xrpl4j.model.flags.NfTokenOfferFlags;
import org.xrpl.xrpl4j.model.transactions.Address;
import org.xrpl.xrpl4j.model.transactions.Hash256;
import org.xrpl.xrpl4j.model.transactions.NfTokenId;
import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.primitives.UnsignedInteger;
import com.google.common.primitives.UnsignedLong;

class NfTokenOfferObjectJsonTests extends AbstractJsonTest{
@Test
void testFullJson() throws JSONException, JsonProcessingException {
String json = "{\n" + //
"\"Amount\": \"0\",\n" + //
"\"Destination\": \"rPt4GkSQ2Zi2c8NPSJ6SeLGyernWPvWpf6\",\n" + //
"\"Flags\": 1,\n" + //
"\"LedgerEntryType\": \"NFTokenOffer\",\n" + //
"\"NFTokenID\": \"0008001EFB09BCE5738AE4C7ECEAADD69DB80B16F0DAF7AE619C329B00232900\",\n" + //
"\"NFTokenOfferNode\": \"0\",\n" + //
"\"Owner\": \"rpQqJo7thmNWAJCDne6jp2WreZ9VQgrbAd\",\n" + //
"\"OwnerNode\": \"0\",\n" + //
"\"PreviousTxnID\": \"0B447AB1C8793CB5976E15EC888CA8C8CFF0C1A2865E6F21F3D257372A1E84C5\",\n" + //
"\"PreviousTxnLgrSeq\": 2305005,\n" + //
"\"index\": \"DD5BB396D4901E69CAD478A1CFDEFBC6154E58D9CEF211513376E3C2CE3CEF46\"\n" + //
"}";

NfTokenOfferObject nftOffer = NfTokenOfferObject.builder()
.amount(XrpCurrencyAmount.of(UnsignedLong.valueOf("0")))
.destination(Address.of("rPt4GkSQ2Zi2c8NPSJ6SeLGyernWPvWpf6"))
.flags(NfTokenOfferFlags.of(1))
.nfTokenId(NfTokenId.of("0008001EFB09BCE5738AE4C7ECEAADD69DB80B16F0DAF7AE619C329B00232900"))
.offerNode("1")
.owner(Address.of("rpQqJo7thmNWAJCDne6jp2WreZ9VQgrbAd"))
.ownerNode("0")
.previousTransactionId(Hash256.of("0B447AB1C8793CB5976E15EC888CA8C8CFF0C1A2865E6F21F3D257372A1E84C5"))
.previousTransactionLedgerSequence(UnsignedInteger.valueOf("2305005"))
.index(Hash256.of("DD5BB396D4901E69CAD478A1CFDEFBC6154E58D9CEF211513376E3C2CE3CEF46"))
.build();

assertCanSerializeAndDeserialize(nftOffer, json);
}
}
Loading