File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
app/src/main/java/io/ballerina/web3/abi Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 2020
2121import com .fasterxml .jackson .databind .ObjectMapper ;
2222import java .io .File ;
23+ import java .util .Arrays ;
24+ import java .util .stream .Collectors ;
2325
2426public class AbiReader {
2527
2628 private String abiPath ;
2729
28- public AbiReader (String abiPath ){
30+ public AbiReader (String abiPath ) {
2931 this .abiPath = abiPath ;
3032 }
3133
32- public AbiEntry [] read () throws Exception {
34+ public AbiEntry [] read () throws Exception {
3335
34- // Load ABI JSON file
35- ObjectMapper objectMapper = new ObjectMapper ();
36- File file = new File (abiPath );
36+ // Load ABI JSON file
37+ ObjectMapper objectMapper = new ObjectMapper ();
38+ File file = new File (abiPath );
3739
38- // Deserialize JSON
39- ContractJson contractJson = objectMapper .readValue (file ,ContractJson .class );
40+ // Deserialize JSON
41+ ContractJson contractJson = objectMapper .readValue (file , ContractJson .class );
4042
41- AbiEntry [] abiEntries = contractJson .getAbi ();
43+ AbiEntry [] abiEntries = contractJson .getAbi ();
4244
43- return abiEntries ;
45+ return Arrays .stream (abiEntries )
46+ .filter (entry -> "function" .equals (entry .getType ()))
47+ .collect (Collectors .toList ());
4448 }
4549}
You can’t perform that action at this time.
0 commit comments