Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Morley client that connects with real Tezos network through RPC and
the octez-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 = MorleyClientEnv {
- mceTezosClient :: TezosClientEnv
- mceLogAction :: ClientLogAction MorleyClientM
- mceSecretKey :: Maybe SecretKey
- mceClientEnv :: ClientEnv
- runMorleyClientM :: MorleyClientEnv -> MorleyClientM a -> IO a
- mkMorleyClientEnv :: MorleyClientConfig -> IO MorleyClientEnv
- mceTezosClientL :: Lens' MorleyClientEnv TezosClientEnv
- mceLogActionL :: Lens' MorleyClientEnv (ClientLogAction MorleyClientM)
- mceSecretKeyL :: Lens' MorleyClientEnv (Maybe SecretKey)
- mceClientEnvL :: Lens' MorleyClientEnv 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 -> L1Address -> 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)
- | OpDelegation (DelegationInfo i)
- class OperationInfoDescriptor (i :: Type) where
- type TransferInfo i :: Type
- type OriginationInfo i :: Type
- type RevealInfo i :: Type
- type DelegationInfo 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 => L1Address -> 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
- | DelegateNotRegistered ImplicitAddress
- | ClientInternalError InternalError
- data UnexpectedErrors
- data IncorrectRpcResponse
- = RpcUnexpectedSize Int Int
- | RpcOriginatedNoContracts
- | 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
- | UnregisteredDelegate ImplicitAddress
- | FailedUnDelegation ImplicitAddress
- | DelegateAlreadyActive
- | IllTypedContract Expression
- | IllTypedData Expression Expression
- | BadStack BadStackInformation
- | ForbiddenZeroAmountTicket
- 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 :: AliasBehavior -> ContractAddress -> ContractAlias -> m ()
- getAliasesAndAddresses :: m [(Text, Text)]
- getKeyPassword :: ImplicitAddress -> m (Maybe ScrubbedBytes)
- class Resolve addressOrAlias where
- type ResolvedAddress addressOrAlias :: Type
- type ResolvedAlias addressOrAlias :: Type
- data ResolveError where
- REAliasNotFound :: Text -> ResolveError
- REWrongKind :: Alias expectedKind -> Address -> ResolveError
- REAddressNotFound :: KindedAddress kind -> ResolveError
- getAlias :: forall addressOrAlias m env. (HasTezosClient m, WithClientLog env m, MonadThrow m, Resolve addressOrAlias) => addressOrAlias -> m (ResolvedAlias addressOrAlias)
- getAliasMaybe :: forall addressOrAlias m env. (HasTezosClient m, WithClientLog env m, MonadThrow m, Resolve addressOrAlias) => addressOrAlias -> m (Maybe (ResolvedAlias addressOrAlias))
- resolveAddress :: forall addressOrAlias m env. (HasTezosClient m, MonadThrow m, WithClientLog env m, Resolve addressOrAlias) => addressOrAlias -> m (ResolvedAddress addressOrAlias)
- resolveAddressMaybe :: forall addressOrAlias m env. (HasTezosClient m, MonadThrow m, WithClientLog env m, Resolve addressOrAlias) => addressOrAlias -> m (Maybe (ResolvedAddress addressOrAlias))
- data TezosClientError
- = UnexpectedClientFailure Int Text Text
- | 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
- | DuplicateAlias Text
- | AmbiguousAlias Text ContractAddress ImplicitAddress
- | AliasTxRollup Text (KindedAddress 'AddressKindTxRollup)
- | ResolveError ResolveError
- data AliasBehavior
- 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 Source #
Runtime environment for morley client.
MorleyClientEnv | |
|
Instances
HasTezosClientEnv MorleyClientEnv Source # | |
Defined in Morley.Client.Full | |
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) # |
runMorleyClientM :: MorleyClientEnv -> MorleyClientM a -> IO a Source #
Run MorleyClientM
action within given MorleyClientEnv
. Retry action
in case of invalid counter error.
mkMorleyClientEnv :: MorleyClientConfig -> IO MorleyClientEnv Source #
Construct MorleyClientEnv
.
octez-client
path is taken fromMorleyClientConfig
, but can be overridden usingMORLEY_TEZOS_CLIENT
environment variable.- Node data is taken from
octez-client
config and can be overridden byMorleyClientConfig
. - The rest is taken from
MorleyClientConfig
as is.
Lens
mceSecretKeyL :: Lens' MorleyClientEnv (Maybe SecretKey) 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 -> L1Address -> 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
octez-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) | |
OpDelegation (DelegationInfo i) |
Instances
Each '[ToJSONObject] '[TransferInfo i, OriginationInfo i, RevealInfo i, DelegationInfo 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 #
type DelegationInfo 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 # type DelegationInfo ClientInput Source # | |
OperationInfoDescriptor Result Source # | |
Defined in Morley.Client.Action.Operation type TransferInfo Result Source # type OriginationInfo Result Source # type RevealInfo Result Source # type DelegationInfo Result Source # | |
OperationInfoDescriptor RPCInput Source # | |
Defined in Morley.Client.RPC.Types type TransferInfo RPCInput Source # type OriginationInfo RPCInput Source # type RevealInfo RPCInput Source # type DelegationInfo 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 DelegationInfo RPCInput Source # | |
type DelegationInfo 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 | |
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 => L1Address -> 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. |
| |
DelegateNotRegistered | Address not registered as delegate |
| |
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 | |
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.
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.
octez-client
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
class Resolve addressOrAlias Source #
type ResolvedAddress addressOrAlias :: Type Source #
type ResolvedAlias addressOrAlias :: Type Source #
Instances
data ResolveError where Source #
REAliasNotFound | |
| |
REWrongKind | |
| |
REAddressNotFound | |
|
Instances
Show ResolveError Source # | |
Defined in Morley.Client.TezosClient.Impl showsPrec :: Int -> ResolveError -> ShowS # show :: ResolveError -> String # showList :: [ResolveError] -> ShowS # | |
Buildable ResolveError Source # | |
Defined in Morley.Client.TezosClient.Impl build :: ResolveError -> Builder # |
getAlias :: forall addressOrAlias m env. (HasTezosClient m, WithClientLog env m, MonadThrow m, Resolve addressOrAlias) => addressOrAlias -> m (ResolvedAlias addressOrAlias) Source #
Looks up the alias associated with the given addressOrAlias
.
Will throw a TezosClientError
if addressOrAlias
:
- is an address that is not associated with any alias.
- is an alias that does not exist.
- is an alias that exists but its address is of the wrong kind.
When the alias is associated with both an implicit and a contract address:
- The
SomeAddressOrAlias
instance will throw aTezosClientError
, unless the alias is prefixed withimplicit:
orcontract:
to disambiguate. - The
AddressOrAlias
instance will return the alias.
getAliasMaybe :: forall addressOrAlias m env. (HasTezosClient m, WithClientLog env m, MonadThrow m, Resolve addressOrAlias) => addressOrAlias -> m (Maybe (ResolvedAlias addressOrAlias)) Source #
Looks up the alias associated with the given addressOrAlias
.
Will return Nothing
if addressOrAlias
:
- is an address that is not associated with any alias.
- is an alias that does not exist.
- is an alias that exists but its address is of the wrong kind.
When the alias is associated with both an implicit and a contract address:
- The
SomeAddressOrAlias
instance will throw aTezosClientError
, unless the alias is prefixed withimplicit:
orcontract:
to disambiguate. - The
AddressOrAlias
instance will return the alias.
resolveAddress :: forall addressOrAlias m env. (HasTezosClient m, MonadThrow m, WithClientLog env m, Resolve addressOrAlias) => addressOrAlias -> m (ResolvedAddress addressOrAlias) Source #
Looks up the address associated with the given addressOrAlias
.
Will throw a TezosClientError
if addressOrAlias
is an alias and:
- the alias does not exist.
- the alias exists but its address is of the wrong kind.
When the alias is associated with both an implicit and a contract address:
- The
SomeAddressOrAlias
instance will throw aTezosClientError
, unless the alias is prefixed withimplicit:
orcontract:
to disambiguate. - The
AddressOrAlias
instance will return the address with the requested kind.
resolveAddressMaybe :: forall addressOrAlias m env. (HasTezosClient m, MonadThrow m, WithClientLog env m, Resolve addressOrAlias) => addressOrAlias -> m (Maybe (ResolvedAddress addressOrAlias)) Source #
Looks up the address associated with the given addressOrAlias
.
Will return Nothing
if addressOrAlias
is an alias and:
- the alias does not exist.
- the alias exists but its address is of the wrong kind.
When the alias is associated with both an implicit and a contract address:
- The
SomeAddressOrAlias
instance will throw aTezosClientError
, unless the alias is prefixed withimplicit:
orcontract:
to disambiguate. - The
AddressOrAlias
instance will return the address with the requested kind.
data TezosClientError Source #
A data type for all predicatable errors that can happen during
octez-client
usage.
UnexpectedClientFailure |
|
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 |
|
DuplicateAlias Text | Tried to save alias, but such alias already exists. |
AmbiguousAlias Text ContractAddress ImplicitAddress | Expected an alias to be associated with either an implicit address or a contract address, but it was associated with both. |
AliasTxRollup Text (KindedAddress 'AddressKindTxRollup) | Expected an alias to be associated with either an implicit address or a contract address, but it was associated with a transaction rollup address. |
ResolveError ResolveError |
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 # |
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 |
Instances
Util
disableAlphanetWarning :: IO () Source #
Sets the environment variable for disabling octez-client
's
"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 # |