Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- data GYAddress
- addressToApi ∷ GYAddress → AddressAny
- addressToApi' ∷ GYAddress → AddressInEra ApiEra
- addressFromApi ∷ AddressAny → GYAddress
- addressFromApi' ∷ AddressInEra era → GYAddress
- addressToPlutus ∷ GYAddress → Address
- addressFromPlutus ∷ GYNetworkId → Address → Either PlutusToCardanoError GYAddress
- addressToPaymentCredential ∷ GYAddress → Maybe GYPaymentCredential
- addressToStakeCredential ∷ GYAddress → Maybe GYStakeCredential
- addressFromPubKeyHash ∷ GYNetworkId → GYPubKeyHash → GYAddress
- addressFromPaymentKeyHash ∷ GYNetworkId → GYPaymentKeyHash → GYAddress
- addressFromScript ∷ GYNetworkId → GYScript v → GYAddress
- addressFromValidator ∷ GYNetworkId → GYScript v → GYAddress
- addressFromCredential ∷ GYNetworkId → GYPaymentCredential → Maybe GYStakeCredential → GYAddress
- addressFromValidatorHash ∷ GYNetworkId → GYScriptHash → GYAddress
- addressFromScriptHash ∷ GYNetworkId → GYScriptHash → GYAddress
- addressFromSimpleScript ∷ GYNetworkId → GYSimpleScript → GYAddress
- addressToText ∷ GYAddress → Text
- addressFromTextMaybe ∷ Text → Maybe GYAddress
- unsafeAddressFromText ∷ Text → GYAddress
- addressToPubKeyHash ∷ GYAddress → Maybe GYPubKeyHash
- addressToValidatorHash ∷ GYAddress → Maybe GYScriptHash
- data GYAddressBech32
- addressToBech32 ∷ GYAddress → GYAddressBech32
- addressFromBech32 ∷ GYAddressBech32 → GYAddress
- data GYStakeAddress
- stakeAddressFromApi ∷ StakeAddress → GYStakeAddress
- stakeAddressToApi ∷ GYStakeAddress → StakeAddress
- stakeAddressFromTextMaybe ∷ Text → Maybe GYStakeAddress
- unsafeStakeAddressFromText ∷ Text → GYStakeAddress
- stakeAddressToText ∷ GYStakeAddress → Text
- stakeAddressCredential ∷ GYStakeAddress → GYStakeCredential
- stakeAddressToCredential ∷ GYStakeAddress → GYStakeCredential
- stakeAddressFromCredential ∷ GYNetworkId → GYStakeCredential → GYStakeAddress
- type GYStakeKeyHashString = String
- stakeKeyFromAddress ∷ GYAddress → Maybe GYStakeKeyHashString
- data GYStakeAddressBech32
- stakeAddressToBech32 ∷ GYStakeAddress → GYStakeAddressBech32
- stakeAddressFromBech32 ∷ GYStakeAddressBech32 → GYStakeAddress
Documentation
Addresses on the blockchain.
Instances
FromJSON GYAddress # | In JSON context addresses are represented in hex.
|
Defined in GeniusYield.Types.Address | |
ToJSON GYAddress # |
|
Generic GYAddress # | |
Show GYAddress # |
|
PrintfArg GYAddress # | This instance is using for logging
|
Defined in GeniusYield.Types.Address | |
FromField GYAddress # |
|
Defined in GeniusYield.Types.Address parseField ∷ Field → Parser GYAddress # | |
FromRecord GYAddress # |
|
Defined in GeniusYield.Types.Address | |
ToField GYAddress # |
|
Defined in GeniusYield.Types.Address | |
ToRecord GYAddress # |
|
Defined in GeniusYield.Types.Address | |
Eq GYAddress # | |
Ord GYAddress # | |
Defined in GeniusYield.Types.Address | |
Hashable GYAddress # | |
Defined in GeniusYield.Types.Address | |
FromHttpApiData GYAddress # |
|
Defined in GeniusYield.Types.Address | |
ToHttpApiData GYAddress # | In an HTTP context, addresses are represented in hex.
|
Defined in GeniusYield.Types.Address | |
ToParamSchema GYAddress # | |
Defined in GeniusYield.Types.Address toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYAddress → ParamSchema t # | |
ToSchema GYAddress # | |
Defined in GeniusYield.Types.Address | |
type Rep GYAddress # | |
Defined in GeniusYield.Types.Address type Rep GYAddress = D1 ('MetaData "GYAddress" "GeniusYield.Types.Address" "atlas-cardano-0.6.2-inplace" 'True) (C1 ('MetaCons "GYAddress" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressAny))) |
addressToApi ∷ GYAddress → AddressAny #
>>>
addressToApi addr
AddressShelley (ShelleyAddress Testnet (KeyHashObj (KeyHash {unKeyHash = "e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d"})) (StakeRefBase (KeyHashObj (KeyHash {unKeyHash = "1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"}))))>>>
addressToApi addrByron1
AddressByron (ByronAddress (Address {addrRoot = 04865e42d2373addbebd5d2acf81c760c848970142889f7ee763091b, addrAttributes = Attributes { data_ = AddrAttributes {aaVKDerivationPath = Nothing, aaNetworkMagic = NetworkMainOrStage} }, addrType = ATVerKey}))>>>
addressToApi addrByron2
AddressByron (ByronAddress (Address {addrRoot = 3f04ff82d3008d3a4f3d2be7d66141dcbcbda74d6a805e463895b72a, addrAttributes = Attributes { data_ = AddrAttributes {aaVKDerivationPath = Just (HDAddressPayload {getHDAddressPayload = "\251C\"a\SUB\209\210M\245S\200S\144\160\190\237y[s\176\148\n3!\DLE\147\141\168"}), aaNetworkMagic = NetworkMainOrStage} }, addrType = ATVerKey}))
addressFromApi' ∷ AddressInEra era → GYAddress #
addressToPlutus ∷ GYAddress → Address #
>>>
addressToPlutus addr
Address {addressCredential = PubKeyCredential e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d, addressStakingCredential = Just (StakingHash (PubKeyCredential 1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616))}
addressFromPlutus ∷ GYNetworkId → Address → Either PlutusToCardanoError GYAddress #
Used to inject wallet pubkeyhashes into addresses.
>>>
import GeniusYield.Types.NetworkId
>>>
addressFromPlutus GYTestnetPreprod $ addressToPlutus addr
Right (unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5")
addressToPaymentCredential ∷ GYAddress → Maybe GYPaymentCredential #
If an address is a shelley address, then we'll return payment credential wrapped in Just
, Nothing
otherwise.
>>>
addressToPaymentCredential addr
Just (GYPaymentCredentialByKey (GYPaymentKeyHash "e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d"))>>>
addressToPaymentCredential addrScript
Just (GYPaymentCredentialByScript (GYScriptHash "178155803bc461c5b0b371c779cb481ec7420df0c619cd9860e570d2"))>>>
addressToPaymentCredential addrByron1
Nothing>>>
addressToPaymentCredential addrByron2
Nothing
addressToStakeCredential ∷ GYAddress → Maybe GYStakeCredential #
If an address is a shelley address, then we'll return stake credential, if present, wrapped in Just
and Nothing
otherwise.
>>>
addressToStakeCredential addr
Just (GYStakeCredentialByKey (GYStakeKeyHash "1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"))>>>
addressToStakeCredential addrScript
Nothing>>>
addressToStakeCredential addrByron1
Nothing>>>
addressToStakeCredential addrByron2
Nothing
addressFromPubKeyHash ∷ GYNetworkId → GYPubKeyHash → GYAddress #
Deprecated: Use addressFromPaymentKeyHash.
Create address from GYPubKeyHash
.
note: no stake credential.
addressFromPaymentKeyHash ∷ GYNetworkId → GYPaymentKeyHash → GYAddress #
Create address from GYPaymentKeyHash
.
note: no stake credential.
addressFromScript ∷ GYNetworkId → GYScript v → GYAddress #
Create address from GYScript
.
note: no stake credential.
addressFromValidator ∷ GYNetworkId → GYScript v → GYAddress #
Create address from GYScript
.
note: no stake credential.
addressFromCredential ∷ GYNetworkId → GYPaymentCredential → Maybe GYStakeCredential → GYAddress #
Create an address from payment & optionally, a stake credential.
addressFromValidatorHash ∷ GYNetworkId → GYScriptHash → GYAddress #
Create address from GYScriptHash
.
note: no stake credential.
addressFromScriptHash ∷ GYNetworkId → GYScriptHash → GYAddress #
Create address from GYScriptHash
.
addressFromSimpleScript ∷ GYNetworkId → GYSimpleScript → GYAddress #
Create address from GYAnyScript
.
addressToText ∷ GYAddress → Text #
newtype wrapper
data GYAddressBech32 #
GYAddressBech32
which uses "bech32" format
>>>
Web.toUrlPiece $ addressToBech32 addr
"addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"
Instances
FromJSON GYAddressBech32 # |
|
Defined in GeniusYield.Types.Address | |
ToJSON GYAddressBech32 # |
|
Defined in GeniusYield.Types.Address | |
IsString GYAddressBech32 # | |
Defined in GeniusYield.Types.Address | |
Show GYAddressBech32 # | |
Defined in GeniusYield.Types.Address showsPrec ∷ Int → GYAddressBech32 → ShowS # show ∷ GYAddressBech32 → String # showList ∷ [GYAddressBech32] → ShowS # | |
PrintfArg GYAddressBech32 # | |
Eq GYAddressBech32 # | |
Defined in GeniusYield.Types.Address (==) ∷ GYAddressBech32 → GYAddressBech32 → Bool # (/=) ∷ GYAddressBech32 → GYAddressBech32 → Bool # | |
Ord GYAddressBech32 # | |
Defined in GeniusYield.Types.Address compare ∷ GYAddressBech32 → GYAddressBech32 → Ordering # (<) ∷ GYAddressBech32 → GYAddressBech32 → Bool # (<=) ∷ GYAddressBech32 → GYAddressBech32 → Bool # (>) ∷ GYAddressBech32 → GYAddressBech32 → Bool # (>=) ∷ GYAddressBech32 → GYAddressBech32 → Bool # | |
FromHttpApiData GYAddressBech32 # |
|
ToHttpApiData GYAddressBech32 # | |
FromField GYAddressBech32 # | |
Defined in GeniusYield.Types.Address | |
ToField GYAddressBech32 # | |
Defined in GeniusYield.Types.Address | |
ToParamSchema GYAddressBech32 # | |
Defined in GeniusYield.Types.Address toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYAddressBech32 → ParamSchema t # | |
ToSchema GYAddressBech32 # | |
Defined in GeniusYield.Types.Address |
Stake address.
data GYStakeAddress #
Stake Address.
Instances
FromJSON GYStakeAddress # | In JSON context, stake addresses are represented in hex.
|
Defined in GeniusYield.Types.Address | |
ToJSON GYStakeAddress # |
|
Defined in GeniusYield.Types.Address toJSON ∷ GYStakeAddress → Value # toEncoding ∷ GYStakeAddress → Encoding # toJSONList ∷ [GYStakeAddress] → Value # toEncodingList ∷ [GYStakeAddress] → Encoding # omitField ∷ GYStakeAddress → Bool # | |
Generic GYStakeAddress # | |
Defined in GeniusYield.Types.Address type Rep GYStakeAddress ∷ Type → Type # from ∷ GYStakeAddress → Rep GYStakeAddress x # to ∷ Rep GYStakeAddress x → GYStakeAddress # | |
Show GYStakeAddress # | |
Defined in GeniusYield.Types.Address showsPrec ∷ Int → GYStakeAddress → ShowS # show ∷ GYStakeAddress → String # showList ∷ [GYStakeAddress] → ShowS # | |
PrintfArg GYStakeAddress # | This instance is using for logging
|
Defined in GeniusYield.Types.Address | |
FromField GYStakeAddress # |
|
Defined in GeniusYield.Types.Address | |
FromRecord GYStakeAddress # |
|
Defined in GeniusYield.Types.Address | |
ToField GYStakeAddress # |
|
Defined in GeniusYield.Types.Address toField ∷ GYStakeAddress → Field # | |
ToRecord GYStakeAddress # |
|
Defined in GeniusYield.Types.Address | |
Eq GYStakeAddress # | |
Defined in GeniusYield.Types.Address (==) ∷ GYStakeAddress → GYStakeAddress → Bool # (/=) ∷ GYStakeAddress → GYStakeAddress → Bool # | |
Ord GYStakeAddress # | |
Defined in GeniusYield.Types.Address compare ∷ GYStakeAddress → GYStakeAddress → Ordering # (<) ∷ GYStakeAddress → GYStakeAddress → Bool # (<=) ∷ GYStakeAddress → GYStakeAddress → Bool # (>) ∷ GYStakeAddress → GYStakeAddress → Bool # (>=) ∷ GYStakeAddress → GYStakeAddress → Bool # | |
Hashable GYStakeAddress # | |
Defined in GeniusYield.Types.Address hashWithSalt ∷ Int → GYStakeAddress → Int # hash ∷ GYStakeAddress → Int # | |
FromHttpApiData GYStakeAddress # |
|
ToHttpApiData GYStakeAddress # | In an HTTP context, stake addresses are represented in hex.
|
ToParamSchema GYStakeAddress # | |
Defined in GeniusYield.Types.Address toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYStakeAddress → ParamSchema t # | |
ToSchema GYStakeAddress # | |
Defined in GeniusYield.Types.Address | |
type Rep GYStakeAddress # | |
Defined in GeniusYield.Types.Address type Rep GYStakeAddress = D1 ('MetaData "GYStakeAddress" "GeniusYield.Types.Address" "atlas-cardano-0.6.2-inplace" 'True) (C1 ('MetaCons "GYStakeAddress" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 StakeAddress))) |
stakeAddressFromApi ∷ StakeAddress → GYStakeAddress #
Get GY
type from corresponding type in cardano-api
library.
stakeAddressToApi ∷ GYStakeAddress → StakeAddress #
Convert GY
type to corresponding type in cardano-api
library.
stakeAddressFromTextMaybe ∷ Text → Maybe GYStakeAddress #
Obtain GYStakeAddress
from bech32 encoding of stake address.
>>>
stakeAddressFromTextMaybe "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"
Just (unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3")>>>
stakeAddressFromTextMaybe "e07a77d120b9e86addc7388dbbb1bd2350490b7d140ab234038632334d"
Nothing
unsafeStakeAddressFromText ∷ Text → GYStakeAddress #
Like stakeAddressFromTextMaybe
but errors on Nothing
case.
stakeAddressToText ∷ GYStakeAddress → Text #
Serialises GYStakeAddress
to it's bech32 representation.
>>>
stakeAddressToText stakeAddr
"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"
stakeAddressCredential ∷ GYStakeAddress → GYStakeCredential #
Deprecated: Use stakeAddressToCredential.
Get a stake credential from a stake address. This drops the network information.
stakeAddressToCredential ∷ GYStakeAddress → GYStakeCredential #
Get a stake credential from a stake address. This drops the network information.
stakeAddressFromCredential ∷ GYNetworkId → GYStakeCredential → GYStakeAddress #
Get a stake address from a stake credential. This also requires network information.
>>>
stakeAddr == stakeAddressFromCredential GYTestnetPreprod (stakeAddressToCredential stakeAddr)
True
type GYStakeKeyHashString = String #
stakeKeyFromAddress ∷ GYAddress → Maybe GYStakeKeyHashString #
>>>
stakeKeyFromAddress addr
Just "1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"
newtype wrapper
data GYStakeAddressBech32 #
GYStakeAddressBech32
which uses "bech32" format
>>>
Web.toUrlPiece $ stakeAddressToBech32 stakeAddr
"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"