morley-1.2.0: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Tezos.Address

Contents

Description

Address in Tezos.

Synopsis

Documentation

newtype ContractHash Source #

Hash of origination command for some contract.

Constructors

ContractHash ByteString 

Instances

Instances details
Eq ContractHash Source # 
Instance details

Defined in Tezos.Address

Ord ContractHash Source # 
Instance details

Defined in Tezos.Address

Show ContractHash Source # 
Instance details

Defined in Tezos.Address

Generic ContractHash Source # 
Instance details

Defined in Tezos.Address

Associated Types

type Rep ContractHash :: Type -> Type #

ToJSON ContractHash Source # 
Instance details

Defined in Tezos.Address

ToJSONKey ContractHash Source # 
Instance details

Defined in Tezos.Address

FromJSON ContractHash Source # 
Instance details

Defined in Tezos.Address

FromJSONKey ContractHash Source # 
Instance details

Defined in Tezos.Address

NFData ContractHash Source # 
Instance details

Defined in Tezos.Address

Methods

rnf :: ContractHash -> () #

type Rep ContractHash Source # 
Instance details

Defined in Tezos.Address

type Rep ContractHash = D1 ('MetaData "ContractHash" "Tezos.Address" "morley-1.2.0-GFTR6HhJxtXGRHqcKAr6TU" 'True) (C1 ('MetaCons "ContractHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

data Address Source #

Data type corresponding to address structure in Tezos.

Constructors

KeyAddress KeyHash

tz address which is a hash of a public key.

ContractAddress ContractHash

KT address which corresponds to a callable contract.

Instances

Instances details
Eq Address Source # 
Instance details

Defined in Tezos.Address

Methods

(==) :: Address -> Address -> Bool #

(/=) :: Address -> Address -> Bool #

Ord Address Source # 
Instance details

Defined in Tezos.Address

Show Address Source # 
Instance details

Defined in Tezos.Address

Generic Address Source # 
Instance details

Defined in Tezos.Address

Associated Types

type Rep Address :: Type -> Type #

Methods

from :: Address -> Rep Address x #

to :: Rep Address x -> Address #

Arbitrary Address Source # 
Instance details

Defined in Tezos.Address

ToJSON Address Source # 
Instance details

Defined in Tezos.Address

ToJSONKey Address Source # 
Instance details

Defined in Tezos.Address

FromJSON Address Source # 
Instance details

Defined in Tezos.Address

FromJSONKey Address Source # 
Instance details

Defined in Tezos.Address

NFData Address Source # 
Instance details

Defined in Tezos.Address

Methods

rnf :: Address -> () #

Buildable Address Source # 
Instance details

Defined in Tezos.Address

Methods

build :: Address -> Builder #

HasCLReader Address Source # 
Instance details

Defined in Tezos.Address

IsoValue Address Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Address :: T Source #

TypeHasDoc Address Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type Rep Address Source # 
Instance details

Defined in Tezos.Address

type Rep Address = D1 ('MetaData "Address" "Tezos.Address" "morley-1.2.0-GFTR6HhJxtXGRHqcKAr6TU" 'False) (C1 ('MetaCons "KeyAddress" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 KeyHash)) :+: C1 ('MetaCons "ContractAddress" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ContractHash)))
type ToT Address Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

mkKeyAddress :: PublicKey -> Address Source #

Smart constructor for KeyAddress.

detGenKeyAddress :: ByteString -> Address Source #

Deterministically generate a random KeyAddress and discard its secret key.

mkContractAddressRaw :: ByteString -> Address Source #

Smart constructor for ContractAddress. Its argument is serialized origination operation.

Note: it's quite unsafe to pass ByteString, because we can pass some garbage which is not a serialized origination operation, but this operation includes contract itself and necessary types are defined in *. So we have to serialize this data outside this module and pass it here as a ByteString. Alternatively we could add some constraint, but it would be almost as unsafe as passing a ByteString. For this reason we add Raw suffix to this function and provide a safer function in Instr. We may reconsider it later.

Formatting

data ParseAddressError Source #

Errors that can happen during address parsing.

Constructors

ParseAddressWrongBase58Check

Address is not in Base58Check format.

ParseAddressBothFailed CryptoParseError ParseContractAddressError

Both address parsers failed with some error.

Instances

Instances details
Eq ParseAddressError Source # 
Instance details

Defined in Tezos.Address

Show ParseAddressError Source # 
Instance details

Defined in Tezos.Address

Generic ParseAddressError Source # 
Instance details

Defined in Tezos.Address

Associated Types

type Rep ParseAddressError :: Type -> Type #

NFData ParseAddressError Source # 
Instance details

Defined in Tezos.Address

Methods

rnf :: ParseAddressError -> () #

Buildable ParseAddressError Source # 
Instance details

Defined in Tezos.Address

type Rep ParseAddressError Source # 
Instance details

Defined in Tezos.Address

type Rep ParseAddressError = D1 ('MetaData "ParseAddressError" "Tezos.Address" "morley-1.2.0-GFTR6HhJxtXGRHqcKAr6TU" 'False) (C1 ('MetaCons "ParseAddressWrongBase58Check" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ParseAddressBothFailed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CryptoParseError) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ParseContractAddressError)))

data ParseContractAddressError Source #

Instances

Instances details
Eq ParseContractAddressError Source # 
Instance details

Defined in Tezos.Address

Show ParseContractAddressError Source # 
Instance details

Defined in Tezos.Address

Generic ParseContractAddressError Source # 
Instance details

Defined in Tezos.Address

Associated Types

type Rep ParseContractAddressError :: Type -> Type #

NFData ParseContractAddressError Source # 
Instance details

Defined in Tezos.Address

Buildable ParseContractAddressError Source # 
Instance details

Defined in Tezos.Address

type Rep ParseContractAddressError Source # 
Instance details

Defined in Tezos.Address

type Rep ParseContractAddressError = D1 ('MetaData "ParseContractAddressError" "Tezos.Address" "morley-1.2.0-GFTR6HhJxtXGRHqcKAr6TU" 'False) (C1 ('MetaCons "ParseContractAddressWrongBase58Check" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ParseContractAddressWrongTag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "ParseContractAddressWrongSize" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

parseAddress :: Text -> Either ParseAddressError Address Source #

Parse an address from its human-readable textual representation used by Tezos (e. g. "tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU"). Or fail if it's invalid.

unsafeParseAddress :: HasCallStack => Text -> Address Source #

Partial version of parseAddress which assumes that the address is correct. Can be used in tests.

unsafeParseContractHash :: HasCallStack => Text -> ContractHash Source #

Parse a TK contract address, fail if address does not match the expected format.