Skip to content

Commit 65eb490

Browse files
committed
wip
1 parent a8c9de1 commit 65eb490

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

cardano-api/src/Cardano/Api/Internal/Address.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,10 @@ instance IsShelleyBasedEra era => FromJSON (AddressInEra era) where
384384
addressAny <- runParsecParser parseAddressAny txt
385385
pure $ anyAddressInShelleyBasedEra sbe addressAny
386386

387-
parseAddressAny :: Parsec.Parser AddressAny
387+
parseAddressAny :: SerialiseAddress addr => Parsec.Parser addr
388388
parseAddressAny = do
389389
str <- lexPlausibleAddressString
390-
case deserialiseAddress AsAddressAny str of
390+
case deserialiseAddress (proxyToAsType Proxy) str of
391391
Nothing -> fail $ "invalid address: " <> Text.unpack str
392392
Just addr -> pure addr
393393

cardano-api/src/Cardano/Api/Internal/Eras/Case.hs

+4
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ caseShelleyToBabbageOrConwayEraOnwards l r = \case
150150
ShelleyBasedEraBabbage -> l ShelleyToBabbageEraBabbage
151151
ShelleyBasedEraConway -> r ConwayEraOnwardsConway
152152

153+
{-# DEPRECATED shelleyToAlonzoEraToShelleyToBabbageEra "Use convert instead" #-}
153154
shelleyToAlonzoEraToShelleyToBabbageEra
154155
:: ()
155156
=> ShelleyToAlonzoEra era
@@ -160,6 +161,7 @@ shelleyToAlonzoEraToShelleyToBabbageEra = \case
160161
ShelleyToAlonzoEraMary -> ShelleyToBabbageEraMary
161162
ShelleyToAlonzoEraAlonzo -> ShelleyToBabbageEraAlonzo
162163

164+
{-# DEPRECATED alonzoEraOnwardsToMaryEraOnwards "Use convert instead" #-}
163165
alonzoEraOnwardsToMaryEraOnwards
164166
:: ()
165167
=> AlonzoEraOnwards era
@@ -169,6 +171,7 @@ alonzoEraOnwardsToMaryEraOnwards = \case
169171
AlonzoEraOnwardsBabbage -> MaryEraOnwardsBabbage
170172
AlonzoEraOnwardsConway -> MaryEraOnwardsConway
171173

174+
{-# DEPRECATED babbageEraOnwardsToMaryEraOnwards "Use convert instead" #-}
172175
babbageEraOnwardsToMaryEraOnwards
173176
:: ()
174177
=> BabbageEraOnwards era
@@ -177,6 +180,7 @@ babbageEraOnwardsToMaryEraOnwards = \case
177180
BabbageEraOnwardsBabbage -> MaryEraOnwardsBabbage
178181
BabbageEraOnwardsConway -> MaryEraOnwardsConway
179182

183+
{-# DEPRECATED babbageEraOnwardsToAlonzoEraOnwards "Use convert instead" #-}
180184
babbageEraOnwardsToAlonzoEraOnwards
181185
:: ()
182186
=> BabbageEraOnwards era

cardano-api/src/Cardano/Api/Internal/Fees.hs

+2
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,8 @@ makeTransactionBodyAutoBalance
15141514
-- we make no attempt to recalculate the tx fee without a change address.
15151515
accountForNoChange :: TxOut CtxTx era -> [TxOut CtxTx era] -> [TxOut CtxTx era]
15161516
accountForNoChange change@(TxOut _ balance _ _) rest =
1517+
-- TODO: shouldn't that include non-ada assets check as well?
1518+
-- TODO: write test for that
15171519
case txOutValueToLovelace balance of
15181520
L.Coin 0 -> rest
15191521
-- We append change at the end so a client can predict the indexes

cardano-api/src/Cardano/Api/Internal/Orphans.hs

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import Ouroboros.Consensus.Shelley.Eras qualified as Consensus
7070
import Ouroboros.Consensus.Shelley.Ledger.Block (ShelleyHash (..))
7171
import Ouroboros.Consensus.Shelley.Ledger.Query qualified as Consensus
7272
import Ouroboros.Network.Block (HeaderHash, Tip (..))
73+
import Ouroboros.Network.Protocol.LocalTxSubmission.Type qualified as Net.Tx
7374
import PlutusLedgerApi.Common qualified as P
7475
import PlutusLedgerApi.V2 qualified as V2
7576

@@ -352,6 +353,8 @@ instance ToJSON PraosState where
352353
, "lastEpochBlockNonce" .= Consensus.praosStateLastEpochBlockNonce s
353354
]
354355

356+
deriving instance Show a => Show (Net.Tx.SubmitResult a)
357+
355358
-- We wrap the individual records with Last and use Last's Semigroup instance.
356359
-- In this instance we take the last 'Just' value or the only 'Just' value
357360
instance Semigroup (Ledger.ShelleyPParams StrictMaybe era) where

cardano-api/src/Cardano/Api/Internal/Tx/Body.hs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2635,9 +2635,9 @@ fromBabbageTxOut w txdatums txout =
26352635
resolveDatumInTx dh
26362636
| Just d <- Map.lookup dh txdatums =
26372637
TxOutSupplementalDatum
2638-
(babbageEraOnwardsToAlonzoEraOnwards w)
2638+
(convert w)
26392639
(fromAlonzoData d)
2640-
| otherwise = TxOutDatumHash (babbageEraOnwardsToAlonzoEraOnwards w) (ScriptDataHash dh)
2640+
| otherwise = TxOutDatumHash (convert w) (ScriptDataHash dh)
26412641

26422642
fromLedgerTxTotalCollateral
26432643
:: ShelleyBasedEra era
@@ -3004,7 +3004,7 @@ convScriptData sbe txOuts scriptWitnesses =
30043004
) <-
30053005
scriptWitnesses
30063006
]
3007-
in TxBodyScriptData w datums redeemers
3007+
in TxBodyScriptData w datums redeemers -- TODO
30083008
)
30093009
sbe
30103010

@@ -3261,7 +3261,7 @@ makeShelleyTransactionBody
32613261
sbe
32623262
txbody
32633263
scripts
3264-
(TxBodyScriptData AlonzoEraOnwardsAlonzo datums redeemers)
3264+
(TxBodyScriptData AlonzoEraOnwardsAlonzo datums redeemers) -- TODO
32653265
txAuxData
32663266
txScriptValidity
32673267
where
@@ -3378,7 +3378,7 @@ makeShelleyTransactionBody
33783378
sbe
33793379
txbody
33803380
scripts
3381-
( TxBodyScriptData
3381+
( TxBodyScriptData -- TODO
33823382
AlonzoEraOnwardsBabbage
33833383
datums
33843384
redeemers
@@ -3518,7 +3518,7 @@ makeShelleyTransactionBody
35183518
sbe
35193519
txbody
35203520
scripts
3521-
( TxBodyScriptData
3521+
( TxBodyScriptData -- TODO
35223522
AlonzoEraOnwardsConway
35233523
datums
35243524
redeemers
@@ -3904,7 +3904,7 @@ collectTxBodyScriptWitnessRequirements
39043904
} =
39053905
obtainAlonzoScriptPurposeConstraints aEon $ do
39063906
let sbe = shelleyBasedEra @era
3907-
supplementaldatums = TxScriptWitnessRequirements mempty mempty (getSupplementalDatums aEon txOuts) mempty
3907+
supplementaldatums = TxScriptWitnessRequirements mempty mempty (getSupplementalDatums aEon txOuts) mempty -- TODO
39083908
txInWits <-
39093909
first TxBodyPlutusScriptDecodeError $
39103910
legacyWitnessToScriptRequirements aEon $

0 commit comments

Comments
 (0)