use of org.fisco.bcos.web3j.protocol.core.JsonRpc2_0Web3j in project web3sdk by FISCO-BCOS.
the class Contract method getTheTransactionManager.
public static TransactionManager getTheTransactionManager(Web3j web3j, Credentials credentials) {
JsonRpc2_0Web3j jsonRpc2_0Web3j = (JsonRpc2_0Web3j) web3j;
String chainId = "1";
int groupId = 1;
String version = "";
String supportedVersion = "";
NodeVersion.Version nodeVersion = null;
try {
groupId = jsonRpc2_0Web3j.getGroupId();
nodeVersion = web3j.getNodeVersion().send().getNodeVersion();
version = nodeVersion.getVersion();
supportedVersion = nodeVersion.getSupportedVersion();
if (EnumNodeVersion.BCOS_2_0_0_RC1.getVersion().equals(version) || EnumNodeVersion.BCOS_2_0_0_RC1.getVersion().equals(supportedVersion)) {
version = EnumNodeVersion.BCOS_2_0_0_RC1.getVersion();
logger.debug("fisco-bcos version:{}", version);
} else {
chainId = nodeVersion.getChainID();
logger.debug("fisco-bcos version:{}, supported version:{}", version, supportedVersion);
}
} catch (Exception e) {
logger.error("Query fisco-bcos version failed", e);
}
TransactionManager transactionManager = EnumNodeVersion.BCOS_2_0_0_RC1.getVersion().equals(version) ? new RawTransactionManager(web3j, credentials) : new ExtendedRawTransactionManager(web3j, credentials, BigInteger.valueOf(groupId), new BigInteger(chainId));
transactionManager.setNodeVersion(nodeVersion);
return transactionManager;
}
use of org.fisco.bcos.web3j.protocol.core.JsonRpc2_0Web3j in project web3sdk by FISCO-BCOS.
the class Contract method registerEventLogPushFilter.
public void registerEventLogPushFilter(TransactionDecoder decoder, EventLogUserParams params, EventLogPushWithDecodeCallback callback) {
Web3jService service = ((JsonRpc2_0Web3j) web3j).web3jService();
ChannelEthereumService channelEthereumService = (ChannelEthereumService) service;
// set timeout
// filter.setTimeout(channelEthereumService.getTimeout());
callback.setDecoder(decoder);
channelEthereumService.getChannelService().registerEventLogFilter(params, callback);
}
Aggregations