Java Code Examples for net.bither.bitherj.core.Tx#amountSentToAddress()
The following examples show how to use
net.bither.bitherj.core.Tx#amountSentToAddress() .
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: DialogHdSendConfirm.java From bither-android with Apache License 2.0 | 6 votes |
public DialogHdSendConfirm(Context context, String toAddress, List<Tx> txs, SendConfirmListener listener, SplitCoin splitCoin) { super(context); this.listener = listener; this.splitCoin = splitCoin; setOnDismissListener(this); setContentView(R.layout.dialog_send_confirm); configureUI(toAddress); TextView tvBtc = (TextView) findViewById(R.id.tv_btc); TextView tvFee = (TextView) findViewById(R.id.tv_fee); long amount = 0; long fee = 0; for (Tx tx: txs) { amount += tx.amountSentToAddress(toAddress); fee += tx.getFee(); } tvBtc.setText(UnitUtilWrapper.formatValueWithBold(amount)); tvFee.setText(UnitUtilWrapper.formatValueWithBold(fee)); }
Example 2
Source File: DialogHdSendConfirm.java From bither-android with Apache License 2.0 | 6 votes |
public DialogHdSendConfirm(Context context, String toAddress, List<Tx> txs, long fee, SendConfirmListener listener) { super(context); this.listener = listener; this.splitCoin = SplitCoin.BCC; setOnDismissListener(this); setContentView(R.layout.dialog_send_confirm); configureUI(toAddress); TextView tvBtc = (TextView) findViewById(R.id.tv_btc); TextView tvFee = (TextView) findViewById(R.id.tv_fee); long amount = 0; for (Tx tx: txs) { amount += tx.amountSentToAddress(toAddress); } tvBtc.setText(UnitUtilWrapper.formatValueWithBold(amount)); tvFee.setText(UnitUtilWrapper.formatValueWithBold(fee)); }
Example 3
Source File: QRCodeTxTransport.java From bitherj with Apache License 2.0 | 5 votes |
public static String getPresignTxString(Tx tx, String changeAddress, String addressCannotParsed, int hdmIndex, TxTransportType txTransportType) { QRCodeTxTransport qrCodeTransport = fromSendRequestWithUnsignedTransaction(tx, addressCannotParsed, hdmIndex, txTransportType); String preSignString = ""; try { String versionStr = ""; if (txTransportType != null) { versionStr = TX_TRANSPORT_VERSION + txTransportType.getType(); } String changeStr = ""; if (!Utils.isEmpty(changeAddress)) { long changeAmt = tx.amountSentToAddress(changeAddress); if (changeAmt != 0) { String[] changeStrings = new String[]{Base58.bas58ToHexWithAddress (changeAddress), Long.toHexString(changeAmt)}; changeStr = Utils.joinString(changeStrings, QRCodeUtil.QR_CODE_SPLIT); } } String hdmIndexString = ""; if (qrCodeTransport.getHdmIndex() != QRCodeTxTransport.NO_HDM_INDEX) { hdmIndexString = Integer.toHexString(qrCodeTransport.getHdmIndex()); } String[] preSigns = new String[]{versionStr, hdmIndexString, Base58.bas58ToHexWithAddress (qrCodeTransport.getMyAddress()), changeStr, Long.toHexString(qrCodeTransport .getFee()), Base58.bas58ToHexWithAddress(qrCodeTransport.getToAddress()), Long.toHexString(qrCodeTransport.getTo())}; preSignString = Utils.joinString(preSigns, QRCodeUtil.QR_CODE_SPLIT); String[] hashStrings = new String[qrCodeTransport.getHashList().size()]; hashStrings = qrCodeTransport.getHashList().toArray(hashStrings); preSignString = preSignString + QRCodeUtil.QR_CODE_SPLIT + Utils.joinString (hashStrings, QRCodeUtil.QR_CODE_SPLIT); preSignString.toUpperCase(Locale.US); } catch (AddressFormatException e) { e.printStackTrace(); } return preSignString; }
Example 4
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); }
Example 5
Source File: QRCodeTxTransport.java From bitherj with Apache License 2.0 | 4 votes |
public static String getDeskpHDMPresignTxString(TxTransportType txTransportType, Tx tx, String changeAddress, String addressCannotParsed, List<DesktopHDMAddress> desktopHDMAddresses) { QRCodeTxTransport qrCodeTransport = fromDeskpHDMSendRequestWithUnsignedTransaction(txTransportType, tx, desktopHDMAddresses, addressCannotParsed); String preSignString = ""; try { String versionStr = ""; if (txTransportType != null) { versionStr = TX_TRANSPORT_VERSION + txTransportType.getType(); } String changeStr = ""; if (!Utils.isEmpty(changeAddress)) { long changeAmt = tx.amountSentToAddress(changeAddress); if (changeAmt != 0) { String[] changeStrings = new String[]{Base58.bas58ToHexWithAddress (changeAddress), Long.toHexString(changeAmt)}; changeStr = Utils.joinString(changeStrings, QRCodeUtil.QR_CODE_SPLIT); } } String hdmIndexString = ""; if (qrCodeTransport.getHdmIndex() != QRCodeTxTransport.NO_HDM_INDEX) { hdmIndexString = Integer.toHexString(qrCodeTransport.getHdmIndex()); } String[] preSigns = new String[]{versionStr, hdmIndexString, Base58.bas58ToHexWithAddress (qrCodeTransport.getMyAddress()), changeStr, Long.toHexString(qrCodeTransport .getFee()), Base58.bas58ToHexWithAddress(qrCodeTransport.getToAddress()), Long.toHexString(qrCodeTransport.getTo())}; preSignString = Utils.joinString(preSigns, QRCodeUtil.QR_CODE_SPLIT); String[] hashStrings = new String[qrCodeTransport.getHashList().size()]; hashStrings = qrCodeTransport.getHashList().toArray(hashStrings); preSignString = preSignString + QRCodeUtil.QR_CODE_SPLIT + Utils.joinString (hashStrings, QRCodeUtil.QR_CODE_SPLIT); preSignString.toUpperCase(Locale.US); } catch (AddressFormatException e) { e.printStackTrace(); } return preSignString; }