Skip to content

Commit

Permalink
Use public Cardano.Write.Tx in Server
Browse files Browse the repository at this point in the history
  • Loading branch information
HeinrichApfelmus committed Oct 18, 2024
1 parent 10ebb5f commit cd6c03d
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -802,13 +802,6 @@ import Fmt
import GHC.Generics
( Generic
)
import Internal.Cardano.Write.Tx.Balance
( PartialTx (..)
, Redeemer (..)
)
import Internal.Cardano.Write.Tx.Sign
( TimelockKeyWitnessCounts
)
import Network.Ntp
( NtpClient
, getNtpStatus
Expand Down Expand Up @@ -887,6 +880,12 @@ import qualified Cardano.Write.Eras as Write
, RecentEra
, cardanoEraFromRecentEra
)
import qualified Cardano.Write.Tx as Write
( PartialTx (..)
, Redeemer (..)
, StakeKeyDepositLookup (..)
, TimelockKeyWitnessCounts (..)
)
import qualified Control.Concurrent.Concierge as Concierge
import qualified Data.ByteArray as BA
import qualified Data.ByteString as BS
Expand All @@ -908,10 +907,8 @@ import qualified Internal.Cardano.Write.Tx as Write
, toCardanoApiTx
, utxoFromTxOutsInRecentEra
)
import qualified Internal.Cardano.Write.Tx.Balance as Write
import qualified Internal.Cardano.Write.Tx.Sign as Write
( TimelockKeyWitnessCounts (..)
, estimateMinWitnessRequiredPerInput
( estimateMinWitnessRequiredPerInput
)
import qualified Network.Ntp as Ntp

Expand Down Expand Up @@ -2759,7 +2756,7 @@ constructTransaction api knownPools poolStatus apiWalletId body = do
wrk
pp
timeTranslation
PartialTx
Write.PartialTx
{ tx = Write.fromCardanoApiTx $ Cardano.Tx unbalancedTx []
, extraUTxO = mempty
, redeemers = mempty
Expand Down Expand Up @@ -3184,7 +3181,7 @@ constructSharedTransaction
wrk
pp
timeTranslation
PartialTx
Write.PartialTx
{ tx = Write.fromCardanoApiTx
$ Cardano.Tx unbalancedTx []
, extraUTxO = mempty
Expand Down Expand Up @@ -3401,7 +3398,7 @@ balanceTransaction ctx (ApiT wid) body = do
(fromApiRedeemer <$> body ^. #redeemers)
(Write.StakeKeyDepositMap mempty)
-- Stake key deposits will be queried by W.balanceTx
(mempty :: TimelockKeyWitnessCounts)
(mempty :: Write.TimelockKeyWitnessCounts)
Left e -> liftHandler $ throwE e

decodeTransaction
Expand Down Expand Up @@ -4880,14 +4877,14 @@ fromExternalInput ApiExternalInput
in
(inp, out)

fromApiRedeemer :: ApiRedeemer n -> Redeemer
fromApiRedeemer :: ApiRedeemer n -> Write.Redeemer
fromApiRedeemer = \case
ApiRedeemerSpending (ApiBytesT bytes) (ApiT i) ->
RedeemerSpending bytes (toLedger i)
Write.RedeemerSpending bytes (toLedger i)
ApiRedeemerMinting (ApiBytesT bytes) (ApiT p) ->
RedeemerMinting bytes (toLedger p)
Write.RedeemerMinting bytes (toLedger p)
ApiRedeemerRewarding (ApiBytesT bytes) (StakeAddress x y) ->
RedeemerRewarding bytes (Ledger.RewardAccount x y)
Write.RedeemerRewarding bytes (Ledger.RewardAccount x y)

sealWriteTx :: forall era. Write.IsRecentEra era => Write.Tx era -> W.SealedTx
sealWriteTx = W.sealedTxFromCardano
Expand Down

0 comments on commit cd6c03d

Please sign in to comment.