haskoin-store 0.52.3 → 0.52.4
raw patch · 3 files changed
+23/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- haskoin-store.cabal +2/−2
- src/Haskoin/Store/Web.hs +17/−10
CHANGELOG.md view
@@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) +## 0.52.4+### Fixed+- Use Base58 addresses by default in Blockchain.info balance querios.+ ## 0.52.3 ### Fixed - Errors should also contain CORS headers.
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 1b40d28d83e2cddb03963757ee2e052cbbfa539b82d7449d5132bc05c2d35485+-- hash: c16fdfbfaeb6b0c31ab673c5c9bb78d75c36fb522954b9d2675fcabff47dd2ed name: haskoin-store-version: 0.52.3+version: 0.52.4 synopsis: Storage and index for Bitcoin and Bitcoin Cash description: Please see the README on GitHub at <https://github.com/haskoin/haskoin-store#readme> category: Bitcoin, Finance, Network
src/Haskoin/Store/Web.hs view
@@ -1446,13 +1446,16 @@ | c -> return () | otherwise -> yield a >> go b' +getCashAddr :: Monad m => WebT m Bool+getCashAddr = S.param "cashaddr" `S.rescue` const (return False)+ scottyMultiAddr :: (MonadUnliftIO m, MonadLoggerIO m) => WebT m () scottyMultiAddr = get_addrs >>= \(addrs', xpubs, saddrs, sxpubs, xspecs) -> getNumTxId >>= \numtxid ->+ getCashAddr >>= \cashaddr -> lift (asks webTicker) >>= \ticker -> get_price ticker >>= \local ->- get_cashaddr >>= \cashaddr -> get_offset >>= \offset -> get_count >>= \n -> get_prune >>= \prune ->@@ -1547,8 +1550,6 @@ Just p -> return $ binfoTickerToSymbol code p get_prune = fmap not $ S.param "no_compact" `S.rescue` const (return False)- get_cashaddr = S.param "cashaddr"- `S.rescue` const (return False) get_count = do d <- lift (asks (maxLimitDefault . webMaxLimits . webConfig)) x <- lift (asks (maxLimitFull . webMaxLimits . webConfig))@@ -1680,10 +1681,12 @@ scottyShortBal :: (MonadUnliftIO m, MonadLoggerIO m) => WebT m () scottyShortBal = getBinfoActive balanceStat >>= \(xspecs, addrs) ->+ getCashAddr >>= \cashaddr -> getNumTxId >>= \numtxid -> do setMetrics balanceStat (hl addrs + ml xspecs) net <- lift $ asks (storeNetwork . webStore . webConfig)- abals <- catMaybes <$> mapM (get_addr_balance net) (HashSet.toList addrs)+ abals <- catMaybes <$>+ mapM (get_addr_balance net cashaddr) (HashSet.toList addrs) xbals <- mapM (get_xspec_balance net) (HashMap.elems xspecs) let res = HashMap.fromList (abals <> xbals) setHeaders@@ -1698,12 +1701,16 @@ binfoShortBalTxCount = balanceTxCount, binfoShortBalReceived = balanceTotalReceived }- get_addr_balance net a =- case addrToText net a of- Nothing -> return Nothing- Just a' -> getBalance a >>= \case- Nothing -> return $ Just (a', to_short_bal (zeroBalance a))- Just b -> return $ Just (a', to_short_bal b)+ get_addr_balance net cashaddr a =+ let net' = if | cashaddr -> net+ | net == bch -> btc+ | net == bchTest -> btcTest+ | otherwise -> net+ in case addrToText net' a of+ Nothing -> return Nothing+ Just a' -> getBalance a >>= \case+ Nothing -> return $ Just (a', to_short_bal (zeroBalance a))+ Just b -> return $ Just (a', to_short_bal b) is_ext XPubBal{xPubBalPath = 0:_} = True is_ext _ = False get_xspec_balance net xpub = do