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

[ADP 3491] Relax policy key guard #4850

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
35 changes: 16 additions & 19 deletions lib/api/src/Cardano/Wallet/Api/Http/Server/Handlers/MintBurn.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
-- |
-- Copyright: © 2020 IOHK
-- License: Apache-2.0
--

module Cardano.Wallet.Api.Http.Server.Handlers.MintBurn
( convertApiAssetMintBurn
, getTxApiAssetMintBurn
)
where
( convertApiAssetMintBurn
, getTxApiAssetMintBurn
)
where

import Prelude hiding
( (.)
Expand Down Expand Up @@ -44,9 +42,6 @@ import Control.Category
import Control.Monad.IO.Class
( MonadIO (liftIO)
)
import Control.Monad.Trans.Except
( runExceptT
)
import Data.Either.Extra
( eitherToMaybe
)
Expand All @@ -61,16 +56,18 @@ convertApiAssetMintBurn
-> (TokenMapWithScripts, TokenMapWithScripts)
-> Handler (ApiAssetMintBurn, ApiAssetMintBurn)
convertApiAssetMintBurn ctx (mint, burn) = do
xpubM <- fmap (fmap fst . eitherToMaybe)
<$> liftIO . runExceptT $ readPolicyPublicKey ctx
let convert tokenWithScripts = ApiAssetMintBurn
{ tokens = toApiTokens tokenWithScripts
, walletPolicyKeyHash =
uncurry ApiPolicyKey . computeKeyPayload (Just True) <$>
includePolicyKeyInfo tokenWithScripts xpubM
, walletPolicyKeyIndex =
policyIx <$ includePolicyKeyInfo tokenWithScripts xpubM
}
xpubM <-
fmap fst . eitherToMaybe
<$> liftIO (readPolicyPublicKey ctx)
let convert tokenWithScripts =
ApiAssetMintBurn
{ tokens = toApiTokens tokenWithScripts
, walletPolicyKeyHash =
uncurry ApiPolicyKey . computeKeyPayload (Just True)
<$> includePolicyKeyInfo tokenWithScripts xpubM
, walletPolicyKeyIndex =
policyIx <$ includePolicyKeyInfo tokenWithScripts xpubM
}
pure (convert mint, convert burn)

getTxApiAssetMintBurn
Expand Down
Loading
Loading