Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions jito_searcher_client/jito_searcher_client/convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from solana.transaction import Transaction
try:
from solana.transaction import Transaction
IS_SOLANA_TRANSACTION = True
except ModuleNotFoundError:
# this allows support of newer 0.35+ versions of solana package
from solders.transaction import Transaction
IS_SOLANA_TRANSACTION = False
from solders.transaction import VersionedTransaction

from jito_searcher_client.generated.packet_pb2 import Meta, Packet
Expand All @@ -21,6 +27,6 @@ def tx_to_protobuf_packet(tx: Transaction) -> Packet:
Note: setting packet.meta.size is required, the rest are optional
"""
return Packet(
data=tx.serialize(),
data=tx.serialize() if IS_SOLANA_TRANSACTION else bytes(tx),
meta=Meta(size=len(tx.serialize()), addr="0.0.0.0", port=0, flags=None, sender_stake=0),
)