org.fisco.bcos.web3j.abi.EventEncoder Java Examples

The following examples show how to use org.fisco.bcos.web3j.abi.EventEncoder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SolidityFunctionWrapper.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
private MethodSpec buildDefaultRegisterEventLogPushFunction(String eventName)
        throws ClassNotFoundException {

    String generatedFunctionName = "register" + eventName + "EventLogFilter";

    MethodSpec.Builder getEventMethodBuilder =
            MethodSpec.methodBuilder(generatedFunctionName)
                    .addModifiers(Modifier.PUBLIC)
                    .addParameter(AbiTypes.getType("EventLogPushCallback"), CALLBACK_VALUE);

    getEventMethodBuilder.addStatement(
            "String topic0 = $T.encode(" + buildEventDefinitionName(eventName) + ")",
            EventEncoder.class);

    getEventMethodBuilder.addStatement(
            "registerEventLogPushFilter(ABI,BINARY" + ",topic0" + "," + CALLBACK_VALUE + ")");

    return getEventMethodBuilder.build();
}
 
Example #2
Source File: Contract.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public static EventValues staticExtractEventParameters(Event event, Log log) {

        List<String> topics = log.getTopics();
        String encodedEventSignature = EventEncoder.encode(event);
        if (!topics.get(0).equals(encodedEventSignature)) {
            return null;
        }

        List<Type> indexedValues = new ArrayList<>();
        List<Type> nonIndexedValues =
                FunctionReturnDecoder.decode(log.getData(), event.getNonIndexedParameters());

        List<TypeReference<Type>> indexedParameters = event.getIndexedParameters();
        for (int i = 0; i < indexedParameters.size(); i++) {
            Type value =
                    FunctionReturnDecoder.decodeIndexedValue(
                            topics.get(i + 1), indexedParameters.get(i));
            indexedValues.add(value);
        }
        return new EventValues(indexedValues, nonIndexedValues);
    }
 
Example #3
Source File: EvidenceVerify.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void registernewEvidenceEventEventLogFilter(
        String fromBlock,
        String toBlock,
        List<String> otherTopcs,
        EventLogPushWithDecodeCallback callback) {
    String topic0 = EventEncoder.encode(NEWEVIDENCEEVENT_EVENT);
    registerEventLogPushFilter(ABI, BINARY, topic0, fromBlock, toBlock, otherTopcs, callback);
}
 
Example #4
Source File: SolidityFunctionWrapper.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
private MethodSpec buildRegisterEventLogPushFunction(String eventName)
        throws ClassNotFoundException {

    String generatedFunctionName = "register" + eventName + "EventLogFilter";

    MethodSpec.Builder getEventMethodBuilder =
            MethodSpec.methodBuilder(generatedFunctionName)
                    .addModifiers(Modifier.PUBLIC)
                    .addParameter(String.class, FROM_BLOCK)
                    .addParameter(String.class, TO_BLOCK);

    addParameter(getEventMethodBuilder, "string[]", OTHER_TOPICS)
            .addParameter(AbiTypes.getType("EventLogPushCallback"), CALLBACK_VALUE);

    getEventMethodBuilder.addStatement(
            "String topic0 = $T.encode(" + buildEventDefinitionName(eventName) + ")",
            EventEncoder.class);

    getEventMethodBuilder.addStatement(
            "registerEventLogPushFilter(ABI,BINARY"
                    + ","
                    + "topic0"
                    + ","
                    + FROM_BLOCK
                    + ","
                    + TO_BLOCK
                    + ","
                    + OTHER_TOPICS
                    + ","
                    + CALLBACK_VALUE
                    + ")");

    return getEventMethodBuilder.build();
}
 
Example #5
Source File: NewSolTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<OwnershipTransferredEventResponse> ownershipTransferredEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(OWNERSHIPTRANSFERRED_EVENT));
    return ownershipTransferredEventFlowable(filter);
}
 
Example #6
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<UpdateResultEventResponse> updateResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(UPDATERESULT_EVENT));
    return updateResultEventFlowable(filter);
}
 
Example #7
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<RemoveResultEventResponse> removeResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(REMOVERESULT_EVENT));
    return removeResultEventFlowable(filter);
}
 
Example #8
Source File: EvidenceVerify.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public void registernewEvidenceEventEventLogFilter(EventLogPushWithDecodeCallback callback) {
    String topic0 = EventEncoder.encode(NEWEVIDENCEEVENT_EVENT);
    registerEventLogPushFilter(ABI, BINARY, topic0, callback);
}
 
Example #9
Source File: Ok.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<TransEventEventResponse> transEventEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(TRANSEVENT_EVENT));
    return transEventEventFlowable(filter);
}
 
Example #10
Source File: OkD.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<InsertResultEventResponse> insertResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(INSERTRESULT_EVENT));
    return insertResultEventFlowable(filter);
}
 
Example #11
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<CreateResultEventResponse> createResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(CREATERESULT_EVENT));
    return createResultEventFlowable(filter);
}
 
Example #12
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<SelectResultEventResponse> selectResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(SELECTRESULT_EVENT));
    return selectResultEventFlowable(filter);
}
 
Example #13
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<InsertResultEventResponse> insertResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(INSERTRESULT_EVENT));
    return insertResultEventFlowable(filter);
}
 
Example #14
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<UpdateResultEventResponse> updateResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(UPDATERESULT_EVENT));
    return updateResultEventFlowable(filter);
}
 
Example #15
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<RemoveResultEventResponse> removeResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(REMOVERESULT_EVENT));
    return removeResultEventFlowable(filter);
}
 
Example #16
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<CreateResultEventResponse> createResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(CREATERESULT_EVENT));
    return createResultEventFlowable(filter);
}
 
Example #17
Source File: NewSolTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<TransferEventResponse> transferEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(TRANSFER_EVENT));
    return transferEventFlowable(filter);
}
 
Example #18
Source File: NewSolTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<ApprovalEventResponse> approvalEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(APPROVAL_EVENT));
    return approvalEventFlowable(filter);
}
 
Example #19
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<CreateResultEventResponse> createResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(CREATERESULT_EVENT));
    return createResultEventFlowable(filter);
}
 
Example #20
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<InsertResultEventResponse> insertResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(INSERTRESULT_EVENT));
    return insertResultEventFlowable(filter);
}
 
Example #21
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<UpdateResultEventResponse> updateResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(UPDATERESULT_EVENT));
    return updateResultEventFlowable(filter);
}
 
Example #22
Source File: TableTest.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
public Flowable<RemoveResultEventResponse> removeResultEventFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(REMOVERESULT_EVENT));
    return removeResultEventFlowable(filter);
}
 
Example #23
Source File: EvidenceSignersData.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public Flowable<NewEvidenceEventEventResponse> newEvidenceEventEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(NEWEVIDENCEEVENT_EVENT));
    return newEvidenceEventEventFlowable(filter);
}
 
Example #24
Source File: Evidence.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public Flowable<AddSignaturesEventEventResponse> addSignaturesEventEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(ADDSIGNATURESEVENT_EVENT));
    return addSignaturesEventEventFlowable(filter);
}
 
Example #25
Source File: Evidence.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public Flowable<NewSignaturesEventEventResponse> newSignaturesEventEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(NEWSIGNATURESEVENT_EVENT));
    return newSignaturesEventEventFlowable(filter);
}
 
Example #26
Source File: Evidence.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public Flowable<ErrorNewSignaturesEventEventResponse> errorNewSignaturesEventEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(ERRORNEWSIGNATURESEVENT_EVENT));
    return errorNewSignaturesEventEventFlowable(filter);
}
 
Example #27
Source File: Evidence.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public Flowable<ErrorAddSignaturesEventEventResponse> errorAddSignaturesEventEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(ERRORADDSIGNATURESEVENT_EVENT));
    return errorAddSignaturesEventEventFlowable(filter);
}
 
Example #28
Source File: Evidence.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public Flowable<AddRepeatSignaturesEventEventResponse> addRepeatSignaturesEventEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(ADDREPEATSIGNATURESEVENT_EVENT));
    return addRepeatSignaturesEventEventFlowable(filter);
}
 
Example #29
Source File: Evidence.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public Flowable<ErrorRepeatSignaturesEventEventResponse> errorRepeatSignaturesEventEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    BcosFilter filter = new BcosFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(ERRORREPEATSIGNATURESEVENT_EVENT));
    return errorRepeatSignaturesEventEventFlowable(filter);
}
 
Example #30
Source File: Evidence.java    From WeBASE-Front with Apache License 2.0 4 votes vote down vote up
public void registeraddRepeatSignaturesEventEventLogFilter(EventLogPushWithDecodeCallback callback) {
    String topic0 = EventEncoder.encode(ADDREPEATSIGNATURESEVENT_EVENT);
    registerEventLogPushFilter(ABI,BINARY,topic0,callback);
}