| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Tezos.Address
Contents
Description
Address in Tezos.
Synopsis
- newtype ContractHash = ContractHash ByteString
- data Address
- mkKeyAddress :: PublicKey -> Address
- detGenKeyAddress :: ByteString -> Address
- mkContractAddressRaw :: ByteString -> Address
- mkContractHashRaw :: ByteString -> ContractHash
- data ParseAddressError
- data ParseContractAddressError
- formatAddress :: Address -> Text
- mformatAddress :: Address -> MText
- parseAddress :: Text -> Either ParseAddressError Address
- unsafeParseAddress :: HasCallStack => Text -> Address
- unsafeParseContractHash :: HasCallStack => Text -> ContractHash
Documentation
newtype ContractHash Source #
Hash of origination command for some contract.
Constructors
| ContractHash ByteString |
Instances
Data type corresponding to address structure in Tezos.
Constructors
| KeyAddress !KeyHash |
|
| ContractAddress !ContractHash |
|
Instances
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.
mkContractHashRaw :: ByteString -> ContractHash Source #
Create a dummy ContractHash value.
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
| Eq ParseAddressError Source # | |
Defined in Tezos.Address Methods (==) :: ParseAddressError -> ParseAddressError -> Bool # (/=) :: ParseAddressError -> ParseAddressError -> Bool # | |
| Show ParseAddressError Source # | |
Defined in Tezos.Address Methods showsPrec :: Int -> ParseAddressError -> ShowS # show :: ParseAddressError -> String # showList :: [ParseAddressError] -> ShowS # | |
| Buildable ParseAddressError Source # | |
Defined in Tezos.Address Methods build :: ParseAddressError -> Builder # | |
data ParseContractAddressError Source #
Instances
| Eq ParseContractAddressError Source # | |
Defined in Tezos.Address Methods (==) :: ParseContractAddressError -> ParseContractAddressError -> Bool # (/=) :: ParseContractAddressError -> ParseContractAddressError -> Bool # | |
| Show ParseContractAddressError Source # | |
Defined in Tezos.Address Methods showsPrec :: Int -> ParseContractAddressError -> ShowS # show :: ParseContractAddressError -> String # showList :: [ParseContractAddressError] -> ShowS # | |
| Buildable ParseContractAddressError Source # | |
Defined in Tezos.Address Methods | |
formatAddress :: Address -> Text Source #
mformatAddress :: Address -> MText 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.
unsafeParseContractHash :: HasCallStack => Text -> ContractHash Source #
Parse a TK contract address, fail if address does not match
the expected format.