diff --git a/lib/core/src/Cardano/Wallet/Api.hs b/lib/core/src/Cardano/Wallet/Api.hs index f0cd098979d..28fd5efd603 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 @@ -307,6 +308,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 fcccc68a9df..cf10f206b68 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -632,7 +632,6 @@ deleteTransaction ctx (ApiT wid) (ApiTxId (ApiT (tid))) = do listTransactions :: forall ctx s t k. ( DefineTx t - , s ~ SeqState t , ctx ~ ApiLayer s t k ) => ctx @@ -751,6 +750,7 @@ compatibilityApiServer rndCtx seqCtx = :<|> getByronWallet rndCtx :<|> getByronWalletMigrationInfo rndCtx :<|> listByronWallets rndCtx + :<|> listByronTransactions rndCtx :<|> migrateByronWallet rndCtx seqCtx :<|> postByronWallet rndCtx @@ -827,6 +827,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 0ec21effd15..29d3387d85d 100644 --- a/specifications/api/swagger.yaml +++ b/specifications/api/swagger.yaml @@ -702,6 +702,46 @@ x-parametersJoinStakePool: ¶metersJoinStakePool x-parametersQuitStakePool: ¶metersQuitStakePool <<: *parametersJoinStakePool +x-parametersStartDate: ¶metersStartDate + in: query + name: start + type: string + format: ISO 8601 + description: | + An optional start time in ISO 8601 date-and-time format. Basic and + extended formats are both accepted. Times can be local (with a + timezone offset) or UTC. + + If both a start time and an end time are specified, then the start + time must not be later than the end time. + + Example: `2008-08-08T08:08:08Z` + +x-parametersEndDate: ¶metersEndDate + in: query + name: end + type: string + format: ISO 8601 + description: | + An optional end time in ISO 8601 date-and-time format. Basic and + extended formats are both accepted. Times can be local (with a + timezone offset) or UTC. + + If both a start time and an end time are specified, then the start + time must not be later than the end time. + + Example: `2008-08-08T08:08:08Z` + +x-parametersSortOrder: ¶metersSortOrder + in: query + name: order + type: string + enum: + - ascending + - descending + default: descending + description: An optional sort order. + ############################################################################# # # @@ -992,6 +1032,7 @@ x-tagGroups: - name: Byron (Random) tags: - Byron Wallets + - Byron Transactions - Byron Migrations - name: Miscellaneous @@ -1109,40 +1150,9 @@ paths: Lists all incoming and outgoing wallet's transactions. parameters: - *parametersWalletId - - in: query - name: start - type: string - format: ISO 8601 - description: | - An optional start time in ISO 8601 date-and-time format. Basic and - extended formats are both accepted. Times can be local (with a - timezone offset) or UTC. - - If both a start time and an end time are specified, then the start - time must not be later than the end time. - - Example: `2008-08-08T08:08:08Z` - - in: query - name: end - type: string - format: ISO 8601 - description: | - An optional end time in ISO 8601 date-and-time format. Basic and - extended formats are both accepted. Times can be local (with a - timezone offset) or UTC. - - If both a start time and an end time are specified, then the start - time must not be later than the end time. - - Example: `2008-08-08T08:08:08Z` - - in: query - name: order - type: string - enum: - - ascending - - descending - default: descending - description: An optional sort order. + - *parametersStartDate + - *parametersEndDate + - *parametersSortOrder responses: *responsesListTransactions post: @@ -1293,6 +1303,22 @@ 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 transactions for the given wallet. + parameters: + - *parametersWalletId + - *parametersStartDate + - *parametersEndDate + - *parametersSortOrder + responses: *responsesListTransactions + /byron-wallets/{walletId}/migrations: get: operationId: getByronWalletMigrationInfo