atlas-cardano-0.6.2: Application backend for Plutus smart contracts on Cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainer[email protected]
Stabilitydevelop
Safe HaskellSafe-Inferred
LanguageGHC2021

GeniusYield.Types.Address

Description

 
Synopsis

Documentation

data GYAddress #

Addresses on the blockchain.

Instances

Instances details
FromJSON GYAddress #

In JSON context addresses are represented in hex.

>>> Aeson.decode @GYAddress "\"00e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616\""
Just (unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5")
Instance details

Defined in GeniusYield.Types.Address

ToJSON GYAddress #
>>> LBS8.putStrLn $ Aeson.encode addr
"00e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"
Instance details

Defined in GeniusYield.Types.Address

Generic GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Associated Types

type Rep GYAddressTypeType #

Methods

fromGYAddressRep GYAddress x #

toRep GYAddress x → GYAddress #

Show GYAddress #
>>> let addr = unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"
Instance details

Defined in GeniusYield.Types.Address

Methods

showsPrecIntGYAddressShowS #

showGYAddressString #

showList ∷ [GYAddress] → ShowS #

PrintfArg GYAddress #

This instance is using for logging

>>> Printf.printf "addr = %s" addr
addr = addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5
Instance details

Defined in GeniusYield.Types.Address

FromField GYAddress #
>>> Csv.runParser $ Csv.parseField @GYAddress "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"
Right (unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5")
>>> Csv.runParser $ Csv.parseField @GYAddress "not an address"
Left "Not an address: not an address"
Instance details

Defined in GeniusYield.Types.Address

FromRecord GYAddress #
>>> Csv.decode @GYAddress Csv.NoHeader "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5\n"
Right [unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"]
>>> Csv.decode @GYAddress Csv.NoHeader "not an address\n"
Left "parse error (Failed reading: conversion error: Not an address: not an address) at \"\\n\""
>>> Csv.decode @GYAddress Csv.NoHeader "not, an, address\n"
Left "parse error (Failed reading: conversion error: expected exactly one field, but got: [\"not\",\" an\",\" address\"]) at \"\\n\""
Instance details

Defined in GeniusYield.Types.Address

ToField GYAddress #
>>> Csv.toField $ unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"
"addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"
Instance details

Defined in GeniusYield.Types.Address

Methods

toFieldGYAddressField #

ToRecord GYAddress #
>>> Csv.encodeWith (Csv.defaultEncodeOptions {Csv.encUseCrLf = False}) [unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"]
"addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5\n"
Instance details

Defined in GeniusYield.Types.Address

Methods

toRecordGYAddressRecord #

Eq GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Methods

(==)GYAddressGYAddressBool #

(/=)GYAddressGYAddressBool #

Ord GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Hashable GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Methods

hashWithSaltIntGYAddressInt #

hashGYAddressInt #

FromHttpApiData GYAddress #
>>> Web.parseUrlPiece @GYAddress "00e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"
Right (unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5")
>>> Web.parseUrlPiece @GYAddress "00"
Left "Not an address: 00; Reason: RawBytesHexErrorRawBytesDecodeFail \"00\" AddressAny (SerialiseAsRawBytesError {unSerialiseAsRawBytesError = \"Unable to deserialise AddressAny\"})"
Instance details

Defined in GeniusYield.Types.Address

ToHttpApiData GYAddress #

In an HTTP context, addresses are represented in hex.

>>> Web.toUrlPiece addr
"00e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"
Instance details

Defined in GeniusYield.Types.Address

ToParamSchema GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Methods

toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYAddressParamSchema t #

ToSchema GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

type Rep GYAddress # 
Instance details

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 ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressAny)))

addressToApiGYAddressAddressAny #

>>> 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}))

addressToPlutusGYAddressAddress #

>>> addressToPlutus addr
Address {addressCredential = PubKeyCredential e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d, addressStakingCredential = Just (StakingHash (PubKeyCredential 1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616))}

addressFromPlutusGYNetworkIdAddressEither PlutusToCardanoError GYAddress #

Used to inject wallet pubkeyhashes into addresses.

>>> import GeniusYield.Types.NetworkId
>>> addressFromPlutus GYTestnetPreprod $ addressToPlutus addr
Right (unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5")

addressToPaymentCredentialGYAddressMaybe 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

addressToStakeCredentialGYAddressMaybe 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

addressFromPubKeyHashGYNetworkIdGYPubKeyHashGYAddress #

Deprecated: Use addressFromPaymentKeyHash.

Create address from GYPubKeyHash.

note: no stake credential.

addressFromPaymentKeyHashGYNetworkIdGYPaymentKeyHashGYAddress #

Create address from GYPaymentKeyHash.

note: no stake credential.

addressFromScriptGYNetworkIdGYScript v → GYAddress #

Create address from GYScript.

note: no stake credential.

addressFromValidatorGYNetworkIdGYScript v → GYAddress #

Create address from GYScript.

note: no stake credential.

addressFromCredentialGYNetworkIdGYPaymentCredentialMaybe GYStakeCredentialGYAddress #

Create an address from payment & optionally, a stake credential.

addressFromValidatorHashGYNetworkIdGYScriptHashGYAddress #

Create address from GYScriptHash.

note: no stake credential.

newtype wrapper

data GYAddressBech32 #

GYAddressBech32 which uses "bech32" format

>>> Web.toUrlPiece $ addressToBech32 addr
"addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"

Instances

Instances details
FromJSON GYAddressBech32 #
>>> Aeson.decode @GYAddressBech32 "\"addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5\""
Just (unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5")
Instance details

Defined in GeniusYield.Types.Address

ToJSON GYAddressBech32 #
>>> LBS8.putStrLn $ Aeson.encode $ addressToBech32 addr
"addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"
Instance details

Defined in GeniusYield.Types.Address

IsString GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Show GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

PrintfArg GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Eq GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Ord GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

FromHttpApiData GYAddressBech32 #
>>> Web.parseUrlPiece @GYAddressBech32 "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5"
Right (unsafeAddressFromText "addr_test1qrsuhwqdhz0zjgnf46unas27h93amfghddnff8lpc2n28rgmjv8f77ka0zshfgssqr5cnl64zdnde5f8q2xt923e7ctqu49mg5")
Instance details

Defined in GeniusYield.Types.Address

ToHttpApiData GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

FromField GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

ToField GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

ToParamSchema GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

ToSchema GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Stake address.

data GYStakeAddress #

Stake Address.

Instances

Instances details
FromJSON GYStakeAddress #

In JSON context, stake addresses are represented in hex.

>>> Aeson.decode @GYStakeAddress "\"e07a77d120b9e86addc7388dbbb1bd2350490b7d140ab234038632334d\""
Just (unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3")
Instance details

Defined in GeniusYield.Types.Address

ToJSON GYStakeAddress #
>>> LBS8.putStrLn $ Aeson.encode stakeAddr
"e07a77d120b9e86addc7388dbbb1bd2350490b7d140ab234038632334d"
Instance details

Defined in GeniusYield.Types.Address

Generic GYStakeAddress # 
Instance details

Defined in GeniusYield.Types.Address

Associated Types

type Rep GYStakeAddressTypeType #

Show GYStakeAddress # 
Instance details

Defined in GeniusYield.Types.Address

PrintfArg GYStakeAddress #

This instance is using for logging

>>> Printf.printf "stake addr = %s" stakeAddr
stake addr = stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3
Instance details

Defined in GeniusYield.Types.Address

FromField GYStakeAddress #
>>> Csv.runParser $ Csv.parseField @GYStakeAddress "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"
Right (unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3")
>>> Csv.runParser $ Csv.parseField @GYStakeAddress "not a stake address"
Left "Not a stake address: not a stake address"
Instance details

Defined in GeniusYield.Types.Address

FromRecord GYStakeAddress #
>>> Csv.decode @GYStakeAddress Csv.NoHeader "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3\n"
Right [unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"]
>>> Csv.decode @GYStakeAddress Csv.NoHeader "not a stake address\n"
Left "parse error (Failed reading: conversion error: Not a stake address: not a stake address) at \"\\n\""
>>> Csv.decode @GYStakeAddress Csv.NoHeader "not, a, stake address\n"
Left "parse error (Failed reading: conversion error: expected exactly one field, but got: [\"not\",\" a\",\" stake address\"]) at \"\\n\""
Instance details

Defined in GeniusYield.Types.Address

ToField GYStakeAddress #
>>> Csv.toField stakeAddr
"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"
Instance details

Defined in GeniusYield.Types.Address

Methods

toFieldGYStakeAddressField #

ToRecord GYStakeAddress #
>>> Csv.encodeWith (Csv.defaultEncodeOptions {Csv.encUseCrLf = False}) [stakeAddr]
"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3\n"
Instance details

Defined in GeniusYield.Types.Address

Eq GYStakeAddress # 
Instance details

Defined in GeniusYield.Types.Address

Ord GYStakeAddress # 
Instance details

Defined in GeniusYield.Types.Address

Hashable GYStakeAddress # 
Instance details

Defined in GeniusYield.Types.Address

FromHttpApiData GYStakeAddress #
>>> Web.parseUrlPiece @GYStakeAddress "e07a77d120b9e86addc7388dbbb1bd2350490b7d140ab234038632334d"
Right (unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3")
>>> Web.parseUrlPiece @GYStakeAddress "00"
Left "Not a stake address: 00; Reason: RawBytesHexErrorRawBytesDecodeFail \"00\" StakeAddress (SerialiseAsRawBytesError {unSerialiseAsRawBytesError = \"Unable to deserialise StakeAddress\"})"
Instance details

Defined in GeniusYield.Types.Address

ToHttpApiData GYStakeAddress #

In an HTTP context, stake addresses are represented in hex.

>>> Web.toUrlPiece stakeAddr
"e07a77d120b9e86addc7388dbbb1bd2350490b7d140ab234038632334d"
Instance details

Defined in GeniusYield.Types.Address

ToParamSchema GYStakeAddress # 
Instance details

Defined in GeniusYield.Types.Address

ToSchema GYStakeAddress # 
Instance details

Defined in GeniusYield.Types.Address

type Rep GYStakeAddress # 
Instance details

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 ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 StakeAddress)))

stakeAddressFromApiStakeAddressGYStakeAddress #

Get GY type from corresponding type in cardano-api library.

stakeAddressToApiGYStakeAddressStakeAddress #

Convert GY type to corresponding type in cardano-api library.

stakeAddressFromTextMaybeTextMaybe GYStakeAddress #

Obtain GYStakeAddress from bech32 encoding of stake address.

>>> stakeAddressFromTextMaybe "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"
Just (unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3")
>>> stakeAddressFromTextMaybe "e07a77d120b9e86addc7388dbbb1bd2350490b7d140ab234038632334d"
Nothing

stakeAddressToTextGYStakeAddressText #

Serialises GYStakeAddress to it's bech32 representation.

>>> stakeAddressToText stakeAddr
"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"

stakeAddressCredentialGYStakeAddressGYStakeCredential #

Deprecated: Use stakeAddressToCredential.

Get a stake credential from a stake address. This drops the network information.

stakeAddressToCredentialGYStakeAddressGYStakeCredential #

Get a stake credential from a stake address. This drops the network information.

stakeAddressFromCredentialGYNetworkIdGYStakeCredentialGYStakeAddress #

Get a stake address from a stake credential. This also requires network information.

>>> stakeAddr == stakeAddressFromCredential GYTestnetPreprod (stakeAddressToCredential stakeAddr)
True

stakeKeyFromAddressGYAddressMaybe GYStakeKeyHashString #

>>> stakeKeyFromAddress addr
Just "1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"

newtype wrapper

data GYStakeAddressBech32 #

GYStakeAddressBech32 which uses "bech32" format

>>> Web.toUrlPiece $ stakeAddressToBech32 stakeAddr
"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"

Instances

Instances details
FromJSON GYStakeAddressBech32 #
>>> Aeson.decode @GYStakeAddressBech32 "\"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3\""
Just (unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3")
Instance details

Defined in GeniusYield.Types.Address

ToJSON GYStakeAddressBech32 #
>>> LBS8.putStrLn $ Aeson.encode $ stakeAddressToBech32 stakeAddr
"stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"
Instance details

Defined in GeniusYield.Types.Address

IsString GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Show GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

PrintfArg GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Eq GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Ord GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

FromHttpApiData GYStakeAddressBech32 #
>>> Web.parseUrlPiece @GYStakeAddressBech32 "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3"
Right (unsafeStakeAddressFromText "stake_test1upa805fqh85x4hw88zxmhvdaydgyjzmazs9tydqrscerxnghfq4t3")
Instance details

Defined in GeniusYield.Types.Address

ToHttpApiData GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

FromField GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

ToField GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

ToParamSchema GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

ToSchema GYStakeAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address