Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- type GYStakePoolId = GYKeyHash 'GYKeyRoleStakePool
- stakePoolIdToApi ∷ GYStakePoolId → Hash StakePoolKey
- stakePoolIdFromApi ∷ Hash StakePoolKey → GYStakePoolId
- stakePoolIdToLedger ∷ GYStakePoolId → KeyHash StakePool StandardCrypto
- stakePoolIdFromLedger ∷ KeyHash StakePool StandardCrypto → GYStakePoolId
- stakePoolIdFromTextMaybe ∷ Text → Maybe GYStakePoolId
- unsafeStakePoolIdFromText ∷ Text → GYStakePoolId
- stakePoolIdToText ∷ GYStakePoolId → Text
- data GYStakePoolIdBech32
- stakePoolIdFromBech32 ∷ GYStakePoolIdBech32 → GYStakePoolId
- stakePoolIdToBech32 ∷ GYStakePoolId → GYStakePoolIdBech32
Documentation
type GYStakePoolId = GYKeyHash 'GYKeyRoleStakePool #
type GYStakePoolId = GYKeyHash 'GYKeyRoleStakePool
stakePoolIdToApi ∷ GYStakePoolId → Hash StakePoolKey #
>>>
let Just spid = Aeson.decode @GYStakePoolId "\"c485ab20bd3f105e59f3c50a0d3fbaf615a51f70a1c6d29d00a1fd27\""
>>>
stakePoolIdToApi spid
"c485ab20bd3f105e59f3c50a0d3fbaf615a51f70a1c6d29d00a1fd27"
stakePoolIdFromApi ∷ Hash StakePoolKey → GYStakePoolId #
>>>
stakePoolIdFromApi "c485ab20bd3f105e59f3c50a0d3fbaf615a51f70a1c6d29d00a1fd27"
GYKeyHash (GYKeyRoleStakePool) "c485ab20bd3f105e59f3c50a0d3fbaf615a51f70a1c6d29d00a1fd27"
stakePoolIdToLedger ∷ GYStakePoolId → KeyHash StakePool StandardCrypto #
Convert to corresponding ledger type.
stakePoolIdFromLedger ∷ KeyHash StakePool StandardCrypto → GYStakePoolId #
Convert from corresponding ledger type.
stakePoolIdFromTextMaybe ∷ Text → Maybe GYStakePoolId #
Obtain GYStakePoolId
from bech32 encoding of stake pool id.
>>>
stakePoolIdFromTextMaybe "pool1cjz6kg9a8ug9uk0nc59q60a67c2628ms58rd98gq587jwa2x5qt"
Just (GYKeyHash (GYKeyRoleStakePool) "c485ab20bd3f105e59f3c50a0d3fbaf615a51f70a1c6d29d00a1fd27")>>>
stakePoolIdFromTextMaybe "c485ab20bd3f105e59f3c50a0d3fbaf615a51f70a1c6d29d00a1fd27"
Nothing
unsafeStakePoolIdFromText ∷ Text → GYStakePoolId #
Like stakePoolIdFromTextMaybe
but errors on Nothing
case.
stakePoolIdToText ∷ GYStakePoolId → Text #
Serialises GYStakePoolId
to it's bech32 representation.
>>>
stakePoolIdToText spId
"pool1cjz6kg9a8ug9uk0nc59q60a67c2628ms58rd98gq587jwa2x5qt"
data GYStakePoolIdBech32 #
GYStakePoolIdBech32
which uses "bech32" format
>>>
Web.toUrlPiece $ stakePoolIdToBech32 spId
"pool1cjz6kg9a8ug9uk0nc59q60a67c2628ms58rd98gq587jwa2x5qt"