Search in sources :

Example 16 with Uint256

use of org.bcos.web3j.abi.datatypes.generated.Uint256 in project web3sdk by FISCO-BCOS.

the class NodeAction method logMessageEventObservable.

public Observable<LogMessageEventResponse> logMessageEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("LogMessage", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {
    }, new TypeReference<Uint256>() {
    }, new TypeReference<Utf8String>() {
    }));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, LogMessageEventResponse>() {

        @Override
        public LogMessageEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            LogMessageEventResponse typedResponse = new LogMessageEventResponse();
            typedResponse.addr = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.code = (Uint256) eventValues.getNonIndexedValues().get(1);
            typedResponse.msg = (Utf8String) eventValues.getNonIndexedValues().get(2);
            return typedResponse;
        }
    });
}
Also used : EventValues(org.bcos.web3j.abi.EventValues) EthFilter(org.bcos.web3j.protocol.core.methods.request.EthFilter) Utf8String(org.bcos.web3j.abi.datatypes.Utf8String) Address(org.bcos.web3j.abi.datatypes.Address) Log(org.bcos.web3j.protocol.core.methods.response.Log) Event(org.bcos.web3j.abi.datatypes.Event) TypeReference(org.bcos.web3j.abi.TypeReference) Uint256(org.bcos.web3j.abi.datatypes.generated.Uint256)

Aggregations

Uint256 (org.bcos.web3j.abi.datatypes.generated.Uint256)16 Utf8String (org.bcos.web3j.abi.datatypes.Utf8String)15 EventValues (org.bcos.web3j.abi.EventValues)11 TypeReference (org.bcos.web3j.abi.TypeReference)11 Address (org.bcos.web3j.abi.datatypes.Address)11 Event (org.bcos.web3j.abi.datatypes.Event)11 EthFilter (org.bcos.web3j.protocol.core.methods.request.EthFilter)11 Log (org.bcos.web3j.protocol.core.methods.response.Log)11 BigInteger (java.math.BigInteger)4 Type (org.bcos.web3j.abi.datatypes.Type)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 InputStream (java.io.InputStream)2 Service (org.bcos.channel.client.Service)2 Uint8 (org.bcos.web3j.abi.datatypes.generated.Uint8)2 Credentials (org.bcos.web3j.crypto.Credentials)2 ECKeyPair (org.bcos.web3j.crypto.ECKeyPair)2 Web3j (org.bcos.web3j.protocol.Web3j)2 ChannelEthereumService (org.bcos.web3j.protocol.channel.ChannelEthereumService)2 ApplicationContext (org.springframework.context.ApplicationContext)2 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)2