tx-gas-utils are gas utility methods for Transaction manager its passed ethquery and used to do things like calculate gas of a tx.
provider
Object A network provider.
txMeta
{Object} - the txMeta objectgetCodeResponse
Returns object the txMeta object with the gas written to the txParams
Estimates the tx's gas usage
txMeta
{Object} - the txMeta objectblockGasLimitHex
{string} - hex string of the block's gas limitgetCodeResponse
Returns string the estimated gas limit as a hex string
Writes the gas on the txParams in the txMeta
txMeta
{Object} - the txMeta object to write toblockGasLimitHex
{string} - the block gas limit hexestimatedGasHex
{string} - the estimated gas hex
Adds a gas buffer with out exceeding the block gas limit
initialGasLimitHex
{string} - the initial gas limit to add the buffer tooblockGasLimitHex
{string} - the block gas limit
Returns string the buffered gas limit as a hex string
Converts a BN object to a hex string with a '0x' prefix
inputBn
BN The BN to convert to a hex string
Returns string A '0x' prefixed hex string
Converts a hex string to a BN object
inputHex
string A number represented as a hex string
Returns Object A BN object
Used to multiply a BN by a fraction
targetBN
BN The number to multiply by a fractionnumerator
(number | string) The numerator of the fraction multiplierdenominator
(number | string) The denominator of the fraction multiplier
Returns BN The product of the multiplication
adds a hex prefix does not change the original string
str
hex
string value
Returns string hex value with 0x
in the beginning
removes hex prefix does not change the original string
str
hex
string value
Returns string hex value with 0x
removed from the beginning