Java Code Examples for net.bither.bitherj.core.HDMAddress

The following examples show how to use net.bither.bitherj.core.HDMAddress. These examples are extracted from open source projects. 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 Project: bither-desktop-java   Source File: AddressProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<HDMAddress> getHDMAddressInUse(HDMKeychain keychain) {
    List<HDMAddress> addresses = new ArrayList<HDMAddress>();

    try {
        ResultSet c = null;

        String sql = "select hd_seed_index,pub_key_hot,pub_key_cold,pub_key_remote,address,is_synced " +
                "from hdm_addresses " +
                "where hd_seed_id=? and address is not null order by hd_seed_index";
        PreparedStatement statement = this.mDb.getPreparedStatement(sql, new String[]{Integer.toString(keychain.getHdSeedId())});
        c = statement.executeQuery();
        while (c.next()) {
            HDMAddress hdmAddress = applyHDMAddress(c, keychain);
            if (hdmAddress != null) {
                addresses.add(hdmAddress);
            }
        }
        c.close();
        statement.close();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return addresses;
}
 
Example 2
Source Project: bither-desktop-java   Source File: AddressProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void recoverHDMAddresses(final int hdSeedId, final List<HDMAddress> addresses) {
    try {
        this.mDb.getConn().setAutoCommit(false);
        for (int i = 0; i < addresses.size(); i++) {
            HDMAddress address = addresses.get(i);
            applyHDMAddressContentValues(this.mDb.getConn(), address.getAddress(), hdSeedId,
                    address.getIndex(), address.getPubHot(), address.getPubCold(), address.getPubRemote(), false);


        }
        this.mDb.getConn().commit();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
Example 3
Source Project: bither-desktop-java   Source File: SingleWalletForm.java    License: Apache License 2.0 6 votes vote down vote up
private void setContent() {
    taAddress.setText(WalletUtils.formatHash(address.getAddress(), 4, 12));
    String iconPath;
    if (address instanceof HDAccount) {
        iconPath = "/images/address_type_hd.png";
    } else if (address instanceof HDMAddress) {
        iconPath = "/images/address_type_hdm.png";
    } else {
        if (address.hasPrivKey()) {
            iconPath = "/images/address_type_private.png";
        } else {
            iconPath = "/images/address_type_watchonly.png";
        }
    }
    ImageIcon icon = ImageLoader.createImageIcon(iconPath);
    icon.setImage(icon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH));
    lblType.setIcon(icon);
    icon = (ImageIcon) lblXRandom.getIcon();
    icon.setImage(icon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH));
    lblXRandom.setIcon(icon);
    lblXRandom.setVisible(address.isFromXRandom());

    icon = (ImageIcon) lblTx.getIcon();
    icon.setImage(icon.getImage().getScaledInstance(12, 12, Image.SCALE_SMOOTH));
    lblTx.setIcon(icon);
}
 
Example 4
public HotAddressFragmentListAdapter(FragmentActivity activity, List<Address> watchOnlys,
                                     List<Address> privates, List<HDMAddress> hdms,
                                     PinnedHeaderAddressExpandableListView listView,
                                      boolean isSplitCoinAddress, SplitCoin splitCoin, boolean isDetectBcc) {

    this.activity = activity;
    this.watchOnlys = watchOnlys;
    this.privates = privates;
    this.hdms = hdms;
    this.isDetectBcc = isDetectBcc;
    this.isSplitCoinAddress = isSplitCoinAddress;
    this.splitCoin = splitCoin;
    hdAccount = AddressManager.getInstance().getHDAccountHot();
    hdAccountMonitored = AddressManager.getInstance().getHDAccountMonitored();
    enterpriseHDMKeychain = AddressManager.getInstance().getEnterpriseHDMKeychain();
    mLayoutInflater = LayoutInflater.from(activity);
    mListView = listView;
}
 
Example 5
Source Project: bither-android   Source File: AddressDetailActivity.java    License: Apache License 2.0 6 votes vote down vote up
protected void optionClicked() {
    Dialog dialog = null;
    if (address.isHDAccount()) {
        return;
    }
    if (address.isHDM()) {
        new DialogHDMAddressOptions(AddressDetailActivity.this, (HDMAddress) address, true)
                .show();
    } else if (address.hasPrivKey()) {
        dialog = new DialogAddressWithPrivateKeyOption(AddressDetailActivity.this, address);
    } else {
        dialog = new DialogAddressWatchOnlyOption(AddressDetailActivity.this, address, new
                Runnable() {
            @Override
            public void run() {
                finish();
            }
        });
    }
    if (dialog != null) {
        dialog.show();
    }
}
 
Example 6
Source Project: bitherj   Source File: RecoveryHDMApi.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void setResult(String response) throws Exception {
    JSONObject json = new JSONObject(response);
    this.result = new ArrayList<HDMAddress.Pubs>();
    List<byte[]> pubHots = new ArrayList<byte[]>();
    List<byte[]> pubColds = new ArrayList<byte[]>();
    List<byte[]> pubService = new ArrayList<byte[]>();
    if (!json.isNull(HttpSetting.PUB_HOT)) {
        String pubHotString = json.getString(HttpSetting.PUB_HOT);
        pubHots = Utils.decodeServiceResult(pubHotString);
    }
    if (!json.isNull(HttpSetting.PUB_COLD)) {
        String pubColdString = json.getString(HttpSetting.PUB_COLD);
        pubColds = Utils.decodeServiceResult(pubColdString);
    }
    if (!json.isNull(HttpSetting.PUB_SERVER)) {
        String pubServiceString = json.getString(HttpSetting.PUB_SERVER);
        pubService = Utils.decodeServiceResult(pubServiceString);
    }

    for (int i = 0; i < pubHots.size(); i++) {
        HDMAddress.Pubs pubs = new HDMAddress.Pubs(pubHots.get(i), pubColds.get(i), pubService.get(i), i);
        this.result.add(pubs);
    }

}
 
Example 7
Source Project: bitherj   Source File: AbstractAddressProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<HDMAddress> getHDMAddressInUse(HDMKeychain keychain) {
    String sql = "select hd_seed_index,pub_key_hot,pub_key_cold,pub_key_remote,address,is_synced " +
            " from hdm_addresses " +
            " where hd_seed_id=? and address is not null order by hd_seed_index";
    final List<HDMAddress> addresses = new ArrayList<HDMAddress>();
    final HDMKeychain hdmKeychain = keychain;
    this.execQueryLoop(sql, new String[]{Integer.toString(keychain.getHdSeedId())}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            HDMAddress hdmAddress = applyHDMAddress(c, hdmKeychain);
            if (hdmAddress != null) {
                addresses.add(hdmAddress);
            }
            return null;
        }
    });
    return addresses;
}
 
Example 8
Source Project: bitherj   Source File: AbstractAddressProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<HDMAddress.Pubs> getUncompletedHDMAddressPubs(int hdSeedId, int count) {
    String sql = "select * from hdm_addresses where hd_seed_id=? and pub_key_remote is null limit ? ";
    final List<HDMAddress.Pubs> pubsList = new ArrayList<HDMAddress.Pubs>();

    this.execQueryLoop(sql, new String[]{Integer.toString(hdSeedId), Integer.toString(count)}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            HDMAddress.Pubs pubs = applyPubs(c);
            if (pubs != null) {
                pubsList.add(pubs);
            }
            return null;
        }
    });
    return pubsList;
}
 
Example 9
Source Project: bither-desktop-java   Source File: AddressProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<HDMAddress> getHDMAddressInUse(HDMKeychain keychain) {
    List<HDMAddress> addresses = new ArrayList<HDMAddress>();

    try {
        ResultSet c = null;

        String sql = "select hd_seed_index,pub_key_hot,pub_key_cold,pub_key_remote,address,is_synced " +
                "from hdm_addresses " +
                "where hd_seed_id=? and address is not null order by hd_seed_index";
        PreparedStatement statement = this.mDb.getPreparedStatement(sql, new String[]{Integer.toString(keychain.getHdSeedId())});
        c = statement.executeQuery();
        while (c.next()) {
            HDMAddress hdmAddress = applyHDMAddress(c, keychain);
            if (hdmAddress != null) {
                addresses.add(hdmAddress);
            }
        }
        c.close();
        statement.close();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return addresses;
}
 
Example 10
Source Project: bither-desktop-java   Source File: AddressProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void recoverHDMAddresses(final int hdSeedId, final List<HDMAddress> addresses) {
    try {
        this.mDb.getConn().setAutoCommit(false);
        for (int i = 0; i < addresses.size(); i++) {
            HDMAddress address = addresses.get(i);
            applyHDMAddressContentValues(this.mDb.getConn(), address.getAddress(), hdSeedId,
                    address.getIndex(), address.getPubHot(), address.getPubCold(), address.getPubRemote(), false);


        }
        this.mDb.getConn().commit();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
Example 11
Source Project: bither-desktop-java   Source File: SingleWalletForm.java    License: Apache License 2.0 6 votes vote down vote up
private void setContent() {
    taAddress.setText(WalletUtils.formatHash(address.getAddress(), 4, 12));
    String iconPath;
    if (address instanceof HDAccount) {
        iconPath = "/images/address_type_hd.png";
    } else if (address instanceof HDMAddress) {
        iconPath = "/images/address_type_hdm.png";
    } else {
        if (address.hasPrivKey()) {
            iconPath = "/images/address_type_private.png";
        } else {
            iconPath = "/images/address_type_watchonly.png";
        }
    }
    ImageIcon icon = ImageLoader.createImageIcon(iconPath);
    icon.setImage(icon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH));
    lblType.setIcon(icon);
    icon = (ImageIcon) lblXRandom.getIcon();
    icon.setImage(icon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH));
    lblXRandom.setIcon(icon);
    lblXRandom.setVisible(address.isFromXRandom());

    icon = (ImageIcon) lblTx.getIcon();
    icon.setImage(icon.getImage().getScaledInstance(12, 12, Image.SCALE_SMOOTH));
    lblTx.setIcon(icon);
}
 
Example 12
public CompleteTransactionRunnable(Address a, long amount, String toAddress,
                                   String changeAddress, SecureCharSequence password,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher1,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher2) throws Exception {
    boolean isHDM = otherSigFetcher1 != null || otherSigFetcher2 != null;
    this.amount = amount;
    this.toAddress = toAddress;
    this.password = password;
    sigFetcher1 = otherSigFetcher1;
    sigFetcher2 = otherSigFetcher2;
    if (isHDM) {
        wallet = a;
        toSign = true;
    } else if (password == null || password.length() == 0) {
        wallet = a;
        toSign = false;
    } else {
        if (a.hasPrivKey()) {
            wallet = a;
        } else {
            throw new Exception("address not with private key");
        }
        toSign = true;
    }
    if (!Utils.isEmpty(changeAddress)) {
        this.changeAddress = changeAddress;
    } else {
        this.changeAddress = wallet.getAddress();
    }
}
 
Example 13
Source Project: bither-desktop-java   Source File: HDMSingularDesktop.java    License: Apache License 2.0 5 votes vote down vote up
public void server() {
    new Thread() {
        @Override
        public void run() {
            callInServer(new HDMHotAdd.IGenerateHDMKeyChain() {
                @Override
                public void generateHDMKeyChain(HDMKeychain hdmKeychain) {
                    KeyUtil.setHDKeyChain(hdmKeychain);

                }

                @Override
                public void beginCompleteAddress() {
                    PeerUtil.stopPeer();
                }

                @Override
                public void completeAddrees(List<HDMAddress> hdmAddresses) {
                    Bither.refreshFrame();
                }


            });
        }


    }.start();
}
 
Example 14
Source Project: bither-desktop-java   Source File: WalletListPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void addHDMHotAddressList(GridBagConstraints constraints, List<HDMAddress> addresses) {
    synchronized (walletPanels) {
        for (Address loopPerWalletModelData : addresses) {
            if (loopPerWalletModelData != null) {
                JPanel outerPanel = new JPanel();
                outerPanel.setOpaque(false);
                outerPanel.setBorder(BorderFactory.createEmptyBorder(TOP_BORDER, LEFT_BORDER, 0, RIGHT_BORDER));
                outerPanel.setLayout(new GridBagLayout());

                GridBagConstraints constraints2 = new GridBagConstraints();
                constraints2.fill = GridBagConstraints.BOTH;
                constraints2.gridx = 0;
                constraints2.gridy = 0;
                constraints2.weightx = 1.0;
                constraints2.weighty = 1.0;
                constraints2.gridwidth = 1;
                constraints2.gridheight = 1;
                constraints2.anchor = GridBagConstraints.CENTER;

                SingleWalletForm singleWalletForm = new SingleWalletForm(loopPerWalletModelData, this);
                singleWalletForm.getPanel().setComponentOrientation(ComponentOrientation
                        .getOrientation(LocaliserUtils.getLocale()));


                outerPanel.add(singleWalletForm.getPanel(), constraints2);


                walletListPanel.add(outerPanel, constraints);
                walletPanels.add(singleWalletForm);
                constraints.gridy = constraints.gridy + 1;
            }
        }
    }


}
 
Example 15
Source Project: bither-android   Source File: AddAddressHotHDMFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ArrayList<String> getAddresses() {
    List<HDMAddress> as = AddressManager.getInstance().getHdmKeychain().getAddresses();
    ArrayList<String> s = new ArrayList<String>();
    for (HDMAddress a : as) {
        s.add(a.getAddress());
    }
    return s;
}
 
Example 16
Source Project: bither-android   Source File: HotAddressFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    broadcastIntentFilter.addAction(BroadcastUtil.ACTION_MARKET);
    watchOnlys = new ArrayList<Address>();
    privates = new ArrayList<Address>();
    hdms = new ArrayList<HDMAddress>();
}
 
Example 17
public CompleteTransactionRunnable(int addressPosition, long amount, String toAddress,
                                   String changeAddress, SecureCharSequence password,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher1,HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher2) throws Exception {
    this(Coin.BTC, addressPosition, amount, toAddress, changeAddress, password, otherSigFetcher1, otherSigFetcher2);
}
 
Example 18
@Override
public boolean onLongClick(View v) {
    if (address.isHDM()) {
        new DialogHDMAddressOptions(activity, (HDMAddress) address).show();
    } else if (address.hasPrivKey()) {
        new DialogAddressWithShowPrivateKey(activity, address, null).show();
    } else {
        new DialogAddressWatchOnlyLongClick(activity, address).show();
    }
    return true;
}
 
Example 19
Source Project: bither-android   Source File: HDMSingularAndroid.java    License: Apache License 2.0 5 votes vote down vote up
public void server() {
    new ThreadNeedService(null, context) {
        @Override
        public void runWithService(final BlockchainService service) {
            callInServer(new HDMHotAdd.IGenerateHDMKeyChain() {
                @Override
                public void generateHDMKeyChain(HDMKeychain hdmKeychain) {
                    KeyUtil.setHDKeyChain(hdmKeychain);

                }

                @Override
                public void beginCompleteAddress() {
                    if (service != null) {
                        service.stopAndUnregister();
                    }
                }

                @Override
                public void completeAddrees(List<HDMAddress> hdmAddresses) {
                    if (service != null) {
                        service.startAndRegister();
                    }
                }


            });
        }
    }.start();
}
 
Example 20
Source Project: bither-android   Source File: WalletUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static Address findPrivateKey(String address) {
    for (Address bitherAddressWithPrivateKey : AddressManager.getInstance().getPrivKeyAddresses()) {
        if (Utils.compareString(address, bitherAddressWithPrivateKey.getAddress())) {
            return bitherAddressWithPrivateKey;
        }
    }
    if (AddressManager.getInstance().hasHDMKeychain()) {
        for (HDMAddress a : AddressManager.getInstance().getHdmKeychain().getAddresses()) {
            if (Utils.compareString(address, a.getAddress())) {
                return a;
            }
        }
    }
    return null;
}
 
Example 21
Source Project: bitherj   Source File: AbstractAddressProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void recoverHDMAddresses(int hdSeedId, List<HDMAddress> addresses) {
    IDb writeDb = this.getWriteDb();
    writeDb.beginTransaction();
    for (int i = 0; i < addresses.size(); i++) {
        HDMAddress address = addresses.get(i);
        this.insertHDMAddressToDb(writeDb, address.getAddress(), hdSeedId, address.getIndex()
                , address.getPubHot(), address.getPubCold(), address.getPubRemote(), false);
    }
    writeDb.endTransaction();
}
 
Example 22
public CompleteTransactionRunnable(Address a, long amount, String toAddress,
                                   String changeAddress, SecureCharSequence password,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher1,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher2) throws Exception {
    boolean isHDM = otherSigFetcher1 != null || otherSigFetcher2 != null;
    this.amount = amount;
    this.toAddress = toAddress;
    this.password = password;
    sigFetcher1 = otherSigFetcher1;
    sigFetcher2 = otherSigFetcher2;
    if (isHDM) {
        wallet = a;
        toSign = true;
    } else if (password == null || password.length() == 0) {
        wallet = a;
        toSign = false;
    } else {
        if (a.hasPrivKey()) {
            wallet = a;
        } else {
            throw new Exception("address not with private key");
        }
        toSign = true;
    }
    if (!Utils.isEmpty(changeAddress)) {
        this.changeAddress = changeAddress;
    } else {
        this.changeAddress = wallet.getAddress();
    }
}
 
Example 23
Source Project: bither-desktop-java   Source File: HDMSingularDesktop.java    License: Apache License 2.0 5 votes vote down vote up
public void server() {
    new Thread() {
        @Override
        public void run() {
            callInServer(new HDMHotAdd.IGenerateHDMKeyChain() {
                @Override
                public void generateHDMKeyChain(HDMKeychain hdmKeychain) {
                    KeyUtil.setHDKeyChain(hdmKeychain);

                }

                @Override
                public void beginCompleteAddress() {
                    PeerUtil.stopPeer();
                }

                @Override
                public void completeAddrees(List<HDMAddress> hdmAddresses) {
                    Bither.refreshFrame();
                }


            });
        }


    }.start();
}
 
Example 24
Source Project: bither-desktop-java   Source File: WalletListPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void addHDMHotAddressList(GridBagConstraints constraints, List<HDMAddress> addresses) {
    synchronized (walletPanels) {
        for (Address loopPerWalletModelData : addresses) {
            if (loopPerWalletModelData != null) {
                JPanel outerPanel = new JPanel();
                outerPanel.setOpaque(false);
                outerPanel.setBorder(BorderFactory.createEmptyBorder(TOP_BORDER, LEFT_BORDER, 0, RIGHT_BORDER));
                outerPanel.setLayout(new GridBagLayout());

                GridBagConstraints constraints2 = new GridBagConstraints();
                constraints2.fill = GridBagConstraints.BOTH;
                constraints2.gridx = 0;
                constraints2.gridy = 0;
                constraints2.weightx = 1.0;
                constraints2.weighty = 1.0;
                constraints2.gridwidth = 1;
                constraints2.gridheight = 1;
                constraints2.anchor = GridBagConstraints.CENTER;

                SingleWalletForm singleWalletForm = new SingleWalletForm(loopPerWalletModelData, this);
                singleWalletForm.getPanel().setComponentOrientation(ComponentOrientation
                        .getOrientation(LocaliserUtils.getLocale()));


                outerPanel.add(singleWalletForm.getPanel(), constraints2);


                walletListPanel.add(outerPanel, constraints);
                walletPanels.add(singleWalletForm);
                constraints.gridy = constraints.gridy + 1;
            }
        }
    }


}
 
Example 25
public CompleteTransactionRunnable(Address a, long amount, String toAddress,
                                   String changeAddress, SecureCharSequence password,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher1) throws Exception {
    this(a, amount, toAddress, changeAddress, password, otherSigFetcher1, null);
}
 
Example 26
@Override
public void run() {
    prepare();

    try {
        Tx tx = wallet.buildTx(amount, toAddress, changeAddress);
        if (tx == null) {
            error(0, LocaliserUtils.getString("send_failed"));

            return;
        }
        if (toSign) {
            if (wallet.isHDM()) {
                if (sigFetcher1 != null && sigFetcher2 != null) {
                    ((HDMAddress) wallet).signTx(tx, password, sigFetcher1, sigFetcher2);
                } else if (sigFetcher1 != null || sigFetcher2 != null) {
                    ((HDMAddress) wallet).signTx(tx, password,
                            sigFetcher1 != null ? sigFetcher1 : sigFetcher2);
                } else {
                    throw new RuntimeException("need sig fetcher to sign hdm tx");
                }
            } else {
                wallet.signTx(tx, password);
            }
            if (password != null) {
                password.wipe();
            }
            if (!tx.verifySignatures()) {
                error(0, getMessageFromException(null));

                return;
            }

        }
        success(tx);

    } catch (Exception e) {
        if (password != null) {
            password.wipe();
        }
        if (e instanceof HDMSignUserCancelExcetion) {
            error(0, null);
            return;
        }
        e.printStackTrace();
        String msg = getMessageFromException(e);
        error(0, msg);
    }

}
 
Example 27
Source Project: bither-android   Source File: HotAddressFragment.java    License: Apache License 2.0 4 votes vote down vote up
public void refresh() {
    if (AbstractApp.addressIsReady) {
        List<Address> ps = AddressManager.getInstance().getPrivKeyAddresses();
        List<Address> ws = AddressManager.getInstance().getWatchOnlyAddresses();
        List<HDMAddress> hs = AddressManager.getInstance().hasHDMKeychain() ? AddressManager
                .getInstance().getHdmKeychain().getAddresses() : null;
        watchOnlys.clear();
        privates.clear();
        hdms.clear();
        if (ws != null) {
            watchOnlys.addAll(ws);
        }
        if (ps != null) {
            privates.addAll(ps);
        }
        if (hs != null) {
            hdms.addAll(hs);
        }
        mAdapter.notifyDataSetChanged();
        if (watchOnlys.size() + privates.size() + hdms.size() + (AddressManager.getInstance()
                .hasHDAccountHot() ? 1 : 0) + (AddressManager.getInstance()
                .hasHDAccountMonitored() ? 1 : 0) +
                (AddressManager.getInstance().hasEnterpriseHDMKeychain() ? 1 : 0) == 0) {
            ivNoAddress.setVisibility(View.VISIBLE);
            lv.setVisibility(View.GONE);
        } else {
            ivNoAddress.setVisibility(View.GONE);
            lv.setVisibility(View.VISIBLE);
        }
        for (int i = 0;
             i < mAdapter.getGroupCount();
             i++) {
            lv.expandGroup(i);
        }
        if (notifyAddress != null) {
            scrollToAddress(notifyAddress);
        }
        lv.removeCallbacks(showAddressesAddedRunnable);
        if (addressesToShowAdded != null) {
            lv.postDelayed(showAddressesAddedRunnable, 600);
        }
    }
}
 
Example 28
public CompleteTransactionRunnable(int addressPosition, long amount, String toAddress,
                                   String changeAddress, SecureCharSequence password,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher1) throws Exception {
    this(Coin.BTC, addressPosition, amount, toAddress, changeAddress, password, otherSigFetcher1, null);
}
 
Example 29
public CompleteTransactionRunnable(Coin coin, int addressPosition, long amount, String toAddress,
                                   String changeAddress, SecureCharSequence password,
                                   HDMAddress.HDMFetchOtherSignatureDelegate
                                           otherSigFetcher1) throws Exception {
    this(coin, addressPosition, amount, toAddress, changeAddress, password, otherSigFetcher1, null);
}
 
Example 30
private void signTx() {
    try {
        Tx tx = wallet.buildTx(amount, toAddress, changeAddress, coin);
        if (tx == null) {
            obtainMessage(HandlerMessage.MSG_FAILURE, BitherApplication.mContext.getString(R
                    .string.send_failed));
            return;
        }
        if (toSign) {
            if (wallet.isHDM()) {
                if (sigFetcher1 != null && sigFetcher2 != null) {
                    ((HDMAddress) wallet).signTx(tx, password, sigFetcher1, sigFetcher2);
                } else if (sigFetcher1 != null || sigFetcher2 != null) {
                    ((HDMAddress) wallet).signTx(tx, password,
                            sigFetcher1 != null ? sigFetcher1 : sigFetcher2);
                } else {
                    throw new RuntimeException("need sig fetcher to sign hdm tx");
                }
            } else {
                wallet.signTx(tx, password, coin);
            }
            if (password != null) {
                password.wipe();
            }
            if (!tx.verifySignatures()) {
                obtainMessage(HandlerMessage.MSG_FAILURE, getMessageFromException(null));
                return;
            }
        }
        obtainMessage(HandlerMessage.MSG_SUCCESS, tx);
    } catch (Exception e) {
        if (password != null) {
            password.wipe();
        }
        if (e instanceof HDMSignUserCancelExcetion) {
            obtainMessage(HandlerMessage.MSG_FAILURE);
            return;
        }
        e.printStackTrace();
        String msg = getMessageFromException(e);
        obtainMessage(HandlerMessage.MSG_FAILURE, msg);
    }
}