-
Notifications
You must be signed in to change notification settings - Fork 71
Add support for unknown transactions #569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b373230
Revert "Revert "unknown transaction""
nkramer44 6251706
Revert "Revert "javadoc""
nkramer44 c8cfa50
cleanup
nkramer44 29e3f04
add NON_ABSENT back
nkramer44 ea26ff0
add flags test
nkramer44 3041912
cleanup
nkramer44 1a109a2
Merge branch 'main' into nk/unknown-transaction
sappenin 4bec1f2
Merge branch 'main' into nk/unknown-transaction
nkramer44 bb31b4c
fix test
nkramer44 a86c698
remove FIXME
nkramer44 c663df6
fix PaymentChannelIT
nkramer44 51589f4
fix PaymentChannelIT
nkramer44 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
65 changes: 65 additions & 0 deletions
65
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/UnknownTransaction.java
This file contains hidden or 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,65 @@ | ||
| package org.xrpl.xrpl4j.model.transactions; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
| import org.immutables.value.Value; | ||
| import org.immutables.value.Value.Immutable; | ||
| import org.xrpl.xrpl4j.model.flags.TransactionFlags; | ||
|
|
||
| /** | ||
| * Mapping for any transaction type that is unrecognized/unsupported by xrpl4j. | ||
| */ | ||
| @Immutable | ||
| @JsonSerialize(as = ImmutableUnknownTransaction.class) | ||
| @JsonDeserialize(as = ImmutableUnknownTransaction.class) | ||
| public interface UnknownTransaction extends Transaction { | ||
|
|
||
| /** | ||
| * Construct a {@code UnknownTransaction} builder. | ||
| * | ||
| * @return An {@link ImmutableUnknownTransaction.Builder}. | ||
| */ | ||
| static ImmutableUnknownTransaction.Builder builder() { | ||
| return ImmutableUnknownTransaction.builder(); | ||
| } | ||
|
|
||
| /** | ||
| * The actual transaction type found in the {@code "TransactionType"} field of the transaction JSON. | ||
| * | ||
| * <p>This has to be a {@link String} because {@link Transaction#transactionType()} is a {@link TransactionType}, | ||
| * which only has an UNKNOWN variant. Because this method is also annotated with {@link JsonProperty} of | ||
| * "TransactionType", this essentially overrides the "TransactionType" field in JSON, but {@link #transactionType()} | ||
| * will always be {@link TransactionType#UNKNOWN} and this field will contain the actual "TransactionType" field. | ||
| * | ||
| * @return A {@link String} containing the transaction type from JSON. | ||
| */ | ||
| @JsonProperty("TransactionType") | ||
| String unknownTransactionType(); | ||
|
|
||
| /** | ||
| * The {@link TransactionType} of this UnknownTransaction, which will always be {@link TransactionType#UNKNOWN}. | ||
| * {@link #unknownTransactionType()} contains the actual transaction type value. | ||
| * | ||
| * @return {@link TransactionType#UNKNOWN}. | ||
| */ | ||
| @Override | ||
| @JsonIgnore | ||
| @Value.Derived | ||
| default TransactionType transactionType() { | ||
| return Transaction.super.transactionType(); | ||
| } | ||
|
|
||
| /** | ||
| * A set of {@link TransactionFlags}. | ||
| * | ||
| * @return A {@link TransactionFlags}. | ||
| */ | ||
| @JsonProperty("Flags") | ||
| @Value.Default | ||
| default TransactionFlags flags() { | ||
| return TransactionFlags.EMPTY; | ||
|
Check warning on line 62 in xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/UnknownTransaction.java
|
||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.