0

Im trying to run Week05's home work solution 1 on the online plutus playground enviornment but I keep getting errors in lines 79 to 84 dose anybody know how to fix this?

code pasted below along with errors

endpoints :: Contract () SignedSchema Text ()
endpoints = mint' >> endpoints
  where
    mint' = endpoint @"mint" >>= mint

errors

Compilation Error, Line 80, Column 13 (jump)

 error:
    * Couldn't match type `(->) (a0 -> Contract w0 s0 e0 b0)'
                     with `Contract () SignedSchema Text'
      Expected type: Contract () SignedSchema Text ()
        Actual type: (a0 -> Contract w0 s0 e0 b0) -> ()
    * Probable cause: `(>>)' is applied to too few arguments
      In the expression: mint' >> endpoints
      In an equation for `endpoints':
          endpoints
            = mint' >> endpoints
            where
                mint' = endpoint @"mint" >>= mint
   |
80 | endpoints = mint' >> endpoints
   |             ^^^^^^^^^^^^^^^^^^

Compilation Error, Line 80, Column 22 (jump)

 error:
    * Couldn't match type `Contract () SignedSchema Text'
                     with `(->) (a0 -> Contract w0 s0 e0 b0)'
      Expected type: (a0 -> Contract w0 s0 e0 b0) -> ()
        Actual type: Contract () SignedSchema Text ()
    * In the second argument of `(>>)', namely `endpoints'
      In the expression: mint' >> endpoints
      In an equation for `endpoints':
          endpoints
            = mint' >> endpoints
            where
                mint' = endpoint @"mint" >>= mint
   |
80 | endpoints = mint' >> endpoints
   |                      ^^^^^^^^^

Compilation Error, Line 82, Column 13 (jump)

 error:
    * Couldn't match type `Promise w s e b' with `MintParams'
      Expected type: (a -> Contract w s e b) -> MintParams
        Actual type: (a -> Contract w s e b) -> Promise w s e b
    * In the first argument of `(>>=)', namely `endpoint @"mint"'
      In the expression: endpoint @"mint" >>= mint
      In an equation for mint': mint' = endpoint @"mint" >>= mint
    * Relevant bindings include
        mint' :: (a -> Contract w s e b) -> ()
          (bound at /tmp/web-ghc-work-5bba159ebc709aaf/Main.hs:82:5)
   |
82 |     mint' = endpoint @"mint" >>= mint
   |             ^^^^^^^^^^^^^^^^

Compilation Error, Line 82, Column 34 (jump)

 error:
    * Couldn't match type `Contract w1 SignedSchema Text'
                     with `(->) (a -> Contract w s e b)'
      Expected type: MintParams -> (a -> Contract w s e b) -> ()
        Actual type: MintParams -> Contract w1 SignedSchema Text ()
    * In the second argument of `(>>=)', namely `mint'
      In the expression: endpoint @"mint" >>= mint
      In an equation for mint': mint' = endpoint @"mint" >>= mint
    * Relevant bindings include
        mint' :: (a -> Contract w s e b) -> ()
          (bound at /tmp/web-ghc-work-5bba159ebc709aaf/Main.hs:82:5)
   |
82 |     mint' = endpoint @"mint" >>= mint
   |   

                           ^^^^

1 Answer 1

0

It is because endpoint has changed according to: https://youtu.be/zW3D2iM5uVg?t=1218

You need to use an older version of Plutus Playground which comes together with plutus commit which was in lecture 5. You will need to start it locally.

So in general you will need to do checkout https://github.com/input-output-hk/plutus at the same commit which is https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week05/cabal.project#L28 but this commit is not present anymore so you can use this instead a5e7a257706c7f5fdab17dbd16683c2390c3ab95 and to start plutus-playground server and client like it is described in Readme for Week1 https://github.com/input-output-hk/plutus-pioneer-program

or you can try to change

endpoints = mint' >> endpoints
  where
    mint' = endpoint @"mint" >>= mint

to:

endpoints = forever
          $ handleError logError
          $ awaitPromise
          $ endpoint @"mint" $ mint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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