Skip to content

Commit 4af104f

Browse files
committed
fix : wrong check when creating new trade keys was working only on sell orders when order was with range
- update nostr-sdk to 0.41.0 - update mostro-core to 0.6.40 - introduce mostro_core::prelude
1 parent 2449f2b commit 4af104f

16 files changed

Lines changed: 108 additions & 81 deletions

Cargo.lock

Lines changed: 78 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = "src/main.rs"
2222
[dependencies]
2323
anyhow = "1.0.68"
2424
clap = { version = "4.0", features = ["derive"] }
25-
nostr-sdk = { version = "0.40.0", features = ["nip06", "nip44", "nip59"] }
25+
nostr-sdk = { version = "0.41.0", features = ["nip06", "nip44", "nip59"] }
2626
serde = "1.0.215"
2727
serde_json = "1.0.91"
2828
tokio = { version = "1.23.0", features = ["full"] }
@@ -39,7 +39,7 @@ uuid = { version = "1.3.0", features = [
3939
dotenvy = "0.15.6"
4040
lightning-invoice = { version = "0.32.0", features = ["std"] }
4141
reqwest = { version = "0.12.4", features = ["json"] }
42-
mostro-core = "0.6.35"
42+
mostro-core = "0.6.40"
4343
lnurl-rs = "0.9.0"
4444
pretty_env_logger = "0.5.0"
4545
openssl = { version = "0.10.68", features = ["vendored"] }

src/cli/add_invoice.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use crate::util::send_message_sync;
33
use crate::{db::Order, lightning::is_valid_invoice};
44
use anyhow::Result;
55
use lnurl::lightning_address::LightningAddress;
6-
use mostro_core::message::{Action, Message, Payload};
7-
use mostro_core::order::Status;
6+
use mostro_core::prelude::*;
87
use nostr_sdk::prelude::*;
98
use std::str::FromStr;
109
use uuid::Uuid;

src/cli/get_dm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use anyhow::Result;
22
use chrono::DateTime;
3-
use mostro_core::message::{Action, Message, Payload};
3+
use mostro_core::prelude::*;
44
use nostr_sdk::prelude::*;
55

66
use crate::{

src/cli/list_orders.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Result;
2-
use mostro_core::order::{Kind, Status};
2+
use mostro_core::prelude::*;
33
use nostr_sdk::prelude::*;
44
use std::str::FromStr;
55

@@ -16,7 +16,7 @@ pub async fn execute_list_orders(
1616
// Used to get upper currency string to check against a list of tickers
1717
let mut upper_currency: Option<String> = None;
1818
let mut status_checked: Option<Status> = Some(Status::from_str("pending").unwrap());
19-
let mut kind_checked: Option<Kind> = None;
19+
let mut kind_checked: Option<mostro_core::order::Kind> = None;
2020

2121
// New check against strings
2222
if let Some(s) = status {
@@ -29,7 +29,7 @@ pub async fn execute_list_orders(
2929
);
3030
// New check against strings
3131
if let Some(k) = kind {
32-
kind_checked = Some(Kind::from_str(k).expect("Not valid order kind! Please check"));
32+
kind_checked = Some(mostro_core::order::Kind::from_str(k).expect("Not valid order kind! Please check"));
3333
println!("You are searching {} orders", kind_checked.unwrap());
3434
}
3535

src/cli/new_order.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use anyhow::Result;
2-
use mostro_core::error::CantDoReason;
3-
use mostro_core::message::{Action, Message, Payload};
4-
use mostro_core::order::SmallOrder;
5-
use mostro_core::order::{Kind, Status};
2+
use mostro_core::prelude::*;
63
use nostr_sdk::prelude::*;
74
use std::collections::HashMap;
85
use std::io::{stdin, stdout, BufRead, Write};
@@ -51,7 +48,7 @@ pub async fn execute_new_order(
5148
}
5249
let kind = uppercase_first(kind);
5350
// New check against strings
54-
let kind_checked = Kind::from_str(&kind).unwrap();
51+
let kind_checked = mostro_core::order::Kind::from_str(&kind).unwrap();
5552
let expires_at = match *expiration_days {
5653
0 => None,
5754
_ => {

src/cli/rate_user.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Result;
2-
use mostro_core::message::{Action, Message, Payload};
2+
use mostro_core::prelude::*;
33
use nostr_sdk::prelude::*;
44
use uuid::Uuid;
55

src/cli/send_dm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{db::Order, util::send_message_sync};
22
use anyhow::Result;
3-
use mostro_core::message::{Action, Message, Payload};
3+
use mostro_core::prelude::*;
44
use nostr_sdk::prelude::*;
55
use uuid::Uuid;
66

src/cli/send_msg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::util::send_message_sync;
33
use crate::{cli::Commands, db::connect};
44

55
use anyhow::Result;
6-
use mostro_core::message::{Action, Message, Payload};
6+
use mostro_core::prelude::*;
77
use nostr_sdk::prelude::*;
88
use sqlx::SqlitePool;
99
use std::process;
@@ -92,7 +92,7 @@ async fn create_next_trade_payload(
9292
if let (Some(_), Some(min_amount), Some(max_amount)) =
9393
(order.is_mine, order.min_amount, order.max_amount)
9494
{
95-
if max_amount - order.amount >= min_amount {
95+
if max_amount - order.fiat_amount >= min_amount {
9696
let (trade_keys, trade_index) = User::get_next_trade_keys(pool).await?;
9797
return Ok(Some(Payload::NextTrade(
9898
trade_keys.public_key().to_string(),

src/cli/take_buy.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use anyhow::Result;
2-
use mostro_core::error::CantDoReason;
3-
use mostro_core::message::{Action, Message, Payload};
2+
use mostro_core::prelude::*;
43
use nostr_sdk::prelude::*;
54
use uuid::Uuid;
65

0 commit comments

Comments
 (0)