morley-0.2.0.1: Developer tools for the Michelson Language

Safe HaskellNone
LanguageHaskell2010

Tezos.Address

Contents

Description

Address in Tezos.

Synopsis

Documentation

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 !ByteString

KT address which corresponds to a callable contract. It's a hash of origination command. TODO: we should probably have a Hash type.

Instances
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

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

Buildable Address Source # 
Instance details

Defined in Tezos.Address

Methods

build :: Address -> Builder #

FromCVal Address Source # 
Instance details

Defined in Michelson.Typed.CValue

ToCVal Address Source # 
Instance details

Defined in Michelson.Typed.CValue

FromVal Address Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

fromVal :: Val instr (ToT Address) -> Address Source #

ToVal Address Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

toVal :: Address -> Val instr (ToT Address) Source #

mkKeyAddress :: PublicKey -> Address Source #

Smart constructor for KeyAddress.

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

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.