Skip to content

Commit

Permalink
Use Cardano.Wallet.Write in Deposit Wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
HeinrichApfelmus committed Oct 22, 2024
1 parent 6eef21c commit 1239608
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/balance-tx/lib/main/Cardano/Write/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Cardano.Write.Tx

-- ** Balancing
, balanceTx
, TimeTranslation
, UTxOAssumptions (..)
, UTxOIndex
, constructUTxOIndex
Expand Down Expand Up @@ -64,3 +65,6 @@ import Internal.Cardano.Write.Tx.Balance
import Internal.Cardano.Write.Tx.Sign
( TimelockKeyWitnessCounts (..)
)
import Internal.Cardano.Write.Tx.TimeTranslation
( TimeTranslation
)
1 change: 1 addition & 0 deletions lib/customer-deposit-wallet/customer-deposit-wallet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ library
build-depends:
, async
, base
, cardano-balance-tx
, cardano-crypto
, cardano-ledger-api
, cardano-strict-containers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module Cardano.Wallet.Deposit.Read
, UTxO

, Read.TxId
, Read.Tx
, Read.Tx (..)
, Read.utxoFromEraTx

, Read.Block
Expand Down
29 changes: 26 additions & 3 deletions lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Write.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
--
-- TODO: Match this up with the @Write@ hierarchy.
module Cardano.Wallet.Deposit.Write
( Address
( -- * Basic types
Address

, Value

Expand All @@ -15,6 +16,24 @@ module Cardano.Wallet.Deposit.Write
, TxIn
, TxOut

-- * Transaction balancing
, Write.IsRecentEra
, Write.Conway
, L.PParams
, Write.UTxOAssumptions (..)
, Write.ChangeAddressGen (..)
, Write.StakeKeyDepositLookup (..)
, Write.TimelockKeyWitnessCounts (..)
, Write.UTxOIndex
, Write.constructUTxOIndex
, Write.UTxO
, toConwayUTxO
, Write.PartialTx (..)
, Write.ErrBalanceTx (..)
, Write.balanceTx

-- ** Time interpreter
, Write.TimeTranslation
-- * Helper functions
, mkAda
, mkTxOut
Expand Down Expand Up @@ -59,12 +78,13 @@ import Lens.Micro
import qualified Cardano.Ledger.Api as L
import qualified Cardano.Ledger.Api.Tx.In as L
import qualified Cardano.Wallet.Read as Read
import qualified Cardano.Write.Eras as Write
import qualified Cardano.Write.Tx as Write
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set

{-----------------------------------------------------------------------------
Type definitions
with dummies
Convenience TxBody
------------------------------------------------------------------------------}
type Tx = Read.Tx Read.Conway

Expand Down Expand Up @@ -113,3 +133,6 @@ toConwayTxOut :: TxOut -> L.TxOut L.Conway
toConwayTxOut txout =
case toConwayOutput txout of
Output o -> o

toConwayUTxO :: Map TxIn TxOut -> Write.UTxO L.Conway
toConwayUTxO = Write.UTxO . Map.map toConwayTxOut

0 comments on commit 1239608

Please sign in to comment.