-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to export serialised PLC programs with Cardano API en…
…velopes (#3358)
- Loading branch information
1 parent
f6a6380
commit 3bc9731
Showing
9 changed files
with
65 additions
and
8 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
nix/pkgs/haskell/materialized-unix/.plan.nix/plutus-ledger.nix
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
|
||
{-| | ||
This module re-exports the module 'Plutus.V1.Ledger.Scripts', but with | ||
additionnal functionality. | ||
This module contains orphan instances of 'Cardano.Api.HasTextEnvelope', since | ||
the Cardano Node CLI expects serialised binary values to be wrapped with a | ||
'Cardano.Api.TextEnvelope'. | ||
-} | ||
module Ledger.Scripts ( | ||
module Export | ||
) where | ||
|
||
import Cardano.Api (AsType, HasTextEnvelope (textEnvelopeType), HasTypeProxy (proxyToAsType), | ||
SerialiseAsCBOR, TextEnvelopeType (TextEnvelopeType)) | ||
import Cardano.Binary (FromCBOR (fromCBOR), ToCBOR (toCBOR)) | ||
import Codec.Serialise (decode, encode) | ||
import qualified Data.Text as Text | ||
import Plutus.V1.Ledger.Api (plutusScriptEnvelopeType) | ||
import Plutus.V1.Ledger.Scripts as Export | ||
|
||
instance HasTextEnvelope Script where | ||
textEnvelopeType _ = TextEnvelopeType $ Text.unpack plutusScriptEnvelopeType | ||
|
||
instance SerialiseAsCBOR Script | ||
|
||
instance FromCBOR Script where | ||
fromCBOR = decode | ||
|
||
instance ToCBOR Script where | ||
toCBOR = encode | ||
|
||
instance HasTypeProxy Script where | ||
data AsType Script = AsScript | ||
proxyToAsType _ = AsScript |