abstract-solana 0.0.0.32__py3-none-any.whl → 0.0.0.33__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 +23 -27
- {abstract_solana-0.0.0.32.dist-info → abstract_solana-0.0.0.33.dist-info}/METADATA +1 -1
- {abstract_solana-0.0.0.32.dist-info → abstract_solana-0.0.0.33.dist-info}/RECORD +5 -5
- {abstract_solana-0.0.0.32.dist-info → abstract_solana-0.0.0.33.dist-info}/WHEEL +0 -0
- {abstract_solana-0.0.0.32.dist-info → abstract_solana-0.0.0.33.dist-info}/top_level.txt +0 -0
|
@@ -59,9 +59,9 @@ def confirm_txn(txn_sig, max_retries=20, retry_interval=3):
|
|
|
59
59
|
time.sleep(retry_interval)
|
|
60
60
|
print("Max retries reached. Transaction confirmation failed.")
|
|
61
61
|
return None
|
|
62
|
-
def buildTxn(mint, amount, slippage, token_account_pubkey,sol_in=0,token_price=0,token_balance=0,token_account_instructions=None,close_token_account=False,buy=True):
|
|
62
|
+
def buildTxn(mint,payer_pubkey, amount, slippage, token_account_pubkey,sol_in=0,token_price=0,token_balance=0,token_account_instructions=None,close_token_account=False,buy=True):
|
|
63
63
|
# Get keys for the transaction, pass the token account's pubkey instead of the AccountMeta object
|
|
64
|
-
keys = getKeys(get_coin_data(mint), token_account_pubkey,
|
|
64
|
+
keys = getKeys(get_coin_data(mint), token_account_pubkey, payer_pubkey,buy=buy)
|
|
65
65
|
slippage_adjustment = 1 - (slippage / 100)
|
|
66
66
|
sol_change = sol_in if buy else float(token_balance) * float(token_price)
|
|
67
67
|
sol_change_with_slippage = sol_change * slippage_adjustment
|
|
@@ -76,25 +76,21 @@ def buildTxn(mint, amount, slippage, token_account_pubkey,sol_in=0,token_price=0
|
|
|
76
76
|
blockHash = getLatestBlockhash(commitment="processed")
|
|
77
77
|
recent_blockhash = get_any_value(blockHash.json(),'blockhash')
|
|
78
78
|
recent_blockhash = Hash.from_string(recent_blockhash)
|
|
79
|
-
txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=
|
|
79
|
+
txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=payer_pubkey)
|
|
80
80
|
txn.add(set_compute_unit_price(UNIT_PRICE))
|
|
81
81
|
txn.add(set_compute_unit_limit(UNIT_BUDGET))
|
|
82
82
|
if buy and token_account_instructions:
|
|
83
83
|
txn.add(token_account_instructions)
|
|
84
84
|
txn.add(swap_instruction)
|
|
85
85
|
if buy == False and close_token_account:
|
|
86
|
-
close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey,
|
|
86
|
+
close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey, payer_pubkey, payer_pubkey))
|
|
87
87
|
txn.add(close_account_instructions)
|
|
88
88
|
txn.sign(payer_keypair)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
print(confirm)
|
|
93
|
-
def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
|
|
89
|
+
return txn
|
|
90
|
+
|
|
91
|
+
def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
|
|
94
92
|
try:
|
|
95
|
-
|
|
96
|
-
payer_pubkey = payer_keypair.pubkey()
|
|
97
|
-
print("Owner Public Key:", owner)
|
|
93
|
+
print("Owner Public Key:", payer_pubkey)
|
|
98
94
|
mint_str = str(mint)
|
|
99
95
|
if not get_pubkey(mint_str).is_on_curve():
|
|
100
96
|
print('Mint public key is not on curve')
|
|
@@ -108,7 +104,7 @@ def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
|
|
|
108
104
|
print("Failed to retrieve coin data...")
|
|
109
105
|
return False
|
|
110
106
|
mint_pubkey = get_pubkey(mint_str)
|
|
111
|
-
token_account, token_account_instructions = check_existing_token_account(
|
|
107
|
+
token_account, token_account_instructions = check_existing_token_account(payer_pubkey, mint_pubkey)
|
|
112
108
|
token_account_pubkey = get_pubkey(token_account)
|
|
113
109
|
# Ensure the token_account is a valid Pubkey
|
|
114
110
|
if not isinstance(token_account_pubkey, Pubkey):
|
|
@@ -132,22 +128,22 @@ def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
|
|
|
132
128
|
except Exception as e:
|
|
133
129
|
print(e)
|
|
134
130
|
|
|
135
|
-
def pump_fun_sell(mint: str, token_balance: Optional[Union[int, float]] = None, slippage: int = 25, close_token_account: bool = True) -> bool:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
131
|
+
def pump_fun_sell(mint: str,payer_pubkey:Pubkey, token_balance: Optional[Union[int, float]] = None, slippage: int = 25, close_token_account: bool = True) -> bool:
|
|
132
|
+
mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,payer_pubkey,token_balance=token_balance)
|
|
133
|
+
return buildTxn(mint=mint,
|
|
134
|
+
amount=amount,
|
|
135
|
+
slippage=slippage,
|
|
136
|
+
sol_in=0,
|
|
137
|
+
token_balance=token_balance,
|
|
138
|
+
token_price=token_price,
|
|
139
|
+
token_account_pubkey=token_account_pubkey,
|
|
140
|
+
token_account_instructions=token_account_instructions,
|
|
141
|
+
buy=False)
|
|
146
142
|
|
|
147
|
-
def pump_fun_buy(mint: str, sol_in: float = 0.001, slippage: int = 25) -> bool:
|
|
148
|
-
mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,
|
|
143
|
+
def pump_fun_buy(mint: str,payer_pubkey:Pubkey, sol_in: float = 0.001, slippage: int = 25) -> bool:
|
|
144
|
+
mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,payer_pubkey,sol_in=sol_in)
|
|
149
145
|
# Build the transaction
|
|
150
|
-
buildTxn(mint=mint,
|
|
146
|
+
return buildTxn(mint=mint,
|
|
151
147
|
amount=amount,
|
|
152
148
|
slippage=slippage,
|
|
153
149
|
sol_in=sol_in,
|
|
@@ -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=e3YFwZKK3E01UICiQ466tqAL8zak3_2n64bXkSjKqEc,7133
|
|
15
15
|
abstract_solana/pumpFun/pumpFunKeys.py,sha256=yMS_fT-0ESndluVpZ17XdMhpXVtSfhtIG5njy7DJkfI,7961
|
|
16
16
|
abstract_solana/pumpFun/pump_fun_keys.py,sha256=lL7afQx3-PYOHz69rm7Cyr2_tLp0nFXLZAd-7tvztm8,7963
|
|
17
17
|
abstract_solana/pumpFun/token_utils.py,sha256=oDvY0YVn8vWwSS3yS-tpZVxb3IvqovGPFicxiXg7YHI,2297
|
|
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.33.dist-info/METADATA,sha256=39mcrvz5zA8xwOUOIExRDGlCyHoYKRE--4zo22LA86E,924
|
|
19
|
+
abstract_solana-0.0.0.33.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
|
20
|
+
abstract_solana-0.0.0.33.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
|
|
21
|
+
abstract_solana-0.0.0.33.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|