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

Move estimateTxSize etc to separate module #4036

Merged
merged 3 commits into from
Jul 14, 2023
Merged
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
1 change: 1 addition & 0 deletions lib/wallet/cardano-wallet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ library
Cardano.Wallet.Write.Tx.Balance
Cardano.Wallet.Write.Tx.Gen
Cardano.Wallet.Write.Tx.Redeemers
Cardano.Wallet.Write.Tx.SizeEstimation
Cardano.Wallet.Write.Tx.TimeTranslation
Cardano.Wallet.Write.UTxOAssumptions
Control.Concurrent.Concierge
Expand Down
13 changes: 8 additions & 5 deletions lib/wallet/src/Cardano/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,6 @@ import Cardano.Wallet.Shelley.Compatibility
)
import Cardano.Wallet.Shelley.Compatibility.Ledger
( toWallet )
import Cardano.Wallet.Shelley.Transaction
( getFeePerByteFromWalletPParams, _txRewardWithdrawalCost )
import Cardano.Wallet.Transaction
( DelegationAction (..)
, ErrCannotJoin (..)
Expand Down Expand Up @@ -532,6 +530,8 @@ import Cardano.Wallet.Write.Tx.Balance
, balanceTransaction
, constructUTxOIndex
)
import Cardano.Wallet.Write.Tx.SizeEstimation
( getFeePerByteFromWalletPParams, _txRewardWithdrawalCost )
import Cardano.Wallet.Write.Tx.TimeTranslation
( TimeTranslation )
import Control.Arrow
Expand Down Expand Up @@ -664,6 +664,7 @@ import qualified Cardano.Wallet.Primitive.Types.UTxOStatistics as UTxOStatistics
import qualified Cardano.Wallet.Read as Read
import qualified Cardano.Wallet.Write.ProtocolParameters as Write
import qualified Cardano.Wallet.Write.Tx as Write
import qualified Cardano.Wallet.Write.Tx.SizeEstimation as Write
import qualified Data.ByteArray as BA
import qualified Data.Delta.Update as Delta
import qualified Data.Foldable as F
Expand Down Expand Up @@ -1026,7 +1027,7 @@ getWalletUtxoSnapshot ctx = do
computeMinAdaQuantity :: TxOut -> Coin
computeMinAdaQuantity (TxOut addr bundle) =
view #txOutputMinimumAdaQuantity
(constraints tl pp)
(Write.txConstraints pp (transactionWitnessTag tl))
(addr)
(view #tokens bundle)

Expand Down Expand Up @@ -1852,8 +1853,10 @@ calcMinimumCoinValues
-> TxOut
-> Coin
calcMinimumCoinValues pp txLayer =
uncurry (constraints txLayer pp ^. #txOutputMinimumAdaQuantity)
uncurry (constraints ^. #txOutputMinimumAdaQuantity)
. (\o -> (o ^. #address, o ^. #tokens . #tokens))
where
constraints = Write.txConstraints pp $ transactionWitnessTag txLayer

signTransaction
:: forall k ktype
Expand Down Expand Up @@ -2697,7 +2700,7 @@ createMigrationPlan
createMigrationPlan ctx rewardWithdrawal = do
(wallet, _, pending) <- readWallet ctx
pp <- currentProtocolParameters nl
let txConstraints = constraints tl pp
let txConstraints = Write.txConstraints pp (transactionWitnessTag tl)
let utxo = availableUTxO pending wallet
pure
$ Migration.createPlan txConstraints utxo
Expand Down
Loading