TxGasUtil

TxGasUtil

tx-gas-utils are gas utility methods for Transaction manager its passed ethquery and used to do things like calculate gas of a tx.

Constructor

new TxGasUtil(provider)

Source:
Parameters:
Name Type Description
provider Object

A network provider.

Methods

addGasBuffer(initialGasLimitHex, blockGasLimitHex) → {string}

Source:

Adds a gas buffer with out exceeding the block gas limit

Parameters:
Name Type Description
initialGasLimitHex string

the initial gas limit to add the buffer too

blockGasLimitHex string

the block gas limit

Returns:

the buffered gas limit as a hex string

Type
string

(async) analyzeGasUsage(txMeta) → {object}

Source:
Parameters:
Name Type Description
txMeta Object

the txMeta object

Returns:

the txMeta object with the gas written to the txParams

Type
object

(async) estimateTxGas(txMeta, blockGasLimitHex) → {string}

Source:

Estimates the tx's gas usage

Parameters:
Name Type Description
txMeta Object

the txMeta object

blockGasLimitHex string

hex string of the block's gas limit

Returns:

the estimated gas limit as a hex string

Type
string

setTxGas(txMeta, blockGasLimitHex, estimatedGasHex)

Source:

Writes the gas on the txParams in the txMeta

Parameters:
Name Type Description
txMeta Object

the txMeta object to write to

blockGasLimitHex string

the block gas limit hex

estimatedGasHex string

the estimated gas hex