From 719d6769fca6659dbcd5b20297305026e7ae57a4 Mon Sep 17 00:00:00 2001 From: hvarona Date: Mon, 12 Nov 2018 22:40:44 -0400 Subject: [PATCH] Change bitcoin address model keys --- .../crystalwallet/manager/GeneralAccountManager.java | 6 ++++-- .../cy/agorise/crystalwallet/models/BitcoinAddress.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/manager/GeneralAccountManager.java b/app/src/main/java/cy/agorise/crystalwallet/manager/GeneralAccountManager.java index d7df4fc..08c2e90 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/manager/GeneralAccountManager.java +++ b/app/src/main/java/cy/agorise/crystalwallet/manager/GeneralAccountManager.java @@ -98,7 +98,7 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf CryptoCoinBalance balance = new CryptoCoinBalance(); balance.setBalance(0); - balance.setCryptoCurrencyId(db.cryptoCurrencyDao().getByName(cryptoCoin.name(),cryptoCoin.name()).getId()); + balance.setCryptoCurrencyId(db.cryptoCurrencyDao().getByName(cryptoCoin.getLabel(),cryptoCoin.name()).getId()); balance.setAccountId(account.getId()); db.cryptoCoinBalanceDao().insertCryptoCoinBalance(balance); @@ -495,7 +495,7 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf } private void calculateUri(CalculateBitcoinUriRequest request) { - StringBuilder uri = new StringBuilder(this.cryptoCoin.getLabel().toLowerCase()+":"); + StringBuilder uri = new StringBuilder(this.cryptoCoin.name().toLowerCase()+":"); CrystalDatabase db = CrystalDatabase.getAppDatabase(request.getContext()); long index = db.bitcoinAddressDao().getLastExternalAddress(request.getAccount().getId()); @@ -530,6 +530,8 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf uri.append(request.getAmount()); } + System.out.println("GeneralAccountMAnager uri calculated : " + uri.toString()); + request.setUri(uri.toString()); request.validate(); } diff --git a/app/src/main/java/cy/agorise/crystalwallet/models/BitcoinAddress.java b/app/src/main/java/cy/agorise/crystalwallet/models/BitcoinAddress.java index ac076f7..f8ca2bd 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/models/BitcoinAddress.java +++ b/app/src/main/java/cy/agorise/crystalwallet/models/BitcoinAddress.java @@ -12,7 +12,7 @@ import android.support.annotation.NonNull; */ @Entity( tableName="bitcoin_address", - primaryKeys = {"account_id","address_index"}, + primaryKeys = {"account_id","address_index","is_change"}, foreignKeys = { @ForeignKey( entity = CryptoNetAccount.class,