Updated on 2026-08-14
This commit is contained in:
parent
30c98ca4b3
commit
def14e863d
3 changed files with 32 additions and 7 deletions
|
|
@ -69,9 +69,14 @@ public class ServerApiBinance {
|
|||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG, "getBalance onError" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
ctx.setError(e.getMessage());
|
||||
responseListener.onFail();
|
||||
if (e.getMessage().contains("code=404")) {
|
||||
((BinanceData)ctx.getCoinData()).setError404(true);
|
||||
responseListener.onFail();
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
ctx.setError(e.getMessage());
|
||||
responseListener.onFail();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public class BinanceData extends CoinData {
|
|||
private String balance, chainId;
|
||||
private Long sequence;
|
||||
private Integer accountNumber;
|
||||
private boolean error404 = false;
|
||||
|
||||
@Override
|
||||
public void loadFromBundle(Bundle B) {
|
||||
|
|
@ -23,6 +24,8 @@ public class BinanceData extends CoinData {
|
|||
else sequence = null;
|
||||
if (B.containsKey("AccountNumber")) accountNumber = B.getInt("AccountNumber");
|
||||
else accountNumber = null;
|
||||
if (B.containsKey("Error404")) error404 = B.getBoolean("Error404");
|
||||
else error404 = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -33,6 +36,7 @@ public class BinanceData extends CoinData {
|
|||
if (chainId != null) B.putString("ChainId", chainId);
|
||||
if (sequence != null) B.putLong("Sequence", sequence);
|
||||
if (accountNumber != null) B.putInt("AccountNumber", accountNumber);
|
||||
if (error404) B.putBoolean("Error404", true);
|
||||
} catch (Exception e) {
|
||||
Log.e("Can't save to bundle ", e.getMessage());
|
||||
}
|
||||
|
|
@ -45,6 +49,7 @@ public class BinanceData extends CoinData {
|
|||
chainId = null;
|
||||
sequence = null;
|
||||
accountNumber = null;
|
||||
error404 = false;
|
||||
}
|
||||
|
||||
public CoinEngine.Amount getBalance() {
|
||||
|
|
@ -82,4 +87,12 @@ public class BinanceData extends CoinData {
|
|||
public void setChainId(String chain_id) {
|
||||
this.chainId = chain_id;
|
||||
}
|
||||
|
||||
public boolean isError404() {
|
||||
return error404;
|
||||
}
|
||||
|
||||
public void setError404(boolean error404) {
|
||||
this.error404 = error404;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,10 +230,17 @@ public class BinanceEngine extends CoinEngine {
|
|||
public boolean validateBalance(BalanceValidator balanceValidator) {
|
||||
try {
|
||||
if (((ctx.getCard().getOfflineBalance() == null) && !ctx.getCoinData().isBalanceReceived()) || (!ctx.getCoinData().isBalanceReceived() && (ctx.getCard().getRemainingSignatures() != ctx.getCard().getMaxSignatures()))) {
|
||||
balanceValidator.setScore(0);
|
||||
balanceValidator.setFirstLine("Unknown balance");
|
||||
balanceValidator.setSecondLine("Balance cannot be verified. Swipe down to refresh.");
|
||||
return false;
|
||||
|
||||
if(coinData.isError404()) {
|
||||
balanceValidator.setScore(0);
|
||||
balanceValidator.setFirstLine("No account or network error");
|
||||
balanceValidator.setSecondLine("To create account send funds to this address");
|
||||
} else {
|
||||
balanceValidator.setScore(0);
|
||||
balanceValidator.setFirstLine("Unknown balance");
|
||||
balanceValidator.setSecondLine("Balance cannot be verified. Swipe down to refresh.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (coinData.isBalanceReceived()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue