Skip to content

Commit

Permalink
Query for stakepools in runTxBuild
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Sep 1, 2021
1 parent 736e613 commit af7257b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ runTxBuild (AnyCardanoEra era) (AnyConsensusModeParams cModeParams) networkId mS
left (ShelleyTxCmdEraConsensusModeMismatchTxBalance outBody
(AnyConsensusMode CardanoMode) (AnyCardanoEra era))

(utxo, pparams, eraHistory, systemStart) <-
(utxo, pparams, eraHistory, systemStart, stakePools) <-
newExceptT . joinEitherM ShelleyTxCmdAcquireFailure id $
executeLocalStateQueryExpr localNodeConnInfo Nothing $ \_ntcVersion -> runExceptT $ do
utxo <- firstExceptT ShelleyTxCmdTxSubmitErrorEraMismatch . newExceptT . queryExpr
Expand All @@ -450,7 +450,10 @@ runTxBuild (AnyCardanoEra era) (AnyConsensusModeParams cModeParams) networkId mS

systemStart <- lift $ queryExpr QuerySystemStart

return (utxo, pparams, eraHistory, systemStart)
stakePools <- firstExceptT ShelleyTxCmdTxSubmitErrorEraMismatch . ExceptT $
queryExpr . QueryInEra eInMode . QueryInShelleyBasedEra sbe $ QueryStakePools

return (utxo, pparams, eraHistory, systemStart, stakePools)

let cAddr = case anyAddressInEra era changeAddr of
Just addr -> addr
Expand All @@ -460,7 +463,7 @@ runTxBuild (AnyCardanoEra era) (AnyConsensusModeParams cModeParams) networkId mS
firstExceptT ShelleyTxCmdBalanceTxBody
. hoistEither
$ makeTransactionBodyAutoBalance eInMode systemStart eraHistory
pparams Set.empty utxo txBodyContent
pparams stakePools utxo txBodyContent
cAddr mOverrideWits

putStrLn $ "Estimated transaction fee: " <> (show fee :: String)
Expand Down

0 comments on commit af7257b

Please sign in to comment.