morley-client-0.2.1: Client to interact with the Tezos blockchain
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Client.RPC.Class

Description

An abstraction layer over RPC implementation. The primary reason it exists is to make it possible to fake RPC in tests.

Synopsis

Documentation

class (Monad m, MonadCatch m) => HasTezosRpc m where Source #

Type class that provides interaction with tezos node via RPC

Methods

getBlockHash :: BlockId -> m BlockHash Source #

Get hash of the given BlockId, mostly used to get hash of HeadId

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

Instances details
HasTezosRpc MorleyClientM Source # 
Instance details

Defined in Morley.Client.Full

Methods

getBlockHash :: BlockId -> MorleyClientM BlockHash Source #

getCounterAtBlock :: BlockId -> ImplicitAddress -> MorleyClientM TezosInt64 Source #

getBlockHeader :: BlockId -> MorleyClientM BlockHeader Source #

getScriptSizeAtBlock :: BlockId -> CalcSize -> MorleyClientM ScriptSize Source #

getBlockConstants :: BlockId -> MorleyClientM BlockConstants Source #

getBlockOperations :: BlockId -> MorleyClientM [[BlockOperation]] Source #

getBlockOperationHashes :: BlockId -> MorleyClientM [[OperationHash]] Source #

getProtocolParametersAtBlock :: BlockId -> MorleyClientM ProtocolParameters Source #

runOperationAtBlock :: BlockId -> RunOperation -> MorleyClientM RunOperationResult Source #

preApplyOperationsAtBlock :: BlockId -> [PreApplyOperation] -> MorleyClientM [RunOperationResult] Source #

forgeOperationAtBlock :: BlockId -> ForgeOperation -> MorleyClientM HexJSONByteString Source #

injectOperation :: HexJSONByteString -> MorleyClientM OperationHash Source #

getContractScriptAtBlock :: BlockId -> ContractAddress -> MorleyClientM OriginationScript Source #

getContractStorageAtBlock :: BlockId -> ContractAddress -> MorleyClientM Expression Source #

getContractBigMapAtBlock :: BlockId -> ContractAddress -> GetBigMap -> MorleyClientM GetBigMapResult Source #

getBigMapValueAtBlock :: BlockId -> Natural -> Text -> MorleyClientM Expression Source #

getBigMapValuesAtBlock :: BlockId -> Natural -> Maybe Natural -> Maybe Natural -> MorleyClientM Expression Source #

getBalanceAtBlock :: BlockId -> Address -> MorleyClientM Mutez Source #

getDelegateAtBlock :: BlockId -> ContractAddress -> MorleyClientM (Maybe KeyHash) Source #

runCodeAtBlock :: BlockId -> RunCode -> MorleyClientM RunCodeResult Source #

getChainId :: MorleyClientM ChainId Source #

getManagerKeyAtBlock :: BlockId -> ImplicitAddress -> MorleyClientM (Maybe PublicKey) Source #

waitForOperation :: MorleyClientM OperationHash -> MorleyClientM OperationHash Source #

HasTezosRpc MorleyOnlyRpcM Source # 
Instance details

Defined in Morley.Client.OnlyRPC

Methods

getBlockHash :: BlockId -> MorleyOnlyRpcM BlockHash Source #

getCounterAtBlock :: BlockId -> ImplicitAddress -> MorleyOnlyRpcM TezosInt64 Source #

getBlockHeader :: BlockId -> MorleyOnlyRpcM BlockHeader Source #

getScriptSizeAtBlock :: BlockId -> CalcSize -> MorleyOnlyRpcM ScriptSize Source #

getBlockConstants :: BlockId -> MorleyOnlyRpcM BlockConstants Source #

getBlockOperations :: BlockId -> MorleyOnlyRpcM [[BlockOperation]] Source #

getBlockOperationHashes :: BlockId -> MorleyOnlyRpcM [[OperationHash]] Source #

getProtocolParametersAtBlock :: BlockId -> MorleyOnlyRpcM ProtocolParameters Source #

runOperationAtBlock :: BlockId -> RunOperation -> MorleyOnlyRpcM RunOperationResult Source #

preApplyOperationsAtBlock :: BlockId -> [PreApplyOperation] -> MorleyOnlyRpcM [RunOperationResult] Source #

forgeOperationAtBlock :: BlockId -> ForgeOperation -> MorleyOnlyRpcM HexJSONByteString Source #

injectOperation :: HexJSONByteString -> MorleyOnlyRpcM OperationHash Source #

getContractScriptAtBlock :: BlockId -> ContractAddress -> MorleyOnlyRpcM OriginationScript Source #

getContractStorageAtBlock :: BlockId -> ContractAddress -> MorleyOnlyRpcM Expression Source #

getContractBigMapAtBlock :: BlockId -> ContractAddress -> GetBigMap -> MorleyOnlyRpcM GetBigMapResult Source #

getBigMapValueAtBlock :: BlockId -> Natural -> Text -> MorleyOnlyRpcM Expression Source #

getBigMapValuesAtBlock :: BlockId -> Natural -> Maybe Natural -> Maybe Natural -> MorleyOnlyRpcM Expression Source #

getBalanceAtBlock :: BlockId -> Address -> MorleyOnlyRpcM Mutez Source #

getDelegateAtBlock :: BlockId -> ContractAddress -> MorleyOnlyRpcM (Maybe KeyHash) Source #

runCodeAtBlock :: BlockId -> RunCode -> MorleyOnlyRpcM RunCodeResult Source #

getChainId :: MorleyOnlyRpcM ChainId Source #

getManagerKeyAtBlock :: BlockId -> ImplicitAddress -> MorleyOnlyRpcM (Maybe PublicKey) Source #

waitForOperation :: MorleyOnlyRpcM OperationHash -> MorleyOnlyRpcM OperationHash Source #