Skip to content

Commit d601900

Browse files
committed
Submitting txs in Babbage era
1 parent 1fc9483 commit d601900

File tree

15 files changed

+1110
-579
lines changed

15 files changed

+1110
-579
lines changed

examples/plutus-game/app/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ main = do
5454
let pabConf =
5555
PABConfig
5656
{ pcCliLocation = Local
57-
, pcNetwork = Testnet (NetworkMagic 1097911063)
57+
, pcNetwork = Testnet (NetworkMagic 9)
5858
, pcChainIndexUrl = BaseUrl Http "localhost" 9083 ""
5959
, pcPort = 9080
6060
, pcProtocolParams = protocolParams

examples/plutus-game/protocol.json

Lines changed: 354 additions & 177 deletions
Large diffs are not rendered by default.

examples/plutus-nft/app/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ main = do
5050
let pabConf =
5151
PABConfig
5252
{ pcCliLocation = Local
53-
, pcNetwork = Testnet (NetworkMagic 1097911063)
53+
, pcNetwork = Testnet (NetworkMagic 9)
5454
, pcChainIndexUrl = BaseUrl Http "localhost" 9083 ""
5555
, pcPort = 9080
5656
, pcProtocolParams = protocolParams

examples/plutus-nft/protocol.json

Lines changed: 355 additions & 178 deletions
Large diffs are not rendered by default.

examples/plutus-transfer/app/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ main = do
5353
let pabConf =
5454
PABConfig
5555
{ pcCliLocation = Local
56-
, pcNetwork = Testnet (NetworkMagic 1097911063)
56+
, pcNetwork = Testnet (NetworkMagic 9)
5757
, pcChainIndexUrl = BaseUrl Http "localhost" 9083 ""
5858
, pcPort = 9080
5959
, pcProtocolParams = protocolParams

examples/plutus-transfer/protocol.json

Lines changed: 355 additions & 178 deletions
Large diffs are not rendered by default.

src/BotPlutusInterface/CardanoCLI.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ calculateMinUtxo pabConf datums txOut =
138138
{ cmdName = "cardano-cli"
139139
, cmdArgs =
140140
mconcat
141-
[ ["transaction", "calculate-min-required-utxo", "--alonzo-era"]
141+
[ ["transaction", "calculate-min-required-utxo", "--babbage-era"]
142142
, txOutOpts pabConf datums [txOut]
143143
, ["--protocol-params-file", pabConf.pcProtocolParamsFile]
144144
]
@@ -199,7 +199,7 @@ buildTx pabConf privKeys txBudget tx = do
199199
(Map.keys (Ledger.txSignatures tx))
200200
opts ins mints =
201201
mconcat
202-
[ ["transaction", "build-raw", "--alonzo-era"]
202+
[ ["transaction", "build-raw", "--babbage-era"]
203203
, ins
204204
, txInCollateralOpts (txCollateral tx)
205205
, txOutOpts pabConf (txData tx) (txOutputs tx)

src/BotPlutusInterface/Contract.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ writeBalancedTx contractEnv cardanoTx = do
267267
-- TODO: This whole part is hacky and we should remove it.
268268
let path = Text.unpack $ Files.txFilePath pabConf "raw" (Tx.txId tx)
269269
-- We read back the tx from file as tx currently has the wrong id (but the one we create with cardano-cli is correct)
270-
alonzoBody <- firstEitherT (Text.pack . show) $ newEitherT $ readFileTextEnvelope @w (AsTxBody AsAlonzoEra) path
271-
let cardanoApiTx = Tx.SomeTx (Tx alonzoBody []) AlonzoEraInCardanoMode
270+
alonzoBody <- firstEitherT (Text.pack . show) $ newEitherT $ readFileTextEnvelope @w (AsTxBody AsBabbageEra) path
271+
let cardanoApiTx = Tx.SomeTx (Tx alonzoBody []) BabbageEraInCardanoMode
272272

273273
if signable
274274
then newEitherT $ CardanoCLI.signTx @w pabConf tx requiredSigners

src/BotPlutusInterface/ExBudget.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ estimateBudget bapConf txFile = do
5353
return txBudget
5454

5555
-- | Deserialize transaction body from ".signed" file
56-
deserialiseSigned :: FilePath -> IO (Either BudgetEstimationError (CAPI.Tx CAPI.AlonzoEra))
56+
deserialiseSigned :: FilePath -> IO (Either BudgetEstimationError (CAPI.Tx CAPI.BabbageEra))
5757
deserialiseSigned txFile = do
5858
envlp <- readEnvelope
5959
return $ envlp >>= parseTx
@@ -64,10 +64,10 @@ deserialiseSigned txFile = do
6464

6565
parseTx =
6666
left toBudgetError
67-
. CAPI.deserialiseFromTextEnvelope CAPI.AsAlonzoTx
67+
. CAPI.deserialiseFromTextEnvelope (CAPI.AsTx CAPI.AsBabbageEra)
6868

6969
-- | Deserialize transaction body from ".raw" file
70-
deserialiseRaw :: FilePath -> IO (Either BudgetEstimationError (CAPI.TxBody CAPI.AlonzoEra))
70+
deserialiseRaw :: FilePath -> IO (Either BudgetEstimationError (CAPI.TxBody CAPI.BabbageEra))
7171
deserialiseRaw txFile = do
7272
envlp <- readEnvelope
7373
return $ envlp >>= parseTx
@@ -78,7 +78,7 @@ deserialiseRaw txFile = do
7878

7979
parseTx =
8080
left toBudgetError
81-
. CAPI.deserialiseFromTextEnvelope (CAPI.AsTxBody CAPI.AsAlonzoEra)
81+
. CAPI.deserialiseFromTextEnvelope (CAPI.AsTxBody CAPI.AsBabbageEra)
8282

8383
-- | Shorthand alias
8484
type ExUnitsMap =
@@ -87,7 +87,7 @@ type ExUnitsMap =
8787
-- | Calculate execution units using `Cardano.Api``
8888
getExUnits ::
8989
NodeInfo ->
90-
CAPI.TxBody CAPI.AlonzoEra ->
90+
CAPI.TxBody CAPI.BabbageEra ->
9191
IO (Either BudgetEstimationError ExUnitsMap)
9292
getExUnits nodeInf txBody = do
9393
sysStart <- QueryNode.querySystemStart nodeInf
@@ -96,7 +96,7 @@ getExUnits nodeInf txBody = do
9696
utxo <- QueryNode.queryOutsByInputs nodeInf capiIns
9797
return $
9898
flattenEvalResult $
99-
CAPI.evaluateTransactionExecutionUnits CAPI.AlonzoEraInCardanoMode
99+
CAPI.evaluateTransactionExecutionUnits CAPI.BabbageEraInCardanoMode
100100
<$> sysStart
101101
<*> eraHist
102102
<*> pparams
@@ -117,7 +117,7 @@ getExUnits nodeInf txBody = do
117117
-}
118118
mkBudgetMaps ::
119119
ExUnitsMap ->
120-
CAPI.TxBody CAPI.AlonzoEra ->
120+
CAPI.TxBody CAPI.BabbageEra ->
121121
Either BudgetEstimationError (SpendBudgets, MintBudgets)
122122
mkBudgetMaps exUnitsMap txBody = do
123123
let (CAPI.TxBody txbc) = txBody

src/BotPlutusInterface/QueryNode.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ queryProtocolParams (connectionInfo -> cInfo) =
3434
flattenQueryResult <$> C.queryNodeLocalState cInfo Nothing query
3535
where
3636
query =
37-
C.QueryInEra C.AlonzoEraInCardanoMode $
38-
C.QueryInShelleyBasedEra C.ShelleyBasedEraAlonzo C.QueryProtocolParameters
37+
C.QueryInEra C.BabbageEraInCardanoMode $
38+
C.QueryInShelleyBasedEra C.ShelleyBasedEraBabbage C.QueryProtocolParameters
3939

4040
querySystemStart :: NodeInfo -> IO (Either NodeQueryError SystemStart)
4141
querySystemStart (connectionInfo -> cInfo) =
@@ -53,7 +53,7 @@ queryEraHistory (connectionInfo -> cInfo) =
5353
Nothing
5454
(C.QueryEraHistory C.CardanoModeIsMultiEra)
5555

56-
queryOutsByInputs :: NodeInfo -> [C.TxIn] -> IO (Either NodeQueryError (C.UTxO C.AlonzoEra))
56+
queryOutsByInputs :: NodeInfo -> [C.TxIn] -> IO (Either NodeQueryError (C.UTxO C.BabbageEra))
5757
queryOutsByInputs (connectionInfo -> cInfo) ins =
5858
flattenQueryResult
5959
<$> C.queryNodeLocalState
@@ -62,8 +62,8 @@ queryOutsByInputs (connectionInfo -> cInfo) ins =
6262
query
6363
where
6464
query =
65-
C.QueryInEra C.AlonzoEraInCardanoMode $
66-
C.QueryInShelleyBasedEra C.ShelleyBasedEraAlonzo $
65+
C.QueryInEra C.BabbageEraInCardanoMode $
66+
C.QueryInShelleyBasedEra C.ShelleyBasedEraBabbage $
6767
C.QueryUTxO (C.QueryUTxOByTxIn (Set.fromList ins))
6868

6969
flattenQueryResult ::

0 commit comments

Comments
 (0)