abstract-solana 0.0.0.36__py3-none-any.whl → 0.0.0.38__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.

@@ -8,3 +8,4 @@ from .utils import *
8
8
  from .log_message_functions import *
9
9
  from .constants import *
10
10
  from .pumpFun import *
11
+ from .keypair_utils import *
@@ -1,4 +1,6 @@
1
1
  from abstract_security import *
2
+ from solders.keypair import Keypair
3
+ import base58
2
4
  def load_from_private_key(env_key='AMM_P'):
3
5
  env_value = get_env_value(key=env_key)
4
6
  if env_value:
@@ -1,7 +1,5 @@
1
1
  import struct,base58,time
2
- from typing import Optional,Union
3
2
  from solders.hash import Hash
4
- from solders.keypair import Keypair
5
3
  from solders.instruction import Instruction
6
4
  from solana.rpc.types import TokenAccountOpts,TxOpts
7
5
  from solana.transaction import Transaction
@@ -61,9 +59,9 @@ def confirm_txn(txn_sig, max_retries=20, retry_interval=3):
61
59
  time.sleep(retry_interval)
62
60
  print("Max retries reached. Transaction confirmation failed.")
63
61
  return None
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):
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):
65
63
  # Get keys for the transaction, pass the token account's pubkey instead of the AccountMeta object
66
- keys = getKeys(get_coin_data(mint), token_account_pubkey, payer_pubkey,buy=buy)
64
+ keys = getKeys(get_coin_data(mint), token_account_pubkey, owner,buy=buy)
67
65
  slippage_adjustment = 1 - (slippage / 100)
68
66
  sol_change = sol_in if buy else float(token_balance) * float(token_price)
69
67
  sol_change_with_slippage = sol_change * slippage_adjustment
@@ -78,21 +76,25 @@ def buildTxn(mint,payer_pubkey, amount, slippage, token_account_pubkey,sol_in=0,
78
76
  blockHash = getLatestBlockhash(commitment="processed")
79
77
  recent_blockhash = get_any_value(blockHash.json(),'blockhash')
80
78
  recent_blockhash = Hash.from_string(recent_blockhash)
81
- txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=payer_pubkey)
79
+ txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=owner)
82
80
  txn.add(set_compute_unit_price(UNIT_PRICE))
83
81
  txn.add(set_compute_unit_limit(UNIT_BUDGET))
84
82
  if buy and token_account_instructions:
85
83
  txn.add(token_account_instructions)
86
84
  txn.add(swap_instruction)
87
85
  if buy == False and close_token_account:
88
- close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey, payer_pubkey, payer_pubkey))
86
+ close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey, owner, owner))
89
87
  txn.add(close_account_instructions)
90
88
  txn.sign(payer_keypair)
91
- return txn
92
-
93
- def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
89
+ txn_sig = sendTransaction(txn, payer_keypair, TxOpts(skip_preflight=True))
90
+ print("Transaction Signature", txn_sig)
91
+ confirm = confirm_txn(txn_sig)
92
+ print(confirm)
93
+ def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
94
94
  try:
95
- print("Owner Public Key:", payer_pubkey)
95
+ payer_keypair = payer_keypair or load_from_private_key()
96
+ payer_pubkey = payer_keypair.pubkey()
97
+ print("Owner Public Key:", owner)
96
98
  mint_str = str(mint)
97
99
  if not get_pubkey(mint_str).is_on_curve():
98
100
  print('Mint public key is not on curve')
@@ -106,7 +108,7 @@ def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
106
108
  print("Failed to retrieve coin data...")
107
109
  return False
108
110
  mint_pubkey = get_pubkey(mint_str)
109
- token_account, token_account_instructions = check_existing_token_account(payer_pubkey, mint_pubkey)
111
+ token_account, token_account_instructions = check_existing_token_account(owner, mint_pubkey)
110
112
  token_account_pubkey = get_pubkey(token_account)
111
113
  # Ensure the token_account is a valid Pubkey
112
114
  if not isinstance(token_account_pubkey, Pubkey):
@@ -130,22 +132,22 @@ def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
130
132
  except Exception as e:
131
133
  print(e)
132
134
 
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)
135
+ def pump_fun_sell(mint_str: str, token_balance: Optional[Union[int, float]] = None, slippage: int = 25, close_token_account: bool = True) -> bool:
136
+ mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,payer_keypair,token_balance)
137
+ buildTxn(mint=mint,
138
+ amount=amount,
139
+ slippage=slippage,
140
+ sol_in=0,
141
+ token_balance=token_balance,
142
+ token_price=token_price,
143
+ token_account_pubkey=token_account_pubkey,
144
+ token_account_instructions=token_account_instructions,
145
+ buy=False)
144
146
 
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)
147
+ def pump_fun_buy(mint_str: 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,payer_keypair)
147
149
  # Build the transaction
148
- return buildTxn(mint=mint,
150
+ buildTxn(mint=mint,
149
151
  amount=amount,
150
152
  slippage=slippage,
151
153
  sol_in=sol_in,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abstract_solana
3
- Version: 0.0.0.36
3
+ Version: 0.0.0.38
4
4
  Home-page: https://github.com/AbstractEndeavors/abstract_solana
5
5
  Author: putkoff
6
6
  Author-email: partners@abstractendeavors.com
@@ -1,9 +1,9 @@
1
- abstract_solana/__init__.py,sha256=7VqcDisrJG50OxM2ccgOJjUeaBWIBiDIZnR2oqj8ENI,290
1
+ abstract_solana/__init__.py,sha256=INCZ3KOpc4o1MnK-0dIM9gldjyTF5JlsiOamMejV_bY,319
2
2
  abstract_solana/account_key_utils.py,sha256=VMJd4GOTK1vn8UZsfXDnjxDOGoQWGY6fvflJqPZ7Xvs,877
3
3
  abstract_solana/constants.py,sha256=cSmCKzQiNZocX1YkKYrdY-O449aYhi7BT_j-45HZN-E,1418
4
4
  abstract_solana/genesis_functions.py,sha256=2WRQUxN9j-dpLfYIBiX3URM-_uDGkh-eTy08Gi-qWgo,939
5
5
  abstract_solana/index_utils.py,sha256=Ed07BYTZWp-SVfpthAUqjRY00U3ZYldPCqd7LJy9AO8,1884
6
- abstract_solana/keypair_utils.py,sha256=B14F2dKHbOGIyyn2w9LSEPZsmasy7g8d1gKM81irylg,472
6
+ abstract_solana/keypair_utils.py,sha256=_5hCWGuzxFA0OX4q807R_Y4kW9WVITUCXilmI78Ewu0,522
7
7
  abstract_solana/log_message_functions.py,sha256=-qGO4rJRHKVEV8eqs4OCe5Rx1osTlEoc07fUruMBFp8,8080
8
8
  abstract_solana/price_utils.py,sha256=BLkwFLhlsTHeW0NTdzCAUi2xhc2lX7SrHz5sslDbUrY,4288
9
9
  abstract_solana/pubkey_utils.py,sha256=TAYF74fKAuTBnqIP2SnA-BttO5uoHbxI9BRZRpGCMNY,2010
@@ -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=DN0tMVKNkEJMw6KTLXnE3kDuDHmHsqqMoLhtHTRuvuw,7243
14
+ abstract_solana/pumpFun/buy_sell_pump.py,sha256=-uzWpD1sh1Op5JCcjshtohmbNUf-bRMhalBoqS3WV18,7355
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.36.dist-info/METADATA,sha256=tM2VjTvZzaZgcX_N0YGsNO-_IVHiTv5wv9NQWsLkHuQ,924
19
- abstract_solana-0.0.0.36.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
20
- abstract_solana-0.0.0.36.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
21
- abstract_solana-0.0.0.36.dist-info/RECORD,,
18
+ abstract_solana-0.0.0.38.dist-info/METADATA,sha256=d3nmAjGRr0NNN3GDW-Yg_Ipugr3rAW0ATv2mN_kyA-w,924
19
+ abstract_solana-0.0.0.38.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
20
+ abstract_solana-0.0.0.38.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
21
+ abstract_solana-0.0.0.38.dist-info/RECORD,,