From b86a40680f2076a4d1e81a861a34cdf97a68d28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Calder=C3=B3n?= Date: Sat, 28 Dec 2024 12:56:40 -0300 Subject: [PATCH 1/2] Move some actions to cantdoreasons --- src/lib.rs | 6 ++++++ src/message.rs | 30 ++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8659ef6..b55c236 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -153,6 +153,12 @@ mod test { CantDoReason::InvalidParameters, CantDoReason::OrderAlreadyCanceled, CantDoReason::CantCreateUser, + CantDoReason::IsNotYourOrder, + CantDoReason::NotAllowedByStatus, + CantDoReason::OutOfRangeFiatAmount, + CantDoReason::OutOfRangeSatsAmount, + CantDoReason::IsNotYourDispute, + CantDoReason::NotFound, ]; for reason in reasons { diff --git a/src/message.rs b/src/message.rs index 3e06536..113dd11 100644 --- a/src/message.rs +++ b/src/message.rs @@ -70,17 +70,10 @@ pub enum Action { AdminAddSolver, AdminTakeDispute, AdminTookDispute, - IsNotYourOrder, - NotAllowedByStatus, - OutOfRangeFiatAmount, - IsNotYourDispute, - NotFound, - IncorrectInvoiceAmount, - InvalidSatsAmount, - OutOfRangeSatsAmount, PaymentFailed, InvoiceUpdated, SendDm, + TradePubkey, } impl fmt::Display for Action { @@ -241,6 +234,18 @@ pub enum CantDoReason { OrderAlreadyCanceled, /// Can't create user CantCreateUser, + /// For users trying to do actions on orders that are not theirs + IsNotYourOrder, + /// For users trying to do actions on orders not allowed by status + NotAllowedByStatus, + /// Fiat amount is out of range + OutOfRangeFiatAmount, + /// Sats amount is out of range + OutOfRangeSatsAmount, + /// For users trying to do actions on dispute that are not theirs + IsNotYourDispute, + /// Generic not found + NotFound, } /// Message payload @@ -329,15 +334,8 @@ impl MessageKind { | Action::CooperativeCancelInitiatedByPeer | Action::CooperativeCancelAccepted | Action::Cancel - | Action::IsNotYourOrder - | Action::NotAllowedByStatus - | Action::OutOfRangeFiatAmount - | Action::OutOfRangeSatsAmount - | Action::IsNotYourDispute - | Action::NotFound - | Action::IncorrectInvoiceAmount - | Action::InvalidSatsAmount | Action::PaymentFailed + | Action::TradePubkey | Action::InvoiceUpdated | Action::AdminAddSolver | Action::SendDm From 189e86ef5705c8f5afe65a6638c7273cfb60ff01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Calder=C3=B3n?= Date: Sat, 28 Dec 2024 12:57:09 -0300 Subject: [PATCH 2/2] bumps to 0.6.22 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0b8cf98..5a499ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mostro-core" -version = "0.6.21" +version = "0.6.22" edition = "2021" license = "MIT" authors = ["Francisco Calderón "]