diff --git a/bower.json b/bower.json index 241dac7..7325f53 100644 --- a/bower.json +++ b/bower.json @@ -18,7 +18,7 @@ "url": "git://github.com/f-o-a-m/purescript-web3-generator.git" }, "dependencies": { - "purescript-argonaut": "^4.0.0", + "purescript-argonaut": "^6.0.0", "purescript-ordered-collections": "^1.0.0", "purescript-prelude": "^4.0.0", "purescript-errors": "^4.0.0", @@ -27,10 +27,10 @@ "purescript-node-fs-aff": "^6.0.0", "purescript-console": "^4.0.0", "purescript-string-parsers": "^4.0.0", - "purescript-web3": "^1.0.0", + "purescript-web3": "^2.0.0", "purescript-mkdirp": "joshuahhh/purescript-mkdirp#48ecb4039d5fe3be82d0e82c3a9f2338d1af82d2", "purescript-fixed-points": "^5.0.0", - "purescript-record-extra": "^1.0.0" + "purescript-record-extra": "^3.0.0" }, "devDependencies": { "purescript-spec": "^3.0.0", diff --git a/package.json b/package.json index f218c16..42a5cd5 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,11 @@ "rlp": "^2.0.0", "secp256k1": "^3.0.1", "psc-package": "^0.2.4-rc1", - "purescript": "^0.12.0", - "pulp": "^12.2.0", - "purescript-psa": "^0.6.0", "yargs": "^8.0.2" + }, + "devDependencies": { + "purescript-psa": "^0.7.3", + "purescript": "^0.13.0", + "pulp": "^13.0.0" } } diff --git a/src/Data/AbiParser.purs b/src/Data/AbiParser.purs index 89aa92f..4a9e6da 100644 --- a/src/Data/AbiParser.purs +++ b/src/Data/AbiParser.purs @@ -6,7 +6,7 @@ import Control.Alternative ((<|>)) import Control.Error.Util (note) import Data.Argonaut as A import Data.Argonaut.Core (fromObject) -import Data.Argonaut.Decode ((.?)) +import Data.Argonaut.Decode ((.:)) import Data.Argonaut.Decode.Class (class DecodeJson, decodeJson) import Data.Array (fromFoldable, null) import Data.Bifunctor (lmap) @@ -140,7 +140,7 @@ parseSolidityType s = runParser (solidityTypeParser <* eof) s # lmap \err -> instance decodeJsonSolidityType :: DecodeJson SolidityType where decodeJson json = do obj <- decodeJson json - t <- obj .? "type" + t <- obj .: "type" parseSolidityType t -------------------------------------------------------------------------------- @@ -163,8 +163,8 @@ instance formatInput :: Format FunctionInput where instance decodeFunctionInput :: DecodeJson FunctionInput where decodeJson json = do obj <- decodeJson json - n <- obj .? "name" - t <- obj .? "type" + n <- obj .: "name" + t <- obj .: "type" typ <- parseSolidityType t pure $ FunctionInput {type: typ, name: n} @@ -186,11 +186,11 @@ instance showSolidityFunction :: Show SolidityFunction where instance decodeJsonSolidityFunction :: DecodeJson SolidityFunction where decodeJson json = do obj <- decodeJson json - nm <- obj .? "name" - is <- obj .? "inputs" - os <- obj .? "outputs" - c <- obj .? "constant" - p <- obj .? "payable" + nm <- obj .: "name" + is <- obj .: "inputs" + os <- obj .: "outputs" + c <- obj .: "constant" + p <- obj .: "payable" pure $ SolidityFunction { name : nm , inputs : is , outputs : os @@ -218,7 +218,7 @@ instance showSolidityConstructor :: Show SolidityConstructor where instance decodeJsonSolidityConstructor :: DecodeJson SolidityConstructor where decodeJson json = do obj <- decodeJson json - is <- obj .? "inputs" + is <- obj .: "inputs" pure $ SolidityConstructor { inputs : is , isUnCurried: all (\(FunctionInput fi) -> fi.name /= "") is && not (null is) @@ -245,10 +245,10 @@ instance formatIndexedSolidityValue :: Format IndexedSolidityValue where instance decodeJsonIndexedSolidityValue :: DecodeJson IndexedSolidityValue where decodeJson json = do obj <- decodeJson json - nm <- obj .? "name" - ts <- obj .? "type" + nm <- obj .: "name" + ts <- obj .: "type" t <- parseSolidityType ts - ixed <- obj .? "indexed" + ixed <- obj .: "indexed" pure $ IndexedSolidityValue { name : nm , type : t , indexed : ixed @@ -268,9 +268,9 @@ instance showSolidityEvent :: Show SolidityEvent where instance decodeJsonSolidityEvent :: DecodeJson SolidityEvent where decodeJson json = do obj <- decodeJson json - nm <- obj .? "name" - is <- obj .? "inputs" - a <- obj .? "anonymous" + nm <- obj .: "name" + is <- obj .: "inputs" + a <- obj .: "anonymous" pure $ SolidityEvent { name : nm , inputs : is , anonymous : a @@ -305,7 +305,7 @@ instance showAbiType :: Show AbiType where instance decodeJsonAbiType :: DecodeJson AbiType where decodeJson json = do obj <- decodeJson json - t <- obj .? "type" + t <- obj .: "type" let json' = fromObject obj case t of "function" -> AbiFunction <$> decodeJson json' diff --git a/src/Data/Generator.purs b/src/Data/Generator.purs index b79bba9..65d9105 100644 --- a/src/Data/Generator.purs +++ b/src/Data/Generator.purs @@ -448,7 +448,7 @@ data EventGenericInstance = instance codeEventGenericInstance :: Code EventGenericInstance where genCode (EventGenericInstance i) _ = let headers = uncurry (\n t -> "instance " <> n <> " :: " <> t <> " where") <$> (zip i.instanceNames i.instanceTypes) - eventGenerics = (\d -> "\t" <> d) <$> i.genericDefs + eventGenerics = (\d -> " " <> d) <$> i.genericDefs instances = zipWith (\h g -> h <> "\n" <> g) headers eventGenerics in pure $ newLine2 $ i.genericDeriving : instances @@ -515,7 +515,7 @@ instance codeEventFilterInstance :: Code EventFilterInstance where import' "Network.Ethereum.Web3" [IClass "EventFilter"] let header = "instance " <> i.instanceName <> " :: EventFilter " <> i.instanceType <> " where" - eventFilter = "\t" <> i.filterDef + eventFilter = " " <> i.filterDef pure $ newLine1 [header, eventFilter] eventId :: SolidityEvent -> HexString @@ -552,8 +552,8 @@ eventToEventFilterInstance ev@(SolidityEvent e) = do pure $ fold ["defaultFilter" - , "\n\t\t" - , joinWith "\n\t\t" + , "\n " + , joinWith "\n " [ "# _address .~ Just " <> addr , "# _topics .~ Just [" <> eventIdStr <> indexedVals <> "]" ]