Ejemplo n.º 1
0
  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");
      }
    }
  }
Ejemplo n.º 2
0
 @Nullable
 private ExchangeRate getCurrentRate() {
   return localRates.get(sendAmountType.getSymbol());
 }