Skip to content

Commit

Permalink
Merge pull request #479 from input-output-hk/mgalazyn/feature/add-sup…
Browse files Browse the repository at this point in the history
…port-for-plutus-v3

Add support for Plutus V3 in command line interface
  • Loading branch information
carbolymer authored Nov 24, 2023
2 parents cead75f + 1fd841d commit 66d2cf6
Show file tree
Hide file tree
Showing 21 changed files with 569 additions and 149 deletions.
13 changes: 8 additions & 5 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1406,11 +1406,14 @@ pPlutusStakeReferenceScriptWitnessFiles prefix autoBalanceExecUnits =
<*> pure Nothing

pPlutusScriptLanguage :: String -> Parser AnyScriptLanguage
pPlutusScriptLanguage prefix =
Opt.flag' (AnyScriptLanguage $ PlutusScriptLanguage PlutusScriptV2)
( Opt.long (prefix ++ "plutus-script-v2")
<> Opt.help "Specify a plutus script v2 reference script."
)
pPlutusScriptLanguage prefix = plutusP PlutusScriptV2 "v2" <|> plutusP PlutusScriptV3 "v3"
where
plutusP :: PlutusScriptVersion lang -> String -> Parser AnyScriptLanguage
plutusP plutusVersion versionString =
Opt.flag' (AnyScriptLanguage $ PlutusScriptLanguage plutusVersion)
( Opt.long (prefix <> "plutus-script-" <> versionString)
<> Opt.help ("Specify a plutus script " <> versionString <> " reference script.")
)

pUpdateProposalFile :: Parser UpdateProposalFile
pUpdateProposalFile =
Expand Down
3 changes: 3 additions & 0 deletions cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@ deserialiseScriptInAnyLang bs =

, FromSomeType (AsScript AsPlutusScriptV2)
(ScriptInAnyLang (PlutusScriptLanguage PlutusScriptV2))

, FromSomeType (AsScript AsPlutusScriptV3)
(ScriptInAnyLang (PlutusScriptLanguage PlutusScriptV3))
]

-- Tx & TxBody
Expand Down
288 changes: 216 additions & 72 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli allegra transaction build-raw
]
(--tx-in TX-IN
[ --spending-tx-in-reference TX-IN
--spending-plutus-script-v2
( --spending-plutus-script-v2
| --spending-plutus-script-v3
)
( --spending-reference-tx-in-datum-cbor-file CBOR FILE
| --spending-reference-tx-in-datum-file JSON FILE
| --spending-reference-tx-in-datum-value JSON VALUE
Expand Down Expand Up @@ -60,7 +62,9 @@ Usage: cardano-cli allegra transaction build-raw
| --simple-minting-script-tx-in-reference TX-IN
--policy-id HASH
| --mint-tx-in-reference TX-IN
--mint-plutus-script-v2
( --mint-plutus-script-v2
| --mint-plutus-script-v3
)
( --mint-reference-tx-in-redeemer-cbor-file CBOR FILE
| --mint-reference-tx-in-redeemer-file JSON FILE
| --mint-reference-tx-in-redeemer-value JSON VALUE
Expand All @@ -81,7 +85,9 @@ Usage: cardano-cli allegra transaction build-raw
)
--certificate-execution-units (INT, INT)]
| --certificate-tx-in-reference TX-IN
--certificate-plutus-script-v2
( --certificate-plutus-script-v2
| --certificate-plutus-script-v3
)
( --certificate-reference-tx-in-redeemer-cbor-file CBOR FILE
| --certificate-reference-tx-in-redeemer-file JSON FILE
| --certificate-reference-tx-in-redeemer-value JSON VALUE
Expand All @@ -97,7 +103,9 @@ Usage: cardano-cli allegra transaction build-raw
)
--withdrawal-execution-units (INT, INT)]
| --withdrawal-tx-in-reference TX-IN
--withdrawal-plutus-script-v2
( --withdrawal-plutus-script-v2
| --withdrawal-plutus-script-v3
)
( --withdrawal-reference-tx-in-redeemer-cbor-file CBOR FILE
| --withdrawal-reference-tx-in-redeemer-file JSON FILE
| --withdrawal-reference-tx-in-redeemer-value JSON VALUE
Expand Down Expand Up @@ -132,6 +140,8 @@ Available options:
input must have a plutus reference script attached.
--spending-plutus-script-v2
Specify a plutus script v2 reference script.
--spending-plutus-script-v3
Specify a plutus script v3 reference script.
--spending-reference-tx-in-datum-cbor-file CBOR FILE
The script datum, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -278,6 +288,7 @@ Available options:
TxId#TxIx - Specify a reference input. The reference
input must have a plutus reference script attached.
--mint-plutus-script-v2 Specify a plutus script v2 reference script.
--mint-plutus-script-v3 Specify a plutus script v3 reference script.
--mint-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -319,6 +330,8 @@ Available options:
input must have a plutus reference script attached.
--certificate-plutus-script-v2
Specify a plutus script v2 reference script.
--certificate-plutus-script-v3
Specify a plutus script v3 reference script.
--certificate-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -355,6 +368,8 @@ Available options:
input must have a plutus reference script attached.
--withdrawal-plutus-script-v2
Specify a plutus script v2 reference script.
--withdrawal-plutus-script-v3
Specify a plutus script v3 reference script.
--withdrawal-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Usage: cardano-cli allegra transaction build --socket-path SOCKET_PATH
[--witness-override WORD]
(--tx-in TX-IN
[ --spending-tx-in-reference TX-IN
--spending-plutus-script-v2
( --spending-plutus-script-v2
| --spending-plutus-script-v3
)
( --spending-reference-tx-in-datum-cbor-file CBOR FILE
| --spending-reference-tx-in-datum-file JSON FILE
| --spending-reference-tx-in-datum-value JSON VALUE
Expand Down Expand Up @@ -63,7 +65,9 @@ Usage: cardano-cli allegra transaction build --socket-path SOCKET_PATH
| --simple-minting-script-tx-in-reference TX-IN
--policy-id HASH
| --mint-tx-in-reference TX-IN
--mint-plutus-script-v2
( --mint-plutus-script-v2
| --mint-plutus-script-v3
)
( --mint-reference-tx-in-redeemer-cbor-file CBOR FILE
| --mint-reference-tx-in-redeemer-file JSON FILE
| --mint-reference-tx-in-redeemer-value JSON VALUE
Expand All @@ -80,7 +84,9 @@ Usage: cardano-cli allegra transaction build --socket-path SOCKET_PATH
| --certificate-redeemer-value JSON VALUE
]
| --certificate-tx-in-reference TX-IN
--certificate-plutus-script-v2
( --certificate-plutus-script-v2
| --certificate-plutus-script-v3
)
( --certificate-reference-tx-in-redeemer-cbor-file CBOR FILE
| --certificate-reference-tx-in-redeemer-file JSON FILE
| --certificate-reference-tx-in-redeemer-value JSON VALUE
Expand All @@ -93,7 +99,9 @@ Usage: cardano-cli allegra transaction build --socket-path SOCKET_PATH
| --withdrawal-redeemer-value JSON VALUE
]
| --withdrawal-tx-in-reference TX-IN
--withdrawal-plutus-script-v2
( --withdrawal-plutus-script-v2
| --withdrawal-plutus-script-v3
)
( --withdrawal-reference-tx-in-redeemer-cbor-file CBOR FILE
| --withdrawal-reference-tx-in-redeemer-file JSON FILE
| --withdrawal-reference-tx-in-redeemer-value JSON VALUE
Expand Down Expand Up @@ -143,6 +151,8 @@ Available options:
input must have a plutus reference script attached.
--spending-plutus-script-v2
Specify a plutus script v2 reference script.
--spending-plutus-script-v3
Specify a plutus script v3 reference script.
--spending-reference-tx-in-datum-cbor-file CBOR FILE
The script datum, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -284,6 +294,7 @@ Available options:
TxId#TxIx - Specify a reference input. The reference
input must have a plutus reference script attached.
--mint-plutus-script-v2 Specify a plutus script v2 reference script.
--mint-plutus-script-v3 Specify a plutus script v3 reference script.
--mint-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -320,6 +331,8 @@ Available options:
input must have a plutus reference script attached.
--certificate-plutus-script-v2
Specify a plutus script v2 reference script.
--certificate-plutus-script-v3
Specify a plutus script v3 reference script.
--certificate-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -352,6 +365,8 @@ Available options:
input must have a plutus reference script attached.
--withdrawal-plutus-script-v2
Specify a plutus script v2 reference script.
--withdrawal-plutus-script-v3
Specify a plutus script v3 reference script.
--withdrawal-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli alonzo transaction build-raw
]
(--tx-in TX-IN
[ --spending-tx-in-reference TX-IN
--spending-plutus-script-v2
( --spending-plutus-script-v2
| --spending-plutus-script-v3
)
( --spending-reference-tx-in-datum-cbor-file CBOR FILE
| --spending-reference-tx-in-datum-file JSON FILE
| --spending-reference-tx-in-datum-value JSON VALUE
Expand Down Expand Up @@ -60,7 +62,9 @@ Usage: cardano-cli alonzo transaction build-raw
| --simple-minting-script-tx-in-reference TX-IN
--policy-id HASH
| --mint-tx-in-reference TX-IN
--mint-plutus-script-v2
( --mint-plutus-script-v2
| --mint-plutus-script-v3
)
( --mint-reference-tx-in-redeemer-cbor-file CBOR FILE
| --mint-reference-tx-in-redeemer-file JSON FILE
| --mint-reference-tx-in-redeemer-value JSON VALUE
Expand All @@ -81,7 +85,9 @@ Usage: cardano-cli alonzo transaction build-raw
)
--certificate-execution-units (INT, INT)]
| --certificate-tx-in-reference TX-IN
--certificate-plutus-script-v2
( --certificate-plutus-script-v2
| --certificate-plutus-script-v3
)
( --certificate-reference-tx-in-redeemer-cbor-file CBOR FILE
| --certificate-reference-tx-in-redeemer-file JSON FILE
| --certificate-reference-tx-in-redeemer-value JSON VALUE
Expand All @@ -97,7 +103,9 @@ Usage: cardano-cli alonzo transaction build-raw
)
--withdrawal-execution-units (INT, INT)]
| --withdrawal-tx-in-reference TX-IN
--withdrawal-plutus-script-v2
( --withdrawal-plutus-script-v2
| --withdrawal-plutus-script-v3
)
( --withdrawal-reference-tx-in-redeemer-cbor-file CBOR FILE
| --withdrawal-reference-tx-in-redeemer-file JSON FILE
| --withdrawal-reference-tx-in-redeemer-value JSON VALUE
Expand Down Expand Up @@ -132,6 +140,8 @@ Available options:
input must have a plutus reference script attached.
--spending-plutus-script-v2
Specify a plutus script v2 reference script.
--spending-plutus-script-v3
Specify a plutus script v3 reference script.
--spending-reference-tx-in-datum-cbor-file CBOR FILE
The script datum, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -278,6 +288,7 @@ Available options:
TxId#TxIx - Specify a reference input. The reference
input must have a plutus reference script attached.
--mint-plutus-script-v2 Specify a plutus script v2 reference script.
--mint-plutus-script-v3 Specify a plutus script v3 reference script.
--mint-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -319,6 +330,8 @@ Available options:
input must have a plutus reference script attached.
--certificate-plutus-script-v2
Specify a plutus script v2 reference script.
--certificate-plutus-script-v3
Specify a plutus script v3 reference script.
--certificate-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down Expand Up @@ -355,6 +368,8 @@ Available options:
input must have a plutus reference script attached.
--withdrawal-plutus-script-v2
Specify a plutus script v2 reference script.
--withdrawal-plutus-script-v3
Specify a plutus script v3 reference script.
--withdrawal-reference-tx-in-redeemer-cbor-file CBOR FILE
The script redeemer, in the given JSON file. The file
must follow the special JSON schema for script data.
Expand Down
Loading

0 comments on commit 66d2cf6

Please sign in to comment.