Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Update execution_engine.py #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
7 changes: 3 additions & 4 deletions utils/execution_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
from solana.rpc.types import TxOpts

def execute(api_endpoint, tx, signers, max_retries=3, skip_confirmation=True, max_timeout=60, target=20, finalized=True):
client = Client(api_endpoint)
signers = list(map(Keypair, set(map(lambda s: s.seed, signers))))
client = Client(api_endpoint)
for attempt in range(max_retries):
try:
result = client.send_transaction(tx, *signers, opts=TxOpts(skip_preflight=True))
result = client.send_transaction(tx, *signers, opts=TxOpts(skip_preflight=False))
print(result)
signatures = [x.signature for x in tx.signatures]
if not skip_confirmation:
Expand Down Expand Up @@ -37,4 +36,4 @@ def await_confirmation(client, signatures, max_timeout=60, target=20, finalized=
return
elif is_finalized:
print(f"Took {elapsed} seconds to confirm transaction")
return
return