| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Morley.Tezos.Address
Contents
Description
Address in Tezos.
Synopsis
- type ContractHash = Hash 'HashKindContract
- data Address
- newtype TxRollupL2Address = TxRollupL2Address KeyHashL2
- mkKeyAddress :: PublicKey -> Address
- detGenKeyAddress :: ByteString -> Address
- isKeyAddress :: Address -> Bool
- newtype GlobalCounter = GlobalCounter {}
- mkContractHashHack :: ByteString -> ContractHash
- data ParseAddressError
- data ParseAddressRawError
- formatAddress :: Address -> Text
- mformatAddress :: Address -> MText
- parseAddressRaw :: ByteString -> Either ParseAddressRawError Address
- parseAddress :: Text -> Either ParseAddressError Address
- ta :: QuasiQuoter
Documentation
type ContractHash = Hash 'HashKindContract Source #
Convenience synonym for a contract hash.
Data type corresponding to address structure in Tezos.
Constructors
| KeyAddress KeyHash |
|
| ContractAddress ContractHash |
|
| TransactionRollupAddress TxRollupHash |
|
Instances
newtype TxRollupL2Address Source #
tz4 level-2 public key hash address, used with transaction rollups, corresponds
to tx_rollup_l2_address Michelson type.
Constructors
| TxRollupL2Address KeyHashL2 |
Instances
mkKeyAddress :: PublicKey -> Address Source #
Smart constructor for KeyAddress.
detGenKeyAddress :: ByteString -> Address Source #
Deterministically generate a random KeyAddress and discard its
secret key.
isKeyAddress :: Address -> Bool Source #
Returns True if given address is implicit.
newtype GlobalCounter Source #
Represents the network's global counter.
We store the current value of this counter in the operation at the time of its creation for the following reasons: * to guarantee the uniqueness of contract addresses upon origination (see 'Morley.Michelson.Typed.Operation.mkContractAddress) * to prevent replay attacks by checking that an operation with the same counter value con't be performed twice.
The counter is incremented after every operation execution and interpretation of instructions
CREATE_CONTRACT and TRANSFER_TOKENS, and thus ensures that these addresses are unique
(i.e. origination of identical contracts with identical metadata will result in
different addresses.)
Our counter is represented as Word64, while in Tezos it is unbounded. We believe that
for our interpreter it should not matter.
Constructors
| GlobalCounter | |
Fields | |
Instances
mkContractHashHack :: ByteString -> ContractHash Source #
Create a dummy ContractHash value by hashing given ByteString.
Use in tests **only**.
Formatting
data ParseAddressError Source #
Errors that can happen during address parsing.
Constructors
| ParseAddressWrongBase58Check | Address is not in Base58Check format. |
| ParseAddressAllFailed (NonEmpty CryptoParseError) | All address parsers failed with some error. |
Instances
data ParseAddressRawError Source #
Constructors
| ParseAddressRawWrongSize ByteString | Raw bytes representation of an address has invalid length. |
| ParseAddressRawInvalidPrefix ByteString | Raw bytes representation of an address has incorrect prefix. |
| ParseAddressRawMalformedSeparator ByteString | Raw bytes representation of an address does not end with "00". |
Instances
formatAddress :: Address -> Text Source #
mformatAddress :: Address -> MText Source #
parseAddressRaw :: ByteString -> Either ParseAddressRawError Address Source #
Parse the given address in its raw byte form used by Tezos (e.g "01521139f84791537d54575df0c74a8084cc68861c00")) . Or fail otherwise if it's invalid.
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.
ta :: QuasiQuoter Source #
QuasyQuoter for constructing Tezos addresses.
Validity of result will be checked at compile time.