Skip to content

Commit

Permalink
no need for truffle flag for differing json structures
Browse files Browse the repository at this point in the history
  • Loading branch information
charlescrain committed Oct 20, 2020
1 parent deeef00 commit 765bd7c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Data/CodeGen.purs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,9 @@ maybeAnnotateArity abi =
go (SolidityFunction f) = SolidityFunction f {name = f.name <> show (length f.inputs)}

parseAbi :: forall r. {truffle :: Boolean | r} -> Json -> Either String AbiWithErrors
parseAbi {truffle} abiJson = case truffle of
false -> lmap printJsonDecodeError $ decodeJson abiJson
true -> let mabi = abiJson ^? _Object <<< ix "abi"
in note "truffle artifact missing abi field" mabi >>= \json -> lmap printJsonDecodeError $ decodeJson json
parseAbi _ abiJson = case abiJson ^? _Object <<< ix "abi" of
Nothing -> lmap printJsonDecodeError $ decodeJson abiJson
Just json -> lmap printJsonDecodeError $ decodeJson json

genPSModuleStatement :: GeneratorOptions -> FilePath -> String
genPSModuleStatement opts fp = comment <> "\n"
Expand Down

0 comments on commit 765bd7c

Please sign in to comment.