Constructor
new TxGasUtil(provider)
Parameters:
Name | Type | Description |
---|---|---|
provider |
Object | A network provider. |
Methods
addGasBuffer(initialGasLimitHex, blockGasLimitHex) → {string}
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}
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}
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)
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 |