accountSetResult = xrplClient.submit(sourceWallet, accountSet);
assertThat(accountSetResult.result()).isEqualTo(SUCCESS_STATUS);
- logger.info("AccountSet successful: https://testnet.xrpl.org/transactions/" +
+
+ logInfo(
+ accountSetResult.transactionResult().transaction().transactionType(),
accountSetResult.transactionResult().hash()
);
}
diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TransactionWithMemoIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TransactionWithMemoIT.java
index 261e1ba8a..8bf96b6e3 100644
--- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TransactionWithMemoIT.java
+++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TransactionWithMemoIT.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.
@@ -68,7 +68,9 @@ public void transactionWithMemoNibble() throws JsonRpcClientErrorException {
assertThat(result.result()).isEqualTo(SUCCESS_STATUS);
assertThat(result.transactionResult().transaction().hash()).isNotEmpty().get()
.isEqualTo(result.transactionResult().hash());
- logger.info("Payment successful: https://testnet.xrpl.org/transactions/" +
+
+ logInfo(
+ result.transactionResult().transaction().transactionType(),
result.transactionResult().hash()
);
@@ -112,7 +114,9 @@ public void transactionWithPlaintextMemo() throws JsonRpcClientErrorException {
assertThat(result.result()).isEqualTo(SUCCESS_STATUS);
assertThat(result.transactionResult().transaction().hash()).isNotEmpty().get()
.isEqualTo(result.transactionResult().hash());
- logger.info("Payment successful: https://testnet.xrpl.org/transactions/" +
+
+ logInfo(
+ result.transactionResult().transaction().transactionType(),
result.transactionResult().hash()
);
diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/DevnetEnvironment.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/DevnetEnvironment.java
new file mode 100644
index 000000000..24bc4574f
--- /dev/null
+++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/DevnetEnvironment.java
@@ -0,0 +1,49 @@
+package org.xrpl.xrpl4j.tests.environment;
+
+/*-
+ * ========================LICENSE_START=================================
+ * xrpl4j :: integration-tests
+ * %%
+ * 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 okhttp3.HttpUrl;
+import org.xrpl.xrpl4j.client.XrplClient;
+import org.xrpl.xrpl4j.client.faucet.FaucetClient;
+import org.xrpl.xrpl4j.client.faucet.FundAccountRequest;
+import org.xrpl.xrpl4j.model.transactions.Address;
+
+/**
+ * XRPL devnet environment.
+ */
+public class DevnetEnvironment implements XrplEnvironment {
+
+ private final FaucetClient faucetClient =
+ FaucetClient.construct(HttpUrl.parse("https://faucet.devnet.rippletest.net"));
+
+ private final XrplClient xrplClient = new XrplClient(HttpUrl.parse("https://s.devnet.rippletest.net:51234"));
+
+ @Override
+ public XrplClient getXrplClient() {
+ return xrplClient;
+ }
+
+ @Override
+ public void fundAccount(Address classicAddress) {
+ faucetClient.fundAccount(FundAccountRequest.of(classicAddress));
+ }
+
+}
\ No newline at end of file
diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/LocalRippledEnvironment.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/LocalRippledEnvironment.java
index cbb2cc624..c01b185bc 100644
--- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/LocalRippledEnvironment.java
+++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/LocalRippledEnvironment.java
@@ -29,6 +29,7 @@
import org.xrpl.xrpl4j.model.client.accounts.AccountInfoRequestParams;
import org.xrpl.xrpl4j.model.client.accounts.AccountInfoResult;
import org.xrpl.xrpl4j.model.client.fees.FeeResult;
+import org.xrpl.xrpl4j.model.client.fees.FeeUtils;
import org.xrpl.xrpl4j.model.client.transactions.SubmitResult;
import org.xrpl.xrpl4j.model.transactions.Address;
import org.xrpl.xrpl4j.model.transactions.Payment;
@@ -82,7 +83,7 @@ protected void sendPayment(Wallet sourceWallet, Address destinationAddress, XrpC
AccountInfoResult accountInfo = this.getCurrentAccountInfo(sourceWallet.classicAddress());
Payment payment = Payment.builder()
.account(sourceWallet.classicAddress())
- .fee(feeResult.drops().minimumFee())
+ .fee(FeeUtils.computeNetworkFees(feeResult).recommendedFee())
.sequence(accountInfo.accountData().sequence())
.destination(destinationAddress)
.amount(paymentAmount)
diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/XrplEnvironment.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/XrplEnvironment.java
index f39342756..bd7aa44b8 100644
--- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/XrplEnvironment.java
+++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/environment/XrplEnvironment.java
@@ -36,16 +36,24 @@ public interface XrplEnvironment {
/**
* Gets the XRPL environment to use (based on existence of -DuseTestnet property).
*
- * @return
+ * @return XRPL environment of the correct type.
*/
static XrplEnvironment getConfiguredEnvironment() {
- // Use the local rippled environment by default because it's faster and more predictable for testing.
- // TestnetEnvironment can make it easier to debug transactions using in the testnet explorer website.
+ // Use the testnet and devnet environment by default to run integration testing.
+ // Use -DuseLocal test to run integration tests on local rippled.
boolean isTestnetEnabled = System.getProperty("useTestnet") != null;
- logger.info("useTestnet set to {}, using {} for testing.",
- isTestnetEnabled, isTestnetEnabled ? "testnet" : "local rippled"
- );
- return isTestnetEnabled ? new TestnetEnvironment() : new LocalRippledEnvironment();
+ boolean isDevnetEnabled = System.getProperty("useDevnet") != null;
+ if (isTestnetEnabled) {
+ logger.info("System property 'useTestnet' detected; Using Testnet for integration testing.");
+ return new TestnetEnvironment();
+ } else if (isDevnetEnabled) {
+ logger.info("System property 'useDevnet' detected; Using Devnet for integration testing.");
+ return new DevnetEnvironment();
+ } else {
+ logger.info("Neither 'useTestNet' nor 'useDevnet' System properties detected." +
+ " Using local rippled for integration testing.");
+ return new LocalRippledEnvironment();
+ }
}
XrplClient getXrplClient();
diff --git a/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/SetFee.java b/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/SetFee.java
index e2fd34aff..e6d5663fd 100644
--- a/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/SetFee.java
+++ b/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/SetFee.java
@@ -10,8 +10,8 @@
import java.util.Optional;
/**
- * A {@link SetFee} pseudo-transaction marks a change in transaction cost or reserve
- * requirements as a result of Fee Voting.
+ * A {@link SetFee} pseudo-transaction marks a change in transaction cost or reserve requirements as a result of Fee
+ * Voting.
*
* @see "https://xrpl.org/setfee.html"
*/
@@ -30,8 +30,8 @@ static ImmutableSetFee.Builder builder() {
}
/**
- * The charge, in drops of XRP, for the reference transaction, as hex.
- * (This is the transaction cost before scaling for load.)
+ * The charge, in drops of XRP, for the reference transaction, as hex. (This is the transaction cost before scaling
+ * for load.)
*
* @return A hex {@link String} basefee value.
*/
@@ -63,9 +63,9 @@ static ImmutableSetFee.Builder builder() {
UnsignedInteger reserveIncrement();
/**
- * The index of the ledger version where this pseudo-transaction appears. This distinguishes the
- * pseudo-transaction from other occurrences of the same change.
- * Omitted for some historical SetFee pseudo-transactions hence making it optional.
+ * The index of the ledger version where this pseudo-transaction appears. This distinguishes the pseudo-transaction
+ * from other occurrences of the same change. Omitted for some historical SetFee pseudo-transactions hence making it
+ * optional.
*
* @return A {@link LedgerIndex} to indicates where the tx appears.
*/
diff --git a/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/Transaction.java b/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/Transaction.java
index e55fc71f3..7f1a67f96 100644
--- a/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/Transaction.java
+++ b/xrpl4j-model/src/main/java/org/xrpl/xrpl4j/model/transactions/Transaction.java
@@ -30,6 +30,8 @@
import org.immutables.value.Value;
import org.immutables.value.Value.Auxiliary;
import org.xrpl.xrpl4j.model.client.common.LedgerIndex;
+import org.xrpl.xrpl4j.model.client.fees.FeeResult;
+import org.xrpl.xrpl4j.model.client.fees.FeeUtils;
import org.xrpl.xrpl4j.model.ledger.SignerListObject;
import java.time.Instant;
@@ -45,8 +47,8 @@
public interface Transaction {
/**
- * XRP Ledger represents dates using a custom epoch called Ripple Epoch. This is a constant for
- * the start of that epoch.
+ * XRP Ledger represents dates using a custom epoch called Ripple Epoch. This is a constant for the start of that
+ * epoch.
*
* @deprecated This will be unnecessary once {@link #closeDateHuman()} is removed.
*/
@@ -94,6 +96,8 @@ public interface Transaction {
* @param signerList The {@link SignerListObject} containing the signers of the transaction.
*
* @return An {@link XrpCurrencyAmount} representing the multisig fee.
+ *
+ * @deprecated Use {@link FeeUtils#computeMultisigNetworkFees(FeeResult, SignerListObject)} instead.
*/
@Deprecated
static XrpCurrencyAmount computeMultiSigFee(
@@ -132,6 +136,7 @@ default TransactionType transactionType() {
* This field is auto-fillable
*
* @return An {@link XrpCurrencyAmount} representing the transaction cost.
+ *
* @see "https://xrpl.org/transaction-common-fields.html#auto-fillable-fields"
*/
@JsonProperty("Fee")
@@ -144,6 +149,7 @@ default TransactionType transactionType() {
*
This field is auto-fillable
*
* @return An {@link UnsignedInteger} representing the sequence of the transaction.
+ *
* @see "https://xrpl.org/transaction-common-fields.html#auto-fillable-fields"
*/
@Value.Default
@@ -153,9 +159,9 @@ default UnsignedInteger sequence() {
}
/**
- * The sequence number of the {@link org.xrpl.xrpl4j.model.ledger.TicketObject} to use in place of a {@link
- * #sequence()} number. If this is provided, {@link #sequence()} must be 0. Cannot be used with {@link
- * #accountTransactionId()}.
+ * The sequence number of the {@link org.xrpl.xrpl4j.model.ledger.TicketObject} to use in place of a
+ * {@link #sequence()} number. If this is provided, {@link #sequence()} must be 0. Cannot be used with
+ * {@link #accountTransactionId()}.
*
* @return An {@link UnsignedInteger} representing the ticket sequence of the transaction.
*/
@@ -228,24 +234,25 @@ default UnsignedInteger sequence() {
Optional transactionSignature();
/**
- * The approximate close time (using Ripple Epoch) of the ledger containing this transaction.
- * This is an undocumented field.
+ * The approximate close time (using Ripple Epoch) of the ledger containing this transaction. This is an undocumented
+ * field.
*
* @return An optionally-present {@link UnsignedLong}.
- * @deprecated This field will be removed in favor of {@link
- * org.xrpl.xrpl4j.model.client.transactions.TransactionResult#closeDate()};
+ *
+ * @deprecated This field will be removed in favor of
+ * {@link org.xrpl.xrpl4j.model.client.transactions.TransactionResult#closeDate()};
*/
@JsonProperty("date")
@Deprecated
Optional closeDate();
/**
- * The approximate close time in UTC offset.
- * This is derived from undocumented field.
+ * The approximate close time in UTC offset. This is derived from undocumented field.
*
* @return An optionally-present {@link ZonedDateTime}.
- * @deprecated This field will be removed in favor of {@link
- * org.xrpl.xrpl4j.model.client.transactions.TransactionResult#closeDateHuman()};
+ *
+ * @deprecated This field will be removed in favor of
+ * {@link org.xrpl.xrpl4j.model.client.transactions.TransactionResult#closeDateHuman()};
*/
@JsonIgnore
@Auxiliary
@@ -260,9 +267,10 @@ default Optional closeDateHuman() {
* The transaction hash of this transaction. Only present in responses to {@code account_tx} rippled calls.
*
* @return An optionally present {@link Hash256} containing the transaction hash.
+ *
* @deprecated This field will be removed in a future release. Instead, use
- * {@link org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsTransaction#hash()} found in {@link
- * org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsResult#transactions()}.
+ * {@link org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsTransaction#hash()} found in
+ * {@link org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsResult#transactions()}.
*/
@Deprecated
Optional hash();
@@ -272,9 +280,10 @@ default Optional closeDateHuman() {
* rippled calls.
*
* @return An optionally-present {@link LedgerIndex}.
+ *
* @deprecated This field will be removed in a future release. Instead, use
- * {@link org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsTransaction#ledgerIndex()} found in {@link
- * org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsResult#transactions()}.
+ * {@link org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsTransaction#ledgerIndex()} found in
+ * {@link org.xrpl.xrpl4j.model.client.accounts.AccountTransactionsResult#transactions()}.
*/
@Deprecated
@JsonProperty("ledger_index")
diff --git a/xrpl4j-model/src/test/java/org/xrpl/xrpl4j/model/transactions/json/PaymentChannelJsonTests.java b/xrpl4j-model/src/test/java/org/xrpl/xrpl4j/model/transactions/json/PaymentChannelJsonTests.java
index 3c1df86d6..4f940cb41 100644
--- a/xrpl4j-model/src/test/java/org/xrpl/xrpl4j/model/transactions/json/PaymentChannelJsonTests.java
+++ b/xrpl4j-model/src/test/java/org/xrpl/xrpl4j/model/transactions/json/PaymentChannelJsonTests.java
@@ -98,7 +98,6 @@ public void testPaymentChannelClaimJson() throws JsonProcessingException, JSONEx
"779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA3CD7B9B\",\n" +
" \"PublicKey\": \"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A\"\n" +
"}";
- System.out.println(ObjectMapperFactory.create().writerWithDefaultPrettyPrinter().writeValueAsString(claim));
assertCanSerializeAndDeserialize(claim, json);
}