-
Notifications
You must be signed in to change notification settings - Fork 965
non-uniform usage of plural in Denomination #729
Copy link
Copy link
Closed
Description
The Amount related Denomination struct parses to and from strings. Currently it uses the plural for Denomination::Bit and the singular for Denomination::Satoshi.
We should be uniform, either we support singular, plural, or both for all the abbreviation denominations (bits and sats).
let a = Amount::from_str("100 bits")andlet a = Amount::from_str("100 sats")let a = Amount::from_str("100 bit")andlet a = Amount::from_str("100 sat")- Both 1 and 2
For reference, here is the from_str implementation.
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"BTC" => Ok(Denomination::Bitcoin),
"mBTC" => Ok(Denomination::MilliBitcoin),
"uBTC" => Ok(Denomination::MicroBitcoin),
"bits" => Ok(Denomination::Bit),
"satoshi" => Ok(Denomination::Satoshi),
"sat" => Ok(Denomination::Satoshi),
"msat" => Ok(Denomination::MilliSatoshi),
d => Err(ParseAmountError::UnknownDenomination(d.to_owned())),
}
}
Found while testing #509
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels