-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add support for unknown transactions #569
base: main
Are you sure you want to change the base?
Conversation
// FIXME: Have to make this Default, otherwise JsonAnySetter adds this field to unknownFields. Other option | ||
// is that's totally fine, which i think it is -- we should let the JSON set this field if it's there | ||
@Value.Default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sappenin we should discuss this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if we wanted to keep the @Derived
could make a special carve-out in the Deserializer to add Account
into EXTRA_TRANSACTION_FIELDS
.
However, that's ugly, and makes it so nobody can create a UnlModify
with an account that's not account-zero. That's a non-goal ATM, but I think I prefer making this @Default
just in case someone every wants to do that (e.g., for testing, or whatever).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #569 +/- ##
============================================
- Coverage 92.04% 92.04% -0.01%
- Complexity 1842 1847 +5
============================================
Files 382 383 +1
Lines 5106 5116 +10
Branches 433 433
============================================
+ Hits 4700 4709 +9
- Misses 271 272 +1
Partials 135 135 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- mostly cleanup and docs suggestions, but otherwise good to go. Thanks for adding support here!
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/AmmBid.java
Outdated
Show resolved
Hide resolved
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/jackson/modules/TransactionDeserializer.java
Outdated
Show resolved
Hide resolved
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/AmmBid.java
Outdated
Show resolved
Hide resolved
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/Transaction.java
Outdated
Show resolved
Hide resolved
xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/transactions/TransactionType.java
Show resolved
Hide resolved
xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/TransactionTypeTests.java
Show resolved
Hide resolved
xrpl4j-core/src/test/java/org/xrpl/xrpl4j/model/transactions/json/UnlModifyJsonTests.java
Outdated
Show resolved
Hide resolved
// FIXME: Have to make this Default, otherwise JsonAnySetter adds this field to unknownFields. Other option | ||
// is that's totally fine, which i think it is -- we should let the JSON set this field if it's there | ||
@Value.Default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if we wanted to keep the @Derived
could make a special carve-out in the Deserializer to add Account
into EXTRA_TRANSACTION_FIELDS
.
However, that's ugly, and makes it so nobody can create a UnlModify
with an account that's not account-zero. That's a non-goal ATM, but I think I prefer making this @Default
just in case someone every wants to do that (e.g., for testing, or whatever).
Adds a new field to
Transaction
calledunknownFields
, which is annotated with@JsonAnySetter
. This tells Jackson to populateunknownFields
with any JSON fields that are unmapped in the immutable.This allow for two things:
UnknownTransaction
, which only has common fields +unknownFields
, which allows any version of xrpl4j that containsUnknownTransaction
to deserialize an unsupported transaction type from JSON