本文整理汇总了Java中org.web3j.abi.datatypes.Address类的典型用法代码示例。如果您正苦于以下问题:Java Address类的具体用法?Java Address怎么用?Java Address使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Address类属于org.web3j.abi.datatypes包,在下文中一共展示了Address类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mintedEventObservable
import org.web3j.abi.datatypes.Address; //导入依赖的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;
}
});
}
示例2: approvalEventObservable
import org.web3j.abi.datatypes.Address; //导入依赖的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;
}
});
}
示例3: votedEventObservable
import org.web3j.abi.datatypes.Address; //导入依赖的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;
}
});
}
示例4: getBalance
import org.web3j.abi.datatypes.Address; //导入依赖的package包/类
public void getBalance(BalanceCallback callback) {
new AsyncTask<Void, Void, Uint256>() {
@Override
protected Uint256 doInBackground(Void... params) {
try {
return getTokenContract().balanceOf(new Address(address)).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(Uint256 result) {
if (result != null) {
lastBalance = result;
callback.onFinish(result);
}
}
}.execute();
}
示例5: executeAsync
import org.web3j.abi.datatypes.Address; //导入依赖的package包/类
@Override
protected void executeAsync(BlockState blockState, BlockContext context) throws Exception {
blockState.blockchain.executeAsync(blockState, context);
BlockchainBlockState state = blockState.blockchain.getState();
state.assertValidAndApproved();
List<Address> participants = IntStream.range(0,state.participants.size())
.filter(i -> state.results.get(i).hash != null)
.mapToObj(i -> state.participants.get(i).address)
.collect(Collectors.toList());
if (!participants.isEmpty()) {
//todo implement deterministic timeout
if (System.currentTimeMillis() <= blockState.created + MAX_WAIT_RESULTS) {
return;
}
logInfo(blockState, "Failed to wait for some of participant's results: {}", participants);
}
finished = true;
}
示例6: issuanceEventObservable
import org.web3j.abi.datatypes.Address; //导入依赖的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;
}
});
}
示例7: slotList
import org.web3j.abi.datatypes.Address; //导入依赖的package包/类
@OnClick(R.id.slot_list)
void slotList() {
storage
.getLengthOfSlotMachinesArray()
.flatMap(length -> {
int slotLength = length.getValue().intValue();
Log.i(TAG, "length of slot machine array : " + slotLength);
return storage.getSlotMachinesArray(new Uint256(0), new Uint256(slotLength - 1));
})
.mergeWith(storage.getSlotMachines(new Address(CredentialManager.getDefaultAccountHex())))
.flatMap(dynamicArray -> Observable.fromIterable(dynamicArray.getValue()))
.subscribe(address -> {
String slotAddress = address.toString();
Log.i(TAG, "slot address : " + slotAddress);
}, Throwable::printStackTrace);
}
示例8: transferEventObservable
import org.web3j.abi.datatypes.Address; //导入依赖的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;
}
});
}
示例9: createSlotRoom
import org.web3j.abi.datatypes.Address; //导入依赖的package包/类
private static Observable<SlotRoom> createSlotRoom(Address address) {
String slotAddress = address.toString();
SlotMachine machine = SlotMachine.load(slotAddress);
return machine
.getInfo()
.map(response -> {
SlotRoom slotRoom = new SlotRoom(
slotAddress,
Utils.byteToString(response.mName.getValue()),
response.mDecider.getValue().intValue() / 1000.0,
response.mMaxPrize.getValue().intValue(),
Convert.fromWei(response.mMinBet.getValue(), Convert.Unit.ETHER).doubleValue(),
Convert.fromWei(response.mMaxBet.getValue(), Convert.Unit.ETHER).doubleValue(),
response.owner.toString(),
response.bankerBalance.getValue()
);
slotRoom.setPlayerAddress(response.mPlayer.toString());
return slotRoom;
});
}
示例10: createTokenTransferData
import org.web3j.abi.datatypes.Address; //导入依赖的package包/类
public static byte[] createTokenTransferData(String to, BigInteger tokenAmount) {
List<Type> params = Arrays.asList(new Address(to), new Uint256(tokenAmount));
List<TypeReference<?>> returnTypes = Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {
});
Function function = new Function("transfer", params, returnTypes);
String encodedFunction = FunctionEncoder.encode(function);
return Numeric.hexStringToByteArray(Numeric.cleanHexPrefix(encodedFunction));
}
示例11: getVotedEvents
import org.web3j.abi.datatypes.Address; //导入依赖的package包/类
public List<VotedEventResponse> getVotedEvents(TransactionReceipt transactionReceipt) {
final Event event = new Event("Voted",
Arrays.<TypeReference<?>>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Bool>() {}, new TypeReference<Uint256>() {}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
ArrayList<VotedEventResponse> responses = new ArrayList<VotedEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
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);
responses.add(typedResponse);
}
return responses;
}
示例12: getTransferEvents
import org.web3j.abi.datatypes.Address; //导入依赖的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._from = (Address) eventValues.getIndexedValues().get(0);
typedResponse._to = (Address) eventValues.getIndexedValues().get(1);
typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0);
responses.add(typedResponse);
}
return responses;
}
示例13: getTransferEvents
import org.web3j.abi.datatypes.Address; //导入依赖的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._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;
}
示例14: getApprovalEvents
import org.web3j.abi.datatypes.Address; //导入依赖的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._owner = (Address) eventValues.getIndexedValues().get(0);
typedResponse._spender = (Address) eventValues.getIndexedValues().get(1);
typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0);
responses.add(typedResponse);
}
return responses;
}
示例15: gameOccupiedEventObservable
import org.web3j.abi.datatypes.Address; //导入依赖的package包/类
public Observable<GameOccupiedEventResponse> gameOccupiedEventObservable() {
return pendingFilterLogs(GAME_OCCUPIED)
.map(eventValues -> {
GameOccupiedEventResponse typedResponse = new GameOccupiedEventResponse();
typedResponse.player = (Address) eventValues.getNonIndexedValues().get(0);
typedResponse.playerSeed = (StaticArray<Bytes32>) eventValues.getNonIndexedValues().get(1);
return typedResponse;
});
}