|
1 | 1 | var yo = require('yo-yo') |
2 | 2 | var csjs = require('csjs-inject') |
3 | 3 | const copyToClipboard = require('./copy-to-clipboard') |
| 4 | +const Web3 = require('web3') |
4 | 5 |
|
5 | 6 | var css = csjs` |
6 | 7 | .txInfoBox { |
@@ -28,7 +29,7 @@ function confirmDialog (tx, network, amount, gasEstimation, newGasPriceCb, initi |
28 | 29 | var maxFee = el.querySelector('#maxfee').value |
29 | 30 | var confirmBtn = document.querySelector('#modal-footer-ok') |
30 | 31 | var maxPriorityFee = el.querySelector('#maxpriorityfee').value |
31 | | - if (parseInt(network.lastBlock.baseFeePerGas, 16) > parseInt(maxFee)) { |
| 32 | + if (parseInt(network.lastBlock.baseFeePerGas, 16) > Web3.utils.toWei(maxFee, 'Gwei')) { |
32 | 33 | el.querySelector('#txfee').innerHTML = 'Transaction is invalid. Max fee should not be less than Base fee' |
33 | 34 | el.gasPriceStatus = false |
34 | 35 | confirmBtn.hidden = true |
@@ -91,7 +92,7 @@ function confirmDialog (tx, network, amount, gasEstimation, newGasPriceCb, initi |
91 | 92 | </div> |
92 | 93 | <div class="align-items-center my-1" title="Represents the maximum amount of fee that you will pay for this transaction. The minimun needs to be set to base fee."> |
93 | 94 | <div class='d-flex'> |
94 | | - <span class="text-dark mr-2 text-nowrap">Max fee (Not less than base fee - ${parseInt(network.lastBlock.baseFeePerGas, 16)} Gwei):</span> |
| 95 | + <span class="text-dark mr-2 text-nowrap">Max fee (Not less than base fee ${Web3.utils.fromWei(Web3.utils.toBN(parseInt(network.lastBlock.baseFeePerGas, 16)), 'Gwei')} Gwei):</span> |
95 | 96 | <input class="form-control mr-1 text-right" style='height: 1.2rem; width: 6rem;' id='maxfee' oninput=${onMaxFeeChange} /> |
96 | 97 | <span>Gwei</span> |
97 | 98 | <span class="text-dark ml-2"></span> |
@@ -124,7 +125,7 @@ function confirmDialog (tx, network, amount, gasEstimation, newGasPriceCb, initi |
124 | 125 | onGasPriceChange() |
125 | 126 | } |
126 | 127 | if (el.querySelector('#maxfee') && network && network.lastBlock && network.lastBlock.baseFeePerGas) { |
127 | | - el.querySelector('#maxfee').value = parseInt(network.lastBlock.baseFeePerGas, 16) |
| 128 | + el.querySelector('#maxfee').value = Web3.utils.fromWei(Web3.utils.toBN(parseInt(network.lastBlock.baseFeePerGas, 16)), 'Gwei') |
128 | 129 | onMaxFeeChange() |
129 | 130 | } |
130 | 131 | if (gasPriceStatus !== undefined) { |
|
0 commit comments