@@ -14,6 +14,7 @@ import Explorer.Config
1414import Ledger ( TxOutRef , txOutRefId , txOutRefIdx )
1515import Prelude hiding (Ordering )
1616import System.Logging.Hlog (Logging (Logging , debugM ), MakeLogging (MakeLogging , forComponent ))
17+ import Common.String.Formatting (toLower )
1718
1819data Explorer f = Explorer
1920 { getOutput :: TxOutRef -> f (Maybe FullTxOut )
@@ -35,23 +36,23 @@ mkExplorer MakeLogging{..} conf = do
3536 }
3637
3738getOutput' :: MonadIO f => Logging f -> ExplorerConfig -> TxOutRef -> f (Maybe FullTxOut )
38- getOutput' logging conf ref =
39- mkGetRequest logging conf $ " /cardano/v1/outputs/" ++ renderTxOutRef ref
39+ getOutput' logging conf@ ExplorerConfig { .. } ref =
40+ mkGetRequest logging conf $ " /cardano/" ++ toLower ( show network) ++ " / v1/outputs/" ++ renderTxOutRef ref
4041
4142getUnspentOutputs' :: MonadIO f => Logging f -> ExplorerConfig -> Gix -> Limit -> Ordering -> f (Items FullTxOut )
42- getUnspentOutputs' logging conf minIndex limit ordering =
43- mkGetRequest logging conf $ " /cardano/v1/outputs/unspent/indexed?minIndex=" ++ show minIndex ++ " &limit=" ++ show limit ++ " &ordering=" ++ show ordering
43+ getUnspentOutputs' logging conf@ ExplorerConfig { .. } minIndex limit ordering =
44+ mkGetRequest logging conf $ " /cardano/" ++ toLower ( show network) ++ " / v1/outputs/unspent/indexed?minIndex=" ++ show minIndex ++ " &limit=" ++ show limit ++ " &ordering=" ++ show ordering
4445
4546getUnspentOutputsByPCred' :: MonadIO f => Logging f -> ExplorerConfig -> PaymentCred -> Paging -> f (Items FullTxOut )
46- getUnspentOutputsByPCred' logging conf pcred Paging {.. } =
47- mkGetRequest logging conf $ " /cardano/v1/outputs/unspent/byPaymentCred/" ++ T. unpack (unPaymentCred pcred) ++ " /?offset=" ++ show offset ++ " &limit=" ++ show limit
47+ getUnspentOutputsByPCred' logging conf@ ExplorerConfig { .. } pcred Paging {.. } =
48+ mkGetRequest logging conf $ " /cardano/" ++ toLower ( show network) ++ " / v1/outputs/unspent/byPaymentCred/" ++ T. unpack (unPaymentCred pcred) ++ " /?offset=" ++ show offset ++ " &limit=" ++ show limit
4849
4950getSystemEnv' :: MonadIO f => Logging f -> ExplorerConfig -> f SystemEnv
50- getSystemEnv' logging conf = mkGetRequest logging conf " /cardano/v1/networkParams"
51+ getSystemEnv' logging conf@ ExplorerConfig { .. } = mkGetRequest logging conf ( " /cardano/v1/" ++ toLower ( show network) ++ " / networkParams" )
5152
5253getTxs' :: MonadIO f => Logging f -> ExplorerConfig -> Paging -> Ordering -> f (Items FullTx )
53- getTxs' logging conf Paging {.. } ordering =
54- mkGetRequest logging conf $ " /cardano/v1/transactions/?offset=" ++ show offset ++ " &limit=" ++ show limit ++ " &ordering=" ++ show ordering
54+ getTxs' logging conf@ ExplorerConfig { .. } Paging {.. } ordering =
55+ mkGetRequest logging conf $ " /cardano/" ++ toLower ( show network) ++ " / v1/transactions/?offset=" ++ show offset ++ " &limit=" ++ show limit ++ " &ordering=" ++ show ordering
5556
5657mkGetRequest :: (MonadIO f , FromJSON a , Show a ) => Logging f -> ExplorerConfig -> String -> f a
5758mkGetRequest Logging {.. } ExplorerConfig {.. } path = do
0 commit comments