Skip to content

Commit 0cf1eb6

Browse files
Change StandardInvoice to TxOutValue, add era parameter
1 parent fab9e6f commit 0cf1eb6

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

flake.lock

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
inputs = {
33
flake-parts.url = "github:hercules-ci/flake-parts";
44
horizon.url = "git+https://gitlab.horizon-haskell.net/package-sets/horizon-cardano";
5-
hydra-coding-standards.url = "github:cardano-scaling/hydra-coding-standards/0.7.0";
5+
hydra-coding-standards.url = "github:cardano-scaling/hydra-coding-standards/0.7.1";
66
import-tree.url = "github:vic/import-tree";
77
nixpkgs.follows = "horizon/nixpkgs";
88
};

hydra-invoices/src/Hydra/Invoice.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module 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)
1212
import Cardano.Binary qualified as CBOR
1313
import Cardano.Crypto.Hash qualified as Crypto
1414
import Control.Monad (replicateM)
@@ -33,8 +33,8 @@ newtype PreImage = UnsafePreImage {fromPreImage :: BS.ByteString}
3333
type PaymentId :: Type
3434
newtype 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

3939
generatePreImage :: IO PreImage
4040
generatePreImage = UnsafePreImage . BS.pack <$> replicateM 32 (randomRIO (0, 255))
@@ -43,7 +43,7 @@ hashPaymentId :: PreImage -> PaymentId
4343
hashPaymentId (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)
4747
generateStandardInvoice recipient amount date = do
4848
preImage <- generatePreImage
4949
let invoice =

0 commit comments

Comments
 (0)