Safe Haskell | Safe-Inferred |
---|---|
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 MorleyClientConfig
- data MorleyClientM a
- data MorleyClientConfig = MorleyClientConfig {
- 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 ImplicitAddress 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 BlockHash
- getCounterAtBlock :: BlockId -> ImplicitAddress -> m TezosInt64
- getBlockHeader :: BlockId -> m BlockHeader
- getScriptSizeAtBlock :: BlockId -> CalcSize -> m ScriptSize
- getBlockConstants :: BlockId -> m BlockConstants
- getBlockOperations :: BlockId -> m [[BlockOperation]]
- getBlockOperationHashes :: BlockId -> m [[OperationHash]]
- 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 -> ContractAddress -> m OriginationScript
- getContractStorageAtBlock :: BlockId -> ContractAddress -> m Expression
- getContractBigMapAtBlock :: BlockId -> ContractAddress -> 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 -> ContractAddress -> m (Maybe KeyHash)
- runCodeAtBlock :: BlockId -> RunCode -> m RunCodeResult
- getChainId :: m ChainId
- getManagerKeyAtBlock :: BlockId -> ImplicitAddress -> m (Maybe PublicKey)
- waitForOperation :: m OperationHash -> m OperationHash
- 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 => ContractAddress -> m Contract
- getImplicitContractCounter :: HasTezosRpc m => ImplicitAddress -> m TezosInt64
- getContractStorage :: HasTezosRpc m => ContractAddress -> m Expression
- getBigMapValue :: HasTezosRpc m => Natural -> Text -> m Expression
- getHeadBlock :: HasTezosRpc m => m BlockHash
- getCounter :: HasTezosRpc m => ImplicitAddress -> 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 => ContractAddress -> m OriginationScript
- getContractBigMap :: HasTezosRpc m => ContractAddress -> GetBigMap -> m GetBigMapResult
- getBalance :: forall kind m. (HasTezosRpc m, L1AddressKind kind) => KindedAddress kind -> m Mutez
- getDelegate :: HasTezosRpc m => ContractAddress -> m (Maybe KeyHash)
- runCode :: HasTezosRpc m => RunCode -> m RunCodeResult
- getManagerKey :: HasTezosRpc m => ImplicitAddress -> m (Maybe PublicKey)
- data ClientRpcError
- = ContractFailed ContractAddress Expression
- | BadParameter Address Expression
- | EmptyTransaction ImplicitAddress
- | ShiftOverflow ContractAddress
- | GasExhaustion ContractAddress
- | KeyAlreadyRevealed ImplicitAddress
- | ClientInternalError InternalError
- data UnexpectedErrors
- data IncorrectRpcResponse
- = RpcUnexpectedSize Int Int
- | RpcOriginatedNoContracts
- | RpcNoOperationsRun
- | RpcOriginatedMoreContracts [ContractAddress]
- data RunError
- = RuntimeError ContractAddress
- | 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 ImplicitAddress
- | ScriptOverflow
- | GasExhaustedOperation
- | MutezAdditionOverflow [TezosInt64]
- | MutezSubtractionUnderflow [TezosInt64]
- | MutezMultiplicationOverflow TezosInt64 TezosInt64
- | CantPayStorageFee
- | BalanceTooLow ("balance" :! Mutez) ("required" :! Mutez)
- | PreviouslyRevealedKey ImplicitAddress
- | NonExistingContract Address
- | InvalidB58Check Text
- 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) => ContractAddress -> 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
- 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 :: Bool -> ContractAddress -> ContractAlias -> m ()
- resolveAddressMaybe :: AddressOrAlias kind -> m (Maybe (KindedAddress kind))
- getAlias :: L1AddressKind kind => AddressOrAlias kind -> m (Alias kind)
- registerDelegate :: ImplicitAlias -> Maybe ScrubbedBytes -> m ()
- getKeyPassword :: ImplicitAddress -> m (Maybe ScrubbedBytes)
- resolveAddress :: (MonadThrow m, HasTezosClient m) => AddressOrAlias kind -> m (KindedAddress kind)
- 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
- 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 BlockHash | Idenfitier referring to a block by its hash in Base58Check notation. |
AtDepthId Natural | Identifier of a block at specific depth relative to |
Instances
Show BlockId Source # | |
Buildable BlockId Source # | |
Defined in Morley.Client.RPC.Types | |
Eq BlockId Source # | |
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 BlockHash Source #
getCounterAtBlock :: BlockId -> ImplicitAddress -> 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.
getScriptSizeAtBlock :: BlockId -> CalcSize -> m ScriptSize Source #
Get the script size at 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.
getBlockOperationHashes :: BlockId -> m [[OperationHash]] Source #
Get all operation hashes 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 -> ContractAddress -> 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 -> ContractAddress -> 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 -> ContractAddress -> 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 -> ContractAddress -> 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 -> ImplicitAddress -> m (Maybe PublicKey) Source #
Get manager key for given address.
Returns Nothing
if this key wasn't revealed.
waitForOperation :: m OperationHash -> m OperationHash Source #
Blocks until an operation with the given hash is included into the chain. The first argument is the action that puts the operation on the chain. Returns the hash of the included operation.
Instances
data OperationInfo i Source #
OpTransfer (TransferInfo i) | |
OpOriginate (OriginationInfo i) | |
OpReveal (RevealInfo i) |
Instances
Each '[ToJSONObject] '[TransferInfo i, OriginationInfo i, RevealInfo i] => ToJSON (OperationInfo i) Source # | |
Defined in Morley.Client.Types toJSON :: OperationInfo i -> Value # toEncoding :: OperationInfo i -> Encoding # toJSONList :: [OperationInfo i] -> Value # toEncodingList :: [OperationInfo i] -> Encoding # | |
ToJSON (OperationInfo i) => ToJSONObject (OperationInfo i) Source # | |
Defined in Morley.Client.Types |
class OperationInfoDescriptor (i :: Type) Source #
type TransferInfo i :: Type Source #
type OriginationInfo i :: Type Source #
type RevealInfo i :: Type Source #
Instances
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 # | |
OperationInfoDescriptor RPCInput Source # | |
Defined in Morley.Client.RPC.Types type TransferInfo RPCInput Source # type OriginationInfo RPCInput Source # type RevealInfo RPCInput 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 # | |
type OriginationInfo RPCInput Source # | |
Defined in Morley.Client.RPC.Types | |
type RevealInfo RPCInput Source # | |
Defined in Morley.Client.RPC.Types | |
type TransferInfo RPCInput Source # | |
Defined in Morley.Client.RPC.Types |
getContract :: HasTezosRpc m => ContractAddress -> m Contract Source #
Get originated Contract
for some address.
getImplicitContractCounter :: HasTezosRpc m => ImplicitAddress -> m TezosInt64 Source #
Get counter value for given implicit address.
getContractStorage :: HasTezosRpc m => ContractAddress -> 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 BlockHash Source #
Get hash of the current head block, this head hash is used in other RPC calls.
getCounter :: HasTezosRpc m => ImplicitAddress -> 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 => ContractAddress -> m OriginationScript Source #
getContractScriptAtBlock
applied to the head block.
getContractBigMap :: HasTezosRpc m => ContractAddress -> GetBigMap -> m GetBigMapResult Source #
getContractBigMapAtBlock
applied to the head block.
getBalance :: forall kind m. (HasTezosRpc m, L1AddressKind kind) => KindedAddress kind -> m Mutez Source #
getBalanceAtBlock
applied to the head block.
getDelegate :: HasTezosRpc m => ContractAddress -> 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 => ImplicitAddress -> 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
Exception ClientRpcError Source # | |
Defined in Morley.Client.RPC.Error | |
Show ClientRpcError Source # | |
Defined in Morley.Client.RPC.Error showsPrec :: Int -> ClientRpcError -> ShowS # show :: ClientRpcError -> String # showList :: [ClientRpcError] -> ShowS # | |
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
Exception UnexpectedErrors Source # | |
Defined in Morley.Client.RPC.Error | |
Show UnexpectedErrors Source # | |
Defined in Morley.Client.RPC.Error showsPrec :: Int -> UnexpectedErrors -> ShowS # show :: UnexpectedErrors -> String # showList :: [UnexpectedErrors] -> ShowS # | |
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 [ContractAddress] |
Instances
Exception IncorrectRpcResponse Source # | |
Show IncorrectRpcResponse Source # | |
Defined in Morley.Client.RPC.Error showsPrec :: Int -> IncorrectRpcResponse -> ShowS # show :: IncorrectRpcResponse -> String # showList :: [IncorrectRpcResponse] -> ShowS # | |
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 ContractAddress | |
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 ImplicitAddress | |
NonExistingContract Address | |
InvalidB58Check Text |
Getters
data ValueDecodeFailure Source #
Failed to decode received value to the given type.
Instances
Exception ValueDecodeFailure Source # | |
Defined in Morley.Client.RPC.Getters | |
Show ValueDecodeFailure Source # | |
Defined in Morley.Client.RPC.Getters showsPrec :: Int -> ValueDecodeFailure -> ShowS # show :: ValueDecodeFailure -> String # showList :: [ValueDecodeFailure] -> ShowS # | |
Buildable ValueDecodeFailure Source # | |
Defined in Morley.Client.RPC.Getters build :: ValueDecodeFailure -> Builder # |
data ValueNotFound Source #
Instances
Exception ValueNotFound Source # | |
Defined in Morley.Client.RPC.Getters | |
Show ValueNotFound Source # | |
Defined in Morley.Client.RPC.Getters showsPrec :: Int -> ValueNotFound -> ShowS # show :: ValueNotFound -> String # showList :: [ValueNotFound] -> ShowS # | |
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) => ContractAddress -> 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
class Monad m => HasTezosClient m where Source #
Type class that provides interaction with tezos-client
binary
signBytes :: ImplicitAddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> m Signature Source #
Sign an operation with tezos-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 :: Bool -> 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.
resolveAddressMaybe :: AddressOrAlias kind -> m (Maybe (KindedAddress kind)) Source #
Retrieve an address from given address or alias. If address or alias does not exist
returns Nothing
getAlias :: L1AddressKind kind => AddressOrAlias kind -> m (Alias kind) 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.
registerDelegate :: ImplicitAlias -> Maybe ScrubbedBytes -> m () Source #
Register a given address as delegate TODO [#869] move to HasTezosRpc
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
HasTezosClient MorleyClientM Source # | |
Defined in Morley.Client.Full signBytes :: ImplicitAddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> MorleyClientM Signature Source # genKey :: ImplicitAlias -> MorleyClientM ImplicitAddress Source # genFreshKey :: ImplicitAlias -> MorleyClientM ImplicitAddress Source # revealKey :: ImplicitAlias -> Maybe ScrubbedBytes -> MorleyClientM () Source # rememberContract :: Bool -> ContractAddress -> ContractAlias -> MorleyClientM () Source # resolveAddressMaybe :: forall (kind :: AddressKind). AddressOrAlias kind -> MorleyClientM (Maybe (KindedAddress kind)) Source # getAlias :: forall (kind :: AddressKind). L1AddressKind kind => AddressOrAlias kind -> MorleyClientM (Alias kind) Source # registerDelegate :: ImplicitAlias -> Maybe ScrubbedBytes -> MorleyClientM () Source # getKeyPassword :: ImplicitAddress -> MorleyClientM (Maybe ScrubbedBytes) Source # | |
HasTezosClient MorleyOnlyRpcM Source # | |
Defined in Morley.Client.OnlyRPC signBytes :: ImplicitAddressOrAlias -> Maybe ScrubbedBytes -> ByteString -> MorleyOnlyRpcM Signature Source # genKey :: ImplicitAlias -> MorleyOnlyRpcM ImplicitAddress Source # genFreshKey :: ImplicitAlias -> MorleyOnlyRpcM ImplicitAddress Source # revealKey :: ImplicitAlias -> Maybe ScrubbedBytes -> MorleyOnlyRpcM () Source # rememberContract :: Bool -> ContractAddress -> ContractAlias -> MorleyOnlyRpcM () Source # resolveAddressMaybe :: forall (kind :: AddressKind). AddressOrAlias kind -> MorleyOnlyRpcM (Maybe (KindedAddress kind)) Source # getAlias :: forall (kind :: AddressKind). L1AddressKind kind => AddressOrAlias kind -> MorleyOnlyRpcM (Alias kind) Source # registerDelegate :: ImplicitAlias -> Maybe ScrubbedBytes -> MorleyOnlyRpcM () Source # getKeyPassword :: ImplicitAddress -> MorleyOnlyRpcM (Maybe ScrubbedBytes) Source # |
resolveAddress :: (MonadThrow m, HasTezosClient m) => AddressOrAlias kind -> m (KindedAddress kind) Source #
Return KindedAddress
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 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 # |
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 # |