Closed LimpidCrypto closed 1 year ago
Honestly I think it might be better if we had separate models for XRP
and IssuedCurrency
as currencies and XRPAmount
and IssuedCurrencyAmount
as amounts. That enables us to make our library to be stronger typed. Like an AccountRoot
objects Balance
could only be XRPAmount
.
What's your opinion @sephynox ? If you agree I would close the PR and open a new PR soon.
Honestly I think it might be better if we had separate models for
XRP
andIssuedCurrency
as currencies andXRPAmount
andIssuedCurrencyAmount
as amounts. That enables us to make our library to be stronger typed. Like anAccountRoot
objectsBalance
could only beXRPAmount
.What's your opinion @sephynox ? If you agree I would close the PR and open a new PR soon.
We agreed upon separating the currencies/amounts.
High Level Overview of Change
Model conversion
This PR changes the lifetime of
Currency
andAmount
from'static
to'a
. It also addsto_amount
to turn aCurrency
into anAmount
giving avalue
. Implement theFrom<Amount> for Currency
trait to turn anAmount
into aCurrency
.value
conversionThe
get_value_as_u32
method was also replaced withTryInto<rust_decimal::Decimal> for Amount
to have a more convenient way to deal with anAmount.value
. Theget_value_as_u32
also don't make sense forIssuedCurrencyAmount
since it'svalue
is most likely a decimal value.Type of Change
Future Tasks