atlas-0.1.0.0: Application backend for Plutus smart contracts on Cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainersupport@geniusyield.co
Stabilitydevelop
Safe HaskellNone
LanguageHaskell2010

GeniusYield.Types.Address

Description

 
Synopsis

Documentation

data GYAddress #

Addresses on the blockchain.

Instances

Instances details
Eq GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Methods

(==)GYAddressGYAddressBool #

(/=)GYAddressGYAddressBool #

Ord GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

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

Defined in GeniusYield.Types.Address

Methods

showsPrecIntGYAddressShowS #

showGYAddressString #

showList ∷ [GYAddress] → ShowS #

Generic GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Associated Types

type Rep GYAddressTypeType #

Methods

fromGYAddressRep GYAddress x #

toRep GYAddress x → GYAddress #

PrintfArg GYAddress #

This instance is using for logging

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

Defined in GeniusYield.Types.Address

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

Methods

parseJSON ∷ Value → Parser GYAddress #

parseJSONList ∷ Value → Parser [GYAddress] #

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

Defined in GeniusYield.Types.Address

Methods

toJSONGYAddress → Value #

toEncodingGYAddress → Encoding #

toJSONList ∷ [GYAddress] → Value #

toEncodingList ∷ [GYAddress] → Encoding #

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

Defined in GeniusYield.Types.Address

Methods

toFieldGYAddress → Field

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\""
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

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

Methods

parseField ∷ Field → Parser GYAddress

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

Methods

parseRecord ∷ Record → Parser GYAddress

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

Defined in GeniusYield.Types.Address

Methods

toRecordGYAddress → Record

ToParamSchema GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Methods

toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYAddress → ParamSchema t

ToSchema GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

Methods

declareNamedSchemaProxy GYAddress → Declare (Definitions Schema) NamedSchema

type Rep GYAddress # 
Instance details

Defined in GeniusYield.Types.Address

type Rep GYAddress = D1 ('MetaData "GYAddress" "GeniusYield.Types.Address" "atlas-0.1.0.0-inplace" 'True) (C1 ('MetaCons "GYAddress" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressAny)))

addressToApiGYAddress → AddressAny #

>>> addressToApi addr
AddressShelley (ShelleyAddress Testnet (KeyHashObj (KeyHash "e1cbb80db89e292269aeb93ec15eb963dda5176b66949fe1c2a6a38d")) (StakeRefBase (KeyHashObj (KeyHash "1b930e9f7add78a174a21000e989ff551366dcd127028cb2aa39f616"))))

addressToApi'GYAddress → AddressInEra BabbageEra #

addressFromApi ∷ AddressAny → GYAddress #

addressFromApi' ∷ AddressInEra era → GYAddress #

addressToPlutusGYAddress → Address #

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

addressFromPlutusGYNetworkId → Address → Either PlutusToCardanoError GYAddress #

Used to inject wallet pubkeyhashes into addresses.

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

addressFromPubKeyHashGYNetworkIdGYPubKeyHashGYAddress #

Create address from GYPubKeyHash.

note: no stake credential.

addressFromValidatorGYNetworkIdGYValidator v → GYAddress #

Create address from GYValidator.

note: no stake credential.

addressFromValidatorHashGYNetworkIdGYValidatorHashGYAddress #

Create address from GYValidatorHash.

note: no stake credential.

newtype wrapper

data GYAddressBech32 #

GYAddress which uses "serialized" format

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

Instances

Instances details
Show GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

IsString GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

PrintfArg GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

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

Defined in GeniusYield.Types.Address

Methods

parseJSON ∷ Value → Parser GYAddressBech32 #

parseJSONList ∷ Value → Parser [GYAddressBech32] #

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

Defined in GeniusYield.Types.Address

Methods

toJSONGYAddressBech32 → Value #

toEncodingGYAddressBech32 → Encoding #

toJSONList ∷ [GYAddressBech32] → Value #

toEncodingList ∷ [GYAddressBech32] → Encoding #

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

Methods

fromField ∷ FieldParser GYAddressBech32

ToField GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Methods

toFieldGYAddressBech32 → Action

ToParamSchema GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Methods

toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYAddressBech32 → ParamSchema t

ToSchema GYAddressBech32 # 
Instance details

Defined in GeniusYield.Types.Address

Methods

declareNamedSchemaProxy GYAddressBech32 → Declare (Definitions Schema) NamedSchema

stakeKeyFromAddressGYAddressMaybe GYStakeKeyHash #

Extract stakeKey Hash from Address