Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Abstraction layer for octez-client
functionality.
We use it to fake octez-client
in tests.
Synopsis
- class Monad m => HasTezosClient m where
- signBytes :: ImplicitAddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> m Signature
- genKey :: ImplicitAlias -> m ImplicitAddress
- genFreshKey :: ImplicitAlias -> m ImplicitAddress
- revealKey :: ImplicitAlias -> Maybe ScrubbedBytes -> m ()
- rememberContract :: AliasBehavior -> ContractAddress -> ContractAlias -> m ()
- getAliasesAndAddresses :: m [(Text, Text)]
- getKeyPassword :: ImplicitAddress -> m (Maybe ScrubbedBytes)
- data AliasBehavior
Documentation
class Monad m => HasTezosClient m where Source #
Type class that provides interaction with octez-client
binary
signBytes :: ImplicitAddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> m Signature Source #
Sign an operation with octez-client
.
genKey :: ImplicitAlias -> m ImplicitAddress Source #
Generate a secret key and store it with given alias. If a key with this alias already exists, the corresponding address will be returned and no state will be changed.
genFreshKey :: ImplicitAlias -> m ImplicitAddress Source #
Generate a secret key and store it with given alias.
Unlike genKey
this function overwrites
the existing key when given alias is already stored.
revealKey :: ImplicitAlias -> Maybe ScrubbedBytes -> m () Source #
Reveal public key associated with given implicit account.
rememberContract :: AliasBehavior -> ContractAddress -> ContractAlias -> m () Source #
Associate the given contract with alias.
The Bool
variable indicates whether or not we should replace already
existing contract alias or not.
getAliasesAndAddresses :: m [(Text, Text)] Source #
Retrieves a list with all known aliases and respective addresses.
Note that an alias can be ambiguous: it can refer to BOTH a contract and an implicit account. When an alias "abc" is ambiguous, the list will contain two entries:
("abc", "KT1...") ("key:abc", "tz1...")
TODO [#910]: Cache this and turn it into a Bimap
.
getKeyPassword :: ImplicitAddress -> m (Maybe ScrubbedBytes) Source #
Get password for secret key associated with given address
in case this key is password-protected. Obtained password is used
in two places:
* 1) In signBytes
call.
* 2) in revealKey
call.
Instances
data AliasBehavior Source #
How to save the originated contract address.
DontSaveAlias | Don't save the newly originated contract address. |
KeepDuplicateAlias | If an alias already exists, keep it, don't save the newly originated contract address. |
OverwriteDuplicateAlias | If an alias already exists, replace it with the address of the newly originated contract. |
ForbidDuplicateAlias | If an alias already exists, throw an exception without doing the origination |