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


Java Address类代码示例

本文整理汇总了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;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:18,代码来源:ModumToken.java

示例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;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:19,代码来源:HumaniqToken.java

示例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;
        }
    });
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:19,代码来源:ModumToken.java

示例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();
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:22,代码来源:Wallet.java

示例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;
}
 
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:23,代码来源:WaitAllResultsTask.java

示例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;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:18,代码来源:HumaniqToken.java

示例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);
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:17,代码来源:PlayExampleActivity.java

示例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;
        }
    });
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:19,代码来源:HumaniqToken.java

示例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;
            });
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:22,代码来源:RxSlotRooms.java

示例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));
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:11,代码来源:TokenRepository.java

示例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;
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:16,代码来源:ModumToken.java

示例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;
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:16,代码来源:ModumToken.java

示例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;
}
 
开发者ID:web3j,项目名称:quorum,代码行数:16,代码来源:HumanStandardToken.java

示例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;
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:16,代码来源:ModumToken.java

示例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;
            });
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:10,代码来源:SlotMachine.java


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