Updated on 2026-08-14
This commit is contained in:
parent
2550dff2f4
commit
69a01a632b
6 changed files with 28 additions and 22 deletions
|
|
@ -147,6 +147,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
if (height != -1) {
|
||||
String nodeAddress = engine.getNode(loadedWallet.getCard());
|
||||
int nodePort = engine.getNodePort(loadedWallet.getCard());
|
||||
engine.switchNode(loadedWallet.getCard());
|
||||
UpdateWalletInfoTask updateWalletInfoTask = new UpdateWalletInfoTask(loadedWallet, nodeAddress, nodePort);
|
||||
// loadedWallet.updateTasks.add(updateWalletInfoTask);
|
||||
updateWalletInfoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.getHeader(mWalletAddress, String.valueOf(height)), ElectrumRequest.getTransaction(mWalletAddress, hash));
|
||||
|
|
@ -184,6 +185,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
if (height != -1) {
|
||||
String nodeAddress = engine.getNode(loadedWallet.getCard());
|
||||
int nodePort = engine.getNodePort(loadedWallet.getCard());
|
||||
engine.switchNode(loadedWallet.getCard());
|
||||
UpdateWalletInfoTask updateWalletInfoTask = new UpdateWalletInfoTask(loadedWallet, nodeAddress, nodePort);
|
||||
// loadedWallet.updateTasks.add(updateWalletInfoTask);
|
||||
updateWalletInfoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.getHeader(mWalletAddress, String.valueOf(height)), ElectrumRequest.getTransaction(mWalletAddress, hash));
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class BalanceValidator {
|
|||
firstLine = "Verification failed";
|
||||
secondLine = "";
|
||||
|
||||
if (card.getBlockchain() == Blockchain.Bitcoin) {
|
||||
if (card.getBlockchain() == Blockchain.Bitcoin || card.getBlockchain() == Blockchain.BitcoinTestNet) {
|
||||
|
||||
if (((card.getOfflineBalance() == null) && !card.isBalanceReceived()) || (!card.isBalanceReceived() && (card.getRemainingSignatures() != card.getMaxSignatures()))) {
|
||||
score = 0;
|
||||
|
|
@ -61,8 +61,8 @@ public class BalanceValidator {
|
|||
|
||||
if (card.getBalanceUnconfirmed() != 0) {
|
||||
score = 0;
|
||||
firstLine = "Unguaranted balance";
|
||||
secondLine = "Loading in progress. Wait for full confirmation in blockchain. ";
|
||||
firstLine = "Transaction in progress";
|
||||
secondLine = "Wait for full confirmation in blockchain. ";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ import java.util.Random;
|
|||
|
||||
import static com.tangem.util.FormatUtil.stringToBigDecimal;
|
||||
|
||||
/**
|
||||
* Created by Ilia on 15.02.2018.
|
||||
*/
|
||||
|
||||
public class BtcEngine extends CoinEngine {
|
||||
|
||||
private static String[] getBitcoinServiceHosts() {
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,7 @@ public class TangemCard {
|
|||
return balanceReceived;
|
||||
}
|
||||
|
||||
private boolean balanceReceived;
|
||||
private boolean balanceReceived = false;
|
||||
|
||||
public void setBalanceReceived(boolean value) {
|
||||
balanceReceived = value;
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
if (height != -1) {
|
||||
val nodeAddress = engine.getNode(card)
|
||||
val nodePort = engine.getNodePort(card)
|
||||
engine.switchNode(card);
|
||||
val updateWalletInfoTask = UpdateWalletInfoTask(this, nodeAddress, nodePort)
|
||||
// loadedWallet.updateTasks.add(updateWalletInfoTask);
|
||||
updateWalletInfoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.getHeader(mWalletAddress, height.toString()), ElectrumRequest.getTransaction(mWalletAddress, hash))
|
||||
|
|
@ -277,6 +278,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
// request card verify listener
|
||||
serverApiHelper!!.setCardVerifyAndGetInfoListener {
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
updateViews()
|
||||
val result = it.results!![0]
|
||||
if (result.error != null) {
|
||||
// Log.e(TAG, "Can't verify card: ${result.error}")
|
||||
|
|
@ -318,7 +320,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
card!!.rate = rate
|
||||
card!!.rateAlter = rate
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
|
||||
updateViews()
|
||||
// Log.i(TAG, "setRateInfoData $rate")
|
||||
}
|
||||
|
||||
|
|
@ -370,9 +372,8 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
if (l.compareTo(BigInteger.ZERO) == 0) {
|
||||
card!!.blockchainID = Blockchain.Ethereum.id
|
||||
card!!.addTokenToBlockchainName()
|
||||
updateViews()
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
// refresh()
|
||||
updateViews()
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_BALANCE, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT, "")
|
||||
|
|
@ -440,6 +441,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
|
||||
override fun onInfuraFail(method: String, message: String) {
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
updateViews()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -762,11 +764,17 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
|
||||
val engine = CoinEngineFactory.create(card!!.blockchain)
|
||||
|
||||
val validator = BalanceValidator()
|
||||
validator.Check(card, false)
|
||||
tvBalanceLine1.text = validator.firstLine
|
||||
tvBalanceLine2.text = validator.getSecondLine(false)
|
||||
tvBalanceLine1.setTextColor(ContextCompat.getColor(context!!, validator.color))
|
||||
if (srlLoadedWallet!!.isRefreshing) {
|
||||
tvBalanceLine1.setTextColor(getResources().getColor(R.color.primary))
|
||||
tvBalanceLine1.text = "Verifying in blockchain..."
|
||||
tvBalanceLine2.text = ""
|
||||
} else {
|
||||
val validator = BalanceValidator()
|
||||
validator.Check(card, false)
|
||||
tvBalanceLine1.setTextColor(ContextCompat.getColor(context!!, validator.color))
|
||||
tvBalanceLine1.text = validator.firstLine
|
||||
tvBalanceLine2.text = validator.getSecondLine(false)
|
||||
}
|
||||
|
||||
if (engine!!.hasBalanceInfo(card) || card!!.offlineBalance == null) {
|
||||
if (card!!.blockchain == Blockchain.Token) {
|
||||
|
|
@ -808,6 +816,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
card!!.clearInfo()
|
||||
card!!.error = null
|
||||
card!!.message = null
|
||||
card!!.isBalanceReceived = false
|
||||
|
||||
val needResendTX = LastSignStorage.getNeedTxSend(card!!.wallet)
|
||||
|
||||
|
|
@ -921,8 +930,8 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
requestRateInfo("ethereum")
|
||||
}
|
||||
|
||||
if (needResendTX)
|
||||
sendTransaction(LastSignStorage.getTxForSend(card!!.wallet))
|
||||
//if (needResendTX)
|
||||
//sendTransaction(LastSignStorage.getTxForSend(card!!.wallet))
|
||||
|
||||
// if (btnExtract.isEnabled)
|
||||
|
||||
|
|
@ -1018,6 +1027,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
} else if (card!!.blockchain == Blockchain.Bitcoin || card!!.blockchain == Blockchain.BitcoinTestNet) {
|
||||
val nodeAddress = engine!!.getNode(card)
|
||||
val nodePort = engine.getNodePort(card)
|
||||
engine.switchNode(card)
|
||||
|
||||
val connectTask = UpdateWalletInfoTask(this@LoadedWallet, nodeAddress, nodePort)
|
||||
connectTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.broadcast(card!!.wallet, tx))
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/maaxmedium"
|
||||
android:textAlignment="center"
|
||||
android:visibility="invisible" />
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBalanceLine2"
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone" />
|
||||
android:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -238,7 +238,6 @@
|
|||
android:elevation="2dp"
|
||||
android:fontFamily="@font/maax"
|
||||
android:padding="4dp"
|
||||
android:text="@string/message"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="normal|bold"
|
||||
|
|
@ -256,7 +255,6 @@
|
|||
android:fontFamily="@font/maax"
|
||||
android:padding="4dp"
|
||||
android:shadowColor="@color/cardview_shadow_start_color"
|
||||
android:text="@string/error"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue