-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3577: Get/list shared txs r=Anviking a=paweljakubas <!-- Detail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: * Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. * Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. * Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] Updated get/list shared tx in swagger - [x] Adding plumbing in api scaffolding layer, link, reusing between shelley and shared modes - [x] adding integration tests ### Comments <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number adp-2224 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Co-authored-by: Pawel Jakubas <[email protected]>
- Loading branch information
Showing
8 changed files
with
894 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/Certificates.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
-- | | ||
-- Copyright: © 2020 IOHK | ||
-- License: Apache-2.0 | ||
-- | ||
|
||
module Cardano.Wallet.Api.Http.Server.Handlers.Certificates | ||
( getApiAnyCertificates | ||
) | ||
where | ||
|
||
import Cardano.Wallet.Api | ||
( ApiLayer ) | ||
import Cardano.Wallet.Api.Http.Server.Error | ||
( liftHandler ) | ||
import Cardano.Wallet.Api.Http.Server.Handlers.TxCBOR | ||
( ParsedTxCBOR (..) ) | ||
import Cardano.Wallet.Api.Types.Certificate | ||
( ApiAnyCertificate, mkApiAnyCertificate ) | ||
import Cardano.Wallet.Primitive.Types | ||
( WalletId ) | ||
import Cardano.Wallet.Registry | ||
( WorkerCtx ) | ||
import Data.Typeable | ||
( Typeable ) | ||
import Prelude hiding | ||
( (.) ) | ||
import Servant.Server | ||
( Handler ) | ||
|
||
import qualified Cardano.Wallet as W | ||
|
||
-- | Promote certificates of a transaction to API type, | ||
-- using additional context from the 'WorkerCtx'. | ||
getApiAnyCertificates | ||
:: forall ctx s k ktype n. | ||
( ctx ~ ApiLayer s k ktype | ||
, Typeable s | ||
, Typeable n | ||
) | ||
=> WorkerCtx ctx | ||
-> WalletId | ||
-> ParsedTxCBOR | ||
-> Handler [ApiAnyCertificate n] | ||
getApiAnyCertificates wrk wid ParsedTxCBOR{certificates} = do | ||
(acct, _, acctPath) <- | ||
liftHandler $ W.readRewardAccount @_ @s @k @n wrk wid | ||
pure $ mkApiAnyCertificate acct acctPath <$> certificates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.