packages feed

bitcoin-payment-channel 0.5.0.0 → 0.5.0.1

raw patch · 3 files changed

+2/−42 lines, 3 filesdep ~base64-bytestringPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base64-bytestring

API changes (from Hackage documentation)

- Data.Bitcoin.PaymentChannel.Types: instance Data.Aeson.Types.Class.FromJSON Data.Bitcoin.PaymentChannel.Types.ReceiverPaymentChannel
- Data.Bitcoin.PaymentChannel.Types: instance Data.Aeson.Types.Class.ToJSON Data.Bitcoin.PaymentChannel.Types.ReceiverPaymentChannel

Files

bitcoin-payment-channel.cabal view
@@ -1,5 +1,5 @@ name:                 bitcoin-payment-channel-version:              0.5.0.0+version:              0.5.0.1 synopsis:             Library for working with Bitcoin payment channels description:     A Bitcoin payment channel allows secure and instant transfer of bitcoins from one@@ -55,7 +55,6 @@   build-depends:        base                >= 4.7    && < 5,                         haskoin-core        >= 0.4.0  && < 0.5.0,                         base16-bytestring   >= 0.1.0  && < 0.2.0,-                        base64-bytestring   >= 1.0.0  && < 1.1.0,                         bytestring          >= 0.10.0 && < 0.11.0,                         cereal              >= 0.5.0  && < 0.6.0,                         errors              >= 2.0.0  && < 2.2.0,
src/Data/Bitcoin/PaymentChannel/Internal/Serialization.hs view
@@ -11,17 +11,12 @@ import           Data.Aeson import           Data.Aeson.Types (Parser, Pair) import           Data.Scientific (Scientific, scientific, toBoundedInteger)-import           Data.Text.Encoding       (decodeUtf8, encodeUtf8) import qualified Data.Serialize     as Bin import qualified Data.Serialize.Put as BinPut import qualified Data.Serialize.Get as BinGet -import qualified Data.ByteString.Base64.URL as B64 import qualified Data.ByteString as B-import qualified Data.Text as T import           Data.Word (Word64)-import           Data.EitherR (fmapL)-import           Data.Typeable import qualified Data.Tagged as Tag  -- Generic PayChanError instance@@ -91,13 +86,7 @@     parseJSON = withScientific "BitcoinAmount" $         fmap fromIntegral . parseJSONInt -instance ToJSON PaymentChannelState where-    toJSON = toJSON . txtB64Encode -instance FromJSON PaymentChannelState where-    parseJSON = withText "PaychanState" txtB64Decode-- --- Binary instance Bin.Serialize ChanScript where     put (ChanScript s) =@@ -171,24 +160,6 @@     maxBound = BitcoinAmount $ round $ 21e6 * 1e8  ---- Util-b64Encode :: Bin.Serialize a => a -> B.ByteString-b64Encode = B64.encode . Bin.encode--b64Decode :: (Typeable a, Bin.Serialize a) => B.ByteString -> Either String a-b64Decode b64 =-    concatErr "failed to deserialize parsed base64 data: " . deserEither =<<-    (concatErr "failed to parse base64 data: ") (b64Decode b64)-        where-            b64Decode = B64.decode . padToMod4-            concatErr e = fmapL (e ++)--txtB64Encode :: Bin.Serialize a => a -> T.Text-txtB64Encode = decodeUtf8 . b64Encode--txtB64Decode :: (Typeable a, Bin.Serialize a) => T.Text -> Parser a-txtB64Decode = either fail return . b64Decode . encodeUtf8- parseJSONInt :: Scientific -> Parser Integer parseJSONInt s =     case toBoundedInteger s of@@ -200,12 +171,3 @@     case toBoundedInteger s of         Just w -> return w         Nothing -> fail $ "failed to decode JSON number to Word64. data: " ++ show s--padToMod4 :: B.ByteString -> B.ByteString-padToMod4 bs =-    let-        lastGroupSize = B.length bs `mod` 4-        numPadChars = if lastGroupSize > 0 then 4 - lastGroupSize else 0-        equalASCIIChar = 61-    in-        B.concat [bs, B.replicate numPadChars equalASCIIChar]
src/Data/Bitcoin/PaymentChannel/Types.hs view
@@ -37,7 +37,6 @@ import Data.Bitcoin.PaymentChannel.Internal.Error (PayChanError(..))  import qualified  Data.Serialize as Bin-import            Data.Aeson as JSON -- (FromJSON, ToJSON) import qualified  Network.Haskoin.Crypto as HC import qualified  Network.Haskoin.Transaction as HT import            Data.Word (Word64)@@ -91,7 +90,7 @@ newtype ReceiverPaymentChannel = CReceiverPaymentChannel {     -- |Internal state object     rpcState        ::  PaymentChannelState-} deriving (Eq, Bin.Serialize, FromJSON, ToJSON)+} deriving (Eq, Bin.Serialize)  instance PaymentChannel SenderPaymentChannel where     valueToMe = channelValueLeft