use rust_sodium::crypto::box_; use std::fmt; #[derive(Debug, Clone)] pub struct Transaction { pub amount: f64, pub payer: box_::curve25519xsalsa20poly1305::PublicKey, pub payee: box_::curve25519xsalsa20poly1305::PublicKey, } impl fmt::Display for Transaction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "{{amount:{}, payer:{:?}, payee:{:?}}}", self.amount, self.payer, self.payee ) } } impl Transaction { pub fn new( amount: f64, payer: box_::curve25519xsalsa20poly1305::PublicKey, payee: box_::curve25519xsalsa20poly1305::PublicKey, ) -> Transaction { Transaction { amount, payer, payee, } } pub fn pr_string(&self) -> String { self.to_string() } }