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 5, 2021
1 parent beba405 commit fa3fac9
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 @@ -446,7 +446,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 @@ -460,7 +460,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 @@ -470,7 +473,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 fa3fac9

Please sign in to comment.