packages feed

network-bitcoin 1.2.0 → 1.2.1

raw patch · 4 files changed

+17/−9 lines, 4 files

Files

network-bitcoin.cabal view
@@ -1,5 +1,5 @@ Name:                network-bitcoin-Version:             1.2.0+Version:             1.2.1 Synopsis:            An interface to bitcoind. Description:     This can be used to send Bitcoins, query balances, etc.  It
src/Network/Bitcoin/Internal.hs view
@@ -16,6 +16,7 @@                                 , FromJSON(..)                                 , callApi                                 , callApi'+                                , Nil(..)                                 , tj                                 , AddrAddress(..)                                 ) where@@ -108,6 +109,13 @@                             , "id"      .= (1 :: Int)                             ] {-# INLINE callApi #-}++-- | Used to allow "null" to decode to a tuple.+data Nil = Nil { unNil :: () }++instance FromJSON Nil where+    parseJSON Null = return $ Nil ()+    parseJSON x    = fail $ "\"null\" was expected, but " ++ show x ++ " was recieved."  -- | Internal helper functions to make callApi more readable httpAuthority :: Auth -> Authority
src/Network/Bitcoin/Mining.hs view
@@ -47,9 +47,9 @@                          --   available cores, and any other value to limit it.             -> IO () setGenerate auth onOff Nothing =-    callApi auth "setgenerate" [ tj onOff ]+    unNil <$> callApi auth "setgenerate" [ tj onOff ] setGenerate auth onOff (Just limit) =-    callApi auth "setgenerate" [ tj onOff, tj limit ]+    unNil <$> callApi auth "setgenerate" [ tj onOff, tj limit ]  -- | Returns a recent hashes per second performance measurement while --   generating.
src/Network/Bitcoin/Wallet.hs view
@@ -108,7 +108,7 @@                                         <*> o .:  "proxy"                                         <*> o .:  "difficulty"                                         <*> o .:  "testnet"-                                        <*> o .:  "keypoololddest"+                                        <*> o .:  "keypoololdest"                                         <*> o .:  "keypoolsize"                                         <*> o .:  "paytxfee"                                         <*> o .:? "unlocked_until"@@ -417,11 +417,11 @@              -> FilePath              -> IO () backupWallet auth fp =-    callApi auth "backupwallet" [ tj fp ]+    unNil <$> callApi auth "backupwallet" [ tj fp ]  -- | Fills the keypool. keyPoolRefill :: Auth -> IO ()-keyPoolRefill auth = callApi auth "keypoolrefill" []+keyPoolRefill auth = unNil <$> callApi auth "keypoolrefill" []  -- | Stores the wallet decryption key in memory for the given amount of time. unlockWallet :: Auth@@ -431,7 +431,7 @@              -- ^ How long to store the key in memory (in seconds).              -> IO () unlockWallet auth pass timeout =-    callApi auth "walletpassphrase" [ tj pass, tj timeout ]+    unNil <$> callApi auth "walletpassphrase" [ tj pass, tj timeout ]  -- | Changes the wallet passphrase. changePassword :: Auth@@ -441,7 +441,7 @@                -- ^ The new password.                -> IO () changePassword auth old new =-    callApi auth "walletpassphrase" [ tj old, tj new ]+    unNil <$> callApi auth "walletpassphrase" [ tj old, tj new ]  -- | Removes the wallet encryption key from memory, locking the wallet. --@@ -451,7 +451,7 @@ --   Note: In future releases, we might introduce an "unlocked" monad, so --         locking and unlocking is automatic. lockWallet :: Auth -> IO ()-lockWallet auth = callApi auth "walletlock" []+lockWallet auth = unNil <$> callApi auth "walletlock" []  -- | Encrypts the wallet with the given passphrase. --