Skip to content

Commit

Permalink
Updated Beaverbuild params, changed it's cancellation method
Browse files Browse the repository at this point in the history
  • Loading branch information
gabedonnan committed Dec 27, 2023
1 parent d91c6c9 commit 9cde506
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pythereum/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -101,18 +104,18 @@ def __init__(self):
"https://rpc.beaverbuild.org/",
"eth_sendPrivateRawTransaction",
"eth_sendBundle",
"eth_cancelBundle",
"eth_sendBundle",
"beaverbuild.org",
{
"txs",
"blockNumber",
"minTimestamp",
"maxTimestamp",
"revertingTxHashes",
"uuid",
"replacementUuid",
"refundPercent",
"refundRecipient",
"refundTxHashes",
},
)

Expand All @@ -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):
Expand Down Expand Up @@ -167,7 +175,8 @@ def __init__(self):
"minTimestamp",
"maxTimestamp",
"revertingTxHashes",
"uuid" "replacementUuid",
"uuid",
"replacementUuid",
"refundPercent",
"refundRecipient",
},
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9cde506

Please sign in to comment.