diff --git a/lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs b/lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs index 2041c7cdc7f..de8201fd823 100644 --- a/lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs +++ b/lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs @@ -103,6 +103,7 @@ import Cardano.Wallet.Api.Http.Server.Error.IsServerError import Cardano.Wallet.Api.Types ( ApiCosignerIndex (..) , ApiCredentialType (..) + , ApiT (ApiT) , Iso8601Time (..) ) import Cardano.Wallet.Api.Types.Error @@ -110,6 +111,7 @@ import Cardano.Wallet.Api.Types.Error , ApiErrorInfo (..) , ApiErrorMissingWitnessesInTransaction (..) , ApiErrorNoSuchPool (..) + , ApiErrorNoSuchWallet (..) , ApiErrorNodeNotYetInRecentEra (..) , ApiErrorNotEnoughMoney (..) , ApiErrorNotEnoughMoneyShortfall (..) @@ -254,7 +256,10 @@ instance IsServerError WalletException where instance IsServerError ErrNoSuchWallet where toServerError = \case ErrNoSuchWallet wid -> - apiError err404 NoSuchWallet $ mconcat + flip (apiError err404) message $ + NoSuchWallet ApiErrorNoSuchWallet { walletId = ApiT wid } + where + message = mconcat [ "I couldn't find a wallet with the given id: " , toText wid ] @@ -262,7 +267,7 @@ instance IsServerError ErrNoSuchWallet where instance IsServerError ErrWalletNotInitialized where toServerError = \case ErrWalletNotInitialized -> - apiError err404 NoSuchWallet $ mconcat + apiError err404 WalletNotInitialized $ mconcat [ "The database for the requested wallet is not initialized. " ] diff --git a/lib/api/src/Cardano/Wallet/Api/Types/Error.hs b/lib/api/src/Cardano/Wallet/Api/Types/Error.hs index ab9c5bce9ed..f289ffca79e 100644 --- a/lib/api/src/Cardano/Wallet/Api/Types/Error.hs +++ b/lib/api/src/Cardano/Wallet/Api/Types/Error.hs @@ -31,6 +31,7 @@ module Cardano.Wallet.Api.Types.Error , ApiErrorNotEnoughMoneyShortfall (..) , ApiErrorMissingWitnessesInTransaction (..) , ApiErrorNoSuchPool (..) + , ApiErrorNoSuchWallet (..) , ApiErrorUnsupportedEra (..) ) where @@ -44,6 +45,7 @@ import Cardano.Wallet.Api.Lib.Options import Cardano.Wallet.Api.Types ( ApiCosignerIndex (..) , ApiCredentialType (..) + , ApiT ) import Cardano.Wallet.Api.Types.Amount ( ApiAmount @@ -54,6 +56,9 @@ import Cardano.Wallet.Api.Types.Era import Cardano.Wallet.Api.Types.WalletAssets ( ApiWalletAssets ) +import Cardano.Wallet.Primitive.Types + ( WalletId + ) import Cardano.Wallet.Primitive.Types.Pool ( PoolId ) @@ -165,6 +170,8 @@ data ApiErrorInfo !ApiErrorNoSuchPool | NoSuchTransaction | NoSuchWallet + !ApiErrorNoSuchWallet + | WalletNotInitialized | NoUtxosAvailable | NodeNotYetInRecentEra !ApiErrorNodeNotYetInRecentEra @@ -329,3 +336,10 @@ data ApiErrorNoSuchPool = ApiErrorNoSuchPool deriving (Data, Eq, Generic, Show, Typeable) deriving (FromJSON, ToJSON) via DefaultRecord ApiErrorNoSuchPool deriving anyclass NFData + +data ApiErrorNoSuchWallet = ApiErrorNoSuchWallet + { walletId :: !(ApiT WalletId) + } + deriving (Data, Eq, Generic, Show, Typeable) + deriving (FromJSON, ToJSON) via DefaultRecord ApiErrorNoSuchWallet + deriving anyclass NFData diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Addresses.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Addresses.hs index 3106b4e66d0..7241886aa9c 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Addresses.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Addresses.hs @@ -34,6 +34,10 @@ import Cardano.Wallet.Api.Types , ApiT (..) , WalletStyle (..) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId (..) ) @@ -63,6 +67,7 @@ import Test.Integration.Framework.DSL ( Context , Headers (..) , Payload (..) + , decodeErrorInfo , emptyIcarusWallet , emptyIcarusWalletMws , emptyRandomWallet @@ -84,13 +89,11 @@ import Test.Integration.Framework.DSL , randomAddresses , request , verify - , walletId ) import Test.Integration.Framework.TestData ( errMsg403CouldntIdentifyAddrAsMine , errMsg403NotAByronWallet , errMsg403WrongPass - , errMsg404NoWallet ) import Web.HttpApiData ( ToHttpApiData (..) @@ -98,6 +101,7 @@ import Web.HttpApiData import qualified Cardano.Wallet.Api.Link as Link import qualified Network.HTTP.Types.Status as HTTP +import qualified Test.Hspec.Expectations.Lifted as Lifted spec :: forall n @@ -190,8 +194,9 @@ scenario_ADDRESS_LIST_04 fixture = it title $ \ctx -> runResourceT $ do r <- request @[ApiAddressWithPath n] ctx (Link.listAddresses @'Byron w) Default Empty verify r [ expectResponseCode HTTP.status404 - , expectErrorMessage $ errMsg404NoWallet $ w ^. walletId ] + decodeErrorInfo r `Lifted.shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet $ w ^. #id) where title = "ADDRESS_LIST_04 - Delete wallet" diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/CoinSelections.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/CoinSelections.hs index 7dc3e6f1c33..75fc7599e58 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/CoinSelections.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/CoinSelections.hs @@ -25,6 +25,10 @@ import Cardano.Wallet.Api.Types import Cardano.Wallet.Api.Types.Amount ( ApiAmount (ApiAmount) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId ) @@ -50,6 +54,7 @@ import Test.Integration.Framework.DSL ( Context (..) , Headers (..) , Payload (..) + , decodeErrorInfo , emptyIcarusWallet , emptyRandomWallet , emptyWallet @@ -64,11 +69,9 @@ import Test.Integration.Framework.DSL , runResourceT , selectCoins , verify - , walletId ) import Test.Integration.Framework.TestData ( errMsg403NotAnIcarusWallet - , errMsg404NoWallet ) import qualified Cardano.Wallet.Api.Link as Link @@ -150,7 +153,9 @@ spec = describe "BYRON_COIN_SELECTION" $ do let minUTxOValue' = ApiAmount . minUTxOValue $ _mainEra ctx let payments = pure (AddressAmount addr minUTxOValue' mempty) _ <- request @ApiByronWallet ctx (Link.deleteWallet @'Byron icW) Default Empty - selectCoins @_ @'Byron ctx icW payments >>= flip verify + r <- selectCoins @_ @'Byron ctx icW payments + verify r [ expectResponseCode HTTP.status404 - , expectErrorMessage (errMsg404NoWallet $ icW ^. walletId) ] + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet $ icW ^. #id) diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Migrations.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Migrations.hs index 8b2ea7cd431..51d95f7447f 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Migrations.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Migrations.hs @@ -36,6 +36,10 @@ import Cardano.Wallet.Api.Types.Amount import Cardano.Wallet.Api.Types.Era ( ApiEra (..) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId (..) ) @@ -82,6 +86,7 @@ import Test.Integration.Framework.DSL ( Context (..) , Headers (..) , Payload (..) + , decodeErrorInfo , emptyIcarusWallet , emptyRandomWallet , emptyWallet @@ -109,7 +114,6 @@ import Test.Integration.Framework.DSL import Test.Integration.Framework.TestData ( errMsg403NothingToMigrate , errMsg403WrongPass - , errMsg404NoWallet ) import qualified Cardano.Faucet.Mnemonics as Mnemonics @@ -117,6 +121,7 @@ import qualified Cardano.Wallet.Api.Link as Link import qualified Cardano.Wallet.Api.Types as ApiTypes import qualified Data.Map.Strict as Map import qualified Network.HTTP.Types.Status as HTTP +import qualified Test.Hspec.Expectations.Lifted as Lifted spec :: forall n. HasSNetworkId n => SpecWith Context spec = describe "BYRON_MIGRATIONS" $ do @@ -189,9 +194,9 @@ spec = describe "BYRON_MIGRATIONS" $ do (Json [json|{addresses: #{targetAddressIds}}|]) verify response [ expectResponseCode HTTP.status404 - , expectErrorMessage - (errMsg404NoWallet $ sourceWallet ^. walletId) ] + decodeErrorInfo response `Lifted.shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet $ sourceWallet ^. #id) it "BYRON_CREATE_MIGRATION_PLAN_04 - \ \Cannot create a plan for a wallet that only contains dust." diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Transactions.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Transactions.hs index a08f9291600..5cb25b2ffa8 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Transactions.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Transactions.hs @@ -33,7 +33,8 @@ import Cardano.Wallet.Api.Types.Amount ( ApiAmount (ApiAmount) ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (UtxoTooSmall) + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) , ApiErrorTxOutputLovelaceInsufficient (ApiErrorTxOutputLovelaceInsufficient) ) import Cardano.Wallet.Api.Types.Transaction @@ -93,6 +94,7 @@ import Test.Integration.Framework.DSL , Headers (..) , Payload (..) , between + , decodeErrorInfo , emptyIcarusWallet , emptyRandomWallet , emptyWallet @@ -132,7 +134,6 @@ import Test.Integration.Framework.Request import Test.Integration.Framework.TestData ( errMsg400StartTimeLaterThanEndTime , errMsg404NoAsset - , errMsg404NoWallet , steveToken ) @@ -555,7 +556,8 @@ spec = describe "BYRON_TRANSACTIONS" $ do let endpoint = "v2/wallets/" <> wid <> "/transactions" r <- request @(ApiTransaction n) ctx ("POST", endpoint) Default payload expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet wid) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_TRANS_DELETE -\ \ Cannot delete tx on Byron wallet using shelley ep" $ \ctx -> runResourceT $ do @@ -565,7 +567,8 @@ spec = describe "BYRON_TRANSACTIONS" $ do let endpoint = "v2/wallets/" <> wid <> "/transactions/" <> txid r <- request @ApiTxId ctx ("DELETE", endpoint) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet wid) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_TRANS_ESTIMATE -\ \ Cannot estimate tx on Byron wallet using shelley ep" $ \ctx -> runResourceT $ do @@ -586,7 +589,8 @@ spec = describe "BYRON_TRANSACTIONS" $ do let endpoint = "v2/wallets/" <> wid <> "/payment-fees" r <- request @ApiFee ctx ("POST", endpoint) Default payload expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet wid) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_TX_LIST_02 -\ \ Byron endpoint does not list Shelley wallet transactions" $ \ctx -> runResourceT $ do @@ -596,8 +600,9 @@ spec = describe "BYRON_TRANSACTIONS" $ do r <- request @([ApiTransaction n]) ctx ep Default Empty verify r [ expectResponseCode HTTP.status404 - , expectErrorMessage (errMsg404NoWallet wid) ] + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_TX_LIST_03 -\ \ Shelley endpoint does not list Byron wallet transactions" $ \ctx -> runResourceT $ do @@ -607,8 +612,9 @@ spec = describe "BYRON_TRANSACTIONS" $ do r <- request @([ApiTransaction n]) ctx ep Default Empty verify r [ expectResponseCode HTTP.status404 - , expectErrorMessage (errMsg404NoWallet wid) ] + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_RESTORE_09 - Ledger wallet" $ \ctx -> runResourceT $ do -- NOTE @@ -778,7 +784,8 @@ spec = describe "BYRON_TRANSACTIONS" $ do let link = Link.listTransactions @'Byron w r <- request @([ApiTransaction n]) ctx link Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) describe "BYRON_TX_LIST_ADDRESS - Transactions can be filtered by address" $ forM_ [ (fixtureRandomWallet, emptyRandomWallet, "Byron wallet") diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Wallets.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Wallets.hs index 31fb75d6ff4..deb9b6f1992 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Wallets.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Byron/Wallets.hs @@ -28,6 +28,10 @@ import Cardano.Wallet.Api.Types import Cardano.Wallet.Api.Types.Amount ( ApiAmount (ApiAmount) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId ) @@ -75,6 +79,7 @@ import Test.Integration.Framework.DSL ( Context (..) , Headers (..) , Payload (..) + , decodeErrorInfo , emptyByronWalletFromXPrvWith , emptyByronWalletWith , emptyIcarusWallet @@ -106,7 +111,6 @@ import Test.Integration.Framework.TestData ( arabicWalletName , errMsg400NumberOfWords , errMsg403WrongPass - , errMsg404NoWallet , kanjiWalletName , polishWalletName , russianWalletName @@ -129,7 +133,8 @@ spec = describe "BYRON_WALLETS" $ do _ <- request @ApiByronWallet ctx (Link.deleteWallet @'Byron w) Default Empty rg <- request @ApiByronWallet ctx (Link.getWallet @'Byron w) Default Empty expectResponseCode HTTP.status404 rg - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) rg + decodeErrorInfo rg `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_LIST_01 - Byron Wallets are listed from oldest to newest" $ \ctx -> runResourceT $ do diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Transactions.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Transactions.hs index 6cadece9449..a260a577127 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Transactions.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Transactions.hs @@ -63,6 +63,7 @@ import Cardano.Wallet.Api.Types.Amount import Cardano.Wallet.Api.Types.Error ( ApiErrorInfo (..) , ApiErrorMissingWitnessesInTransaction (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) , ApiErrorTxOutputLovelaceInsufficient (ApiErrorTxOutputLovelaceInsufficient) ) import Cardano.Wallet.Api.Types.Transaction @@ -204,7 +205,6 @@ import Test.Integration.Framework.DSL , verify , waitForNextEpoch , waitNumberOfEpochBoundaries - , walletId , (.>) ) import Test.Integration.Framework.Request @@ -213,7 +213,6 @@ import Test.Integration.Framework.Request import Test.Integration.Framework.TestData ( errMsg400StartTimeLaterThanEndTime , errMsg404CannotFindTx - , errMsg404NoWallet ) import qualified Cardano.Address.Script as CA @@ -1609,7 +1608,8 @@ spec = describe "SHARED_TRANSACTIONS" $ do (Link.listTransactions @'Shared w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "SHARED_TRANSACTIONS_LIST_RANGE_01 - \ \Transaction at time t is SELECTED by small ranges that cover it" $ @@ -1741,7 +1741,8 @@ spec = describe "SHARED_TRANSACTIONS" $ do let link = Link.getTransaction @'Shared w (ApiTxId txid) r <- request @(ApiTransaction n) ctx link Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "SHARED_TRANSACTIONS_GET_03 - \ \Using wrong transaction id" $ diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Wallets.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Wallets.hs index c4992a769fd..8c85f1a3df7 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Wallets.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shared/Wallets.hs @@ -63,6 +63,7 @@ import Cardano.Wallet.Api.Types.Amount ) import Cardano.Wallet.Api.Types.Error ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) , ApiErrorSharedWalletNoSuchCosigner (..) ) import Cardano.Wallet.Compat @@ -175,7 +176,6 @@ import Test.Integration.Framework.TestData , errMsg403TemplateInvalidScript , errMsg403TemplateInvalidUnknownCosigner , errMsg403WrongIndex - , errMsg404NoWallet , errMsg406 ) @@ -1703,7 +1703,8 @@ spec = describe "SHARED_WALLETS" $ do r <- request @ApiUtxoStatistics ctx (Link.getUTxOsStatistics @'Shared w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) describe "SHARED_WALLETS_UTXO_04 - HTTP headers" $ do let matrix = diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Addresses.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Addresses.hs index 838f5cb6b45..ebf1340dd5c 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Addresses.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Addresses.hs @@ -38,6 +38,10 @@ import Cardano.Wallet.Api.Types import Cardano.Wallet.Api.Types.Amount ( ApiAmount (ApiAmount) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId ) @@ -85,6 +89,7 @@ import Test.Integration.Framework.DSL ( Context (..) , Headers (..) , Payload (..) + , decodeErrorInfo , emptyRandomWallet , emptyWallet , emptyWalletWith @@ -113,7 +118,6 @@ import Test.Integration.Framework.TestData , errMsg400ScriptTimelocksContradictory , errMsg400ScriptWrongCoeffcient , errMsg403WrongIndex - , errMsg404NoWallet ) import qualified Cardano.Wallet.Api.Link as Link @@ -134,7 +138,8 @@ spec = describe "SHELLEY_ADDRESSES" $ do let ep = ("GET", "v2/wallets/" <> wid <> "/addresses") r <- request @[ApiAddressWithPath n] ctx ep Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet wid) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "ADDRESS_LIST_01 - Can list known addresses on a default wallet" $ \ctx -> runResourceT $ do let g = fromIntegral $ getAddressPoolGap defaultAddressPoolGap @@ -287,7 +292,8 @@ spec = describe "SHELLEY_ADDRESSES" $ do r <- request @[ApiAddressWithPath n] ctx (Link.listAddresses @'Shelley w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "ADDRESS_LIST_05 - bech32 HRP is correct - testnet" $ \ctx -> runResourceT $ do w <- emptyWallet ctx diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/CoinSelections.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/CoinSelections.hs index deaab156844..f598d7b3eb4 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/CoinSelections.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/CoinSelections.hs @@ -39,6 +39,10 @@ import Cardano.Wallet.Api.Types import Cardano.Wallet.Api.Types.Amount ( ApiAmount (ApiAmount) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId ) @@ -90,6 +94,7 @@ import Test.Integration.Framework.DSL , Headers (..) , Payload (..) , addField + , decodeErrorInfo , derivationPathValidationErrors , emptyWallet , expectErrorMessage @@ -107,13 +112,11 @@ import Test.Integration.Framework.DSL , selectCoinsWith , verify , verifyMsg - , walletId ) import Test.Integration.Framework.TestData ( errMsg400TxMetadataStringTooLong , errMsg403OutputTokenBundleSizeExceedsLimit , errMsg403OutputTokenQuantityExceedsLimit - , errMsg404NoWallet , errMsg406 , errMsg415 ) @@ -127,6 +130,7 @@ import qualified Data.List.NonEmpty as NE import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Network.HTTP.Types as HTTP +import qualified Test.Hspec.Expectations.Lifted as Lifted spec :: forall n @@ -220,12 +224,12 @@ spec = describe "SHELLEY_COIN_SELECTION" $ do let minUTxOValue' = ApiAmount . minUTxOValue $ _mainEra ctx let payments = AddressAmount addr minUTxOValue' mempty :| [] _ <- request @ApiWallet ctx (Link.deleteWallet @'Shelley w) Default Empty - selectCoins @_ @'Shelley ctx w payments - >>= flip - verify - [ expectResponseCode HTTP.status404 - , expectErrorMessage (errMsg404NoWallet $ w ^. walletId) - ] + rTx <- selectCoins @_ @'Shelley ctx w payments + verify rTx + [ expectResponseCode HTTP.status404 + ] + decodeErrorInfo rTx `Lifted.shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "WALLETS_COIN_SELECTION_03 - \ diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Migrations.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Migrations.hs index ea41470f7f0..dd15e6fd615 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Migrations.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Migrations.hs @@ -38,6 +38,10 @@ import Cardano.Wallet.Api.Types.Amount import Cardano.Wallet.Api.Types.Era ( ApiEra (..) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Faucet ( Faucet (..) ) @@ -99,6 +103,7 @@ import Test.Integration.Framework.DSL ( Context (..) , Headers (..) , Payload (..) + , decodeErrorInfo , emptyIcarusWallet , emptyRandomWallet , emptyWallet @@ -131,7 +136,6 @@ import Test.Integration.Framework.DSL import Test.Integration.Framework.TestData ( errMsg403NothingToMigrate , errMsg403WrongPass - , errMsg404NoWallet ) import Text.Pretty.Simple ( pShowNoColor @@ -243,12 +247,12 @@ spec = describe "SHELLEY_MIGRATIONS" $ do ep Default (Json [json|{addresses: #{targetAddressIds}}|]) - verify - result + verify result [ expectResponseCode HTTP.status404 - , expectErrorMessage - (errMsg404NoWallet $ sourceWallet ^. walletId) ] + decodeErrorInfo result `shouldBe` + NoSuchWallet + (ApiErrorNoSuchWallet (sourceWallet ^. #id)) Hspec.it "SHELLEY_CREATE_MIGRATION_PLAN_04 - \ diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/StakePools.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/StakePools.hs index 895e45281b2..2e3496f7ac8 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/StakePools.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/StakePools.hs @@ -57,6 +57,7 @@ import Cardano.Wallet.Api.Types.Era import Cardano.Wallet.Api.Types.Error ( ApiErrorInfo (..) , ApiErrorNoSuchPool (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) ) import Cardano.Wallet.Faucet ( Faucet (..) @@ -214,7 +215,6 @@ import Test.Integration.Framework.DSL , waitForTxImmutability , waitForTxStatus , waitNumberOfEpochBoundaries - , walletId , (.<) , (.>) , (.>=) @@ -222,7 +222,6 @@ import Test.Integration.Framework.DSL import Test.Integration.Framework.TestData ( errMsg403PoolAlreadyJoined , errMsg403WrongPass - , errMsg404NoWallet ) import qualified Cardano.Wallet.Api.Link as Link @@ -264,7 +263,6 @@ spec = describe "SHELLEY_STAKE_POOLS" $ do it "STAKE_POOLS_JOIN_01 - Cannot join non-existent wallet" $ \ctx -> runResourceT $ do w <- emptyWallet ctx - let wid = w ^. walletId _ <- request @ApiWallet ctx @@ -274,7 +272,8 @@ spec = describe "SHELLEY_STAKE_POOLS" $ do let poolIdAbsent = PoolId $ BS.pack $ replicate 32 1 r <- joinStakePool @n ctx (SpecificPool poolIdAbsent) (w, fixturePassphrase) expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet wid) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "STAKE_POOLS_JOIN_01 - Cannot join non-existent stakepool" $ \ctx -> runResourceT $ do w <- fixtureWallet ctx diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Transactions.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Transactions.hs index 43cb977edd0..6223289c84f 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Transactions.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Transactions.hs @@ -56,6 +56,7 @@ import Cardano.Wallet.Api.Types.Era ) import Cardano.Wallet.Api.Types.Error ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) , ApiErrorTxOutputLovelaceInsufficient (ApiErrorTxOutputLovelaceInsufficient) ) import Cardano.Wallet.Api.Types.SchemaMetadata @@ -223,7 +224,6 @@ import Test.Integration.Framework.TestData , errMsg403WrongPass , errMsg404CannotFindTx , errMsg404NoAsset - , errMsg404NoWallet , steveToken , txMetadata_ADP_1005 ) @@ -848,7 +848,8 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do Default payload expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) describe "TRANS_CREATE_08 - Bad payload" $ do let matrix = @@ -1710,7 +1711,8 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do Default payload expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "TRANS_LIST_01 - Can list Incoming and Outgoing transactions" $ \ctx -> runResourceT $ do @@ -2202,7 +2204,8 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "TRANS_LIST_RANGE_01 - \ @@ -2380,7 +2383,8 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do let link = Link.getTransaction @'Shelley w (ApiTxId txid) r <- request @(ApiTransaction n) ctx link Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "TRANS_GET_03 - Using wrong transaction id" $ \ctx -> runResourceT $ do (wSrc, wDest) <- (,) <$> fixtureWallet ctx <*> emptyWallet ctx diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs index f5b5f69ba98..8cf7c7b3116 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs @@ -115,6 +115,7 @@ import Cardano.Wallet.Api.Types.Error ( ApiErrorInfo (..) , ApiErrorMissingWitnessesInTransaction (..) , ApiErrorNoSuchPool (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) , ApiErrorTxOutputLovelaceInsufficient (ApiErrorTxOutputLovelaceInsufficient) , ApiErrorUnsupportedEra (..) ) @@ -332,9 +333,6 @@ import Test.Integration.Framework.DSL , (.<) , (.>) ) -import Test.Integration.Framework.TestData - ( errMsg404NoWallet - ) import UnliftIO.Exception ( fromEither ) @@ -2810,8 +2808,9 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do verify submittedTx [ expectResponseCode HTTP.status404 - , expectErrorMessage (errMsg404NoWallet wid) ] + decodeErrorInfo submittedTx `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (wb ^. #id)) it "TRANS_NEW_SUBMIT_03 - Can submit transaction encoded in base16" $ \ctx -> runResourceT $ do wa <- fixtureWallet ctx diff --git a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Wallets.hs b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Wallets.hs index 9c68a179aa0..5dfccf321fa 100644 --- a/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Wallets.hs +++ b/lib/integration/scenarios/Test/Integration/Scenario/API/Shelley/Wallets.hs @@ -49,6 +49,10 @@ import Cardano.Wallet.Api.Types import Cardano.Wallet.Api.Types.Amount ( ApiAmount (ApiAmount) ) +import Cardano.Wallet.Api.Types.Error + ( ApiErrorInfo (..) + , ApiErrorNoSuchWallet (ApiErrorNoSuchWallet) + ) import Cardano.Wallet.Network.RestorationMode ( RestorationMode (..) ) @@ -135,6 +139,7 @@ import Test.Integration.Framework.DSL , Headers (..) , Payload (..) , counterexample + , decodeErrorInfo , emptyByronWalletWith , emptyRandomWallet , emptyWallet @@ -734,7 +739,8 @@ spec = describe "SHELLEY_WALLETS" $ do rg <- request @ApiWallet ctx (Link.getWallet @'Shelley w) Default Empty expectResponseCode HTTP.status404 rg - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) rg + decodeErrorInfo rg `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "WALLETS_LIST_01 - Created a wallet can be listed" $ \ctx -> runResourceT $ do m18 <- Mnemonics.generateSome Mnemonics.M18 @@ -894,7 +900,8 @@ spec = describe "SHELLEY_WALLETS" $ do let newName = updateNamePayload "new name" ru <- request @ApiWallet ctx ("PUT", endpoint) Default newName expectResponseCode HTTP.status404 ru - expectErrorMessage (errMsg404NoWallet wid) ru + decodeErrorInfo ru `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) describe "WALLETS_UPDATE_04 - HTTP headers" $ do let matrix = @@ -1078,7 +1085,8 @@ spec = describe "SHELLEY_WALLETS" $ do let updEndp = delEndp ("passphrase" :: Text) rup <- request @ApiWallet ctx ("PUT", updEndp) Default payload expectResponseCode HTTP.status404 rup - expectErrorMessage (errMsg404NoWallet walId) rup + decodeErrorInfo rup `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "WALLETS_UPDATE_PASS_04 - Deleted wallet is not available, mnemonic" $ \ctx -> runResourceT $ do @@ -1090,7 +1098,8 @@ spec = describe "SHELLEY_WALLETS" $ do let updEndp = delEndp ("passphrase" :: Text) rup <- request @ApiWallet ctx ("PUT", updEndp) Default payload expectResponseCode HTTP.status404 rup - expectErrorMessage (errMsg404NoWallet walId) rup + decodeErrorInfo rup `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) describe "WALLETS_UPDATE_PASS_05,06 - Transaction after updating passphrase" $ do @@ -1279,7 +1288,8 @@ spec = describe "SHELLEY_WALLETS" $ do r <- request @ApiUtxoStatistics ctx (Link.getUTxOsStatistics @'Shelley w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) describe "WALLETS_UTXO_04 - HTTP headers" $ do let matrix = @@ -1378,8 +1388,9 @@ spec = describe "SHELLEY_WALLETS" $ do verify r [ expectResponseCode HTTP.status404 - , expectErrorMessage (errMsg404NoWallet $ w ^. walletId) ] + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "WALLETS_SIGNATURES_01 - can verify signature" $ \ctx -> runResourceT $ do let mnemonic = unsafeMnemonic @15 @@ -1479,6 +1490,8 @@ spec = describe "SHELLEY_WALLETS" $ do (Headers [(HTTP.hAccept, "*/*"), (HTTP.hContentType, "application/json")]) (Json payload) + -- TODO: ADP-3306 + -- Use `expectErrorInfo` instead of `expectErrorMessage` here: verify r [ expectResponseCode HTTP.status404 , expectErrorMessage (errMsg404NoWallet $ w ^. walletId) @@ -1494,7 +1507,8 @@ spec = describe "SHELLEY_WALLETS" $ do ("statistics/utxos" :: Text) r <- request @ApiUtxoStatistics ctx ("GET", endpoint) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet wid) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_WALLETS_UPDATE_PASS -\ \ Cannot update Byron wal with shelley ep (404)" $ \ctx -> runResourceT $ do @@ -1507,7 +1521,8 @@ spec = describe "SHELLEY_WALLETS" $ do ("passphrase" :: Text) rup <- request @ApiWallet ctx ("PUT", endpoint) Default payload expectResponseCode HTTP.status404 rup - expectErrorMessage (errMsg404NoWallet wid) rup + decodeErrorInfo rup `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_WALLETS_UPDATE -\ \ Cannot update Byron wal with shelley ep (404)" $ \ctx -> runResourceT $ do @@ -1517,21 +1532,24 @@ spec = describe "SHELLEY_WALLETS" $ do let newName = updateNamePayload "new name" ru <- request @ApiWallet ctx ("PUT", endpoint) Default newName expectResponseCode HTTP.status404 ru - expectErrorMessage (errMsg404NoWallet wid) ru + decodeErrorInfo ru `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_WALLETS_GET_02 - Byron ep does not show Shelley wallet" $ \ctx -> runResourceT $ do w <- emptyWallet ctx r <- request @ApiByronWallet ctx (Link.getWallet @'Byron w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_WALLETS_GET_03 - Shelley ep does not show Byron wallet" $ \ctx -> runResourceT $ do w <- emptyRandomWallet ctx r <- request @ApiWallet ctx (Link.getWallet @'Shelley w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_WALLETS_LIST_02,03 - \ \Byron wallets listed only via Byron endpoints + \ @@ -1622,13 +1640,15 @@ spec = describe "SHELLEY_WALLETS" $ do w <- emptyWallet ctx r <- request @ApiByronWallet ctx (Link.deleteWallet @'Byron w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "BYRON_WALLETS_DELETE_03 - Shelley ep does not delete Byron wallet" $ \ctx -> runResourceT $ do w <- emptyRandomWallet ctx r <- request @ApiByronWallet ctx (Link.deleteWallet @'Shelley w) Default Empty expectResponseCode HTTP.status404 r - expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r + decodeErrorInfo r `shouldBe` + NoSuchWallet (ApiErrorNoSuchWallet (w ^. #id)) it "WALLETS_NETWORK_SHELLEY - Wallet has the same tip as network/information" $ \ctx -> runResourceT $ do let getNetworkInfo = request @ApiNetworkInformation ctx diff --git a/lib/unit/test/data/Cardano/Wallet/Api/ApiError.json b/lib/unit/test/data/Cardano/Wallet/Api/ApiError.json index a5e935649d6..8d4ee31a464 100644 --- a/lib/unit/test/data/Cardano/Wallet/Api/ApiError.json +++ b/lib/unit/test/data/Cardano/Wallet/Api/ApiError.json @@ -1,939 +1,45 @@ { "samples": [ { - "code": "unsupported_media_type", - "message": "\u0015팟􄸁E􎈳\u0006 o\u001eꞍ" - }, - { - "code": "transaction_already_balanced", - "message": "󱀇\\cX\u001a'𦃦oR\u0016=􉱨􁚸𩉸" - }, - { - "code": "balance_tx_underestimated_fee", - "info": { - "candidate_tx_hex": "", - "candidate_tx_readable": "(", - "estimated_number_of_bootstrap_key_wits": 0, - "estimated_number_of_key_wits": 2, - "underestimation": { - "quantity": 19770424347101868, - "unit": "lovelace" - } - }, - "message": "T𤢸sM\u001ba󵵩I" - }, - { - "code": "rejected_by_core_node", - "message": "t>Vc\u0004" - }, - { - "code": "created_wrong_policy_script_template", - "message": "S𫥋`" - }, - { - "code": "not_implemented", - "message": "H󻻡6]" - }, - { - "code": "validity_interval_not_inside_script_timelock", - "message": "\u000e&/`#\u001cIP\u0011䳓w" - }, - { - "code": "transaction_already_in_ledger", - "message": "s\u001f\r\u0001_𤭘T)l𰛞𤌿􎭉^;" - }, - { - "code": "non_null_rewards", - "message": "f\\p_쩧J" - }, - { - "code": "past_horizon", - "message": "b\u0002\\=Nl8Y" - }, - { - "code": "shared_wallet_incomplete", - "message": "stA\u000eJ[{幬" - }, - { - "code": "input_resolution_conflicts", - "message": "􃄕𬕲du5" - }, - { - "code": "shared_wallet_script_template_invalid", - "message": "eH\u0014\u0016􅄲㛼\t𬉕E;" - }, - { - "code": "unexpected_error", - "message": "𧚔𪊯􀈔-}􀲕D" - }, - { - "code": "balance_tx_existing_total_collateral", - "message": "3𤘘7t|a" - }, - { - "code": "utxo_too_small", - "info": { - "tx_output_index": 1, - "tx_output_lovelace_required_minimum": { - "quantity": 0, - "unit": "lovelace" - }, - "tx_output_lovelace_specified": { - "quantity": 19932530910944474, - "unit": "lovelace" - } - }, - "message": "󼠎팚" + "code": "balance_tx_existing_return_collateral", + "message": "9󲜨𰋆\u001b\u000by쨤v\u001b󳝾" }, { "code": "input_resolution_conflicts", - "message": ",N\u0003~\u001a󹝭􆔚s݁H􀂮6A0" - }, - { - "code": "hardened_derivation_required", - "message": "󶘥\u0001𖽝i\u000e9" - }, - { - "code": "query_param_missing", - "message": "GqgK𑤡𱅁" - }, - { - "code": "network_query_failed", - "message": "𰭼􎨆" - }, - { - "code": "shared_wallet_no_such_cosigner", - "info": { - "cosigner_index": 6, - "credential_type": "delegation" - }, - "message": "4 k󿝭L]4:𥊐ﵱa" - }, - { - "code": "asset_not_present", - "message": "g`v𪜕OO2L蒞g" - }, - { - "code": "redeemer_target_not_found", - "message": "㬩6]l\u001b>󱠝" - }, - { - "code": "malformed_tx_payload", - "message": "n" - }, - { - "code": "output_token_bundle_size_exceeds_limit", - "message": "\\d􉽜" - }, - { - "code": "shared_wallet_cannot_update_key", - "message": "[⾣<ꎆ4paf\u0013Uq𐓋|" - }, - { - "code": "wrong_mnemonic", - "message": "\u001fi8𤇁⋥-]􌇂󳃰" - }, - { - "code": "insufficient_collateral", - "message": "`\u0005v𒇺𝘼m4V{" - }, - { - "code": "missing_reward_account", - "message": "P&.\u001d]𤖬y`o𨙨'V$" - }, - { - "code": "unsupported_media_type", - "message": "\u0017\u0007󴊇󹎦" - }, - { - "code": "no_such_wallet", - "message": "c]ࠓ*𓁽𱖿\u001e⛥%v]\u0001" - }, - { - "code": "insufficient_collateral", - "message": "𗯥n\u000c" - }, - { - "code": "existing_key_witnesses", - "message": "앆󿍭\u0007" - }, - { - "code": "cannot_cover_fee", - "message": "Y秂" - }, - { - "code": "redeemer_target_not_found", - "message": "\u0011鯧2\u001fy)(s+" - }, - { - "code": "shared_wallet_incomplete", - "message": "e\u0013K􋉫x8\u000c>\u0010TS\u0003" - }, - { - "code": "node_not_yet_in_recent_era", - "info": { - "node_era": "byron", - "supported_recent_eras": [ - "alonzo", - "babbage" - ] - }, - "message": "𧰏@qs𬤻DL\u0017􆊛'" - }, - { - "code": "withdrawal_not_possible_without_vote", - "message": "􆺮-\u000b𧥬v~j󴂙}6<\u0003l" - }, - { - "code": "output_token_quantity_exceeds_limit", - "message": "먆𛊊?bi(𩟹󶂟𞴈" - }, - { - "code": "balance_tx_internal_error", - "message": "\u0003;xX􉶄" - }, - { - "code": "asset_not_present", - "message": "" + "message": "𨈃鸍𧾒􄧛5ml" }, { "code": "missing_reward_account", - "message": "\u000c\u0015\u0008u" - }, - { - "code": "cannot_cover_fee", - "message": "􆹕$m\u0010KA󰁸]a" - }, - { - "code": "query_param_missing", - "message": "IM*𮙸􋀁>\u001bn<\u001eYG" - }, - { - "code": "not_synced", - "message": "􊼺;" - }, - { - "code": "wallet_metadata_not_found", - "message": "$8:})󷶿_9􀄫\u0007}9B" - }, - { - "code": "soft_derivation_required", - "message": "\u0001x󷗏Oi\u0012h󼼎]" - }, - { - "code": "created_multidelegation_transaction", - "message": "\\\rk_JzT" - }, - { - "code": "node_not_yet_in_recent_era", - "info": { - "node_era": "allegra", - "supported_recent_eras": [ - "byron", - "alonzo", - "babbage" - ] - }, - "message": "0" - }, - { - "code": "no_such_wallet", - "message": "󱹯𘄂cq󳊹D" - }, - { - "code": "past_horizon", - "message": "𫗙󴰵󿂷\u0007z~i" - }, - { - "code": "malformed_tx_payload", - "message": "GᎵ0ZC𐚻$4\"a\u0012" - }, - { - "code": "rejected_by_core_node", - "message": "\u0016*􁠥n]\u0005*\u0006rpM" - }, - { - "code": "unable_to_determine_current_epoch", - "message": "\u000fF\t\u0008\u0014􃼐o󺐕|)A^" - }, - { - "code": "network_query_failed", - "message": "*D" - }, - { - "code": "not_delegating_to", - "message": "0X􁂸𥕝!+^E\t\n" - }, - { - "code": "min_withdrawal_wrong", - "message": " \\Ay\u0011\u0014" - }, - { - "code": "redeemer_script_failure", - "message": "𢃲" - }, - { - "code": "method_not_allowed", - "message": "wO%\u001f\u0014\u00010󵡖VA" - }, - { - "code": "voting_in_invalid_era", - "message": "􅵯I)󳩂󻤁𧎥j3Z𮀣󱔰W" - }, - { - "code": "wallet_already_exists", - "message": "\u001e\u00073=\u001f4󽊼𐅯\n\"𨗁" - }, - { - "code": "cannot_cover_fee", - "message": "⻙" - }, - { - "code": "node_not_yet_in_recent_era", - "info": { - "node_era": "byron", - "supported_recent_eras": [ - "byron", - "mary", - "babbage" - ] - }, - "message": "\u0010􋔫'`\u0006t󹁺𰡅|pB" - }, - { - "code": "pool_already_joined_same_vote", - "message": ";\u0018𮃁hy" - }, - { - "code": "same_vote", - "message": "\nd󾇢Y𦌕\u0013D𒒒骲k" - }, - { - "code": "address_already_exists", - "message": "/vY␟\u0007" - }, - { - "code": "already_withdrawing", - "message": "/I􎁂OE0󲅵A$\u001di\u0019f" - }, - { - "code": "block_header_not_found", - "message": "=" - }, - { - "code": "no_root_key", - "message": "SpS辪\u001f\u0019 " - }, - { - "code": "unable_to_determine_current_epoch", - "message": "\u0013\u0005,𬳭𱑪$ai" - }, - { - "code": "existing_key_witnesses", - "message": "7󳛇@\u000e@\"\u0006썞" - }, - { - "code": "insufficient_collateral", - "message": "<𭗂\u001f7\u0013𮰥" - }, - { - "code": "balance_tx_existing_total_collateral", - "message": ":𬩺\u0002V9淺~T𢷁t\u001f\u0010\u0019" - }, - { - "code": "insufficient_collateral", - "message": "i*a󲆒K*\u001aG𤜊𫼘[𦛢x" - }, - { - "code": "unexpected_error", - "message": "G盼\u0019🥧Si\u0001𡣕" - }, - { - "code": "redeemer_target_not_found", - "message": "0ettXv󸗵\u001f𢏞X𢡐{" - }, - { - "code": "translation_byron_tx_out_in_context", - "message": "\u0007" - }, - { - "code": "invalid_wallet_type", - "message": "􏻯\u0008(Fo􁖼#95" - }, - { - "code": "tx_not_in_node_era", - "message": "\u001b痰\u001cず𭼱𞲜\"" - }, - { - "code": "node_not_yet_in_recent_era", - "info": { - "node_era": "babbage", - "supported_recent_eras": [ - "shelley", - "allegra", - "babbage" - ] - }, - "message": ":\u0016􇑲m" - }, - { - "code": "shared_wallet_incomplete", - "message": "|y=}\u000cb󸺖󵿤鼔A\u0008" - }, - { - "code": "block_header_not_found", - "message": "\"~" - }, - { - "code": "shared_wallet_incomplete", - "message": "z\u000f󱳦:Z𧈶謰48􂆕悯" - }, - { - "code": "output_token_quantity_exceeds_limit", - "message": "𤐍&V'f" - }, - { - "code": "created_multidelegation_transaction", - "message": " zb+󲨁\u0005󹈞􌔖󴝰" - }, - { - "code": "balance_tx_existing_key_witnesses", - "message": ">M 𪷮:\u0013\u001bJX`\u001d􉖯" - }, - { - "code": "block_header_not_found", - "message": "Ae|X+\"i|Z6" - }, - { - "code": "not_synced", - "message": "Xp*" - }, - { - "code": "mempool_is_full", - "message": "\r\u0010r*!D\r$[B􇢓󵝖" - }, - { - "code": "no_utxos_available", - "message": "\u0018􍬜\n􄫏W" - }, - { - "code": "unsupported_media_type", - "message": "K]" - }, - { - "code": "unresolved_inputs", - "message": "{,3" - }, - { - "code": "no_such_pool", - "info": { - "pool_id": "2a291332313210231022320c3333233c10051a393017323c082d3e0f" - }, - "message": "\u001c\u0014\u001a󸫻Q\u0000\u0014m[2}k𰷕􇗻" - }, - { - "code": "query_param_missing", - "message": "V5\"󹁨\u000cz𥜾Yw)􃫖" - }, - { - "code": "not_implemented", - "message": "" - }, - { - "code": "hardened_derivation_required", - "message": "xﮎ" - }, - { - "code": "cannot_cover_fee", - "message": "~k[a\u0011" - }, - { - "code": "unsupported_media_type", - "message": "5X" - }, - { - "code": "wallet_not_responding", - "message": "􇤐_gb3t\u0005`" - }, - { - "code": "shared_wallet_no_such_cosigner", - "info": { - "cosigner_index": 5, - "credential_type": "payment" - }, - "message": "]7" - }, - { - "code": "withdrawal_not_beneficial", - "message": "t\u0017𫂡𩂗H\u0006d\u0006𢧑a'iP󳥑" - }, - { - "code": "no_such_wallet", - "message": "\u001c\u0011" - }, - { - "code": "pool_already_joined_same_vote", - "message": "\u0000􉅉d\u0013e" - }, - { - "code": "mempool_is_full", - "message": "{A𬭖\u0008\u0017y􎝺" - }, - { - "code": "created_multiaccount_transaction", - "message": ">L毌q𣊺S󳥪藯𤡽b" - }, - { - "code": "key_not_found_for_address", - "message": "􄿘2$C)c𝛤\u000e𡠤\u0012\u001d\u0004󾳃" - }, - { - "code": "redeemer_script_failure", - "message": "" - }, - { - "code": "created_invalid_transaction", - "message": "􂰲;p~kWn" - }, - { - "code": "mempool_is_full", - "message": "􃩂*Asz" - }, - { - "code": "network_unreachable", - "message": "{J" - }, - { - "code": "query_param_missing", - "message": "3Z5" - }, - { - "code": "not_delegating_to", - "message": "h" - }, - { - "code": "shared_wallet_cannot_update_key", - "message": "揱\u000f􎅾ᬈ" - }, - { - "code": "translation_error", - "message": "sEB%𫛷駏'" - }, - { - "code": "rejected_by_core_node", - "message": "" - }, - { - "code": "not_synced", - "message": "CZ\u0016g#9\u0002𛄠`I" - }, - { - "code": "redeemer_target_not_found", - "message": "\u0010F~YQj􆩋󹵄𝁟\u0005\u001d" - }, - { - "code": "balance_tx_existing_total_collateral", - "message": "m󻙞3/\t" - }, - { - "code": "not_found", - "message": "%HP\u0002yz󴥸\t𣨝𩴗)\"E\u001c" - }, - { - "code": "network_unreachable", - "message": "𝨃\\\u0019X党=l(㷊" - }, - { - "code": "utxo_too_small", - "info": { - "tx_output_index": 0, - "tx_output_lovelace_required_minimum": { - "quantity": 20663996575782212, - "unit": "lovelace" - }, - "tx_output_lovelace_specified": { - "quantity": 32782666421279309, - "unit": "lovelace" - } - }, - "message": "`6<" - }, - { - "code": "voting_in_invalid_era", - "message": "\u0001^흌\u0012/\u0004🁷K|􈍍" - }, - { - "code": "translation_error", - "message": "\u0005,󱈨\u0003.m=𫜍!D%>᪫" - }, - { - "code": "shared_wallet_no_such_cosigner", - "info": { - "cosigner_index": 3, - "credential_type": "delegation" - }, - "message": "%7𧱗􍩙𠃃t06|𔓂I}𭏙" - }, - { - "code": "created_invalid_transaction", - "message": "\rx" - }, - { - "code": "created_multidelegation_transaction", - "message": "v4r𠞭}8𡹆>\u0000*R1Yv" - }, - { - "code": "created_multidelegation_transaction", - "message": "5𧗔}W{󸨆𮧱S_􅚎" - }, - { - "code": "output_token_quantity_exceeds_limit", - "message": "􁮞&x(𢾽􂘎𮸆㤂" - }, - { - "code": "shared_wallet_key_already_exists", - "message": "!]􍨵M'󷴒\u0014" - }, - { - "code": "asset_not_present", - "message": "\u000bs\u0017#S\u000c9J\u000b\u001d_􉳪" + "message": "!2𨊚=" }, { "code": "invalid_coin_selection", - "message": "𥰢ka.􋍣nhI𩭧o􎈌鉶" - }, - { - "code": "balance_tx_internal_error", - "message": "􀰙wk\u001c" - }, - { - "code": "min_withdrawal_wrong", - "message": "r`<\u0010邌k^x/AꂯCI" - }, - { - "code": "hardened_derivation_required", - "message": "\u0017DA􀃲󼠃\u0000" - }, - { - "code": "balance_tx_conflicting_networks", - "message": "/}􍸅𧴿𛰼v" - }, - { - "code": "not_synced", - "message": "%э*檆\u0013_𥼠\u0006\u0014𖽈银K\u001fꐒ" - }, - { - "code": "missing_reward_account", - "message": " D𗭍=\u000fk\u0015f䔯m6oKW" - }, - { - "code": "missing_policy_public_key", - "message": "'s􀸱\tIU\u001fuA" - }, - { - "code": "no_utxos_available", - "message": "햧,𭚗" - }, - { - "code": "not_synced", - "message": "@\u0008𣤼#𩹥/\u0016蓯" - }, - { - "code": "not_implemented", - "message": "󷥉Tx\u0006bIyi鞈0􍘄󹛵󼅊Syl㟬󿐩\u0002󱴎6" - }, - { - "code": "wallet_metadata_not_found", - "message": "\u0012p􇜷󰈁" - }, - { - "code": "delegation_invalid", - "message": ":b𝗀iJW\u0013z󴌆bW铹㸆" - }, - { - "code": "not_found", - "message": "\u0006\u0006G|" - }, - { - "code": "transaction_already_balanced", - "message": "c\u0005 뮁𗯴\t\u000eg^\u001eg$\u00135" - }, - { - "code": "validity_interval_not_inside_script_timelock", - "message": "U𓉆{𱁇\u0005" - }, - { - "code": "unable_to_assign_input_output", - "message": "&]:\u0012p0VD" - }, - { - "code": "created_multidelegation_transaction", - "message": "dm!H" - }, - { - "code": "redeemer_target_not_found", - "message": "\u000eH}`4C!󿣚r\\𗪖𓅡t􁁋" - }, - { - "code": "inputs_depleted", - "message": "wL`𣵯\u0014K\u0008YT\u0015" - }, - { - "code": "translation_byron_tx_out_in_context", - "message": "&" - }, - { - "code": "not_synced", - "message": "$C" + "code": "network_misconfigured", + "message": "x\u0000" }, { "code": "delegation_invalid", - "message": "􌳷nv," + "message": "䎇\u0013O躰\u0019!^6U6ꪸ\u001d\u0008䡴" }, { - "code": "node_not_yet_in_recent_era", - "info": { - "node_era": "allegra", - "supported_recent_eras": [ - "allegra", - "mary" - ] - }, - "message": "8𣦡{YO+\\\u0006K" - }, - { - "code": "balance_tx_existing_return_collateral", - "message": "`D" - }, - { - "code": "redeemer_invalid_data", - "message": "Y" - }, - { - "code": "hardened_derivation_required", - "message": "" - }, - { - "code": "translation_error", - "message": "+􈙙𠠵s\u0001襴0.y" - }, - { - "code": "start_time_later_than_end_time", - "message": "" - }, - { - "code": "created_multidelegation_transaction", - "message": "*\n𰄢| p{s􌸹𲈷" - }, - { - "code": "created_multiaccount_transaction", - "message": "krベ\u0014𩝤~𦲐^\u0003􏷏" - }, - { - "code": "missing_reward_account", - "message": "褔[n}G?M\u0002𱎾5" - }, - { - "code": "no_utxos_available", - "message": "'𮶂#𓂨 " - }, - { - "code": "missing_witnesses_in_transaction", - "info": { - "detected_number_of_key_wits": 7, - "expected_number_of_key_wits": 2 - }, - "message": "\u0006`1Gd" - }, - { - "code": "created_wrong_policy_script_template", - "message": "VnPNES􄳟b\u0004%󳉢/" - }, - { - "code": "query_param_missing", - "message": "𘎶𐾺M" - }, - { - "code": "balance_tx_conflicting_networks", - "message": "o󾌞\t27\u0002짛𢯛" - }, - { - "code": "balance_tx_inline_plutus_v3_script_not_supported_in_babbage", - "message": "\t𤋬󽒶Kc}\u0019𭸤\"𩱍􋛟h" - }, - { - "code": "missing_policy_public_key", - "message": "\u0005\u001eN^+ILZ" - }, - { - "code": "node_not_yet_in_recent_era", - "info": { - "node_era": "alonzo", - "supported_recent_eras": [] - }, - "message": "|𤽸0n" - }, - { - "code": "not_enough_money", - "info": { - "shortfall": { - "ada": { - "quantity": 29203954436170393, - "unit": "lovelace" - }, - "assets": [ - { - "asset_name": "0001010101000001000000010000010100010000000101000000010001000100", - "policy_id": "00010101010101010001010001010101010101000101010000010001", - "quantity": 1 - }, - { - "asset_name": "0100000000010000010101010000010101000101010000000001000101000000", - "policy_id": "00000100010000000101000101000001000100010001000001010001", - "quantity": 1 - }, - { - "asset_name": "0001000001000000010101010100010000000001010100000101000001010100", - "policy_id": "00010100000100010001000101000001010100010100000000000000", - "quantity": 0 - }, - { - "asset_name": "0001010001010000000000000101010101010101000100010101010001010000", - "policy_id": "01010100000000000001000100010101000000010101000000010101", - "quantity": 1 - } - ] - } - }, - "message": "\u0019o\u001ex:鲙" - }, - { - "code": "created_multidelegation_transaction", - "message": "𠝥\u0011[" - }, - { - "code": "not_acceptable", - "message": "\\\u0019\u001cz" - }, - { - "code": "unable_to_determine_current_epoch", - "message": "𛊐8" - }, - { - "code": "output_token_bundle_size_exceeds_limit", - "message": "D\u0008I" - }, - { - "code": "created_wrong_policy_script_template", - "message": "𩰲􆹒犔􏵏%J􈮽\u0004g𦜢/" - }, - { - "code": "redeemer_invalid_data", - "message": "v4󶔙" + "code": "missing_reward_account", + "message": "󸺝󰘵V|" } ], - "seed": -36971223 + "seed": 76464662 } \ No newline at end of file diff --git a/lib/unit/test/data/Cardano/Wallet/Api/ApiErrorNoSuchWallet.json b/lib/unit/test/data/Cardano/Wallet/Api/ApiErrorNoSuchWallet.json new file mode 100644 index 00000000000..a8571baada5 --- /dev/null +++ b/lib/unit/test/data/Cardano/Wallet/Api/ApiErrorNoSuchWallet.json @@ -0,0 +1,35 @@ +{ + "samples": [ + { + "wallet_id": "6524d51c49d87740db3a3c2e62d82267b543a6cf" + }, + { + "wallet_id": "a987b59400280be6b47b1b13ea5e386062a67e81" + }, + { + "wallet_id": "c1793e140462743013585c89bd6cf6a69d7f59b3" + }, + { + "wallet_id": "946b649eef71f01477178fcb069ab403d048b8a3" + }, + { + "wallet_id": "5debea5568c412cf9293f0c67977f874ca7f5aca" + }, + { + "wallet_id": "d0bbaac33e0a4fbf14c5db9654809c4fefb70e0b" + }, + { + "wallet_id": "53348b8491a6fdce3936c8a9bfcbcec0f29869af" + }, + { + "wallet_id": "a4c90e0ad19156a347082bd7b21d6ba730b532fe" + }, + { + "wallet_id": "ace2e09835abf46b70213c2f60bf142c774ebdbe" + }, + { + "wallet_id": "556a4cd62a3dda336ab5d2582f8e0fa16a1fc853" + } + ], + "seed": 1466306521 +} \ No newline at end of file diff --git a/lib/unit/test/unit/Cardano/Wallet/Api/TypesSpec.hs b/lib/unit/test/unit/Cardano/Wallet/Api/TypesSpec.hs index 943943f76d1..630613ad296 100644 --- a/lib/unit/test/unit/Cardano/Wallet/Api/TypesSpec.hs +++ b/lib/unit/test/unit/Cardano/Wallet/Api/TypesSpec.hs @@ -280,6 +280,7 @@ import Cardano.Wallet.Api.Types.Error , ApiErrorMessage (..) , ApiErrorMissingWitnessesInTransaction (..) , ApiErrorNoSuchPool (..) + , ApiErrorNoSuchWallet (..) , ApiErrorNodeNotYetInRecentEra (..) , ApiErrorNotEnoughMoney (..) , ApiErrorNotEnoughMoneyShortfall (..) @@ -810,6 +811,7 @@ spec = do jsonTest @ApiErrorTxOutputLovelaceInsufficient jsonTest @ApiErrorBalanceTxUnderestimatedFee jsonTest @ApiErrorNoSuchPool + jsonTest @ApiErrorNoSuchWallet jsonTest @ApiErrorNodeNotYetInRecentEra jsonTest @ApiErrorNotEnoughMoney jsonTest @ApiFee @@ -2474,6 +2476,10 @@ instance Arbitrary ApiErrorNoSuchPool where arbitrary = genericArbitrary shrink = genericShrink +instance Arbitrary ApiErrorNoSuchWallet where + arbitrary = genericArbitrary + shrink = genericShrink + instance Arbitrary ApiErrorMissingWitnessesInTransaction where arbitrary = genericArbitrary shrink = genericShrink diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs index f77af0999ef..b46eafd16c8 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs @@ -1,5 +1,6 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE DuplicateRecordFields #-} @@ -263,7 +264,8 @@ import Data.ByteString ( ByteString ) import Data.Data - ( Proxy (..) + ( Data + , Proxy (..) ) import Data.Generics.Labels () @@ -387,7 +389,7 @@ walletNameMaxLength :: Int walletNameMaxLength = 255 newtype WalletId = WalletId { getWalletId :: Digest Blake2b_160 } - deriving (Generic, Eq, Ord, Show) + deriving (Data, Generic, Eq, Ord, Show) instance NFData WalletId diff --git a/specifications/api/swagger.yaml b/specifications/api/swagger.yaml index 6ea600a5455..5ced3e3e51c 100644 --- a/specifications/api/swagger.yaml +++ b/specifications/api/swagger.yaml @@ -4361,6 +4361,18 @@ x-errNoUtxosAvailable: &errNoUtxosAvailable type: string enum: ['no_utxos_available'] +x-errWalletNotInitialized: &errWalletNotInitialized + <<: *responsesErr + title: wallet_not_initialized + properties: + message: + type: string + description: | + May occur when the database for the requested wallet is not initialized. + code: + type: string + enum: ['wallet_not_initialized'] + x-errNoSuchWallet: &errNoSuchWallet <<: *responsesErr title: no_such_wallet @@ -4373,6 +4385,12 @@ x-errNoSuchWallet: &errNoSuchWallet code: type: string enum: ['no_such_wallet'] + info: + type: object + required: + - wallet_id + properties: + wallet_id: *walletId x-errNoSuchTransaction: &errNoSuchTransaction <<: *responsesErr @@ -5647,6 +5665,13 @@ x-responsesErr404WalletNotFound: &responsesErr404WalletNotFound application/json: schema: *errNoSuchWallet +x-responsesErr404WalletNotInitialized: &responsesErr404WalletNotInitialized + 404: + description: Wallet not yet initialized + content: + application/json: + schema: *errWalletNotInitialized + x-responsesErr503WalletMetadataNotFound: &responsesErr503WalletMetadataNotFound 503: description: No meta @@ -5726,6 +5751,7 @@ x-responsesListByronWallets: &responsesListByronWallets x-responsesGetUTxOsStatistics: &responsesGetUTxOsStatistics <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 200: description: Ok @@ -5735,6 +5761,7 @@ x-responsesGetUTxOsStatistics: &responsesGetUTxOsStatistics x-responsesGetWalletUtxoSnapshot: &responsesGetWalletUtxoSnapshot <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 200: description: Ok @@ -5792,6 +5819,7 @@ x-responsesPostByronWallet: &responsesPostByronWallet x-responsesGetWallet: &responsesGetWallet <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 200: description: Ok @@ -5811,6 +5839,7 @@ x-responsesGetByronWallet: &responsesGetByronWallet x-responsesGetSharedWallet: &responsesGetSharedWallet <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 200: description: Ok @@ -5821,6 +5850,7 @@ x-responsesGetSharedWallet: &responsesGetSharedWallet x-responsesPatchSharedWallet: &responsesPatchSharedWallet <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr503WalletMetadataNotFound 403: @@ -5847,6 +5877,7 @@ x-responsesCreateWalletMigrationPlan: &responsesCreateWalletMigrationPlan application/json: schema: *errNothingToMigrate <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 202: description: Accepted @@ -5865,6 +5896,7 @@ x-responsesMigrateWallet: &responsesMigrateWallet - <<: *errNoRootKey - <<: *errWrongEncryptionPassphrase <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: @@ -5879,6 +5911,7 @@ x-responsesMigrateWallet: &responsesMigrateWallet x-responsesDeleteWallet: &responsesDeleteWallet <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 204: description: No Content @@ -5895,6 +5928,7 @@ x-responsesForceResyncWallet: &responsesForceResyncWallet x-responsesPutWallet: &responsesPutWallet <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 200: @@ -5906,6 +5940,7 @@ x-responsesPutWallet: &responsesPutWallet x-responsesPutSharedWallet: &responsesPutSharedWallet <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 200: @@ -5926,6 +5961,7 @@ x-responsesPutWalletPassphrase: &responsesPutWalletPassphrase - <<: *errWrongEncryptionPassphrase - <<: *errWrongMnemonic <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 204: @@ -5950,6 +5986,7 @@ x-responsesSelectCoins: &responsesSelectCoins - <<: *errOutputTokenQuantityExceedsLimit - <<: *errOutputTokenBundleSizeExceedsLimit <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 200: @@ -5971,6 +6008,7 @@ x-responsesDeleteTransaction: &responsesDeleteTransaction schema: oneOf: - <<: *errNoSuchWallet + - <<: *errWalletNotInitialized - <<: *errNoSuchTransaction <<: *responsesErr406 204: @@ -5986,6 +6024,7 @@ x-responsesListTransactions: &responsesListTransactions - <<: *errMinWithdrawalWrong - <<: *errStartTimeLaterThanEndTime <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 200: description: Ok @@ -6008,6 +6047,7 @@ x-responsesGetTransaction: &responsesGetTransaction schema: oneOf: - <<: *errNoSuchWallet + - <<: *errWalletNotInitialized - <<: *errNoSuchTransaction <<: *responsesErr406 200: @@ -6037,6 +6077,7 @@ x-responsesPostTransaction: &responsesPostTransaction - <<: *errWrongEncryptionPassphrase - <<: *errUnsupportedEra <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType <<: *responsesErr425MempoolIsFull @@ -6080,6 +6121,7 @@ x-responsesConstructTransaction: &responsesConstructTransaction - <<: *errVotingInInvalidEra - <<: *errWithdrawalNotPossibleWithoutVote <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: @@ -6099,6 +6141,7 @@ x-responsesSignTransaction: &responsesSignTransaction - <<: *errNoRootKey - <<: *errWrongEncryptionPassphrase <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: @@ -6110,6 +6153,7 @@ x-responsesSignTransaction: &responsesSignTransaction x-responsesDecodedTransaction: &responsesDecodedTransaction <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: @@ -6121,6 +6165,7 @@ x-responsesDecodedTransaction: &responsesDecodedTransaction x-responsesSubmitTransaction: &responsesSubmitTransaction <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: @@ -6186,6 +6231,7 @@ x-responsesPostTransactionFee: &responsesPostTransactionFee - <<: *errOutputTokenBundleSizeExceedsLimit - <<: *errTransactionIsTooBig <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: @@ -6201,6 +6247,7 @@ x-responsesGetDelegationFee: &responsesGetDelegationFee application/json: schema: *errCannotCoverFee <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 200: description: Ok @@ -6211,6 +6258,7 @@ x-responsesGetDelegationFee: &responsesGetDelegationFee x-responsesListAddresses: &responsesListAddresses <<: *responsesErr400 <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 200: description: Ok @@ -6383,6 +6431,7 @@ x-responsesJoinStakePool: &responsesJoinStakePool schema: oneOf: - <<: *errNoSuchWallet + - <<: *errWalletNotInitialized - <<: *errNoSuchPool <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType @@ -6407,6 +6456,7 @@ x-responsesQuitStakePool: &responsesQuitStakePool - <<: *errNotDelegatingTo - <<: *errNonNullRewards <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: @@ -6545,6 +6595,7 @@ x-responsesBalanceTransaction: &responsesBalanceTransaction - <<: *errTranslationByronTxOutInContext <<: *responsesErr404WalletNotFound + <<: *responsesErr404WalletNotInitialized <<: *responsesErr406 <<: *responsesErr415UnsupportedMediaType 202: