Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities for lightweight entrypoints support.
Synopsis
- data EpAddress = EpAddress {}
- data ParseEpAddressError
- formatEpAddress :: EpAddress -> Text
- mformatEpAddress :: EpAddress -> MText
- parseEpAddress :: Text -> Either ParseEpAddressError EpAddress
- unsafeParseEpAddress :: HasCallStack => Text -> EpAddress
- newtype ParamNotes (t :: T) = ParamNotesUnsafe {
- unParamNotes :: Notes t
- pattern ParamNotes :: Notes t -> ParamNotes t
- data ArmCoord
- type ArmCoords = [ArmCoord]
- data ParamEpError
- mkParamNotes :: Notes t -> Either ParamEpError (ParamNotes t)
- data EpLiftSequence (arg :: T) (param :: T) where
- EplArgHere :: EpLiftSequence arg arg
- EplWrapLeft :: EpLiftSequence arg subparam -> EpLiftSequence arg (TOr subparam r)
- EplWrapRight :: EpLiftSequence arg subparam -> EpLiftSequence arg (TOr l subparam)
- data EntryPointCallT (param :: T) (arg :: T) = ParameterScope arg => EntryPointCall {
- epcName :: EpName
- epcParamProxy :: Proxy param
- epcLiftSequence :: EpLiftSequence arg param
- data SomeEntryPointCallT (arg :: T) = ParameterScope param => SomeEpc (EntryPointCallT param arg)
- sepcName :: SomeEntryPointCallT arg -> EpName
- data MkEntryPointCallRes param where
- MkEntryPointCallRes :: ParameterScope arg => Notes arg -> EntryPointCallT param arg -> MkEntryPointCallRes param
- mkEntryPointCall :: ParameterScope param => EpName -> (Sing param, ParamNotes param) -> Maybe (MkEntryPointCallRes param)
- tyImplicitAccountParam :: (Sing TUnit, ParamNotes TUnit)
- newtype EpName = EpNameUnsafe {}
- pattern DefEpName :: EpName
- epNameFromParamAnn :: FieldAnn -> Maybe EpName
- epNameToParamAnn :: EpName -> FieldAnn
- epNameFromRefAnn :: FieldAnn -> Either EpNameFromRefAnnError EpName
- epNameToRefAnn :: EpName -> FieldAnn
- data EpNameFromRefAnnError = InEpNameBadAnnotation FieldAnn
Documentation
Address with optional entrypoint name attached to it. TODO: come up with better name?
EpAddress | |
|
Instances
data ParseEpAddressError Source #
ParseEpAddressBadAddress ParseAddressError | |
ParseEpAddressBadRefAnn Text | |
ParseEpAddressRefAnnError EpNameFromRefAnnError |
Instances
Eq ParseEpAddressError Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: ParseEpAddressError -> ParseEpAddressError -> Bool # (/=) :: ParseEpAddressError -> ParseEpAddressError -> Bool # | |
Show ParseEpAddressError Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> ParseEpAddressError -> ShowS # show :: ParseEpAddressError -> String # showList :: [ParseEpAddressError] -> ShowS # | |
Buildable ParseEpAddressError Source # | |
Defined in Michelson.Typed.EntryPoints build :: ParseEpAddressError -> Builder # |
formatEpAddress :: EpAddress -> Text Source #
mformatEpAddress :: EpAddress -> MText Source #
parseEpAddress :: Text -> Either ParseEpAddressError EpAddress Source #
Parse an address which can be suffixed with entrypoint name (e.g. "tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU%entrypoint").
unsafeParseEpAddress :: HasCallStack => Text -> EpAddress Source #
newtype ParamNotes (t :: T) Source #
Annotations for contract parameter declaration.
Following the Michelson specification, this type has the following invariants:
1. No entrypoint name is duplicated.
2. If default
entrypoint is explicitly assigned, no "arm" remains uncallable.
Instances
Eq (ParamNotes t) Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: ParamNotes t -> ParamNotes t -> Bool # (/=) :: ParamNotes t -> ParamNotes t -> Bool # | |
Show (ParamNotes t) Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> ParamNotes t -> ShowS # show :: ParamNotes t -> String # showList :: [ParamNotes t] -> ShowS # |
pattern ParamNotes :: Notes t -> ParamNotes t Source #
data ParamEpError Source #
Errors specific to parameter type declaration (entrypoints).
Instances
Eq ParamEpError Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: ParamEpError -> ParamEpError -> Bool # (/=) :: ParamEpError -> ParamEpError -> Bool # | |
Show ParamEpError Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> ParamEpError -> ShowS # show :: ParamEpError -> String # showList :: [ParamEpError] -> ShowS # | |
Buildable ParamEpError Source # | |
Defined in Michelson.Typed.EntryPoints build :: ParamEpError -> Builder # |
mkParamNotes :: Notes t -> Either ParamEpError (ParamNotes t) Source #
Construct ParamNotes
performing all necessary checks.
data EpLiftSequence (arg :: T) (param :: T) where Source #
Describes how to construct full contract parameter from given entrypoint argument.
This could be just wrapper over Value arg -> Value param
, but we cannot
use Value
type in this module easily.
EplArgHere :: EpLiftSequence arg arg | |
EplWrapLeft :: EpLiftSequence arg subparam -> EpLiftSequence arg (TOr subparam r) | |
EplWrapRight :: EpLiftSequence arg subparam -> EpLiftSequence arg (TOr l subparam) |
Instances
Eq (EpLiftSequence arg param) Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: EpLiftSequence arg param -> EpLiftSequence arg param -> Bool # (/=) :: EpLiftSequence arg param -> EpLiftSequence arg param -> Bool # | |
Show (EpLiftSequence arg param) Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> EpLiftSequence arg param -> ShowS # show :: EpLiftSequence arg param -> String # showList :: [EpLiftSequence arg param] -> ShowS # | |
Buildable (EpLiftSequence arg param) Source # | |
Defined in Michelson.Typed.EntryPoints build :: EpLiftSequence arg param -> Builder # |
data EntryPointCallT (param :: T) (arg :: T) Source #
Reference for calling a specific entrypoint of type arg
.
ParameterScope arg => EntryPointCall | |
|
Instances
Eq (EntryPointCallT param arg) Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: EntryPointCallT param arg -> EntryPointCallT param arg -> Bool # (/=) :: EntryPointCallT param arg -> EntryPointCallT param arg -> Bool # | |
Show (EntryPointCallT param arg) Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> EntryPointCallT param arg -> ShowS # show :: EntryPointCallT param arg -> String # showList :: [EntryPointCallT param arg] -> ShowS # | |
(param ~ arg, ParameterScope arg) => Default (EntryPointCallT param arg) Source # | Calls the default entrypoint. TODO [TM-280]: This implementation always refers parameter root, fix it. |
Defined in Michelson.Typed.EntryPoints def :: EntryPointCallT param arg # | |
Buildable (EntryPointCallT param arg) Source # | |
Defined in Michelson.Typed.EntryPoints build :: EntryPointCallT param arg -> Builder # |
data SomeEntryPointCallT (arg :: T) Source #
EntryPointCallT
with hidden parameter type.
This requires argument to satisfy ParameterScope
constraint.
Strictly speaking, entrypoint argument may one day start having different
set of constraints comparing to ones applied to parameter, but this seems
unlikely.
ParameterScope param => SomeEpc (EntryPointCallT param arg) |
Instances
Eq (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: SomeEntryPointCallT arg -> SomeEntryPointCallT arg -> Bool # (/=) :: SomeEntryPointCallT arg -> SomeEntryPointCallT arg -> Bool # | |
Show (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> SomeEntryPointCallT arg -> ShowS # show :: SomeEntryPointCallT arg -> String # showList :: [SomeEntryPointCallT arg] -> ShowS # | |
ParameterScope arg => Default (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints def :: SomeEntryPointCallT arg # | |
Buildable (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints build :: SomeEntryPointCallT arg -> Builder # |
sepcName :: SomeEntryPointCallT arg -> EpName Source #
data MkEntryPointCallRes param where Source #
MkEntryPointCallRes :: ParameterScope arg => Notes arg -> EntryPointCallT param arg -> MkEntryPointCallRes param |
mkEntryPointCall :: ParameterScope param => EpName -> (Sing param, ParamNotes param) -> Maybe (MkEntryPointCallRes param) Source #
Build EntryPointCallT
.
Here we accept entrypoint name and type information for the parameter of target contract.
Returns Nothing
if entrypoint is not found.
tyImplicitAccountParam :: (Sing TUnit, ParamNotes TUnit) Source #
Parameter type of implicit account.
Re-exports
Entrypoint name.
Empty if this entrypoint is default one. Cannot be equal to "default", the reference implementation forbids that. Also, set of allowed characters should be the same as in annotations.
epNameToParamAnn :: EpName -> FieldAnn Source #
Turn entrypoint name into annotation for contract parameter declaration.
epNameFromRefAnn :: FieldAnn -> Either EpNameFromRefAnnError EpName Source #
Make up EpName
from annotation which is reference to an entrypoint
(e.g. annotation in CONTRACT
instruction).
Fails if annotation is invalid.
epNameToRefAnn :: EpName -> FieldAnn Source #
Turn entrypoint name into annotation used as reference to entrypoint.
data EpNameFromRefAnnError Source #
Instances
Eq EpNameFromRefAnnError Source # | |
Defined in Michelson.Untyped.EntryPoints (==) :: EpNameFromRefAnnError -> EpNameFromRefAnnError -> Bool # (/=) :: EpNameFromRefAnnError -> EpNameFromRefAnnError -> Bool # | |
Show EpNameFromRefAnnError Source # | |
Defined in Michelson.Untyped.EntryPoints showsPrec :: Int -> EpNameFromRefAnnError -> ShowS # show :: EpNameFromRefAnnError -> String # showList :: [EpNameFromRefAnnError] -> ShowS # | |
Buildable EpNameFromRefAnnError Source # | |
Defined in Michelson.Untyped.EntryPoints build :: EpNameFromRefAnnError -> Builder # |