/* * Copyright 2014-2020 the original author or authors. * * 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. */ package com.webank.webase.front.channel.test; import io.reactivex.Flowable; import org.fisco.bcos.channel.client.TransactionSucCallback; import org.fisco.bcos.web3j.abi.EventEncoder; import org.fisco.bcos.web3j.abi.TypeReference; import org.fisco.bcos.web3j.abi.datatypes.Event; import org.fisco.bcos.web3j.abi.datatypes.Function; import org.fisco.bcos.web3j.abi.datatypes.Type; import org.fisco.bcos.web3j.abi.datatypes.generated.Uint256; import org.fisco.bcos.web3j.crypto.Credentials; import org.fisco.bcos.web3j.protocol.Web3j; import org.fisco.bcos.web3j.protocol.core.DefaultBlockParameter; import org.fisco.bcos.web3j.protocol.core.RemoteCall; import org.fisco.bcos.web3j.protocol.core.methods.request.BcosFilter; import org.fisco.bcos.web3j.protocol.core.methods.response.Log; import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; import org.fisco.bcos.web3j.tx.Contract; import org.fisco.bcos.web3j.tx.TransactionManager; import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Auto generated code. * * <p><strong>Do not modify!</strong> * * <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>, * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the <a * href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update. * * <p>Generated with web3j version none. */ public class Ok extends Contract { private static final String BINARY = "608060405234801561001057600080fd5b5060016000800160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506402540be40060006001018190555060028060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006002600101819055506103bf806100c26000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806366c99139146100515780636d4ce63c1461007e575b600080fd5b34801561005d57600080fd5b5061007c600480360381019080803590602001909291905050506100a9565b005b34801561008a57600080fd5b506100936102e1565b6040518082815260200191505060405180910390f35b8060006001015410806100c757506002600101548160026001015401105b156100d1576102de565b8060006001015403600060010181905550806002600101600082825401925050819055507fc77b710b83d1dc3f3fafeccd08a6c469beb873b2f0975b50d1698e46b3ee5b4c816040518082815260200191505060405180910390a160046080604051908101604052806040805190810160405280600881526020017f323031373034313300000000000000000000000000000000000000000000000081525081526020016000800160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000190805190602001906102419291906102ee565b5060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301555050505b50565b6000600260010154905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061032f57805160ff191683800117855561035d565b8280016001018555821561035d579182015b8281111561035c578251825591602001919060010190610341565b5b50905061036a919061036e565b5090565b61039091905b8082111561038c576000816000905550600101610374565b5090565b905600a165627a7a72305820fb983c66bee66788f407721b23b10a8aae3dc9ef8f1b09e08ec6a6c0b0ec70100029"; public static final String FUNC_TRANS = "trans"; public static final String FUNC_GET = "get"; public static final Event TRANSEVENT_EVENT = new Event("TransEvent", Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));; @Deprecated protected Ok( String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); } protected Ok( String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { super(BINARY, contractAddress, web3j, credentials, contractGasProvider); } @Deprecated protected Ok( String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); } protected Ok( String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } public RemoteCall<TransactionReceipt> trans(BigInteger num) { final Function function = new Function( FUNC_TRANS, Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(num)), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); } public void trans(BigInteger num, TransactionSucCallback callback) { final Function function = new Function( FUNC_TRANS, Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(num)), Collections.<TypeReference<?>>emptyList()); asyncExecuteTransaction(function, callback); } public RemoteCall<BigInteger> get() { final Function function = new Function( FUNC_GET, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {})); return executeRemoteCallSingleValueReturn(function, BigInteger.class); } public List<TransEventEventResponse> getTransEventEvents(TransactionReceipt transactionReceipt) { List<EventValuesWithLog> valueList = extractEventParametersWithLog(TRANSEVENT_EVENT, transactionReceipt); ArrayList<TransEventEventResponse> responses = new ArrayList<TransEventEventResponse>(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TransEventEventResponse typedResponse = new TransEventEventResponse(); typedResponse.log = eventValues.getLog(); typedResponse.num = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); responses.add(typedResponse); } return responses; } public Flowable<TransEventEventResponse> transEventEventFlowable(BcosFilter filter) { return web3j .logFlowable(filter) .map( new io.reactivex.functions.Function<Log, TransEventEventResponse>() { @Override public TransEventEventResponse apply(Log log) { Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(TRANSEVENT_EVENT, log); TransEventEventResponse typedResponse = new TransEventEventResponse(); typedResponse.log = log; typedResponse.num = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); return typedResponse; } }); } public Flowable<TransEventEventResponse> transEventEventFlowable( DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress()); filter.addSingleTopic(EventEncoder.encode(TRANSEVENT_EVENT)); return transEventEventFlowable(filter); } @Deprecated public static Ok load( String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { return new Ok(contractAddress, web3j, credentials, gasPrice, gasLimit); } @Deprecated public static Ok load( String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { return new Ok(contractAddress, web3j, transactionManager, gasPrice, gasLimit); } public static Ok load( String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { return new Ok(contractAddress, web3j, credentials, contractGasProvider); } public static Ok load( String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { return new Ok(contractAddress, web3j, transactionManager, contractGasProvider); } public static RemoteCall<Ok> deploy( Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { return deployRemoteCall(Ok.class, web3j, credentials, contractGasProvider, BINARY, ""); } public static RemoteCall<Ok> deploy( Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { return deployRemoteCall(Ok.class, web3j, transactionManager, contractGasProvider, BINARY, ""); } @Deprecated public static RemoteCall<Ok> deploy( Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { return deployRemoteCall(Ok.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); } @Deprecated public static RemoteCall<Ok> deploy( Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { return deployRemoteCall(Ok.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); } public static class TransEventEventResponse { public Log log; public BigInteger num; } }