mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fix addTxDefaults
This commit is contained in:
parent
21e76484d6
commit
3a4726018e
@ -172,7 +172,7 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
// ensure value
|
// ensure value
|
||||||
txParams.value = txParams.value || '0x0'
|
txParams.value = txParams.value || '0x0'
|
||||||
if (!txParams.gasPrice) {
|
if (!txParams.gasPrice) {
|
||||||
gassPrice = await this.query.gasPrice()
|
const gasPrice = await this.query.gasPrice()
|
||||||
txParams.gasPrice = gasPrice
|
txParams.gasPrice = gasPrice
|
||||||
}
|
}
|
||||||
// set gasLimit
|
// set gasLimit
|
||||||
|
@ -19,6 +19,7 @@ module.exports = class txProvideUtils {
|
|||||||
const block = await this.query.getBlockByNumber('latest', true)
|
const block = await this.query.getBlockByNumber('latest', true)
|
||||||
const estimatedGasHex = await this.estimateTxGas(txMeta, block.gasLimit)
|
const estimatedGasHex = await this.estimateTxGas(txMeta, block.gasLimit)
|
||||||
this.setTxGas(txMeta, block.gasLimit, estimatedGasHex)
|
this.setTxGas(txMeta, block.gasLimit, estimatedGasHex)
|
||||||
|
return txMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
async estimateTxGas (txMeta, blockGasLimitHex) {
|
async estimateTxGas (txMeta, blockGasLimitHex) {
|
||||||
@ -32,7 +33,7 @@ module.exports = class txProvideUtils {
|
|||||||
txParams.gas = bnToHex(saferGasLimitBN)
|
txParams.gas = bnToHex(saferGasLimitBN)
|
||||||
}
|
}
|
||||||
// run tx, see if it will OOG
|
// run tx, see if it will OOG
|
||||||
return await this.query.estimateGas(txParams)
|
return this.query.estimateGas(txParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
setTxGas (txMeta, blockGasLimitHex, estimatedGasHex) {
|
setTxGas (txMeta, blockGasLimitHex, estimatedGasHex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user