Skip to content

Commit

Permalink
upstream merge
Browse files Browse the repository at this point in the history
  • Loading branch information
apratt3377 committed Sep 17, 2020
2 parents 4b7563e + 17ca36c commit 5c5b6ea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/main/java/org/web3j/quorum/tx/ClientTransactionManager.java
Expand Up @@ -19,10 +19,12 @@
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.DefaultBlockParameter;
import org.web3j.protocol.core.methods.request.Transaction;
import org.web3j.protocol.core.methods.response.EthCall;
import org.web3j.protocol.core.methods.response.EthGetCode;
import org.web3j.protocol.core.methods.response.EthSendTransaction;
import org.web3j.quorum.Quorum;
import org.web3j.quorum.methods.request.PrivateTransaction;
import org.web3j.tx.ContractErrorUtil;
import org.web3j.tx.TransactionManager;

/** TransactionManager implementation for using a Quorum node to transact. */
Expand Down Expand Up @@ -112,11 +114,13 @@ public EthSendTransaction sendTransaction(
@Override
public String sendCall(String to, String data, DefaultBlockParameter defaultBlockParameter)
throws IOException {
return quorum.ethCall(
Transaction.createEthCallTransaction(getFromAddress(), to, data),
defaultBlockParameter)
.send()
.getValue();
EthCall ethCall =
quorum.ethCall(
Transaction.createEthCallTransaction(getFromAddress(), to, data),
defaultBlockParameter)
.send();
ContractErrorUtil.assertCallNotReverted(ethCall);
return ethCall.getValue();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/web3j/quorum/consensus/raft.kt
Expand Up @@ -12,4 +12,4 @@
*/
package org.web3j.quorum.methods.response.raft

public data class RaftPeer(var hostname: String, var nodeActive: String, var nodeId: String, var p2pPort: String, var raftId: String, var raftPort: String, var role: String)
public data class RaftPeer(var hostname: String, var nodeId: String, var nodeActive: Boolean, var p2pPort: String, var raftId: String, var raftPort: String)
19 changes: 19 additions & 0 deletions src/main/kotlin/org/web3j/tx/ContractErrorUtil.kt
@@ -0,0 +1,19 @@
/*
* Copyright 2020 Web3 Labs Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
@file:JvmName("ContractErrorUtil")

package org.web3j.tx

import org.web3j.protocol.core.methods.response.EthCall

fun assertCallNotReverted(ethCall: EthCall) = TransactionManager.assertCallNotReverted(ethCall)

0 comments on commit 5c5b6ea

Please sign in to comment.