-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for Horizon's transaction_async API. (#621)
- Loading branch information
Showing
7 changed files
with
564 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/org/stellar/sdk/responses/SubmitTransactionAsyncResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.stellar.sdk.responses; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.Value; | ||
import org.stellar.sdk.Util; | ||
import org.stellar.sdk.xdr.TransactionResult; | ||
|
||
/** | ||
* Represents the response from the "Submit a Transaction Asynchronously" endpoint of Horizon API. | ||
* | ||
* <p>See <a | ||
* href="https://developers.stellar.org/docs/data/horizon/api-reference/submit-async-transaction"> | ||
* Submit Transaction Asynchronously</a> | ||
*/ | ||
@Value | ||
public class SubmitTransactionAsyncResponse { | ||
String hash; | ||
|
||
@SerializedName("tx_status") | ||
TransactionStatus txStatus; | ||
|
||
@SerializedName("errorResultXdr") // inconsistency | ||
String errorResultXdr; | ||
|
||
/** | ||
* Parses the {@code errorResultXdr} field from a string to an {@link | ||
* org.stellar.sdk.xdr.TransactionResult} object. | ||
* | ||
* @return the parsed {@link org.stellar.sdk.xdr.TransactionResult} object | ||
*/ | ||
public TransactionResult parseErrorResultXdr() { | ||
return Util.parseXdr(errorResultXdr, TransactionResult::fromXdrBase64); | ||
} | ||
|
||
public enum TransactionStatus { | ||
ERROR, | ||
PENDING, | ||
DUPLICATE, | ||
TRY_AGAIN_LATER, | ||
} | ||
} |
Oops, something went wrong.