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 16, 2019
1 parent 06cd335 commit 3249615
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 @@ -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)
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 @@ -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
Expand Down Expand Up @@ -724,6 +723,7 @@ compatibilityApiServer rndCtx seqCtx =
:<|> getByronWallet rndCtx
:<|> getByronWalletMigrationInfo rndCtx
:<|> listByronWallets rndCtx
:<|> listByronTransactions rndCtx
:<|> migrateByronWallet rndCtx seqCtx
:<|> postByronWallet rndCtx

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

- name: Miscellaneous
Expand Down Expand Up @@ -1248,6 +1249,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 3249615

Please sign in to comment.