Updated on 2026-08-14
This commit is contained in:
commit
781d032856
12 changed files with 182 additions and 152 deletions
|
|
@ -119,6 +119,7 @@ public class ServerApiHelper {
|
|||
*/
|
||||
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";
|
||||
|
|
@ -149,7 +150,9 @@ public class ServerApiHelper {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -37,20 +37,19 @@ public class ETHRequestTask extends InfuraTask {
|
|||
if (request.isMethod(InfuraRequest.METHOD_ETH_GetGasPrice)) {
|
||||
try {
|
||||
String gasPrice = request.getResultString();
|
||||
Log.i("sjjoefeff", gasPrice);
|
||||
Log.i("Gas Price 1", gasPrice);
|
||||
gasPrice = gasPrice.substring(2);
|
||||
BigInteger l = new BigInteger(gasPrice, 16);
|
||||
|
||||
|
||||
Log.i("sjjoefeff", gasPrice);
|
||||
Log.i("Gas Price 2", gasPrice);
|
||||
|
||||
BigInteger m = confirmPaymentActivity.getCard().getBlockchain() == Blockchain.Token ? BigInteger.valueOf(55000) : BigInteger.valueOf(21000);
|
||||
l = l.multiply(m);
|
||||
String MinFeeInGwei = confirmPaymentActivity.getCard().getAmountInGwei(String.valueOf(l));
|
||||
String NormalFeeInGwei = confirmPaymentActivity.getCard().getAmountInGwei(String.valueOf(l.multiply(BigInteger.valueOf(12)).divide(BigInteger.valueOf(10))));
|
||||
String MaxFeeInGwei = confirmPaymentActivity.getCard().getAmountInGwei(String.valueOf(l.multiply(BigInteger.valueOf(15)).divide(BigInteger.valueOf(10))));
|
||||
BigInteger GasLimit = confirmPaymentActivity.getCard().getBlockchain() == Blockchain.Token ? BigInteger.valueOf(60000) : BigInteger.valueOf(21000);
|
||||
String MinFeeInGwei = confirmPaymentActivity.getCard().getAmountInGwei(String.valueOf(l.multiply(GasLimit)));
|
||||
String NormalFeeInGwei = confirmPaymentActivity.getCard().getAmountInGwei(String.valueOf(l.multiply(BigInteger.valueOf(12)).divide(BigInteger.valueOf(10).multiply(GasLimit))));
|
||||
String MaxFeeInGwei = confirmPaymentActivity.getCard().getAmountInGwei(String.valueOf(l.multiply(BigInteger.valueOf(15)).divide(BigInteger.valueOf(10).multiply(GasLimit))));
|
||||
|
||||
Log.i("sjjoefeff", MinFeeInGwei);
|
||||
Log.i("Min Fee Gwei", MinFeeInGwei);
|
||||
|
||||
confirmPaymentActivity.setMinFee(MinFeeInGwei);
|
||||
confirmPaymentActivity.setNormalFee(NormalFeeInGwei);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class ETHRequestTask extends InfuraTask {
|
|||
nonce = nonce.substring(2);
|
||||
BigInteger count = new BigInteger(nonce, 16);
|
||||
|
||||
loadedWallet.getCard().setConfirmTXCount(count);
|
||||
loadedWallet.getCard().setConfirmedTXCount(count);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -105,9 +105,9 @@ public class ETHRequestTask extends InfuraTask {
|
|||
Log.e("TX_RESULT", hashTX);
|
||||
|
||||
|
||||
BigInteger nonce = loadedWallet.getCard().GetConfirmTXCount();
|
||||
BigInteger nonce = loadedWallet.getCard().getConfirmedTXCount();
|
||||
nonce.add(BigInteger.valueOf(1));
|
||||
loadedWallet.getCard().setConfirmTXCount(nonce);
|
||||
loadedWallet.getCard().setConfirmedTXCount(nonce);
|
||||
Log.e("TX_RESULT", hashTX);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ public class ETHRequestTask extends InfuraTask {
|
|||
BigInteger bigInt = new BigInteger(hashTX, 16); //TODO: очень плохой способ
|
||||
LastSignStorage.setTxWasSend(sendTransactionActivity.getCard().getWallet());
|
||||
LastSignStorage.setLastMessage(sendTransactionActivity.getCard().getWallet(), "");
|
||||
BigInteger nonce = sendTransactionActivity.getCard().GetConfirmTXCount();
|
||||
BigInteger nonce = sendTransactionActivity.getCard().getConfirmedTXCount();
|
||||
nonce.add(BigInteger.valueOf(1));
|
||||
sendTransactionActivity.getCard().setConfirmTXCount(nonce);
|
||||
sendTransactionActivity.getCard().setConfirmedTXCount(nonce);
|
||||
Log.e("TX_RESULT", hashTX);
|
||||
sendTransactionActivity.finishWithSuccess();
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue