diff --git a/app/src/main/java/com/tangem/data/network/Cryptonit_OtherAPI.java b/app/src/main/java/com/tangem/data/network/CryptonitOtherApi.java
similarity index 98%
rename from app/src/main/java/com/tangem/data/network/Cryptonit_OtherAPI.java
rename to app/src/main/java/com/tangem/data/network/CryptonitOtherApi.java
index 0124f4d431..772da733a8 100644
--- a/app/src/main/java/com/tangem/data/network/Cryptonit_OtherAPI.java
+++ b/app/src/main/java/com/tangem/data/network/CryptonitOtherApi.java
@@ -37,9 +37,9 @@ import retrofit2.http.Path;
/**
* HTTP
- * Used in Cryptonit_OtherAPI service
+ * Used in CryptonitOtherApi service
*/
-public class Cryptonit_OtherAPI {
+public class CryptonitOtherApi {
private static final String SERVER_URL = "https://api.cryptonit.net/api/";
private static class Method {
@@ -115,7 +115,7 @@ public class Cryptonit_OtherAPI {
private ErrorListener errorListener;
private Context context;
- public Cryptonit_OtherAPI(Context context) {
+ public CryptonitOtherApi(Context context) {
this.context = context;
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
key = sp.getString(context.getResources().getString(R.string.key_cryptonit_key), "");
diff --git a/app/src/main/java/com/tangem/data/network/ServerApiHelper.java b/app/src/main/java/com/tangem/data/network/ServerApiCommon.java
similarity index 73%
rename from app/src/main/java/com/tangem/data/network/ServerApiHelper.java
rename to app/src/main/java/com/tangem/data/network/ServerApiCommon.java
index 02eaf41fa6..50b790ad84 100644
--- a/app/src/main/java/com/tangem/data/network/ServerApiHelper.java
+++ b/app/src/main/java/com/tangem/data/network/ServerApiCommon.java
@@ -6,8 +6,6 @@ import android.util.Log;
import com.tangem.App;
import com.tangem.data.network.model.CardVerifyAndGetInfo;
-import com.tangem.data.network.model.InfuraBody;
-import com.tangem.data.network.model.InfuraResponse;
import com.tangem.data.network.model.RateInfoResponse;
import com.tangem.domain.wallet.TangemCard;
import com.tangem.util.Util;
@@ -24,8 +22,8 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
-public class ServerApiHelper {
- private static String TAG = ServerApiHelper.class.getSimpleName();
+public class ServerApiCommon {
+ private static String TAG = ServerApiCommon.class.getSimpleName();
/**
* HTTP
@@ -85,84 +83,6 @@ public class ServerApiHelper {
});
}
- /**
- * HTTP
- * Infura
- *
- * eth_getBalance
- * eth_getTransactionCount
- * eth_call
- * eth_sendRawTransaction
- * eth_gasPrice
- */
- public static final String INFURA_ETH_GET_BALANCE = "eth_getBalance";
- public static final String INFURA_ETH_GET_TRANSACTION_COUNT = "eth_getTransactionCount";
- public static final String INFURA_ETH_GET_PENDING_COUNT = "eth_getPendingCount";
- public static final String INFURA_ETH_CALL = "eth_call";
- public static final String INFURA_ETH_SEND_RAW_TRANSACTION = "eth_sendRawTransaction";
- public static final String INFURA_ETH_GAS_PRICE = "eth_gasPrice";
-
- private InfuraBodyListener infuraBodyListener;
-
- public interface InfuraBodyListener {
- void onSuccess(String method, InfuraResponse infuraResponse);
- void onFail(String method, String message);
- }
-
- public void setInfuraResponse(InfuraBodyListener listener) {
- infuraBodyListener = listener;
- }
-
- public void infura(String method, int id, String wallet, String contract, String tx) {
- InfuraApi infuraApi = App.getNetworkComponent().getRetrofitInfura().create(InfuraApi.class);
-
- InfuraBody infuraBody;
- switch (method) {
- case INFURA_ETH_GET_BALANCE:
- case INFURA_ETH_GET_TRANSACTION_COUNT:
- infuraBody = new InfuraBody(method, new String[]{wallet, "latest"}, id);
- break;
- case INFURA_ETH_GET_PENDING_COUNT:
- infuraBody = new InfuraBody(INFURA_ETH_GET_TRANSACTION_COUNT, new String[]{wallet, "pending"}, id);
- break;
- case INFURA_ETH_CALL:
- String address = wallet.substring(2);
- infuraBody = new InfuraBody(method, new Object[]{new InfuraBody.EthCallParams("0x70a08231000000000000000000000000" + address, contract), "latest"}, id);
- break;
-
- case INFURA_ETH_SEND_RAW_TRANSACTION:
- infuraBody = new InfuraBody(method, new String[]{tx}, id);
- break;
-
- case INFURA_ETH_GAS_PRICE:
- infuraBody = new InfuraBody(method, id);
- break;
-
- default:
- infuraBody = new InfuraBody();
- }
-
- Call call = infuraApi.infura(infuraBody);
- call.enqueue(new Callback() {
- @Override
- public void onResponse(@NonNull Call call, @NonNull Response response) {
- if (response.code() == 200) {
- infuraBodyListener.onSuccess(method, response.body());
- Log.i(TAG, "infura " + method + " onResponse " + response.code());
- } else {
- infuraBodyListener.onFail(method, String.valueOf(response.code()));
- Log.e(TAG, "infura " + method + " onResponse " + response.code());
- }
- }
-
- @Override
- public void onFailure(@NonNull Call call, @NonNull Throwable t) {
- infuraBodyListener.onFail(method, String.valueOf(t.getMessage()));
- Log.e(TAG, "infura " + method + " onFailure " + t.getMessage());
- }
- });
- }
-
/**
* HTTP
* Card verify
diff --git a/app/src/main/java/com/tangem/data/network/ServerApiHelperElectrum.java b/app/src/main/java/com/tangem/data/network/ServerApiElectrum.java
similarity index 97%
rename from app/src/main/java/com/tangem/data/network/ServerApiHelperElectrum.java
rename to app/src/main/java/com/tangem/data/network/ServerApiElectrum.java
index 8c9b69e298..1dab3d8d83 100644
--- a/app/src/main/java/com/tangem/data/network/ServerApiHelperElectrum.java
+++ b/app/src/main/java/com/tangem/data/network/ServerApiElectrum.java
@@ -35,9 +35,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.observers.DefaultObserver;
import io.reactivex.schedulers.Schedulers;
-public class ServerApiHelperElectrum {
- // private static String TAG = ServerApiHelper.class.getSimpleName();
- private static String TAG = ServerApiHelperElectrum.class.getSimpleName();
+public class ServerApiElectrum {
+ private static String TAG = ServerApiElectrum.class.getSimpleName();
/**
* TCP
diff --git a/app/src/main/java/com/tangem/data/network/ServerApiInfura.java b/app/src/main/java/com/tangem/data/network/ServerApiInfura.java
new file mode 100644
index 0000000000..fb8e407099
--- /dev/null
+++ b/app/src/main/java/com/tangem/data/network/ServerApiInfura.java
@@ -0,0 +1,96 @@
+package com.tangem.data.network;
+
+import android.support.annotation.NonNull;
+import android.util.Log;
+
+import com.tangem.App;
+import com.tangem.data.network.model.InfuraBody;
+import com.tangem.data.network.model.InfuraResponse;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class ServerApiInfura {
+ private static String TAG = ServerApiInfura.class.getSimpleName();
+
+ /**
+ * HTTP
+ * Infura
+ *
+ * eth_getBalance
+ * eth_getTransactionCount
+ * eth_call
+ * eth_sendRawTransaction
+ * eth_gasPrice
+ */
+ public static final String INFURA_ETH_GET_BALANCE = "eth_getBalance";
+ public static final String INFURA_ETH_GET_TRANSACTION_COUNT = "eth_getTransactionCount";
+ public static final String INFURA_ETH_GET_PENDING_COUNT = "eth_getPendingCount";
+ public static final String INFURA_ETH_CALL = "eth_call";
+ public static final String INFURA_ETH_SEND_RAW_TRANSACTION = "eth_sendRawTransaction";
+ public static final String INFURA_ETH_GAS_PRICE = "eth_gasPrice";
+
+ private InfuraBodyListener infuraBodyListener;
+
+ public interface InfuraBodyListener {
+ void onSuccess(String method, InfuraResponse infuraResponse);
+
+ void onFail(String method, String message);
+ }
+
+ public void setInfuraResponse(InfuraBodyListener listener) {
+ infuraBodyListener = listener;
+ }
+
+ public void infura(String method, int id, String wallet, String contract, String tx) {
+ InfuraApi infuraApi = App.getNetworkComponent().getRetrofitInfura().create(InfuraApi.class);
+
+ InfuraBody infuraBody;
+ switch (method) {
+ case INFURA_ETH_GET_BALANCE:
+ case INFURA_ETH_GET_TRANSACTION_COUNT:
+ infuraBody = new InfuraBody(method, new String[]{wallet, "latest"}, id);
+ break;
+ case INFURA_ETH_GET_PENDING_COUNT:
+ infuraBody = new InfuraBody(INFURA_ETH_GET_TRANSACTION_COUNT, new String[]{wallet, "pending"}, id);
+ break;
+ case INFURA_ETH_CALL:
+ String address = wallet.substring(2);
+ infuraBody = new InfuraBody(method, new Object[]{new InfuraBody.EthCallParams("0x70a08231000000000000000000000000" + address, contract), "latest"}, id);
+ break;
+
+ case INFURA_ETH_SEND_RAW_TRANSACTION:
+ infuraBody = new InfuraBody(method, new String[]{tx}, id);
+ break;
+
+ case INFURA_ETH_GAS_PRICE:
+ infuraBody = new InfuraBody(method, id);
+ break;
+
+ default:
+ infuraBody = new InfuraBody();
+ }
+
+ Call call = infuraApi.infura(infuraBody);
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) {
+ if (response.code() == 200) {
+ infuraBodyListener.onSuccess(method, response.body());
+ Log.i(TAG, "infura " + method + " onResponse " + response.code());
+ } else {
+ infuraBodyListener.onFail(method, String.valueOf(response.code()));
+ Log.e(TAG, "infura " + method + " onResponse " + response.code());
+ }
+ }
+
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull Throwable t) {
+ infuraBodyListener.onFail(method, String.valueOf(t.getMessage()));
+ Log.e(TAG, "infura " + method + " onFailure " + t.getMessage());
+ }
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/domain/wallet/CoinEngineFactory.kt b/app/src/main/java/com/tangem/domain/wallet/CoinEngineFactory.kt
index dc5c01486a..1386aa4930 100644
--- a/app/src/main/java/com/tangem/domain/wallet/CoinEngineFactory.kt
+++ b/app/src/main/java/com/tangem/domain/wallet/CoinEngineFactory.kt
@@ -8,7 +8,7 @@ import com.tangem.domain.wallet.eth.EthEngine
import com.tangem.domain.wallet.token.TokenEngine
/**
- * Factory for create specific engine.
+ * Factory for create specific engine
*
* @param Blockchain
* @param TangemContext
diff --git a/app/src/main/java/com/tangem/domain/wallet/btc/BitcoinNodeSsl.kt b/app/src/main/java/com/tangem/domain/wallet/btc/BitcoinNodeSsl.kt
new file mode 100644
index 0000000000..ce7656323f
--- /dev/null
+++ b/app/src/main/java/com/tangem/domain/wallet/btc/BitcoinNodeSsl.kt
@@ -0,0 +1,7 @@
+package com.tangem.domain.wallet.btc
+
+enum class BitcoinNodeSsl(val host: String, val port: Int) {
+ n1("electrum.anduck.net", 50012),
+ n2("electrum.eff.ro", 50002),
+ n3("vps.hsmiths.com", 50002)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/domain/wallet/btc/BtcEngine.java b/app/src/main/java/com/tangem/domain/wallet/btc/BtcEngine.java
index 529e709deb..6175b0e9a7 100644
--- a/app/src/main/java/com/tangem/domain/wallet/btc/BtcEngine.java
+++ b/app/src/main/java/com/tangem/domain/wallet/btc/BtcEngine.java
@@ -62,17 +62,17 @@ public class BtcEngine extends CoinEngine {
}
@Override
- public boolean awaitingConfirmation(){
- if( coinData ==null ) return false;
+ public boolean awaitingConfirmation() {
+ if (coinData == null) return false;
return coinData.getBalanceUnconfirmed() != 0;
}
@Override
public String getBalanceHTML() {
- Amount balance=getBalance();
- if( balance!=null ) {
+ Amount balance = getBalance();
+ if (balance != null) {
return balance.toDescriptionString(getDecimals());
- }else{
+ } else {
return "";
}
}
@@ -84,21 +84,21 @@ public class BtcEngine extends CoinEngine {
@Override
public String getOfflineBalanceHTML() {
- InternalAmount offlineInternalAmount = convertToInternalAmount(ctx.getCard().getOfflineBalance());
- Amount offlineAmount = convertToAmount(offlineInternalAmount);
- return offlineAmount.toDescriptionString(getDecimals());
+ InternalAmount offlineInternalAmount = convertToInternalAmount(ctx.getCard().getOfflineBalance());
+ Amount offlineAmount = convertToAmount(offlineInternalAmount);
+ return offlineAmount.toDescriptionString(getDecimals());
}
@Override
public boolean isBalanceNotZero() {
- if( coinData ==null ) return false;
+ if (coinData == null) return false;
if (coinData.getBalanceInInternalUnits() == null) return false;
return coinData.getBalanceInInternalUnits().notZero();
}
@Override
- public boolean hasBalanceInfo(){
- if( coinData ==null ) return false;
+ public boolean hasBalanceInfo() {
+ if (coinData == null) return false;
return coinData.hasBalanceInfo();
}
@@ -193,12 +193,12 @@ public class BtcEngine extends CoinEngine {
@Override
public InputFilter[] getAmountInputFilters() {
- return new InputFilter[] { new DecimalDigitsInputFilter(getDecimals()) };
+ return new InputFilter[]{new DecimalDigitsInputFilter(getDecimals())};
}
@Override
- public boolean checkNewTransactionAmount(Amount amount){
- if( coinData ==null ) return false;
+ public boolean checkNewTransactionAmount(Amount amount) {
+ if (coinData == null) return false;
if (amount.compareTo(convertToAmount(coinData.getBalanceInInternalUnits())) > 0) {
return false;
}
@@ -225,10 +225,10 @@ public class BtcEngine extends CoinEngine {
if (fee.isZero() || amount.isZero())
return false;
- if (isIncludeFee && (amount.compareTo(coinData.getBalanceInInternalUnits())>0 || amount.compareTo(fee)<0))
+ if (isIncludeFee && (amount.compareTo(coinData.getBalanceInInternalUnits()) > 0 || amount.compareTo(fee) < 0))
return false;
- if (!isIncludeFee && amount.add(fee).compareTo(coinData.getBalanceInInternalUnits())>0)
+ if (!isIncludeFee && amount.add(fee).compareTo(coinData.getBalanceInInternalUnits()) > 0)
return false;
return true;
@@ -277,7 +277,7 @@ public class BtcEngine extends CoinEngine {
// return;
// }
- if ((ctx.getCard().getOfflineBalance() != null) && !coinData.isBalanceReceived() && (ctx.getCard().getRemainingSignatures() == ctx.getCard().getMaxSignatures()) && coinData.getBalanceInInternalUnits().notZero() ) {
+ if ((ctx.getCard().getOfflineBalance() != null) && !coinData.isBalanceReceived() && (ctx.getCard().getRemainingSignatures() == ctx.getCard().getMaxSignatures()) && coinData.getBalanceInInternalUnits().notZero()) {
balanceValidator.setScore(80);
balanceValidator.setFirstLine("Verified offline balance");
balanceValidator.setSecondLine("Can't obtain balance from blockchain. Restore internet connection to be more confident. ");
@@ -303,28 +303,26 @@ public class BtcEngine extends CoinEngine {
@Override
public Amount getBalance() {
- if( !hasBalanceInfo() ) return null;
+ if (!hasBalanceInfo()) return null;
return convertToAmount(coinData.getBalanceInInternalUnits());
}
@Override
public String evaluateFeeEquivalent(String fee) {
- if( !coinData.getAmountEquivalentDescriptionAvailable() ) return "";
+ if (!coinData.getAmountEquivalentDescriptionAvailable()) return "";
try {
Amount feeAmount = new Amount(fee, getFeeCurrency());
return feeAmount.toEquivalentString(coinData.getRate());
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
return "";
}
}
@Override
public String getBalanceEquivalent() {
- if( coinData ==null || !coinData.getAmountEquivalentDescriptionAvailable() ) return "";
- Amount balance=getBalance();
- if( balance==null ) return "";
+ if (coinData == null || !coinData.getAmountEquivalentDescriptionAvailable()) return "";
+ Amount balance = getBalance();
+ if (balance == null) return "";
return balance.toEquivalentString(coinData.getRate());
}
@@ -364,7 +362,7 @@ public class BtcEngine extends CoinEngine {
@Override
public Amount convertToAmount(InternalAmount internalAmount) {
- BigDecimal d=internalAmount.divide(new BigDecimal("100000000"));
+ BigDecimal d = internalAmount.divide(new BigDecimal("100000000"));
return new Amount(d, getBalanceCurrency());
}
@@ -375,7 +373,7 @@ public class BtcEngine extends CoinEngine {
@Override
public InternalAmount convertToInternalAmount(Amount amount) throws Exception {
- BigDecimal d=amount.multiply(new BigDecimal("100000000"));
+ BigDecimal d = amount.multiply(new BigDecimal("100000000"));
return new InternalAmount(d, "Satoshi");
}
@@ -384,7 +382,7 @@ public class BtcEngine extends CoinEngine {
if (bytes == null) return null;
byte[] reversed = new byte[bytes.length];
for (int i = 0; i < bytes.length; i++) reversed[i] = bytes[bytes.length - i - 1];
- return new InternalAmount(Util.byteArrayToLong(reversed),"Satoshi");
+ return new InternalAmount(Util.byteArrayToLong(reversed), "Satoshi");
}
@Override
diff --git a/app/src/main/java/com/tangem/presentation/activity/ConfirmPaymentActivity.kt b/app/src/main/java/com/tangem/presentation/activity/ConfirmPaymentActivity.kt
index 373c43a6c9..c6c9d981a5 100644
--- a/app/src/main/java/com/tangem/presentation/activity/ConfirmPaymentActivity.kt
+++ b/app/src/main/java/com/tangem/presentation/activity/ConfirmPaymentActivity.kt
@@ -14,8 +14,9 @@ import android.view.KeyEvent
import android.view.View
import android.widget.Toast
import com.tangem.data.network.ElectrumRequest
-import com.tangem.data.network.ServerApiHelper
-import com.tangem.data.network.ServerApiHelperElectrum
+import com.tangem.data.network.ServerApiCommon
+import com.tangem.data.network.ServerApiElectrum
+import com.tangem.data.network.ServerApiInfura
import com.tangem.data.network.model.InfuraResponse
import com.tangem.domain.cardReader.NfcManager
import com.tangem.domain.wallet.*
@@ -38,8 +39,9 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
private var nfcManager: NfcManager? = null
- private var serverApiHelper: ServerApiHelper = ServerApiHelper()
- private var serverApiHelperElectrum: ServerApiHelperElectrum = ServerApiHelperElectrum()
+ private var serverApiCommon: ServerApiCommon = ServerApiCommon()
+ private var serverApiInfura: ServerApiInfura = ServerApiInfura()
+ private var serverApiElectrum: ServerApiElectrum = ServerApiElectrum()
private lateinit var ctx: TangemContext
private lateinit var amount: CoinEngine.Amount
@@ -98,7 +100,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
if (ctx.blockchain == Blockchain.Ethereum || ctx.blockchain == Blockchain.EthereumTestNet || ctx.blockchain == Blockchain.Token) {
rgFee.isEnabled = false
- requestInfura(ServerApiHelper.INFURA_ETH_GAS_PRICE)
+ requestInfura(ServerApiInfura.INFURA_ETH_GAS_PRICE)
} else {
rgFee.isEnabled = true
@@ -195,7 +197,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
// request electrum listener
- val electrumBodyListener: ServerApiHelperElectrum.ElectrumRequestDataListener = object : ServerApiHelperElectrum.ElectrumRequestDataListener {
+ val electrumBodyListener: ServerApiElectrum.ElectrumRequestDataListener = object : ServerApiElectrum.ElectrumRequestDataListener {
override fun onSuccess(electrumRequest: ElectrumRequest?) {
if (electrumRequest!!.isMethod(ElectrumRequest.METHOD_GetBalance)) {
try {
@@ -226,13 +228,13 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
}
- serverApiHelperElectrum.setElectrumRequestData(electrumBodyListener)
+ serverApiElectrum.setElectrumRequestData(electrumBodyListener)
// request infura eth gasPrice listener
- val infuraBodyListener: ServerApiHelper.InfuraBodyListener = object : ServerApiHelper.InfuraBodyListener {
+ val infuraBodyListener: ServerApiInfura.InfuraBodyListener = object : ServerApiInfura.InfuraBodyListener {
override fun onSuccess(method: String, infuraResponse: InfuraResponse) {
when (method) {
- ServerApiHelper.INFURA_ETH_GAS_PRICE -> {
+ ServerApiInfura.INFURA_ETH_GAS_PRICE -> {
var gasPrice = infuraResponse.result
gasPrice = gasPrice.substring(2)
//TODO - remove Gwei
@@ -261,16 +263,16 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
override fun onFail(method: String, message: String) {
when (method) {
- ServerApiHelper.INFURA_ETH_GAS_PRICE -> {
+ ServerApiInfura.INFURA_ETH_GAS_PRICE -> {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
}
}
}
}
- serverApiHelper.setInfuraResponse(infuraBodyListener)
+ serverApiInfura.setInfuraResponse(infuraBodyListener)
// request estimate fee listener
- val estimateFeeListener: ServerApiHelper.EstimateFeeListener = object : ServerApiHelper.EstimateFeeListener {
+ val estimateFeeListener: ServerApiCommon.EstimateFeeListener = object : ServerApiCommon.EstimateFeeListener {
override fun onSuccess(blockCount: Int, estimateFeeResponse: String?) {
var fee: BigDecimal?
fee = BigDecimal(estimateFeeResponse) // BTC per 1 kb
@@ -291,17 +293,17 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
fee = fee!!.setScale(8, RoundingMode.DOWN)
when (blockCount) {
- ServerApiHelper.ESTIMATE_FEE_MINIMAL -> {
+ ServerApiCommon.ESTIMATE_FEE_MINIMAL -> {
minFee = CoinEngine.Amount(fee, engine.feeCurrency)
if (rgFee.checkedRadioButtonId == R.id.rbMinimalFee) doSetFee(rgFee.checkedRadioButtonId)
}
- ServerApiHelper.ESTIMATE_FEE_NORMAL -> {
+ ServerApiCommon.ESTIMATE_FEE_NORMAL -> {
normalFee = CoinEngine.Amount(fee, engine.feeCurrency)
if (rgFee.checkedRadioButtonId == R.id.rbNormalFee) doSetFee(rgFee.checkedRadioButtonId)
}
- ServerApiHelper.ESTIMATE_FEE_PRIORITY -> {
+ ServerApiCommon.ESTIMATE_FEE_PRIORITY -> {
maxFee = CoinEngine.Amount(fee, engine.feeCurrency)
if (rgFee.checkedRadioButtonId == R.id.rbMaximumFee) doSetFee(rgFee.checkedRadioButtonId)
}
@@ -318,7 +320,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_calculate_fee_wrong_data_received_from_node))
}
}
- serverApiHelper.setEstimateFee(estimateFeeListener)
+ serverApiCommon.setEstimateFee(estimateFeeListener)
}
public override fun onResume() {
@@ -460,22 +462,22 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
private fun requestElectrum(card: TangemCard, electrumRequest: ElectrumRequest) {
if (UtilHelper.isOnline(this)) {
- serverApiHelperElectrum.electrumRequestData(card, electrumRequest)
+ serverApiElectrum.electrumRequestData(card, electrumRequest)
} else
finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
}
private fun requestInfura(method: String) {
if (UtilHelper.isOnline(this)) {
- serverApiHelper.infura(method, 67, ctx.card!!.wallet, "", "")
+ serverApiInfura.infura(method, 67, ctx.card!!.wallet, "", "")
} else
finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
}
private fun requestEstimateFee() {
- serverApiHelper.estimateFee(ServerApiHelper.ESTIMATE_FEE_PRIORITY)
- serverApiHelper.estimateFee(ServerApiHelper.ESTIMATE_FEE_NORMAL)
- serverApiHelper.estimateFee(ServerApiHelper.ESTIMATE_FEE_MINIMAL)
+ serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_PRIORITY)
+ serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_NORMAL)
+ serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_MINIMAL)
}
private fun doSetFee(checkedRadioButtonId: Int) {
diff --git a/app/src/main/java/com/tangem/presentation/activity/LogoActivity.kt b/app/src/main/java/com/tangem/presentation/activity/LogoActivity.kt
index 87ddd9de47..0f814afbf5 100644
--- a/app/src/main/java/com/tangem/presentation/activity/LogoActivity.kt
+++ b/app/src/main/java/com/tangem/presentation/activity/LogoActivity.kt
@@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
-import com.tangem.data.network.ServerApiHelperElectrum
+import com.tangem.data.network.ServerApiElectrum
import com.tangem.wallet.BuildConfig
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_logo.*
@@ -18,7 +18,7 @@ class LogoActivity : AppCompatActivity() {
const val MILLIS_AUTO_HIDE = 1000
}
- private var serverApiHelperElectrum: ServerApiHelperElectrum = ServerApiHelperElectrum()
+ private var serverApiElectrum: ServerApiElectrum = ServerApiElectrum()
private val hideRunnable = Runnable { this.hide() }
diff --git a/app/src/main/java/com/tangem/presentation/activity/MainActivity.kt b/app/src/main/java/com/tangem/presentation/activity/MainActivity.kt
index 4870d00836..db08ff96a1 100644
--- a/app/src/main/java/com/tangem/presentation/activity/MainActivity.kt
+++ b/app/src/main/java/com/tangem/presentation/activity/MainActivity.kt
@@ -26,7 +26,7 @@ import android.widget.Toast
import com.scottyab.rootbeer.RootBeer
import com.tangem.data.Logger
import com.tangem.data.db.PINStorage
-import com.tangem.data.network.ServerApiHelper
+import com.tangem.data.network.ServerApiCommon
import com.tangem.data.nfc.DeviceNFCAntennaLocation
import com.tangem.data.nfc.ReadCardInfoTask
import com.tangem.domain.cardReader.CardProtocol
@@ -153,7 +153,7 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
fab.setOnClickListener { showMenu(it) }
- val apiHelper = ServerApiHelper()
+ val apiHelper = ServerApiCommon()
apiHelper.setLastVersionListener { response ->
try {
if (response.isNullOrEmpty()) return@setLastVersionListener
diff --git a/app/src/main/java/com/tangem/presentation/activity/PrepareCryptonitOtherAPIWithdrawalActivity.kt b/app/src/main/java/com/tangem/presentation/activity/PrepareCryptonitOtherAPIWithdrawalActivity.kt
index 9527f8744f..773d775d61 100644
--- a/app/src/main/java/com/tangem/presentation/activity/PrepareCryptonitOtherAPIWithdrawalActivity.kt
+++ b/app/src/main/java/com/tangem/presentation/activity/PrepareCryptonitOtherAPIWithdrawalActivity.kt
@@ -9,7 +9,7 @@ import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
-import com.tangem.data.network.Cryptonit_OtherAPI
+import com.tangem.data.network.CryptonitOtherApi
import com.tangem.domain.cardReader.NfcManager
import com.tangem.domain.wallet.Blockchain
import com.tangem.domain.wallet.CoinEngineFactory
@@ -30,7 +30,7 @@ class PrepareCryptonitOtherAPIWithdrawalActivity : AppCompatActivity(), NfcAdapt
private lateinit var ctx: TangemContext
private var nfcManager: NfcManager? = null
- private var cryptonit: Cryptonit_OtherAPI? = null
+ private var cryptonit: CryptonitOtherApi? = null
@SuppressLint("SetTextI18n")
@@ -44,7 +44,7 @@ class PrepareCryptonitOtherAPIWithdrawalActivity : AppCompatActivity(), NfcAdapt
ctx = TangemContext.loadFromBundle(this, intent.extras)
- cryptonit = Cryptonit_OtherAPI(this)
+ cryptonit = CryptonitOtherApi(this)
tvKey.text = cryptonit!!.key
tvUserID.text = cryptonit!!.userId
diff --git a/app/src/main/java/com/tangem/presentation/activity/SendTransactionActivity.kt b/app/src/main/java/com/tangem/presentation/activity/SendTransactionActivity.kt
index 4356fdff30..21ab026ef3 100644
--- a/app/src/main/java/com/tangem/presentation/activity/SendTransactionActivity.kt
+++ b/app/src/main/java/com/tangem/presentation/activity/SendTransactionActivity.kt
@@ -8,8 +8,8 @@ import android.support.v7.app.AppCompatActivity
import android.view.KeyEvent
import android.widget.Toast
import com.tangem.data.network.ElectrumRequest
-import com.tangem.data.network.ServerApiHelper
-import com.tangem.data.network.ServerApiHelperElectrum
+import com.tangem.data.network.ServerApiElectrum
+import com.tangem.data.network.ServerApiInfura
import com.tangem.data.network.model.InfuraResponse
import com.tangem.domain.cardReader.NfcManager
import com.tangem.domain.wallet.*
@@ -25,8 +25,8 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
const val EXTRA_TX: String = "TX"
}
- private var serverApiHelper: ServerApiHelper = ServerApiHelper()
- private var serverApiHelperElectrum: ServerApiHelperElectrum = ServerApiHelperElectrum()
+ private var serverApiInfura: ServerApiInfura = ServerApiInfura()
+ private var serverApiElectrum: ServerApiElectrum = ServerApiElectrum()
private lateinit var ctx: TangemContext
private var tx: String? = null
@@ -46,14 +46,14 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
val engine = CoinEngineFactory.create(ctx)
if (ctx.blockchain == Blockchain.Ethereum || ctx.blockchain == Blockchain.EthereumTestNet || ctx.blockchain == Blockchain.Token)
- requestInfura(ServerApiHelper.INFURA_ETH_SEND_RAW_TRANSACTION, "")
+ requestInfura(ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION, "")
else if (ctx.blockchain == Blockchain.Bitcoin || ctx.blockchain == Blockchain.BitcoinTestNet)
requestElectrum(ctx.card!!, ElectrumRequest.broadcast(ctx.card!!.wallet, tx))
else if (ctx.blockchain == Blockchain.BitcoinCash || ctx.blockchain == Blockchain.BitcoinCashTestNet)
requestElectrum(ctx.card!!, ElectrumRequest.broadcast(ctx.card!!.wallet, tx))
// request electrum listener
- val electrumBodyListener: ServerApiHelperElectrum.ElectrumRequestDataListener = object : ServerApiHelperElectrum.ElectrumRequestDataListener {
+ val electrumBodyListener: ServerApiElectrum.ElectrumRequestDataListener = object : ServerApiElectrum.ElectrumRequestDataListener {
override fun onSuccess(electrumRequest: ElectrumRequest?) {
if (electrumRequest!!.isMethod(ElectrumRequest.METHOD_SendTransaction)) {
if (electrumRequest.resultString.isEmpty())
@@ -67,13 +67,13 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
finishWithError(message!!)
}
}
- serverApiHelperElectrum.setElectrumRequestData(electrumBodyListener)
+ serverApiElectrum.setElectrumRequestData(electrumBodyListener)
// request infura listener
- val infuraBodyListener: ServerApiHelper.InfuraBodyListener = object : ServerApiHelper.InfuraBodyListener {
+ val infuraBodyListener: ServerApiInfura.InfuraBodyListener = object : ServerApiInfura.InfuraBodyListener {
override fun onSuccess(method: String, infuraResponse: InfuraResponse) {
when (method) {
- ServerApiHelper.INFURA_ETH_SEND_RAW_TRANSACTION -> {
+ ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION -> {
if (infuraResponse.result.isEmpty())
finishWithError("Rejected by node: " + infuraResponse.error)
else {
@@ -88,13 +88,13 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
override fun onFail(method: String, message: String) {
when (method) {
- ServerApiHelper.INFURA_ETH_SEND_RAW_TRANSACTION -> {
+ ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION -> {
finishWithError(message)
}
}
}
}
- serverApiHelper.setInfuraResponse(infuraBodyListener)
+ serverApiInfura.setInfuraResponse(infuraBodyListener)
}
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
@@ -132,14 +132,14 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
private fun requestInfura(method: String, contract: String) {
if (UtilHelper.isOnline(this)) {
- serverApiHelper.infura(method, 67, ctx.card!!.wallet, contract, tx)
+ serverApiInfura.infura(method, 67, ctx.card!!.wallet, contract, tx)
} else
finishWithError(getString(R.string.no_connection))
}
private fun requestElectrum(card: TangemCard, electrumRequest: ElectrumRequest) {
if (UtilHelper.isOnline(this)) {
- serverApiHelperElectrum.electrumRequestData(card, electrumRequest)
+ serverApiElectrum.electrumRequestData(card, electrumRequest)
} else
finishWithError(getString(R.string.no_connection))
}
diff --git a/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt b/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt
index ee4503b8ac..ac883fd1b7 100644
--- a/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt
+++ b/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt
@@ -22,8 +22,9 @@ import android.widget.Toast
import com.tangem.data.db.LocalStorage
import com.tangem.data.db.PINStorage
import com.tangem.data.network.ElectrumRequest
-import com.tangem.data.network.ServerApiHelper
-import com.tangem.data.network.ServerApiHelperElectrum
+import com.tangem.data.network.ServerApiCommon
+import com.tangem.data.network.ServerApiElectrum
+import com.tangem.data.network.ServerApiInfura
import com.tangem.data.network.model.CardVerifyAndGetInfo
import com.tangem.data.network.model.InfuraResponse
import com.tangem.data.nfc.VerifyCardTask
@@ -64,8 +65,9 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
private var nfcManager: NfcManager? = null
- private var serverApiHelper: ServerApiHelper = ServerApiHelper()
- private var serverApiHelperElectrum: ServerApiHelperElectrum = ServerApiHelperElectrum()
+ private var serverApiCommon: ServerApiCommon = ServerApiCommon()
+ private var serverApiInfura: ServerApiInfura = ServerApiInfura()
+ private var serverApiElectrum: ServerApiElectrum = ServerApiElectrum()
private var singleToast: Toast? = null
//private var card: TangemCard? = null
@@ -126,7 +128,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
// set listeners
srl!!.setOnRefreshListener { refresh() }
btnLookup.setOnClickListener {
- val engine = CoinEngineFactory.create(ctx)
+ val engine = CoinEngineFactory.create(ctx)
val browserIntent = Intent(Intent.ACTION_VIEW, engine!!.shareWalletUriExplorer)
startActivity(browserIntent)
}
@@ -219,7 +221,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
// request electrum listener
- val electrumBodyListener: ServerApiHelperElectrum.ElectrumRequestDataListener = object : ServerApiHelperElectrum.ElectrumRequestDataListener {
+ val electrumBodyListener: ServerApiElectrum.ElectrumRequestDataListener = object : ServerApiElectrum.ElectrumRequestDataListener {
override fun onSuccess(electrumRequest: ElectrumRequest?) {
if (electrumRequest!!.isMethod(ElectrumRequest.METHOD_GetBalance)) {
try {
@@ -229,7 +231,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
ctx.coinData!!.isBalanceReceived = true
(ctx.coinData!! as BtcData).setBalanceConfirmed(confBalance)
(ctx.coinData!! as BtcData).balanceUnconfirmed = unconfirmedBalance
- (ctx.coinData!! as BtcData).validationNodeDescription = serverApiHelperElectrum.validationNodeDescription
+ (ctx.coinData!! as BtcData).validationNodeDescription = serverApiElectrum.validationNodeDescription
} catch (e: JSONException) {
e.printStackTrace()
Log.e(TAG, "FAIL METHOD_GetBalance JSONException")
@@ -293,13 +295,13 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
}
- serverApiHelperElectrum.setElectrumRequestData(electrumBodyListener)
+ serverApiElectrum.setElectrumRequestData(electrumBodyListener)
// request infura listener
- val infuraBodyListener: ServerApiHelper.InfuraBodyListener = object : ServerApiHelper.InfuraBodyListener {
+ val infuraBodyListener: ServerApiInfura.InfuraBodyListener = object : ServerApiInfura.InfuraBodyListener {
override fun onSuccess(method: String, infuraResponse: InfuraResponse) {
when (method) {
- ServerApiHelper.INFURA_ETH_GET_BALANCE -> {
+ ServerApiInfura.INFURA_ETH_GET_BALANCE -> {
var balanceCap = infuraResponse.result
balanceCap = balanceCap.substring(2)
val l = BigInteger(balanceCap, 16)
@@ -320,7 +322,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
// Log.i("$TAG eth_get_balance", balanceCap)
}
- ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT -> {
+ ServerApiInfura.INFURA_ETH_GET_TRANSACTION_COUNT -> {
var nonce = infuraResponse.result
nonce = nonce.substring(2)
val count = BigInteger(nonce, 16)
@@ -330,7 +332,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
// Log.i("$TAG eth_getTransCount", nonce)
}
- ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT -> {
+ ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT -> {
var pending = infuraResponse.result
pending = pending.substring(2)
val count = BigInteger(pending, 16)
@@ -339,7 +341,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
// Log.i("$TAG eth_getPendingTxCount", pending)
}
- ServerApiHelper.INFURA_ETH_CALL -> {
+ ServerApiInfura.INFURA_ETH_CALL -> {
try {
var balanceCap = infuraResponse.result
balanceCap = balanceCap.substring(2)
@@ -355,18 +357,18 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
// requestCounter--
// if (requestCounter == 0) srl!!.isRefreshing = false
//
-// requestInfura(ServerApiHelper.INFURA_ETH_GET_BALANCE, "")
-// requestInfura(ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT, "")
-// requestInfura(ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT, "")
+// requestInfura(ServerApiCommon.INFURA_ETH_GET_BALANCE, "")
+// requestInfura(ServerApiCommon.INFURA_ETH_GET_TRANSACTION_COUNT, "")
+// requestInfura(ServerApiCommon.INFURA_ETH_GET_PENDING_COUNT, "")
// return
// }
(ctx.coinData!! as EthData).balanceInInternalUnits = CoinEngine.InternalAmount(l.toBigDecimal(), ctx.card.tokenSymbol)
// Log.i("$TAG eth_call", balanceCap)
- requestInfura(ServerApiHelper.INFURA_ETH_GET_BALANCE, "")
- requestInfura(ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT, "")
- requestInfura(ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT, "")
+ requestInfura(ServerApiInfura.INFURA_ETH_GET_BALANCE, "")
+ requestInfura(ServerApiInfura.INFURA_ETH_GET_TRANSACTION_COUNT, "")
+ requestInfura(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, "")
} catch (e: JSONException) {
e.printStackTrace()
} catch (e: NumberFormatException) {
@@ -376,7 +378,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
}
- ServerApiHelper.INFURA_ETH_SEND_RAW_TRANSACTION -> {
+ ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION -> {
try {
var hashTX: String
try {
@@ -411,10 +413,10 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
}
- serverApiHelper.setInfuraResponse(infuraBodyListener)
+ serverApiInfura.setInfuraResponse(infuraBodyListener)
// request card verify and get info listener
- val cardVerifyAndGetInfoListener: ServerApiHelper.CardVerifyAndGetInfoListener = object : ServerApiHelper.CardVerifyAndGetInfoListener {
+ val cardVerifyAndGetInfoListener: ServerApiCommon.CardVerifyAndGetInfoListener = object : ServerApiCommon.CardVerifyAndGetInfoListener {
override fun onSuccess(cardVerifyAndGetArtworkResponse: CardVerifyAndGetInfo.Response?) {
val result = cardVerifyAndGetArtworkResponse?.results!![0]
if (result.error != null) {
@@ -440,7 +442,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
if (result.artwork != null && localStorage.checkNeedUpdateArtwork(result.artwork)) {
Log.w(TAG, "Artwork '${result.artwork!!.id}' updated, need download")
- serverApiHelper.requestArtwork(result.artwork!!.id, result.artwork!!.getUpdateDate(), ctx.card!!)
+ serverApiCommon.requestArtwork(result.artwork!!.id, result.artwork!!.getUpdateDate(), ctx.card!!)
updateViews()
}
// Log.i(TAG, "setCardVerify " + it.results!![0].passed)
@@ -450,10 +452,10 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
}
- serverApiHelper.setCardVerifyAndGetInfoListener(cardVerifyAndGetInfoListener)
+ serverApiCommon.setCardVerifyAndGetInfoListener(cardVerifyAndGetInfoListener)
// request artwork listener
- val artworkListener: ServerApiHelper.ArtworkListener = object : ServerApiHelper.ArtworkListener {
+ val artworkListener: ServerApiCommon.ArtworkListener = object : ServerApiCommon.ArtworkListener {
override fun onSuccess(artworkId: String?, inputStream: InputStream?, updateDate: Date?) {
localStorage.updateArtwork(artworkId!!, inputStream!!, updateDate!!)
ivTangemCard.setImageBitmap(localStorage.getCardArtworkBitmap(ctx.card!!))
@@ -463,10 +465,10 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
}
- serverApiHelper.setArtworkListener(artworkListener)
+ serverApiCommon.setArtworkListener(artworkListener)
// request rate info listener
- serverApiHelper.setRateInfoData {
+ serverApiCommon.setRateInfoData {
val rate = it.priceUsd.toFloat()
ctx.coinData!!.rate = rate
ctx.coinData!!.rateAlter = rate
@@ -836,16 +838,16 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
// Ethereum
else if (ctx.blockchain == Blockchain.Ethereum || ctx.blockchain == Blockchain.EthereumTestNet) {
- requestInfura(ServerApiHelper.INFURA_ETH_GET_BALANCE, "")
- requestInfura(ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT, "")
- requestInfura(ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT, "")
+ requestInfura(ServerApiInfura.INFURA_ETH_GET_BALANCE, "")
+ requestInfura(ServerApiInfura.INFURA_ETH_GET_TRANSACTION_COUNT, "")
+ requestInfura(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, "")
requestRateInfo("ethereum")
}
// Token
else if (ctx.blockchain == Blockchain.Token) {
val engine = CoinEngineFactory.create(ctx)
- requestInfura(ServerApiHelper.INFURA_ETH_CALL, (engine as TokenEngine).getContractAddress(ctx.card))
+ requestInfura(ServerApiInfura.INFURA_ETH_CALL, (engine as TokenEngine).getContractAddress(ctx.card))
requestRateInfo("ethereum")
}
} catch (e: Exception) {
@@ -856,7 +858,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
private fun requestElectrum(electrumRequest: ElectrumRequest) {
if (UtilHelper.isOnline(activity!!)) {
requestCounter++
- serverApiHelperElectrum.electrumRequestData(ctx.card, electrumRequest)
+ serverApiElectrum.electrumRequestData(ctx.card, electrumRequest)
} else {
Toast.makeText(activity!!, getString(R.string.no_connection), Toast.LENGTH_SHORT).show()
srl!!.isRefreshing = false
@@ -866,7 +868,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
private fun requestInfura(method: String, contract: String) {
if (UtilHelper.isOnline(activity)) {
requestCounter++
- serverApiHelper.infura(method, 67, ctx.card!!.wallet, contract, "")
+ serverApiInfura.infura(method, 67, ctx.card!!.wallet, contract, "")
} else {
Toast.makeText(activity, getString(R.string.no_connection), Toast.LENGTH_SHORT).show()
srl!!.isRefreshing = false
@@ -876,7 +878,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
private fun requestVerifyAndGetInfo() {
if (UtilHelper.isOnline(activity)) {
if ((ctx.card!!.isOnlineVerified == null || !ctx.card!!.isOnlineVerified)) {
- serverApiHelper.cardVerifyAndGetInfo(ctx.card)
+ serverApiCommon.cardVerifyAndGetInfo(ctx.card)
}
} else {
Toast.makeText(activity, getString(R.string.no_connection), Toast.LENGTH_SHORT).show()
@@ -886,7 +888,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
private fun requestRateInfo(cryptoId: String) {
if (UtilHelper.isOnline(activity)) {
- serverApiHelper.rateInfoData(cryptoId)
+ serverApiCommon.rateInfoData(cryptoId)
} else {
Toast.makeText(activity, getString(R.string.no_connection), Toast.LENGTH_SHORT).show()
srl!!.isRefreshing = false