abstract-solana 0.0.0.34__tar.gz → 0.0.0.36__tar.gz
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-0.0.0.34 → abstract_solana-0.0.0.36}/PKG-INFO +1 -1
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/setup.py +1 -1
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/buy_sell_pump.py +24 -27
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/PKG-INFO +1 -1
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/README.md +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/setup.cfg +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/__init__.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/account_key_utils.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/constants.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/genesis_functions.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/index_utils.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/keypair_utils.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/log_message_functions.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/price_utils.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pubkey_utils.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/__init__.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/pump_fun_keys.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/token_utils.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/signature_data_parse.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/utils.py +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/SOURCES.txt +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/dependency_links.txt +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/requires.txt +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/top_level.txt +0 -0
- {abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/test/test_abstract_solana.py +0 -0
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/buy_sell_pump.py
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import struct,base58,time
|
|
2
|
+
from typing import Optional,Union
|
|
2
3
|
from solders.hash import Hash
|
|
3
4
|
from solders.keypair import Keypair
|
|
4
5
|
from solders.instruction import Instruction
|
|
@@ -60,9 +61,9 @@ def confirm_txn(txn_sig, max_retries=20, retry_interval=3):
|
|
|
60
61
|
time.sleep(retry_interval)
|
|
61
62
|
print("Max retries reached. Transaction confirmation failed.")
|
|
62
63
|
return None
|
|
63
|
-
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):
|
|
64
|
+
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):
|
|
64
65
|
# Get keys for the transaction, pass the token account's pubkey instead of the AccountMeta object
|
|
65
|
-
keys = getKeys(get_coin_data(mint), token_account_pubkey,
|
|
66
|
+
keys = getKeys(get_coin_data(mint), token_account_pubkey, payer_pubkey,buy=buy)
|
|
66
67
|
slippage_adjustment = 1 - (slippage / 100)
|
|
67
68
|
sol_change = sol_in if buy else float(token_balance) * float(token_price)
|
|
68
69
|
sol_change_with_slippage = sol_change * slippage_adjustment
|
|
@@ -77,25 +78,21 @@ def buildTxn(mint, amount, slippage, token_account_pubkey,sol_in=0,token_price=0
|
|
|
77
78
|
blockHash = getLatestBlockhash(commitment="processed")
|
|
78
79
|
recent_blockhash = get_any_value(blockHash.json(),'blockhash')
|
|
79
80
|
recent_blockhash = Hash.from_string(recent_blockhash)
|
|
80
|
-
txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=
|
|
81
|
+
txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=payer_pubkey)
|
|
81
82
|
txn.add(set_compute_unit_price(UNIT_PRICE))
|
|
82
83
|
txn.add(set_compute_unit_limit(UNIT_BUDGET))
|
|
83
84
|
if buy and token_account_instructions:
|
|
84
85
|
txn.add(token_account_instructions)
|
|
85
86
|
txn.add(swap_instruction)
|
|
86
87
|
if buy == False and close_token_account:
|
|
87
|
-
close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey,
|
|
88
|
+
close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey, payer_pubkey, payer_pubkey))
|
|
88
89
|
txn.add(close_account_instructions)
|
|
89
90
|
txn.sign(payer_keypair)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
print(confirm)
|
|
94
|
-
def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
|
|
91
|
+
return txn
|
|
92
|
+
|
|
93
|
+
def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
|
|
95
94
|
try:
|
|
96
|
-
|
|
97
|
-
payer_pubkey = payer_keypair.pubkey()
|
|
98
|
-
print("Owner Public Key:", owner)
|
|
95
|
+
print("Owner Public Key:", payer_pubkey)
|
|
99
96
|
mint_str = str(mint)
|
|
100
97
|
if not get_pubkey(mint_str).is_on_curve():
|
|
101
98
|
print('Mint public key is not on curve')
|
|
@@ -109,7 +106,7 @@ def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
|
|
|
109
106
|
print("Failed to retrieve coin data...")
|
|
110
107
|
return False
|
|
111
108
|
mint_pubkey = get_pubkey(mint_str)
|
|
112
|
-
token_account, token_account_instructions = check_existing_token_account(
|
|
109
|
+
token_account, token_account_instructions = check_existing_token_account(payer_pubkey, mint_pubkey)
|
|
113
110
|
token_account_pubkey = get_pubkey(token_account)
|
|
114
111
|
# Ensure the token_account is a valid Pubkey
|
|
115
112
|
if not isinstance(token_account_pubkey, Pubkey):
|
|
@@ -133,22 +130,22 @@ def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
|
|
|
133
130
|
except Exception as e:
|
|
134
131
|
print(e)
|
|
135
132
|
|
|
136
|
-
def pump_fun_sell(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
133
|
+
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:
|
|
134
|
+
mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,payer_pubkey,token_balance=token_balance)
|
|
135
|
+
return buildTxn(mint=mint,
|
|
136
|
+
amount=amount,
|
|
137
|
+
slippage=slippage,
|
|
138
|
+
sol_in=0,
|
|
139
|
+
token_balance=token_balance,
|
|
140
|
+
token_price=token_price,
|
|
141
|
+
token_account_pubkey=token_account_pubkey,
|
|
142
|
+
token_account_instructions=token_account_instructions,
|
|
143
|
+
buy=False)
|
|
147
144
|
|
|
148
|
-
def pump_fun_buy(
|
|
149
|
-
mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,
|
|
145
|
+
def pump_fun_buy(mint: str,payer_pubkey:Pubkey, sol_in: float = 0.001, slippage: int = 25) -> bool:
|
|
146
|
+
mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,payer_pubkey,sol_in=sol_in)
|
|
150
147
|
# Build the transaction
|
|
151
|
-
buildTxn(mint=mint,
|
|
148
|
+
return buildTxn(mint=mint,
|
|
152
149
|
amount=amount,
|
|
153
150
|
slippage=slippage,
|
|
154
151
|
sol_in=sol_in,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/account_key_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/genesis_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/log_message_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/__init__.py
RENAMED
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/pump_fun_keys.py
RENAMED
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/pumpFun/token_utils.py
RENAMED
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana/signature_data_parse.py
RENAMED
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/requires.txt
RENAMED
|
File without changes
|
{abstract_solana-0.0.0.34 → abstract_solana-0.0.0.36}/src/abstract_solana.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|