Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Interface to the tezos-client
executable expressed in Haskell types.
Synopsis
- data TezosClientError
- = UnexpectedClientFailure Int Text Text
- | UnknownAddressAlias Text
- | UnknownAddress Address
- | AlreadyRevealed ImplicitAlias
- | InvalidOperationHash OperationHash
- | CounterIsAlreadyUsed Text Text
- | EConnreset
- | ConfigParseError String
- | TezosClientCryptoParseError Text CryptoParseError
- | TezosClientParseAddressError Text ParseAddressError
- | TezosClientParseFeeError Text Text
- | TezosClientUnexpectedOutputFormat Text
- | CantRevealContract ImplicitAlias
- | ContractSender ContractAddress Text
- | EmptyImplicitContract ImplicitAlias
- | TezosClientUnexpectedSignatureOutput Text
- | TezosClientParseEncryptionTypeError Text Text
- signBytes :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> m Signature
- rememberContract :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => Bool -> ContractAddress -> ContractAlias -> m ()
- importKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => Bool -> ImplicitAlias -> SecretKey -> m ImplicitAlias
- genKey :: (MonadThrow m, MonadCatch m, WithClientLog env m, HasTezosClientEnv env, MonadIO m, HasTezosClient m) => ImplicitAlias -> m ImplicitAddress
- genFreshKey :: (MonadThrow m, MonadCatch m, WithClientLog env m, HasTezosClientEnv env, MonadIO m, HasTezosClient m) => ImplicitAlias -> m ImplicitAddress
- revealKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAlias -> Maybe ScrubbedBytes -> m ()
- resolveAddressMaybe :: forall env m kind. (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => AddressOrAlias kind -> m (Maybe (KindedAddress kind))
- resolveAddress :: (MonadThrow m, HasTezosClient m) => AddressOrAlias kind -> m (KindedAddress kind)
- getAlias :: forall kind env m. (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m, L1AddressKind kind) => AddressOrAlias kind -> m (Alias kind)
- getPublicKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAddressOrAlias -> m PublicKey
- getSecretKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAddressOrAlias -> m SecretKey
- getTezosClientConfig :: FilePath -> Maybe FilePath -> IO TezosClientConfig
- calcTransferFee :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => AddressOrAlias kind -> Maybe ScrubbedBytes -> TezosInt64 -> [CalcTransferFeeData] -> m [TezosMutez]
- calcOriginationFee :: (UntypedValScope st, WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => CalcOriginationFeeData cp st -> m TezosMutez
- calcRevealFee :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAlias -> Maybe ScrubbedBytes -> TezosInt64 -> m TezosMutez
- getKeyPassword :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadMask m) => ImplicitAddress -> m (Maybe ScrubbedBytes)
- registerDelegate :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAlias -> Maybe ScrubbedBytes -> m ()
- callTezosClient :: forall env m. (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => (Text -> Text -> IO Bool) -> [String] -> CallMode -> Maybe ScrubbedBytes -> m Text
- callTezosClientStrict :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => [String] -> CallMode -> Maybe ScrubbedBytes -> m Text
Documentation
data TezosClientError Source #
A data type for all predicatable errors that can happen during
tezos-client
usage.
UnexpectedClientFailure |
|
UnknownAddressAlias | Could not find an address with given name. |
| |
UnknownAddress | Could not find an address. |
| |
AlreadyRevealed | Public key of the given address is already revealed. |
| |
InvalidOperationHash OperationHash | Can't wait for inclusion of operation with given hash because the hash is invalid. |
CounterIsAlreadyUsed | Error that indicates when given counter is already used for given contract. |
EConnreset | Network error with which |
ConfigParseError String | A parse error occurred during config parsing. |
TezosClientCryptoParseError Text CryptoParseError |
|
TezosClientParseAddressError Text ParseAddressError |
|
TezosClientParseFeeError Text Text |
|
TezosClientUnexpectedOutputFormat Text |
|
CantRevealContract | Given alias is a contract and cannot be revealed. |
| |
ContractSender ContractAddress Text | Given contract is a source of a transfer or origination operation. |
EmptyImplicitContract | Given alias is an empty implicit contract. |
| |
TezosClientUnexpectedSignatureOutput Text |
|
TezosClientParseEncryptionTypeError Text Text |
|
Instances
Exception TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl | |
Show TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl showsPrec :: Int -> TezosClientError -> ShowS # show :: TezosClientError -> String # showList :: [TezosClientError] -> ShowS # | |
Buildable TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl build :: TezosClientError -> Builder # | |
Eq TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl (==) :: TezosClientError -> TezosClientError -> Bool # (/=) :: TezosClientError -> TezosClientError -> Bool # |
tezos-client
api
signBytes :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> m Signature Source #
Sign an arbtrary bytestring using tezos-client
.
Secret key of the address corresponding to give AddressOrAlias
must be known.
rememberContract :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => Bool -> ContractAddress -> ContractAlias -> m () Source #
Save a contract with given address and alias.
If replaceExisting
is False
and a contract with given alias
already exists, this function does nothing.
importKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => Bool -> ImplicitAlias -> SecretKey -> m ImplicitAlias Source #
genKey :: (MonadThrow m, MonadCatch m, WithClientLog env m, HasTezosClientEnv env, MonadIO m, HasTezosClient m) => ImplicitAlias -> m ImplicitAddress Source #
Generate a new secret key and save it with given alias. If an address with given alias already exists, it will be returned and no state will be changed.
genFreshKey :: (MonadThrow m, MonadCatch m, WithClientLog env m, HasTezosClientEnv env, MonadIO m, HasTezosClient m) => ImplicitAlias -> m ImplicitAddress Source #
Generate a new secret key and save it with given alias. If an address with given alias already exists, it will be removed and replaced with a fresh one.
revealKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAlias -> Maybe ScrubbedBytes -> m () Source #
Reveal public key corresponding to the given alias. Fails if it's already revealed.
resolveAddressMaybe :: forall env m kind. (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => AddressOrAlias kind -> m (Maybe (KindedAddress kind)) Source #
Return KindedAddress
corresponding to given AddressOrAlias
, covered in Maybe
.
Return Nothing
if address alias is unknown
resolveAddress :: (MonadThrow m, HasTezosClient m) => AddressOrAlias kind -> m (KindedAddress kind) Source #
Return KindedAddress
corresponding to given AddressOrAlias
.
getAlias :: forall kind env m. (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m, L1AddressKind kind) => AddressOrAlias kind -> m (Alias kind) Source #
Return Alias
corresponding to given AddressOrAlias
.
getPublicKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAddressOrAlias -> m PublicKey Source #
Return PublicKey
corresponding to given AddressOrAlias
.
getSecretKey :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAddressOrAlias -> m SecretKey Source #
Return SecretKey
corresponding to given AddressOrAlias
.
getTezosClientConfig :: FilePath -> Maybe FilePath -> IO TezosClientConfig Source #
Read tezos-client
configuration.
calcTransferFee :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => AddressOrAlias kind -> Maybe ScrubbedBytes -> TezosInt64 -> [CalcTransferFeeData] -> m [TezosMutez] Source #
Calc baker fee for transfer using tezos-client
.
calcOriginationFee :: (UntypedValScope st, WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => CalcOriginationFeeData cp st -> m TezosMutez Source #
Calc baker fee for origination using tezos-client
.
calcRevealFee :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAlias -> Maybe ScrubbedBytes -> TezosInt64 -> m TezosMutez Source #
Calc baker fee for revealing using tezos-client
.
Note that tezos-client
does not support passing an address here,
at least at the moment of writing.
getKeyPassword :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadMask m) => ImplicitAddress -> m (Maybe ScrubbedBytes) Source #
Get password for secret key associated with given address in case this key is password-protected
registerDelegate :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => ImplicitAlias -> Maybe ScrubbedBytes -> m () Source #
Register alias as delegate
Internals
callTezosClient :: forall env m. (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => (Text -> Text -> IO Bool) -> [String] -> CallMode -> Maybe ScrubbedBytes -> m Text Source #
Call tezos-client
with given arguments. Arguments defined by
config are added automatically. The second argument specifies what
should be done in failure case. It takes stdout and stderr
output. Possible handling:
- Parse a specific error and throw it.
- Parse an expected error that shouldn't cause a failure.
Return
True
in this case. - Detect an unexpected error, return
False
. In this caseUnexpectedClientFailure
will be throw.
callTezosClientStrict :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => [String] -> CallMode -> Maybe ScrubbedBytes -> m Text Source #
Call tezos-client and expect success.