Java Code Examples for net.bither.bitherj.core.HDAccount#newForkTx()

The following examples show how to use net.bither.bitherj.core.HDAccount#newForkTx() . 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: BCCAssetsHDAccountMonitoredActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
private void send() {
    this.txs = null;
    HDAccount account = (HDAccount) address;
    try {
        txs = account.newForkTx(toAddress, btcAmount,outs, SplitCoin.BCC);
    } catch (Exception e) {
        e.printStackTrace();
        btcAmount = 0;
        txs = null;
        String msg = getString(R.string.send_failed);
        if (e instanceof KeyCrypterException || e instanceof MnemonicException
                .MnemonicLengthException) {
            msg = getString(R.string.password_wrong);
        } else if (e instanceof TxBuilderException) {
            msg = e.getMessage();
        }
        final String m = msg;
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (dp.isShowing()) {
                    dp.dismiss();
                }
                DropdownMessage.showDropdownMessage(BCCAssetsHDAccountMonitoredActivity.this, m);
            }
        });
    }

    if (this.txs != null) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                showConfirm();
            }
        });
    }
}
 
Example 2
Source File: SplitBCCHDAccountMonitoredSendActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
private void send() {
    this.txs = null;
    HDAccount account = (HDAccount) address;
    try {
        txs = account.newForkTx(toAddress, btcAmount, splitCoin);
    } catch (Exception e) {
        e.printStackTrace();
        btcAmount = 0;
        txs = null;
        String msg = getString(R.string.send_failed);
        if (e instanceof KeyCrypterException || e instanceof MnemonicException
                .MnemonicLengthException) {
            msg = getString(R.string.password_wrong);
        } else if (e instanceof TxBuilderException) {
            msg = e.getMessage();
        }
        final String m = msg;
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (dp.isShowing()) {
                    dp.dismiss();
                }
                DropdownMessage.showDropdownMessage(SplitBCCHDAccountMonitoredSendActivity.this, m);
            }
        });
    }

    if (this.txs != null) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                showConfirm();
            }
        });
    }
}
 
Example 3
Source File: SplitBCCHDAccountSendActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
private void send(String...blockhash) {
    txs = null;
    HDAccount account = (HDAccount) address;
    SecureCharSequence password = new SecureCharSequence(etPassword.getText());
    try {
        txs = account.newForkTx(etAddress.getText().toString().trim(), btcAmount, password, splitCoin,blockhash);
    } catch (Exception e) {
        e.printStackTrace();
        btcAmount = 0;
        txs = null;
        String msg = getString(R.string.send_failed);
        if (e instanceof KeyCrypterException || e instanceof MnemonicException
                .MnemonicLengthException) {
            msg = getString(R.string.password_wrong);
        } else if (e instanceof TxBuilderException) {
            msg = e.getMessage();
        }
        final String m = msg;
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (dp.isShowing()) {
                    dp.dismiss();
                }
                DropdownMessage.showDropdownMessage(SplitBCCHDAccountSendActivity.this, m);
            }
        });
    } finally {
        password.wipe();
    }
    if (txs != null) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                showConfirm();

            }
        });
    }
}