Skip to content

Commit

Permalink
treat policyXPub in more conservative way
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Apr 15, 2022
1 parent 5f54412 commit 646d2cb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/core/src/Cardano/Wallet/Api/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2300,10 +2300,10 @@ constructTransaction ctx genChange knownPools getPoolStatus (ApiT wid) body = do

(utxoAvailable, wallet, pendingTxs) <-
liftHandler $ W.readWalletUTxOIndex @_ @s @k wrk wid
(policyXPub, _) <-
liftHandler $ W.readPolicyPublicKey @_ @s @k @n wrk wid
txCtx' <-
(txCtx', policyXPubM) <-
if isJust mintingBurning' then do
(policyXPub, _) <-
liftHandler $ W.readPolicyPublicKey @_ @s @k @n wrk wid
let isMinting (ApiMintBurnData _ _ (ApiMint _)) = True
isMinting _ = False
let getMinting = \case
Expand Down Expand Up @@ -2344,12 +2344,13 @@ constructTransaction ctx genChange knownPools getPoolStatus (ApiT wid) body = do
map getBurning $
filter (not . isMinting) $
NE.toList $ fromJust mintingBurning'
pure $ txCtx
{ txAssetsToMint = mintingData
, txAssetsToBurn = burningData
}
pure ( txCtx
{ txAssetsToMint = mintingData
, txAssetsToBurn = burningData
}
, Just policyXPub)
else
pure txCtx
pure (txCtx, Nothing)

let runSelection outs =
W.selectAssets @_ @_ @s @k wrk pp selectAssetsParams transform
Expand Down Expand Up @@ -2383,7 +2384,7 @@ constructTransaction ctx genChange knownPools getPoolStatus (ApiT wid) body = do
let mintingOuts = case mintingBurning' of
Just mintBurns ->
coalesceTokensPerAddr $
map (toMintTxOut policyXPub) $
map (toMintTxOut (fromJust policyXPubM)) $
filter mintWithAddress $
NE.toList mintBurns
Nothing -> []
Expand Down

0 comments on commit 646d2cb

Please sign in to comment.