web3 0.5.2.0 → 0.5.2.1
raw patch · 3 files changed
+9/−8 lines, 3 filesdep ~web3
Dependency ranges changed: web3
Files
src/Network/Ethereum/Web3/Contract.hs view
@@ -36,11 +36,11 @@ import qualified Data.Text.Lazy.Builder.Int as B import qualified Data.Text.Lazy.Builder as B import Control.Concurrent (ThreadId, threadDelay)+import Data.Maybe (catMaybes, listToMaybe) import Control.Monad.IO.Class (liftIO) import Control.Exception (throwIO) import Data.Text.Lazy (toStrict) import qualified Data.Text as T-import Data.Maybe (catMaybes) import Data.Monoid ((<>)) import Network.Ethereum.Web3.Provider@@ -126,22 +126,23 @@ _sendTransaction :: (Provider p, Method a, Unit b) => Address -> b -> a -> Web3 p TxHash _sendTransaction to value dat = do- primeAddress <- head <$> eth_accounts+ primeAddress <- listToMaybe <$> eth_accounts eth_sendTransaction (txdata primeAddress $ Just $ toData dat)- where txdata from = Call (Just from) to Nothing Nothing (Just $ toWeiText value)+ where txdata from = Call from to Nothing Nothing (Just $ toWeiText value) toWeiText = ("0x" <>) . toStrict . B.toLazyText . B.hexadecimal . toWei _call :: (Provider p, Method a, ABIEncoding b) => Address -> CallMode -> a -> Web3 p b _call to mode dat = do- res <- eth_call txdata mode+ primeAddress <- listToMaybe <$> eth_accounts+ res <- eth_call (txdata primeAddress) mode case fromData (T.drop 2 res) of Nothing -> liftIO $ throwIO $ ParserFail $ "Unable to parse result on `" ++ T.unpack res ++ "` from `" ++ show to ++ "`" Just x -> return x where- txdata = Call Nothing to Nothing Nothing Nothing (Just (toData dat))+ txdata from = Call from to Nothing Nothing Nothing (Just (toData dat)) -- | Zero value is used to send transaction without money nopay :: Wei
src/Network/Ethereum/Web3/Types.hs view
@@ -100,7 +100,7 @@ { callFrom :: Maybe Address , callTo :: Address , callGas :: Maybe Text- , callPrice :: Maybe Text+ , callGasPrice:: Maybe Text , callValue :: Maybe Text , callData :: Maybe Text } deriving Show
web3.cabal view
@@ -1,5 +1,5 @@ name: web3-version: 0.5.2.0+version: 0.5.2.1 cabal-version: >=1.10 build-type: Simple license: BSD3@@ -64,7 +64,7 @@ base >=4.9.0.0 && <4.10, memory ==0.13.*, text >=1.2.2.1 && <1.3,- web3 >=0.5.2.0 && <0.6+ web3 >=0.5.2.1 && <0.6 default-language: Haskell2010 default-extensions: OverloadedStrings hs-source-dirs: test