Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
Instances
Data type corresponding to address structure in Tezos.
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.
ParseAddressWrongBase58Check | Address is not in Base58Check format. |
ParseAddressBothFailed CryptoParseError ParseContractAddressError | Both address parsers failed with some error. |
Instances
data ParseContractAddressError Source #
Instances
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.