Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and 'implement' "listByronTransactions" to the API #844

Merged
merged 1 commit into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
Expand Down Expand Up @@ -751,6 +750,7 @@ compatibilityApiServer rndCtx seqCtx =
:<|> getByronWallet rndCtx
:<|> getByronWalletMigrationInfo rndCtx
:<|> listByronWallets rndCtx
:<|> listByronTransactions rndCtx
:<|> migrateByronWallet rndCtx seqCtx
:<|> postByronWallet rndCtx

Expand Down Expand Up @@ -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
-------------------------------------------------------------------------------}
Expand Down
94 changes: 60 additions & 34 deletions specifications/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,46 @@ x-parametersJoinStakePool: &parametersJoinStakePool
x-parametersQuitStakePool: &parametersQuitStakePool
<<: *parametersJoinStakePool

x-parametersStartDate: &parametersStartDate
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: &parametersEndDate
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: &parametersSortOrder
in: query
name: order
type: string
enum:
- ascending
- descending
default: descending
description: An optional sort order.


#############################################################################
# #
Expand Down Expand Up @@ -992,6 +1032,7 @@ x-tagGroups:
- name: Byron (Random)
tags:
- Byron Wallets
- Byron Transactions
- Byron Migrations

- name: Miscellaneous
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -1293,6 +1303,22 @@ 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 transactions for the given wallet.
parameters:
- *parametersWalletId
- *parametersStartDate
- *parametersEndDate
- *parametersSortOrder
responses: *responsesListTransactions

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