@@ -1953,21 +1953,21 @@ public static SmartContract.ABI jsonStr2Abi(String jsonStr) {
19531953 for (int index = 0 ; index < jsonRoot .size (); index ++) {
19541954 JsonElement abiItem = jsonRoot .get (index );
19551955 boolean anonymous = abiItem .getAsJsonObject ().get ("anonymous" ) != null
1956- ? abiItem .getAsJsonObject ().get ("anonymous" ).getAsBoolean () : false ;
1956+ ? abiItem .getAsJsonObject ().get ("anonymous" ).getAsBoolean () : false ;
19571957 final boolean constant = abiItem .getAsJsonObject ().get ("constant" ) != null
1958- ? abiItem .getAsJsonObject ().get ("constant" ).getAsBoolean () : false ;
1958+ ? abiItem .getAsJsonObject ().get ("constant" ).getAsBoolean () : false ;
19591959 final String name = abiItem .getAsJsonObject ().get ("name" ) != null
1960- ? abiItem .getAsJsonObject ().get ("name" ).getAsString () : null ;
1960+ ? abiItem .getAsJsonObject ().get ("name" ).getAsString () : null ;
19611961 JsonArray inputs = abiItem .getAsJsonObject ().get ("inputs" ) != null
1962- ? abiItem .getAsJsonObject ().get ("inputs" ).getAsJsonArray () : null ;
1962+ ? abiItem .getAsJsonObject ().get ("inputs" ).getAsJsonArray () : null ;
19631963 final JsonArray outputs = abiItem .getAsJsonObject ().get ("outputs" ) != null
1964- ? abiItem .getAsJsonObject ().get ("outputs" ).getAsJsonArray () : null ;
1964+ ? abiItem .getAsJsonObject ().get ("outputs" ).getAsJsonArray () : null ;
19651965 String type = abiItem .getAsJsonObject ().get ("type" ) != null
1966- ? abiItem .getAsJsonObject ().get ("type" ).getAsString () : null ;
1966+ ? abiItem .getAsJsonObject ().get ("type" ).getAsString () : null ;
19671967 final boolean payable = abiItem .getAsJsonObject ().get ("payable" ) != null
1968- ? abiItem .getAsJsonObject ().get ("payable" ).getAsBoolean () : false ;
1968+ ? abiItem .getAsJsonObject ().get ("payable" ).getAsBoolean () : false ;
19691969 final String stateMutability = abiItem .getAsJsonObject ().get ("stateMutability" ) != null
1970- ? abiItem .getAsJsonObject ().get ("stateMutability" ).getAsString () : null ;
1970+ ? abiItem .getAsJsonObject ().get ("stateMutability" ).getAsString () : null ;
19711971 if (type == null ) {
19721972 logger .error ("No type!" );
19731973 return null ;
@@ -1989,15 +1989,17 @@ public static SmartContract.ABI jsonStr2Abi(String jsonStr) {
19891989 for (int j = 0 ; j < inputs .size (); j ++) {
19901990 JsonElement inputItem = inputs .get (j );
19911991 if (inputItem .getAsJsonObject ().get ("name" ) == null
1992- || inputItem .getAsJsonObject ().get ("type" ) == null ) {
1992+ || inputItem .getAsJsonObject ().get ("type" ) == null ) {
19931993 logger .error ("Input argument invalid due to no name or no type!" );
19941994 return null ;
19951995 }
19961996 String inputName = inputItem .getAsJsonObject ().get ("name" ).getAsString ();
19971997 String inputType = inputItem .getAsJsonObject ().get ("type" ).getAsString ();
19981998 SmartContract .ABI .Entry .Param .Builder paramBuilder = SmartContract .ABI .Entry .Param
1999- .newBuilder ();
2000- paramBuilder .setIndexed (false );
1999+ .newBuilder ();
2000+ JsonElement indexed = inputItem .getAsJsonObject ().get ("indexed" );
2001+
2002+ paramBuilder .setIndexed ((indexed == null )?false : indexed .getAsBoolean ());
20012003 paramBuilder .setName (inputName );
20022004 paramBuilder .setType (inputType );
20032005 entryBuilder .addInputs (paramBuilder .build ());
@@ -2009,15 +2011,17 @@ public static SmartContract.ABI jsonStr2Abi(String jsonStr) {
20092011 for (int k = 0 ; k < outputs .size (); k ++) {
20102012 JsonElement outputItem = outputs .get (k );
20112013 if (outputItem .getAsJsonObject ().get ("name" ) == null
2012- || outputItem .getAsJsonObject ().get ("type" ) == null ) {
2014+ || outputItem .getAsJsonObject ().get ("type" ) == null ) {
20132015 logger .error ("Output argument invalid due to no name or no type!" );
20142016 return null ;
20152017 }
20162018 String outputName = outputItem .getAsJsonObject ().get ("name" ).getAsString ();
20172019 String outputType = outputItem .getAsJsonObject ().get ("type" ).getAsString ();
20182020 SmartContract .ABI .Entry .Param .Builder paramBuilder = SmartContract .ABI .Entry .Param
2019- .newBuilder ();
2020- paramBuilder .setIndexed (false );
2021+ .newBuilder ();
2022+ JsonElement indexed = outputItem .getAsJsonObject ().get ("indexed" );
2023+
2024+ paramBuilder .setIndexed ((indexed == null )?false : indexed .getAsBoolean ());
20212025 paramBuilder .setName (outputName );
20222026 paramBuilder .setType (outputType );
20232027 entryBuilder .addOutputs (paramBuilder .build ());
0 commit comments