Skip to content
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

asset/btc/electrum: make floatString work for floats and strings #2770

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ukane-philemon
Copy link
Contributor

This PR improves the UnmarshalJSON method of type floatString.

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
@ukane-philemon ukane-philemon changed the title asset/btc/electrum: make floatString work for floats and `strings asset/btc/electrum: make floatString work for floats and strings May 12, 2024
Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test that confirms it does what it should? I don't know exactly what we want to parse, like "1.31" and 0?

@ukane-philemon
Copy link
Contributor Author

like "1.31" and 0

Yes, floatString should do both, master code parses only the former. This PR enables parsing both.

@buck54321
Copy link
Member

Please provide some reasoning for why this change is needed.

@ukane-philemon
Copy link
Contributor Author

Please provide some reasoning for why this change is needed.

I intend to use this in #2769, as a shared code since we deal with floatString there too, suggesting this as a smaller change to make floatString compatible with cases where the same fields could be represented as floats and strings depending on the asset. In other cases where we'd need this, we would simply add a type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants