Skip to content

Commit

Permalink
add 'listByronTransactions' endpoint to the API
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Oct 17, 2019
1 parent f0c2622 commit 0b01dfb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/core/src/Cardano/Wallet/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ type CompatibilityApi t =
:<|> GetByronWallet
:<|> GetByronWalletMigrationInfo
:<|> ListByronWallets
:<|> ListByronTransactions t
:<|> MigrateByronWallet t
:<|> PostByronWallet

Expand Down Expand Up @@ -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)
Expand Down
16 changes: 15 additions & 1 deletion lib/core/src/Cardano/Wallet/Api/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,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
Expand Down Expand Up @@ -752,6 +751,7 @@ compatibilityApiServer rndCtx seqCtx =
:<|> getByronWallet rndCtx
:<|> getByronWalletMigrationInfo rndCtx
:<|> listByronWallets rndCtx
:<|> listByronTransactions rndCtx
:<|> migrateByronWallet rndCtx seqCtx
:<|> postByronWallet rndCtx

Expand Down Expand Up @@ -828,6 +828,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
-------------------------------------------------------------------------------}
Expand Down
12 changes: 12 additions & 0 deletions specifications/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@ x-tagGroups:
- name: Byron (Random)
tags:
- Byron Wallets
- Byron Transactions
- Byron Migrations

- name: Miscellaneous
Expand Down Expand Up @@ -1293,6 +1294,17 @@ paths:
- *parametersWalletId
responses: *responsesDeleteWallet

/byron-wallets/{walletId}/transactions:
get:
operationId: listByronTransactions
tags: ["Byron Transactions"]
summary: List
description: |
<p align="right">status: <strong>under testing</strong></p>
List all incoming and outgoing wallet's transactions.
responses: *responsesListTransactions

/byron-wallets/{walletId}/migrations:
get:
operationId: getByronWalletMigrationInfo
Expand Down

0 comments on commit 0b01dfb

Please sign in to comment.