Updated on 2026-08-14
This commit is contained in:
parent
0419482795
commit
3f743ec353
5 changed files with 19 additions and 31 deletions
|
|
@ -45,7 +45,7 @@ public class EthEngine extends CoinEngine {
|
|||
} else if (ctx.getCoinData() instanceof EthData) {
|
||||
coinData = (EthData) ctx.getCoinData();
|
||||
} else {
|
||||
throw new Exception("Invalid type of Blockchain data for EthEngine");
|
||||
throw new Exception("Invalid type of Blockchain data for " + this.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,15 +28,7 @@ public class RskEngine extends EthEngine {
|
|||
private static final String TAG = RskEngine.class.getSimpleName();
|
||||
|
||||
public RskEngine(TangemContext ctx) throws Exception {
|
||||
this.ctx = ctx;
|
||||
if (ctx.getCoinData() == null) {
|
||||
coinData = new EthData();
|
||||
ctx.setCoinData(coinData);
|
||||
} else if (ctx.getCoinData() instanceof EthData) {
|
||||
coinData = (EthData) ctx.getCoinData();
|
||||
} else {
|
||||
throw new Exception("Invalid type of Blockchain data for RskEngine");
|
||||
}
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
public RskEngine() {
|
||||
|
|
@ -58,10 +50,14 @@ public class RskEngine extends EthEngine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Uri getShareWalletUri() { return Uri.parse(ctx.getCoinData().getWallet()); }
|
||||
public Uri getShareWalletUri() {
|
||||
return Uri.parse(ctx.getCoinData().getWallet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri getShareWalletUriExplorer() { return Uri.parse("https://explorer.rsk.co/address/" + ctx.getCoinData().getWallet()); }
|
||||
public Uri getShareWalletUriExplorer() {
|
||||
return Uri.parse("https://explorer.rsk.co/address/" + ctx.getCoinData().getWallet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) {
|
||||
|
|
@ -138,7 +134,7 @@ public class RskEngine extends EthEngine {
|
|||
throw new Exception("Error in RskEngine - invalid v");
|
||||
}
|
||||
tx.signature.v = (byte) v;
|
||||
Log.e(TAG, "RSK_v: " +String.valueOf(v));
|
||||
Log.e(TAG, "RSK_v: " + String.valueOf(v));
|
||||
|
||||
byte[] txForSend = tx.getEncoded();
|
||||
notifyOnNeedSendPayment(txForSend);
|
||||
|
|
@ -272,7 +268,7 @@ public class RskEngine extends EthEngine {
|
|||
blockchainRequestsCallbacks.onComplete(false);
|
||||
} else {
|
||||
BigInteger nonce = coinData.getConfirmedTXCount();
|
||||
nonce=nonce.add(BigInteger.valueOf(1));
|
||||
nonce = nonce.add(BigInteger.valueOf(1));
|
||||
coinData.setConfirmedTXCount(nonce);
|
||||
ctx.setError(null);
|
||||
blockchainRequestsCallbacks.onComplete(true);
|
||||
|
|
|
|||
|
|
@ -34,21 +34,6 @@ public class RskTokenEngine extends TokenEngine {
|
|||
|
||||
public RskTokenEngine(TangemContext ctx) throws Exception {
|
||||
super(ctx);
|
||||
if (ctx.getCoinData() == null) {
|
||||
coinData = new TokenData();
|
||||
ctx.setCoinData(coinData);
|
||||
} else if (ctx.getCoinData() instanceof TokenData) {
|
||||
coinData = (TokenData) ctx.getCoinData();
|
||||
} else if (ctx.getCoinData() instanceof EthData) {
|
||||
// special case with receive card data substitution from server at the moment
|
||||
Bundle B=new Bundle();
|
||||
ctx.getCoinData().saveToBundle(B);
|
||||
coinData = new TokenData();
|
||||
coinData.loadFromBundle(B);
|
||||
ctx.setCoinData(coinData);
|
||||
} else {
|
||||
throw new Exception("Invalid type of Blockchain data for RskTokenEngine");
|
||||
}
|
||||
}
|
||||
|
||||
public RskTokenEngine() {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class TokenEngine extends CoinEngine {
|
|||
coinData.loadFromBundle(B);
|
||||
ctx.setCoinData(coinData);
|
||||
} else {
|
||||
throw new Exception("Invalid type of Blockchain data for TokenEngine");
|
||||
throw new Exception("Invalid type of Blockchain data for " + this.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,14 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
val rateInfoDataListener: ServerApiCommon.RateInfoDataListener = object : ServerApiCommon.RateInfoDataListener {
|
||||
|
||||
override fun onSuccess(rateInfoResponse: RateInfoResponse?){
|
||||
ctx.coinData!!.rate = rateInfoResponse!!.data!!.quote!!.usd!!.price!!
|
||||
try {
|
||||
ctx.coinData!!.rate = rateInfoResponse!!.data!!.quote!!.usd!!.price!!
|
||||
}
|
||||
catch (e : java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
ctx.error = "Unknown response from CoinMarketCap"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFail(message: String?){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue