From 9cde5064d3bcc46552623480ce621a212297eead Mon Sep 17 00:00:00 2001 From: gmandonnan Date: Wed, 27 Dec 2023 10:16:16 +0000 Subject: [PATCH] Updated Beaverbuild params, changed it's cancellation method --- pythereum/builders.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pythereum/builders.py b/pythereum/builders.py index bcc72cb..7886cea 100644 --- a/pythereum/builders.py +++ b/pythereum/builders.py @@ -59,6 +59,9 @@ def format_private_transaction( def format_bundle(self, bundle: dict | Bundle) -> list[dict]: return [{key: bundle[key] for key in bundle.keys() & self.bundle_params}] + def format_cancellation(self, uuids: HexStr | str | list[HexStr] | list[str]): + return [uuids] + def __hash__(self): return self.builder_name @@ -101,7 +104,7 @@ def __init__(self): "https://rpc.beaverbuild.org/", "eth_sendPrivateRawTransaction", "eth_sendBundle", - "eth_cancelBundle", + "eth_sendBundle", "beaverbuild.org", { "txs", @@ -109,10 +112,10 @@ def __init__(self): "minTimestamp", "maxTimestamp", "revertingTxHashes", + "uuid", "replacementUuid", "refundPercent", "refundRecipient", - "refundTxHashes", }, ) @@ -123,6 +126,11 @@ def format_private_transaction( ) -> list[Any]: return [tx] + def format_cancellation(self, uuids: HexStr | str | list[HexStr] | list[str]): + if isinstance(uuids, str): + return [Bundle(uuid=uuids, txs=[])] + return [[Bundle(uuid=uuid, txs=[]) for uuid in uuids]] + class RsyncBuilder(Builder): def __init__(self): @@ -167,7 +175,8 @@ def __init__(self): "minTimestamp", "maxTimestamp", "revertingTxHashes", - "uuid" "replacementUuid", + "uuid", + "replacementUuid", "refundPercent", "refundRecipient", }, @@ -392,7 +401,7 @@ async def cancel_bundle( self._send_message( builder, builder.cancel_bundle_method, - [replacement_uuids], + builder.format_cancellation(replacement_uuids), isinstance(builder, FLASHBOTS_BUILDER_TYPES), ) for builder in self.builders