-
Notifications
You must be signed in to change notification settings - Fork 4
Make token operations deserializable from CBOR #362
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
base: main
Are you sure you want to change the base?
Conversation
Also add toString, equals and hashCode for convenience.
This adds support for writing unsigned numbers to CBOR, so the reflection workaround is removed. Writing unsigned numbers also now takes as little space as possible.
Also place serializer near the deserializer for clarity.
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.
Pull Request Overview
This PR enables CBOR deserialization for TokenOperation
s by refactoring the serialization approach from custom code to Jackson annotations and adding comprehensive deserialization support.
Key Changes:
- Upgraded Jackson dependency from 2.19.1 to 2.20.0
- Replaced custom serialization code with Jackson annotation-based configuration for token operations
- Added deserialization support for
TokenOperation
,CborMemo
,TaggedTokenHolderAccount
, andTokenOperationAmount
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
pom.xml | Updated project version to 11.1.0-SNAPSHOT and Jackson to 2.20.0 |
TokenOperation.java | Replaced custom serializer with @JsonTypeInfo and @JsonSubTypes annotations |
TransferTokenOperation.java | Added @Jacksonized , @EqualsAndHashCode , and removed custom getBody() method |
TokenOperationAmount.java | Added @JsonCreator constructor and replaced custom serializer with StdSerializer |
CborMemo.java | Added CborDeserializer class and equals /hashCode methods |
TaggedTokenHolderAccount.java | Added CborDeserializer class and equals /hashCode methods |
UInt64.java | Simplified CBOR serialization using writeNumberUnsigned() |
UInt32.java | Added @JsonCreator constructor and simplified CBOR serialization |
TokenUpdate.java | Added getOperationsSerialized() method and operationsSerialized() builder method |
CborMapper.java | Removed custom writeBytesAsValue() method and updated configuration |
Test files | Added deserialization tests and updated expected values |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Purpose
Make
TokenOperation
s deserializable from CBOR.Changes
TransferTokenOperation
deserializable from CBORChecklist
hard-to-understand areas.