Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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);
}
Expand All @@ -77,7 +87,8 @@ private static AccountSetTransactionFlags of(
boolean tfRequireAuth,
boolean tfOptionalAuth,
boolean tfDisallowXrp,
boolean tfAllowXrp
boolean tfAllowXrp,
boolean tfInnerBatchTxn
) {
Preconditions.checkArgument(
!(tfRequireDestTag && tfOptionalDestTag),
Expand All @@ -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()
);
}
Expand Down Expand Up @@ -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}.
*/
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*
Expand All @@ -300,7 +337,8 @@ public AccountSetTransactionFlags build() {
tfRequireAuth,
tfOptionalAuth,
tfDisallowXrp,
tfAllowXrp
tfAllowXrp,
tfInnerBatchTxn
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* {@link TransactionFlags} for {@link AmmClawback} transactions.
*/
public class AmmClawbackFlags extends TransactionFlags {

/**
* Constant {@link AmmDepositFlags} for the {@code tfClawTwoAssets} flag.
*/
Expand All @@ -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);
}
Expand All @@ -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}.
*/
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -105,4 +111,13 @@ public boolean tfTwoAssetIfEmpty() {
return this.isSet(TWO_ASSET_IF_EMPTY);
}

}
/**
* 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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
Loading
Loading