From bdf146e1d3a6eacf84afa93dfc9b6c5595c86a0a Mon Sep 17 00:00:00 2001 From: magooster Date: Tue, 14 Apr 2020 17:26:04 +0100 Subject: [PATCH] Fix order of parameters passed to priv_call method (#1185) https://besu.hyperledger.org/en/stable/Reference/API-Methods/#priv_call --- besu/src/main/java/org/web3j/protocol/besu/Besu.java | 4 ++-- .../main/java/org/web3j/protocol/besu/JsonRpc2_0Besu.java | 6 +++--- .../test/java/org/web3j/protocol/besu/RequestTest.java | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/besu/src/main/java/org/web3j/protocol/besu/Besu.java b/besu/src/main/java/org/web3j/protocol/besu/Besu.java index 7998aad83..58949958a 100644 --- a/besu/src/main/java/org/web3j/protocol/besu/Besu.java +++ b/besu/src/main/java/org/web3j/protocol/besu/Besu.java @@ -110,7 +110,7 @@ Request privGetCode( String privacyGroupId, String address, DefaultBlockParameter defaultBlockParameter); Request privCall( + String privacyGroupId, org.web3j.protocol.core.methods.request.Transaction transaction, - DefaultBlockParameter defaultBlockParameter, - String privacyGroupId); + DefaultBlockParameter defaultBlockParameter); } diff --git a/besu/src/main/java/org/web3j/protocol/besu/JsonRpc2_0Besu.java b/besu/src/main/java/org/web3j/protocol/besu/JsonRpc2_0Besu.java index 40c9fdd7f..e854b6198 100644 --- a/besu/src/main/java/org/web3j/protocol/besu/JsonRpc2_0Besu.java +++ b/besu/src/main/java/org/web3j/protocol/besu/JsonRpc2_0Besu.java @@ -336,12 +336,12 @@ public Request privGetCode( @Override public Request privCall( + String privacyGroupId, final Transaction transaction, - final DefaultBlockParameter defaultBlockParameter, - String privacyGroupId) { + final DefaultBlockParameter defaultBlockParameter) { return new Request<>( "priv_call", - Arrays.asList(transaction, defaultBlockParameter, privacyGroupId), + Arrays.asList(privacyGroupId, transaction, defaultBlockParameter), web3jService, org.web3j.protocol.core.methods.response.EthCall.class); } diff --git a/besu/src/test/java/org/web3j/protocol/besu/RequestTest.java b/besu/src/test/java/org/web3j/protocol/besu/RequestTest.java index c7c16ca29..d0c52ed53 100644 --- a/besu/src/test/java/org/web3j/protocol/besu/RequestTest.java +++ b/besu/src/test/java/org/web3j/protocol/besu/RequestTest.java @@ -216,18 +216,18 @@ public void testPrivGetCode() throws Exception { @Test public void testEthCall() throws Exception { web3j.privCall( + MOCK_PRIVACY_GROUP_ID.toString(), Transaction.createEthCallTransaction( "0xa70e8dd61c5d32be8058bb8eb970870f07233155", "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "0x0"), - DefaultBlockParameter.valueOf("latest"), - MOCK_PRIVACY_GROUP_ID.toString()) + DefaultBlockParameter.valueOf("latest")) .send(); verifyResult( "{\"jsonrpc\":\"2.0\",\"method\":\"priv_call\"," - + "\"params\":[{\"from\":\"0xa70e8dd61c5d32be8058bb8eb970870f07233155\"," + + "\"params\":[\"DyAOiF/ynpc+JXa2YAGB0bCitSlOMNm+ShmB/7M6C4w=\",{\"from\":\"0xa70e8dd61c5d32be8058bb8eb970870f07233155\"," + "\"to\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"data\":\"0x0\"}," - + "\"latest\",\"DyAOiF/ynpc+JXa2YAGB0bCitSlOMNm+ShmB/7M6C4w=\"],\"id\":1}"); + + "\"latest\"],\"id\":1}"); } }