Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
data
Script
(elem ::
Type
)
- = RequireSignatureOf !elem
- | RequireAllOf ![ Script elem]
- | RequireAnyOf ![ Script elem]
- | RequireSomeOf Word8 ![ Script elem]
- | ActiveFromSlot Natural
- | ActiveUntilSlot Natural
- serializeScript :: Script KeyHash -> ByteString
- foldScript :: (a -> b -> b) -> b -> Script a -> b
- data ScriptTemplate = ScriptTemplate { }
- newtype Cosigner = Cosigner Word8
- data ErrValidateScript
- data ErrRecommendedValidateScript
- data ErrValidateScriptTemplate
- validateScript :: ValidationLevel -> Script KeyHash -> Either ErrValidateScript ()
- validateScriptTemplate :: ValidationLevel -> ScriptTemplate -> Either ErrValidateScriptTemplate ()
- validateScriptOfTemplate :: ValidationLevel -> Script Cosigner -> Either ErrValidateScript ()
- prettyErrValidateScript :: ErrValidateScript -> String
- prettyErrValidateScriptTemplate :: ErrValidateScriptTemplate -> String
- newtype ScriptHash = ScriptHash { }
- toScriptHash :: Script KeyHash -> ScriptHash
- scriptHashFromBytes :: ByteString -> Maybe ScriptHash
-
data
KeyHash
=
KeyHash
{
- role :: KeyRole
- digest :: ByteString
- keyHashFromBytes :: ( KeyRole , ByteString ) -> Maybe KeyHash
- keyHashFromText :: Text -> Either ErrKeyHashFromText KeyHash
- keyHashToText :: KeyHash -> Text
Script
data Script (elem :: Type ) Source #
A
Script
type represents multi signature script. The script embodies conditions
that need to be satisfied to make it valid.
Since: 3.0.0
RequireSignatureOf !elem | |
RequireAllOf ![ Script elem] | |
RequireAnyOf ![ Script elem] | |
RequireSomeOf Word8 ![ Script elem] | |
ActiveFromSlot Natural | |
ActiveUntilSlot Natural |
Instances
serializeScript :: Script KeyHash -> ByteString Source #
This function realizes what cardano-node's `Api.serialiseToCBOR script` realizes This is basically doing the symbolically following: toCBOR [0,multisigScript]
Since: 3.0.0
foldScript :: (a -> b -> b) -> b -> Script a -> b Source #
Script
folding
Since: 3.2.0
Script template
data ScriptTemplate Source #
Represents the script template that show the structure of the script and determines the expected place of verification keys corresponding to given cosigners.
Since: 3.2.0
Instances
Represents the cosigner of the script, ie., party that co-shares the script.
Since: 3.2.0
Instances
Eq Cosigner Source # | |
Ord Cosigner Source # | |
Defined in Cardano.Address.Script |
|
Show Cosigner Source # | |
Generic Cosigner Source # | |
Hashable Cosigner Source # | |
ToJSON Cosigner Source # | |
FromJSON Cosigner Source # | |
NFData Cosigner Source # | |
Defined in Cardano.Address.Script |
|
FromJSON ( Script Cosigner ) Source # | |
type Rep Cosigner Source # | |
Defined in Cardano.Address.Script |
Validation
data ErrValidateScript Source #
Possible validation errors when validating a script
Since: 3.0.0
LedgerIncompatible | |
WrongKeyHash | |
NotUniformKeyType | |
Malformed | |
NotRecommended ErrRecommendedValidateScript |
Instances
Eq ErrValidateScript Source # | |
Defined in Cardano.Address.Script (==) :: ErrValidateScript -> ErrValidateScript -> Bool Source # (/=) :: ErrValidateScript -> ErrValidateScript -> Bool Source # |
|
Show ErrValidateScript Source # | |
Defined in Cardano.Address.Script |
data ErrRecommendedValidateScript Source #
Possible recommended validation errors when validating a script
Since: 3.2.0
Instances
Eq ErrRecommendedValidateScript Source # | |
Defined in Cardano.Address.Script |
|
Show ErrRecommendedValidateScript Source # | |
Defined in Cardano.Address.Script |
data ErrValidateScriptTemplate Source #
Possible validation errors when validating a script template
Since: 3.2.0
WrongScript ErrValidateScript | |
DuplicateXPubs | |
UnknownCosigner | |
MissingCosignerXPub | |
NoCosignerInScript | |
NoCosignerXPub |
Instances
Eq ErrValidateScriptTemplate Source # | |
Defined in Cardano.Address.Script |
|
Show ErrValidateScriptTemplate Source # | |
Defined in Cardano.Address.Script |
validateScript :: ValidationLevel -> Script KeyHash -> Either ErrValidateScript () Source #
Validate a
Script
, semantically
Since: 3.0.0
validateScriptTemplate :: ValidationLevel -> ScriptTemplate -> Either ErrValidateScriptTemplate () Source #
Validate a
ScriptTemplate
, semantically
Since: 3.2.0
validateScriptOfTemplate :: ValidationLevel -> Script Cosigner -> Either ErrValidateScript () Source #
Validate a script in
ScriptTemplate
Since: 3.5.0
prettyErrValidateScript :: ErrValidateScript -> String Source #
Pretty-print a script validation error.
Since: 3.0.0
prettyErrValidateScriptTemplate :: ErrValidateScriptTemplate -> String Source #
Pretty-print a script template validation error.
Since: 3.2.0
Hashing
newtype ScriptHash Source #
A
ScriptHash
type represents script hash. The hash is expected to have size of
28-byte.
Since: 3.0.0
Instances
toScriptHash :: Script KeyHash -> ScriptHash Source #
Computes the hash of a given script, by first serializing it to CBOR.
Since: 3.0.0
scriptHashFromBytes :: ByteString -> Maybe ScriptHash Source #
Construct an
ScriptHash
from raw
ByteString
(28 bytes).
Since: 3.0.0
A
KeyHash
type represents verification key hash that participate in building
multi-signature script. The hash is expected to have size of 28-byte.
Since: 3.0.0
KeyHash | |
|
Instances
Eq KeyHash Source # | |
Ord KeyHash Source # | |
Defined in Cardano.Address.Script |
|
Show KeyHash Source # | |
Generic KeyHash Source # | |
ToJSON KeyHash Source # | |
NFData KeyHash Source # | |
Defined in Cardano.Address.Script |
|
FromJSON ( Script KeyHash ) Source # | |
type Rep KeyHash Source # | |
Defined in Cardano.Address.Script
type
Rep
KeyHash
=
D1
('
MetaData
"KeyHash" "Cardano.Address.Script" "cardano-addresses-3.11.0-D40zGSHo3QMFNy9OpWafYI" '
False
) (
C1
('
MetaCons
"KeyHash" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"role") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
KeyRole
)
:*:
S1
('
MetaSel
('
Just
"digest") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
ByteString
)))
|
keyHashFromBytes :: ( KeyRole , ByteString ) -> Maybe KeyHash Source #
Construct an
KeyHash
from raw
ByteString
(28 bytes).
Since: 3.0.0
keyHashFromText :: Text -> Either ErrKeyHashFromText KeyHash Source #
Construct a
KeyHash
from
Text
. It should be
Bech32 encoded text with one of following hrp:
-
addr_shared_vkh
-
stake_shared_vkh
-
addr_vkh
-
stake_vkh
-
policy_vkh
-
addr_shared_vk
-
stake_shared_vk
-
addr_vk
-
stake_vk
-
addr_shared_xvk
-
stake_shared_xvk
-
addr_xvk
-
stake_xvk
-
policy_vk
-
policy_xvk
Raw keys will be hashed on the fly, whereas hash that are directly
provided will remain as such.
Since: 3.1.0