Safe Haskell | None |
---|---|
Language | Haskell2010 |
Address in Tezos.
Synopsis
- data Address
- mkKeyAddress :: PublicKey -> Address
- mkContractAddressRaw :: ByteString -> Address
- formatAddress :: Address -> Text
- parseAddress :: Text -> Either ParseAddressError Address
- unsafeParseAddress :: HasCallStack => Text -> Address
Documentation
Data type corresponding to address structure in Tezos.
KeyAddress !KeyHash |
|
ContractAddress !ByteString |
|
Instances
Eq Address Source # | |
Ord Address Source # | |
Show Address Source # | |
Arbitrary Address Source # | |
ToJSON Address Source # | |
Defined in Tezos.Address | |
ToJSONKey Address Source # | |
Defined in Tezos.Address | |
FromJSON Address Source # | |
FromJSONKey Address Source # | |
Defined in Tezos.Address | |
Buildable Address Source # | |
Defined in Tezos.Address | |
FromCVal Address Source # | |
ToCVal Address Source # | |
FromVal Address Source # | |
ToVal 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
formatAddress :: Address -> Text Source #
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.