From 07296b89f5f4b591bed51b84ae7416e9efb2057e Mon Sep 17 00:00:00 2001 From: Arkanoider Date: Thu, 29 Aug 2024 09:15:28 +0200 Subject: [PATCH 1/3] additions to make dispute tokens --- Cargo.toml | 2 +- src/message.rs | 2 +- src/order.rs | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aa4638e..4954bd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mostro-core" -version = "0.6.5" +version = "0.6.6" edition = "2021" license = "MIT" authors = ["Francisco Calderón "] diff --git a/src/message.rs b/src/message.rs index 318cbc4..8802593 100644 --- a/src/message.rs +++ b/src/message.rs @@ -192,7 +192,7 @@ pub enum Content { Order(SmallOrder), PaymentRequest(Option, String, Option), TextMessage(String), - Peer(Peer), + Peer(Peer, Option), RatingUser(u8), Amount(Amount), Dispute(Uuid), diff --git a/src/order.rs b/src/order.rs index 86efce7..a6fa4c0 100644 --- a/src/order.rs +++ b/src/order.rs @@ -164,6 +164,8 @@ impl Order { self.buyer_invoice.clone(), Some(self.created_at), Some(self.expires_at), + None, + None, ) } @@ -194,6 +196,8 @@ pub struct SmallOrder { pub buyer_invoice: Option, pub created_at: Option, pub expires_at: Option, + pub buyer_token: Option, + pub seller_token: Option, } #[allow(dead_code)] @@ -215,6 +219,8 @@ impl SmallOrder { buyer_invoice: Option, created_at: Option, expires_at: Option, + buyer_token: Option, + seller_token: Option, ) -> Self { Self { id, @@ -232,6 +238,8 @@ impl SmallOrder { buyer_invoice, created_at, expires_at, + buyer_token, + seller_token, } } /// New order from json string From b2f8e44bf1a3eacfae6c73b059a46e4a2e5ebec2 Mon Sep 17 00:00:00 2001 From: Arkanoider Date: Thu, 29 Aug 2024 09:25:38 +0200 Subject: [PATCH 2/3] fix tests --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index dfab3df..7fcec80 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,6 +53,8 @@ mod test { None, Some(1627371434), None, + None, + None, ))), )); let sample_message = r#"{"order":{"version":1,"id":"308e1272-d5f4-47e6-bd97-3504baea9c23","pubkey":null,"action":"new-order","content":{"order":{"id":"308e1272-d5f4-47e6-bd97-3504baea9c23","kind":"sell","status":"pending","amount":100,"fiat_code":"eur","fiat_amount":100,"payment_method":"SEPA","premium":1,"created_at":1627371434}}}}"#; @@ -87,6 +89,8 @@ mod test { None, Some(1627371434), None, + None, + None )), "lnbcrt78510n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e".to_string(), None, From 9e0d516617ef95d579c04b9a40f95152b9c2d996 Mon Sep 17 00:00:00 2001 From: Arkanoider Date: Thu, 29 Aug 2024 23:27:20 +0200 Subject: [PATCH 3/3] additions to save to db tokens --- src/dispute.rs | 4 ++++ src/message.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dispute.rs b/src/dispute.rs index 6baeaed..f7a1062 100644 --- a/src/dispute.rs +++ b/src/dispute.rs @@ -62,6 +62,8 @@ pub struct Dispute { pub solver_pubkey: Option, pub created_at: i64, pub taken_at: i64, + pub buyer_token: Option, + pub seller_token: Option, } impl Dispute { @@ -73,6 +75,8 @@ impl Dispute { solver_pubkey: None, created_at: Utc::now().timestamp(), taken_at: 0, + buyer_token: None, + seller_token: None, } } } diff --git a/src/message.rs b/src/message.rs index 8802593..b1c978e 100644 --- a/src/message.rs +++ b/src/message.rs @@ -192,10 +192,10 @@ pub enum Content { Order(SmallOrder), PaymentRequest(Option, String, Option), TextMessage(String), - Peer(Peer, Option), + Peer(Peer), RatingUser(u8), Amount(Amount), - Dispute(Uuid), + Dispute(Uuid, Option), } #[allow(dead_code)]