abstract-solana 0.0.0.33__tar.gz → 0.0.0.34__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.

Files changed (26) hide show
  1. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/PKG-INFO +1 -1
  2. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/setup.py +1 -1
  3. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/pumpFun/buy_sell_pump.py +29 -24
  4. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana.egg-info/PKG-INFO +1 -1
  5. abstract_solana-0.0.0.34/test/test_abstract_solana.py +8 -0
  6. abstract_solana-0.0.0.33/test/test_abstract_solana.py +0 -7
  7. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/README.md +0 -0
  8. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/setup.cfg +0 -0
  9. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/__init__.py +0 -0
  10. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/account_key_utils.py +0 -0
  11. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/constants.py +0 -0
  12. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/genesis_functions.py +0 -0
  13. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/index_utils.py +0 -0
  14. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/keypair_utils.py +0 -0
  15. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/log_message_functions.py +0 -0
  16. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/price_utils.py +0 -0
  17. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/pubkey_utils.py +0 -0
  18. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/pumpFun/__init__.py +0 -0
  19. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/pumpFun/pump_fun_keys.py +0 -0
  20. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/pumpFun/token_utils.py +0 -0
  21. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/signature_data_parse.py +0 -0
  22. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana/utils.py +0 -0
  23. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana.egg-info/SOURCES.txt +0 -0
  24. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana.egg-info/dependency_links.txt +0 -0
  25. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana.egg-info/requires.txt +0 -0
  26. {abstract_solana-0.0.0.33 → abstract_solana-0.0.0.34}/src/abstract_solana.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abstract_solana
3
- Version: 0.0.0.33
3
+ Version: 0.0.0.34
4
4
  Home-page: https://github.com/AbstractEndeavors/abstract_solana
5
5
  Author: putkoff
6
6
  Author-email: partners@abstractendeavors.com
@@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
4
4
  long_description = fh.read()
5
5
  setuptools.setup(
6
6
  name='abstract_solana',
7
- version='0.0.0.33',
7
+ version='0.0.0.34',
8
8
  author='putkoff',
9
9
  author_email='partners@abstractendeavors.com',
10
10
  description="",
@@ -1,10 +1,11 @@
1
1
  import struct,base58,time
2
- from typing import Optional,Union
3
2
  from solders.hash import Hash
4
3
  from solders.keypair import Keypair
5
4
  from solders.instruction import Instruction
6
5
  from solana.rpc.types import TokenAccountOpts,TxOpts
7
6
  from solana.transaction import Transaction
7
+ from ..pubkey_utils import Pubkey,get_pubkey
8
+ from ..constants import PUMP_FUN_PROGRAM_PUBKEY,LAMPORTS_PER_SOL
8
9
  from solders.compute_budget import set_compute_unit_limit, set_compute_unit_price
9
10
  from .token_utils import get_token_balance
10
11
  def sendTransaction(txn: Transaction, payer_keypair, opts=TxOpts(skip_preflight=True)) -> dict:
@@ -59,9 +60,9 @@ def confirm_txn(txn_sig, max_retries=20, retry_interval=3):
59
60
  time.sleep(retry_interval)
60
61
  print("Max retries reached. Transaction confirmation failed.")
61
62
  return None
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
+ 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):
63
64
  # 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, payer_pubkey,buy=buy)
65
+ keys = getKeys(get_coin_data(mint), token_account_pubkey, owner,buy=buy)
65
66
  slippage_adjustment = 1 - (slippage / 100)
66
67
  sol_change = sol_in if buy else float(token_balance) * float(token_price)
67
68
  sol_change_with_slippage = sol_change * slippage_adjustment
@@ -76,21 +77,25 @@ def buildTxn(mint,payer_pubkey, amount, slippage, token_account_pubkey,sol_in=0,
76
77
  blockHash = getLatestBlockhash(commitment="processed")
77
78
  recent_blockhash = get_any_value(blockHash.json(),'blockhash')
78
79
  recent_blockhash = Hash.from_string(recent_blockhash)
79
- txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=payer_pubkey)
80
+ txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=owner)
80
81
  txn.add(set_compute_unit_price(UNIT_PRICE))
81
82
  txn.add(set_compute_unit_limit(UNIT_BUDGET))
82
83
  if buy and token_account_instructions:
83
84
  txn.add(token_account_instructions)
84
85
  txn.add(swap_instruction)
85
86
  if buy == False and close_token_account:
86
- close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey, payer_pubkey, payer_pubkey))
87
+ close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey, owner, owner))
87
88
  txn.add(close_account_instructions)
88
89
  txn.sign(payer_keypair)
89
- return txn
90
-
91
- def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
90
+ txn_sig = sendTransaction(txn, payer_keypair, TxOpts(skip_preflight=True))
91
+ print("Transaction Signature", txn_sig)
92
+ confirm = confirm_txn(txn_sig)
93
+ print(confirm)
94
+ def get_all_buy_sell_info(mint,payer_keypair=None,token_balance=None):
92
95
  try:
93
- print("Owner Public Key:", payer_pubkey)
96
+ payer_keypair = payer_keypair or load_from_private_key()
97
+ payer_pubkey = payer_keypair.pubkey()
98
+ print("Owner Public Key:", owner)
94
99
  mint_str = str(mint)
95
100
  if not get_pubkey(mint_str).is_on_curve():
96
101
  print('Mint public key is not on curve')
@@ -104,7 +109,7 @@ def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
104
109
  print("Failed to retrieve coin data...")
105
110
  return False
106
111
  mint_pubkey = get_pubkey(mint_str)
107
- token_account, token_account_instructions = check_existing_token_account(payer_pubkey, mint_pubkey)
112
+ token_account, token_account_instructions = check_existing_token_account(owner, mint_pubkey)
108
113
  token_account_pubkey = get_pubkey(token_account)
109
114
  # Ensure the token_account is a valid Pubkey
110
115
  if not isinstance(token_account_pubkey, Pubkey):
@@ -128,22 +133,22 @@ def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0):
128
133
  except Exception as e:
129
134
  print(e)
130
135
 
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)
136
+ def pump_fun_sell(mint_str: str, token_balance: Optional[Union[int, float]] = None, slippage: int = 25, close_token_account: bool = True) -> bool:
137
+ mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,payer_keypair,token_balance)
138
+ buildTxn(mint=mint,
139
+ amount=amount,
140
+ slippage=slippage,
141
+ sol_in=0,
142
+ token_balance=token_balance,
143
+ token_price=token_price,
144
+ token_account_pubkey=token_account_pubkey,
145
+ token_account_instructions=token_account_instructions,
146
+ buy=False)
142
147
 
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)
148
+ def pump_fun_buy(mint_str: str, sol_in: float = 0.001, slippage: int = 25) -> bool:
149
+ mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions = get_all_buy_sell_info(mint,payer_keypair)
145
150
  # Build the transaction
146
- return buildTxn(mint=mint,
151
+ buildTxn(mint=mint,
147
152
  amount=amount,
148
153
  slippage=slippage,
149
154
  sol_in=sol_in,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abstract_solana
3
- Version: 0.0.0.33
3
+ Version: 0.0.0.34
4
4
  Home-page: https://github.com/AbstractEndeavors/abstract_solana
5
5
  Author: putkoff
6
6
  Author-email: partners@abstractendeavors.com
@@ -0,0 +1,8 @@
1
+ from abstract_solana import pump_fun_sell,load_from_private_key,sendTransaction
2
+ payer_keypair = load_from_private_key()
3
+ mint_str = "3bb6QmvustnZ627Kg2QvwTSi8gmxp7Y6orwXUokEwUyV"
4
+ txn = pump_fun_sell(mint=mint_str, token_balance=None, slippage=25)
5
+ txn_sig = sendTransaction(txn, payer_keypair, TxOpts(skip_preflight=True))
6
+ print("Transaction Signature", txn_sig)
7
+ confirm = confirm_txn(txn_sig)
8
+ print(confirm)
@@ -1,7 +0,0 @@
1
- from abstract_solana import pump_fun_sell,load_from_private_key
2
- payer_keypair = load_from_private_key()
3
- mint_str = "3bb6QmvustnZ627Kg2QvwTSi8gmxp7Y6orwXUokEwUyV"
4
- result = pump_fun_sell(mint=mint_str, token_balance=None, slippage=25)
5
- input(result)
6
-
7
-