use of org.bcos.web3j.abi.EventValues in project web3sdk by FISCO-BCOS.
the class ContractAbiMgr method abiNotExistEventObservable.
public Observable<AbiNotExistEventResponse> abiNotExistEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("AbiNotExist", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, AbiNotExistEventResponse>() {
@Override
public AbiNotExistEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
AbiNotExistEventResponse typedResponse = new AbiNotExistEventResponse();
typedResponse.cns_name = (Utf8String) eventValues.getNonIndexedValues().get(0);
typedResponse.contractname = (Utf8String) eventValues.getNonIndexedValues().get(1);
typedResponse.version = (Utf8String) eventValues.getNonIndexedValues().get(2);
return typedResponse;
}
});
}
use of org.bcos.web3j.abi.EventValues in project web3sdk by FISCO-BCOS.
the class ContractAbiMgr method addOldAbiEventObservable.
public Observable<AddOldAbiEventResponse> addOldAbiEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("AddOldAbi", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Address>() {
}, new TypeReference<Uint256>() {
}, new TypeReference<Uint256>() {
}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, AddOldAbiEventResponse>() {
@Override
public AddOldAbiEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
AddOldAbiEventResponse typedResponse = new AddOldAbiEventResponse();
typedResponse.cns_name = (Utf8String) eventValues.getNonIndexedValues().get(0);
typedResponse.contractname = (Utf8String) eventValues.getNonIndexedValues().get(1);
typedResponse.version = (Utf8String) eventValues.getNonIndexedValues().get(2);
typedResponse.abi = (Utf8String) eventValues.getNonIndexedValues().get(3);
typedResponse.addr = (Address) eventValues.getNonIndexedValues().get(4);
typedResponse.blocknumber = (Uint256) eventValues.getNonIndexedValues().get(5);
typedResponse.timestamp = (Uint256) eventValues.getNonIndexedValues().get(6);
return typedResponse;
}
});
}
use of org.bcos.web3j.abi.EventValues in project web3sdk by FISCO-BCOS.
the class ContractAbiMgr method abiExistEventObservable.
public Observable<AbiExistEventResponse> abiExistEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("AbiExist", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Address>() {
}, new TypeReference<Uint256>() {
}, new TypeReference<Uint256>() {
}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, AbiExistEventResponse>() {
@Override
public AbiExistEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
AbiExistEventResponse typedResponse = new AbiExistEventResponse();
typedResponse.cns_name = (Utf8String) eventValues.getNonIndexedValues().get(0);
typedResponse.contractname = (Utf8String) eventValues.getNonIndexedValues().get(1);
typedResponse.version = (Utf8String) eventValues.getNonIndexedValues().get(2);
typedResponse.abi = (Utf8String) eventValues.getNonIndexedValues().get(3);
typedResponse.addr = (Address) eventValues.getNonIndexedValues().get(4);
typedResponse.bn = (Uint256) eventValues.getNonIndexedValues().get(5);
typedResponse.t = (Uint256) eventValues.getNonIndexedValues().get(6);
return typedResponse;
}
});
}
use of org.bcos.web3j.abi.EventValues in project web3sdk by FISCO-BCOS.
the class ContractAbiMgr method addAbiEventObservable.
public Observable<AddAbiEventResponse> addAbiEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("AddAbi", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Address>() {
}, new TypeReference<Uint256>() {
}, new TypeReference<Uint256>() {
}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, AddAbiEventResponse>() {
@Override
public AddAbiEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
AddAbiEventResponse typedResponse = new AddAbiEventResponse();
typedResponse.cns_name = (Utf8String) eventValues.getNonIndexedValues().get(0);
typedResponse.contractname = (Utf8String) eventValues.getNonIndexedValues().get(1);
typedResponse.version = (Utf8String) eventValues.getNonIndexedValues().get(2);
typedResponse.abi = (Utf8String) eventValues.getNonIndexedValues().get(3);
typedResponse.addr = (Address) eventValues.getNonIndexedValues().get(4);
typedResponse.blocknumber = (Uint256) eventValues.getNonIndexedValues().get(5);
typedResponse.timestamp = (Uint256) eventValues.getNonIndexedValues().get(6);
return typedResponse;
}
});
}
use of org.bcos.web3j.abi.EventValues in project web3sdk by FISCO-BCOS.
the class ContractAbiMgr method getAbiExistEvents.
public static List<AbiExistEventResponse> getAbiExistEvents(TransactionReceipt transactionReceipt) {
final Event event = new Event("AbiExist", Arrays.<TypeReference<?>>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<Address>() {
}, new TypeReference<Uint256>() {
}, new TypeReference<Uint256>() {
}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
ArrayList<AbiExistEventResponse> responses = new ArrayList<AbiExistEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
AbiExistEventResponse typedResponse = new AbiExistEventResponse();
typedResponse.cns_name = (Utf8String) eventValues.getNonIndexedValues().get(0);
typedResponse.contractname = (Utf8String) eventValues.getNonIndexedValues().get(1);
typedResponse.version = (Utf8String) eventValues.getNonIndexedValues().get(2);
typedResponse.abi = (Utf8String) eventValues.getNonIndexedValues().get(3);
typedResponse.addr = (Address) eventValues.getNonIndexedValues().get(4);
typedResponse.bn = (Uint256) eventValues.getNonIndexedValues().get(5);
typedResponse.t = (Uint256) eventValues.getNonIndexedValues().get(6);
responses.add(typedResponse);
}
return responses;
}
Aggregations