From 5c86e6fb024f6a98ad84d35afaf05a0694e68c05 Mon Sep 17 00:00:00 2001 From: Quang Lam Date: Thu, 9 Mar 2023 08:38:04 -0500 Subject: [PATCH 1/5] Add SubmitTransactionResponse.ResultCodes.innerTransactionResultCode --- .../stellar/sdk/responses/SubmitTransactionResponse.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java b/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java index 9b77fefdf..ab2a682a8 100644 --- a/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java +++ b/src/main/java/org/stellar/sdk/responses/SubmitTransactionResponse.java @@ -201,17 +201,24 @@ public ResultCodes getResultCodes() { public static class ResultCodes { @SerializedName("transaction") private final String transactionResultCode; + @SerializedName("inner_transaction") + private final String innerTransactionResultCode; @SerializedName("operations") private final ArrayList operationsResultCodes; - public ResultCodes(String transactionResultCode, ArrayList operationsResultCodes) { + public ResultCodes(String transactionResultCode, String innerTransactionResultCode, ArrayList operationsResultCodes) { this.transactionResultCode = transactionResultCode; + this.innerTransactionResultCode = innerTransactionResultCode; this.operationsResultCodes = operationsResultCodes; } public String getTransactionResultCode() { return transactionResultCode; } + + public String getInnerTransactionResultCode() { + return innerTransactionResultCode; + } public ArrayList getOperationsResultCodes() { return operationsResultCodes; From 60f267dfb9e069793bec7404590dc8fc56cfdd59 Mon Sep 17 00:00:00 2001 From: Quang Lam Date: Thu, 9 Mar 2023 10:54:31 -0500 Subject: [PATCH 2/5] Update SubmitTransactionResponseTest.java --- .../SubmitTransactionResponseTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java index 193d72713..2c171acfe 100644 --- a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java +++ b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java @@ -36,6 +36,34 @@ public void testDeserializeTransactionFailureResponse() throws IOException { assertEquals(submitTransactionResponse.getExtras().getResultCodes().getTransactionResultCode(), "tx_no_source_account"); } + @Test + public void testDeserializeFeeBumpTransactionFailureResponse() throws IOException { + String json = "{\n" + + " \"type\": \"https://developers.stellar.org/api/errors/http-status-codes/horizon-specific/transaction-failed/\",\n" + + " \"title\": \"Transaction Failed\",\n" + + " \"status\": 400,\n" + + " \"detail\": \"The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details. Descriptions of each code can be found at: https://developers.stellar.org/docs/start/list-of-operations/\",\n" + + " \"instance\": \"horizon-testnet-001.prd.stellar001.internal.stellar-ops.com/4elYz2fHhC-528285\",\n" + + " \"extras\": {\n" + + " \"envelope_xdr\": \"AAAAAKpmDL6Z4hvZmkTBkYpHftan4ogzTaO4XTB7joLgQnYYAAAAZAAAAAAABeoyAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAD3sEVVGZGi/NoC3ta/8f/YZKMzyi9ZJpOi0H47x7IqYAAAAAAAAAAAF9eEAAAAAAAAAAAA=\",\n" + + " \"result_codes\": {\n" + + " \"transaction\": \"tx_fee_bump_inner_failed\"\n" + + " \"inner_transaction\": \"tx_no_source_account\"\n" + + " },\n" + + " \"result_xdr\": \"AAAAAAAAAMj////zxZjN9tKJLJ6diZuWBitlMJ/4MXX1Akm9M5CqZt10ogoAAAAAAAAAAP////8AAAABAAAAAAAAAAb/////AAAAAAAAAAA=\"\n" + + " }\n" + + "}"; + + SubmitTransactionResponse submitTransactionResponse = GsonSingleton.getInstance().fromJson(json, SubmitTransactionResponse.class); + assertEquals(submitTransactionResponse.isSuccess(), false); + assertEquals(submitTransactionResponse.getEnvelopeXdr().get(), "AAAAAKpmDL6Z4hvZmkTBkYpHftan4ogzTaO4XTB7joLgQnYYAAAAZAAAAAAABeoyAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAD3sEVVGZGi/NoC3ta/8f/YZKMzyi9ZJpOi0H47x7IqYAAAAAAAAAAAF9eEAAAAAAAAAAAA="); + assertEquals(submitTransactionResponse.getResultXdr().get(), "AAAAAAAAAMj////zxZjN9tKJLJ6diZuWBitlMJ/4MXX1Akm9M5CqZt10ogoAAAAAAAAAAP////8AAAABAAAAAAAAAAb/////AAAAAAAAAAA="); + assertFalse(submitTransactionResponse.getOfferIdFromResult(0).isPresent()); + assertFalse(submitTransactionResponse.getDecodedTransactionResult().isPresent()); + assertEquals(submitTransactionResponse.getExtras().getResultCodes().getTransactionResultCode(), "tx_fee_bump_inner_failed"); + assertEquals(submitTransactionResponse.getExtras().getResultCodes().getInnerTransactionResultCode(), "tx_no_source_account"); + } + @Test public void testDeserializeOperationFailureResponse() throws IOException { String json = "{\n" + From 112b2c71b167832a105f437d1d6a61e906ed69bf Mon Sep 17 00:00:00 2001 From: Quang Lam Date: Thu, 9 Mar 2023 11:59:33 -0500 Subject: [PATCH 3/5] Update SubmitTransactionResponseTest.java --- .../stellar/sdk/responses/SubmitTransactionResponseTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java index 2c171acfe..d03b9b9c2 100644 --- a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java +++ b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java @@ -47,7 +47,7 @@ public void testDeserializeFeeBumpTransactionFailureResponse() throws IOExceptio " \"extras\": {\n" + " \"envelope_xdr\": \"AAAAAKpmDL6Z4hvZmkTBkYpHftan4ogzTaO4XTB7joLgQnYYAAAAZAAAAAAABeoyAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAD3sEVVGZGi/NoC3ta/8f/YZKMzyi9ZJpOi0H47x7IqYAAAAAAAAAAAF9eEAAAAAAAAAAAA=\",\n" + " \"result_codes\": {\n" + - " \"transaction\": \"tx_fee_bump_inner_failed\"\n" + + " \"transaction\": \"tx_fee_bump_inner_failed\",\n" + " \"inner_transaction\": \"tx_no_source_account\"\n" + " },\n" + " \"result_xdr\": \"AAAAAAAAAMj////zxZjN9tKJLJ6diZuWBitlMJ/4MXX1Akm9M5CqZt10ogoAAAAAAAAAAP////8AAAABAAAAAAAAAAb/////AAAAAAAAAAA=\"\n" + From 0f8fa6518f75d7bd3820fdf7dfb1e1bc60062033 Mon Sep 17 00:00:00 2001 From: shawn Date: Thu, 9 Mar 2023 10:25:19 -0800 Subject: [PATCH 4/5] troubleshooting gh workflow add a commmit to trigger new workflow run on gh to resolve issue. --- .../org/stellar/sdk/responses/SubmitTransactionResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java index d03b9b9c2..a85716b69 100644 --- a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java +++ b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java @@ -9,6 +9,7 @@ import java.io.IOException; +// temp change to trigger workflow again public class SubmitTransactionResponseTest extends TestCase { @Test public void testDeserializeTransactionFailureResponse() throws IOException { From ecf0906834f721f8a5397c00235ce799b68c6e17 Mon Sep 17 00:00:00 2001 From: shawn Date: Thu, 9 Mar 2023 10:35:08 -0800 Subject: [PATCH 5/5] remove temporary change removed the temporary line update for testing new commits on workflow runs in gh --- .../org/stellar/sdk/responses/SubmitTransactionResponseTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java index a85716b69..d03b9b9c2 100644 --- a/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java +++ b/src/test/java/org/stellar/sdk/responses/SubmitTransactionResponseTest.java @@ -9,7 +9,6 @@ import java.io.IOException; -// temp change to trigger workflow again public class SubmitTransactionResponseTest extends TestCase { @Test public void testDeserializeTransactionFailureResponse() throws IOException {