Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `"monero"` and `"xmr"` variants for Monero `FromStr` impl ([#192](https://github.com/farcaster-project/farcaster-core/pull/192))

### Fixed

- Fix `Display` implementation to work with any given writer ([#192](https://github.com/farcaster-project/farcaster-core/pull/192))

## [0.4.1] - 2021-12-05

### Added
Expand Down
11 changes: 5 additions & 6 deletions src/monero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use monero::util::key::{PrivateKey, PublicKey};
use monero::Address;
use monero::Amount;

use std::fmt::{self, Debug, Display, Formatter};
use std::fmt::{self, Debug};

pub mod tasks;

Expand Down Expand Up @@ -74,16 +74,15 @@ impl std::str::FromStr for Monero {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"Monero" => Ok(Monero),
"Monero" | "monero" | "xmr" => Ok(Monero),
_ => Err(crate::consensus::Error::UnknownType),
}
}
}

impl Display for Monero {
fn fmt(&self, _f: &mut Formatter<'_>) -> fmt::Result {
println!("xmr");
Ok(())
impl fmt::Display for Monero {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Monero")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/negotiation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ mod tests {

#[test]
fn display_offer() {
assert_eq!(&format!("{}", *OFFER), "Network: Testnet\nBlockchain: Bitcoin<SegwitV0>\n- amount: 0.00001350 BTC\nBlockchain: \n- amount: 0.000000010000 XMR\nTimelocks\n- cancel: 4 blocks\n- punish: 6 blocks\nFee strategy: Fixed: 1 satoshi/vByte\nMaker swap role: Bob\n");
assert_eq!(&format!("{}", *OFFER), "Network: Testnet\nBlockchain: Bitcoin<SegwitV0>\n- amount: 0.00001350 BTC\nBlockchain: Monero\n- amount: 0.000000010000 XMR\nTimelocks\n- cancel: 4 blocks\n- punish: 6 blocks\nFee strategy: Fixed: 1 satoshi/vByte\nMaker swap role: Bob\n");
}

#[test]
Expand Down