diff --git a/blockfrost-api/src/Blockfrost/Types/Cardano/Mempool.hs b/blockfrost-api/src/Blockfrost/Types/Cardano/Mempool.hs index a920717..ccf977f 100644 --- a/blockfrost-api/src/Blockfrost/Types/Cardano/Mempool.hs +++ b/blockfrost-api/src/Blockfrost/Types/Cardano/Mempool.hs @@ -1,19 +1,19 @@ -- | Transaction metadata module Blockfrost.Types.Cardano.Mempool - ( MempoolTransaction(..), - TransactionInMempool (..), - MempoolTxAmount(..), - MempoolUTxOInput(..), - MempoolRedeemer(..), + ( MempoolTransaction(..) + , TransactionInMempool (..) + , MempoolUTxOInput(..) + , MempoolRedeemer(..) ) where -import Data.Text +import Data.Text import Deriving.Aeson import Blockfrost.Types.Cardano.Transactions import Blockfrost.Types.Shared.Ada +import Blockfrost.Types.Shared.Amount -data MempoolTransaction = MempoolTransaction +data MempoolTransaction = MempoolTransaction { _tx :: TransactionInMempool , _inputs :: [MempoolUTxOInput] , _outputs :: [UtxoOutput] @@ -25,8 +25,8 @@ data MempoolTransaction = MempoolTransaction data TransactionInMempool = TransactionInMempool { _transactionHash :: Text -- ^ Transaction hash - , _transactionOutputAmount :: [MempoolTxAmount] -- ^ Transaction outputs - , _transactionFees :: Lovelaces -- ^ Transacction fee + , _transactionOutputAmount :: [Amount] -- ^ Transaction outputs + , _transactionFees :: Lovelaces -- ^ Transaction fee , _transactionDeposit :: Lovelaces -- ^ Deposit within the transaction in Lovelaces , _transactionSize :: Integer -- ^ Size of the transaction in Bytes , _transactionInvalidBefore :: Maybe Text -- ^ Left (included) endpoint of the timelock validity intervals @@ -46,29 +46,18 @@ data TransactionInMempool = TransactionInMempool deriving (FromJSON, ToJSON) via CustomJSON '[FieldLabelModifier '[StripPrefix "_transaction", CamelToSnake]] TransactionInMempool -data MempoolTxAmount - = MempoolTxAmount - { _amountUnit :: Text -- ^ Quantity in Lovelaces - , _amountQuantity :: Text -- ^ Quantity in the unit - } - deriving stock (Show, Eq, Generic) - deriving (FromJSON, ToJSON) - via CustomJSON '[FieldLabelModifier '[StripPrefix "_amount", CamelToSnake]] MempoolTxAmount - -data MempoolUTxOInput - = MempoolUTxOInput +data MempoolUTxOInput = MempoolUTxOInput { _address :: Text -- ^ Address , _txHash :: Text -- ^ Transaction hash , _outputIndex :: Integer -- ^ Output index , _collateral :: Bool -- ^ True if the input is a collateral input , _reference :: Bool -- ^ Is the input a reference input - } - deriving stock (Show, Eq, Generic) - deriving (FromJSON, ToJSON) - via CustomJSON '[FieldLabelModifier '[StripPrefix "_", CamelToSnake]] MempoolUTxOInput + } + deriving stock (Show, Eq, Generic) + deriving (FromJSON, ToJSON) + via CustomJSON '[FieldLabelModifier '[StripPrefix "_", CamelToSnake]] MempoolUTxOInput -data MempoolRedeemer - = MempoolRedeemer +data MempoolRedeemer = MempoolRedeemer { _tx_index :: Integer -- ^ Transaction index , _purpose :: Text -- ^ Purpose of the redeemer , _unit_mem :: Text -- ^ Memory unit @@ -76,4 +65,4 @@ data MempoolRedeemer } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON) - via CustomJSON '[FieldLabelModifier '[StripPrefix "_", CamelToSnake]] MempoolRedeemer \ No newline at end of file + via CustomJSON '[FieldLabelModifier '[StripPrefix "_", CamelToSnake]] MempoolRedeemer diff --git a/blockfrost-api/test/Cardano/Transactions.hs b/blockfrost-api/test/Cardano/Transactions.hs index e5da5c7..0e776a9 100644 --- a/blockfrost-api/test/Cardano/Transactions.hs +++ b/blockfrost-api/test/Cardano/Transactions.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} diff --git a/blockfrost-client/src/Blockfrost/Client/NutLink.hs b/blockfrost-client/src/Blockfrost/Client/NutLink.hs index 51f259d..e61ddd5 100644 --- a/blockfrost-client/src/Blockfrost/Client/NutLink.hs +++ b/blockfrost-client/src/Blockfrost/Client/NutLink.hs @@ -10,8 +10,8 @@ module Blockfrost.Client.NutLink , nutlinkTickers' ) where -import Blockfrost.API -import Blockfrost.Client.Types +import Blockfrost.API +import Blockfrost.Client.Types import Blockfrost.Types hiding (MempoolUTxOInput(..)) import Data.Text (Text)