1

I'm doing homework2 of week05 (cohort3). My contract runs fine in the repl, but when I try it in the playground, I'm running into an issue. It fails on this line:

mkSchemaDefinitions ''NFTSchema

I changed the schema a bit, so that the mint endpoint takes an NFTSchema, not an Address:


data NFTParams = MintParams
  { 
    mpAddress :: !Address 
  } deriving (Generic, ToJSON, FromJSON, ToSchema)  

type NFTSchema = Endpoint "mint" NFTParams

However, it seems Address cannot (automatically) be turned to a schema:

Compilation Error, Line 67, Column 42 (jump)
 error:
    • No instance for (ToSchema Address)
        arising from the 'deriving' clause of a data type declaration
      Possible fix:
        use a standalone 'deriving instance' declaration,
          so you can specify the instance context yourself
    • When deriving the instance for (ToSchema NFTParams)
   |
67 |   } deriving (Generic, ToJSON, FromJSON, ToSchema)  
   |                   

How can one make the Address parameter in a schema work in the playground? (Stated another way: How can one make ToSchema address work?)

Failing code: https://gitlab.com/moment-4/courses/plutus-pioneer/plutus-pioneer-program/-/tree/homework05.2_ToSchema_Failure (with ToSchema)

Working code: https://gitlab.com/moment-4/courses/plutus-pioneer/plutus-pioneer-program/-/tree/week05.homework2 (without ToSchema)

Thx

1
  • I have the same issue.
    – Jey
    May 10, 2022 at 19:28

0

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.