Updated on 2026-08-14
This commit is contained in:
commit
5c6ea5ca04
18 changed files with 195 additions and 57 deletions
|
|
@ -130,6 +130,11 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
val sharedFee = SharedData(SharedData.COUNT_REQUEST)
|
||||
|
||||
progressBar!!.visibility = View.VISIBLE
|
||||
|
||||
// serverApiHelper!!.estimateFee(ServerApiHelper.ESTIMATE_FEE_PRIORITY)
|
||||
// serverApiHelper!!.estimateFee(ServerApiHelper.ESTIMATE_FEE_NORMAL)
|
||||
// serverApiHelper!!.estimateFee(ServerApiHelper.ESTIMATE_FEE_MINIMAL)
|
||||
|
||||
for (i in 0 until SharedData.COUNT_REQUEST) {
|
||||
val feeTask = ConnectFeeTask(this@ConfirmPaymentActivity, sharedFee)
|
||||
feeTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
|
|
@ -203,8 +208,8 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
return@setOnClickListener
|
||||
}
|
||||
|
||||
if (!engineCoin.checkAmountValue(card, txAmount, txFee, minFeeInInternalUnits)) {
|
||||
finishActivityWithError(Activity.RESULT_CANCELED, getString(R.string.not_enough_eth_for_transaction_fee))
|
||||
if (!engineCoin.checkAmountValue(card, txAmount, txFee, minFeeInInternalUnits, incFee)) {
|
||||
finishActivityWithError(Activity.RESULT_CANCELED, getString(R.string.not_enough_funds_or_incorrect_amount))
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +228,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
gasPrice = gasPrice.substring(2)
|
||||
var l = BigInteger(gasPrice, 16)
|
||||
|
||||
val m = if (card!!.blockchain == Blockchain.Token) BigInteger.valueOf(55000) else BigInteger.valueOf(21000)
|
||||
val m = if (card!!.blockchain == Blockchain.Token) BigInteger.valueOf(60000) else BigInteger.valueOf(21000)
|
||||
l = l.multiply(m)
|
||||
val minFeeInGwei = card!!.getAmountInGwei(l.toString())
|
||||
val normalFeeInGwei = card!!.getAmountInGwei(l.multiply(BigInteger.valueOf(12)).divide(BigInteger.valueOf(10)).toString())
|
||||
|
|
@ -242,6 +247,23 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
|
||||
// Log.i("eth_gas_price", feeInGwei)
|
||||
}
|
||||
|
||||
// request estimate fee listener
|
||||
serverApiHelper!!.setEstimateFee { blockCount, estimateFeeResponse ->
|
||||
when (blockCount) {
|
||||
ServerApiHelper.ESTIMATE_FEE_PRIORITY -> {
|
||||
// Log.i("estimate_fee_PRIORITY", estimateFeeResponse)
|
||||
}
|
||||
|
||||
ServerApiHelper.ESTIMATE_FEE_NORMAL -> {
|
||||
// Log.i("estimate_fee_NORMAL", estimateFeeResponse)
|
||||
}
|
||||
|
||||
ServerApiHelper.ESTIMATE_FEE_MINIMAL -> {
|
||||
// Log.i("estimate_fee_MINIMAL", estimateFeeResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override fun onResume() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue