private void setUri(CoinURI coinUri) throws CoinURIParseException { setAddress(coinUri.getAddress(), false); if (address == null) { // TODO when going to support the payment protocol, address could be null throw new CoinURIParseException("missing address"); } sendAmountType = (CoinType) address.getParameters(); sendAmount = coinUri.getAmount(); final String label = coinUri.getLabel(); }
private void processUri(String uri) throws CoinURIParseException { CoinURI coinUri = new CoinURI(uri); CoinType scannedType = coinUri.getType(); if (!Constants.SUPPORTED_COINS.contains(scannedType)) { String error = getResources().getString(R.string.unsupported_coin, scannedType.getName()); throw new CoinURIParseException(error); } setUri(coinUri); if (pocket == null) { List<WalletAccount> allAccounts = application.getAllAccounts(); List<WalletAccount> sendFromAccounts = application.getAccounts(coinUri.getType()); if (sendFromAccounts.size() == 1) { pocket = sendFromAccounts.get(0); } else if (allAccounts.size() == 1) { pocket = allAccounts.get(0); } else { throw new CoinURIParseException("No default account found"); } } }