11module Hydra.Invoice (
2- Invoice (MkInvoice ),
2+ Invoice (.. ),
33 PreImage (.. ),
44 PaymentId (.. ),
55 StandardInvoice ,
@@ -8,7 +8,7 @@ module Hydra.Invoice (
88 generateStandardInvoice ,
99) where
1010
11- import Cardano.Api (Address , ShelleyAddr , Value )
11+ import Cardano.Api (Address , ShelleyAddr , TxOutValue )
1212import Cardano.Binary qualified as CBOR
1313import Cardano.Crypto.Hash qualified as Crypto
1414import Control.Monad (replicateM )
@@ -33,8 +33,8 @@ newtype PreImage = UnsafePreImage {fromPreImage :: BS.ByteString}
3333type PaymentId :: Type
3434newtype PaymentId = UnsafePaymentId { fromPaymentId :: Crypto. Hash Crypto. SHA256 BS. ByteString}
3535
36- type StandardInvoice :: Type
37- type StandardInvoice = Invoice PaymentId (Address ShelleyAddr ) Value UTCTime
36+ type StandardInvoice :: Type -> Type
37+ type StandardInvoice era = Invoice PaymentId (Address ShelleyAddr ) ( TxOutValue era ) UTCTime
3838
3939generatePreImage :: IO PreImage
4040generatePreImage = UnsafePreImage . BS. pack <$> replicateM 32 (randomRIO (0 , 255 ))
@@ -43,7 +43,7 @@ hashPaymentId :: PreImage -> PaymentId
4343hashPaymentId (UnsafePreImage preimage) =
4444 UnsafePaymentId $ Crypto. hashWith CBOR. serialize' preimage
4545
46- generateStandardInvoice :: Address ShelleyAddr -> Value -> UTCTime -> IO (StandardInvoice , PreImage )
46+ generateStandardInvoice :: Address ShelleyAddr -> TxOutValue era -> UTCTime -> IO (StandardInvoice era , PreImage )
4747generateStandardInvoice recipient amount date = do
4848 preImage <- generatePreImage
4949 let invoice =
0 commit comments