diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a420ff174..af0344cb4 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -93,3 +93,45 @@ jobs: # Maven install with JVM locale = de_DE - name: Build run: mvn dependency:go-offline install -Dmaven.javadoc.skip=true -DargLine="-Duser.language=de -Duser.country=DE" + + build_devnet_its: + runs-on: ubuntu-latest + steps: + # Checks-out the repository under $GITHUB_WORKSPACE + - uses: actions/checkout@v2 + # Set up Java 8 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cache mvn dependencies + uses: actions/cache@v2 + env: + cache-name: mvn-deps + with: + path: ~/.m2 + key: ${{ env.cache-name }}-${{ hashFiles('pom.xml') }} + restore-keys: ${{ env.cache-name }}- + - name: Build + run: mvn dependency:go-offline install -Dmaven.javadoc.skip=true -DuseDevnet + + build_testnet_its: + runs-on: ubuntu-latest + steps: + # Checks-out the repository under $GITHUB_WORKSPACE + - uses: actions/checkout@v2 + # Set up Java 8 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cache mvn dependencies + uses: actions/cache@v2 + env: + cache-name: mvn-deps + with: + path: ~/.m2 + key: ${{ env.cache-name }}-${{ hashFiles('pom.xml') }} + restore-keys: ${{ env.cache-name }}- + - name: Build + run: mvn dependency:go-offline install -Dmaven.javadoc.skip=true -DuseTestnet \ No newline at end of file diff --git a/README.md b/README.md index b0d94439e..f5420cb95 100644 --- a/README.md +++ b/README.md @@ -61,24 +61,19 @@ Then you can add any of the xrpl4j modules found in the BOM to your `pom.xml`. F ``` ## Development -You can build and install the project locally using maven from the command line: +You can build and test the entire project locally using maven from the command line: ``` -mvn clean install -DskipTests +mvn clean install ``` -To run unit tests, use the following command: +To build the project while skipping Integration tests, use the following command: ``` mvn clean install -DskipITs ``` -To run the integration tests, you can either run -``` -mvn clean install +To build the project while skipping Unit and Integration tests, use the following command: ``` -which will run both the unit tests and integration tests, or to run only the integration tests, you can run the following commands: -``` -cd xrpl4j-integration-tests -mvn clean install +mvn clean install -DskipITs -DskipTests ``` [codecov-image]: https://codecov.io/gh/XRPLF/xrpl4j/branch/main/graph/badge.svg diff --git a/pom.xml b/pom.xml index 0ae6e8667..e8f1a2faa 100644 --- a/pom.xml +++ b/pom.xml @@ -301,9 +301,6 @@ checkstyle.xml warning - false - - 1.0.4 2.13.3 11.6 @@ -377,10 +374,6 @@ org.apache.maven.plugins maven-failsafe-plugin 2.22.2 - - ${skipITs} - ${failsafe.argLine} - integration-tests diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AbstractIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AbstractIT.java index 780e5e506..37f928c86 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AbstractIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AbstractIT.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. @@ -55,6 +55,7 @@ import org.xrpl.xrpl4j.model.transactions.Payment; import org.xrpl.xrpl4j.model.transactions.Transaction; import org.xrpl.xrpl4j.model.transactions.TransactionResultCodes; +import org.xrpl.xrpl4j.model.transactions.TransactionType; import org.xrpl.xrpl4j.model.transactions.TrustSet; import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; import org.xrpl.xrpl4j.tests.environment.XrplEnvironment; @@ -87,7 +88,12 @@ protected Wallet createRandomAccount() { // Create the account SeedWalletGenerationResult seedResult = walletFactory.randomWallet(true); final Wallet wallet = seedResult.wallet(); - logger.info("Generated testnet wallet with XAddress={} (Classic={})", wallet.xAddress(), wallet.classicAddress()); + String network = System.getProperty("useTestnet") != null ? "testnet" : + (System.getProperty("useDevnet") != null ? "devnet" : "local rippled"); + logger.info( + "Generated {} wallet with XAddress={} (Classic={})", + network, wallet.xAddress(), wallet.classicAddress() + ); fundAccount(wallet); @@ -302,9 +308,10 @@ public TrustLine createTrustLine( assertThat(trustSetSubmitResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(trustSetSubmitResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(trustSetSubmitResult.transactionResult().hash()); - logger.info( - "TrustSet transaction successful: https://testnet.xrpl.org/transactions/" + - trustSetSubmitResult.transactionResult().hash() + + logInfo( + trustSetSubmitResult.transactionResult().transaction().transactionType(), + trustSetSubmitResult.transactionResult().hash() ); return scanForResult( @@ -356,9 +363,10 @@ public void sendIssuedCurrency( assertThat(paymentResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(paymentResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(paymentResult.transactionResult().hash()); - logger.info( - "Payment transaction successful: https://testnet.xrpl.org/transactions/" + - paymentResult.transactionResult().hash() + + logInfo( + paymentResult.transactionResult().transaction().transactionType(), + paymentResult.transactionResult().hash() ); this.scanForResult( @@ -368,4 +376,16 @@ public void sendIssuedCurrency( ); } + + /** + * Helper function to print log statements for Integration Tests which is network specific. + * + * @param transactionType {@link TransactionType} to be logged for the executed transaction. + * @param hash {@link Hash256} to be logged for the executed transaction. + */ + public void logInfo(TransactionType transactionType, Hash256 hash) { + String url = System.getProperty("useTestnet") != null ? "https://testnet.xrpl.org/transactions/" : + (System.getProperty("useDevnet") != null ? "https://devnet.xrpl.org/transactions/" : ""); + logger.info(transactionType.value() + " transaction successful: {}{}", url, hash); + } } diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AccountSetIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AccountSetIT.java index 55dbcf194..b7cb6d65c 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AccountSetIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/AccountSetIT.java @@ -72,8 +72,9 @@ public void enableAllAndDisableOne() throws JsonRpcClientErrorException { assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "AccountSet transaction successful: https://testnet.xrpl.org/transactions/" + response.transactionResult().hash() + logInfo( + response.transactionResult().transaction().transactionType(), + response.transactionResult().hash() ); /////////////////////// @@ -134,8 +135,10 @@ public void disableAndEnableAllFlags() throws JsonRpcClientErrorException { assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "AccountSet transaction successful: https://testnet.xrpl.org/transactions/" + response.transactionResult().hash() + + logInfo( + response.transactionResult().transaction().transactionType(), + response.transactionResult().hash() ); /////////////////////// @@ -193,9 +196,9 @@ private void assertSetFlag( assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "AccountSet SetFlag transaction successful (asf={}; arf={}): https://testnet.xrpl.org/transactions/{}", - accountSetFlag, accountRootFlag, response.transactionResult().hash() + logInfo( + response.transactionResult().transaction().transactionType(), + response.transactionResult().hash() ); ///////////////////////// @@ -229,9 +232,9 @@ private void assertClearFlag( assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "AccountSet ClearFlag transaction successful (asf={}; arf={}): https://testnet.xrpl.org/transactions/{}", - accountSetFlag, accountRootFlag, response.transactionResult().hash() + logInfo( + response.transactionResult().transaction().transactionType(), + response.transactionResult().hash() ); ///////////////////////// diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/CheckIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/CheckIT.java index 3bd556d09..0a6cb9135 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/CheckIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/CheckIT.java @@ -74,8 +74,9 @@ public void createXrpCheckAndCash() throws JsonRpcClientErrorException { assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "CheckCreate transaction successful: https://testnet.xrpl.org/transactions/{}", + + logInfo( + response.transactionResult().transaction().transactionType(), response.transactionResult().hash() ); @@ -108,8 +109,8 @@ public void createXrpCheckAndCash() throws JsonRpcClientErrorException { assertThat(cashResponse.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "CheckCash transaction successful: https://testnet.xrpl.org/transactions/{}", + logInfo( + cashResponse.transactionResult().transaction().transactionType(), cashResponse.transactionResult().hash() ); @@ -163,8 +164,9 @@ public void createCheckAndSourceCancels() throws JsonRpcClientErrorException { assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "CheckCreate transaction successful: https://testnet.xrpl.org/transactions/{}", + + logInfo( + response.transactionResult().transaction().transactionType(), response.transactionResult().hash() ); @@ -194,8 +196,9 @@ public void createCheckAndSourceCancels() throws JsonRpcClientErrorException { assertThat(cancelResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "CheckCancel transaction successful: https://testnet.xrpl.org/transactions/{}", + + logInfo( + cancelResult.transactionResult().transaction().transactionType(), cancelResult.transactionResult().hash() ); @@ -240,8 +243,9 @@ public void createCheckAndDestinationCancels() throws JsonRpcClientErrorExceptio assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "CheckCreate transaction successful: https://testnet.xrpl.org/transactions/{}", + + logInfo( + response.transactionResult().transaction().transactionType(), response.transactionResult().hash() ); @@ -271,8 +275,9 @@ public void createCheckAndDestinationCancels() throws JsonRpcClientErrorExceptio assertThat(cancelResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "CheckCancel transaction successful: https://testnet.xrpl.org/transactions/{}", + + logInfo( + cancelResult.transactionResult().transaction().transactionType(), cancelResult.transactionResult().hash() ); diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/DepositPreAuthIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/DepositPreAuthIT.java index 4ff074ab2..589b95611 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/DepositPreAuthIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/DepositPreAuthIT.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. @@ -70,7 +70,9 @@ public void preauthorizeAccountAndReceivePayment() throws JsonRpcClientErrorExce assertThat(result.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(result.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(result.transactionResult().hash()); - logger.info("DepositPreauth transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + result.transactionResult().transaction().transactionType(), result.transactionResult().hash() ); @@ -112,7 +114,8 @@ public void preauthorizeAccountAndReceivePayment() throws JsonRpcClientErrorExce assertThat(result.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(result.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(result.transactionResult().hash()); - logger.info("Payment transaction successful. https://testnet.xrpl.org/transactions/{}", + logInfo( + paymentResult.transactionResult().transaction().transactionType(), paymentResult.transactionResult().hash() ); @@ -221,7 +224,6 @@ public void updateDepositPreAuthWithLedgerHash() { * @param fee The {@link XrpCurrencyAmount} of the ledger fee for the AccountSet transaction. * * @return The {@link AccountInfoResult} of the wallet once the {@link AccountSet} transaction has been applied. - * * @throws JsonRpcClientErrorException If {@code xrplClient} throws an error. */ private AccountInfoResult enableDepositPreauth( @@ -243,9 +245,11 @@ private AccountInfoResult enableDepositPreauth( assertThat(accountSetResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(accountSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(accountSetResult.transactionResult().hash()); - logger.info("AccountSet to enable Deposit Preauth successful. https://testnet.xrpl.org/transactions/{}", + logInfo( + accountSetResult.transactionResult().transaction().transactionType(), accountSetResult.transactionResult().hash() ); + return this.scanForResult( () -> this.getValidatedAccountInfo(wallet.classicAddress()), accountInfo -> accountInfo.accountData().flags().lsfDepositAuth() diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/EscrowIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/EscrowIT.java index 8c03aacbf..0208a04a9 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/EscrowIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/EscrowIT.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. @@ -30,6 +30,7 @@ import org.xrpl.xrpl4j.client.JsonRpcClientErrorException; 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.ledger.LedgerResult; import org.xrpl.xrpl4j.model.client.transactions.SubmitResult; import org.xrpl.xrpl4j.model.client.transactions.TransactionResult; @@ -42,6 +43,7 @@ import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; import org.xrpl.xrpl4j.wallet.Wallet; +import java.math.BigDecimal; import java.time.Duration; import java.time.Instant; @@ -66,7 +68,7 @@ public void createAndFinishTimeBasedEscrow() throws JsonRpcClientErrorException, EscrowCreate escrowCreate = EscrowCreate.builder() .account(senderWallet.classicAddress()) .sequence(senderAccountInfo.accountData().sequence()) - .fee(feeResult.drops().openLedgerFee()) + .fee(FeeUtils.computeNetworkFees(feeResult).recommendedFee()) .amount(XrpCurrencyAmount.ofDrops(123456)) .destination(receiverWallet.classicAddress()) .cancelAfter(instantToXrpTimestamp(getMinExpirationTime().plus(Duration.ofSeconds(100)))) @@ -80,9 +82,10 @@ public void createAndFinishTimeBasedEscrow() throws JsonRpcClientErrorException, assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info( - "EscrowCreate transaction successful: https://testnet.xrpl.org/transactions/" + - createResult.transactionResult().hash() + + logInfo( + createResult.transactionResult().transaction().transactionType(), + createResult.transactionResult().hash() ); ////////////////////// @@ -114,7 +117,7 @@ public void createAndFinishTimeBasedEscrow() throws JsonRpcClientErrorException, ); EscrowFinish escrowFinish = EscrowFinish.builder() .account(receiverWallet.classicAddress()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(new BigDecimal(1))) .sequence(receiverAccountInfo.accountData().sequence()) .owner(senderWallet.classicAddress()) .offerSequence(result.transaction().sequence()) @@ -125,9 +128,10 @@ public void createAndFinishTimeBasedEscrow() throws JsonRpcClientErrorException, assertThat(finishResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(finishResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(finishResult.transactionResult().hash()); - logger.info( - "EscrowFinish transaction successful: https://testnet.xrpl.org/transactions/" + - finishResult.transactionResult().hash() + + logInfo( + finishResult.transactionResult().transaction().transactionType(), + finishResult.transactionResult().hash() ); ////////////////////// @@ -146,7 +150,7 @@ public void createAndFinishTimeBasedEscrow() throws JsonRpcClientErrorException, infoResult -> infoResult.accountData().balance().equals( receiverAccountInfo.accountData().balance() .plus(escrowCreate.amount()) - .minus(feeResult.drops().openLedgerFee()) + .minus(XrpCurrencyAmount.ofXrp(new BigDecimal(1))) ) ); @@ -170,7 +174,7 @@ public void createAndCancelTimeBasedEscrow() throws JsonRpcClientErrorException EscrowCreate escrowCreate = EscrowCreate.builder() .account(senderWallet.classicAddress()) .sequence(senderAccountInfo.accountData().sequence()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(new BigDecimal(1))) .amount(XrpCurrencyAmount.ofDrops(123456)) .destination(receiverWallet.classicAddress()) .cancelAfter(instantToXrpTimestamp(getMinExpirationTime().plus(Duration.ofSeconds(5)))) @@ -184,9 +188,10 @@ public void createAndCancelTimeBasedEscrow() throws JsonRpcClientErrorException assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info( - "EscrowCreate transaction successful: https://testnet.xrpl.org/transactions/" + - createResult.transactionResult().hash() + + logInfo( + createResult.transactionResult().transaction().transactionType(), + createResult.transactionResult().hash() ); ////////////////////// @@ -224,7 +229,7 @@ public void createAndCancelTimeBasedEscrow() throws JsonRpcClientErrorException // Sender account cancels the Escrow EscrowCancel escrowCancel = EscrowCancel.builder() .account(senderWallet.classicAddress()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(new BigDecimal(1))) .sequence(senderAccountInfo.accountData().sequence().plus(UnsignedInteger.ONE)) .owner(senderWallet.classicAddress()) .offerSequence(result.transaction().sequence()) @@ -235,9 +240,10 @@ public void createAndCancelTimeBasedEscrow() throws JsonRpcClientErrorException assertThat(cancelResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(cancelResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(cancelResult.transactionResult().hash()); - logger.info( - "EscrowCancel transaction successful: https://testnet.xrpl.org/transactions/" + - cancelResult.transactionResult().hash() + + logInfo( + cancelResult.transactionResult().transaction().transactionType(), + cancelResult.transactionResult().hash() ); ////////////////////// @@ -255,7 +261,7 @@ public void createAndCancelTimeBasedEscrow() throws JsonRpcClientErrorException () -> this.getValidatedAccountInfo(senderWallet.classicAddress()), infoResult -> infoResult.accountData().balance().equals( senderAccountInfo.accountData().balance() - .minus(feeResult.drops().openLedgerFee().times(XrpCurrencyAmount.of(UnsignedLong.valueOf(2)))) + .minus(XrpCurrencyAmount.ofXrp(new BigDecimal(1)).times(XrpCurrencyAmount.of(UnsignedLong.valueOf(2)))) ) ); } @@ -274,14 +280,14 @@ public void createAndFinishCryptoConditionBasedEscrow() throws JsonRpcClientErro ////////////////////// // Sender account creates an Escrow with the receiver account - FeeResult feeResult = xrplClient.fee(); + final FeeResult feeResult = xrplClient.fee(); AccountInfoResult senderAccountInfo = this.scanForResult( () -> this.getValidatedAccountInfo(senderWallet.classicAddress()) ); EscrowCreate escrowCreate = EscrowCreate.builder() .account(senderWallet.classicAddress()) .sequence(senderAccountInfo.accountData().sequence()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(new BigDecimal(1))) .amount(XrpCurrencyAmount.ofDrops(123456)) .destination(receiverWallet.classicAddress()) .signingPublicKey(senderWallet.publicKey()) @@ -296,9 +302,10 @@ public void createAndFinishCryptoConditionBasedEscrow() throws JsonRpcClientErro assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info( - "EscrowCreate transaction successful: https://testnet.xrpl.org/transactions/" + - createResult.transactionResult().hash() + + logInfo( + createResult.transactionResult().transaction().transactionType(), + createResult.transactionResult().hash() ); ////////////////////// @@ -330,11 +337,11 @@ public void createAndFinishCryptoConditionBasedEscrow() throws JsonRpcClientErro ); final XrpCurrencyAmount feeForFulfillment = EscrowFinish - .computeFee(feeResult.drops().openLedgerFee(), executeEscrowFulfillment); + .computeFee(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(1)), executeEscrowFulfillment); EscrowFinish escrowFinish = EscrowFinish.builder() .account(receiverWallet.classicAddress()) // V-- Be sure to add more fee to process the Fulfillment - .fee(EscrowFinish.computeFee(feeResult.drops().openLedgerFee(), executeEscrowFulfillment)) + .fee(EscrowFinish.computeFee(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(1)), executeEscrowFulfillment)) .sequence(receiverAccountInfo.accountData().sequence()) .owner(senderWallet.classicAddress()) .offerSequence(result.transaction().sequence()) @@ -347,9 +354,10 @@ public void createAndFinishCryptoConditionBasedEscrow() throws JsonRpcClientErro assertThat(finishResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(finishResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(finishResult.transactionResult().hash()); - logger.info( - "EscrowFinish transaction successful: https://testnet.xrpl.org/transactions/" + - finishResult.transactionResult().hash() + + logInfo( + finishResult.transactionResult().transaction().transactionType(), + finishResult.transactionResult().hash() ); ////////////////////// @@ -395,7 +403,7 @@ public void createAndCancelCryptoConditionBasedEscrow() throws JsonRpcClientErro EscrowCreate escrowCreate = EscrowCreate.builder() .account(senderWallet.classicAddress()) .sequence(senderAccountInfo.accountData().sequence()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(new BigDecimal(1))) .amount(XrpCurrencyAmount.ofDrops(123456)) .destination(receiverWallet.classicAddress()) .cancelAfter(instantToXrpTimestamp(getMinExpirationTime().plus(Duration.ofSeconds(5)))) @@ -409,9 +417,10 @@ public void createAndCancelCryptoConditionBasedEscrow() throws JsonRpcClientErro assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info( - "EscrowCreate transaction successful: https://testnet.xrpl.org/transactions/" + - createResult.transactionResult().hash() + + logInfo( + createResult.transactionResult().transaction().transactionType(), + createResult.transactionResult().hash() ); ////////////////////// @@ -440,7 +449,7 @@ public void createAndCancelCryptoConditionBasedEscrow() throws JsonRpcClientErro // Sender account cancels the Escrow EscrowCancel escrowCancel = EscrowCancel.builder() .account(senderWallet.classicAddress()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(new BigDecimal(1))) .sequence(senderAccountInfo.accountData().sequence().plus(UnsignedInteger.ONE)) .owner(senderWallet.classicAddress()) .offerSequence(result.transaction().sequence()) @@ -451,9 +460,10 @@ public void createAndCancelCryptoConditionBasedEscrow() throws JsonRpcClientErro assertThat(cancelResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(cancelResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(cancelResult.transactionResult().hash()); - logger.info( - "EscrowCancel transaction successful: https://testnet.xrpl.org/transactions/" + - cancelResult.transactionResult().hash() + + logInfo( + cancelResult.transactionResult().transaction().transactionType(), + cancelResult.transactionResult().hash() ); ////////////////////// @@ -471,7 +481,7 @@ public void createAndCancelCryptoConditionBasedEscrow() throws JsonRpcClientErro () -> this.getValidatedAccountInfo(senderWallet.classicAddress()), infoResult -> infoResult.accountData().balance().equals( senderAccountInfo.accountData().balance() - .minus(feeResult.drops().openLedgerFee().times(XrpCurrencyAmount.of(UnsignedLong.valueOf(2)))) + .minus(XrpCurrencyAmount.ofXrp(new BigDecimal(1)).times(XrpCurrencyAmount.of(UnsignedLong.valueOf(2)))) ) ); diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/GatewayBalancesIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/GatewayBalancesIT.java index 687e07f27..53d7695d4 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/GatewayBalancesIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/GatewayBalancesIT.java @@ -34,8 +34,10 @@ import org.xrpl.xrpl4j.model.client.accounts.TrustLine; import org.xrpl.xrpl4j.model.client.common.LedgerSpecifier; import org.xrpl.xrpl4j.model.client.fees.FeeResult; +import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; import org.xrpl.xrpl4j.wallet.Wallet; +import java.math.BigDecimal; import java.util.Optional; public class GatewayBalancesIT extends AbstractIT { @@ -58,7 +60,7 @@ public void testGatewayBalances() throws JsonRpcClientErrorException { "10000", issuerWallet, counterpartyWallet, - feeResult.drops().minimumFee() + XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(1)) ); /////////////////////////// @@ -68,7 +70,7 @@ public void testGatewayBalances() throws JsonRpcClientErrorException { trustLine.limitPeer(), issuerWallet, counterpartyWallet, - feeResult.drops().minimumFee() + XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(1)) ); /////////////////////////// diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/IssuedCurrencyIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/IssuedCurrencyIT.java index 3aaecb74c..acf38d667 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/IssuedCurrencyIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/IssuedCurrencyIT.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. @@ -64,7 +64,7 @@ public void issueIssuedCurrencyBalance() throws JsonRpcClientErrorException { "10000", issuerWallet, counterpartyWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// @@ -74,7 +74,7 @@ public void issueIssuedCurrencyBalance() throws JsonRpcClientErrorException { trustLine.limitPeer(), issuerWallet, counterpartyWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// @@ -122,7 +122,7 @@ public void sendSimpleRipplingIssuedCurrencyPayment() throws JsonRpcClientErrorE "10000", issuerWallet, aliceWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// @@ -132,16 +132,16 @@ public void sendSimpleRipplingIssuedCurrencyPayment() throws JsonRpcClientErrorE "10000", issuerWallet, bobWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// // Issuer issues 50 USD to alice - sendIssuedCurrency("USD", "50", issuerWallet, aliceWallet, feeResult.drops().minimumFee()); + sendIssuedCurrency("USD", "50", issuerWallet, aliceWallet, FeeUtils.computeNetworkFees(feeResult).recommendedFee()); /////////////////////////// // Issuer issues 50 USD to bob - sendIssuedCurrency("USD", "50", issuerWallet, bobWallet, feeResult.drops().minimumFee()); + sendIssuedCurrency("USD", "50", issuerWallet, bobWallet, FeeUtils.computeNetworkFees(feeResult).recommendedFee()); /////////////////////////// // Try to find a path for this Payment. @@ -179,9 +179,10 @@ public void sendSimpleRipplingIssuedCurrencyPayment() throws JsonRpcClientErrorE assertThat(paymentResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(paymentResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(paymentResult.transactionResult().hash()); - logger.info( - "Payment transaction successful: https://testnet.xrpl.org/transactions/" + - paymentResult.transactionResult().hash() + + logInfo( + paymentResult.transactionResult().transaction().transactionType(), + paymentResult.transactionResult().hash() ); /////////////////////////// @@ -225,7 +226,7 @@ public void sendMultiHopSameCurrencyPayment() throws JsonRpcClientErrorException "10000", issuerAWallet, charlieWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// @@ -235,7 +236,7 @@ public void sendMultiHopSameCurrencyPayment() throws JsonRpcClientErrorException "10000", issuerAWallet, emilyWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// @@ -245,7 +246,7 @@ public void sendMultiHopSameCurrencyPayment() throws JsonRpcClientErrorException "10000", issuerBWallet, emilyWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// @@ -255,28 +256,36 @@ public void sendMultiHopSameCurrencyPayment() throws JsonRpcClientErrorException "10000", issuerBWallet, danielWallet, - feeResult.drops().minimumFee() + FeeUtils.computeNetworkFees(feeResult).recommendedFee() ); /////////////////////////// // Issue 10 USD from issuerA to charlie. // IssuerA now owes Charlie 10 USD. - sendIssuedCurrency("USD", "10", issuerAWallet, charlieWallet, feeResult.drops().minimumFee()); + sendIssuedCurrency( + "USD", "10", issuerAWallet, charlieWallet, FeeUtils.computeNetworkFees(feeResult).recommendedFee() + ); /////////////////////////// // Issue 1 USD from issuerA to emily. // IssuerA now owes Emily 1 USD - sendIssuedCurrency("USD", "1", issuerAWallet, emilyWallet, feeResult.drops().minimumFee()); + sendIssuedCurrency( + "USD", "1", issuerAWallet, emilyWallet, FeeUtils.computeNetworkFees(feeResult).recommendedFee() + ); /////////////////////////// // Issue 100 USD from issuerB to emily. // IssuerB now owes Emily 100 USD - sendIssuedCurrency("USD", "100", issuerBWallet, emilyWallet, feeResult.drops().minimumFee()); + sendIssuedCurrency( + "USD", "100", issuerBWallet, emilyWallet, FeeUtils.computeNetworkFees(feeResult).recommendedFee() + ); /////////////////////////// // Issue 2 USD from issuerB to daniel. // IssuerB now owes Daniel 2 USD - sendIssuedCurrency("USD", "2", issuerBWallet, danielWallet, feeResult.drops().minimumFee()); + sendIssuedCurrency( + "USD", "2", issuerBWallet, danielWallet, FeeUtils.computeNetworkFees(feeResult).recommendedFee() + ); /////////////////////////// // Look for a payment path from charlie to daniel. @@ -324,9 +333,10 @@ public void sendMultiHopSameCurrencyPayment() throws JsonRpcClientErrorException assertThat(paymentResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(paymentResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(paymentResult.transactionResult().hash()); - logger.info( - "Payment transaction successful: https://testnet.xrpl.org/transactions/" + - paymentResult.transactionResult().hash() + + logInfo( + paymentResult.transactionResult().transaction().transactionType(), + paymentResult.transactionResult().hash() ); /////////////////////////// @@ -382,9 +392,10 @@ public void setDefaultRipple(Wallet issuerWallet, FeeResult feeResult) throws Js assertThat(setResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(setResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(setResult.transactionResult().hash()); - logger.info( - "AccountSet transaction successful: https://testnet.xrpl.org/transactions/" + - setResult.transactionResult().hash() + + logInfo( + setResult.transactionResult().transaction().transactionType(), + setResult.transactionResult().hash() ); scanForResult( diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/OfferIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/OfferIT.java index 6d1fdd4e6..5aa0a5293 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/OfferIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/OfferIT.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. @@ -101,8 +101,8 @@ public void ensureUsdIssued() throws JsonRpcClientErrorException { assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "OfferCreate transaction successful: https://testnet.xrpl.org/transactions/{}", + logInfo( + response.transactionResult().transaction().transactionType(), response.transactionResult().hash() ); usdIssued = true; @@ -150,8 +150,8 @@ public void createOpenOfferAndCancel() throws JsonRpcClientErrorException { assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "OfferCreate transaction successful: https://testnet.xrpl.org/transactions/{}", + logInfo( + response.transactionResult().transaction().transactionType(), response.transactionResult().hash() ); @@ -232,8 +232,8 @@ public void createUnmatchedKillOrFill() throws JsonRpcClientErrorException { SubmitResult response = xrplClient.submit(purchaser, offerCreate); assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); - logger.info( - "OfferCreate transaction successful: https://testnet.xrpl.org/transactions/{}", + logInfo( + response.transactionResult().transaction().transactionType(), response.transactionResult().hash() ); @@ -290,8 +290,9 @@ public void createFullyMatchedOffer() throws JsonRpcClientErrorException { assertThat(response.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(response.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(response.transactionResult().hash()); - logger.info( - "OfferCreate transaction successful: https://testnet.xrpl.org/transactions/{}", + + logInfo( + response.transactionResult().transaction().transactionType(), response.transactionResult().hash() ); diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/PaymentChannelIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/PaymentChannelIT.java index c3b7a4ae9..10ad1e9cf 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/PaymentChannelIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/PaymentChannelIT.java @@ -93,7 +93,9 @@ public void createPaymentChannel() throws JsonRpcClientErrorException { assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info("PaymentChannelCreate transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + createResult.transactionResult().transaction().transactionType(), createResult.transactionResult().hash() ); @@ -175,7 +177,9 @@ void createAndClaimPaymentChannel() throws JsonRpcClientErrorException, JsonProc assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info("PaymentChannelCreate transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + createResult.transactionResult().transaction().transactionType(), createResult.transactionResult().hash() ); @@ -248,7 +252,9 @@ void createAndClaimPaymentChannel() throws JsonRpcClientErrorException, JsonProc assertThat(claimResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(claimResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(claimResult.transactionResult().hash()); - logger.info("PaymentChannelClaim transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + claimResult.transactionResult().transaction().transactionType(), claimResult.transactionResult().hash() ); @@ -297,7 +303,9 @@ void createAddFundsAndSetExpirationToPaymentChannel() throws JsonRpcClientErrorE assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info("PaymentChannelCreate transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + createResult.transactionResult().transaction().transactionType(), createResult.transactionResult().hash() ); @@ -334,7 +342,9 @@ void createAddFundsAndSetExpirationToPaymentChannel() throws JsonRpcClientErrorE assertThat(fundResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(fundResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(fundResult.transactionResult().hash()); - logger.info("PaymentChannelFund transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + fundResult.transactionResult().transaction().transactionType(), fundResult.transactionResult().hash() ); @@ -373,7 +383,9 @@ void createAddFundsAndSetExpirationToPaymentChannel() throws JsonRpcClientErrorE assertThat(expiryResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(expiryResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(expiryResult.transactionResult().hash()); - logger.info("PaymentChannelFund transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + expiryResult.transactionResult().transaction().transactionType(), expiryResult.transactionResult().hash() ); @@ -424,7 +436,9 @@ void testCurrentAccountChannels() throws JsonRpcClientErrorException { assertThat(createResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(createResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(createResult.transactionResult().hash()); - logger.info("PaymentChannelCreate transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + createResult.transactionResult().transaction().transactionType(), createResult.transactionResult().hash() ); diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SetRegularKeyIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SetRegularKeyIT.java index 25a1fa6a2..9cc8a2f43 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SetRegularKeyIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SetRegularKeyIT.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. @@ -66,7 +66,9 @@ void setRegularKeyOnAccount() throws JsonRpcClientErrorException { assertThat(setResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(setResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(setResult.transactionResult().hash()); - logger.info("SetRegularKey transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + setResult.transactionResult().transaction().transactionType(), setResult.transactionResult().hash() ); @@ -123,7 +125,9 @@ void removeRegularKeyFromAccount() throws JsonRpcClientErrorException { assertThat(setResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(setResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(setResult.transactionResult().hash()); - logger.info("SetRegularKey transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + setResult.transactionResult().transaction().transactionType(), setResult.transactionResult().hash() ); @@ -148,7 +152,6 @@ void removeRegularKeyFromAccount() throws JsonRpcClientErrorException { } ); - SetRegularKey removeRegularKey = SetRegularKey.builder() .account(wallet.classicAddress()) .fee(FeeUtils.computeNetworkFees(feeResult).recommendedFee()) @@ -160,7 +163,9 @@ void removeRegularKeyFromAccount() throws JsonRpcClientErrorException { assertThat(removeResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(removeResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(removeResult.transactionResult().hash()); - logger.info("SetRegularKey transaction successful. https://testnet.xrpl.org/transactions/{}", + + logInfo( + removeResult.transactionResult().transaction().transactionType(), removeResult.transactionResult().hash() ); diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SignerListSetIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SignerListSetIT.java index be5128cf8..dee13f3c0 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SignerListSetIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SignerListSetIT.java @@ -43,12 +43,10 @@ import org.xrpl.xrpl4j.model.transactions.Signer; import org.xrpl.xrpl4j.model.transactions.SignerListSet; import org.xrpl.xrpl4j.model.transactions.SignerWrapper; -import org.xrpl.xrpl4j.model.transactions.Transaction; import org.xrpl.xrpl4j.model.transactions.TransactionResultCodes; import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; import org.xrpl.xrpl4j.wallet.Wallet; -import java.math.BigDecimal; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -113,9 +111,10 @@ void addSignersToSignerListAndSendPayment() throws JsonRpcClientErrorException { assertThat(signerListSetResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(signerListSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(signerListSetResult.transactionResult().hash()); - logger.info( - "SignerListSet transaction successful: https://testnet.xrpl.org/transactions/" + - signerListSetResult.transactionResult().hash() + + logInfo( + signerListSetResult.transactionResult().transaction().transactionType(), + signerListSetResult.transactionResult().hash() ); ///////////////////////////// @@ -185,9 +184,10 @@ void addSignersToSignerListAndSendPayment() throws JsonRpcClientErrorException { assertThat(paymentResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(signerListSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(signerListSetResult.transactionResult().hash()); - logger.info( - "Payment transaction successful: https://testnet.xrpl.org/transactions/" + - paymentResult.transaction().hash() + + logInfo( + paymentResult.transaction().transaction().transactionType(), + paymentResult.transaction().hash() ); } @@ -242,9 +242,10 @@ void addSignersToSignerListThenDeleteSignerList() throws JsonRpcClientErrorExcep assertThat(signerListSetResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(signerListSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(signerListSetResult.transactionResult().hash()); - logger.info( - "SignerListSet transaction successful: https://testnet.xrpl.org/transactions/" + - signerListSetResult.transactionResult().hash() + + logInfo( + signerListSetResult.transactionResult().transaction().transactionType(), + signerListSetResult.transactionResult().hash() ); ///////////////////////////// @@ -280,9 +281,10 @@ void addSignersToSignerListThenDeleteSignerList() throws JsonRpcClientErrorExcep assertThat(signerListDeleteResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(signerListSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(signerListSetResult.transactionResult().hash()); - logger.info( - "SignerListSet transaction successful: https://testnet.xrpl.org/transactions/" + - signerListDeleteResult.transactionResult().hash() + + logInfo( + signerListDeleteResult.transactionResult().transaction().transactionType(), + signerListDeleteResult.transactionResult().hash() ); ///////////////////////////// diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitMultisignedIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitMultisignedIT.java index fbd151209..dc35959de 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitMultisignedIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitMultisignedIT.java @@ -27,7 +27,6 @@ import org.xrpl.xrpl4j.model.transactions.Signer; import org.xrpl.xrpl4j.model.transactions.SignerListSet; import org.xrpl.xrpl4j.model.transactions.SignerWrapper; -import org.xrpl.xrpl4j.model.transactions.Transaction; import org.xrpl.xrpl4j.model.transactions.TransactionResultCodes; import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; import org.xrpl.xrpl4j.wallet.Wallet; @@ -102,9 +101,9 @@ public void setUp() throws JsonRpcClientErrorException { assertThat(signerListSetResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(signerListSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(signerListSetResult.transactionResult().hash()); - logger.info( - "SignerListSet transaction successful: https://testnet.xrpl.org/transactions/" + - signerListSetResult.transactionResult().hash() + logInfo( + signerListSetResult.transactionResult().transaction().transactionType(), + signerListSetResult.transactionResult().hash() ); ///////////////////////////// @@ -180,16 +179,16 @@ public void submitMultisignedAndVerifyHash() throws JsonRpcClientErrorException, .build(); String libraryCalculatedHash = signedTransaction.hash().value(); - SubmitMultiSignedResult paymentResult = xrplClient.submitMultisigned(multiSigPayment); + SubmitMultiSignedResult submitMultiSignedResult = xrplClient.submitMultisigned(multiSigPayment); - assertThat(paymentResult.transaction().hash().value()).isEqualTo(libraryCalculatedHash); + assertThat(submitMultiSignedResult.transaction().hash().value()).isEqualTo(libraryCalculatedHash); - assertThat(paymentResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); + assertThat(submitMultiSignedResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(signerListSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(signerListSetResult.transactionResult().hash()); - logger.info( - "Payment transaction successful: https://testnet.xrpl.org/transactions/" + - paymentResult.transaction().hash() + logInfo( + submitMultiSignedResult.transaction().transaction().transactionType(), + submitMultiSignedResult.transaction().hash() ); } @@ -259,16 +258,16 @@ public void submitMultisignedWithSignersInDescOrderAndVerifyHash() throws .build(); String libraryCalculatedHash = signedTransaction.hash().value(); - SubmitMultiSignedResult paymentResult = xrplClient.submitMultisigned(multiSigPayment); - - assertThat(paymentResult.transaction().hash().value()).isEqualTo(libraryCalculatedHash); - - assertThat(paymentResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); + SubmitMultiSignedResult submitMultiSignedResult = xrplClient.submitMultisigned(multiSigPayment); + assertThat(submitMultiSignedResult.transaction().hash().value()).isEqualTo(libraryCalculatedHash); + assertThat(submitMultiSignedResult.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(signerListSetResult.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(signerListSetResult.transactionResult().hash()); - logger.info( - "Payment transaction successful: https://testnet.xrpl.org/transactions/" + - paymentResult.transaction().hash() + + logInfo( + submitMultiSignedResult.transaction().transaction().transactionType(), + submitMultiSignedResult.transaction().hash() ); + } } diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentIT.java index 66fc80871..be7c7e397 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentIT.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. @@ -62,7 +62,9 @@ public void sendPayment() 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() ); @@ -105,7 +107,9 @@ public void sendPaymentFromSecp256k1Wallet() throws JsonRpcClientErrorException assertThat(result.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); 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() ); @@ -119,9 +123,9 @@ public void sendPaymentFromSecp256k1Wallet() throws JsonRpcClientErrorException private void assertPaymentCloseTimeMatchesLedgerCloseTime(TransactionResult validatedPayment) throws JsonRpcClientErrorException { LedgerResult ledger = xrplClient.ledger( - LedgerRequestParams.builder() - .ledgerSpecifier(LedgerSpecifier.of(validatedPayment.ledgerIndexSafe())) - .build() + LedgerRequestParams.builder() + .ledgerSpecifier(LedgerSpecifier.of(validatedPayment.ledgerIndexSafe())) + .build() ); assertThat(validatedPayment.transaction().closeDateHuman()).isNotEmpty() diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentUsingSignatureService.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentUsingSignatureService.java index ba7b21191..107b58c72 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentUsingSignatureService.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/SubmitPaymentUsingSignatureService.java @@ -45,6 +45,7 @@ import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount; import org.xrpl.xrpl4j.wallet.Wallet; +import java.math.BigDecimal; import java.security.Key; import java.security.KeyStore; import java.util.Objects; @@ -88,7 +89,7 @@ public void sendPaymentFromEd25519Wallet() throws JsonRpcClientErrorException, J .scanForResult(() -> this.getValidatedAccountInfo(sourceWallet.classicAddress())); Payment payment = Payment.builder() .account(sourceWallet.classicAddress()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(1))) .sequence(accountInfo.accountData().sequence()) .destination(destinationWallet.classicAddress()) .amount(XrpCurrencyAmount.ofDrops(12345)) @@ -102,8 +103,11 @@ public void sendPaymentFromEd25519Wallet() throws JsonRpcClientErrorException, J assertThat(result.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(result.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(result.transactionResult().hash()); - logger.info( - "Payment successful: https://testnet.xrpl.org/transactions/" + result.transactionResult().hash()); + + logInfo( + result.transactionResult().transaction().transactionType(), + result.transactionResult().hash() + ); this.scanForResult( () -> this.getValidatedTransaction( @@ -121,7 +125,7 @@ public void sendPaymentFromSecp256k1Wallet() throws JsonRpcClientErrorException, .scanForResult(() -> this.getValidatedAccountInfo(sourceWallet.classicAddress())); Payment payment = Payment.builder() .account(sourceWallet.classicAddress()) - .fee(feeResult.drops().openLedgerFee()) + .fee(XrpCurrencyAmount.ofXrp(BigDecimal.valueOf(1))) .sequence(accountInfo.accountData().sequence()) .destination(destinationWallet.classicAddress()) .amount(XrpCurrencyAmount.ofDrops(12345)) @@ -135,8 +139,10 @@ public void sendPaymentFromSecp256k1Wallet() throws JsonRpcClientErrorException, assertThat(result.result()).isEqualTo(TransactionResultCodes.TES_SUCCESS); assertThat(result.transactionResult().transaction().hash()).isNotEmpty().get() .isEqualTo(result.transactionResult().hash()); - logger.info( - "Payment successful: https://testnet.xrpl.org/transactions/" + result.transactionResult().hash() + + logInfo( + result.transactionResult().transaction().transactionType(), + result.transactionResult().hash() ); this.scanForResult( diff --git a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TicketIT.java b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TicketIT.java index a31b4d7a3..6719739d9 100644 --- a/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TicketIT.java +++ b/xrpl4j-integration-tests/src/test/java/org/xrpl/xrpl4j/tests/TicketIT.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. @@ -57,7 +57,9 @@ void createTicketAndUseSequenceNumber() throws JsonRpcClientErrorException { SubmitResult submitResult = xrplClient.submit(sourceWallet, ticketCreate); assertThat(submitResult.result()).isEqualTo(SUCCESS_STATUS); - logger.info("TicketCreate successful: https://testnet.xrpl.org/transactions/" + + + logInfo( + submitResult.transactionResult().transaction().transactionType(), submitResult.transactionResult().hash() ); @@ -79,7 +81,9 @@ void createTicketAndUseSequenceNumber() throws JsonRpcClientErrorException { SubmitResult 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); }