diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlags.java
index 37e8a3889..69ffe4ca4 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlags.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,10 +24,11 @@
import org.xrpl.xrpl4j.model.transactions.AccountSet;
/**
- * {@link TransactionFlags} for {@link AccountSet} transactions. Note that using these directly is
- * discouraged, but can be useful when setting multiple flags for an account.
+ * {@link TransactionFlags} for {@link AccountSet} transactions. Note that using these directly is discouraged, but can
+ * be useful when setting multiple flags for an account.
*/
public class AccountSetTransactionFlags extends TransactionFlags {
+
/**
* Constant for an unset flag.
*/
@@ -63,6 +64,15 @@ public class AccountSetTransactionFlags extends TransactionFlags {
*/
protected static final AccountSetTransactionFlags ALLOW_XRP = new AccountSetTransactionFlags(0x00200000);
+ /**
+ * Constant {@link AccountSetTransactionFlags} for the {@code tfInnerBatchTxn} flag. This flag is used to indicate
+ * that a transaction is an inner transaction of a Batch.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public static final AccountSetTransactionFlags INNER_BATCH_TXN =
+ new AccountSetTransactionFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private AccountSetTransactionFlags(long value) {
super(value);
}
@@ -77,7 +87,8 @@ private static AccountSetTransactionFlags of(
boolean tfRequireAuth,
boolean tfOptionalAuth,
boolean tfDisallowXrp,
- boolean tfAllowXrp
+ boolean tfAllowXrp,
+ boolean tfInnerBatchTxn
) {
Preconditions.checkArgument(
!(tfRequireDestTag && tfOptionalDestTag),
@@ -101,7 +112,8 @@ private static AccountSetTransactionFlags of(
tfRequireAuth ? REQUIRE_AUTH : UNSET,
tfOptionalAuth ? OPTIONAL_AUTH : UNSET,
tfDisallowXrp ? DISALLOW_XRP : UNSET,
- tfAllowXrp ? ALLOW_XRP : UNSET
+ tfAllowXrp ? ALLOW_XRP : UNSET,
+ tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN : UNSET
).getValue()
);
}
@@ -135,8 +147,8 @@ public static AccountSetTransactionFlags of(long value) {
}
/**
- * Construct an empty instance of {@link AccountSetTransactionFlags}. Transactions with empty flags will
- * not be serialized with a {@code Flags} field.
+ * Construct an empty instance of {@link AccountSetTransactionFlags}. Transactions with empty flags will not be
+ * serialized with a {@code Flags} field.
*
* @return An empty {@link AccountSetTransactionFlags}.
*/
@@ -216,16 +228,29 @@ public boolean tfAllowXrp() {
return this.isSet(ALLOW_XRP);
}
+ /**
+ * Indicates that this transaction is an inner transaction of a Batch transaction.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(AccountSetTransactionFlags.INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link AccountSetTransactionFlags}.
*/
public static class Builder {
+
private boolean tfRequireDestTag = false;
private boolean tfOptionalDestTag = false;
private boolean tfRequireAuth = false;
private boolean tfOptionalAuth = false;
private boolean tfDisallowXrp = false;
private boolean tfAllowXrp = false;
+ private boolean tfInnerBatchTxn = false;
/**
* Set {@code tfRequireDestTag} to the given value.
@@ -287,6 +312,18 @@ public Builder tfAllowXrp() {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link AccountSetTransactionFlags} from the current boolean values.
*
@@ -300,7 +337,8 @@ public AccountSetTransactionFlags build() {
tfRequireAuth,
tfOptionalAuth,
tfDisallowXrp,
- tfAllowXrp
+ tfAllowXrp,
+ tfInnerBatchTxn
);
}
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlags.java
index 818467273..5dfea3f4d 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlags.java
@@ -26,6 +26,7 @@
* {@link TransactionFlags} for {@link AmmClawback} transactions.
*/
public class AmmClawbackFlags extends TransactionFlags {
+
/**
* Constant {@link AmmDepositFlags} for the {@code tfClawTwoAssets} flag.
*/
@@ -36,6 +37,12 @@ public class AmmClawbackFlags extends TransactionFlags {
*/
public static final AmmClawbackFlags UNSET = new AmmClawbackFlags(0L);
+ /**
+ * Constant {@link AmmClawbackFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final AmmClawbackFlags INNER_BATCH_TXN = new AmmClawbackFlags(
+ TransactionFlags.INNER_BATCH_TXN.getValue());
+
private AmmClawbackFlags(long value) {
super(value);
}
@@ -44,8 +51,8 @@ private AmmClawbackFlags() {
}
/**
- * Construct an empty instance of {@link AmmClawbackFlags}. Transactions with empty flags will
- * not be serialized with a {@code Flags} field.
+ * Construct an empty instance of {@link AmmClawbackFlags}. Transactions with empty flags will not be serialized with
+ * a {@code Flags} field.
*
* @return An empty {@link AmmClawbackFlags}.
*/
@@ -61,4 +68,13 @@ public static AmmClawbackFlags empty() {
public boolean tfClawTwoAssets() {
return this.isSet(CLAW_TWO_ASSETS);
}
+
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlags.java
index 570c2b903..728246293 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlags.java
@@ -47,6 +47,12 @@ public class AmmDepositFlags extends TransactionFlags {
*/
public static final AmmDepositFlags TWO_ASSET_IF_EMPTY = new AmmDepositFlags(0x00800000);
+ /**
+ * Constant {@link AmmDepositFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final AmmDepositFlags INNER_BATCH_TXN = new AmmDepositFlags(
+ TransactionFlags.INNER_BATCH_TXN.getValue());
+
private AmmDepositFlags(long value) {
super(value);
}
@@ -105,4 +111,13 @@ public boolean tfTwoAssetIfEmpty() {
return this.isSet(TWO_ASSET_IF_EMPTY);
}
-}
\ No newline at end of file
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
+}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlags.java
index dfdc55bb7..1d08e401d 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlags.java
@@ -52,6 +52,12 @@ public class AmmWithdrawFlags extends TransactionFlags {
*/
public static final AmmWithdrawFlags LIMIT_LP_TOKEN = new AmmWithdrawFlags(0x00400000);
+ /**
+ * Constant {@link AmmWithdrawFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final AmmWithdrawFlags INNER_BATCH_TXN = new AmmWithdrawFlags(
+ TransactionFlags.INNER_BATCH_TXN.getValue());
+
private AmmWithdrawFlags(long value) {
super(value);
}
@@ -118,4 +124,13 @@ public boolean tfOneAssetLpToken() {
public boolean tfLimitLpToken() {
return this.isSet(LIMIT_LP_TOKEN);
}
+
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/BatchFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/BatchFlags.java
new file mode 100644
index 000000000..193233008
--- /dev/null
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/BatchFlags.java
@@ -0,0 +1,275 @@
+package org.xrpl.xrpl4j.model.flags;
+
+/*-
+ * ========================LICENSE_START=================================
+ * xrpl4j :: core
+ * %%
+ * Copyright (C) 2020 - 2023 XRPL Foundation and its contributors
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * =========================LICENSE_END==================================
+ */
+
+import com.google.common.annotations.Beta;
+
+/**
+ * A set of {@link TransactionFlags} for Batch transactions.
+ *
+ *
Exactly one of the four batch mode flags must be set on a Batch transaction.
+ *
+ * This class will be marked {@link Beta} until the featureBatch amendment is enabled on mainnet.
+ * Its API is subject to change.
+ */
+@Beta
+public class BatchFlags extends TransactionFlags {
+
+ static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Constant {@link BatchFlags} for the {@code tfAllOrNothing} flag. All transactions must succeed for any of them to
+ * succeed.
+ */
+ public static final BatchFlags ALL_OR_NOTHING = new BatchFlags(0x00010000L);
+
+ /**
+ * Constant {@link BatchFlags} for the {@code tfOnlyOne} flag. The first transaction to succeed will be the only one
+ * to succeed.
+ */
+ public static final BatchFlags ONLY_ONE = new BatchFlags(0x00020000L);
+
+ /**
+ * Constant {@link BatchFlags} for the {@code tfUntilFailure} flag. All transactions will be applied until the first
+ * failure.
+ */
+ public static final BatchFlags UNTIL_FAILURE = new BatchFlags(0x00040000L);
+
+ /**
+ * Constant {@link BatchFlags} for the {@code tfIndependent} flag. All transactions will be applied, regardless of
+ * failure.
+ */
+ public static final BatchFlags INDEPENDENT = new BatchFlags(0x00080000L);
+
+ /**
+ * Constant for an unset flag.
+ */
+ public static final BatchFlags UNSET = new BatchFlags(0L);
+
+ /**
+ * Constant empty {@link TransactionFlags}.
+ */
+ public static final BatchFlags EMPTY = new BatchFlags();
+
+ private BatchFlags(long value) {
+ super(value);
+ }
+
+ private BatchFlags() {
+ super();
+ }
+
+ /**
+ * Construct {@link BatchFlags} with a given value.
+ *
+ * @param value The long-number encoded flags value of this {@link BatchFlags}.
+ *
+ * @return New {@link BatchFlags}.
+ */
+ public static BatchFlags of(long value) {
+ return new BatchFlags(value);
+ }
+
+ /**
+ * Constructs a {@link BatchFlags} object based on the specified boolean flags. Each flag corresponds to a specific
+ * mode or configuration for the batch processing.
+ *
+ * @param tfFullyCanonicalSig Indicates whether the `tfFullyCanonicalSig` flag should be set.
+ * @param tfAllOrNothing Indicates whether the `tfAllOrNothing` flag should be set.
+ * @param tfOnlyOne Indicates whether the `tfOnlyOne` flag should be set.
+ * @param tfUntilFailure Indicates whether the `tfUntilFailure` flag should be set.
+ * @param tfIndependent Indicates whether the `tfIndependent` flag should be set.
+ *
+ * @return A new {@link BatchFlags} instance with the corresponding flags set.
+ */
+ private static BatchFlags of(
+ boolean tfFullyCanonicalSig,
+ boolean tfAllOrNothing,
+ boolean tfOnlyOne,
+ boolean tfUntilFailure,
+ boolean tfIndependent
+ ) {
+ return new BatchFlags(of(
+ tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
+ tfAllOrNothing ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
+ tfOnlyOne ? ONLY_ONE : UNSET,
+ tfUntilFailure ? UNTIL_FAILURE : UNSET,
+ tfIndependent ? INDEPENDENT : UNSET
+ ).getValue());
+ }
+
+ public BatchFlags with(BatchFlags flags) {
+ return new BatchFlags(this.bitwiseOr(flags).getValue());
+ }
+
+ /**
+ * Construct {@link BatchFlags} for AllOrNothing mode.
+ *
+ * @return {@link BatchFlags} with tfAllOrNothing set.
+ */
+ public static BatchFlags ofAllOrNothing() {
+ return ALL_OR_NOTHING;
+ }
+
+ /**
+ * Construct {@link BatchFlags} for OnlyOne mode.
+ *
+ * @return {@link BatchFlags} with tfOnlyOne set.
+ */
+ public static BatchFlags ofOnlyOne() {
+ return ONLY_ONE;
+ }
+
+ /**
+ * Construct {@link BatchFlags} for UntilFailure mode.
+ *
+ * @return {@link BatchFlags} with tfUntilFailure set.
+ */
+ public static BatchFlags ofUntilFailure() {
+ return UNTIL_FAILURE;
+ }
+
+ /**
+ * Construct {@link BatchFlags} for Independent mode.
+ *
+ * @return {@link BatchFlags} with tfIndependent set.
+ */
+ public static BatchFlags ofIndependent() {
+ return INDEPENDENT;
+ }
+
+ /**
+ * Check if the {@code tfAllOrNothing} flag is set.
+ *
+ * @return {@code true} if {@code tfAllOrNothing} is set, otherwise {@code false}.
+ */
+ public boolean tfAllOrNothing() {
+ return this.isSet(ALL_OR_NOTHING);
+ }
+
+ /**
+ * Check if the {@code tfOnlyOne} flag is set.
+ *
+ * @return {@code true} if {@code tfOnlyOne} is set, otherwise {@code false}.
+ */
+ public boolean tfOnlyOne() {
+ return this.isSet(ONLY_ONE);
+ }
+
+ /**
+ * Check if the {@code tfUntilFailure} flag is set.
+ *
+ * @return {@code true} if {@code tfUntilFailure} is set, otherwise {@code false}.
+ */
+ public boolean tfUntilFailure() {
+ return this.isSet(UNTIL_FAILURE);
+ }
+
+ /**
+ * Check if the {@code tfIndependent} flag is set.
+ *
+ * @return {@code true} if {@code tfIndependent} is set, otherwise {@code false}.
+ */
+ public boolean tfIndependent() {
+ return this.isSet(INDEPENDENT);
+ }
+
+ /**
+ * A builder class for {@link PaymentFlags} flags.
+ */
+ public static class Builder {
+
+ boolean tfAllOrNothing = false;
+ boolean tfOnlyOne = false;
+ boolean tfUntilFailure = false;
+ boolean tfIndependent = false;
+
+ /**
+ * Private constructor to prevent direct instantiation of the {@link Builder} class. This ensures that the Builder
+ * can only be accessed through controlled methods within its enclosing class.
+ *
+ * Use {@link BatchFlags#builder()} instead.
+ */
+ private Builder() {
+ // To avoid direct instantiation.
+ }
+
+ /**
+ * Set {@code tfAllOrNothing} to the given value.
+ *
+ * @param tfAllOrNothing A boolean value.
+ *
+ * @return The same {@link PaymentFlags.Builder}.
+ */
+ public BatchFlags.Builder tfAllOrNothing(boolean tfAllOrNothing) {
+ this.tfAllOrNothing = tfAllOrNothing;
+ return this;
+ }
+
+ /**
+ * Set {@code tfOnlyOne} to the given value.
+ *
+ * @param tfOnlyOne A boolean value.
+ *
+ * @return The same {@link PaymentFlags.Builder}.
+ */
+ public BatchFlags.Builder tfOnlyOne(boolean tfOnlyOne) {
+ this.tfOnlyOne = tfOnlyOne;
+ return this;
+ }
+
+ /**
+ * Set {@code tfLimitQuality} to the given value.
+ *
+ * @param tfUntilFailure A boolean value.
+ *
+ * @return The same {@link PaymentFlags.Builder}.
+ */
+ public BatchFlags.Builder tfUntilFailure(boolean tfUntilFailure) {
+ this.tfUntilFailure = tfUntilFailure;
+ return this;
+ }
+
+ /**
+ * Set {@code tfIndependent} to the given value.
+ *
+ * @param tfIndependent A boolean value.
+ *
+ * @return The same {@link PaymentFlags.Builder}.
+ */
+ public BatchFlags.Builder tfIndependent(boolean tfIndependent) {
+ this.tfIndependent = tfIndependent;
+ return this;
+ }
+
+ /**
+ * Build a new {@link PaymentFlags} from the current boolean values.
+ *
+ * @return A new {@link PaymentFlags}.
+ */
+ public BatchFlags build() {
+ return BatchFlags.of(true, tfAllOrNothing, tfOnlyOne, tfUntilFailure, tfIndependent);
+ }
+ }
+
+}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlags.java
index 78fd2c649..e5b328d25 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlags.java
@@ -12,6 +12,12 @@ public class MpTokenAuthorizeFlags extends TransactionFlags {
*/
public static final MpTokenAuthorizeFlags UNAUTHORIZE = new MpTokenAuthorizeFlags(0x00000001);
+ /**
+ * Constant {@link MpTokenAuthorizeFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final MpTokenAuthorizeFlags INNER_BATCH_TXN = new MpTokenAuthorizeFlags(
+ TransactionFlags.INNER_BATCH_TXN.getValue());
+
private MpTokenAuthorizeFlags(long value) {
super(value);
}
@@ -42,4 +48,13 @@ public boolean tfMptUnauthorize() {
return this.isSet(UNAUTHORIZE);
}
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlags.java
index e900b6711..c06e637e1 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlags.java
@@ -32,6 +32,11 @@ public class MpTokenIssuanceCreateFlags extends TransactionFlags {
*/
protected static final MpTokenIssuanceCreateFlags CAN_CLAWBACK = new MpTokenIssuanceCreateFlags(0x00000040);
+ /**
+ * Constant {@link MpTokenIssuanceCreateFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final MpTokenIssuanceCreateFlags INNER_BATCH_TXN =
+ new MpTokenIssuanceCreateFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
private MpTokenIssuanceCreateFlags(long value) {
super(value);
@@ -56,7 +61,8 @@ private static MpTokenIssuanceCreateFlags of(
boolean tfMPTCanEscrow,
boolean tfMPTCanTrade,
boolean tfMPTCanTransfer,
- boolean tfMPTCanClawback
+ boolean tfMPTCanClawback,
+ boolean tfInnerBatchTxn
) {
return new MpTokenIssuanceCreateFlags(
TransactionFlags.of(
@@ -66,7 +72,8 @@ private static MpTokenIssuanceCreateFlags of(
tfMPTCanEscrow ? CAN_ESCROW : UNSET,
tfMPTCanTransfer ? CAN_TRANSFER : UNSET,
tfMPTCanTrade ? CAN_TRADE : UNSET,
- tfMPTCanClawback ? CAN_CLAWBACK : UNSET
+ tfMPTCanClawback ? CAN_CLAWBACK : UNSET,
+ tfInnerBatchTxn ? INNER_BATCH_TXN : UNSET
).getValue()
);
}
@@ -139,6 +146,15 @@ public boolean tfMptCanClawback() {
return this.isSet(CAN_CLAWBACK);
}
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link MpTokenIssuanceCreateFlags}.
*/
@@ -150,11 +166,13 @@ public static class Builder {
private boolean tfMptCanTrade = false;
private boolean tfMptCanTransfer = false;
private boolean tfMptCanClawback = false;
+ private boolean tfInnerBatchTxn = false;
/**
* Set {@code tfMptCanLock} to the given value.
*
* @param tfMptCanLock A boolean value.
+ *
* @return The same {@link Builder}.
*/
public Builder tfMptCanLock(boolean tfMptCanLock) {
@@ -166,6 +184,7 @@ public Builder tfMptCanLock(boolean tfMptCanLock) {
* Set {@code tfMptRequireAuth} to the given value.
*
* @param tfMptRequireAuth A boolean value.
+ *
* @return The same {@link Builder}.
*/
public Builder tfMptRequireAuth(boolean tfMptRequireAuth) {
@@ -177,6 +196,7 @@ public Builder tfMptRequireAuth(boolean tfMptRequireAuth) {
* Set {@code tfMptCanEscrow} to the given value.
*
* @param tfMptCanEscrow A boolean value.
+ *
* @return The same {@link Builder}.
*/
public Builder tfMptCanEscrow(boolean tfMptCanEscrow) {
@@ -188,6 +208,7 @@ public Builder tfMptCanEscrow(boolean tfMptCanEscrow) {
* Set {@code tfMptCanTrade} to the given value.
*
* @param tfMptCanTrade A boolean value.
+ *
* @return The same {@link Builder}.
*/
public Builder tfMptCanTrade(boolean tfMptCanTrade) {
@@ -199,6 +220,7 @@ public Builder tfMptCanTrade(boolean tfMptCanTrade) {
* Set {@code tfMptCanTransfer} to the given value.
*
* @param tfMptCanTransfer A boolean value.
+ *
* @return The same {@link Builder}.
*/
public Builder tfMptCanTransfer(boolean tfMptCanTransfer) {
@@ -210,6 +232,7 @@ public Builder tfMptCanTransfer(boolean tfMptCanTransfer) {
* Set {@code tfMptCanClawback} to the given value.
*
* @param tfMptCanClawback A boolean value.
+ *
* @return The same {@link Builder}.
*/
public Builder tfMptCanClawback(boolean tfMptCanClawback) {
@@ -217,6 +240,18 @@ public Builder tfMptCanClawback(boolean tfMptCanClawback) {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link MpTokenIssuanceCreateFlags} from the current boolean values.
*
@@ -230,7 +265,8 @@ public MpTokenIssuanceCreateFlags build() {
tfMptCanEscrow,
tfMptCanTrade,
tfMptCanTransfer,
- tfMptCanClawback
+ tfMptCanClawback,
+ tfInnerBatchTxn
);
}
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlags.java
index 93e2d16fa..443f81420 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlags.java
@@ -16,6 +16,13 @@ public class MpTokenIssuanceSetFlags extends TransactionFlags {
*/
public static final MpTokenIssuanceSetFlags UNLOCK = new MpTokenIssuanceSetFlags(0x00000002);
+ /**
+ * Constant {@link MpTokenIssuanceSetFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final MpTokenIssuanceSetFlags INNER_BATCH_TXN = new MpTokenIssuanceSetFlags(
+ TransactionFlags.INNER_BATCH_TXN.getValue()
+ );
+
private MpTokenIssuanceSetFlags(long value) {
super(value);
}
@@ -51,4 +58,13 @@ public boolean tfMptUnlock() {
return this.isSet(UNLOCK);
}
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlags.java
index 0b3fb9f07..2f3e742bc 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlags.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +32,12 @@ public class NfTokenCreateOfferFlags extends TransactionFlags {
*/
public static final NfTokenCreateOfferFlags SELL_NFTOKEN = new NfTokenCreateOfferFlags(0x00000001);
+ /**
+ * Constant {@link NfTokenCreateOfferFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final NfTokenCreateOfferFlags INNER_BATCH_TXN =
+ new NfTokenCreateOfferFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private NfTokenCreateOfferFlags(long value) {
super(value);
}
@@ -48,11 +54,16 @@ public static Builder builder() {
return new Builder();
}
- private static NfTokenCreateOfferFlags of(boolean tfFullyCanonicalSig, boolean tfSellToken) {
+ private static NfTokenCreateOfferFlags of(
+ boolean tfFullyCanonicalSig,
+ boolean tfSellToken,
+ boolean tfInnerBatchTxn
+ ) {
return new NfTokenCreateOfferFlags(
TransactionFlags.of(
tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
- tfSellToken ? SELL_NFTOKEN : UNSET
+ tfSellToken ? SELL_NFTOKEN : UNSET,
+ tfInnerBatchTxn ? INNER_BATCH_TXN : UNSET
).getValue()
);
}
@@ -69,8 +80,8 @@ public static NfTokenCreateOfferFlags of(long value) {
}
/**
- * Construct an empty instance of {@link NfTokenCreateOfferFlags}. Transactions with empty flags will
- * not be serialized with a {@code Flags} field.
+ * Construct an empty instance of {@link NfTokenCreateOfferFlags}. Transactions with empty flags will not be
+ * serialized with a {@code Flags} field.
*
* @return An empty {@link NfTokenCreateOfferFlags}.
*/
@@ -79,9 +90,8 @@ public static NfTokenCreateOfferFlags empty() {
}
/**
- * If set, indicates that the minted token may be burned by the issuer even
- * if the issuer does not currently hold the token. The current holder of
- * the token may always burn it.
+ * If set, indicates that the minted token may be burned by the issuer even if the issuer does not currently hold the
+ * token. The current holder of the token may always burn it.
*
* @return {@code true} if {@code tfBurnable} is set, otherwise {@code false}.
*/
@@ -89,11 +99,22 @@ public boolean tfSellNfToken() {
return this.isSet(SELL_NFTOKEN);
}
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link NfTokenCreateOfferFlags}.
*/
public static class Builder {
+
boolean tfSellNfToken = false;
+ boolean tfInnerBatchTxn = false;
/**
* Set {@code tfSellToken} to the given value.
@@ -107,13 +128,25 @@ public Builder tfSellToken(boolean tfSellNfToken) {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link NfTokenCreateOfferFlags} from the current boolean values.
*
* @return A new {@link NfTokenCreateOfferFlags}.
*/
public NfTokenCreateOfferFlags build() {
- return NfTokenCreateOfferFlags.of(true, tfSellNfToken);
+ return NfTokenCreateOfferFlags.of(true, tfSellNfToken, tfInnerBatchTxn);
}
}
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlags.java
index 4a931744f..21a53a5bd 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlags.java
@@ -49,6 +49,12 @@ public class NfTokenMintFlags extends TransactionFlags {
*/
protected static final NfTokenMintFlags TRANSFERABLE = new NfTokenMintFlags(0x00000008);
+ /**
+ * Constant {@link NfTokenMintFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final NfTokenMintFlags INNER_BATCH_TXN =
+ new NfTokenMintFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private NfTokenMintFlags(long value) {
super(value);
}
@@ -65,15 +71,22 @@ public static Builder builder() {
return new Builder();
}
- private static NfTokenMintFlags of(boolean tfFullyCanonicalSig, boolean tfBurnable, boolean tfOnlyXRP,
- boolean tfTrustLine, boolean tfTransferable) {
+ private static NfTokenMintFlags of(
+ boolean tfFullyCanonicalSig,
+ boolean tfBurnable,
+ boolean tfOnlyXRP,
+ boolean tfTrustLine,
+ boolean tfTransferable,
+ boolean tfInnerBatchTxn
+ ) {
return new NfTokenMintFlags(
TransactionFlags.of(
tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
tfBurnable ? BURNABLE : UNSET,
tfOnlyXRP ? ONLY_XRP : UNSET,
tfTrustLine ? TRUSTLINE : UNSET,
- tfTransferable ? TRANSFERABLE : UNSET
+ tfTransferable ? TRANSFERABLE : UNSET,
+ tfInnerBatchTxn ? INNER_BATCH_TXN : UNSET
).getValue()
);
}
@@ -139,6 +152,15 @@ public boolean tfTransferable() {
return this.isSet(TRANSFERABLE);
}
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link NfTokenMintFlags}.
*/
@@ -147,6 +169,7 @@ public static class Builder {
boolean tfOnlyXRP = false;
boolean tfTrustLine = false;
boolean tfTransferable = false;
+ boolean tfInnerBatchTxn = false;
/**
* Set {@code tfBurnable} to the given value.
@@ -196,13 +219,25 @@ public Builder tfTransferable(boolean tfTransferable) {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link NfTokenMintFlags} from the current boolean values.
*
* @return A new {@link NfTokenMintFlags}.
*/
public NfTokenMintFlags build() {
- return NfTokenMintFlags.of(true, tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable);
+ return NfTokenMintFlags.of(true, tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable, tfInnerBatchTxn);
}
}
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlags.java
index d0b8fac41..af6ada226 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlags.java
@@ -52,6 +52,15 @@ public class OfferCreateFlags extends TransactionFlags {
*/
protected static final OfferCreateFlags HYBRID = new OfferCreateFlags(0x00100000L);
+ /**
+ * Constant {@link OfferCreateFlags} for the {@code tfInnerBatchTxn} flag. This flag is used to indicate that a
+ * transaction is an inner transaction of a Batch.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public static final OfferCreateFlags INNER_BATCH_TXN =
+ new OfferCreateFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private OfferCreateFlags(long value) {
super(value);
}
@@ -85,7 +94,8 @@ private static OfferCreateFlags of(
boolean tfImmediateOrCancel,
boolean tfFillOrKill,
boolean tfSell,
- boolean tfHybrid
+ boolean tfHybrid,
+ boolean tfInnerBatchTxn
) {
long value = Flags.of(
tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
@@ -93,7 +103,8 @@ private static OfferCreateFlags of(
tfImmediateOrCancel ? IMMEDIATE_OR_CANCEL : UNSET,
tfFillOrKill ? FILL_OR_KILL : UNSET,
tfSell ? SELL : UNSET,
- tfHybrid ? HYBRID : UNSET
+ tfHybrid ? HYBRID : UNSET,
+ tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN : UNSET
).getValue();
return new OfferCreateFlags(value);
}
@@ -160,6 +171,17 @@ public boolean tfHybrid() {
return this.isSet(OfferCreateFlags.HYBRID);
}
+ /**
+ * Indicates that this transaction is an inner transaction of a Batch transaction.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(OfferCreateFlags.INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link OfferCreateFlags} flags.
*/
@@ -170,6 +192,7 @@ public static class Builder {
private boolean tfFillOrKill = false;
private boolean tfSell = false;
private boolean tfHybrid = false;
+ private boolean tfInnerBatchTxn = false;
/**
* Set {@code tfPassive} to the given value.
@@ -231,6 +254,18 @@ public Builder tfHybrid(boolean tfHybrid) {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link OfferCreateFlags} from the current boolean values.
*
@@ -243,8 +278,9 @@ public OfferCreateFlags build() {
tfImmediateOrCancel,
tfFillOrKill,
tfSell,
- tfHybrid
+ tfHybrid,
+ tfInnerBatchTxn
);
}
}
-}
\ No newline at end of file
+}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlags.java
index 397715185..235579f21 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlags.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,8 +24,7 @@
import org.xrpl.xrpl4j.model.transactions.PaymentChannelClaim;
/**
- * A set of static {@link TransactionFlags} which can be set on
- * {@link PaymentChannelClaim} transactions.
+ * A set of static {@link TransactionFlags} which can be set on {@link PaymentChannelClaim} transactions.
*/
public class PaymentChannelClaimFlags extends TransactionFlags {
@@ -39,6 +38,12 @@ public class PaymentChannelClaimFlags extends TransactionFlags {
*/
protected static final PaymentChannelClaimFlags CLOSE = new PaymentChannelClaimFlags(0x00020000);
+ /**
+ * Constant {@link PaymentChannelClaimFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final PaymentChannelClaimFlags INNER_BATCH_TXN =
+ new PaymentChannelClaimFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private PaymentChannelClaimFlags(long value) {
super(value);
}
@@ -55,12 +60,18 @@ public static Builder builder() {
return new Builder();
}
- private static PaymentChannelClaimFlags of(boolean tfFullyCanonicalSig, boolean tfRenew, boolean tfClose) {
+ private static PaymentChannelClaimFlags of(
+ boolean tfFullyCanonicalSig,
+ boolean tfRenew,
+ boolean tfClose,
+ boolean tfInnerBatchTxn
+ ) {
return new PaymentChannelClaimFlags(
TransactionFlags.of(
tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
tfRenew ? RENEW : UNSET,
- tfClose ? CLOSE : UNSET
+ tfClose ? CLOSE : UNSET,
+ tfInnerBatchTxn ? INNER_BATCH_TXN : UNSET
).getValue()
);
}
@@ -77,8 +88,8 @@ public static PaymentChannelClaimFlags of(long value) {
}
/**
- * Construct an empty instance of {@link PaymentChannelClaimFlags}. Transactions with empty flags will
- * not be serialized with a {@code Flags} field.
+ * Construct an empty instance of {@link PaymentChannelClaimFlags}. Transactions with empty flags will not be
+ * serialized with a {@code Flags} field.
*
* @return An empty {@link PaymentChannelClaimFlags}.
*/
@@ -96,8 +107,8 @@ public boolean tfFullyCanonicalSig() {
}
/**
- * Clear the {@link PayChannelObject#expiration()} time (different from {@link PayChannelObject#cancelAfter()}
- * time.) Only the source address of the payment channel can use this flag.
+ * Clear the {@link PayChannelObject#expiration()} time (different from {@link PayChannelObject#cancelAfter()} time.)
+ * Only the source address of the payment channel can use this flag.
*
* @return {@code true} if {@code tfRenew} is set, otherwise {@code false}.
*/
@@ -112,8 +123,8 @@ public boolean tfRenew() {
* this flag.
*
* This flag closes the channel immediately if it has no more XRP allocated to it after processing the
- * current claim, or if the {@link PayChannelObject#destination()} address uses it. If the source address uses
- * this flag when the channel still holds XRP, this schedules the channel to close after
+ * current claim, or if the {@link PayChannelObject#destination()} address uses it. If the source address uses this
+ * flag when the channel still holds XRP, this schedules the channel to close after
* {@link PayChannelObject#settleDelay()} seconds have passed. (Specifically, this sets the
* {@link PayChannelObject#expiration()} of the channel to the close time of the previous ledger plus the channel's
* {@link PayChannelObject#settleDelay()} time, unless the channel already has an earlier
@@ -128,12 +139,23 @@ public boolean tfClose() {
return this.isSet(CLOSE);
}
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link PaymentChannelClaimFlags}.
*/
public static class Builder {
+
boolean tfRenew = false;
boolean tfClose = false;
+ boolean tfInnerBatchTxn = false;
/**
* Set {@code tfRenew} to the given value.
@@ -159,13 +181,25 @@ public Builder tfClose(boolean tfClose) {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link PaymentChannelClaimFlags} from the current boolean values.
*
* @return A new {@link PaymentChannelClaimFlags}.
*/
public PaymentChannelClaimFlags build() {
- return PaymentChannelClaimFlags.of(true, tfRenew, tfClose);
+ return PaymentChannelClaimFlags.of(true, tfRenew, tfClose, tfInnerBatchTxn);
}
}
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentFlags.java
index efcf610d8..58e94ab64 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/PaymentFlags.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,6 +47,14 @@ public class PaymentFlags extends TransactionFlags {
*/
protected static final PaymentFlags LIMIT_QUALITY = new PaymentFlags(0x00040000L);
+ /**
+ * Constant {@link PaymentFlags} for the {@code tfInnerBatchTxn} flag. This flag is used to indicate that a
+ * transaction is an inner transaction of a Batch.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public static final PaymentFlags INNER_BATCH_TXN = new PaymentFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private PaymentFlags(long value) {
super(value);
}
@@ -74,19 +82,25 @@ public static PaymentFlags of(long value) {
return new PaymentFlags(value);
}
- private static PaymentFlags of(boolean tfFullyCanonicalSig, boolean tfNoDirectRipple, boolean tfPartialPayment,
- boolean tfLimitQuality) {
+ private static PaymentFlags of(
+ boolean tfFullyCanonicalSig,
+ boolean tfNoDirectRipple,
+ boolean tfPartialPayment,
+ boolean tfLimitQuality,
+ boolean tfInnerBatchTxn
+ ) {
return new PaymentFlags(of(
tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
tfNoDirectRipple ? NO_DIRECT_RIPPLE : UNSET,
tfPartialPayment ? PARTIAL_PAYMENT : UNSET,
- tfLimitQuality ? LIMIT_QUALITY : UNSET
+ tfLimitQuality ? LIMIT_QUALITY : UNSET,
+ tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN : UNSET
).getValue());
}
/**
- * Construct an empty instance of {@link PaymentFlags}. Transactions with empty flags will
- * not be serialized with a {@code Flags} field.
+ * Construct an empty instance of {@link PaymentFlags}. Transactions with empty flags will not be serialized with a
+ * {@code Flags} field.
*
* @return An empty {@link PaymentFlags}.
*/
@@ -95,8 +109,8 @@ public static PaymentFlags empty() {
}
/**
- * Do not use the default path; only use paths included in the {@link Payment#paths()} field. This is intended
- * to force the transaction to take arbitrage opportunities. Most clients do not need this.
+ * Do not use the default path; only use paths included in the {@link Payment#paths()} field. This is intended to
+ * force the transaction to take arbitrage opportunities. Most clients do not need this.
*
* @return {@code true} if {@code tfNoDirectRipple} is set, otherwise {@code false}.
*/
@@ -105,11 +119,11 @@ public boolean tfNoDirectRipple() {
}
/**
- * If the specified {@link Payment#amount()} cannot be sent without spending
- * more than {@link Payment#sendMax()}, reduce the received amount instead of
- * failing outright.
+ * If the specified {@link Payment#amount()} cannot be sent without spending more than {@link Payment#sendMax()},
+ * reduce the received amount instead of failing outright.
*
* @return {@code true} if {@code tfPartialPayment} is set, otherwise {@code false}.
+ *
* @see "https://xrpl.org/partial-payments.html"
*/
public boolean tfPartialPayment() {
@@ -126,6 +140,17 @@ public boolean tfLimitQuality() {
return this.isSet(PaymentFlags.LIMIT_QUALITY);
}
+ /**
+ * Indicates that this transaction is an inner transaction of a Batch transaction.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(PaymentFlags.INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link PaymentFlags} flags.
*/
@@ -134,6 +159,7 @@ public static class Builder {
private boolean tfNoDirectRipple = false;
private boolean tfPartialPayment = false;
private boolean tfLimitQuality = false;
+ private boolean tfInnerBatchTxn = false;
/**
* Set {@code tfNoDirectRipple} to the given value.
@@ -171,13 +197,25 @@ public Builder tfLimitQuality(boolean tfLimitQuality) {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link PaymentFlags} from the current boolean values.
*
* @return A new {@link PaymentFlags}.
*/
public PaymentFlags build() {
- return PaymentFlags.of(true, tfNoDirectRipple, tfPartialPayment, tfLimitQuality);
+ return PaymentFlags.of(true, tfNoDirectRipple, tfPartialPayment, tfLimitQuality, tfInnerBatchTxn);
}
}
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TransactionFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TransactionFlags.java
index 8c03379a7..808057572 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TransactionFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TransactionFlags.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +32,15 @@ public class TransactionFlags extends Flags {
*/
public static final TransactionFlags FULLY_CANONICAL_SIG = new TransactionFlags(0x80000000L);
+ /**
+ * Corresponds to the {@code tfInnerBatchTxn} flag. This flag should only be used if a transaction is an inner
+ * transaction in a Batch transaction. It signifies that the transaction shouldn't be signed. Any normal transaction
+ * that includes this flag should be rejected.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public static final TransactionFlags INNER_BATCH_TXN = new TransactionFlags(0x40000000L);
+
/**
* Constant for an unset flag.
*/
@@ -57,12 +66,25 @@ public static TransactionFlags of(long value) {
* Flags indicating that a fully-canonical signature is required. This flag is highly recommended.
*
* @return {@code true} if {@code tfFullyCanonicalSig} is set, otherwise {@code false}.
+ *
* @see "https://xrpl.org/transaction-common-fields.html#flags-field"
*/
public boolean tfFullyCanonicalSig() {
return this.isSet(TransactionFlags.FULLY_CANONICAL_SIG);
}
+ /**
+ * Check if the {@code tfInnerBatchTxn} flag is set. This flag indicates that the transaction is an inner transaction
+ * within a Batch transaction.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(TransactionFlags.INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link TransactionFlags} flags.
*/
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TrustSetFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TrustSetFlags.java
index d6e64397b..de5962ee2 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TrustSetFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/TrustSetFlags.java
@@ -24,8 +24,7 @@
import org.xrpl.xrpl4j.model.transactions.TrustSet;
/**
- * A set of static {@link TransactionFlags} which can be set on {@link TrustSet}
- * transactions.
+ * A set of static {@link TransactionFlags} which can be set on {@link TrustSet} transactions.
*/
public class TrustSetFlags extends TransactionFlags {
@@ -69,6 +68,14 @@ public class TrustSetFlags extends TransactionFlags {
*/
protected static final TrustSetFlags CLEAR_DEEP_FREEZE = new TrustSetFlags(0x00800000);
+ /**
+ * Constant {@link TrustSetFlags} for the {@code tfInnerBatchTxn} flag. This flag is used to indicate that a
+ * transaction is an inner transaction of a Batch.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public static final TrustSetFlags INNER_BATCH_TXN = new TrustSetFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private TrustSetFlags(long value) {
super(value);
}
@@ -93,7 +100,8 @@ private static TrustSetFlags of(
boolean tfSetFreeze,
boolean tfClearFreeze,
boolean tfSetDeepFreeze,
- boolean tfClearDeepFreeze
+ boolean tfClearDeepFreeze,
+ boolean tfInnerBatchTxn
) {
return new TrustSetFlags(
Flags.of(
@@ -104,7 +112,8 @@ private static TrustSetFlags of(
tfSetFreeze ? SET_FREEZE : UNSET,
tfClearFreeze ? CLEAR_FREEZE : UNSET,
tfSetDeepFreeze ? SET_DEEP_FREEZE : UNSET,
- tfClearDeepFreeze ? CLEAR_DEEP_FREEZE : UNSET).getValue()
+ tfClearDeepFreeze ? CLEAR_DEEP_FREEZE : UNSET,
+ tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN : UNSET).getValue()
);
}
@@ -120,8 +129,8 @@ public static TrustSetFlags of(long value) {
}
/**
- * Construct an empty instance of {@link TrustSetFlags}. Transactions with empty flags will
- * not be serialized with a {@code Flags} field.
+ * Construct an empty instance of {@link TrustSetFlags}. Transactions with empty flags will not be serialized with a
+ * {@code Flags} field.
*
* @return An empty {@link TrustSetFlags}.
*/
@@ -149,8 +158,8 @@ public boolean tfSetfAuth() {
}
/**
- * Enable the No Ripple flag, which blocks rippling between two trust lines of the same currency if this
- * flag is enabled on both.
+ * Enable the No Ripple flag, which blocks rippling between two trust lines of the same currency if this flag is
+ * enabled on both.
*
* @return {@code true} if {@code tfSetNoRipple} is set, otherwise {@code false}.
*/
@@ -195,7 +204,8 @@ public boolean tfSetDeepFreeze() {
}
/**
- * Clear deep freeze on the trust line.
+ * Clear deep freeze on the
+ * trust line.
*
* @return {@code true} if {@code tfClearDeepFreeze} is set, otherwise {@code false}.
*/
@@ -203,10 +213,22 @@ public boolean tfClearDeepFreeze() {
return this.isSet(CLEAR_DEEP_FREEZE);
}
+ /**
+ * Indicates that this transaction is an inner transaction of a Batch transaction.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ *
+ * @see "https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0056-batch"
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(TrustSetFlags.INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link TrustSetFlags}.
*/
public static class Builder {
+
private boolean tfSetfAuth = false;
private boolean tfSetNoRipple = false;
private boolean tfClearNoRipple = false;
@@ -214,6 +236,7 @@ public static class Builder {
private boolean tfClearFreeze = false;
private boolean tfSetDeepFreeze = false;
private boolean tfClearDeepFreeze = false;
+ private boolean tfInnerBatchTxn = false;
/**
* Set {@code tfSetfAuth} to the given value.
@@ -287,6 +310,18 @@ public Builder tfClearDeepFreeze() {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link TrustSetFlags} from the current boolean values.
*
@@ -301,7 +336,8 @@ public TrustSetFlags build() {
tfSetFreeze,
tfClearFreeze,
tfSetDeepFreeze,
- tfClearDeepFreeze
+ tfClearDeepFreeze,
+ tfInnerBatchTxn
);
}
}
diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlags.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlags.java
index c00f65e31..c18676b14 100644
--- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlags.java
+++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlags.java
@@ -12,6 +12,12 @@ public class XChainModifyBridgeFlags extends TransactionFlags {
*/
public static final XChainModifyBridgeFlags CLEAR_ACCOUNT_CREATE_AMOUNT = new XChainModifyBridgeFlags(0x00010000);
+ /**
+ * Constant {@link XChainModifyBridgeFlags} for the {@code tfInnerBatchTxn} flag.
+ */
+ public static final XChainModifyBridgeFlags INNER_BATCH_TXN =
+ new XChainModifyBridgeFlags(TransactionFlags.INNER_BATCH_TXN.getValue());
+
private XChainModifyBridgeFlags(long value) {
super(value);
}
@@ -40,16 +46,21 @@ public static XChainModifyBridgeFlags of(long value) {
return new XChainModifyBridgeFlags(value);
}
- private static XChainModifyBridgeFlags of(boolean tfFullyCanonicalSig, boolean tfClearAccountCreateAmount) {
+ private static XChainModifyBridgeFlags of(
+ boolean tfFullyCanonicalSig,
+ boolean tfClearAccountCreateAmount,
+ boolean tfInnerBatchTxn
+ ) {
return new XChainModifyBridgeFlags(of(
tfFullyCanonicalSig ? TransactionFlags.FULLY_CANONICAL_SIG : UNSET,
- tfClearAccountCreateAmount ? CLEAR_ACCOUNT_CREATE_AMOUNT : UNSET
+ tfClearAccountCreateAmount ? CLEAR_ACCOUNT_CREATE_AMOUNT : UNSET,
+ tfInnerBatchTxn ? INNER_BATCH_TXN : UNSET
).getValue());
}
/**
- * Construct an empty instance of {@link XChainModifyBridgeFlags}. Transactions with empty flags will
- * not be serialized with a {@code Flags} field.
+ * Construct an empty instance of {@link XChainModifyBridgeFlags}. Transactions with empty flags will not be
+ * serialized with a {@code Flags} field.
*
* @return An empty {@link XChainModifyBridgeFlags}.
*/
@@ -66,12 +77,22 @@ public boolean tfClearAccountCreateAmount() {
return this.isSet(XChainModifyBridgeFlags.CLEAR_ACCOUNT_CREATE_AMOUNT);
}
+ /**
+ * Whether the {@code tfInnerBatchTxn} flag is set.
+ *
+ * @return {@code true} if {@code tfInnerBatchTxn} is set, otherwise {@code false}.
+ */
+ public boolean tfInnerBatchTxn() {
+ return this.isSet(INNER_BATCH_TXN);
+ }
+
/**
* A builder class for {@link XChainModifyBridgeFlags} flags.
*/
public static class Builder {
private boolean tfClearAccountCreateAmount = false;
+ private boolean tfInnerBatchTxn = false;
/**
* Set {@code tfClearAccountCreateAmount} to the given value.
@@ -85,13 +106,25 @@ public Builder tfClearAccountCreateAmount(boolean tfClearAccountCreateAmount) {
return this;
}
+ /**
+ * Set {@code tfInnerBatchTxn} to the given value.
+ *
+ * @param tfInnerBatchTxn A boolean value.
+ *
+ * @return The same {@link Builder}.
+ */
+ public Builder tfInnerBatchTxn(boolean tfInnerBatchTxn) {
+ this.tfInnerBatchTxn = tfInnerBatchTxn;
+ return this;
+ }
+
/**
* Build a new {@link XChainModifyBridgeFlags} from the current boolean values.
*
* @return A new {@link XChainModifyBridgeFlags}.
*/
public XChainModifyBridgeFlags build() {
- return XChainModifyBridgeFlags.of(true, tfClearAccountCreateAmount);
+ return XChainModifyBridgeFlags.of(true, tfClearAccountCreateAmount, tfInnerBatchTxn);
}
}
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AbstractFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AbstractFlagsTest.java
index 9bcf1f617..d340daefd 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AbstractFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AbstractFlagsTest.java
@@ -78,6 +78,15 @@ protected void assertCanSerializeAndDeserialize(TransactionFlagsWrapper object,
assertThat(deserialized).isEqualTo(object);
}
+ protected void assertCanSerializeAndDeserialize(BatchFlagsWrapper object, String json)
+ throws JsonProcessingException, JSONException {
+ String serialized = objectMapper.writeValueAsString(object);
+ JSONAssert.assertEquals(json, serialized, JSONCompareMode.STRICT);
+
+ BatchFlagsWrapper deserialized = objectMapper.readValue(serialized, BatchFlagsWrapper.class);
+ assertThat(deserialized).isEqualTo(object);
+ }
+
@Value.Immutable
@JsonSerialize(as = ImmutableFlagsWrapper.class)
@JsonDeserialize(as = ImmutableFlagsWrapper.class)
@@ -104,4 +113,19 @@ default TransactionFlags flags() {
return TransactionFlags.EMPTY;
}
}
+
+ @Value.Immutable
+ @JsonSerialize(as = ImmutableBatchFlagsWrapper.class)
+ @JsonDeserialize(as = ImmutableBatchFlagsWrapper.class)
+ interface BatchFlagsWrapper {
+
+ static BatchFlagsWrapper of(BatchFlags flags) {
+ return ImmutableBatchFlagsWrapper.builder().flags(flags).build();
+ }
+
+ @Value.Default
+ default BatchFlags flags() {
+ return BatchFlags.EMPTY;
+ }
+ }
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlagsTests.java
index 8c7993fb1..26f234655 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlagsTests.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AccountSetTransactionFlagsTests.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,18 +24,22 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.common.primitives.UnsignedInteger;
import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
+import org.xrpl.xrpl4j.model.transactions.AccountSet;
+import org.xrpl.xrpl4j.model.transactions.Address;
+import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount;
import java.util.stream.Stream;
public class AccountSetTransactionFlagsTests extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(6);
+ return getBooleanCombinations(7);
}
@ParameterizedTest
@@ -46,9 +50,11 @@ public void testFlagsConstructionWithIndividualFlags(
boolean tfRequireAuth,
boolean tfOptionalAuth,
boolean tfDisallowXrp,
- boolean tfAllowXrp
+ boolean tfAllowXrp,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
- AccountSetTransactionFlags.Builder builder = AccountSetTransactionFlags.builder();
+ AccountSetTransactionFlags.Builder builder = AccountSetTransactionFlags.builder()
+ .tfInnerBatchTxn(tfInnerBatchTxn);
if (tfRequireDestTag) {
builder.tfRequireDestTag();
@@ -105,7 +111,8 @@ public void testFlagsConstructionWithIndividualFlags(
tfRequireAuth,
tfOptionalAuth,
tfDisallowXrp,
- tfAllowXrp
+ tfAllowXrp,
+ tfInnerBatchTxn
);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
@@ -126,7 +133,8 @@ public void testDeriveIndividualFlagsFromFlags(
boolean tfRequireAuth,
boolean tfOptionalAuth,
boolean tfDisallowXrp,
- boolean tfAllowXrp
+ boolean tfAllowXrp,
+ boolean tfInnerBatchTxn
) {
long expectedFlags = getExpectedFlags(
tfRequireDestTag,
@@ -134,7 +142,8 @@ public void testDeriveIndividualFlagsFromFlags(
tfRequireAuth,
tfOptionalAuth,
tfDisallowXrp,
- tfAllowXrp
+ tfAllowXrp,
+ tfInnerBatchTxn
);
if (tfRequireDestTag && tfOptionalDestTag) {
@@ -170,6 +179,18 @@ public void testDeriveIndividualFlagsFromFlags(
assertThat(flags.tfOptionalAuth()).isEqualTo(tfOptionalAuth);
assertThat(flags.tfDisallowXrp()).isEqualTo(tfDisallowXrp);
assertThat(flags.tfAllowXrp()).isEqualTo(tfAllowXrp);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
+ }
+
+ @Test
+ public void testDeriveIndividualFlagsFromFlagsWithEmptyFlags() {
+ AccountSet accountSet = AccountSet.builder()
+ .account(Address.of("r9TeThyi5xiuUUrFjtPKZiHcDxs7K9H6Rb"))
+ .fee(XrpCurrencyAmount.ofDrops(10))
+ .sequence(UnsignedInteger.ONE)
+ .build();
+
+ assertThat(accountSet.flags().isEmpty()).isTrue();
}
@Test
@@ -184,6 +205,7 @@ void testEmptyFlags() throws JSONException, JsonProcessingException {
assertThat(flags.tfRequireDestTag()).isFalse();
assertThat(flags.tfOptionalDestTag()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(flags);
@@ -193,13 +215,42 @@ void testEmptyFlags() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
+ @Test
+ void testInnerBatchTxn() {
+ AccountSetTransactionFlags flags = AccountSetTransactionFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfRequireDestTag()).isFalse();
+ assertThat(flags.tfOptionalDestTag()).isFalse();
+ assertThat(flags.tfRequireAuth()).isFalse();
+ assertThat(flags.tfOptionalAuth()).isFalse();
+ assertThat(flags.tfDisallowXrp()).isFalse();
+ assertThat(flags.tfAllowXrp()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
+ /**
+ * Computes the combined expected flag value based on the specified flag inputs.
+ *
+ * @param tfRequireDestTag A boolean indicating whether the "Require Destination Tag" flag should be set.
+ * @param tfOptionalDestTag A boolean indicating whether the "Optional Destination Tag" flag should be set.
+ * @param tfRequireAuth A boolean indicating whether the "Require Authorization" flag should be set.
+ * @param tfOptionalAuth A boolean indicating whether the "Optional Authorization" flag should be set.
+ * @param tfDisallowXrp A boolean indicating whether the "Disallow XRP" flag should be set.
+ * @param tfAllowXrp A boolean indicating whether the "Allow XRP" flag should be set.
+ * @param tfInnerBatchTxn A boolean indicating whether the "Inner Batch Transaction" flag should be set.
+ *
+ * @return A long value representing the combined flags calculated from the input parameters.
+ */
private long getExpectedFlags(
boolean tfRequireDestTag,
boolean tfOptionalDestTag,
boolean tfRequireAuth,
boolean tfOptionalAuth,
boolean tfDisallowXrp,
- boolean tfAllowXrp
+ boolean tfAllowXrp,
+ boolean tfInnerBatchTxn
) {
return (AccountSetTransactionFlags.FULLY_CANONICAL_SIG.getValue()) |
(tfRequireDestTag ? AccountSetTransactionFlags.REQUIRE_DEST_TAG.getValue() : 0L) |
@@ -207,6 +258,9 @@ private long getExpectedFlags(
(tfRequireAuth ? AccountSetTransactionFlags.REQUIRE_AUTH.getValue() : 0L) |
(tfOptionalAuth ? AccountSetTransactionFlags.OPTIONAL_AUTH.getValue() : 0L) |
(tfDisallowXrp ? AccountSetTransactionFlags.DISALLOW_XRP.getValue() : 0L) |
- (tfAllowXrp ? AccountSetTransactionFlags.ALLOW_XRP.getValue() : 0L);
+ (tfAllowXrp ? AccountSetTransactionFlags.ALLOW_XRP.getValue() : 0L) |
+ (tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN.getValue() : 0L);
}
+
+
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlagsTest.java
index 79271f8c3..5f05145b0 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmClawbackFlagsTest.java
@@ -15,6 +15,7 @@ void testFlagWithValue() {
assertThat(flags.tfClawTwoAssets()).isTrue();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isEqualTo(1L);
}
@@ -25,15 +26,26 @@ void testEmptyFlags() {
assertThat(flags.tfClawTwoAssets()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isZero();
}
+ @Test
+ void testInnerBatchTxn() {
+ AmmClawbackFlags flags = AmmClawbackFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfClawTwoAssets()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
@Test
void testJson() throws JSONException, JsonProcessingException {
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(AmmClawbackFlags.CLAW_TWO_ASSETS);
String json = String.format("{\n" +
- " \"flags\": %s\n" +
- "}", AmmClawbackFlags.CLAW_TWO_ASSETS.getValue());
+ " \"flags\": %s\n" +
+ "}", AmmClawbackFlags.CLAW_TWO_ASSETS.getValue());
assertCanSerializeAndDeserialize(wrapper, json);
}
@@ -43,7 +55,7 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
AmmClawbackFlags flags = AmmClawbackFlags.empty();
AbstractFlagsTest.TransactionFlagsWrapper wrapper = AbstractFlagsTest.TransactionFlagsWrapper.of(flags);
String json = "{\n" +
- "}";
+ "}";
assertCanSerializeAndDeserialize(wrapper, json);
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlagsTest.java
index f011c82a4..16561c142 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmDepositFlagsTest.java
@@ -15,6 +15,7 @@ void testFlagValues() {
assertThat(lpToken.tfOneAssetLpToken()).isFalse();
assertThat(lpToken.tfLimitLpToken()).isFalse();
assertThat(lpToken.tfTwoAssetIfEmpty()).isFalse();
+ assertThat(lpToken.tfInnerBatchTxn()).isFalse();
AmmDepositFlags singleAsset = AmmDepositFlags.SINGLE_ASSET;
assertThat(singleAsset.tfLpToken()).isFalse();
@@ -23,6 +24,7 @@ void testFlagValues() {
assertThat(singleAsset.tfOneAssetLpToken()).isFalse();
assertThat(singleAsset.tfLimitLpToken()).isFalse();
assertThat(singleAsset.tfTwoAssetIfEmpty()).isFalse();
+ assertThat(singleAsset.tfInnerBatchTxn()).isFalse();
AmmDepositFlags twoAsset = AmmDepositFlags.TWO_ASSET;
assertThat(twoAsset.tfLpToken()).isFalse();
@@ -31,6 +33,7 @@ void testFlagValues() {
assertThat(twoAsset.tfOneAssetLpToken()).isFalse();
assertThat(twoAsset.tfLimitLpToken()).isFalse();
assertThat(twoAsset.tfTwoAssetIfEmpty()).isFalse();
+ assertThat(twoAsset.tfInnerBatchTxn()).isFalse();
AmmDepositFlags oneAssetLpToken = AmmDepositFlags.ONE_ASSET_LP_TOKEN;
assertThat(oneAssetLpToken.tfLpToken()).isFalse();
@@ -39,6 +42,7 @@ void testFlagValues() {
assertThat(oneAssetLpToken.tfOneAssetLpToken()).isTrue();
assertThat(oneAssetLpToken.tfLimitLpToken()).isFalse();
assertThat(oneAssetLpToken.tfTwoAssetIfEmpty()).isFalse();
+ assertThat(oneAssetLpToken.tfInnerBatchTxn()).isFalse();
AmmDepositFlags limitLpToken = AmmDepositFlags.LIMIT_LP_TOKEN;
assertThat(limitLpToken.tfLpToken()).isFalse();
@@ -47,6 +51,7 @@ void testFlagValues() {
assertThat(limitLpToken.tfOneAssetLpToken()).isFalse();
assertThat(limitLpToken.tfLimitLpToken()).isTrue();
assertThat(limitLpToken.tfTwoAssetIfEmpty()).isFalse();
+ assertThat(limitLpToken.tfInnerBatchTxn()).isFalse();
AmmDepositFlags twoAssetIfEmpty = AmmDepositFlags.TWO_ASSET_IF_EMPTY;
assertThat(twoAssetIfEmpty.tfLpToken()).isFalse();
@@ -55,5 +60,20 @@ void testFlagValues() {
assertThat(twoAssetIfEmpty.tfOneAssetLpToken()).isFalse();
assertThat(twoAssetIfEmpty.tfLimitLpToken()).isFalse();
assertThat(twoAssetIfEmpty.tfTwoAssetIfEmpty()).isTrue();
+ assertThat(twoAssetIfEmpty.tfInnerBatchTxn()).isFalse();
+ }
+
+ @Test
+ void testInnerBatchTxn() {
+ AmmDepositFlags flags = AmmDepositFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfLpToken()).isFalse();
+ assertThat(flags.tfSingleAsset()).isFalse();
+ assertThat(flags.tfTwoAsset()).isFalse();
+ assertThat(flags.tfOneAssetLpToken()).isFalse();
+ assertThat(flags.tfLimitLpToken()).isFalse();
+ assertThat(flags.tfTwoAssetIfEmpty()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
}
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlagsTest.java
index ba89e32ba..611bf4435 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/AmmWithdrawFlagsTest.java
@@ -16,6 +16,7 @@ void testFlagValues() {
assertThat(lpToken.tfTwoAsset()).isFalse();
assertThat(lpToken.tfOneAssetLpToken()).isFalse();
assertThat(lpToken.tfLimitLpToken()).isFalse();
+ assertThat(lpToken.tfInnerBatchTxn()).isFalse();
AmmWithdrawFlags withdrawAll = AmmWithdrawFlags.WITHDRAW_ALL;
assertThat(withdrawAll.tfLpToken()).isFalse();
@@ -25,6 +26,7 @@ void testFlagValues() {
assertThat(withdrawAll.tfTwoAsset()).isFalse();
assertThat(withdrawAll.tfOneAssetLpToken()).isFalse();
assertThat(withdrawAll.tfLimitLpToken()).isFalse();
+ assertThat(withdrawAll.tfInnerBatchTxn()).isFalse();
AmmWithdrawFlags oneAssetWithdrawAll = AmmWithdrawFlags.ONE_ASSET_WITHDRAW_ALL;
assertThat(oneAssetWithdrawAll.tfLpToken()).isFalse();
@@ -34,6 +36,7 @@ void testFlagValues() {
assertThat(oneAssetWithdrawAll.tfTwoAsset()).isFalse();
assertThat(oneAssetWithdrawAll.tfOneAssetLpToken()).isFalse();
assertThat(oneAssetWithdrawAll.tfLimitLpToken()).isFalse();
+ assertThat(oneAssetWithdrawAll.tfInnerBatchTxn()).isFalse();
AmmWithdrawFlags singleAsset = AmmWithdrawFlags.SINGLE_ASSET;
assertThat(singleAsset.tfLpToken()).isFalse();
@@ -43,6 +46,7 @@ void testFlagValues() {
assertThat(singleAsset.tfTwoAsset()).isFalse();
assertThat(singleAsset.tfOneAssetLpToken()).isFalse();
assertThat(singleAsset.tfLimitLpToken()).isFalse();
+ assertThat(singleAsset.tfInnerBatchTxn()).isFalse();
AmmWithdrawFlags twoAsset = AmmWithdrawFlags.TWO_ASSET;
assertThat(twoAsset.tfLpToken()).isFalse();
@@ -52,6 +56,7 @@ void testFlagValues() {
assertThat(twoAsset.tfTwoAsset()).isTrue();
assertThat(twoAsset.tfOneAssetLpToken()).isFalse();
assertThat(twoAsset.tfLimitLpToken()).isFalse();
+ assertThat(twoAsset.tfInnerBatchTxn()).isFalse();
AmmWithdrawFlags oneAssetLpToken = AmmWithdrawFlags.ONE_ASSET_LP_TOKEN;
assertThat(oneAssetLpToken.tfLpToken()).isFalse();
@@ -61,6 +66,7 @@ void testFlagValues() {
assertThat(oneAssetLpToken.tfTwoAsset()).isFalse();
assertThat(oneAssetLpToken.tfOneAssetLpToken()).isTrue();
assertThat(oneAssetLpToken.tfLimitLpToken()).isFalse();
+ assertThat(oneAssetLpToken.tfInnerBatchTxn()).isFalse();
AmmWithdrawFlags limitLpToken = AmmWithdrawFlags.LIMIT_LP_TOKEN;
assertThat(limitLpToken.tfLpToken()).isFalse();
@@ -70,6 +76,21 @@ void testFlagValues() {
assertThat(limitLpToken.tfTwoAsset()).isFalse();
assertThat(limitLpToken.tfOneAssetLpToken()).isFalse();
assertThat(limitLpToken.tfLimitLpToken()).isTrue();
+ assertThat(limitLpToken.tfInnerBatchTxn()).isFalse();
+ }
+ @Test
+ void testInnerBatchTxn() {
+ AmmWithdrawFlags flags = AmmWithdrawFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfLpToken()).isFalse();
+ assertThat(flags.tfWithdrawAll()).isFalse();
+ assertThat(flags.tfOneAssetWithdrawAll()).isFalse();
+ assertThat(flags.tfSingleAsset()).isFalse();
+ assertThat(flags.tfTwoAsset()).isFalse();
+ assertThat(flags.tfOneAssetLpToken()).isFalse();
+ assertThat(flags.tfLimitLpToken()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
}
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/BatchFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/BatchFlagsTest.java
new file mode 100644
index 000000000..17ffe29af
--- /dev/null
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/BatchFlagsTest.java
@@ -0,0 +1,389 @@
+package org.xrpl.xrpl4j.model.flags;
+
+/*-
+ * ========================LICENSE_START=================================
+ * xrpl4j :: core
+ * %%
+ * Copyright (C) 2020 - 2023 XRPL Foundation and its contributors
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * =========================LICENSE_END==================================
+ */
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.json.JSONException;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.util.stream.Stream;
+
+/**
+ * Unit tests for {@link BatchFlags}.
+ */
+class BatchFlagsTest extends AbstractFlagsTest {
+
+ @Test
+ void testAllOrNothingFlag() {
+ BatchFlags flags = BatchFlags.ALL_OR_NOTHING;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfAllOrNothing()).isTrue();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x00010000L);
+ }
+
+ @Test
+ void testOnlyOneFlag() {
+ BatchFlags flags = BatchFlags.ONLY_ONE;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isTrue();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x00020000L);
+ }
+
+ @Test
+ void testUntilFailureFlag() {
+ BatchFlags flags = BatchFlags.UNTIL_FAILURE;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isTrue();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x00040000L);
+ }
+
+ @Test
+ void testIndependentFlag() {
+ BatchFlags flags = BatchFlags.INDEPENDENT;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isTrue();
+ assertThat(flags.getValue()).isEqualTo(0x00080000L);
+ }
+
+ @Test
+ void testOfAllOrNothing() {
+ assertThat(BatchFlags.ofAllOrNothing()).isEqualTo(BatchFlags.ALL_OR_NOTHING);
+ }
+
+ @Test
+ void testOfOnlyOne() {
+ assertThat(BatchFlags.ofOnlyOne()).isEqualTo(BatchFlags.ONLY_ONE);
+ }
+
+ @Test
+ void testOfUntilFailure() {
+ assertThat(BatchFlags.ofUntilFailure()).isEqualTo(BatchFlags.UNTIL_FAILURE);
+ }
+
+ @Test
+ void testOfIndependent() {
+ assertThat(BatchFlags.ofIndependent()).isEqualTo(BatchFlags.INDEPENDENT);
+ }
+
+ @Test
+ void testOfWithValue() {
+ BatchFlags flags = BatchFlags.of(0x00010000L);
+ assertThat(flags.tfAllOrNothing()).isTrue();
+ assertThat(flags.getValue()).isEqualTo(0x00010000L);
+ }
+
+ @Test
+ void testOfWithOnlyOneValue() {
+ BatchFlags flags = BatchFlags.of(0x00020000L);
+ assertThat(flags.tfOnlyOne()).isTrue();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x00020000L);
+ }
+
+ @Test
+ void testOfWithUntilFailureValue() {
+ BatchFlags flags = BatchFlags.of(0x00040000L);
+ assertThat(flags.tfUntilFailure()).isTrue();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x00040000L);
+ }
+
+ @Test
+ void testOfWithIndependentValue() {
+ BatchFlags flags = BatchFlags.of(0x00080000L);
+ assertThat(flags.tfIndependent()).isTrue();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x00080000L);
+ }
+
+ @Test
+ void testOfWithZeroValue() {
+ BatchFlags flags = BatchFlags.of(0L);
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0L);
+ }
+
+ // ////////////////
+ // Test with() method
+ // ////////////////
+
+ @Test
+ void testWithCombinesFlags() {
+ BatchFlags combined = BatchFlags.ALL_OR_NOTHING.with(BatchFlags.ONLY_ONE);
+ assertThat(combined.tfAllOrNothing()).isTrue();
+ assertThat(combined.tfOnlyOne()).isTrue();
+ assertThat(combined.tfUntilFailure()).isFalse();
+ assertThat(combined.tfIndependent()).isFalse();
+ assertThat(combined.getValue()).isEqualTo(0x00010000L | 0x00020000L);
+ }
+
+ @Test
+ void testWithMultipleFlags() {
+ BatchFlags combined = BatchFlags.UNTIL_FAILURE.with(BatchFlags.INDEPENDENT);
+ assertThat(combined.tfUntilFailure()).isTrue();
+ assertThat(combined.tfIndependent()).isTrue();
+ assertThat(combined.tfAllOrNothing()).isFalse();
+ assertThat(combined.tfOnlyOne()).isFalse();
+ assertThat(combined.getValue()).isEqualTo(0x00040000L | 0x00080000L);
+ }
+
+ @Test
+ void testWithUnsetFlag() {
+ BatchFlags combined = BatchFlags.ALL_OR_NOTHING.with(BatchFlags.UNSET);
+ assertThat(combined.tfAllOrNothing()).isTrue();
+ assertThat(combined.getValue()).isEqualTo(0x00010000L);
+ }
+
+ @Test
+ void testWithChaining() {
+ BatchFlags combined = BatchFlags.ALL_OR_NOTHING
+ .with(BatchFlags.ONLY_ONE)
+ .with(BatchFlags.UNTIL_FAILURE);
+ assertThat(combined.tfAllOrNothing()).isTrue();
+ assertThat(combined.tfOnlyOne()).isTrue();
+ assertThat(combined.tfUntilFailure()).isTrue();
+ assertThat(combined.tfIndependent()).isFalse();
+ assertThat(combined.getValue()).isEqualTo(0x00010000L | 0x00020000L | 0x00040000L);
+ }
+
+ // ////////////////
+ // Test Builder
+ // ////////////////
+
+ public static Stream builderData() {
+ return getBooleanCombinations(4);
+ }
+
+ @ParameterizedTest
+ @MethodSource("builderData")
+ void testBuilderWithAllCombinations(
+ boolean tfAllOrNothing,
+ boolean tfOnlyOne,
+ boolean tfUntilFailure,
+ boolean tfIndependent
+ ) {
+ BatchFlags flags = BatchFlags.builder()
+ .tfAllOrNothing(tfAllOrNothing)
+ .tfOnlyOne(tfOnlyOne)
+ .tfUntilFailure(tfUntilFailure)
+ .tfIndependent(tfIndependent)
+ .build();
+
+ assertThat(flags.tfOnlyOne()).isEqualTo(tfOnlyOne);
+ assertThat(flags.tfUntilFailure()).isEqualTo(tfUntilFailure);
+ assertThat(flags.tfIndependent()).isEqualTo(tfIndependent);
+ }
+
+ @Test
+ void testBuilderDefaultValues() {
+ BatchFlags flags = BatchFlags.builder().build();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isTrue();
+ }
+
+ @Test
+ void testBuilderWithAllOrNothingOnly() {
+ BatchFlags flags = BatchFlags.builder()
+ .tfAllOrNothing(true)
+ .build();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isTrue();
+ }
+
+ @Test
+ void testBuilderWithOnlyOneOnly() {
+ BatchFlags flags = BatchFlags.builder()
+ .tfOnlyOne(true)
+ .build();
+ assertThat(flags.tfOnlyOne()).isTrue();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isTrue();
+ }
+
+ @Test
+ void testBuilderWithUntilFailureOnly() {
+ BatchFlags flags = BatchFlags.builder()
+ .tfUntilFailure(true)
+ .build();
+ assertThat(flags.tfUntilFailure()).isTrue();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfIndependent()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isTrue();
+ }
+
+ @Test
+ void testBuilderWithIndependentOnly() {
+ BatchFlags flags = BatchFlags.builder()
+ .tfIndependent(true)
+ .build();
+ assertThat(flags.tfIndependent()).isTrue();
+ assertThat(flags.tfAllOrNothing()).isFalse();
+ assertThat(flags.tfOnlyOne()).isFalse();
+ assertThat(flags.tfUntilFailure()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isTrue();
+ }
+
+ // ////////////////
+ // Test TransactionFlags as Batch Flags
+ // ////////////////
+
+ @Test
+ void testAllOrNothingJson() throws JSONException, JsonProcessingException {
+ TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(BatchFlags.ALL_OR_NOTHING);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.ALL_OR_NOTHING.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testOnlyOneJson() throws JSONException, JsonProcessingException {
+ TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(BatchFlags.ONLY_ONE);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.ONLY_ONE.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testEmptyFlags() throws JSONException, JsonProcessingException {
+ TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(BatchFlags.EMPTY);
+ String json = "{}";
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testUnsetFlags() throws JSONException, JsonProcessingException {
+ TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(BatchFlags.UNSET);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.UNSET.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testUntilFailureJson() throws JSONException, JsonProcessingException {
+ TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(BatchFlags.UNTIL_FAILURE);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.UNTIL_FAILURE.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testIndependentJson() throws JSONException, JsonProcessingException {
+ TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(BatchFlags.INDEPENDENT);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.INDEPENDENT.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ // ////////////////
+ // Test Batch Flags as Transaction Flags
+ // ////////////////
+
+ @Test
+ void testAllOrNothingBatchJson() throws JSONException, JsonProcessingException {
+ BatchFlagsWrapper wrapper = BatchFlagsWrapper.of(BatchFlags.ALL_OR_NOTHING);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.ALL_OR_NOTHING.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testOnlyOneBatchJson() throws JSONException, JsonProcessingException {
+ BatchFlagsWrapper wrapper = BatchFlagsWrapper.of(BatchFlags.ONLY_ONE);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.ONLY_ONE.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testEmptyBatchFlags() throws JSONException, JsonProcessingException {
+ BatchFlagsWrapper wrapper = BatchFlagsWrapper.of(BatchFlags.EMPTY);
+ String json = "{}";
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testUnsetBatchFlags() throws JSONException, JsonProcessingException {
+ BatchFlagsWrapper wrapper = BatchFlagsWrapper.of(BatchFlags.UNSET);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.UNSET.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testUntilFailureBatchJson() throws JSONException, JsonProcessingException {
+ BatchFlagsWrapper wrapper = BatchFlagsWrapper.of(BatchFlags.UNTIL_FAILURE);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.UNTIL_FAILURE.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+
+ @Test
+ void testIndependentBatchJson() throws JSONException, JsonProcessingException {
+ BatchFlagsWrapper wrapper = BatchFlagsWrapper.of(BatchFlags.INDEPENDENT);
+ String json = String.format("{\n" +
+ "\"flags\": %s\n" +
+ "}", BatchFlags.INDEPENDENT.getValue());
+ assertCanSerializeAndDeserialize(wrapper, json);
+ }
+}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlagsTest.java
index a75cfb221..c1be5ee9a 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenAuthorizeFlagsTest.java
@@ -9,11 +9,22 @@ class MpTokenAuthorizeFlagsTest {
@Test
void testEmpty() {
assertThat(MpTokenAuthorizeFlags.empty().isEmpty()).isTrue();
+ assertThat(MpTokenAuthorizeFlags.empty().tfInnerBatchTxn()).isFalse();
}
@Test
void tfMptUnauthorize() {
assertThat(MpTokenAuthorizeFlags.UNAUTHORIZE.tfMptUnauthorize()).isTrue();
+ assertThat(MpTokenAuthorizeFlags.UNAUTHORIZE.tfInnerBatchTxn()).isFalse();
assertThat(MpTokenAuthorizeFlags.empty().tfMptUnauthorize()).isFalse();
}
-}
\ No newline at end of file
+
+ @Test
+ void testInnerBatchTxn() {
+ MpTokenAuthorizeFlags flags = MpTokenAuthorizeFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfMptUnauthorize()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlagsTest.java
index 0e3b4baf0..e413ae936 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateFlagsTest.java
@@ -12,7 +12,7 @@
class MpTokenIssuanceCreateFlagsTest extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(6);
+ return getBooleanCombinations(7);
}
@ParameterizedTest
@@ -23,7 +23,8 @@ public void testDeriveIndividualFlagsFromFlags(
boolean tfMptCanEscrow,
boolean tfMptCanTrade,
boolean tfMptCanTransfer,
- boolean tfMptCanClawback
+ boolean tfMptCanClawback,
+ boolean tfInnerBatchTxn
) {
long expectedFlags = (MpTokenIssuanceCreateFlags.FULLY_CANONICAL_SIG.getValue()) |
(tfMptCanLock ? MpTokenIssuanceCreateFlags.CAN_LOCK.getValue() : 0L) |
@@ -31,7 +32,8 @@ public void testDeriveIndividualFlagsFromFlags(
(tfMptCanEscrow ? MpTokenIssuanceCreateFlags.CAN_ESCROW.getValue() : 0L) |
(tfMptCanTrade ? MpTokenIssuanceCreateFlags.CAN_TRADE.getValue() : 0L) |
(tfMptCanTransfer ? MpTokenIssuanceCreateFlags.CAN_TRANSFER.getValue() : 0L) |
- (tfMptCanClawback ? MpTokenIssuanceCreateFlags.CAN_CLAWBACK.getValue() : 0L);
+ (tfMptCanClawback ? MpTokenIssuanceCreateFlags.CAN_CLAWBACK.getValue() : 0L) |
+ (tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN.getValue() : 0L);
MpTokenIssuanceCreateFlags flags = MpTokenIssuanceCreateFlags.builder()
.tfMptCanLock(tfMptCanLock)
@@ -40,6 +42,7 @@ public void testDeriveIndividualFlagsFromFlags(
.tfMptCanTrade(tfMptCanTrade)
.tfMptCanTransfer(tfMptCanTransfer)
.tfMptCanClawback(tfMptCanClawback)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
assertThat(flags.getValue()).isEqualTo(expectedFlags);
@@ -49,7 +52,34 @@ public void testDeriveIndividualFlagsFromFlags(
assertThat(flags.tfMptCanTrade()).isEqualTo(tfMptCanTrade);
assertThat(flags.tfMptCanTransfer()).isEqualTo(tfMptCanTransfer);
assertThat(flags.tfMptCanClawback()).isEqualTo(tfMptCanClawback);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
+ @Test
+ void testInnerBatchTxn() {
+ MpTokenIssuanceCreateFlags flags = MpTokenIssuanceCreateFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfMptCanLock()).isFalse();
+ assertThat(flags.tfMptRequireAuth()).isFalse();
+ assertThat(flags.tfMptCanEscrow()).isFalse();
+ assertThat(flags.tfMptCanTrade()).isFalse();
+ assertThat(flags.tfMptCanTransfer()).isFalse();
+ assertThat(flags.tfMptCanClawback()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
-}
\ No newline at end of file
+ @Test
+ void testEmptyFlags() {
+ MpTokenIssuanceCreateFlags flags = MpTokenIssuanceCreateFlags.empty();
+ assertThat(flags.isEmpty()).isTrue();
+ assertThat(flags.tfMptCanLock()).isFalse();
+ assertThat(flags.tfMptRequireAuth()).isFalse();
+ assertThat(flags.tfMptCanEscrow()).isFalse();
+ assertThat(flags.tfMptCanTrade()).isFalse();
+ assertThat(flags.tfMptCanTransfer()).isFalse();
+ assertThat(flags.tfMptCanClawback()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0L);
+ }
+}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlagsTest.java
index b3b4aa75a..97154a6c2 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceSetFlagsTest.java
@@ -3,26 +3,34 @@
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import java.util.stream.Stream;
class MpTokenIssuanceSetFlagsTest {
@Test
void testEmpty() {
assertThat(MpTokenIssuanceSetFlags.empty().isEmpty()).isTrue();
+ assertThat(MpTokenIssuanceSetFlags.empty().tfInnerBatchTxn()).isFalse();
}
@Test
void testGetters() {
assertThat(MpTokenIssuanceSetFlags.LOCK.tfMptLock()).isTrue();
assertThat(MpTokenIssuanceSetFlags.LOCK.tfMptUnlock()).isFalse();
+ assertThat(MpTokenIssuanceSetFlags.LOCK.tfInnerBatchTxn()).isFalse();
assertThat(MpTokenIssuanceSetFlags.UNLOCK.tfMptLock()).isFalse();
assertThat(MpTokenIssuanceSetFlags.UNLOCK.tfMptUnlock()).isTrue();
+ assertThat(MpTokenIssuanceSetFlags.UNLOCK.tfInnerBatchTxn()).isFalse();
assertThat(MpTokenIssuanceSetFlags.empty().tfMptLock()).isFalse();
assertThat(MpTokenIssuanceSetFlags.empty().tfMptUnlock()).isFalse();
}
-}
\ No newline at end of file
+
+ @Test
+ void testInnerBatchTxn() {
+ MpTokenIssuanceSetFlags flags = MpTokenIssuanceSetFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfMptLock()).isFalse();
+ assertThat(flags.tfMptUnlock()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlagsTests.java
index c01240921..d8c3552a2 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlagsTests.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenCreateOfferFlagsTests.java
@@ -34,33 +34,37 @@
public class NfTokenCreateOfferFlagsTests extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(4);
+ return getBooleanCombinations(2);
}
@ParameterizedTest
@MethodSource("data")
public void testFlagsConstructionWithIndividualFlags(
- boolean tfSellToken
+ boolean tfSellToken,
+ boolean tfInnerBatchTxn
) {
NfTokenCreateOfferFlags flags = NfTokenCreateOfferFlags.builder()
.tfSellToken(tfSellToken)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
assertThat(flags.getValue())
- .isEqualTo(getExpectedFlags(tfSellToken));
+ .isEqualTo(getExpectedFlags(tfSellToken, tfInnerBatchTxn));
}
@ParameterizedTest
@MethodSource("data")
public void testDeriveIndividualFlagsFromFlags(
- boolean tfSellToken
+ boolean tfSellToken,
+ boolean tfInnerBatchTxn
) {
- long expectedFlags = getExpectedFlags(tfSellToken);
+ long expectedFlags = getExpectedFlags(tfSellToken, tfInnerBatchTxn);
NfTokenCreateOfferFlags flags = NfTokenCreateOfferFlags.of(expectedFlags);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
assertThat(flags.tfFullyCanonicalSig()).isEqualTo(true);
assertThat(flags.tfSellNfToken()).isEqualTo(tfSellToken);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
@Test
@@ -70,16 +74,19 @@ void testEmptyFlags() {
assertThat(flags.tfSellNfToken()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
}
@ParameterizedTest
@MethodSource("data")
void testJson(
- boolean tfSellToken
+ boolean tfSellToken,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
NfTokenCreateOfferFlags flags = NfTokenCreateOfferFlags.builder()
.tfSellToken(tfSellToken)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(flags);
@@ -101,10 +108,21 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
+ @Test
+ void testInnerBatchTxn() {
+ NfTokenCreateOfferFlags flags = NfTokenCreateOfferFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfSellNfToken()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
private long getExpectedFlags(
- boolean tfSellToken
+ boolean tfSellToken,
+ boolean tfInnerBatchTxn
) {
return (TransactionFlags.FULLY_CANONICAL_SIG.getValue()) |
- (tfSellToken ? NfTokenCreateOfferFlags.SELL_NFTOKEN.getValue() : 0L);
+ (tfSellToken ? NfTokenCreateOfferFlags.SELL_NFTOKEN.getValue() : 0L) |
+ (tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN.getValue() : 0L);
}
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlagsTests.java
index bf0103618..ec6bd7210 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlagsTests.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/NfTokenMintFlagsTests.java
@@ -37,7 +37,7 @@
public class NfTokenMintFlagsTests extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(4);
+ return getBooleanCombinations(5);
}
@ParameterizedTest
@@ -46,17 +46,19 @@ public void testFlagsConstructionWithIndividualFlags(
boolean tfBurnable,
boolean tfOnlyXRP,
boolean tfTrustLine,
- boolean tfTransferable
+ boolean tfTransferable,
+ boolean tfInnerBatchTxn
) {
NfTokenMintFlags flags = NfTokenMintFlags.builder()
.tfBurnable(tfBurnable)
.tfOnlyXRP(tfOnlyXRP)
.tfTrustLine(tfTrustLine)
.tfTransferable(tfTransferable)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
assertThat(flags.getValue())
- .isEqualTo(getExpectedFlags(tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable));
+ .isEqualTo(getExpectedFlags(tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable, tfInnerBatchTxn));
}
@ParameterizedTest
@@ -65,9 +67,10 @@ public void testDeriveIndividualFlagsFromFlags(
boolean tfBurnable,
boolean tfOnlyXRP,
boolean tfTrustLine,
- boolean tfTransferable
+ boolean tfTransferable,
+ boolean tfInnerBatchTxn
) {
- long expectedFlags = getExpectedFlags(tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable);
+ long expectedFlags = getExpectedFlags(tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable, tfInnerBatchTxn);
NfTokenMintFlags flags = NfTokenMintFlags.of(expectedFlags);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
@@ -76,6 +79,7 @@ public void testDeriveIndividualFlagsFromFlags(
assertThat(flags.tfOnlyXRP()).isEqualTo(tfOnlyXRP);
assertThat(flags.tfTrustLine()).isEqualTo(tfTrustLine);
assertThat(flags.tfTransferable()).isEqualTo(tfTransferable);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
@Test
@@ -88,6 +92,7 @@ void testEmptyFlags() {
assertThat(flags.tfTrustLine()).isFalse();
assertThat(flags.tfTransferable()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
}
@@ -97,9 +102,10 @@ void testJson(
boolean tfBurnable,
boolean tfOnlyXRP,
boolean tfTrustLine,
- boolean tfTransferable
+ boolean tfTransferable,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
- long expectedFlags = getExpectedFlags(tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable);
+ long expectedFlags = getExpectedFlags(tfBurnable, tfOnlyXRP, tfTrustLine, tfTransferable, tfInnerBatchTxn);
NfTokenMintFlags flags = NfTokenMintFlags.of(expectedFlags);
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(flags);
@@ -121,17 +127,30 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
+ @Test
+ void testInnerBatchTxn() {
+ NfTokenMintFlags flags = NfTokenMintFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfBurnable()).isFalse();
+ assertThat(flags.tfOnlyXRP()).isFalse();
+ assertThat(flags.tfTrustLine()).isFalse();
+ assertThat(flags.tfTransferable()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
private long getExpectedFlags(
boolean tfBurnable,
boolean tfOnlyXRP,
boolean tfTrustLine,
- boolean tfTransferable
+ boolean tfTransferable,
+ boolean tfInnerBatchTxn
) {
return (NfTokenMintFlags.FULLY_CANONICAL_SIG.getValue()) |
(tfBurnable ? NfTokenMintFlags.BURNABLE.getValue() : 0L) |
(tfOnlyXRP ? NfTokenMintFlags.ONLY_XRP.getValue() : 0L) |
(tfTrustLine ? NfTokenMintFlags.TRUSTLINE.getValue() : 0L) |
- (tfTransferable ? NfTokenMintFlags.TRANSFERABLE.getValue() : 0L);
+ (tfTransferable ? NfTokenMintFlags.TRANSFERABLE.getValue() : 0L) |
+ (tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN.getValue() : 0L);
}
}
-
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlagsTests.java
index 1316b3963..3b810519b 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlagsTests.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/OfferCreateFlagsTests.java
@@ -34,7 +34,7 @@
public class OfferCreateFlagsTests extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(5);
+ return getBooleanCombinations(6);
}
@ParameterizedTest
@@ -44,7 +44,8 @@ public void testFlagsConstructionWithIndividualFlags(
boolean tfImmediateOrCancel,
boolean tfFillOrKill,
boolean tfSell,
- boolean tfHybrid
+ boolean tfHybrid,
+ boolean tfInnerBatchTxn
) {
OfferCreateFlags flags = OfferCreateFlags.builder()
.tfPassive(tfPassive)
@@ -52,10 +53,11 @@ public void testFlagsConstructionWithIndividualFlags(
.tfFillOrKill(tfFillOrKill)
.tfSell(tfSell)
.tfHybrid(tfHybrid)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
assertThat(flags.getValue())
- .isEqualTo(getExpectedFlags(tfPassive, tfImmediateOrCancel, tfFillOrKill, tfSell, tfHybrid));
+ .isEqualTo(getExpectedFlags(tfPassive, tfImmediateOrCancel, tfFillOrKill, tfSell, tfHybrid, tfInnerBatchTxn));
}
@ParameterizedTest
@@ -65,9 +67,12 @@ public void testDeriveIndividualFlagsFromFlags(
boolean tfImmediateOrCancel,
boolean tfFillOrKill,
boolean tfSell,
- boolean tfHybrid
+ boolean tfHybrid,
+ boolean tfInnerBatchTxn
) {
- long expectedFlags = getExpectedFlags(tfPassive, tfImmediateOrCancel, tfFillOrKill, tfSell, tfHybrid);
+ long expectedFlags = getExpectedFlags(
+ tfPassive, tfImmediateOrCancel, tfFillOrKill, tfSell, tfHybrid, tfInnerBatchTxn
+ );
OfferCreateFlags flags = OfferCreateFlags.of(expectedFlags);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
@@ -77,6 +82,7 @@ public void testDeriveIndividualFlagsFromFlags(
assertThat(flags.tfFillOrKill()).isEqualTo(tfFillOrKill);
assertThat(flags.tfSell()).isEqualTo(tfSell);
assertThat(flags.tfHybrid()).isEqualTo(tfHybrid);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
@Test
@@ -90,6 +96,7 @@ void testEmptyFlags() {
assertThat(flags.tfSell()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
assertThat(flags.tfHybrid()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
}
@@ -100,7 +107,8 @@ void testJson(
boolean tfImmediateOrCancel,
boolean tfFillOrKill,
boolean tfSell,
- boolean tfHybrid
+ boolean tfHybrid,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
OfferCreateFlags flags = OfferCreateFlags.builder()
.tfPassive(tfPassive)
@@ -108,6 +116,7 @@ void testJson(
.tfFillOrKill(tfFillOrKill)
.tfSell(tfSell)
.tfHybrid(tfHybrid)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(flags);
@@ -128,18 +137,33 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
+ @Test
+ void testInnerBatchTxn() {
+ OfferCreateFlags flags = OfferCreateFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfPassive()).isFalse();
+ assertThat(flags.tfImmediateOrCancel()).isFalse();
+ assertThat(flags.tfFillOrKill()).isFalse();
+ assertThat(flags.tfSell()).isFalse();
+ assertThat(flags.tfHybrid()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
private long getExpectedFlags(
boolean tfPassive,
boolean tfImmediateOrCancel,
boolean tfFillOrKill,
boolean tfSell,
- boolean tfHybrid
+ boolean tfHybrid,
+ boolean tfInnerBatchTxn
) {
return (OfferCreateFlags.FULLY_CANONICAL_SIG.getValue()) |
(tfPassive ? OfferCreateFlags.PASSIVE.getValue() : 0L) |
(tfImmediateOrCancel ? OfferCreateFlags.IMMEDIATE_OR_CANCEL.getValue() : 0L) |
(tfFillOrKill ? OfferCreateFlags.FILL_OR_KILL.getValue() : 0L) |
(tfSell ? OfferCreateFlags.SELL.getValue() : 0L) |
- (tfHybrid ? OfferCreateFlags.HYBRID.getValue() : 0L);
+ (tfHybrid ? OfferCreateFlags.HYBRID.getValue() : 0L) |
+ (tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN.getValue() : 0L);
}
-}
\ No newline at end of file
+}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlagsTests.java
index d8032cde2..7b59d4fe2 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlagsTests.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentChannelClaimFlagsTests.java
@@ -34,36 +34,40 @@
public class PaymentChannelClaimFlagsTests extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(2);
+ return getBooleanCombinations(3);
}
@ParameterizedTest
@MethodSource("data")
public void testFlagsConstructionWithIndividualFlags(
boolean tfRenew,
- boolean tfClose
+ boolean tfClose,
+ boolean tfInnerBatchTxn
) {
PaymentChannelClaimFlags flags = PaymentChannelClaimFlags.builder()
.tfRenew(tfRenew)
.tfClose(tfClose)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
- assertThat(flags.getValue()).isEqualTo(getExpectedFlags(tfRenew, tfClose));
+ assertThat(flags.getValue()).isEqualTo(getExpectedFlags(tfRenew, tfClose, tfInnerBatchTxn));
}
@ParameterizedTest
@MethodSource("data")
public void testDeriveIndividualFlagsFromFlags(
boolean tfRenew,
- boolean tfClose
+ boolean tfClose,
+ boolean tfInnerBatchTxn
) {
- long expectedFlags = getExpectedFlags(tfRenew, tfClose);
+ long expectedFlags = getExpectedFlags(tfRenew, tfClose, tfInnerBatchTxn);
PaymentChannelClaimFlags flags = PaymentChannelClaimFlags.of(expectedFlags);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
assertThat(flags.tfFullyCanonicalSig()).isEqualTo(true);
assertThat(flags.tfRenew()).isEqualTo(tfRenew);
assertThat(flags.tfClose()).isEqualTo(tfClose);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
@Test
@@ -74,6 +78,7 @@ void testEmptyFlags() {
assertThat(flags.tfRenew()).isFalse();
assertThat(flags.tfClose()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
}
@@ -81,11 +86,13 @@ void testEmptyFlags() {
@MethodSource("data")
void testJson(
boolean tfRenew,
- boolean tfClose
+ boolean tfClose,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
PaymentChannelClaimFlags flags = PaymentChannelClaimFlags.builder()
.tfRenew(tfRenew)
.tfClose(tfClose)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(flags);
@@ -107,9 +114,21 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
- private long getExpectedFlags(boolean tfRenew, boolean tfClose) {
+ @Test
+ void testInnerBatchTxn() {
+ PaymentChannelClaimFlags flags = PaymentChannelClaimFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfRenew()).isFalse();
+ assertThat(flags.tfClose()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
+ private long getExpectedFlags(boolean tfRenew, boolean tfClose, boolean tfInnerBatchTxn) {
return (PaymentChannelClaimFlags.FULLY_CANONICAL_SIG.getValue()) |
(tfRenew ? PaymentChannelClaimFlags.RENEW.getValue() : 0L) |
- (tfClose ? PaymentChannelClaimFlags.CLOSE.getValue() : 0L);
+ (tfClose ? PaymentChannelClaimFlags.CLOSE.getValue() : 0L) |
+ (tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN.getValue() : 0L);
}
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentFlagsTests.java
index 20df0c552..4ad20176d 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentFlagsTests.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/PaymentFlagsTests.java
@@ -34,7 +34,7 @@
public class PaymentFlagsTests extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(3);
+ return getBooleanCombinations(4);
}
@ParameterizedTest
@@ -42,16 +42,18 @@ public static Stream data() {
public void testFlagsConstructionWithIndividualFlags(
boolean tfNoDirectRipple,
boolean tfPartialPayment,
- boolean tfLimitQuality
+ boolean tfLimitQuality,
+ boolean tfInnerBatchTxn
) {
PaymentFlags flags = PaymentFlags.builder()
.tfNoDirectRipple(tfNoDirectRipple)
.tfPartialPayment(tfPartialPayment)
.tfLimitQuality(tfLimitQuality)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
assertThat(flags.getValue())
- .isEqualTo(getExpectedFlags(tfNoDirectRipple, tfPartialPayment, tfLimitQuality));
+ .isEqualTo(getExpectedFlags(tfNoDirectRipple, tfPartialPayment, tfLimitQuality, tfInnerBatchTxn));
}
@ParameterizedTest
@@ -59,9 +61,10 @@ public void testFlagsConstructionWithIndividualFlags(
public void testDeriveIndividualFlagsFromFlags(
boolean tfNoDirectRipple,
boolean tfPartialPayment,
- boolean tfLimitQuality
+ boolean tfLimitQuality,
+ boolean tfInnerBatchTxn
) {
- long expectedFlags = getExpectedFlags(tfNoDirectRipple, tfPartialPayment, tfLimitQuality);
+ long expectedFlags = getExpectedFlags(tfNoDirectRipple, tfPartialPayment, tfLimitQuality, tfInnerBatchTxn);
PaymentFlags flags = PaymentFlags.of(expectedFlags);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
@@ -69,6 +72,7 @@ public void testDeriveIndividualFlagsFromFlags(
assertThat(flags.tfNoDirectRipple()).isEqualTo(tfNoDirectRipple);
assertThat(flags.tfPartialPayment()).isEqualTo(tfPartialPayment);
assertThat(flags.tfLimitQuality()).isEqualTo(tfLimitQuality);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
@Test
@@ -79,6 +83,7 @@ void testEmptyFlags() {
assertThat(flags.tfNoDirectRipple()).isFalse();
assertThat(flags.tfPartialPayment()).isFalse();
assertThat(flags.tfLimitQuality()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
}
@@ -88,12 +93,14 @@ void testEmptyFlags() {
void testJson(
boolean tfNoDirectRipple,
boolean tfPartialPayment,
- boolean tfLimitQuality
+ boolean tfLimitQuality,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
PaymentFlags flags = PaymentFlags.builder()
.tfNoDirectRipple(tfNoDirectRipple)
.tfPartialPayment(tfPartialPayment)
.tfLimitQuality(tfLimitQuality)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(flags);
@@ -115,14 +122,28 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
+ @Test
+ void testInnerBatchTxn() {
+ PaymentFlags flags = PaymentFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfNoDirectRipple()).isFalse();
+ assertThat(flags.tfPartialPayment()).isFalse();
+ assertThat(flags.tfLimitQuality()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
private long getExpectedFlags(
boolean tfNoDirectRipple,
boolean tfPartialPayment,
- boolean tfLimitQuality
+ boolean tfLimitQuality,
+ boolean tfInnerBatchTxn
) {
return (PaymentFlags.FULLY_CANONICAL_SIG.getValue()) |
(tfNoDirectRipple ? PaymentFlags.NO_DIRECT_RIPPLE.getValue() : 0L) |
(tfPartialPayment ? PaymentFlags.PARTIAL_PAYMENT.getValue() : 0L) |
- (tfLimitQuality ? PaymentFlags.LIMIT_QUALITY.getValue() : 0L);
+ (tfLimitQuality ? PaymentFlags.LIMIT_QUALITY.getValue() : 0L) |
+ (tfInnerBatchTxn ? PaymentFlags.INNER_BATCH_TXN.getValue() : 0L);
}
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TransactionFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TransactionFlagsTest.java
index ac1d5b232..50ee15d1c 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TransactionFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TransactionFlagsTest.java
@@ -32,4 +32,45 @@ void testFlags() {
assertThat(flags.tfFullyCanonicalSig()).isFalse();
assertThat(flags.isEmpty()).isTrue();
}
+
+ @Test
+ void testOfWithValue() {
+ TransactionFlags flags = TransactionFlags.of(0x80000000L);
+ assertThat(flags.tfFullyCanonicalSig()).isTrue();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x80000000L);
+ }
+
+ @Test
+ void testOfWithInnerBatchTxnValue() {
+ TransactionFlags flags = TransactionFlags.of(0x40000000L);
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.getValue()).isEqualTo(0x40000000L);
+ }
+
+ @Test
+ void testOfWithCombinedValue() {
+ TransactionFlags flags = TransactionFlags.of(0x80000000L | 0x40000000L);
+ assertThat(flags.tfFullyCanonicalSig()).isTrue();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.getValue()).isEqualTo(0xC0000000L);
+ }
+
+ @Test
+ void testOfWithZeroValue() {
+ TransactionFlags flags = TransactionFlags.of(0L);
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0L);
+ }
+
+ @Test
+ void testTfInnerBatchTxn() {
+ TransactionFlags flags = TransactionFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(0x40000000L);
+ }
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TrustSetFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TrustSetFlagsTests.java
index 83a55f51f..1f8d33a29 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TrustSetFlagsTests.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/TrustSetFlagsTests.java
@@ -34,7 +34,7 @@
public class TrustSetFlagsTests extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(7);
+ return getBooleanCombinations(8);
}
@ParameterizedTest
@@ -46,10 +46,12 @@ public void testFlagsConstructionWithIndividualFlags(
boolean tfSetFreeze,
boolean tfClearFreeze,
boolean tfSetDeepFreeze,
- boolean tfClearDeepFreeze
+ boolean tfClearDeepFreeze,
+ boolean tfInnerBatchTxn
) {
TrustSetFlags.Builder builder = TrustSetFlags.builder()
- .tfSetfAuth(tfSetfAuth);
+ .tfSetfAuth(tfSetfAuth)
+ .tfInnerBatchTxn(tfInnerBatchTxn);
if (tfSetNoRipple) {
builder.tfSetNoRipple();
@@ -84,7 +86,8 @@ public void testFlagsConstructionWithIndividualFlags(
tfSetFreeze,
tfClearFreeze,
tfSetDeepFreeze,
- tfClearDeepFreeze
+ tfClearDeepFreeze,
+ tfInnerBatchTxn
);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
}
@@ -98,7 +101,8 @@ public void testDeriveIndividualFlagsFromFlags(
boolean tfSetFreeze,
boolean tfClearFreeze,
boolean tfSetDeepFreeze,
- boolean tfClearDeepFreeze
+ boolean tfClearDeepFreeze,
+ boolean tfInnerBatchTxn
) {
long expectedFlags = getExpectedFlags(
tfSetfAuth,
@@ -107,7 +111,8 @@ public void testDeriveIndividualFlagsFromFlags(
tfSetFreeze,
tfClearFreeze,
tfSetDeepFreeze,
- tfClearDeepFreeze
+ tfClearDeepFreeze,
+ tfInnerBatchTxn
);
TrustSetFlags flags = TrustSetFlags.of(expectedFlags);
@@ -120,6 +125,7 @@ public void testDeriveIndividualFlagsFromFlags(
assertThat(flags.tfClearFreeze()).isEqualTo(tfClearFreeze);
assertThat(flags.tfSetDeepFreeze()).isEqualTo(tfSetDeepFreeze);
assertThat(flags.tfClearDeepFreeze()).isEqualTo(tfClearDeepFreeze);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
@Test
@@ -134,6 +140,7 @@ void testEmptyFlags() {
assertThat(flags.tfClearFreeze()).isFalse();
assertThat(flags.tfSetDeepFreeze()).isFalse();
assertThat(flags.tfClearDeepFreeze()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
}
@@ -147,7 +154,8 @@ void testJson(
boolean tfSetFreeze,
boolean tfClearFreeze,
boolean tfSetDeepFreeze,
- boolean tfClearDeepFreeze
+ boolean tfClearDeepFreeze,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
long expectedFlags = getExpectedFlags(
tfSetfAuth,
@@ -156,7 +164,8 @@ void testJson(
tfSetFreeze,
tfClearFreeze,
tfSetDeepFreeze,
- tfClearDeepFreeze
+ tfClearDeepFreeze,
+ tfInnerBatchTxn
);
TrustSetFlags flags = TrustSetFlags.of(expectedFlags);
@@ -179,6 +188,22 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
+ @Test
+ void testInnerBatchTxn() {
+ TrustSetFlags flags = TrustSetFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfSetfAuth()).isFalse();
+ assertThat(flags.tfSetNoRipple()).isFalse();
+ assertThat(flags.tfClearNoRipple()).isFalse();
+ assertThat(flags.tfSetFreeze()).isFalse();
+ assertThat(flags.tfClearFreeze()).isFalse();
+ assertThat(flags.tfSetDeepFreeze()).isFalse();
+ assertThat(flags.tfClearDeepFreeze()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
private long getExpectedFlags(
boolean tfSetfAuth,
boolean tfSetNoRipple,
@@ -186,7 +211,8 @@ private long getExpectedFlags(
boolean tfSetFreeze,
boolean tfClearFreeze,
boolean tfSetDeepFreeze,
- boolean tfClearDeepFreeze
+ boolean tfClearDeepFreeze,
+ boolean tfInnerBatchTxn
) {
return (TrustSetFlags.FULLY_CANONICAL_SIG.getValue()) |
(tfSetfAuth ? TrustSetFlags.SET_F_AUTH.getValue() : 0L) |
@@ -195,6 +221,7 @@ private long getExpectedFlags(
(tfSetFreeze ? TrustSetFlags.SET_FREEZE.getValue() : 0L) |
(tfClearFreeze ? TrustSetFlags.CLEAR_FREEZE.getValue() : 0L) |
(tfSetDeepFreeze ? TrustSetFlags.SET_DEEP_FREEZE.getValue() : 0L) |
- (tfClearDeepFreeze ? TrustSetFlags.CLEAR_DEEP_FREEZE.getValue() : 0L);
+ (tfClearDeepFreeze ? TrustSetFlags.CLEAR_DEEP_FREEZE.getValue() : 0L) |
+ (tfInnerBatchTxn ? TrustSetFlags.INNER_BATCH_TXN.getValue() : 0L);
}
}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlagsTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlagsTest.java
index d647ce82a..6bc1f4260 100644
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlagsTest.java
+++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/flags/XChainModifyBridgeFlagsTest.java
@@ -14,34 +14,38 @@
class XChainModifyBridgeFlagsTest extends AbstractFlagsTest {
public static Stream data() {
- return getBooleanCombinations(1);
+ return getBooleanCombinations(2);
}
@ParameterizedTest
@MethodSource("data")
public void testFlagsConstructionWithIndividualFlags(
- boolean tfClearAccountCreateAmount
+ boolean tfClearAccountCreateAmount,
+ boolean tfInnerBatchTxn
) {
XChainModifyBridgeFlags flags = XChainModifyBridgeFlags.builder()
.tfClearAccountCreateAmount(tfClearAccountCreateAmount)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
assertThat(flags.getValue())
- .isEqualTo(getExpectedFlags(tfClearAccountCreateAmount));
+ .isEqualTo(getExpectedFlags(tfClearAccountCreateAmount, tfInnerBatchTxn));
}
@ParameterizedTest
@MethodSource("data")
void testDeriveIndividualFlagsFromFlags(
- boolean tfClearAccountCreateAmount
+ boolean tfClearAccountCreateAmount,
+ boolean tfInnerBatchTxn
) {
- long expectedFlags = getExpectedFlags(tfClearAccountCreateAmount);
+ long expectedFlags = getExpectedFlags(tfClearAccountCreateAmount, tfInnerBatchTxn);
XChainModifyBridgeFlags flags = XChainModifyBridgeFlags.of(expectedFlags);
assertThat(flags.getValue()).isEqualTo(expectedFlags);
assertThat(flags.tfFullyCanonicalSig()).isTrue();
assertThat(flags.tfClearAccountCreateAmount()).isEqualTo(tfClearAccountCreateAmount);
+ assertThat(flags.tfInnerBatchTxn()).isEqualTo(tfInnerBatchTxn);
}
@Test
@@ -50,16 +54,19 @@ void testEmptyFlags() {
assertThat(flags.isEmpty()).isTrue();
assertThat(flags.tfFullyCanonicalSig()).isFalse();
assertThat(flags.tfClearAccountCreateAmount()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isFalse();
assertThat(flags.getValue()).isEqualTo(0L);
}
@ParameterizedTest
@MethodSource("data")
void testJson(
- boolean tfClearAccountCreateAmount
+ boolean tfClearAccountCreateAmount,
+ boolean tfInnerBatchTxn
) throws JSONException, JsonProcessingException {
XChainModifyBridgeFlags flags = XChainModifyBridgeFlags.builder()
.tfClearAccountCreateAmount(tfClearAccountCreateAmount)
+ .tfInnerBatchTxn(tfInnerBatchTxn)
.build();
TransactionFlagsWrapper wrapper = TransactionFlagsWrapper.of(flags);
@@ -80,10 +87,22 @@ void testEmptyJson() throws JSONException, JsonProcessingException {
assertCanSerializeAndDeserialize(wrapper, json);
}
+ @Test
+ void testInnerBatchTxn() {
+ XChainModifyBridgeFlags flags = XChainModifyBridgeFlags.INNER_BATCH_TXN;
+ assertThat(flags.isEmpty()).isFalse();
+ assertThat(flags.tfInnerBatchTxn()).isTrue();
+ assertThat(flags.tfClearAccountCreateAmount()).isFalse();
+ assertThat(flags.tfFullyCanonicalSig()).isFalse();
+ assertThat(flags.getValue()).isEqualTo(TransactionFlags.INNER_BATCH_TXN.getValue());
+ }
+
private long getExpectedFlags(
- boolean tfClearAccountCreateAmount
+ boolean tfClearAccountCreateAmount,
+ boolean tfInnerBatchTxn
) {
return (XChainModifyBridgeFlags.FULLY_CANONICAL_SIG.getValue()) |
- (tfClearAccountCreateAmount ? XChainModifyBridgeFlags.CLEAR_ACCOUNT_CREATE_AMOUNT.getValue() : 0L);
+ (tfClearAccountCreateAmount ? XChainModifyBridgeFlags.CLEAR_ACCOUNT_CREATE_AMOUNT.getValue() : 0L) |
+ (tfInnerBatchTxn ? TransactionFlags.INNER_BATCH_TXN.getValue() : 0L);
}
-}
\ No newline at end of file
+}
diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/AccountSetTransactionFlagsTests.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/AccountSetTransactionFlagsTests.java
deleted file mode 100644
index c37189594..000000000
--- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/AccountSetTransactionFlagsTests.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.xrpl.xrpl4j.model.transactions;
-
-/*-
- * ========================LICENSE_START=================================
- * xrpl4j :: model
- * %%
- * Copyright (C) 2020 - 2022 XRPL Foundation and its contributors
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * =========================LICENSE_END==================================
- */
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.common.primitives.UnsignedInteger;
-import org.junit.jupiter.api.Test;
-
-public class AccountSetTransactionFlagsTests {
-
- @Test
- public void testDeriveIndividualFlagsFromFlags() {
- AccountSet accountSet = AccountSet.builder()
- .account(Address.of("r9TeThyi5xiuUUrFjtPKZiHcDxs7K9H6Rb"))
- .fee(XrpCurrencyAmount.ofDrops(10))
- .sequence(UnsignedInteger.ONE)
- .build();
-
- assertThat(accountSet.flags().isEmpty()).isTrue();
- }
-}