{-# LANGUAGE FlexibleContexts  #-}
{-# LANGUAGE OverloadedStrings #-}

-- |
-- Module      :  Network.Ethereum.Api.Web3
-- Copyright   :  Aleksandr Krupenkin 2016-2021
-- License     :  Apache-2.0
--
-- Maintainer  :  mail@akru.me
-- Stability   :  experimental
-- Portability :  unknown
--
-- Ethereum node JSON-RPC API methods with `web3_` prefix.
--

module Network.Ethereum.Api.Web3 where

import           Data.ByteArray.HexString   (HexString)
import           Data.Text                  (Text)
import           Network.JsonRpc.TinyClient (JsonRpc (..))

-- | Returns current node version string.
clientVersion :: JsonRpc m => m Text
{-# INLINE clientVersion #-}
clientVersion :: m Text
clientVersion = Text -> m Text
forall (m :: * -> *) a. (JsonRpc m, Remote m a) => Text -> a
remote Text
"web3_clientVersion"

-- | Returns Keccak-256 (not the standardized SHA3-256) of the given data.
sha3 :: JsonRpc m => HexString -> m HexString
{-# INLINE sha3 #-}
sha3 :: HexString -> m HexString
sha3 = Text -> HexString -> m HexString
forall (m :: * -> *) a. (JsonRpc m, Remote m a) => Text -> a
remote Text
"web3_sha3"