From 32496157dee463d477cf062bf7ab178557710cd7 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Wed, 16 Oct 2019 14:48:32 +0200 Subject: [PATCH] add 'listByronTransactions' endpoint to the API --- lib/core/src/Cardano/Wallet/Api.hs | 10 ++++++++++ lib/core/src/Cardano/Wallet/Api/Server.hs | 16 +++++++++++++++- specifications/api/swagger.yaml | 12 ++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lib/core/src/Cardano/Wallet/Api.hs b/lib/core/src/Cardano/Wallet/Api.hs index e2e92be7f84..5c5234be7a6 100644 --- a/lib/core/src/Cardano/Wallet/Api.hs +++ b/lib/core/src/Cardano/Wallet/Api.hs @@ -124,6 +124,7 @@ type CompatibilityApi t = :<|> GetByronWallet :<|> GetByronWalletMigrationInfo :<|> ListByronWallets + :<|> ListByronTransactions t :<|> MigrateByronWallet t :<|> PostByronWallet @@ -299,6 +300,15 @@ type GetByronWalletMigrationInfo = "byron-wallets" type ListByronWallets = "byron-wallets" :> Get '[JSON] [ApiByronWallet] +-- | https://input-output-hk.github.io/cardano-wallet/api/#operation/listByronTransactions +type ListByronTransactions t = "byron-wallets" + :> Capture "walletId" (ApiT WalletId) + :> "transactions" + :> QueryParam "start" Iso8601Time + :> QueryParam "end" Iso8601Time + :> QueryParam "order" (ApiT SortOrder) + :> Get '[JSON] [ApiTransaction t] + -- | https://input-output-hk.github.io/cardano-wallet/api/#operation/migrateByronWallet type MigrateByronWallet t = "byron-wallets" :> Capture "sourceWalletId" (ApiT WalletId) diff --git a/lib/core/src/Cardano/Wallet/Api/Server.hs b/lib/core/src/Cardano/Wallet/Api/Server.hs index 222379e2db0..0bdf55c1ec1 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -609,7 +609,6 @@ postExternalTransaction ctx (PostExternalTransactionData load) = do listTransactions :: forall ctx s t k. ( DefineTx t - , s ~ SeqState t , ctx ~ ApiLayer s t k ) => ctx @@ -724,6 +723,7 @@ compatibilityApiServer rndCtx seqCtx = :<|> getByronWallet rndCtx :<|> getByronWalletMigrationInfo rndCtx :<|> listByronWallets rndCtx + :<|> listByronTransactions rndCtx :<|> migrateByronWallet rndCtx seqCtx :<|> postByronWallet rndCtx @@ -800,6 +800,20 @@ postByronWallet ctx body = do rootXPrv = Rnd.generateKeyFromSeed mnemonicSentence passphrase wid = WalletId $ digest $ publicKey rootXPrv +listByronTransactions + :: forall ctx s t k. + ( DefineTx t + , ctx ~ ApiLayer s t k + ) + => ctx + -> ApiT WalletId + -> Maybe Iso8601Time + -> Maybe Iso8601Time + -> Maybe (ApiT SortOrder) + -> Handler [ApiTransaction t] +listByronTransactions = + listTransactions + {------------------------------------------------------------------------------- Helpers -------------------------------------------------------------------------------} diff --git a/specifications/api/swagger.yaml b/specifications/api/swagger.yaml index 0679481472c..9e27b23b03c 100644 --- a/specifications/api/swagger.yaml +++ b/specifications/api/swagger.yaml @@ -961,6 +961,7 @@ x-tagGroups: - name: Byron (Random) tags: - Byron Wallets + - Byron Transactions - Byron Migrations - name: Miscellaneous @@ -1248,6 +1249,17 @@ paths: - *parametersWalletId responses: *responsesDeleteWallet + /byron-wallets/{walletId}/transactions: + get: + operationId: listByronTransactions + tags: ["Byron Transactions"] + summary: List + description: | +

status: under testing

+ + List all incoming and outgoing wallet's transactions. + responses: *responsesListTransactions + /byron-wallets/{walletId}/migrations: get: operationId: getByronWalletMigrationInfo