Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
An abstraction layer over RPC implementation. The primary reason it exists is to make it possible to fake RPC in tests.
Synopsis
- 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
Documentation
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.