0

I have the following datum type

data ProjectSubmitDatum = ProjectSubmitDatum
  { vProjectOwner :: PaymentPubKeyHash,
    vProjectRegistrationFee :: Integer,
    vProjectCategory :: BuiltinByteString,
    vFundPayIdentifier :: PaymentPubKeyHash
  }
  deriving (Show)

I also have the module imported like this

import Ledger.Address 

The following error pops up when i run cabal repl

src/QuadraticVFSC.hs:45:19: error:
    Not in scope: type constructor or class ‘PaymentPubKeyHash’
   |
45 |   { vFundOwner :: PaymentPubKeyHash,
   |                   ^^^^^^^^^^^^^^^^^

2 Answers 2

2

you need to import either the whole module like this:

import Ledger

or the specific type like this:

import Ledger (PaymentPubKeyHash)
3
  • Still not working when i import the whole module. When i was importing specific type it said it does not export PaymentPubKeyHash.
    – szhang9921
    May 10, 2022 at 15:04
  • 1
    Also check you have the right git commits (precisely the commit of plutus-apps as found in the cabal.project). PaymentPub... is relatively new. It used to just be Pub...
    – waalge
    May 11, 2022 at 8:18
  • If it can’t be found, you most probably have an older version of plutus-apps. You can change the tags in the file cabal.project.
    – Jey
    May 11, 2022 at 10:45
2

You neeed to import PaymentPubKeyHash it like the following:

import Ledger.Address qualified as Address (Address, PaymentPubKeyHash(..))

This works for me and you can checkout my working code on testnet here:

https://github.com/lley154/cardano-lottery/blob/main/src/OnChain.hs

Cheers,

Lawrence

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.