1- from solders .pubkey import Pubkey
21from solana .rpc .types import TxOpts
32
4- from pyxfluencer .utils import get_local_keypair_pubkey , select_client , sign_and_send_transaction_sync
3+ from pathlib import Path
4+ from solders .pubkey import Pubkey # type: ignore
5+ from anchorpy import Idl , Program
6+
7+ import asyncio
8+ from solders .system_program import ID as SYS_PROGRAM_ID
9+
10+
11+ from pyxfluencer .utils import get_local_keypair_pubkey , select_client
512from pyxfluencer .utils import sign_and_send_transaction
613from pyxfluencer .program_id import PROGRAM_ID
714
@@ -21,7 +28,8 @@ async def main():
2128
2229 configuration = load_configuration ()
2330
24- network = configuration ["network" ]
31+ network = configuration ["rpc" ]["mainnet" ]
32+
2533
2634 print ("Network selected: " ,network )
2735 client = select_client (network = network , async_client = False )
@@ -36,11 +44,7 @@ async def main():
3644 #print(validation) # way to get base58 from keypair seed
3745
3846 _ , validation_authority_pk = get_local_keypair_pubkey (path = keypair_paths .validation_authority )
39-
40- #business, business_pk = get_local_keypair_pubkey(path=keypair_paths.bussines_keypair)
41- business , business_pk = get_local_keypair_pubkey (path = keypair_paths .bussines_GQRD )
42-
43-
47+ business , business_pk = get_local_keypair_pubkey (path = keypair_paths .bussines_keypair )
4448 _ , influencer_pk = get_local_keypair_pubkey (path = keypair_paths .influencer_keypair )
4549
4650 assert str (validation_authority_pk ) == configuration ["platform" ]
@@ -66,8 +70,8 @@ async def main():
6670 amount = configuration ["amount" ]["lamports" ]
6771 order_code = configuration ["order_code" ]
6872
69- args = {"amount" :int (amount ),
70- "order_code" :int (order_code ) }
73+ args = {"amount" :int (amount ),
74+ "order_code" :int (order_code )}
7175
7276 SEEDS = [b"escrow" ,
7377 bytes (business_pk ),
@@ -84,20 +88,20 @@ async def main():
8488 "to" :influencer_pk
8589 }
8690
91+ client = select_client (network = network , async_client = False )
92+
93+ latest_blockhash = client .get_latest_blockhash ().value .last_valid_block_height
94+
95+
8796 opts = TxOpts (skip_confirmation = False ,
8897 skip_preflight = False ,
98+ max_retries = 1 ,
99+ last_valid_block_height = latest_blockhash ,
89100 preflight_commitment = "processed" )
90101
91-
92102 print_tittle ("Instruction description" )
93103
94-
95-
96-
97104 ix = create_escrow (args , accounts , program_id = PROGRAM_ID )
98-
99- print (ix )
100-
101105 signers = [business ]
102106
103107 ## forming the transaction
@@ -113,7 +117,6 @@ async def main():
113117 #sign_status = await sign_and_send_transaction(ix, signers, opts, network)
114118 #sign_status = sign_and_send_transaction_sync(ix, signers, opts, network)
115119
116- #print(sign_status)
117120 try :
118121 print ("Network selected: " ,network )
119122 client = select_client (network = network , async_client = False )
@@ -124,7 +127,6 @@ async def main():
124127
125128 #print(simulate_response.value.err)
126129
127- #exit()
128130 print ("Start Sending transactions with options" , opts )
129131
130132 tx_res = client .send_transaction (tx , * signers , opts = opts )
@@ -139,8 +141,9 @@ async def main():
139141 return signature_status .to_json ()
140142 except RPCException as e :
141143 raise RPCException (f"RPC exception happened: { e } " )
144+
145+
142146
143- import asyncio
144147
145148asyncio .run (main ())
146149
0 commit comments