-
Notifications
You must be signed in to change notification settings - Fork 9
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
Configure asset metadata #659
base: savage-multi-assets
Are you sure you want to change the base?
Conversation
e6a24e3
to
2e0d015
Compare
I have to admit at first I thought we should provide a larger list of assets but this minimal approach is more appealing now. |
Yes |
use super::{AssetMetadata, Persister}; | ||
|
||
impl Persister { | ||
pub(crate) fn replace_asset_metadata( |
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.
Can you elaborate what is the advantage of persisting the configurable assets?
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.
For rendering the payment list, it seems simpler to add them to the SQL join
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.
Still reviewing, but will have to finish later, so here's what I got for now :)
lib/core/src/model.rs
Outdated
impl AssetMetadata { | ||
pub fn to_sat(&self, amount: f64) -> u64 { | ||
(amount * (10_u64.pow(self.precision) as f64)) as u64 | ||
} | ||
|
||
pub fn from_sat(&self, amount_sat: u64) -> f64 { | ||
amount_sat as f64 / (10_u64.pow(self.precision) as f64) | ||
} | ||
} |
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.
Nit: this is a bit unconventional. Maybe we could have an AssetAmount
struct with these methods.
36f9697
to
289d61f
Compare
dbc649c
to
e01ea48
Compare
289d61f
to
4dfef3b
Compare
e01ea48
to
2e7501a
Compare
Builds on PR #645
This PR:
Depends on breez/breez-sdk-greenlight#1157