From 1da875a12a45b3b6b63e411caf08a59f74f71891 Mon Sep 17 00:00:00 2001 From: nkramer44 Date: Thu, 13 Jul 2023 12:36:00 -0400 Subject: [PATCH] Remove tfTransferable check in NfTokenMint (#449) * remove the check in `NfTokenMint` that ensures tfTransferable is set if TransferFee is set. * add test for setting TransferFee but not tfTransferable * checkstyle --- .../model/transactions/NfTokenMint.java | 11 ---------- .../model/transactions/NfTokenMintTest.java | 20 +++++++++---------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/NfTokenMint.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/NfTokenMint.java index fb2775c4f..26ee8f36b 100644 --- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/NfTokenMint.java +++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/NfTokenMint.java @@ -107,15 +107,4 @@ static ImmutableNfTokenMint.Builder builder() { default NfTokenMintFlags flags() { return NfTokenMintFlags.empty(); } - - /** - * For secondary sale/brokered mode, tfTransferable flag must be set. - */ - @Value.Check - default void checkIfFlagIsSet() { - if (transferFee().isPresent()) { - Preconditions.checkArgument(flags().tfTransferable(), - "tfTransferable flag must be set for secondary sale."); - } - } } diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/NfTokenMintTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/NfTokenMintTest.java index cecd8ded0..16a0ea347 100644 --- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/NfTokenMintTest.java +++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/NfTokenMintTest.java @@ -21,6 +21,7 @@ */ import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatNoException; import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.io.BaseEncoding; @@ -78,16 +79,15 @@ public void buildTxWithTransferFee() { } @Test - public void transferFeeWithoutFlagSet() { - assertThrows( - IllegalArgumentException.class, - () -> NfTokenMint.builder() - .fee(XrpCurrencyAmount.ofDrops(1)) - .account(Address.of("rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59Ba")) - .tokenTaxon(UnsignedLong.valueOf(146999694L)) - .transferFee(TransferFee.of(UnsignedInteger.valueOf(1000))) - .build(), - "tfTransferable flag must be set for secondary sale." + public void transferFeeWithoutFlagSetDoesNotThrow() { + assertThatNoException().isThrownBy(() -> + NfTokenMint.builder() + .fee(XrpCurrencyAmount.ofDrops(1)) + .account(Address.of("rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59Ba")) + .tokenTaxon(UnsignedLong.valueOf(146999694L)) + .transferFee(TransferFee.of(UnsignedInteger.valueOf(1000))) + .flags(NfTokenMintFlags.empty()) + .build() ); }