core icon indicating copy to clipboard operation
core copied to clipboard

[Feature][Primitive] Allow ParseUnits to be converted to u128

Open NicolasWent opened this issue 10 months ago • 1 comments

Component

primitives

Describe the feature you would like

The gas configurations have been set to u128 instead of U256 in the alloy TransactionBuilder

It would be nice to have an into() implementation for a ParseUnits to convert it directly to u128.

This way we would be able to set the max priority fee per gas (and max_fee_per_gas) more smoothly:

// Currently not working:
my_transaction_builder.max_priority_fee_per_gas(parse_units("0.1", "gwei").unwrap().into());

Instead of the current workaround:

let max_priority_fee_per_gas: U256 = parse_units("0.1", "gwei").unwrap().into();
my_transaction_build.max_priority_fee_per_gas(max_priority_fee_per_gas.to());

NicolasWent avatar Apr 09 '24 13:04 NicolasWent