-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace only AdaSupportedInEra
and MultiAssetSupportedInEra
with eons
#254
Merged
newhoggy
merged 14 commits into
main
from
newhoggy/replace-OnlyAdaSupportedInEra-and-MultiAssetSupportedInEra-with-eons
Sep 22, 2023
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dd0153f
New ByronToAllegraEra eon
newhoggy a626bd8
New caseByronToAllegraOrMaryEraOnwards function
newhoggy 8d8b025
Delete MultiAssetSupportedInEra. Use MaryEraOnwards instead
newhoggy a3eca59
Delete OnlyAdaSupportedInEra. Use ByronToAllegraEra instead
newhoggy e37dc48
Additional constraints for MaryEraOnwards and ShelleyToAllegraEra
newhoggy e0e2cf7
Delete multiAssetSupportedInEra. Use caseByronToAllegraOrMaryEraOnwa…
newhoggy 0e5c9f6
New caseShelleyToAllegraOrMaryEraOnwards and shelleyToAllegraEraToByr…
newhoggy b14c8bc
In implementation of fromShelleyTxOut, compute txOutValue and address…
newhoggy 6848a82
Delete ReferenceTxInsScriptsInlineDatumsInBabbageEra. Use BabbageEra…
newhoggy 884b330
Delete refInsScriptsAndInlineDatsSupportedInEra. Use caseShelleyToAl…
newhoggy 4576638
Delete ScriptDataInAlonzoEra. Use AlonzoEraOnwardsAlonzo instead
newhoggy d50df2c
New ByronToMaryEra eon
newhoggy fb45cf5
Delete commented out code
newhoggy 6c802c1
Delete scriptDataSupportedInEra. Use caseByronToMaryOrAlonzoEraOnwar…
newhoggy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{-# LANGUAGE ConstraintKinds #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE StandaloneDeriving #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Cardano.Api.Eon.ByronToAllegraEra | ||
( ByronToAllegraEra(..) | ||
, IsByronToAllegraEra(..) | ||
, AnyByronToAllegraEra(..) | ||
, byronToAllegraEraConstraints | ||
, byronToAllegraEraToCardanoEra | ||
|
||
, ByronToAllegraEraConstraints | ||
) where | ||
|
||
import Cardano.Api.Eras.Core | ||
|
||
import Data.Typeable (Typeable) | ||
|
||
class IsByronToAllegraEra era where | ||
byronToAllegraEra :: ByronToAllegraEra era | ||
|
||
data ByronToAllegraEra era where | ||
ByronToAllegraEraByron :: ByronToAllegraEra ByronEra | ||
ByronToAllegraEraShelley :: ByronToAllegraEra ShelleyEra | ||
ByronToAllegraEraAllegra :: ByronToAllegraEra AllegraEra | ||
|
||
deriving instance Show (ByronToAllegraEra era) | ||
deriving instance Eq (ByronToAllegraEra era) | ||
|
||
instance IsByronToAllegraEra ByronEra where | ||
byronToAllegraEra = ByronToAllegraEraByron | ||
|
||
instance IsByronToAllegraEra ShelleyEra where | ||
byronToAllegraEra = ByronToAllegraEraShelley | ||
|
||
instance IsByronToAllegraEra AllegraEra where | ||
byronToAllegraEra = ByronToAllegraEraAllegra | ||
|
||
instance Eon ByronToAllegraEra where | ||
inEonForEra no yes = \case | ||
ByronEra -> yes ByronToAllegraEraByron | ||
ShelleyEra -> yes ByronToAllegraEraShelley | ||
AllegraEra -> yes ByronToAllegraEraAllegra | ||
MaryEra -> no | ||
AlonzoEra -> no | ||
BabbageEra -> no | ||
ConwayEra -> no | ||
|
||
instance ToCardanoEra ByronToAllegraEra where | ||
toCardanoEra = \case | ||
ByronToAllegraEraByron -> ByronEra | ||
ByronToAllegraEraShelley -> ShelleyEra | ||
ByronToAllegraEraAllegra -> AllegraEra | ||
|
||
type ByronToAllegraEraConstraints era = | ||
( IsCardanoEra era | ||
, IsByronToAllegraEra era | ||
, Typeable era | ||
) | ||
|
||
data AnyByronToAllegraEra where | ||
AnyByronToAllegraEra :: ByronToAllegraEra era -> AnyByronToAllegraEra | ||
|
||
deriving instance Show AnyByronToAllegraEra | ||
|
||
byronToAllegraEraConstraints :: () | ||
=> ByronToAllegraEra era | ||
-> (ByronToAllegraEraConstraints era => a) | ||
-> a | ||
byronToAllegraEraConstraints = \case | ||
ByronToAllegraEraByron -> id | ||
ByronToAllegraEraShelley -> id | ||
ByronToAllegraEraAllegra -> id | ||
|
||
byronToAllegraEraToCardanoEra :: ByronToAllegraEra era -> CardanoEra era | ||
byronToAllegraEraToCardanoEra = \case | ||
ByronToAllegraEraByron -> ByronEra | ||
ByronToAllegraEraShelley -> ShelleyEra | ||
ByronToAllegraEraAllegra -> AllegraEra |
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,98 @@ | ||
{-# LANGUAGE ConstraintKinds #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE StandaloneDeriving #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Cardano.Api.Eon.ByronToAlonzoEra | ||
( ByronToAlonzoEra(..) | ||
, IsByronToAlonzoEra(..) | ||
, AnyByronToAlonzoEra(..) | ||
, byronToAlonzoEraConstraints | ||
, byronToAlonzoEraToCardanoEra | ||
|
||
, ByronToAlonzoEraConstraints | ||
) where | ||
|
||
import Cardano.Api.Eras.Core | ||
|
||
import Data.Typeable (Typeable) | ||
|
||
class IsByronToAlonzoEra era where | ||
byronToAlonzoEra :: ByronToAlonzoEra era | ||
|
||
data ByronToAlonzoEra era where | ||
ByronToAlonzoEraByron :: ByronToAlonzoEra ByronEra | ||
ByronToAlonzoEraShelley :: ByronToAlonzoEra ShelleyEra | ||
ByronToAlonzoEraAllegra :: ByronToAlonzoEra AllegraEra | ||
ByronToAlonzoEraMary :: ByronToAlonzoEra MaryEra | ||
ByronToAlonzoEraAlonzo :: ByronToAlonzoEra AlonzoEra | ||
|
||
deriving instance Show (ByronToAlonzoEra era) | ||
deriving instance Eq (ByronToAlonzoEra era) | ||
|
||
instance IsByronToAlonzoEra ByronEra where | ||
byronToAlonzoEra = ByronToAlonzoEraByron | ||
|
||
instance IsByronToAlonzoEra ShelleyEra where | ||
byronToAlonzoEra = ByronToAlonzoEraShelley | ||
|
||
instance IsByronToAlonzoEra AllegraEra where | ||
byronToAlonzoEra = ByronToAlonzoEraAllegra | ||
|
||
instance IsByronToAlonzoEra MaryEra where | ||
byronToAlonzoEra = ByronToAlonzoEraMary | ||
|
||
instance IsByronToAlonzoEra AlonzoEra where | ||
byronToAlonzoEra = ByronToAlonzoEraAlonzo | ||
|
||
instance Eon ByronToAlonzoEra where | ||
inEonForEra no yes = \case | ||
ByronEra -> yes ByronToAlonzoEraByron | ||
ShelleyEra -> yes ByronToAlonzoEraShelley | ||
AllegraEra -> yes ByronToAlonzoEraAllegra | ||
MaryEra -> yes ByronToAlonzoEraMary | ||
AlonzoEra -> yes ByronToAlonzoEraAlonzo | ||
BabbageEra -> no | ||
ConwayEra -> no | ||
|
||
instance ToCardanoEra ByronToAlonzoEra where | ||
toCardanoEra = \case | ||
ByronToAlonzoEraByron -> ByronEra | ||
ByronToAlonzoEraShelley -> ShelleyEra | ||
ByronToAlonzoEraAllegra -> AllegraEra | ||
ByronToAlonzoEraMary -> MaryEra | ||
ByronToAlonzoEraAlonzo -> AlonzoEra | ||
|
||
type ByronToAlonzoEraConstraints era = | ||
( IsCardanoEra era | ||
, IsByronToAlonzoEra era | ||
, Typeable era | ||
) | ||
|
||
data AnyByronToAlonzoEra where | ||
AnyByronToAlonzoEra :: ByronToAlonzoEra era -> AnyByronToAlonzoEra | ||
|
||
deriving instance Show AnyByronToAlonzoEra | ||
|
||
byronToAlonzoEraConstraints :: () | ||
=> ByronToAlonzoEra era | ||
-> (ByronToAlonzoEraConstraints era => a) | ||
-> a | ||
byronToAlonzoEraConstraints = \case | ||
ByronToAlonzoEraByron -> id | ||
ByronToAlonzoEraShelley -> id | ||
ByronToAlonzoEraAllegra -> id | ||
ByronToAlonzoEraMary -> id | ||
ByronToAlonzoEraAlonzo -> id | ||
|
||
byronToAlonzoEraToCardanoEra :: ByronToAlonzoEra era -> CardanoEra era | ||
byronToAlonzoEraToCardanoEra = \case | ||
ByronToAlonzoEraByron -> ByronEra | ||
ByronToAlonzoEraShelley -> ShelleyEra | ||
ByronToAlonzoEraAllegra -> AllegraEra | ||
ByronToAlonzoEraMary -> MaryEra | ||
ByronToAlonzoEraAlonzo -> AlonzoEra |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? Where is it being used. Do you have a cli branch integrated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsByronToAllegraEra
I can delete.