Skip to content

Commit

Permalink
Merge pull request #5 from adridadou/develop
Browse files Browse the repository at this point in the history
Merge develop into develop
  • Loading branch information
Penait1 authored Sep 23, 2019
2 parents 1fe55a6 + 21f52c6 commit 97ad364
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.adridadou</groupId>
<artifactId>eth-propeller-core</artifactId>
<version>0.52-SNAPSHOT</version>
<version>0.53-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.adridadou.ethereum.propeller.solidity.abi;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.adridadou.ethereum.propeller.exception.EthereumApiException;
import org.adridadou.ethereum.propeller.solidity.converters.decoders.SolidityTypeDecoder;
Expand Down Expand Up @@ -53,7 +54,9 @@ private AbiEntry(Boolean anonymous, Boolean constant, Boolean payable, String st

public static List<AbiEntry> parse(final String json) {
try {
return new ObjectMapper().readValue(json, new TypeReference<List<AbiEntry>>() {});
return new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.readValue(json, new TypeReference<List<AbiEntry>>() {});
} catch (IOException e) {
throw new EthereumApiException("error while deserialising ABI", e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.adridadou.ethereum.propeller.util

import org.adridadou.ethereum.propeller.solidity.abi.AbiEntry
import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.check.Checkers

class JsonParserTest extends FlatSpec with Matchers with Checkers {
"Json parser" should "ignore unknown parameters" in {
val json =
"""[
| {
| "constant": true,
| "inputs": [],
| "name": "getName",
| "outputs": [
| {
| "internalType": "string",
| "name": "",
| "type": "string"
| }
| ],
| "payable": false,
| "stateMutability": "view",
| "type": "function"
| },
| {
| "constant": false,
| "inputs": [
| {
| "internalType": "string",
| "name": "_name",
| "type": "string"
| }
| ],
| "name": "recordTest",
| "outputs": [],
| "payable": false,
| "stateMutability": "nonpayable",
| "type": "function"
| }
|]""".stripMargin

AbiEntry.parse(json)
}
}

0 comments on commit 97ad364

Please sign in to comment.