Skip to content

Commit

Permalink
Fix the FromJSON instance for Payload
Browse files Browse the repository at this point in the history
  • Loading branch information
enobayram committed Dec 18, 2023
1 parent f9c8e66 commit d870846
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Chainweb/Api/Payload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ instance ToJSON Payload where

instance FromJSON Payload where
parseJSON = withObject "Payload" $ \o -> do
o .: "exec" >>= \case
Nothing -> o .: "cont" >>= \case
o .:? "exec" >>= \case
Nothing -> o .:? "cont" >>= \case
Nothing -> fail "Payload must be exec or cont"
Just cont -> return $ ContPayload cont
Just exec -> return $ ExecPayload exec
Expand Down

0 comments on commit d870846

Please sign in to comment.