use of org.bcos.web3j.abi.datatypes.Event in project web3sdk by FISCO-BCOS.
the class Ok method getEventOrderLogEvents.
public List<EventOrderLogEventResponse> getEventOrderLogEvents(TransactionReceipt transactionReceipt) {
final Event event = new Event("eventOrderLog", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<StaticArray<Bytes32>>() {
}, new TypeReference<StaticArray<Int256>>() {
}, new TypeReference<Int256>() {
}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
ArrayList<EventOrderLogEventResponse> responses = new ArrayList<EventOrderLogEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
EventOrderLogEventResponse typedResponse = new EventOrderLogEventResponse();
typedResponse.msg = (StaticArray<Bytes32>) eventValues.getNonIndexedValues().get(0);
typedResponse.msg2 = (StaticArray<Int256>) eventValues.getNonIndexedValues().get(1);
typedResponse.hello = (Int256) eventValues.getNonIndexedValues().get(2);
responses.add(typedResponse);
}
return responses;
}
use of org.bcos.web3j.abi.datatypes.Event in project web3sdk by FISCO-BCOS.
the class Ok method eventOrderLogEventObservable.
public Observable<EventOrderLogEventResponse> eventOrderLogEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("eventOrderLog", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<StaticArray<Bytes32>>() {
}, new TypeReference<StaticArray<Int256>>() {
}, new TypeReference<Int256>() {
}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, EventOrderLogEventResponse>() {
@Override
public EventOrderLogEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
EventOrderLogEventResponse typedResponse = new EventOrderLogEventResponse();
typedResponse.msg = (StaticArray<Bytes32>) eventValues.getNonIndexedValues().get(0);
typedResponse.msg2 = (StaticArray<Int256>) eventValues.getNonIndexedValues().get(1);
typedResponse.hello = (Int256) eventValues.getNonIndexedValues().get(2);
return typedResponse;
}
});
}
use of org.bcos.web3j.abi.datatypes.Event in project web3sdk by FISCO-BCOS.
the class CAAction 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;
}
});
}
use of org.bcos.web3j.abi.datatypes.Event in project web3sdk by FISCO-BCOS.
the class CAAction method getLogMessageEvents.
public static List<LogMessageEventResponse> getLogMessageEvents(TransactionReceipt transactionReceipt) {
final Event event = new Event("LogMessage", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {
}, new TypeReference<Uint256>() {
}, new TypeReference<Utf8String>() {
}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
ArrayList<LogMessageEventResponse> responses = new ArrayList<LogMessageEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
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);
responses.add(typedResponse);
}
return responses;
}
use of org.bcos.web3j.abi.datatypes.Event in project web3sdk by FISCO-BCOS.
the class ConfigAction 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;
}
});
}
Aggregations