Safe Haskell | None |
---|---|
Language | Haskell2010 |
Morley client that connects with real Tezos network through RPC and tezos-client binary. For more information please refer to README.
Synopsis
- parserInfo :: ("usage" :! Doc) -> ("description" :! String) -> ("header" :! String) -> ("parser" :! Parser s) -> ParserInfo s
- clientConfigParser :: Parser (Maybe Text) -> Parser MorleyClientConfig
- data MorleyClientM a
- data MorleyClientConfig = MorleyClientConfig {
- mccAliasPrefix :: Maybe Text
- mccEndpointUrl :: Maybe BaseUrl
- mccTezosClientPath :: FilePath
- mccMbTezosClientDataDir :: Maybe FilePath
- mccVerbosity :: Word
- mccSecretKey :: Maybe SecretKey
- data MorleyClientEnv' m = MorleyClientEnv {
- mceTezosClient :: TezosClientEnv
- mceLogAction :: ClientLogAction m
- mceSecretKey :: Maybe SecretKey
- mceClientEnv :: ClientEnv
- type MorleyClientEnv = MorleyClientEnv' MorleyClientM
- runMorleyClientM :: MorleyClientEnv -> MorleyClientM a -> IO a
- mkMorleyClientEnv :: MonadIO m => MorleyClientConfig -> IO (MorleyClientEnv' m)
- mceTezosClientL :: forall m. Lens' (MorleyClientEnv' m) TezosClientEnv
- mceLogActionL :: forall m m. Lens (MorleyClientEnv' m) (MorleyClientEnv' m) (ClientLogAction m) (ClientLogAction m)
- mceSecretKeyL :: forall m. Lens' (MorleyClientEnv' m) (Maybe SecretKey)
- mceClientEnvL :: forall m. Lens' (MorleyClientEnv' m) ClientEnv
- newtype MorleyOnlyRpcM a = MorleyOnlyRpcM {}
- data MorleyOnlyRpcEnv = MorleyOnlyRpcEnv {
- moreLogAction :: ClientLogAction MorleyOnlyRpcM
- moreClientEnv :: ClientEnv
- moreSecretKeys :: Map Address SecretKey
- mkMorleyOnlyRpcEnv :: [SecretKey] -> BaseUrl -> Word -> IO MorleyOnlyRpcEnv
- runMorleyOnlyRpcM :: MorleyOnlyRpcEnv -> MorleyOnlyRpcM a -> IO a
- module Morley.Client.Action
- data BlockId
- class (Monad m, MonadCatch m) => HasTezosRpc m where
- getBlockHash :: BlockId -> m Text
- getCounterAtBlock :: BlockId -> Address -> m TezosInt64
- getBlockHeader :: BlockId -> m BlockHeader
- getBlockConstants :: BlockId -> m BlockConstants
- getBlockOperations :: BlockId -> m [[BlockOperation]]
- getProtocolParametersAtBlock :: BlockId -> m ProtocolParameters
- runOperationAtBlock :: BlockId -> RunOperation -> m RunOperationResult
- preApplyOperationsAtBlock :: BlockId -> [PreApplyOperation] -> m [RunOperationResult]
- forgeOperationAtBlock :: BlockId -> ForgeOperation -> m HexJSONByteString
- injectOperation :: HexJSONByteString -> m OperationHash
- getContractScriptAtBlock :: BlockId -> Address -> m OriginationScript
- getContractStorageAtBlock :: BlockId -> Address -> m Expression
- getContractBigMapAtBlock :: BlockId -> Address -> GetBigMap -> m GetBigMapResult
- getBigMapValueAtBlock :: BlockId -> Natural -> Text -> m Expression
- getBigMapValuesAtBlock :: BlockId -> Natural -> Maybe Natural -> Maybe Natural -> m Expression
- getBalanceAtBlock :: BlockId -> Address -> m Mutez
- getDelegateAtBlock :: BlockId -> Address -> m (Maybe KeyHash)
- runCodeAtBlock :: BlockId -> RunCode -> m RunCodeResult
- getChainId :: m ChainId
- getManagerKeyAtBlock :: BlockId -> Address -> m (Maybe PublicKey)
- data OperationInfo i
- = OpTransfer (TransferInfo i)
- | OpOriginate (OriginationInfo i)
- | OpReveal (RevealInfo i)
- class OperationInfoDescriptor (i :: Type) where
- type TransferInfo i :: Type
- type OriginationInfo i :: Type
- type RevealInfo i :: Type
- data RPCInput
- getContract :: HasTezosRpc m => Address -> m Contract
- getImplicitContractCounter :: HasTezosRpc m => Address -> m TezosInt64
- getContractStorage :: HasTezosRpc m => Address -> m Expression
- getBigMapValue :: HasTezosRpc m => Natural -> Text -> m Expression
- getHeadBlock :: HasTezosRpc m => m Text
- getCounter :: HasTezosRpc m => Address -> m TezosInt64
- getProtocolParameters :: HasTezosRpc m => m ProtocolParameters
- runOperation :: HasTezosRpc m => RunOperation -> m RunOperationResult
- preApplyOperations :: HasTezosRpc m => [PreApplyOperation] -> m [RunOperationResult]
- forgeOperation :: HasTezosRpc m => ForgeOperation -> m HexJSONByteString
- getContractScript :: HasTezosRpc m => Address -> m OriginationScript
- getContractBigMap :: HasTezosRpc m => Address -> GetBigMap -> m GetBigMapResult
- getBalance :: HasTezosRpc m => Address -> m Mutez
- getDelegate :: HasTezosRpc m => Address -> m (Maybe KeyHash)
- runCode :: HasTezosRpc m => RunCode -> m RunCodeResult
- getManagerKey :: HasTezosRpc m => Address -> m (Maybe PublicKey)
- data ClientRpcError
- = ContractFailed Address Expression
- | BadParameter Address Expression
- | EmptyTransaction Address
- | ShiftOverflow Address
- | GasExhaustion Address
- | KeyAlreadyRevealed Address
- | ClientInternalError InternalError
- data UnexpectedErrors
- data IncorrectRpcResponse
- data RunError
- = RuntimeError Address
- | ScriptRejected Expression
- | BadContractParameter Address
- | InvalidConstant Expression Expression
- | InvalidContract Address
- | InconsistentTypes Expression Expression
- | InvalidPrimitive [Text] Text
- | InvalidSyntacticConstantError Expression Expression
- | InvalidExpressionKind [Text] Text
- | InvalidContractNotation Text
- | UnexpectedContract
- | IllFormedType Expression
- | UnexpectedOperation
- | REEmptyTransaction Address
- | ScriptOverflow
- | GasExhaustedOperation
- | MutezAdditionOverflow [TezosInt64]
- | MutezSubtractionUnderflow [TezosInt64]
- | MutezMultiplicationOverflow TezosInt64 TezosInt64
- | CantPayStorageFee
- | BalanceTooLow ("balance" :! Mutez) ("required" :! Mutez)
- | PreviouslyRevealedKey Address
- | NonExistingContract Address
- data ValueDecodeFailure = ValueDecodeFailure Text T
- data ValueNotFound = ValueNotFound
- readAllBigMapValues :: forall v k m. (NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> m [v]
- readAllBigMapValuesMaybe :: forall v k m. (NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> m (Maybe [v])
- readContractBigMapValue :: forall k v m. (PackedValScope k, HasTezosRpc m, SingI v) => Address -> Value k -> m (Value v)
- readBigMapValueMaybe :: forall v k m. (NicePackedValue k, NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> k -> m (Maybe v)
- readBigMapValue :: forall v k m. (NicePackedValue k, NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> k -> m v
- data Alias
- mkAlias :: Text -> Alias
- data AliasHint
- mkAliasHint :: Text -> AliasHint
- data AliasOrAliasHint
- data AddressOrAlias
- = AddressResolved Address
- | AddressAlias Alias
- addressResolved :: ToAddress addr => addr -> AddressOrAlias
- class Monad m => HasTezosClient m where
- signBytes :: AddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> m Signature
- genKey :: AliasOrAliasHint -> m Address
- genFreshKey :: AliasOrAliasHint -> m Address
- revealKey :: Alias -> Maybe ScrubbedBytes -> m ()
- waitForOperation :: OperationHash -> m ()
- rememberContract :: Bool -> Address -> AliasOrAliasHint -> m ()
- importKey :: Bool -> AliasOrAliasHint -> SecretKey -> m Alias
- resolveAddressMaybe :: AddressOrAlias -> m (Maybe Address)
- getAlias :: AddressOrAlias -> m Alias
- getPublicKey :: AddressOrAlias -> m PublicKey
- registerDelegate :: AliasOrAliasHint -> Maybe ScrubbedBytes -> m ()
- getTezosClientConfig :: m TezosClientConfig
- calcTransferFee :: AddressOrAlias -> Maybe ScrubbedBytes -> TezosInt64 -> [CalcTransferFeeData] -> m [TezosMutez]
- calcOriginationFee :: UntypedValScope st => CalcOriginationFeeData cp st -> m TezosMutez
- getKeyPassword :: Address -> m (Maybe ScrubbedBytes)
- resolveAddress :: (MonadThrow m, HasTezosClient m) => AddressOrAlias -> m Address
- data TezosClientError
- = UnexpectedClientFailure Int Text Text
- | UnknownAddressAlias Alias
- | UnknownAddress Address
- | AlreadyRevealed Alias
- | InvalidOperationHash OperationHash
- | CounterIsAlreadyUsed Text Text
- | EConnreset
- | ConfigParseError String
- | TezosClientCryptoParseError Text CryptoParseError
- | TezosClientParseAddressError Text ParseAddressError
- | TezosClientParseFeeError Text Text
- | TezosClientUnexpectedOutputFormat Text
- | CantRevealContract Alias
- | ContractSender Address Text
- | EmptyImplicitContract Alias
- | TezosClientUnexpectedSignatureOutput Text
- | TezosClientParseEncryptionTypeError Text Text
- disableAlphanetWarning :: IO ()
- data ParserInfo a
Command line parser
parserInfo :: ("usage" :! Doc) -> ("description" :! String) -> ("header" :! String) -> ("parser" :! Parser s) -> ParserInfo s #
Full client monad and environment
data MorleyClientM a Source #
Instances
data MorleyClientConfig Source #
Data necessary for morley client initialization.
MorleyClientConfig | |
|
Instances
Show MorleyClientConfig Source # | |
Defined in Morley.Client.Init showsPrec :: Int -> MorleyClientConfig -> ShowS # show :: MorleyClientConfig -> String # showList :: [MorleyClientConfig] -> ShowS # |
data MorleyClientEnv' m Source #
Runtime environment for morley client.
MorleyClientEnv | |
|
Instances
MonadReader MorleyClientEnv MorleyClientM Source # | |
Defined in Morley.Client.Full ask :: MorleyClientM MorleyClientEnv # local :: (MorleyClientEnv -> MorleyClientEnv) -> MorleyClientM a -> MorleyClientM a # reader :: (MorleyClientEnv -> a) -> MorleyClientM a # | |
HasLog MorleyClientEnv Message MorleyClientM Source # | |
Defined in Morley.Client.Full getLogAction :: MorleyClientEnv -> LogAction MorleyClientM Message # setLogAction :: LogAction MorleyClientM Message -> MorleyClientEnv -> MorleyClientEnv # overLogAction :: (LogAction MorleyClientM Message -> LogAction MorleyClientM Message) -> MorleyClientEnv -> MorleyClientEnv # logActionL :: Lens' MorleyClientEnv (LogAction MorleyClientM Message) # | |
HasTezosClientEnv (MorleyClientEnv' m) Source # | |
Defined in Morley.Client.Env |
runMorleyClientM :: MorleyClientEnv -> MorleyClientM a -> IO a Source #
Run MorleyClientM
action within given MorleyClientEnv
. Retry action
in case of invalid counter error.
mkMorleyClientEnv :: MonadIO m => MorleyClientConfig -> IO (MorleyClientEnv' m) Source #
Construct MorleyClientEnv
.
tezos-client
path is taken fromMorleyClientConfig
, but can be overridden usingMORLEY_TEZOS_CLIENT
environment variable.- Node data is taken from
tezos-client
config and can be overridden byMorleyClientConfig
. - The rest is taken from
MorleyClientConfig
as is.
Lens
mceTezosClientL :: forall m. Lens' (MorleyClientEnv' m) TezosClientEnv Source #
mceLogActionL :: forall m m. Lens (MorleyClientEnv' m) (MorleyClientEnv' m) (ClientLogAction m) (ClientLogAction m) Source #
mceSecretKeyL :: forall m. Lens' (MorleyClientEnv' m) (Maybe SecretKey) Source #
mceClientEnvL :: forall m. Lens' (MorleyClientEnv' m) ClientEnv Source #
Only-RPC client monad and environment
newtype MorleyOnlyRpcM a Source #
Monad that implements HasTezosClient
and HasTezosRpc
classes and
can be used for high-level actions as an alternative to MorleyClientM
.
Instances
data MorleyOnlyRpcEnv Source #
Environment used by MorleyOnlyRpcM
.
MorleyOnlyRpcEnv | |
|
Instances
mkMorleyOnlyRpcEnv :: [SecretKey] -> BaseUrl -> Word -> IO MorleyOnlyRpcEnv Source #
Construct MorleyOnlyRpcEnv
.
- Full
MorleyClientConfig
is not passed because we need just 2 things from it. - Log action is built the same way as for
MorleyClientEnv
. - All secret keys are passed as an argument.
runMorleyOnlyRpcM :: MorleyOnlyRpcEnv -> MorleyOnlyRpcM a -> IO a Source #
Run MorleyOnlyRpcM
action within given MorleyOnlyRpcEnv
. Retry action
in case of invalid counter error.
High-level actions
module Morley.Client.Action
RPC
A block identifier as submitted to RPC.
A block can be referenced by head
, genesis
, level or block hash
HeadId | Identifier referring to the head block. |
FinalHeadId | Identifier of the most recent block guaranteed to have been finalized. See: https://web.archive.org/web/20220305165609/https://tezos.gitlab.io/protocols/tenderbake.html#operations |
GenesisId | Identifier referring to the genesis block. |
LevelId Natural | Identifier referring to a block by its level. |
BlockHashId Text | Idenfitier referring to a block by its hash in Base58Check notation. |
AtDepthId Natural | Identifier of a block at specific depth relative to |
Instances
Eq BlockId Source # | |
Show BlockId Source # | |
Buildable BlockId Source # | |
Defined in Morley.Client.RPC.Types | |
ToHttpApiData BlockId Source # | |
Defined in Morley.Client.RPC.Types toUrlPiece :: BlockId -> Text # toEncodedUrlPiece :: BlockId -> Builder # toHeader :: BlockId -> ByteString # toQueryParam :: BlockId -> Text # | |
HasCLReader BlockId Source # | |
Defined in Morley.Client.RPC.Types |
class (Monad m, MonadCatch m) => HasTezosRpc m where Source #
Type class that provides interaction with tezos node via RPC
getBlockHash :: BlockId -> m Text Source #
getCounterAtBlock :: BlockId -> Address -> m TezosInt64 Source #
Get address counter, which is required for both transaction sending and contract origination.
getBlockHeader :: BlockId -> m BlockHeader Source #
Get the whole header of a block.
getBlockConstants :: BlockId -> m BlockConstants Source #
Get block constants that are required by other RPC calls.
getBlockOperations :: BlockId -> m [[BlockOperation]] Source #
Get all operations from the block with specified ID.
getProtocolParametersAtBlock :: BlockId -> m ProtocolParameters Source #
Get protocol parameters that are for limits calculations.
runOperationAtBlock :: BlockId -> RunOperation -> m RunOperationResult Source #
Perform operation run, this operation doesn't require proper signing. As a result it returns burned gas and storage diff (also list of originated contracts but their addresses are incorrect due to the fact that operation could be not signed properly) or indicates about operation failure.
preApplyOperationsAtBlock :: BlockId -> [PreApplyOperation] -> m [RunOperationResult] Source #
Preapply list of operations, each operation has to be signed with sender secret key. As a result it returns list of results each of which has information about burned gas, storage diff size and originated contracts.
forgeOperationAtBlock :: BlockId -> ForgeOperation -> m HexJSONByteString Source #
Forge operation in order to receive its hexadecimal representation.
injectOperation :: HexJSONByteString -> m OperationHash Source #
Inject operation, note that this operation has to be signed before injection. As a result it returns operation hash.
getContractScriptAtBlock :: BlockId -> Address -> m OriginationScript Source #
Get code and storage of the desired contract. Note that both code and storage
are presented in low-level Micheline representation.
If the storage contains a big_map
, then the expression will contain the big_map
's ID,
not its contents.
getContractStorageAtBlock :: BlockId -> Address -> m Expression Source #
Get storage of the desired contract at some block. Note that storage
is presented in low-level Micheline representation.
If the storage contains a big_map
, then the expression will contain the big_map
's ID,
not its contents.
getContractBigMapAtBlock :: BlockId -> Address -> GetBigMap -> m GetBigMapResult Source #
Get big map value by contract address.
getBigMapValueAtBlock :: BlockId -> Natural -> Text -> m Expression Source #
Get big map value at some block by the big map's ID and the hashed entry key.
getBigMapValuesAtBlock :: BlockId -> Natural -> Maybe Natural -> Maybe Natural -> m Expression Source #
Get all big map values at some block by the big map's ID and the optional offset and length.
getBalanceAtBlock :: BlockId -> Address -> m Mutez Source #
Get balance for given address.
getDelegateAtBlock :: BlockId -> Address -> m (Maybe KeyHash) Source #
Get delegate for given address.
runCodeAtBlock :: BlockId -> RunCode -> m RunCodeResult Source #
Emulate contract call. This RPC endpoint does the same as
tezos-client run script
command does.
getChainId :: m ChainId Source #
Get current ChainId
getManagerKeyAtBlock :: BlockId -> Address -> m (Maybe PublicKey) Source #
Get manager key for given address.
Returns Nothing
if this key wasn't revealed.
Instances
data OperationInfo i Source #
OpTransfer (TransferInfo i) | |
OpOriginate (OriginationInfo i) | |
OpReveal (RevealInfo i) |
Instances
ToJSON (OperationInfo RPCInput) Source # | |
Defined in Morley.Client.RPC.Types toJSON :: OperationInfo RPCInput -> Value # toEncoding :: OperationInfo RPCInput -> Encoding # toJSONList :: [OperationInfo RPCInput] -> Value # toEncodingList :: [OperationInfo RPCInput] -> Encoding # |
class OperationInfoDescriptor (i :: Type) Source #
type TransferInfo i :: Type Source #
type OriginationInfo i :: Type Source #
type RevealInfo i :: Type Source #
Instances
OperationInfoDescriptor RPCInput Source # | |
Defined in Morley.Client.RPC.Types type TransferInfo RPCInput Source # type OriginationInfo RPCInput Source # type RevealInfo RPCInput Source # | |
OperationInfoDescriptor ClientInput Source # | |
Defined in Morley.Client.Action.Common type TransferInfo ClientInput Source # type OriginationInfo ClientInput Source # type RevealInfo ClientInput Source # | |
OperationInfoDescriptor Result Source # | |
Defined in Morley.Client.Action.Operation type TransferInfo Result Source # type OriginationInfo Result Source # type RevealInfo Result Source # |
Designates an input RPC data that we supply to perform an operation.
Instances
OperationInfoDescriptor RPCInput Source # | |
Defined in Morley.Client.RPC.Types type TransferInfo RPCInput Source # type OriginationInfo RPCInput Source # type RevealInfo RPCInput Source # | |
ToJSON (OperationInfo RPCInput) Source # | |
Defined in Morley.Client.RPC.Types toJSON :: OperationInfo RPCInput -> Value # toEncoding :: OperationInfo RPCInput -> Encoding # toJSONList :: [OperationInfo RPCInput] -> Value # toEncodingList :: [OperationInfo RPCInput] -> Encoding # | |
type TransferInfo RPCInput Source # | |
Defined in Morley.Client.RPC.Types | |
type OriginationInfo RPCInput Source # | |
Defined in Morley.Client.RPC.Types | |
type RevealInfo RPCInput Source # | |
Defined in Morley.Client.RPC.Types |
getContract :: HasTezosRpc m => Address -> m Contract Source #
Get originated Contract
for some address.
getImplicitContractCounter :: HasTezosRpc m => Address -> m TezosInt64 Source #
Get counter value for given address.
Throws an error if given address is a contract address.
getContractStorage :: HasTezosRpc m => Address -> m Expression Source #
getContractStorageAtBlock
applied to the head block.
getBigMapValue :: HasTezosRpc m => Natural -> Text -> m Expression Source #
getBigMapValueAtBlock
applied to the head block.
getHeadBlock :: HasTezosRpc m => m Text Source #
Get hash of the current head block, this head hash is used in other RPC calls.
getCounter :: HasTezosRpc m => Address -> m TezosInt64 Source #
getCounterAtBlock
applied to the head block.
getProtocolParameters :: HasTezosRpc m => m ProtocolParameters Source #
getProtocolParametersAtBlock
applied to the head block.
runOperation :: HasTezosRpc m => RunOperation -> m RunOperationResult Source #
runOperationAtBlock
applied to the head block.
preApplyOperations :: HasTezosRpc m => [PreApplyOperation] -> m [RunOperationResult] Source #
preApplyOperationsAtBlock
applied to the head block.
forgeOperation :: HasTezosRpc m => ForgeOperation -> m HexJSONByteString Source #
forgeOperationAtBlock
applied to the head block.
getContractScript :: HasTezosRpc m => Address -> m OriginationScript Source #
getContractScriptAtBlock
applied to the head block.
getContractBigMap :: HasTezosRpc m => Address -> GetBigMap -> m GetBigMapResult Source #
getContractBigMapAtBlock
applied to the head block.
getBalance :: HasTezosRpc m => Address -> m Mutez Source #
getBalanceAtBlock
applied to the head block.
getDelegate :: HasTezosRpc m => Address -> m (Maybe KeyHash) Source #
getDelegateAtBlock
applied to the head block.
runCode :: HasTezosRpc m => RunCode -> m RunCodeResult Source #
runCodeAtBlock
applied to the head block.
getManagerKey :: HasTezosRpc m => Address -> m (Maybe PublicKey) Source #
Errors
data ClientRpcError Source #
Errors that can happen in the RPC part when a user tries to make failing actions.
ContractFailed | Smart contract execution has failed. |
| |
BadParameter | Parameter passed to a contract does not match its type. |
| |
EmptyTransaction | Transfer of 0 to an implicit account. |
| |
ShiftOverflow | A smart contract execution failed due to a shift overflow. |
| |
GasExhaustion | A smart contract execution failed due gas exhaustion. |
| |
KeyAlreadyRevealed | A key has already been revealed. |
| |
ClientInternalError InternalError | An error that RPC considers internal occurred. These errors
are considered internal by mistake, they are actually quite
realistic and normally indicate bad user action. Currently we
put |
Instances
Show ClientRpcError Source # | |
Defined in Morley.Client.RPC.Error showsPrec :: Int -> ClientRpcError -> ShowS # show :: ClientRpcError -> String # showList :: [ClientRpcError] -> ShowS # | |
Exception ClientRpcError Source # | |
Defined in Morley.Client.RPC.Error | |
Buildable ClientRpcError Source # | |
Defined in Morley.Client.RPC.Error build :: ClientRpcError -> Builder # |
data UnexpectedErrors Source #
Errors that we don't expect to happen, but they can be reported by the server.
Instances
Show UnexpectedErrors Source # | |
Defined in Morley.Client.RPC.Error showsPrec :: Int -> UnexpectedErrors -> ShowS # show :: UnexpectedErrors -> String # showList :: [UnexpectedErrors] -> ShowS # | |
Exception UnexpectedErrors Source # | |
Defined in Morley.Client.RPC.Error | |
Buildable UnexpectedErrors Source # | |
Defined in Morley.Client.RPC.Error build :: UnexpectedErrors -> Builder # |
data IncorrectRpcResponse Source #
Errors that we can throw when we get a response from a node that doesn't match our expectations. It means that either the node we are talking to misbehaves or our code is incorrect.
RpcUnexpectedSize Int Int | |
RpcOriginatedNoContracts | |
RpcNoOperationsRun | |
RpcOriginatedMoreContracts [Address] |
Instances
Show IncorrectRpcResponse Source # | |
Defined in Morley.Client.RPC.Error showsPrec :: Int -> IncorrectRpcResponse -> ShowS # show :: IncorrectRpcResponse -> String # showList :: [IncorrectRpcResponse] -> ShowS # | |
Exception IncorrectRpcResponse Source # | |
Buildable IncorrectRpcResponse Source # | |
Defined in Morley.Client.RPC.Error build :: IncorrectRpcResponse -> Builder # |
Errors that are sent as part of operation result in an OK response (status 200). They are semi-formally defined as errors that can happen when a contract is executed and something goes wrong.
RuntimeError Address | |
ScriptRejected Expression | |
BadContractParameter Address | |
InvalidConstant Expression Expression | |
InvalidContract Address | |
InconsistentTypes Expression Expression | |
InvalidPrimitive [Text] Text | |
InvalidSyntacticConstantError Expression Expression | |
InvalidExpressionKind [Text] Text | |
InvalidContractNotation Text | |
UnexpectedContract | |
IllFormedType Expression | |
UnexpectedOperation | |
REEmptyTransaction | Transfer of 0 to an implicit account. |
| |
ScriptOverflow | A contract failed due to the detection of an overflow. It seems to happen if a too big value is passed to shift instructions (as second argument). |
GasExhaustedOperation | |
MutezAdditionOverflow [TezosInt64] | |
MutezSubtractionUnderflow [TezosInt64] | |
MutezMultiplicationOverflow TezosInt64 TezosInt64 | |
CantPayStorageFee | |
BalanceTooLow ("balance" :! Mutez) ("required" :! Mutez) | |
PreviouslyRevealedKey Address | |
NonExistingContract Address |
Getters
data ValueDecodeFailure Source #
Failed to decode received value to the given type.
Instances
Show ValueDecodeFailure Source # | |
Defined in Morley.Client.RPC.Getters showsPrec :: Int -> ValueDecodeFailure -> ShowS # show :: ValueDecodeFailure -> String # showList :: [ValueDecodeFailure] -> ShowS # | |
Exception ValueDecodeFailure Source # | |
Defined in Morley.Client.RPC.Getters | |
Buildable ValueDecodeFailure Source # | |
Defined in Morley.Client.RPC.Getters build :: ValueDecodeFailure -> Builder # |
data ValueNotFound Source #
Instances
Show ValueNotFound Source # | |
Defined in Morley.Client.RPC.Getters showsPrec :: Int -> ValueNotFound -> ShowS # show :: ValueNotFound -> String # showList :: [ValueNotFound] -> ShowS # | |
Exception ValueNotFound Source # | |
Defined in Morley.Client.RPC.Getters | |
Buildable ValueNotFound Source # | |
Defined in Morley.Client.RPC.Getters build :: ValueNotFound -> Builder # |
readAllBigMapValues :: forall v k m. (NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> m [v] Source #
Read all big_map values, given it's ID.
If the values are not of the expected type, a ValueDecodeFailure
will be thrown.
readAllBigMapValuesMaybe :: forall v k m. (NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> m (Maybe [v]) Source #
Read all big_map values, given it's ID.
If the values are not of the expected type, a ValueDecodeFailure
will be thrown.
Returns Nothing
if a big_map with the given ID does not exist.
readContractBigMapValue :: forall k v m. (PackedValScope k, HasTezosRpc m, SingI v) => Address -> Value k -> m (Value v) Source #
Read big_map value of given contract by key.
If the contract contains several big_map
s with given key type, only one
of them will be considered.
readBigMapValueMaybe :: forall v k m. (NicePackedValue k, NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> k -> m (Maybe v) Source #
Read big_map value, given it's ID and a key.
If the value is not of the expected type, a ValueDecodeFailure
will be thrown.
Returns Nothing
if a big_map with the given ID does not exist,
or it does exist but does not contain the given key.
readBigMapValue :: forall v k m. (NicePackedValue k, NiceUnpackedValue v, HasTezosRpc m) => BigMapId k v -> k -> m v Source #
Read big_map value, given it's ID and a key.
If the value is not of the expected type, a ValueDecodeFailure
will be thrown.
tezos-client
tezos-client
can associate addresses with textual aliases.
This type denotes such an alias.
A hint for constructing an alias when generating an address or remembering a contract.
Resulting Alias
most likely will differ from this as we tend to prefix
aliases, but a user should be able to recognize your alias visually.
For instance, passing "alice"
as a hint may result into "myTest.alice"
alias being created.
data AliasOrAliasHint Source #
Either an Alias
, or an AliasHint
. The difference is that AliasHint
needs to be
prefixed (if alias prefix is non-empty), while Alias
doesn't.
Instances
Show AliasOrAliasHint Source # | |
Defined in Morley.Client.TezosClient.Types showsPrec :: Int -> AliasOrAliasHint -> ShowS # show :: AliasOrAliasHint -> String # showList :: [AliasOrAliasHint] -> ShowS # |
data AddressOrAlias Source #
Representation of an address that tezos-client
uses. It can be
an address itself or a textual alias.
AddressResolved Address | Address itself, can be used as is. |
AddressAlias Alias | Address alias, should be resolved by |
Instances
addressResolved :: ToAddress addr => addr -> AddressOrAlias Source #
Creates an AddressOrAlias
with the given address.
class Monad m => HasTezosClient m where Source #
Type class that provides interaction with tezos-client
binary
signBytes :: AddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> m Signature Source #
Sign an operation with tezos-client
.
genKey :: AliasOrAliasHint -> m Address 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 :: AliasOrAliasHint -> m Address 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 :: Alias -> Maybe ScrubbedBytes -> m () Source #
Reveal public key associated with given implicit account.
waitForOperation :: OperationHash -> m () Source #
Wait until operation known by some hash is included into the chain.
rememberContract :: Bool -> Address -> AliasOrAliasHint -> m () Source #
Associate the given contract with alias.
The Bool
variable indicates whether or not we should replace already
existing contract alias or not.
importKey :: Bool -> AliasOrAliasHint -> SecretKey -> m Alias Source #
Saves SecretKey
via tezos-client
with given alias or hint associated.
The Bool
variable indicates whether or not we should replace already
existing alias key or not.
The returned Alias
is the alias under which the key will be accessible.
resolveAddressMaybe :: AddressOrAlias -> m (Maybe Address) Source #
Retrieve an address from given address or alias. If address or alias does not exist
returns Nothing
getAlias :: AddressOrAlias -> m Alias Source #
Retrieve an alias from given address using tezos-client
. The
primary (and probably only) reason this function exists is that
tezos-client sign
command only works with aliases. It was
reported upstream: https://gitlab.com/tezos/tezos/-/issues/836.
getPublicKey :: AddressOrAlias -> m PublicKey Source #
Get public key for given address. Public keys are often used when interacting with the multising contracts
registerDelegate :: AliasOrAliasHint -> Maybe ScrubbedBytes -> m () Source #
Register a given address as delegate
getTezosClientConfig :: m TezosClientConfig Source #
Retrieve the current tezos-client
config.
calcTransferFee :: AddressOrAlias -> Maybe ScrubbedBytes -> TezosInt64 -> [CalcTransferFeeData] -> m [TezosMutez] Source #
Calculate fee for transfer using `--dry-run` flag.
calcOriginationFee :: UntypedValScope st => CalcOriginationFeeData cp st -> m TezosMutez Source #
Calculate fee for origination using `--dry-run` flag.
getKeyPassword :: Address -> 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
resolveAddress :: (MonadThrow m, HasTezosClient m) => AddressOrAlias -> m Address Source #
Return Address
corresponding to given AddressOrAlias
.
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 Address 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
Eq TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl (==) :: TezosClientError -> TezosClientError -> Bool # (/=) :: TezosClientError -> TezosClientError -> Bool # | |
Show TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl showsPrec :: Int -> TezosClientError -> ShowS # show :: TezosClientError -> String # showList :: [TezosClientError] -> ShowS # | |
Exception TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl | |
Buildable TezosClientError Source # | |
Defined in Morley.Client.TezosClient.Impl build :: TezosClientError -> Builder # |
Util
disableAlphanetWarning :: IO () Source #
Sets the environment variable for disabling tezos-client "not a mainnet" warning
Reexports
data ParserInfo a #
A full description for a runnable Parser
for a program.
Instances
Functor ParserInfo | |
Defined in Options.Applicative.Types fmap :: (a -> b) -> ParserInfo a -> ParserInfo b # (<$) :: a -> ParserInfo b -> ParserInfo a # |