Copyright | (c) 2024 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | None |
Language | GHC2021 |
GeniusYield.Types.Anchor
Description
Synopsis
- data GYUrl
- textToUrl :: MonadFail m => Text -> m GYUrl
- unsafeTextToUrl :: Text -> GYUrl
- urlToText :: GYUrl -> Text
- urlToLedger :: GYUrl -> Url
- urlFromLedger :: Url -> GYUrl
- type GYAnchorData = ByteString
- data GYAnchorDataHash
- hashAnchorData :: GYAnchorData -> GYAnchorDataHash
- anchorDataHashToByteString :: GYAnchorDataHash -> ByteString
- anchorDataHashFromByteString :: ByteString -> Maybe GYAnchorDataHash
- data GYAnchor = GYAnchor {}
- anchorToLedger :: GYAnchor -> Anchor
- anchorFromLedger :: Anchor -> GYAnchor
Documentation
URL to a JSON payload of metadata. Note that we require URL to be at most 128 bytes. >>> textToUrl "https://geniusyield.co" GYUrl (Url {urlToText = "https://geniusyield.co"})
unsafeTextToUrl :: Text -> GYUrl #
urlToLedger :: GYUrl -> Url #
urlFromLedger :: Url -> GYUrl #
type GYAnchorData = ByteString #
Anchor data.
data GYAnchorDataHash #
Hash of anchor data. >>> hashAnchorData "Hello, World!" GYAnchorDataHash (SafeHash "511bc81dde11180838c562c82bb35f3223f46061ebde4a955c27b3f489cf1e03")
Instances
hashAnchorData :: GYAnchorData -> GYAnchorDataHash #
Hash anchor data.
anchorDataHashToByteString :: GYAnchorDataHash -> ByteString #
Convert a GYAnchorDataHash
to a ByteString
.
>>> let h = hashAnchorData "Hello, World!"
>>>
show h
"GYAnchorDataHash (SafeHash \"511bc81dde11180838c562c82bb35f3223f46061ebde4a955c27b3f489cf1e03\")"
>>>
BS16.encode $ anchorDataHashToByteString h
"511bc81dde11180838c562c82bb35f3223f46061ebde4a955c27b3f489cf1e03"
>>>
anchorDataHashFromByteString $ anchorDataHashToByteString h
Just (GYAnchorDataHash (SafeHash "511bc81dde11180838c562c82bb35f3223f46061ebde4a955c27b3f489cf1e03"))
Anchor.
Constructors
GYAnchor | |
Fields
|
anchorToLedger :: GYAnchor -> Anchor #
anchorFromLedger :: Anchor -> GYAnchor #