diff --git a/core/src/main/java/org/web3j/protocol/core/Ethereum.java b/core/src/main/java/org/web3j/protocol/core/Ethereum.java index b5380088b..16cdf1068 100644 --- a/core/src/main/java/org/web3j/protocol/core/Ethereum.java +++ b/core/src/main/java/org/web3j/protocol/core/Ethereum.java @@ -63,9 +63,9 @@ import org.web3j.protocol.core.methods.response.ShhNewIdentity; import org.web3j.protocol.core.methods.response.ShhUninstallFilter; import org.web3j.protocol.core.methods.response.ShhVersion; +import org.web3j.protocol.core.methods.response.TxPoolStatus; import org.web3j.protocol.core.methods.response.Web3ClientVersion; import org.web3j.protocol.core.methods.response.Web3Sha3; -import org.web3j.protocol.core.methods.response.TxPoolStatus; import org.web3j.protocol.core.methods.response.admin.AdminDataDir; import org.web3j.protocol.core.methods.response.admin.AdminNodeInfo; import org.web3j.protocol.core.methods.response.admin.AdminPeers; @@ -85,11 +85,11 @@ public interface Ethereum { Request adminNodeInfo(); Request adminPeers(); - + Request adminAddPeer(String url); - + Request adminRemovePeer(String url); - + Request adminDataDir(); Request ethProtocolVersion(); @@ -224,6 +224,6 @@ Request shhPost( Request shhGetFilterChanges(BigInteger filterId); Request shhGetMessages(BigInteger filterId); - + Request txPoolStatus(); } diff --git a/core/src/main/java/org/web3j/protocol/core/JsonRpc2_0Web3j.java b/core/src/main/java/org/web3j/protocol/core/JsonRpc2_0Web3j.java index a7b91a0dc..47607eba3 100644 --- a/core/src/main/java/org/web3j/protocol/core/JsonRpc2_0Web3j.java +++ b/core/src/main/java/org/web3j/protocol/core/JsonRpc2_0Web3j.java @@ -78,9 +78,9 @@ import org.web3j.protocol.core.methods.response.ShhNewIdentity; import org.web3j.protocol.core.methods.response.ShhUninstallFilter; import org.web3j.protocol.core.methods.response.ShhVersion; +import org.web3j.protocol.core.methods.response.TxPoolStatus; import org.web3j.protocol.core.methods.response.Web3ClientVersion; import org.web3j.protocol.core.methods.response.Web3Sha3; -import org.web3j.protocol.core.methods.response.TxPoolStatus; import org.web3j.protocol.core.methods.response.admin.AdminDataDir; import org.web3j.protocol.core.methods.response.admin.AdminNodeInfo; import org.web3j.protocol.core.methods.response.admin.AdminPeers; @@ -157,19 +157,19 @@ public Request adminPeers() { return new Request<>( "admin_peers", Collections.emptyList(), web3jService, AdminPeers.class); } - + @Override public Request adminAddPeer(String url) { return new Request<>( "admin_addPeer", Arrays.asList(url), web3jService, BooleanResponse.class); } - + @Override public Request adminRemovePeer(String url) { return new Request<>( "admin_removePeer", Arrays.asList(url), web3jService, BooleanResponse.class); } - + @Override public Request adminDataDir() { return new Request<>( @@ -672,7 +672,7 @@ public Request shhGetMessages(BigInteger filterId) { web3jService, ShhMessages.class); } - + @Override public Request txPoolStatus() { return new Request<>( diff --git a/core/src/main/java/org/web3j/protocol/core/methods/response/TxPoolStatus.java b/core/src/main/java/org/web3j/protocol/core/methods/response/TxPoolStatus.java index 954dad71d..a8a6084b4 100644 --- a/core/src/main/java/org/web3j/protocol/core/methods/response/TxPoolStatus.java +++ b/core/src/main/java/org/web3j/protocol/core/methods/response/TxPoolStatus.java @@ -12,18 +12,18 @@ */ package org.web3j.protocol.core.methods.response; -import org.web3j.protocol.core.Response; +import java.util.Map; +import org.web3j.protocol.core.Response; import org.web3j.utils.Numeric; -import java.util.Map; /** txpool_status. */ public class TxPoolStatus extends Response> { - public Integer getPending() { - return Numeric.decodeQuantity((String) getResult().get("pending")).intValue(); + public Integer getPending() { + return Numeric.decodeQuantity((String) getResult().get("pending")).intValue(); } - - public Integer getQueued() { - return Numeric.decodeQuantity((String) getResult().get("queued")).intValue(); + + public Integer getQueued() { + return Numeric.decodeQuantity((String) getResult().get("queued")).intValue(); } } diff --git a/core/src/main/java/org/web3j/protocol/core/methods/response/admin/AdminNodeInfo.java b/core/src/main/java/org/web3j/protocol/core/methods/response/admin/AdminNodeInfo.java index 386a43a88..7558a1d9f 100644 --- a/core/src/main/java/org/web3j/protocol/core/methods/response/admin/AdminNodeInfo.java +++ b/core/src/main/java/org/web3j/protocol/core/methods/response/admin/AdminNodeInfo.java @@ -16,9 +16,9 @@ import java.util.Map; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.ObjectReader; @@ -43,19 +43,19 @@ public static class NodeInfo { private String listenAddr; private String name; private String consensus; - + @JsonProperty("protocols") @SuppressWarnings("unchecked") private void consensusDeserializer(Map protocols) { - if(protocols.containsKey("istanbul")) { + if (protocols.containsKey("istanbul")) { consensus = "istanbul"; } else if (protocols.containsKey("clique")) { - consensus = "clique"; + consensus = "clique"; } else if (protocols.containsKey("eth")) { Map eth = (Map) protocols.get("eth"); consensus = (String) eth.get("consensus"); } else { - consensus = "unknown"; + consensus = "unknown"; } } @@ -95,7 +95,7 @@ public String getListenAddr() { public String getName() { return name; } - + public String getConsensus() { return consensus; } diff --git a/core/src/test/java/org/web3j/protocol/core/RequestTest.java b/core/src/test/java/org/web3j/protocol/core/RequestTest.java index f39b6152c..f6ceb1059 100644 --- a/core/src/test/java/org/web3j/protocol/core/RequestTest.java +++ b/core/src/test/java/org/web3j/protocol/core/RequestTest.java @@ -79,26 +79,28 @@ public void testAdminNodeInfo() throws Exception { verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_nodeInfo\",\"params\":[],\"id\":1}"); } - + @Test public void testAdminAddPeer() throws Exception { web3j.adminAddPeer("url").send(); - verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"url\"],\"id\":1}"); + verifyResult( + "{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"url\"],\"id\":1}"); } - + @Test public void testAdminDataDir() throws Exception { web3j.adminDataDir().send(); verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_datadir\",\"params\":[],\"id\":1}"); } - + @Test public void testAdminRemovePeer() throws Exception { web3j.adminRemovePeer("url").send(); - verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_removePeer\",\"params\":[\"url\"],\"id\":1}"); + verifyResult( + "{\"jsonrpc\":\"2.0\",\"method\":\"admin_removePeer\",\"params\":[\"url\"],\"id\":1}"); } @Test @@ -737,7 +739,7 @@ public void testShhGetMessages() throws Exception { "{\"jsonrpc\":\"2.0\",\"method\":\"shh_getMessages\"," + "\"params\":[\"0x07\"],\"id\":1}"); } - + @Test public void testTxPoolStatus() throws Exception { web3j.txPoolStatus().send(); diff --git a/core/src/test/java/org/web3j/protocol/core/ResponseTest.java b/core/src/test/java/org/web3j/protocol/core/ResponseTest.java index 2d249fd66..0d227fb1e 100644 --- a/core/src/test/java/org/web3j/protocol/core/ResponseTest.java +++ b/core/src/test/java/org/web3j/protocol/core/ResponseTest.java @@ -1571,7 +1571,7 @@ public void testSshMessages() { ShhMessages shhMessages = deserialiseResponse(ShhMessages.class); assertEquals(shhMessages.getMessages(), (messages)); } - + @Test public void testBooleanResponse() { buildResponse( @@ -1584,7 +1584,7 @@ public void testBooleanResponse() { BooleanResponse booleanResponse = deserialiseResponse(BooleanResponse.class); assertTrue(booleanResponse.success()); } - + @Test public void testAdminDataDir() { buildResponse( @@ -1597,7 +1597,7 @@ public void testAdminDataDir() { AdminDataDir dataDir = deserialiseResponse(AdminDataDir.class); assertEquals(dataDir.getDataDir(), "sampleDir"); } - + @Test public void testTxPoolStatus() { buildResponse(