-
Notifications
You must be signed in to change notification settings - Fork 8
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 ledger object models #58
Merged
LimpidCrypto
merged 8 commits into
sephynox:develop
from
LimpidCrypto:add-ledger-object-models
Apr 6, 2023
Merged
Add ledger object models #58
LimpidCrypto
merged 8 commits into
sephynox:develop
from
LimpidCrypto:add-ledger-object-models
Apr 6, 2023
Conversation
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
Closed
22 tasks
sephynox
reviewed
Mar 20, 2023
2 tasks
sephynox
reviewed
Apr 1, 2023
Comment on lines
+20
to
+35
match flags_value_result { | ||
Ok(flags_as_value) => { | ||
let flag_vec_result: Result<Vec<u32>, serde_json::Error> = | ||
serde_json::from_value(flags_as_value); | ||
match flag_vec_result { | ||
Ok(flags_vec) => s.serialize_u32(flags_vec.iter().sum()), | ||
Err(_) => { | ||
// TODO: Find a way to use custom errors | ||
Err(ser::Error::custom("SerdeIntermediateStepError: Failed to turn flags into `Vec<u32>` during serialization")) | ||
} | ||
} | ||
} | ||
Err(_) => Err(ser::Error::custom( | ||
"SerdeIntermediateStepError: Failed to turn flags into `Value` during serialization", | ||
)), | ||
} |
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.
I think an if let or pattern binding might make this a bit cleaner.
Comment on lines
+102
to
112
let flags_vec_result: Result<Vec<F>, D::Error> = deserialize_flags(d); | ||
match flags_vec_result { | ||
Ok(flags_vec) => { | ||
if flags_vec.is_empty() { | ||
Ok(None) | ||
} else { | ||
Ok(Some(flags_vec)) | ||
} | ||
} | ||
Err(error) => Err(error), | ||
} |
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.
An if/else would be simpler here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
1st month
Planned to be worked on in the first month. Estimate budget: 13,333 $
2nd month
Planned to be worked on in the second month. Estimate budget: 6,666 $
enhancement
New feature or request
XRPL Grants
This issue is planned to get resoled as part of the XRPL Grants program (within 8 months)
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.
This is the follow up to #57
High Level Overview of Change
Ledger object models
Adds ledger object models including the
AMM
object model.Models in general
It is also an attempt to implement a general order for fields (models/mod.rs):
If agreed on the order:
serde_with_tag
Moved the
Helper
tofn serialize
andfn deserialize
to avoid defining it multiple times in a file.Context of Change
#27
Type of Change
Test Plan
Future Tasks
Keep an eye on the
XRPFees
amendment. It could change how some fields are typed and/or named.