本文整理汇总了Java中org.web3j.abi.datatypes.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于org.web3j.abi.datatypes包,在下文中一共展示了Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mintedEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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.datatypes.Event; //导入依赖的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.datatypes.Event; //导入依赖的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.datatypes.Event; //导入依赖的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: votedEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例6: payoutEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例7: approvalEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例8: newMessageEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例9: pendingEventSet
import org.web3j.abi.datatypes.Event; //导入依赖的package包/类
@OnClick(R.id.pending_event_set)
public void pendingEventSet() {
final Event event = new Event(
"Print",
Collections.emptyList(),
Collections.singletonList(new TypeReference<Uint256>() {
}));
FilterManager.Filter filter = new FilterManager.Filter(event, HELLO_CONTRACT_ADDR);
FilterManager.pendingFilterLogs(filter)
.compose(bindToLifecycle())
.map(log -> Utils.extractEventParameters(event, log))
.subscribe(eventValues -> {
Log.i(TAG, "output : " + eventValues.getNonIndexedValues().get(0).getValue());
}, Throwable::printStackTrace);
}
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:17,代码来源:PendingExampleActivity.java
示例10: isTopicMatch
import org.web3j.abi.datatypes.Event; //导入依赖的package包/类
public static boolean isTopicMatch(Event event, Log log) throws Exception {
Hashes topics = log.getTopics();
if (topics == null || topics.size() == 0) {
android.util.Log.e(TAG, "topic is empty");
return false;
}
String eventSig = EventEncoder.encode(event);
String topic = topics.get(0).getHex();
if (!topic.equals(eventSig)) {
android.util.Log.e(TAG, "topic is not match. topic signature : " + eventSig + ", log topic : " + topic);
return false;
}
return true;
}
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:17,代码来源:Utils.java
示例11: getNotifyEvents
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例12: notifyEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的package包/类
public Observable<NotifyEventResponse> notifyEventObservable() {
final Event event = new Event(
"Notify",
Collections.emptyList(),
Arrays.asList(
new TypeReference<Uint256>() {
},
new TypeReference<Uint256>() {
}
));
return filterLogs(event)
.map(eventValues -> {
NotifyEventResponse typedResponse = new NotifyEventResponse();
typedResponse.input = (Uint256) eventValues.getNonIndexedValues().get(0);
typedResponse.result = (Uint256) eventValues.getNonIndexedValues().get(1);
return typedResponse;
});
}
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:20,代码来源:Fibonacci.java
示例13: getPrintEvents
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例14: transferEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例15: transferEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例16: issuanceEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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
示例17: getTransferEvents
import org.web3j.abi.datatypes.Event; //导入依赖的package包/类
public List<TransferEventResponse> getTransferEvents(TransactionReceipt transactionReceipt) {
final Event event = new Event("Transfer",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
ArrayList<TransferEventResponse> responses = new ArrayList<TransferEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
TransferEventResponse typedResponse = new TransferEventResponse();
typedResponse.log = transactionReceipt.getLogs().get(valueList.indexOf(eventValues));
typedResponse._from = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse._to = (String) eventValues.getIndexedValues().get(1).getValue();
typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
responses.add(typedResponse);
}
return responses;
}
开发者ID:web3j,项目名称:web3j,代码行数:17,代码来源:HumanStandardToken.java
示例18: transferEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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.log = log;
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,项目名称:web3j,代码行数:20,代码来源:HumanStandardToken.java
示例19: getApprovalEvents
import org.web3j.abi.datatypes.Event; //导入依赖的package包/类
public List<ApprovalEventResponse> getApprovalEvents(TransactionReceipt transactionReceipt) {
final Event event = new Event("Approval",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
ArrayList<ApprovalEventResponse> responses = new ArrayList<ApprovalEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
ApprovalEventResponse typedResponse = new ApprovalEventResponse();
typedResponse.log = transactionReceipt.getLogs().get(valueList.indexOf(eventValues));
typedResponse._owner = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse._spender = (String) eventValues.getIndexedValues().get(1).getValue();
typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
responses.add(typedResponse);
}
return responses;
}
开发者ID:web3j,项目名称:web3j,代码行数:17,代码来源:HumanStandardToken.java
示例20: approvalEventObservable
import org.web3j.abi.datatypes.Event; //导入依赖的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.log = log;
typedResponse._owner = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse._spender = (String) eventValues.getIndexedValues().get(1).getValue();
typedResponse._value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
return typedResponse;
}
});
}
开发者ID:web3j,项目名称:web3j,代码行数:20,代码来源:HumanStandardToken.java
注:本文中的org.web3j.abi.datatypes.Event类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论