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

@@ -7,3 +7,4 @@ from .signature_data_parse import *
7
7
  from .utils import *
8
8
  from .log_message_functions import *
9
9
  from .constants import *
10
+ from .pumpFunKeys import *
@@ -0,0 +1,95 @@
1
+ from .pubkey_utils import Pubkey,get_pubkey,derive_bonding_curve,derive_associated_bonding_curve
2
+ from .log_message_functions import get_for_program_ids_info
3
+ from spl.token.instructions import create_associated_token_account, get_associated_token_address
4
+ from abstract_solcatcher import getGenesisSignature,getTransaction,getAccountInfo
5
+ from construct import Padding, Struct, Int64ul, Flag
6
+ import base64
7
+
8
+ # Change dictionary keys to lowercase and replace spaces with underscores
9
+ def change_keys_lower(dict_obj):
10
+ new_dict = {}
11
+ for key, value in dict_obj.items():
12
+ new_dict[key.lower().replace(' ', '_')] = value
13
+ return new_dict
14
+
15
+ # Predefined map for different transaction types
16
+ def get_create_map():
17
+ return [
18
+ {'instruction_number': '1', 'instruction_name': 'Mint', 'token_address': 'AkAUSJg1v9xYT3HUxdALH7NsrC6owmwoZuP9MLw8fxTL', 'token_name': '3CAT'},
19
+ {'instruction_number': '2', 'instruction_name': 'Mint Authority', 'token_address': 'TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM', 'token_name': 'Pump.fun Token Mint Authority'},
20
+ {'instruction_number': '3', 'instruction_name': 'Bonding Curve', 'token_address': '9nhxvNxfSUaJddVco6oa6NodtsCscqCScp6UU1hZkfGm', 'token_name': 'Pump.fun (3CAT) Bonding Curve'},
21
+ {'instruction_number': '4', 'instruction_name': 'Associated Bonding Curve', 'token_address': '889XLp3qvVAHpTYQmhn6cBpYSppV8Gi8E2Rgp9RH2vRy', 'token_name': 'Pump.fun (3CAT) Vault'},
22
+ {'instruction_number': '5', 'instruction_name': 'Global', 'token_address': '4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf', 'token_name': '4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf'},
23
+ {'instruction_number': '6', 'instruction_name': 'Mpl Token Metadata', 'token_address': 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s', 'token_name': 'Metaplex Token Metadata'},
24
+ {'instruction_number': '7', 'instruction_name': 'Metadata', 'token_address': 'CH41RxpjSXHqr1vfLTVYJMsfNs2fBCCWoAE13tPihXh7', 'token_name': 'CH41RxpjSXHqr1vfLTVYJMsfNs2fBCCWoAE13tPihXh7'},
25
+ {'instruction_number': '8', 'instruction_name': 'User', 'token_address': 'Fuy5MvbgzjSok1U8hH6mUY6WnLynzUextDxfEWMiTkn4', 'token_name': 'Fuy5MvbgzjSok1U8hH6mUY6WnLynzUextDxfEWMiTkn4'},
26
+ {'instruction_number': '9', 'instruction_name': 'System Program', 'token_address': '11111111111111111111111111111111', 'token_name': 'System Program'},
27
+ {'instruction_number': '10', 'instruction_name': 'Token Program', 'token_address': 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', 'token_name': 'Token Program'},
28
+ {'instruction_number': '11', 'instruction_name': 'Associated Token Program', 'token_address': 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL', 'token_name': 'Associated Token Account Program'},
29
+ {'instruction_number': '12', 'instruction_name': 'Rent', 'token_address': 'SysvarRent111111111111111111111111111111111', 'token_name': 'Rent Program'},
30
+ {'instruction_number': '13', 'instruction_name': 'Event Authority', 'token_address': 'Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1', 'token_name': 'Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1'},
31
+ {'instruction_number': '14', 'instruction_name': 'Program', 'token_address': '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P', 'token_name': 'Pump.fun'}
32
+ ]
33
+
34
+ # Fetches and organizes transaction types based on provided mint
35
+ def getTxnTypes(mint):
36
+ bonding_curve = str(derive_bonding_curve(mint)[0])
37
+ bonding_curve_signature = getGenesisSignature(address=bonding_curve)
38
+ txn_data = getTransaction(signature=bonding_curve_signature)
39
+ txn_data = get_for_program_ids_info(txn_data)
40
+
41
+ for new_map in get_create_map():
42
+ instructions = txn_data['transaction']['message']['instructions']
43
+ inner_instructions = txn_data['meta']['innerInstructions'][0]['instructions']
44
+ all_instructions = instructions + inner_instructions
45
+
46
+ instruction = [inst for inst in all_instructions if len(inst.get('associatedAccounts', [])) > 13]
47
+
48
+ txn_types = {create_index['instruction_name']: instruction[0]['associatedAccounts'][int(create_index['instruction_number']) - 1] for create_index in get_create_map()}
49
+
50
+ if txn_types:
51
+ txn_types['signature'] = bonding_curve_signature
52
+ break
53
+ return txn_types
54
+
55
+ # Retrieve virtual reserves for a bonding curve using a structured layout
56
+ def get_virtual_reserves(bonding_curve: Pubkey):
57
+ bonding_curve_struct = Struct(
58
+ Padding(8),
59
+ "virtualTokenReserves" / Int64ul,
60
+ "virtualSolReserves" / Int64ul,
61
+ "realTokenReserves" / Int64ul,
62
+ "realSolReserves" / Int64ul,
63
+ "tokenTotalSupply" / Int64ul,
64
+ "complete" / Flag
65
+ )
66
+ account_info = getAccountInfo(account=str(bonding_curve[0]))
67
+
68
+ if not account_info or 'value' not in account_info or 'data' not in account_info['value']:
69
+ print("Failed to retrieve account info.")
70
+ return None
71
+
72
+ data_base64 = account_info['value']['data'][0]
73
+ data = base64.b64decode(data_base64)
74
+ parsed_data = bonding_curve_struct.parse(data)
75
+ return parsed_data
76
+
77
+ # Retrieves comprehensive transaction and reserve data for the mint
78
+ def get_pump_fun_data(mint_str: str):
79
+ txn_types = change_keys_lower(getTxnTypes(mint_str))
80
+ bonding_curve = derive_bonding_curve(mint_str)
81
+ virtual_reserves = get_virtual_reserves(bonding_curve)
82
+ if virtual_reserves is None:
83
+ return None
84
+
85
+ txn_types.update({
86
+ "mint": mint_str,
87
+ "bonding_curve": str(bonding_curve[0]),
88
+ "associated_bonding_curve": str(derive_associated_bonding_curve(mint_str)),
89
+ "virtual_token_reserves": int(virtual_reserves.virtualTokenReserves),
90
+ "virtual_sol_reserves": int(virtual_reserves.virtualSolReserves),
91
+ "token_total_supply": int(virtual_reserves.tokenTotalSupply),
92
+ "complete": bool(virtual_reserves.complete)
93
+ })
94
+
95
+ return txn_types
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abstract_solana
3
- Version: 0.0.0.21
3
+ Version: 0.0.0.23
4
4
  Home-page: https://github.com/AbstractEndeavors/abstract_solana
5
5
  Author: putkoff
6
6
  Author-email: partners@abstractendeavors.com
@@ -1,4 +1,4 @@
1
- abstract_solana/__init__.py,sha256=z3oCMoB4hTYtcAkqbB7C_-lb28UPtxCWYO980evOOWQ,267
1
+ abstract_solana/__init__.py,sha256=8eQx1fE7XslNgWaRR98PeJ0XRTofUp4zMtDDmbIu1J8,294
2
2
  abstract_solana/account_key_utils.py,sha256=VMJd4GOTK1vn8UZsfXDnjxDOGoQWGY6fvflJqPZ7Xvs,877
3
3
  abstract_solana/constants.py,sha256=m1TsZLBAgcdM7Rrw_3_6YrFU9zdVFpghZXZKk7T38J8,1624
4
4
  abstract_solana/genesis_functions.py,sha256=2WRQUxN9j-dpLfYIBiX3URM-_uDGkh-eTy08Gi-qWgo,939
@@ -6,9 +6,10 @@ abstract_solana/index_utils.py,sha256=Ed07BYTZWp-SVfpthAUqjRY00U3ZYldPCqd7LJy9AO
6
6
  abstract_solana/log_message_functions.py,sha256=-qGO4rJRHKVEV8eqs4OCe5Rx1osTlEoc07fUruMBFp8,8080
7
7
  abstract_solana/price_utils.py,sha256=BLkwFLhlsTHeW0NTdzCAUi2xhc2lX7SrHz5sslDbUrY,4288
8
8
  abstract_solana/pubkey_utils.py,sha256=TAYF74fKAuTBnqIP2SnA-BttO5uoHbxI9BRZRpGCMNY,2010
9
+ abstract_solana/pumpFunKeys.py,sha256=KHZyQ_GFS9XzmNNMzEDQkAZsiM5Mpua6ZE1e3WebErc,5898
9
10
  abstract_solana/signature_data_parse.py,sha256=5AOMtJZADWcwR0JLDbd2kXZNzW129qeB0lvYUrE_tm0,1974
10
11
  abstract_solana/utils.py,sha256=Y1nyq-x7GqN09MEDrmiBM5iNDLJHDafFZ_lXrV0ua8k,348
11
- abstract_solana-0.0.0.21.dist-info/METADATA,sha256=3binE1O3R30L8MbtLaQn_Agrg1J_33WloaMty3C6uOs,924
12
- abstract_solana-0.0.0.21.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
13
- abstract_solana-0.0.0.21.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
14
- abstract_solana-0.0.0.21.dist-info/RECORD,,
12
+ abstract_solana-0.0.0.23.dist-info/METADATA,sha256=S5S_6CvqdX114jdCSYSY1o2V9zLnBDdxX1dHS2eJ7pw,924
13
+ abstract_solana-0.0.0.23.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
14
+ abstract_solana-0.0.0.23.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
15
+ abstract_solana-0.0.0.23.dist-info/RECORD,,