当前位置: 首页>>代码示例>>Java>>正文


Java EventValues类代码示例

本文整理汇总了Java中org.web3j.abi.EventValues的典型用法代码示例。如果您正苦于以下问题:Java EventValues类的具体用法?Java EventValues怎么用?Java EventValues使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EventValues类属于org.web3j.abi包,在下文中一共展示了EventValues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mintedEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<MintedEventResponse> mintedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Minted", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, MintedEventResponse>() {
        @Override
        public MintedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            MintedEventResponse typedResponse = new MintedEventResponse();
            typedResponse._addr = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.tokens = (Uint256) eventValues.getNonIndexedValues().get(1);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:18,代码来源:ModumToken.java

示例2: transferEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse._from = (Address) eventValues.getIndexedValues().get(0);
            typedResponse._to = (Address) eventValues.getIndexedValues().get(1);
            typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:19,代码来源:ModumToken.java

示例3: extractEventParameters

import org.web3j.abi.EventValues; //导入依赖的package包/类
public static EventValues extractEventParameters(Event event, Log log) throws Exception {
        Hashes topics = log.getTopics();
        if (topics == null || topics.size() == 0) {
//            throw new GethException("topic is empty");
            return null;
        }

        String eventSig = EventEncoder.encode(event);
        String topic = topics.get(0).getHex();
        if (!topic.equals(eventSig)) {
//            throw new GethException("topic is not match. topic signature : " + eventSig + ", log topic : " + topic);
            return null;
        }
        android.util.Log.d(TAG, "======= LOG DATA : " + byteToHex(log.getData()));

        List<Type> indexedValues = new ArrayList<>();
        List<Type> nonIndexedValues = FunctionReturnDecoder.decode(byteToHex(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).getHex(), indexedParameters.get(i));
            indexedValues.add(value);
        }
        return new EventValues(indexedValues, nonIndexedValues);
    }
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:26,代码来源:Utils.java

示例4: approvalEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<ApprovalEventResponse> approvalEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Approval", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ApprovalEventResponse>() {
        @Override
        public ApprovalEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ApprovalEventResponse typedResponse = new ApprovalEventResponse();
            typedResponse.owner = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.spender = (Address) eventValues.getIndexedValues().get(1);
            typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:19,代码来源:HumaniqToken.java

示例5: testProcessEvent

import org.web3j.abi.EventValues; //导入依赖的package包/类
@Test
public void testProcessEvent() {
    TransactionReceipt transactionReceipt = new TransactionReceipt();
    Log log = new Log();
    log.setTopics(Arrays.asList(
            // encoded function
            "0xfceb437c298f40d64702ac26411b2316e79f3c28ffa60edfc891ad4fc8ab82ca",
            // indexed value
            "0000000000000000000000003d6cb163f7c72d20b0fcd6baae5889329d138a4a"));
    // non-indexed value
    log.setData("0000000000000000000000000000000000000000000000000000000000000001");

    transactionReceipt.setLogs(Arrays.asList(log));

    EventValues eventValues = contract.processEvent(transactionReceipt).get(0);

    assertThat(eventValues.getIndexedValues(),
            equalTo(Collections.singletonList(
                    new Address("0x3d6cb163f7c72d20b0fcd6baae5889329d138a4a"))));
    assertThat(eventValues.getNonIndexedValues(),
            equalTo(Collections.singletonList(new Uint256(BigInteger.ONE))));
}
 
开发者ID:web3j,项目名称:web3j,代码行数:23,代码来源:ContractTest.java

示例6: votedEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<VotedEventResponse> votedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Voted", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Bool>() {}, new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, VotedEventResponse>() {
        @Override
        public VotedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            VotedEventResponse typedResponse = new VotedEventResponse();
            typedResponse._addr = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.option = (Bool) eventValues.getNonIndexedValues().get(1);
            typedResponse.votes = (Uint256) eventValues.getNonIndexedValues().get(2);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:19,代码来源:ModumToken.java

示例7: payoutEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<PayoutEventResponse> payoutEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Payout", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, PayoutEventResponse>() {
        @Override
        public PayoutEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            PayoutEventResponse typedResponse = new PayoutEventResponse();
            typedResponse.weiPerToken = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:17,代码来源:ModumToken.java

示例8: approvalEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<ApprovalEventResponse> approvalEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Approval", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ApprovalEventResponse>() {
        @Override
        public ApprovalEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ApprovalEventResponse typedResponse = new ApprovalEventResponse();
            typedResponse._owner = (Address) eventValues.getIndexedValues().get(0);
            typedResponse._spender = (Address) eventValues.getIndexedValues().get(1);
            typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:19,代码来源:ModumToken.java

示例9: newMessageEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<NewMessageEventResponse> newMessageEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("NewMessage", 
            Arrays.<TypeReference<?>>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Utf8String>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, NewMessageEventResponse>() {
        @Override
        public NewMessageEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            NewMessageEventResponse typedResponse = new NewMessageEventResponse();
            typedResponse.from = (Address) eventValues.getNonIndexedValues().get(0);
            typedResponse.message = (Utf8String) eventValues.getNonIndexedValues().get(1);
            return typedResponse;
        }
    });
}
 
开发者ID:CDCgov,项目名称:blockchain-collab,代码行数:18,代码来源:Echo_sol_Echo.java

示例10: getNotifyEvents

import org.web3j.abi.EventValues; //导入依赖的package包/类
public List<NotifyEventResponse> getNotifyEvents(Receipt transactionReceipt) throws Exception {
    final Event event = new Event(
            "Notify",
            Collections.emptyList(),
            Arrays.asList(
                    new TypeReference<Uint256>() {
                    },
                    new TypeReference<Uint256>() {
                    }
            ));

    List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
    ArrayList<NotifyEventResponse> responses = new ArrayList<>(valueList.size());
    for (EventValues eventValues : valueList) {
        NotifyEventResponse typedResponse = new NotifyEventResponse();
        typedResponse.input = (Uint256) eventValues.getNonIndexedValues().get(0);
        typedResponse.result = (Uint256) eventValues.getNonIndexedValues().get(1);
        responses.add(typedResponse);
    }
    return responses;
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:22,代码来源:Fibonacci.java

示例11: getSlotMachineCreatedEvents

import org.web3j.abi.EventValues; //导入依赖的package包/类
/**
 * events
 **/
public List<SlotMachineCreatedEventResponse> getSlotMachineCreatedEvents(Receipt transactionReceipt) throws Exception {
    List<EventValues> valueList = extractEventParameters(SLOT_MACHINE_CREATED, transactionReceipt);
    ArrayList<SlotMachineCreatedEventResponse> responses = new ArrayList<>(valueList.size());
    for (EventValues eventValues : valueList) {
        SlotMachineCreatedEventResponse typedResponse = new SlotMachineCreatedEventResponse();
        typedResponse._banker = (Address) eventValues.getNonIndexedValues().get(0);
        typedResponse._decider = (Uint16) eventValues.getNonIndexedValues().get(1);
        typedResponse._minBet = (Uint256) eventValues.getNonIndexedValues().get(2);
        typedResponse._maxBet = (Uint256) eventValues.getNonIndexedValues().get(3);
        typedResponse._maxPrize = (Uint16) eventValues.getNonIndexedValues().get(4);
        typedResponse._totalNum = (Uint256) eventValues.getNonIndexedValues().get(5);
        typedResponse._slotAddr = (Address) eventValues.getNonIndexedValues().get(6);
        responses.add(typedResponse);
    }
    return responses;
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:20,代码来源:SlotMachineManager.java

示例12: getPrintEvents

import org.web3j.abi.EventValues; //导入依赖的package包/类
public List<PrintEventResponse> getPrintEvents(Receipt transactionReceipt) throws Exception {
    final Event event = new Event(
            "Print",
            Collections.emptyList(),
            Collections.singletonList(new TypeReference<Uint256>() {
            }));

    List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
    ArrayList<PrintEventResponse> responses = new ArrayList<>(valueList.size());
    for (EventValues eventValues : valueList) {
        PrintEventResponse printEventResponse = new PrintEventResponse();
        printEventResponse.out = (Uint256) eventValues.getNonIndexedValues().get(0);
        responses.add(printEventResponse);
    }
    return responses;
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:17,代码来源:Hello.java

示例13: transferEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer",
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse._from = (String) eventValues.getIndexedValues().get(0).getValue();
            typedResponse._to = (String) eventValues.getIndexedValues().get(1).getValue();
            typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
开发者ID:web3j,项目名称:quorum,代码行数:19,代码来源:HumanStandardToken.java

示例14: transferEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse.from = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.to = (Address) eventValues.getIndexedValues().get(1);
            typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:19,代码来源:HumaniqToken.java

示例15: issuanceEventObservable

import org.web3j.abi.EventValues; //导入依赖的package包/类
public Observable<IssuanceEventResponse> issuanceEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Issuance", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, IssuanceEventResponse>() {
        @Override
        public IssuanceEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            IssuanceEventResponse typedResponse = new IssuanceEventResponse();
            typedResponse.to = (Address) eventValues.getIndexedValues().get(0);
            typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
            return typedResponse;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:18,代码来源:HumaniqToken.java


注:本文中的org.web3j.abi.EventValues类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。