@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { accountId = getArguments().getString(Constants.ARG_ACCOUNT_ID); } WalletApplication walletApplication = (WalletApplication) getActivity().getApplication(); // TODO pocket = (WalletPocketHD) walletApplication.getAccount(accountId); if (pocket == null) { Toast.makeText(getActivity(), R.string.no_such_pocket_error, Toast.LENGTH_LONG).show(); return; } type = pocket.getCoinType(); }
private void createAddress(WalletPocketHD account, @Nullable String newLabel) { if (account.canCreateFreshReceiveAddress()) { try { AbstractAddress newAddress = account.getFreshReceiveAddress( app.getConfiguration().isManualAddressManagement()); if (newLabel != null && !newLabel.isEmpty()) { final Uri uri = AddressBookProvider.contentUri(getActivity().getPackageName(), account.getCoinType()) .buildUpon().appendPath(newAddress.toString()).build(); final ContentValues values = new ContentValues(); values.put(AddressBookProvider.KEY_LABEL, newLabel); if (resolver != null) resolver.insert(uri, values); } } catch (Bip44KeyLookAheadExceededException e) { // Should not happen as we already checked if we can create a new address Toast.makeText(getActivity(), R.string.too_many_unused_addresses, Toast.LENGTH_LONG).show(); } } else { Toast.makeText(getContext(), R.string.too_many_unused_addresses, Toast.LENGTH_LONG).show(); } } }
private Sha256Hash send(Value value, WalletPocketHD w1, WalletPocketHD w2) throws Exception { assertEquals(w1.getCoinType(), w2.getCoinType()); CoinType type = w1.getCoinType(); BitSendRequest req = w1.sendCoinsOffline(w2.getReceiveAddress(), value); req.feePerTxSize = type.value("0.01"); w1.completeAndSignTx(req); byte[] txBytes = req.tx.bitcoinSerialize(); w1.addNewTransactionIfNeeded(new BitTransaction(type, txBytes)); w2.addNewTransactionIfNeeded(new BitTransaction(type, txBytes)); return req.tx.getHash(); }
checkUnspentOutputs(expectedUtxoSet, newPocket); assertEquals(pocket.getCoinType(), newPocket.getCoinType()); assertEquals(pocket.getDescriptionOrCoinName(), newPocket.getDescriptionOrCoinName()); assertEquals(pocket.keys.toProtobuf().toString(), newPocket.keys.toProtobuf().toString());
public static Protos.WalletPocket toProtobuf(WalletPocketHD pocket) { walletBuilder.setNetworkIdentifier(pocket.getCoinType().getId()); if (pocket.getDescription() != null) { walletBuilder.setDescription(pocket.getDescription());