From d678abab78c016c73ef7b4db1b5c84a626a3849a Mon Sep 17 00:00:00 2001 From: dimxy Date: Thu, 24 Aug 2023 14:01:46 +0500 Subject: [PATCH] refactor sign_raw_tx error return --- mm2src/coins/eth.rs | 6 +++--- mm2src/coins/lightning.rs | 5 ++--- mm2src/coins/solana.rs | 5 ++--- mm2src/coins/solana/spl.rs | 5 ++--- mm2src/coins/tendermint/tendermint_coin.rs | 5 ++--- mm2src/coins/tendermint/tendermint_token.rs | 5 ++--- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/mm2src/coins/eth.rs b/mm2src/coins/eth.rs index fe8fa6a020..d96c98ccca 100644 --- a/mm2src/coins/eth.rs +++ b/mm2src/coins/eth.rs @@ -1907,12 +1907,12 @@ impl MarketCoinOps for EthCoin { ) } + /// Stub for sign utxo tx #[inline(always)] async fn sign_raw_tx(&self, _args: &SignRawTransactionRequest) -> SignRawTransactionResult { - Err(RawTransactionError::NotImplemented { + MmError::err(RawTransactionError::NotImplemented { coin: self.ticker().to_string(), - } - .into()) + }) } fn wait_for_confirmations(&self, input: ConfirmPaymentInput) -> Box + Send> { diff --git a/mm2src/coins/lightning.rs b/mm2src/coins/lightning.rs index bac7dadecd..d25431a664 100644 --- a/mm2src/coins/lightning.rs +++ b/mm2src/coins/lightning.rs @@ -1098,10 +1098,9 @@ impl MarketCoinOps for LightningCoin { #[inline(always)] async fn sign_raw_tx(&self, _args: &SignRawTransactionRequest) -> SignRawTransactionResult { - Err(RawTransactionError::NotImplemented { + MmError::err(RawTransactionError::NotImplemented { coin: self.ticker().to_string(), - } - .into()) + }) } // Todo: Add waiting for confirmations logic for the case of if the channel is closed and the htlc can be claimed on-chain diff --git a/mm2src/coins/solana.rs b/mm2src/coins/solana.rs index 906c902b09..0811d9c91d 100644 --- a/mm2src/coins/solana.rs +++ b/mm2src/coins/solana.rs @@ -442,10 +442,9 @@ impl MarketCoinOps for SolanaCoin { #[inline(always)] async fn sign_raw_tx(&self, _args: &SignRawTransactionRequest) -> SignRawTransactionResult { - Err(RawTransactionError::NotImplemented { + MmError::err(RawTransactionError::NotImplemented { coin: self.ticker().to_string(), - } - .into()) + }) } fn wait_for_confirmations(&self, _input: ConfirmPaymentInput) -> Box + Send> { diff --git a/mm2src/coins/solana/spl.rs b/mm2src/coins/solana/spl.rs index 3df4fb761c..ddc4397d61 100644 --- a/mm2src/coins/solana/spl.rs +++ b/mm2src/coins/solana/spl.rs @@ -270,10 +270,9 @@ impl MarketCoinOps for SplToken { #[inline(always)] async fn sign_raw_tx(&self, _args: &SignRawTransactionRequest) -> SignRawTransactionResult { - Err(RawTransactionError::NotImplemented { + MmError::err(RawTransactionError::NotImplemented { coin: self.ticker().to_string(), - } - .into()) + }) } fn wait_for_confirmations(&self, _input: ConfirmPaymentInput) -> Box + Send> { diff --git a/mm2src/coins/tendermint/tendermint_coin.rs b/mm2src/coins/tendermint/tendermint_coin.rs index f8a3e1333e..9c2ba68c58 100644 --- a/mm2src/coins/tendermint/tendermint_coin.rs +++ b/mm2src/coins/tendermint/tendermint_coin.rs @@ -2188,10 +2188,9 @@ impl MarketCoinOps for TendermintCoin { #[inline(always)] async fn sign_raw_tx(&self, _args: &SignRawTransactionRequest) -> SignRawTransactionResult { - Err(RawTransactionError::NotImplemented { + MmError::err(RawTransactionError::NotImplemented { coin: self.ticker().to_string(), - } - .into()) + }) } fn wait_for_confirmations(&self, input: ConfirmPaymentInput) -> Box + Send> { diff --git a/mm2src/coins/tendermint/tendermint_token.rs b/mm2src/coins/tendermint/tendermint_token.rs index 3d0a7b252d..65e7ecb36f 100644 --- a/mm2src/coins/tendermint/tendermint_token.rs +++ b/mm2src/coins/tendermint/tendermint_token.rs @@ -541,10 +541,9 @@ impl MarketCoinOps for TendermintToken { #[inline(always)] async fn sign_raw_tx(&self, _args: &SignRawTransactionRequest) -> SignRawTransactionResult { - Err(RawTransactionError::NotImplemented { + MmError::err(RawTransactionError::NotImplemented { coin: self.ticker().to_string(), - } - .into()) + }) } fn wait_for_confirmations(&self, input: ConfirmPaymentInput) -> Box + Send> {