|
|
@ -18,6 +18,7 @@ import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import io.reactivex.Flowable; |
|
|
|
import org.web3j.abi.EventEncoder; |
|
|
|
import org.web3j.abi.EventEncoder; |
|
|
|
import org.web3j.abi.TypeReference; |
|
|
|
import org.web3j.abi.TypeReference; |
|
|
|
import org.web3j.abi.datatypes.Address; |
|
|
|
import org.web3j.abi.datatypes.Address; |
|
|
@ -34,8 +35,7 @@ import org.web3j.protocol.core.methods.response.Log; |
|
|
|
import org.web3j.protocol.core.methods.response.TransactionReceipt; |
|
|
|
import org.web3j.protocol.core.methods.response.TransactionReceipt; |
|
|
|
import org.web3j.tx.Contract; |
|
|
|
import org.web3j.tx.Contract; |
|
|
|
import org.web3j.tx.TransactionManager; |
|
|
|
import org.web3j.tx.TransactionManager; |
|
|
|
import rx.Observable; |
|
|
|
import org.web3j.tx.gas.ContractGasProvider; |
|
|
|
import rx.functions.Func1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Auto generated code. |
|
|
|
* Auto generated code. |
|
|
@ -46,12 +46,12 @@ import rx.functions.Func1; |
|
|
|
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the <a |
|
|
|
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the <a |
|
|
|
* href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update. |
|
|
|
* href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Generated with web3j version 3.5.0. |
|
|
|
* <p>Generated with web3j version 4.0.1. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@SuppressWarnings("rawtypes") |
|
|
|
@SuppressWarnings("rawtypes") |
|
|
|
public class EventEmitter extends Contract { |
|
|
|
public class EventEmitter extends Contract { |
|
|
|
private static final String BINARY = |
|
|
|
private static final String BINARY = |
|
|
|
"608060405234801561001057600080fd5b5060008054600160a060020a03191633179055610187806100326000396000f3006080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f245811461005b5780636057361d1461008257806367e404ce1461009c575b600080fd5b34801561006757600080fd5b506100706100da565b60408051918252519081900360200190f35b34801561008e57600080fd5b5061009a6004356100e0565b005b3480156100a857600080fd5b506100b161013f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60025490565b604080513381526020810183905281517fc9db20adedc6cf2b5d25252b101ab03e124902a73fcb12b753f3d1aaa2d8f9f5929181900390910190a16002556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff16905600a165627a7a72305820f958aea7922a9538be4c34980ad3171806aad2d3fedb62682cef2ca4e1f1f3120029"; |
|
|
|
"608060405234801561001057600080fd5b5060008054600160a060020a03191633179055610199806100326000396000f3fe6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f245811461005b5780636057361d1461008257806367e404ce146100ae575b600080fd5b34801561006757600080fd5b506100706100ec565b60408051918252519081900360200190f35b34801561008e57600080fd5b506100ac600480360360208110156100a557600080fd5b50356100f2565b005b3480156100ba57600080fd5b506100c3610151565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60025490565b604080513381526020810183905281517fc9db20adedc6cf2b5d25252b101ab03e124902a73fcb12b753f3d1aaa2d8f9f5929181900390910190a16002556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff169056fea165627a7a72305820c7f729cb24e05c221f5aa913700793994656f233fe2ce3b9fd9a505ea17e8d8a0029"; |
|
|
|
|
|
|
|
|
|
|
|
public static final String FUNC_VALUE = "value"; |
|
|
|
public static final String FUNC_VALUE = "value"; |
|
|
|
|
|
|
|
|
|
|
@ -63,26 +63,44 @@ public class EventEmitter extends Contract { |
|
|
|
new Event( |
|
|
|
new Event( |
|
|
|
"stored", |
|
|
|
"stored", |
|
|
|
Arrays.<TypeReference<?>>asList( |
|
|
|
Arrays.<TypeReference<?>>asList( |
|
|
|
new TypeReference<Address>() {}, new TypeReference<Uint256>() {})); |
|
|
|
new TypeReference<Address>() {}, new TypeReference<Uint256>() {}));; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
protected EventEmitter( |
|
|
|
protected EventEmitter( |
|
|
|
final String contractAddress, |
|
|
|
String contractAddress, |
|
|
|
final Web3j web3j, |
|
|
|
Web3j web3j, |
|
|
|
final Credentials credentials, |
|
|
|
Credentials credentials, |
|
|
|
final BigInteger gasPrice, |
|
|
|
BigInteger gasPrice, |
|
|
|
final BigInteger gasLimit) { |
|
|
|
BigInteger gasLimit) { |
|
|
|
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); |
|
|
|
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected EventEmitter( |
|
|
|
protected EventEmitter( |
|
|
|
final String contractAddress, |
|
|
|
String contractAddress, |
|
|
|
final Web3j web3j, |
|
|
|
Web3j web3j, |
|
|
|
final TransactionManager transactionManager, |
|
|
|
Credentials credentials, |
|
|
|
final BigInteger gasPrice, |
|
|
|
ContractGasProvider contractGasProvider) { |
|
|
|
final BigInteger gasLimit) { |
|
|
|
super(BINARY, contractAddress, web3j, credentials, contractGasProvider); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
|
|
|
|
protected EventEmitter( |
|
|
|
|
|
|
|
String contractAddress, |
|
|
|
|
|
|
|
Web3j web3j, |
|
|
|
|
|
|
|
TransactionManager transactionManager, |
|
|
|
|
|
|
|
BigInteger gasPrice, |
|
|
|
|
|
|
|
BigInteger gasLimit) { |
|
|
|
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); |
|
|
|
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected EventEmitter( |
|
|
|
|
|
|
|
String contractAddress, |
|
|
|
|
|
|
|
Web3j web3j, |
|
|
|
|
|
|
|
TransactionManager transactionManager, |
|
|
|
|
|
|
|
ContractGasProvider contractGasProvider) { |
|
|
|
|
|
|
|
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public RemoteCall<BigInteger> value() { |
|
|
|
public RemoteCall<BigInteger> value() { |
|
|
|
final Function function = |
|
|
|
final Function function = |
|
|
|
new Function( |
|
|
|
new Function( |
|
|
@ -92,7 +110,7 @@ public class EventEmitter extends Contract { |
|
|
|
return executeRemoteCallSingleValueReturn(function, BigInteger.class); |
|
|
|
return executeRemoteCallSingleValueReturn(function, BigInteger.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public RemoteCall<TransactionReceipt> store(final BigInteger _amount) { |
|
|
|
public RemoteCall<TransactionReceipt> store(BigInteger _amount) { |
|
|
|
final Function function = |
|
|
|
final Function function = |
|
|
|
new Function( |
|
|
|
new Function( |
|
|
|
FUNC_STORE, |
|
|
|
FUNC_STORE, |
|
|
@ -110,30 +128,12 @@ public class EventEmitter extends Contract { |
|
|
|
return executeRemoteCallSingleValueReturn(function, String.class); |
|
|
|
return executeRemoteCallSingleValueReturn(function, String.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static RemoteCall<EventEmitter> deploy( |
|
|
|
public List<StoredEventResponse> getStoredEvents(TransactionReceipt transactionReceipt) { |
|
|
|
final Web3j web3j, |
|
|
|
List<Contract.EventValuesWithLog> valueList = |
|
|
|
final Credentials credentials, |
|
|
|
|
|
|
|
final BigInteger gasPrice, |
|
|
|
|
|
|
|
final BigInteger gasLimit) { |
|
|
|
|
|
|
|
return deployRemoteCall(EventEmitter.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static RemoteCall<EventEmitter> deploy( |
|
|
|
|
|
|
|
final Web3j web3j, |
|
|
|
|
|
|
|
final TransactionManager transactionManager, |
|
|
|
|
|
|
|
final BigInteger gasPrice, |
|
|
|
|
|
|
|
final BigInteger gasLimit) { |
|
|
|
|
|
|
|
return deployRemoteCall( |
|
|
|
|
|
|
|
EventEmitter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<StoredEventResponse> getStoredEvents(final TransactionReceipt transactionReceipt) { |
|
|
|
|
|
|
|
final List<Contract.EventValuesWithLog> valueList = |
|
|
|
|
|
|
|
extractEventParametersWithLog(STORED_EVENT, transactionReceipt); |
|
|
|
extractEventParametersWithLog(STORED_EVENT, transactionReceipt); |
|
|
|
final ArrayList<StoredEventResponse> responses = |
|
|
|
ArrayList<StoredEventResponse> responses = new ArrayList<StoredEventResponse>(valueList.size()); |
|
|
|
new ArrayList<StoredEventResponse>(valueList.size()); |
|
|
|
for (Contract.EventValuesWithLog eventValues : valueList) { |
|
|
|
for (final Contract.EventValuesWithLog eventValues : valueList) { |
|
|
|
StoredEventResponse typedResponse = new StoredEventResponse(); |
|
|
|
final StoredEventResponse typedResponse = new StoredEventResponse(); |
|
|
|
|
|
|
|
typedResponse.log = eventValues.getLog(); |
|
|
|
typedResponse.log = eventValues.getLog(); |
|
|
|
typedResponse._to = (String) eventValues.getNonIndexedValues().get(0).getValue(); |
|
|
|
typedResponse._to = (String) eventValues.getNonIndexedValues().get(0).getValue(); |
|
|
|
typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); |
|
|
|
typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); |
|
|
@ -142,16 +142,16 @@ public class EventEmitter extends Contract { |
|
|
|
return responses; |
|
|
|
return responses; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Observable<StoredEventResponse> storedEventObservable(final EthFilter filter) { |
|
|
|
public Flowable<StoredEventResponse> storedEventFlowable(EthFilter filter) { |
|
|
|
return web3j |
|
|
|
return web3j |
|
|
|
.ethLogObservable(filter) |
|
|
|
.ethLogFlowable(filter) |
|
|
|
.map( |
|
|
|
.map( |
|
|
|
new Func1<Log, StoredEventResponse>() { |
|
|
|
new io.reactivex.functions.Function<Log, StoredEventResponse>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public StoredEventResponse call(final Log log) { |
|
|
|
public StoredEventResponse apply(Log log) { |
|
|
|
final Contract.EventValuesWithLog eventValues = |
|
|
|
Contract.EventValuesWithLog eventValues = |
|
|
|
extractEventParametersWithLog(STORED_EVENT, log); |
|
|
|
extractEventParametersWithLog(STORED_EVENT, log); |
|
|
|
final StoredEventResponse typedResponse = new StoredEventResponse(); |
|
|
|
StoredEventResponse typedResponse = new StoredEventResponse(); |
|
|
|
typedResponse.log = log; |
|
|
|
typedResponse.log = log; |
|
|
|
typedResponse._to = (String) eventValues.getNonIndexedValues().get(0).getValue(); |
|
|
|
typedResponse._to = (String) eventValues.getNonIndexedValues().get(0).getValue(); |
|
|
|
typedResponse._amount = |
|
|
|
typedResponse._amount = |
|
|
@ -161,31 +161,77 @@ public class EventEmitter extends Contract { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Observable<StoredEventResponse> storedEventObservable( |
|
|
|
public Flowable<StoredEventResponse> storedEventFlowable( |
|
|
|
final DefaultBlockParameter startBlock, final DefaultBlockParameter endBlock) { |
|
|
|
DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { |
|
|
|
final EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); |
|
|
|
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); |
|
|
|
filter.addSingleTopic(EventEncoder.encode(STORED_EVENT)); |
|
|
|
filter.addSingleTopic(EventEncoder.encode(STORED_EVENT)); |
|
|
|
return storedEventObservable(filter); |
|
|
|
return storedEventFlowable(filter); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
public static EventEmitter load( |
|
|
|
public static EventEmitter load( |
|
|
|
final String contractAddress, |
|
|
|
String contractAddress, |
|
|
|
final Web3j web3j, |
|
|
|
Web3j web3j, |
|
|
|
final Credentials credentials, |
|
|
|
Credentials credentials, |
|
|
|
final BigInteger gasPrice, |
|
|
|
BigInteger gasPrice, |
|
|
|
final BigInteger gasLimit) { |
|
|
|
BigInteger gasLimit) { |
|
|
|
return new EventEmitter(contractAddress, web3j, credentials, gasPrice, gasLimit); |
|
|
|
return new EventEmitter(contractAddress, web3j, credentials, gasPrice, gasLimit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
public static EventEmitter load( |
|
|
|
public static EventEmitter load( |
|
|
|
final String contractAddress, |
|
|
|
String contractAddress, |
|
|
|
final Web3j web3j, |
|
|
|
Web3j web3j, |
|
|
|
final TransactionManager transactionManager, |
|
|
|
TransactionManager transactionManager, |
|
|
|
final BigInteger gasPrice, |
|
|
|
BigInteger gasPrice, |
|
|
|
final BigInteger gasLimit) { |
|
|
|
BigInteger gasLimit) { |
|
|
|
return new EventEmitter(contractAddress, web3j, transactionManager, gasPrice, gasLimit); |
|
|
|
return new EventEmitter(contractAddress, web3j, transactionManager, gasPrice, gasLimit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static EventEmitter load( |
|
|
|
|
|
|
|
String contractAddress, |
|
|
|
|
|
|
|
Web3j web3j, |
|
|
|
|
|
|
|
Credentials credentials, |
|
|
|
|
|
|
|
ContractGasProvider contractGasProvider) { |
|
|
|
|
|
|
|
return new EventEmitter(contractAddress, web3j, credentials, contractGasProvider); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static EventEmitter load( |
|
|
|
|
|
|
|
String contractAddress, |
|
|
|
|
|
|
|
Web3j web3j, |
|
|
|
|
|
|
|
TransactionManager transactionManager, |
|
|
|
|
|
|
|
ContractGasProvider contractGasProvider) { |
|
|
|
|
|
|
|
return new EventEmitter(contractAddress, web3j, transactionManager, contractGasProvider); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static RemoteCall<EventEmitter> deploy( |
|
|
|
|
|
|
|
Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { |
|
|
|
|
|
|
|
return deployRemoteCall( |
|
|
|
|
|
|
|
EventEmitter.class, web3j, credentials, contractGasProvider, BINARY, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static RemoteCall<EventEmitter> deploy( |
|
|
|
|
|
|
|
Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { |
|
|
|
|
|
|
|
return deployRemoteCall( |
|
|
|
|
|
|
|
EventEmitter.class, web3j, transactionManager, contractGasProvider, BINARY, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
|
|
|
|
public static RemoteCall<EventEmitter> deploy( |
|
|
|
|
|
|
|
Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { |
|
|
|
|
|
|
|
return deployRemoteCall(EventEmitter.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
|
|
|
|
public static RemoteCall<EventEmitter> deploy( |
|
|
|
|
|
|
|
Web3j web3j, |
|
|
|
|
|
|
|
TransactionManager transactionManager, |
|
|
|
|
|
|
|
BigInteger gasPrice, |
|
|
|
|
|
|
|
BigInteger gasLimit) { |
|
|
|
|
|
|
|
return deployRemoteCall( |
|
|
|
|
|
|
|
EventEmitter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static class StoredEventResponse { |
|
|
|
public static class StoredEventResponse { |
|
|
|
public Log log; |
|
|
|
public Log log; |
|
|
|
|
|
|
|
|
|
|
|