diff --git a/pycardano/txbuilder.py b/pycardano/txbuilder.py index e3e68471..96f2fcd1 100644 --- a/pycardano/txbuilder.py +++ b/pycardano/txbuilder.py @@ -88,6 +88,9 @@ class TransactionBuilder: execution_step_buffer: float = 0.2 """Additional amount of execution step (in ratio) that will be added on top of estimation""" + fee_buffer: Optional[int] = field(default=None) + """Additional amount of fee (in lovelace) that will be added on top of estimation.""" + ttl: Optional[int] = field(default=None) validity_start: Optional[int] = field(default=None) @@ -544,6 +547,9 @@ def _merge_changes(changes): # With changes included, we can estimate the fee more precisely self.fee = self._estimate_fee() + # Beyond this, the computed fee is not updated anymore so we can add the fee buffer + if self.fee_buffer is not None: + self.fee += self.fee_buffer if change_address: self._outputs = original_outputs @@ -872,6 +878,8 @@ def _estimate_fee(self): plutus_execution_units.steps, plutus_execution_units.mem, ) + if self.fee_buffer is not None: + estimated_fee += self.fee_buffer return estimated_fee