Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit 8717fdb

Browse files
airvinnwaywood
andcommitted
Marbles init function working
Co-authored-by: Nick Waywood <n.waywood@gmail.com> Signed-off-by: Allison Irvin <allison.irvin2@gmail.com>
1 parent 95a0510 commit 8717fdb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/Marbles.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ instance ToJSON Marble where
6666
instance FromJSON Marble
6767

6868
initFunc :: DefaultChaincodeStub -> IO Pb.Response
69-
initFunc _ = pure $ successPayload Nothing
70-
69+
initFunc s =
70+
let e = getFunctionAndParameters s
71+
in
72+
case e of
73+
Left _ -> pure $ errorPayload ""
74+
Right ("initMarble" , parameters) -> initMarble s parameters
75+
Right (fn , _ ) -> pure
76+
$ errorPayload (pack ("Invoke did not find function: " ++ unpack fn))
7177

7278
invokeFunc :: DefaultChaincodeStub -> IO Pb.Response
7379
invokeFunc s =

0 commit comments

Comments
 (0)