abstract-solana 0.0.0.68__py3-none-any.whl → 0.0.0.69__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of abstract-solana might be problematic. Click here for more details.
- abstract_solana/pumpFun/buy_sell_pump.py +40 -29
- {abstract_solana-0.0.0.68.dist-info → abstract_solana-0.0.0.69.dist-info}/METADATA +1 -1
- {abstract_solana-0.0.0.68.dist-info → abstract_solana-0.0.0.69.dist-info}/RECORD +5 -5
- {abstract_solana-0.0.0.68.dist-info → abstract_solana-0.0.0.69.dist-info}/WHEEL +0 -0
- {abstract_solana-0.0.0.68.dist-info → abstract_solana-0.0.0.69.dist-info}/top_level.txt +0 -0
|
@@ -13,28 +13,6 @@ from ..constants import PUMP_FUN_PROGRAM_PUBKEY,LAMPORTS_PER_SOL,UNIT_PRICE,UNIT
|
|
|
13
13
|
from solders.compute_budget import set_compute_unit_limit, set_compute_unit_price
|
|
14
14
|
from .token_utils import get_token_balance,check_existing_token_account,get_token_price
|
|
15
15
|
from .pump_fun_keys import getKeys
|
|
16
|
-
async def confirm_txn(txn_sig, max_retries=20, retry_interval=3):
|
|
17
|
-
retries = 0
|
|
18
|
-
while retries < max_retries:
|
|
19
|
-
txn_res = getTransaction(signature=str(txn_sig))
|
|
20
|
-
if txn_res:
|
|
21
|
-
print(f"\n\nhttps://solscan.io/tx/{str(txn_sig)}")
|
|
22
|
-
return txn_res
|
|
23
|
-
retries += 1
|
|
24
|
-
print(f"Retrying... ({retries}/{max_retries})")
|
|
25
|
-
await asyncio.sleep(retry_interval)
|
|
26
|
-
print(f"Failed to confirm transaction after {max_retries} attempts.")
|
|
27
|
-
return txn_sig
|
|
28
|
-
async def complete_txn(txn, payer_keypair):
|
|
29
|
-
txn_sig = sendTransaction(txn=txn,payer_keypair=payer_keypair, skip_preflight=True)
|
|
30
|
-
print("Transaction Signature", txn_sig)
|
|
31
|
-
confirm = await confirm_txn(txn_sig)
|
|
32
|
-
while not confirm:
|
|
33
|
-
print("Waiting for transaction confirmation...")
|
|
34
|
-
time.sleep(1) # Wait for 1 second before checking again
|
|
35
|
-
confirm = confirm_txn(txn_sig)
|
|
36
|
-
print("Transaction confirmed:", confirm)
|
|
37
|
-
return confirm
|
|
38
16
|
def buildTxn(mint,payer_pubkey, amount, slippage, token_account,sol_in=0,token_price=0,token_balance=0,token_account_instructions=None,close_token_account=False,buy=True):
|
|
39
17
|
# Get keys for the transaction, pass the token account's pubkey instead of the AccountMeta object
|
|
40
18
|
keys = getKeys(mint, token_account=token_account, payer_pubkey=payer_pubkey,buy=buy)
|
|
@@ -124,22 +102,55 @@ def pump_fun_buy(mint: str,payer_pubkey:Pubkey, sol_in: float = 0.001, slippage:
|
|
|
124
102
|
token_account_instructions=token_account_instructions,
|
|
125
103
|
buy=True)
|
|
126
104
|
return True
|
|
105
|
+
async def confirm_txn(txn_sig, max_retries=20, retry_interval=3):
|
|
106
|
+
retries = 0
|
|
107
|
+
while retries < max_retries:
|
|
108
|
+
txn_res = getTransaction(signature=str(txn_sig))
|
|
109
|
+
if txn_res:
|
|
110
|
+
print(f"\n\nhttps://solscan.io/tx/{str(txn_sig)}")
|
|
111
|
+
return txn_res
|
|
112
|
+
retries += 1
|
|
113
|
+
print(f"Retrying... ({retries}/{max_retries})")
|
|
114
|
+
await asyncio.sleep(retry_interval)
|
|
115
|
+
print(f"Failed to confirm transaction after {max_retries} attempts.")
|
|
116
|
+
return txn_sig
|
|
117
|
+
async def complete_txn(txn, payer_keypair):
|
|
118
|
+
txn_sig = await sendTransaction(txn=txn, payer_keypair=payer_keypair, skip_preflight=True) # Await this async call
|
|
119
|
+
print("Transaction Signature", txn_sig)
|
|
120
|
+
confirm = await confirm_txn(txn_sig) # Await confirmation
|
|
121
|
+
|
|
122
|
+
while not confirm:
|
|
123
|
+
print("Waiting for transaction confirmation...")
|
|
124
|
+
await asyncio.sleep(1) # Use asyncio.sleep instead of time.sleep to avoid blocking
|
|
125
|
+
confirm = await confirm_txn(txn_sig) # Await confirmation check again
|
|
126
|
+
|
|
127
|
+
print("Transaction confirmed:", confirm)
|
|
128
|
+
return confirm
|
|
127
129
|
|
|
128
|
-
def
|
|
130
|
+
async def buy_pump_sync(mint: str, payer_keypair: Pubkey, sol_in=None, slippage=None):
|
|
129
131
|
sol_in = sol_in or 0.001
|
|
130
132
|
slippage = slippage or 25
|
|
131
133
|
payer_pubkey = get_pubkey(payer_keypair.pubkey())
|
|
132
|
-
txn = pump_fun_buy(mint=mint, payer_pubkey=payer_pubkey,sol_in=sol_in,slippage=slippage)
|
|
133
|
-
|
|
134
|
+
txn = pump_fun_buy(mint=mint, payer_pubkey=payer_pubkey, sol_in=sol_in, slippage=slippage)
|
|
135
|
+
|
|
136
|
+
completed = await complete_txn(txn, payer_keypair) # Await here since `complete_txn` is async
|
|
134
137
|
if not completed:
|
|
135
138
|
print("Buy transaction failed")
|
|
136
139
|
return completed
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def sell_pump_sync(mint: str, payer_keypair: Pubkey, token_balance=None, slippage=None):
|
|
139
143
|
slippage = slippage or 25
|
|
140
144
|
payer_pubkey = get_pubkey(payer_keypair.pubkey())
|
|
141
145
|
txn = pump_fun_sell(mint=mint, payer_pubkey=payer_pubkey, token_balance=token_balance, slippage=slippage)
|
|
142
|
-
|
|
146
|
+
|
|
147
|
+
completed = await complete_txn(txn, payer_keypair) # Await here since `complete_txn` is async
|
|
143
148
|
if not completed:
|
|
144
|
-
print("
|
|
149
|
+
print("Sell transaction failed")
|
|
145
150
|
return completed
|
|
151
|
+
|
|
152
|
+
def buy_pump(mint: str, payer_keypair: Pubkey, sol_in=None, slippage=None):
|
|
153
|
+
return asyncio.run(buy_pump_sync(mint, payer_keypair, sol_in, slippage))
|
|
154
|
+
|
|
155
|
+
def sell_pump(mint: str, payer_keypair: Pubkey, token_balance=None, slippage=None):
|
|
156
|
+
return asyncio.run(sell_pump_sync(mint, payer_keypair, token_balance, slippage))
|
|
@@ -11,11 +11,11 @@ abstract_solana/pumpFunKeys.py,sha256=KHZyQ_GFS9XzmNNMzEDQkAZsiM5Mpua6ZE1e3WebEr
|
|
|
11
11
|
abstract_solana/signature_data_parse.py,sha256=5AOMtJZADWcwR0JLDbd2kXZNzW129qeB0lvYUrE_tm0,1974
|
|
12
12
|
abstract_solana/utils.py,sha256=RcnGEiZ0aJbcw8ObpjHU3WUFU4Tmy-exCs6qIbEu4_c,444
|
|
13
13
|
abstract_solana/pumpFun/__init__.py,sha256=BiRxwJd1JWwEft63zqYwZ_Xs6UDp4hjczjzvuwy3sHg,85
|
|
14
|
-
abstract_solana/pumpFun/buy_sell_pump.py,sha256=
|
|
14
|
+
abstract_solana/pumpFun/buy_sell_pump.py,sha256=Q23BE3J2C2nEEIHqexXHzm9VIw-ORMwMCZhSMiTjePU,8080
|
|
15
15
|
abstract_solana/pumpFun/pumpFunKeys.py,sha256=yMS_fT-0ESndluVpZ17XdMhpXVtSfhtIG5njy7DJkfI,7961
|
|
16
16
|
abstract_solana/pumpFun/pump_fun_keys.py,sha256=3ykkcogaptbzJ6MwI6OWzUdo5rA1qW54fY0KAJAXgIc,8050
|
|
17
17
|
abstract_solana/pumpFun/token_utils.py,sha256=NhMvpTnw3QZk8DmeKYFzuqEMEZEHUlrBKfFp7662ohw,2684
|
|
18
|
-
abstract_solana-0.0.0.
|
|
19
|
-
abstract_solana-0.0.0.
|
|
20
|
-
abstract_solana-0.0.0.
|
|
21
|
-
abstract_solana-0.0.0.
|
|
18
|
+
abstract_solana-0.0.0.69.dist-info/METADATA,sha256=-dsUxie4sztnzHr9wJp65AEXZPeu1BfY-tCQPIDOKvg,981
|
|
19
|
+
abstract_solana-0.0.0.69.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
|
20
|
+
abstract_solana-0.0.0.69.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
|
|
21
|
+
abstract_solana-0.0.0.69.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|