apply_median_gas_strategy
Function
def apply_median_gas_strategy(tx, tx_amount=100):
median_gas_price = get_average_gas_prices('median', tx_amount)['gas_price']
tx['maxFeePerGas'] = int(web3.to_wei(median_gas_price, 'wei'))
tx['maxPriorityFeePerGas'] = web3.to_wei(500, 'gwei')
return tx
Description
Get the median gas price
Set it to maxFeePerGas
Set a default value for maxPriorityFeePerGas
Return the transaction