Java Code Examples for net.bither.bitherj.core.Tx#getFirstOutAddress()
The following examples show how to use
net.bither.bitherj.core.Tx#getFirstOutAddress() .
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: QRCodeTxTransport.java From bitherj with Apache License 2.0 | 6 votes |
private static QRCodeTxTransport oldFromSendRequestWithUnsignedTransaction(Tx tx, String addressCannotParsed) { QRCodeTxTransport qrCodeTransport = new QRCodeTxTransport(); qrCodeTransport.setMyAddress(tx.getFromAddress()); String toAddress = tx.getFirstOutAddress(); if (Utils.isEmpty(toAddress)) { toAddress = addressCannotParsed; } qrCodeTransport.setToAddress(toAddress); qrCodeTransport.setTo(tx.amountSentToAddress(toAddress)); qrCodeTransport.setFee(tx.getFee()); List<String> hashList = new ArrayList<String>(); for (byte[] h : tx.getUnsignedInHashes()) { hashList.add(Utils.bytesToHexString(h)); } qrCodeTransport.setHashList(hashList); return qrCodeTransport; }
Example 2
Source File: QRCodeTxTransport.java From bitherj with Apache License 2.0 | 5 votes |
private static QRCodeTxTransport fromDeskpHDMSendRequestWithUnsignedTransaction(TxTransportType txTransportType, Tx tx, List<DesktopHDMAddress> desktopHDMAddresses, String addressCannotParsed) { if (!AddressManager.getInstance().hasDesktopHDMKeychain()) { return null; } QRCodeTxTransport qrCodeTransport = new QRCodeTxTransport(); qrCodeTransport.setMyAddress(tx.getFromAddress()); String toAddress = tx.getFirstOutAddress(); if (Utils.isEmpty(toAddress)) { toAddress = addressCannotParsed; } qrCodeTransport.setToAddress(toAddress); qrCodeTransport.setTo(tx.amountSentToAddress(toAddress)); qrCodeTransport.setFee(tx.getFee()); List<String> hashList = new ArrayList<String>(); if (txTransportType == TxTransportType.DesktopHDM) { for (int i = 0; i < desktopHDMAddresses.size(); i++) { DesktopHDMAddress desktopHDMAddress = desktopHDMAddresses.get(i); for (byte[] h : tx.getUnsignedInHashesForDesktpHDM(desktopHDMAddress.getPubKey(), i)) { String[] strings = new String[]{Integer.toString(desktopHDMAddress.getPathType().getValue()), Integer.toString(desktopHDMAddress.getIndex()), Utils.bytesToHexString(h)}; hashList.add(Utils.joinString(strings, QRCodeUtil.QR_CODE_SECONDARY_SPLIT)); } } } qrCodeTransport.setHashList(hashList); return qrCodeTransport; }
Example 3
Source File: DialogSendConfirm.java From bither-android with Apache License 2.0 | 4 votes |
public DialogSendConfirm(Context context, Tx tx, String changeAddress, SendConfirmListener listener) { super(context); this.tx = tx; this.listener = listener; setOnDismissListener(this); setContentView(R.layout.dialog_send_confirm); TextView tvAddress = (TextView) findViewById(R.id.tv_address); TextView tvBtc = (TextView) findViewById(R.id.tv_btc); TextView tvFee = (TextView) findViewById(R.id.tv_fee); TextView tvSymbol = (TextView) findViewById(R.id.tv_symbol); TextView tvFeeSymbol = (TextView) findViewById(R.id.tv_fee_symbol); View llChange = findViewById(R.id.ll_change); TextView tvAddressChange = (TextView) findViewById(R.id.tv_address_change); TextView tvBtcChange = (TextView) findViewById(R.id.tv_btc_change); TextView tvSymbolChange = (TextView) findViewById(R.id.tv_symbol_change); String symbol = AppSharedPreference.getInstance().getBitcoinUnit().name(); tvSymbol.setText(symbol); tvFeeSymbol.setText(symbol); tvSymbolChange.setText(symbol); Button btnCancel = (Button) findViewById(R.id.btn_cancel); Button btnOk = (Button) findViewById(R.id.btn_ok); String outAddress = tx.getFirstOutAddressOtherThanChange(changeAddress); if (Utils.isEmpty(changeAddress) || tx.amountSentToAddress(changeAddress) <= 0) { llChange.setVisibility(View.GONE); } else { tvAddressChange.setText(WalletUtils.formatHash(changeAddress, 4, 24)); tvBtcChange.setText(UnitUtilWrapper.formatValueWithBold(tx.amountSentToAddress(changeAddress))); } if (tx.getFirstOutAddress() != null) { tvAddress.setText(WalletUtils.formatHash(outAddress, 4, 24)); } tvBtc.setText(UnitUtilWrapper.formatValueWithBold(tx.amountSentToAddress(outAddress))); tvFee.setText(UnitUtilWrapper.formatValueWithBold(tx.getFee())); // This warning is no longer needed. As more and more mining pool upgrade their // bitcoin client to 0.9.+, low fee transactions get confirmed soon enough. // if (isLowPriority(tx)) { // tvLowPriorityWarn.setVisibility(View.VISIBLE); // } else { // tvLowPriorityWarn.setVisibility(View.GONE); // } btnCancel.setOnClickListener(cancelClick); btnOk.setOnClickListener(okClick); }