From daf14bb8a5f984f3416b4f7dc4d34c30f0b55cc9 Mon Sep 17 00:00:00 2001 From: Pawel Jakubas Date: Mon, 17 Jan 2022 14:28:25 +0100 Subject: [PATCH] make foreign wallet definition laxer hlint --- .../src/Test/Integration/Framework/TestData.hs | 2 +- .../Integration/Scenario/API/Shelley/TransactionsNew.hs | 7 +++---- lib/core/src/Cardano/Wallet/Api/Server.hs | 8 ++------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/core-integration/src/Test/Integration/Framework/TestData.hs b/lib/core-integration/src/Test/Integration/Framework/TestData.hs index 1576692c72b..1e4ff86a799 100644 --- a/lib/core-integration/src/Test/Integration/Framework/TestData.hs +++ b/lib/core-integration/src/Test/Integration/Framework/TestData.hs @@ -642,7 +642,7 @@ errMsg400ScriptNotUniformRoles = errMsg403ForeignTransaction :: String errMsg403ForeignTransaction = mconcat [ "The transaction to be submitted is foreign to the current wallet " - , "and cannot be sent. Submit a transaction that has either input, output " + , "and cannot be sent. Submit a transaction that has either input " , "or withdrawal belonging to the wallet." ] diff --git a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs index e1b3ccf7fa6..166c9ec7527 100644 --- a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs +++ b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs @@ -2158,8 +2158,7 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do ] forM_ scenarios $ \(title, foreignWallet) -> it title $ \ctx -> runResourceT $ do wa <- fixtureWallet ctx - wb <- fixtureWallet ctx - wF <- foreignWallet ctx + wb <- foreignWallet ctx -- Construct tx payload <- mkTxPayload ctx wb $ minUTxOValue (_mainEra ctx) @@ -2176,8 +2175,8 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do signedTx <- getFromResponse Prelude.id <$> request @ApiSerialisedTransaction ctx signEndpoint Default toSign - -- Submit tx (from wF) - submittedTx <- submitTxWithWid ctx wF signedTx + -- Submit tx (from wb) + submittedTx <- submitTxWithWid ctx wb signedTx verify submittedTx [ expectResponseCode HTTP.status403 , expectErrorMessage errMsg403ForeignTransaction diff --git a/lib/core/src/Cardano/Wallet/Api/Server.hs b/lib/core/src/Cardano/Wallet/Api/Server.hs index e3c1640561f..db94a5641fd 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -2410,15 +2410,11 @@ submitTransaction ctx apiw@(ApiT wid) apitx@(ApiSerialisedTransaction (ApiT seal isForeign apiDecodedTx = let generalInps = apiDecodedTx ^. #inputs generalWdrls = apiDecodedTx ^. #withdrawals - generalOuts = apiDecodedTx ^. #outputs isInpForeign (WalletInput _) = False isInpForeign _ = True - isOutForeign (WalletOutput _) = False - isOutForeign _ = True isWdrlForeign (ApiWithdrawalGeneral _ _ context) = context == External in all isInpForeign generalInps && - all isOutForeign generalOuts && all isWdrlForeign generalWdrls joinStakePool @@ -3942,11 +3938,11 @@ instance IsServerError ErrSubmitTransaction where ErrSubmitTransactionForeignWallet -> apiError err403 ForeignTransaction $ mconcat [ "The transaction to be submitted is foreign to the current wallet " - , "and cannot be sent. Submit a transaction that has either input, output " + , "and cannot be sent. Submit a transaction that has either input " , "or withdrawal belonging to the wallet." ] ErrSubmitTransactionPartiallySignedOrNoSignedTx expectedWitsNo foundWitsNo -> - apiError err403 MissingWitnessesInTransaction $ mconcat $ + apiError err403 MissingWitnessesInTransaction $ mconcat [ "The transaction has ", toText expectedWitsNo , " inputs and ", toText foundWitsNo, " witnesses included." , " Submit fully-signed transaction."