diff --git a/lib/core/src/Cardano/Wallet/Api/Server.hs b/lib/core/src/Cardano/Wallet/Api/Server.hs index 79e9777be9d..2d627384000 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -2251,21 +2251,6 @@ constructTransaction ctx genChange knownPools getPoolStatus (ApiT wid) body = do (utxoAvailable, wallet, pendingTxs) <- liftHandler $ W.readWalletUTxOIndex @_ @s @k wrk wid - let runSelection outs = - W.selectAssets @_ @_ @s @k wrk pp selectAssetsParams transform - where - selectAssetsParams = W.SelectAssetsParams - { outputs = outs - , pendingTxs - , randomSeed = Nothing - , txContext = txCtx - , utxoAvailableForInputs = - UTxOSelection.fromIndex utxoAvailable - , utxoAvailableForCollateral = - UTxOIndex.toMap utxoAvailable - , wallet - , selectionStrategy = SelectionStrategyOptimal - } txCtx' <- if isJust mintingBurning then do (policyXPub, _) <- @@ -2317,6 +2302,22 @@ constructTransaction ctx genChange knownPools getPoolStatus (ApiT wid) body = do else pure txCtx + let runSelection outs = + W.selectAssets @_ @_ @s @k wrk pp selectAssetsParams transform + where + selectAssetsParams = W.SelectAssetsParams + { outputs = outs + , pendingTxs + , randomSeed = Nothing + , txContext = txCtx' + , utxoAvailableForInputs = + UTxOSelection.fromIndex utxoAvailable + , utxoAvailableForCollateral = + UTxOIndex.toMap utxoAvailable + , wallet + , selectionStrategy = SelectionStrategyOptimal + } + (sel, sel', fee) <- do outs <- case (body ^. #payments) of Nothing -> pure [] diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs index cf151469b0b..adc3896e523 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs @@ -261,6 +261,7 @@ import qualified Data.Sequence.Strict as StrictSeq import qualified Data.Set as Set import qualified Data.Text as T +import qualified Debug.Trace as TR -- | Type encapsulating what we need to know to add things -- payloads, -- certificates -- to a transaction. @@ -1395,8 +1396,9 @@ mkTxSkeleton witness context skeleton = TxSkeleton , txInputCount = view #skeletonInputCount skeleton , txOutputs = view #skeletonOutputs skeleton , txChange = view #skeletonChange skeleton - -- Until we actually support minting and burning, leave these as empty. - , txScripts = [] + , txScripts = (<>) + (Map.elems (snd $ view #txAssetsToMint context)) + (Map.elems (snd $ view #txAssetsToBurn context)) , txAssetsToMintOrBurn = (<>) (TokenMap.getAssets (fst $ view #txAssetsToMint context)) (TokenMap.getAssets (fst $ view #txAssetsToBurn context)) @@ -1431,7 +1433,7 @@ estimateTxCost pp skeleton = -- estimateTxSize :: TxSkeleton -> TxSize estimateTxSize skeleton = - TxSize $ fromIntegral sizeOf_Transaction + TR.trace ("skeleton:"<> show skeleton) $ TxSize $ fromIntegral sizeOf_Transaction where TxSkeleton { txMetadata