-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Everything builds! Need to sorrt out getScriptIntegrityHash
- Loading branch information
Showing
16 changed files
with
1,213 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/Script.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE KindSignatures #-} | ||
{-# LANGUAGE StandaloneDeriving #-} | ||
|
||
module Cardano.Api.Internal.Experimental.Plutus.Script | ||
( PlutusScriptInEra (..) | ||
, PlutusScriptOrReferenceInput (..) | ||
) | ||
where | ||
|
||
import Cardano.Api.Internal.TxIn (TxIn) | ||
|
||
import Cardano.Ledger.Plutus.Language (PlutusRunnable) | ||
import Cardano.Ledger.Plutus.Language qualified as L | ||
|
||
-- | A Plutus script in a particular era. | ||
-- Why PlutusRunnable? Mainly for deserialization benefits. | ||
-- The deserialization of this type looks at the | ||
-- major protocol version and the script language to determine if | ||
-- indeed the script is runnable. This is a dramatic improvement over the old api | ||
-- which essentially read a 'ByteString'. Any failures due to malformed/invalid scripts | ||
-- were caught upon transaction submission or running the script when attempting to | ||
-- predict the necessary execution units. | ||
-- | ||
-- Where do we get the major protocol version from? | ||
-- In order to access the major protocol version we pass in an 'era` type parameter which | ||
-- can be translated to the major protocol version. | ||
-- | ||
-- Where do we get the script language from? | ||
-- The serialized version of 'PlutusRunnable' encodes the script language. | ||
-- See `DecCBOR (PlutusRunnable l)` in cardano-ledger for more details. | ||
data PlutusScriptInEra (lang :: L.Language) era where | ||
PlutusScriptInEra | ||
:: PlutusRunnable lang -> PlutusScriptInEra lang era | ||
|
||
deriving instance Show (PlutusScriptInEra lang era) | ||
|
||
-- :: IsEra era => PlutusRunnable lang -> PlutusScriptInEra lang era | ||
|
||
-- | You can provide the plutus script directly in the transaction | ||
-- or a reference input that points to the script in the UTxO. | ||
-- Using a reference script saves space in your transaction. | ||
data PlutusScriptOrReferenceInput lang era | ||
= PScript (PlutusScriptInEra lang era) | ||
| PReferenceScript TxIn | ||
deriving Show |
Oops, something went wrong.