Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class EraScript era ⇒ ScriptClass era where
- basescript ∷ Proxy era → KeyHash 'Witness (EraCrypto era) → Script era
- isKey ∷ Proxy era → Script era → Maybe (KeyHash 'Witness (EraCrypto era))
- isOnePhase ∷ Proxy era → Script era → Bool
- quantify ∷ Proxy era → Script era → Quantifier (Script era)
- unQuantify ∷ Proxy era → Quantifier (Script era) → Script era
- data Quantifier t
- exponential ∷ Integer → Integer → Gen Integer
- anyOf ∷ ∀ era. ScriptClass era ⇒ Proxy era → [Script era] → Script era
- allOf ∷ ∀ era. ScriptClass era ⇒ Proxy era → [Script era] → Script era
- mOf ∷ ∀ era. ScriptClass era ⇒ Proxy era → Int → [Script era] → Script era
- keyPairs ∷ Crypto c ⇒ Constants → KeyPairs c
- mkPayScriptHashMap ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → Map (ScriptHash (EraCrypto era)) (Script era, Script era)
- mkStakeScriptHashMap ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → Map (ScriptHash (EraCrypto era)) (Script era, Script era)
- mkScriptsFromKeyPair ∷ ∀ era. ScriptClass era ⇒ (KeyPair 'Payment (EraCrypto era), KeyPair 'Staking (EraCrypto era)) → (Script era, Script era)
- mkKeyPairs ∷ DSIGNAlgorithm (DSIGN c) ⇒ Word64 → (KeyPair kr c, KeyPair kr' c)
- mkScripts ∷ ∀ era. ScriptClass era ⇒ KeyPairs (EraCrypto era) → [(Script era, Script era)]
- mkScriptCombinations ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → [(Script era, Script era)]
- combinedScripts ∷ ∀ era. ScriptClass era ⇒ Constants → [(Script era, Script era)]
- baseScripts ∷ ∀ era. ScriptClass era ⇒ Constants → [(Script era, Script era)]
- scriptKeyCombinations ∷ ∀ era. ScriptClass era ⇒ Proxy era → Script era → [[KeyHash 'Witness (EraCrypto era)]]
- scriptKeyCombination ∷ ∀ era. ScriptClass era ⇒ Proxy era → Script era → [KeyHash 'Witness (EraCrypto era)]
Documentation
class EraScript era ⇒ ScriptClass era where Source #
basescript ∷ Proxy era → KeyHash 'Witness (EraCrypto era) → Script era Source #
isKey ∷ Proxy era → Script era → Maybe (KeyHash 'Witness (EraCrypto era)) Source #
isOnePhase ∷ Proxy era → Script era → Bool Source #
quantify ∷ Proxy era → Script era → Quantifier (Script era) Source #
unQuantify ∷ Proxy era → Quantifier (Script era) → Script era Source #
Instances
Crypto c ⇒ ScriptClass (ShelleyEra c) Source # | |
Defined in Test.Cardano.Ledger.Shelley.Generator.ShelleyEraGen basescript ∷ Proxy (ShelleyEra c) → KeyHash 'Witness (EraCrypto (ShelleyEra c)) → Script (ShelleyEra c) Source # isKey ∷ Proxy (ShelleyEra c) → Script (ShelleyEra c) → Maybe (KeyHash 'Witness (EraCrypto (ShelleyEra c))) Source # isOnePhase ∷ Proxy (ShelleyEra c) → Script (ShelleyEra c) → Bool Source # quantify ∷ Proxy (ShelleyEra c) → Script (ShelleyEra c) → Quantifier (Script (ShelleyEra c)) Source # unQuantify ∷ Proxy (ShelleyEra c) → Quantifier (Script (ShelleyEra c)) → Script (ShelleyEra c) Source # |
data Quantifier t Source #
Instances
Functor Quantifier Source # | |
Defined in Test.Cardano.Ledger.Shelley.Generator.ScriptClass fmap ∷ (a → b) → Quantifier a → Quantifier b Source # (<$) ∷ a → Quantifier b → Quantifier a Source # |
keyPairs ∷ Crypto c ⇒ Constants → KeyPairs c Source #
Constant list of KeyPairs intended to be used in the generators.
mkPayScriptHashMap ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → Map (ScriptHash (EraCrypto era)) (Script era, Script era) Source #
mkStakeScriptHashMap ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → Map (ScriptHash (EraCrypto era)) (Script era, Script era) Source #
Generate a mapping from stake script hash to script pair.
mkScriptsFromKeyPair ∷ ∀ era. ScriptClass era ⇒ (KeyPair 'Payment (EraCrypto era), KeyPair 'Staking (EraCrypto era)) → (Script era, Script era) Source #
mkKeyPairs ∷ DSIGNAlgorithm (DSIGN c) ⇒ Word64 → (KeyPair kr c, KeyPair kr' c) Source #
mkScripts ∷ ∀ era. ScriptClass era ⇒ KeyPairs (EraCrypto era) → [(Script era, Script era)] Source #
make Scripts based on the given key pairs
mkScriptCombinations ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → [(Script era, Script era)] Source #
Combine a list of script pairs into hierarchically structured multi-sig scripts, list must have at least length 3. Be careful not to call with too many pairs in order not to create too many of the possible combinations.
combinedScripts ∷ ∀ era. ScriptClass era ⇒ Constants → [(Script era, Script era)] Source #
Make a list of script pairs (payment,staking). Each of these are combined scripts. I.e. All, Any, MofN, etc. These come from combining the the first N (numBaseScripts) baseScripts When N==3, we get about 150 combined scripts.
baseScripts ∷ ∀ era. ScriptClass era ⇒ Constants → [(Script era, Script era)] Source #
Make list of script pairs (payment,staking). These are non-combined scripts Ie NO quantifer like All, Any, MofN, etc.) scripts. In post Shelley Eras, either Keylock or Require Start-Finish scripts.
scriptKeyCombinations ∷ ∀ era. ScriptClass era ⇒ Proxy era → Script era → [[KeyHash 'Witness (EraCrypto era)]] Source #
Return all valid lists of KeyHashes that appear in a Script used in testing.
scriptKeyCombination ∷ ∀ era. ScriptClass era ⇒ Proxy era → Script era → [KeyHash 'Witness (EraCrypto era)] Source #
Produce a valid list of key hashes that appear in a Script. Note: in the case of AnyOf, we just take the first script in the expression. This only works if we generate AnyOf scripts such that all script options are valid scripts (that is, valid in the context of a transaction, at generation time and execution/spend time).