Java Code Examples for net.bither.bitherj.core.HDAccount#HDAccountAddress
The following examples show how to use
net.bither.bitherj.core.HDAccount#HDAccountAddress .
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: AbstractHDAccountAddressProvider.java From bitherj with Apache License 2.0 | 6 votes |
@Override public List<HDAccount.HDAccountAddress> belongAccount(int hdAccountId, List<String> addresses) { final List<HDAccount.HDAccountAddress> hdAccountAddressList = new ArrayList<HDAccount .HDAccountAddress>(); List<String> temp = new ArrayList<String>(); for (String str : addresses) { temp.add(Utils.format("'%s'", str)); } String sql = "select address,pub,path_type,address_index,is_issued,is_synced,hd_account_id " + " from hd_account_addresses" + " where hd_account_id=? and address in (" + Utils.joinString(temp, ",") + ")"; this.execQueryLoop(sql, new String[]{Integer.toString(hdAccountId)}, new Function<ICursor, Void>() { @Nullable @Override public Void apply(@Nullable ICursor c) { hdAccountAddressList.add(formatAddress(c)); return null; } }); return hdAccountAddressList; }
Example 2
Source File: BCCAssetsDetectListActivity.java From bither-android with Apache License 2.0 | 6 votes |
private void loadAddress() { if (!isLoading && hasMore) { isLoading = true; List<HDAccount.HDAccountAddress> address; if (isMonitored) { address = hdAccountMonitored.getHdHotAddresses(page, pathType, password); } else { address = hdAccount.getHdHotAddresses(page, pathType, password); } if (page == 1) { hdAccountAddresses.clear(); } if (address != null && address.size() > 0) { hdAccountAddresses.addAll(address); hasMore = true; } else { hasMore = false; } adapter.notifyDataSetChanged(); isLoading = false; } }
Example 3
Source File: AbstractHDAccountAddressProvider.java From bitherj with Apache License 2.0 | 6 votes |
@Override public HDAccount.HDAccountAddress addressForPath(int hdAccountId, AbstractHD.PathType type, int index) { String sql = "select address,pub,path_type,address_index,is_issued," + "is_synced,hd_account_id from hd_account_addresses" + " where path_type=? and address_index=? and hd_account_id=?"; final HDAccount.HDAccountAddress[] accountAddress = {null}; this.execQueryOneRecord(sql, new String[]{Integer.toString(type.getValue()), Integer.toString(index), Integer.toString(hdAccountId)}, new Function<ICursor, Void>() { @Nullable @Override public Void apply(@Nullable ICursor c) { accountAddress[0] = formatAddress(c); return null; } }); return accountAddress[0]; }
Example 4
Source File: AbstractHDAccountAddressProvider.java From bitherj with Apache License 2.0 | 6 votes |
public List<HDAccount.HDAccountAddress> getAllHDAddress(int hdAccountId) { final List<HDAccount.HDAccountAddress> adressPubList = new ArrayList<HDAccount .HDAccountAddress>(); String sql = "select address,pub,path_type,address_index,is_issued,is_synced,hd_account_id " + "from hd_account_addresses where hd_account_id=? "; this.execQueryLoop(sql, new String[]{Integer.toString(hdAccountId)}, new Function<ICursor, Void>() { @Nullable @Override public Void apply(@Nullable ICursor c) { HDAccount.HDAccountAddress hdAccountAddress = formatAddress(c); if (hdAccountAddress != null) { adressPubList.add(hdAccountAddress); } return null; } }); return adressPubList; }
Example 5
Source File: AbstractHDAccountAddressProvider.java From bitherj with Apache License 2.0 | 6 votes |
@Override public void addAddress(List<HDAccount.HDAccountAddress> hdAccountAddresses) { String sql = "insert into hd_account_addresses(hd_account_id,path_type,address_index,is_issued,address,pub,is_synced) values(?,?,?,?,?,?,?)"; IDb writeDb = this.getWriteDb(); writeDb.beginTransaction(); for (HDAccount.HDAccountAddress hdAccountAddress : hdAccountAddresses) { this.execUpdate(writeDb, sql, new String[] { Integer.toString(hdAccountAddress.getHdAccountId()) , Integer.toString(hdAccountAddress.getPathType().getValue()) , Integer.toString(hdAccountAddress.getIndex()) , hdAccountAddress.isIssued() ? "1" : "0" , hdAccountAddress.getAddress() , Base58.encode(hdAccountAddress.getPub()) , hdAccountAddress.isSyncedComplete() ? "1" : "0" }); } writeDb.endTransaction(); }
Example 6
Source File: OptionHotFragment.java From bither-android with Apache License 2.0 | 5 votes |
private boolean isRepeatHD(String firstAddress) { HDAccount hdAccountHot = AddressManager.getInstance().getHDAccountHot(); if (hdAccountHot == null) { return false; } HDAccount.HDAccountAddress addressHot = hdAccountHot.addressForPath(AbstractHD.PathType.EXTERNAL_ROOT_PATH, 0); if (firstAddress.equals(addressHot.getAddress())) { return true; } return false; }
Example 7
Source File: DialogAddressFullForHD.java From bither-android with Apache License 2.0 | 5 votes |
private List<String> foreignAddresses(List<String> addresses) { ArrayList<String> result = new ArrayList<String>(addresses); for (HDAccount.HDAccountAddress a : ownAddresses) { if (result.contains(a.getAddress())) { result.remove(a.getAddress()); } } return result; }
Example 8
Source File: SignHashActivity.java From bither-android with Apache License 2.0 | 5 votes |
private HDAccount.HDAccountAddress addressForIndex(int index, AbstractHD.PathType pathType) { if (isBitpieCold) { return bitpieHDAccountCold.addressForPath(pathType, index); } else if (isHot) { return hdAccount.addressForPath(pathType, index); } else { return hdAccountCold.addressForPath(pathType, index); } }
Example 9
Source File: SignMessageAddressListActivity.java From bither-android with Apache License 2.0 | 5 votes |
private void loadAddress() { if (!isLoading && hasMore) { isLoading = true; List<HDAccount.HDAccountAddress> address; if (signMessageTypeSelect.isBitpieCold()) { address = bitpieHDAccountCold.getHdColdAddresses(page, pathType, password); } else { if (isHot) { address = hdAccount.getHdHotAddresses(page, pathType, password); } else { address = hdAccountCold.getHdColdAddresses(page, pathType, password); } } if (page == 1) { hdAccountAddresses.clear(); } if (address != null && address.size() > 0) { hdAccountAddresses.addAll(address); hasMore = true; } else { hasMore = false; } adapter.notifyDataSetChanged(); isLoading = false; } }
Example 10
Source File: SignMessageAddressListActivity.java From bither-android with Apache License 2.0 | 4 votes |
public HdAddressListItemClick(HDAccount.HDAccountAddress hdAccountAddress) { this.hdAccountAddress = hdAccountAddress; }
Example 11
Source File: SignMessageAddressListActivity.java From bither-android with Apache License 2.0 | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { if (inflater == null) { inflater = LayoutInflater.from(SignMessageAddressListActivity.this); } ViewHolder h; if (convertView != null && convertView.getTag() != null && convertView.getTag() instanceof ViewHolder) { h = (ViewHolder) convertView.getTag(); } else { convertView = inflater.inflate(R.layout .list_item_dialog_sign_message_select_address, null); h = new ViewHolder(convertView); convertView.setTag(h); } switch (signMessageTypeSelect) { case Hot: Address a = (Address) getItem(position); h.tvAddress.setText(WalletUtils.formatHash(a.getAddress(), 4, 20)); h.tvIndex.setText(String.valueOf(position)); h.tvBalance.setText(UnitUtilWrapper.formatValue(a.getBalance())); if (!isShowAddress) { convertView.setOnClickListener(new ListItemClick(a)); } break; case HdReceive: case HdChange: case BitpieColdReceive: case BitpieColdChange: HDAccount.HDAccountAddress hdar = (HDAccount.HDAccountAddress) getItem(position); h.tvAddress.setText(WalletUtils.formatHash(hdar.getAddress(), 4, 20)); h.tvIndex.setText(String.valueOf(hdar.getIndex())); if (isHot) { h.tvBalance.setText(UnitUtilWrapper.formatValue(hdar.getBalance())); } else { h.llBalance.setVisibility(View.GONE); } if (!isShowAddress) { convertView.setOnClickListener(new HdAddressListItemClick(hdar)); } break; } return convertView; }
Example 12
Source File: BCCAssetsDetectListActivity.java From bither-android with Apache License 2.0 | 4 votes |
public HdAddressListItemClick(HDAccount.HDAccountAddress hdAccountAddress) { this.hdAccountAddress = hdAccountAddress; }
Example 13
Source File: BCCAssetsDetectListActivity.java From bither-android with Apache License 2.0 | 4 votes |
public void setAddress(HDAccount.HDAccountAddress address) { tvAddress.setText(WalletUtils.formatHash(address.getAddress(), 4, 20)); tvIndex.setText(String.valueOf(address.getIndex())); tvBalance.setText(UnitUtilWrapper.formatValue(address.getBalance())); setOnClickListener(new BCCAssetsDetectListActivity.HdAddressListItemClick(address)); }
Example 14
Source File: AbstractHDAccountAddressProvider.java From bitherj with Apache License 2.0 | 4 votes |
private HDAccount.HDAccountAddress formatAddress(ICursor c) { String address = null; byte[] pubs = null; AbstractHD.PathType ternalRootType = AbstractHD.PathType.EXTERNAL_ROOT_PATH; int index = 0; boolean isIssued = false; boolean isSynced = true; int hdAccountId = 0; HDAccount.HDAccountAddress hdAccountAddress = null; int idColumn = c.getColumnIndex(AbstractDb.HDAccountAddressesColumns.ADDRESS); if (idColumn != -1) { address = c.getString(idColumn); } idColumn = c.getColumnIndex(AbstractDb.HDAccountAddressesColumns.PUB); if (idColumn != -1) { try { pubs = Base58.decode(c.getString(idColumn)); } catch (AddressFormatException e) { e.printStackTrace(); } } idColumn = c.getColumnIndex(AbstractDb.HDAccountAddressesColumns.PATH_TYPE); if (idColumn != -1) { ternalRootType = AbstractHD.getTernalRootType(c.getInt(idColumn)); } idColumn = c.getColumnIndex(AbstractDb.HDAccountAddressesColumns.ADDRESS_INDEX); if (idColumn != -1) { index = c.getInt(idColumn); } idColumn = c.getColumnIndex(AbstractDb.HDAccountAddressesColumns.IS_ISSUED); if (idColumn != -1) { isIssued = c.getInt(idColumn) == 1; } idColumn = c.getColumnIndex(AbstractDb.HDAccountAddressesColumns.IS_SYNCED); if (idColumn != -1) { isSynced = c.getInt(idColumn) == 1; } idColumn = c.getColumnIndex(AbstractDb.HDAccountAddressesColumns.HD_ACCOUNT_ID); if (idColumn != -1) { hdAccountId = c.getInt(idColumn); } hdAccountAddress = new HDAccount.HDAccountAddress(address, pubs, ternalRootType, index, isIssued, isSynced, hdAccountId); return hdAccountAddress; }
Example 15
Source File: AbstractHDAccountAddressProvider.java From bitherj with Apache License 2.0 | 4 votes |
@Override public void updateSyncdComplete(int hdAccountId, HDAccount.HDAccountAddress address) { String sql = "update hd_account_addresses set is_synced=? where address=? and hd_account_id=?"; this.execUpdate(sql, new String[]{address.isSyncedComplete() ? "1" : "0", address.getAddress() , Integer.toString(hdAccountId)}); }
Example 16
Source File: IHDAccountAddressProvider.java From bitherj with Apache License 2.0 | votes |
void addAddress(List<HDAccount.HDAccountAddress> hdAccountAddresses);
Example 17
Source File: IHDAccountAddressProvider.java From bitherj with Apache License 2.0 | votes |
HDAccount.HDAccountAddress addressForPath(int hdAccountId, AbstractHD.PathType type, int index);
Example 18
Source File: IHDAccountAddressProvider.java From bitherj with Apache License 2.0 | votes |
List<HDAccount.HDAccountAddress> getSigningAddressesForInputs(int hdAccountId, List<In> inList);
Example 19
Source File: IHDAccountAddressProvider.java From bitherj with Apache License 2.0 | votes |
List<HDAccount.HDAccountAddress> belongAccount(int hdAccountId, List<String> addresses);
Example 20
Source File: IHDAccountAddressProvider.java From bitherj with Apache License 2.0 | votes |
void updateSyncdComplete(int hdAccountId, HDAccount.HDAccountAddress address);