abstract-solana 0.0.0.20__py3-none-any.whl → 0.0.0.22__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 *
@@ -126,12 +126,7 @@ def associate_logs_with_instructions(txnData):
126
126
  instruction_stack_height = instruction.get('stackHeight', 1)
127
127
  if instruction_program_id == log_programId and instruction_stack_height == log_stackHeight:
128
128
  # Add log data to the matching instruction
129
- instruction['logs'] = log['logs']
130
- instruction['event'] = None if log['events'] == [] else log['events'][0]
131
- instruction['start'] = log['start']
132
- instruction['end'] = log['end']
133
- instruction['stackHeight'] = instruction_stack_height
134
- instruction['programId'] = instruction_program_id
129
+ instruction.update(log)
135
130
  instruction['associatedAccounts'] = [accountKeys[index] for index in instruction['accounts']]
136
131
  if instIndex == 0:
137
132
  instructions[i] = instruction
@@ -0,0 +1,94 @@
1
+ from .pubkey_utils import 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
+ txn_types = {create_index['instruction_name']: instruction[0]['associatedAccounts'][int(create_index['instruction_number']) - 1] for create_index in get_create_map()}
48
+
49
+ if txn_types:
50
+ txn_types['signature'] = bonding_curve_signature
51
+ break
52
+ return txn_types
53
+
54
+ # Retrieve virtual reserves for a bonding curve using a structured layout
55
+ def get_virtual_reserves(bonding_curve: Pubkey):
56
+ bonding_curve_struct = Struct(
57
+ Padding(8),
58
+ "virtualTokenReserves" / Int64ul,
59
+ "virtualSolReserves" / Int64ul,
60
+ "realTokenReserves" / Int64ul,
61
+ "realSolReserves" / Int64ul,
62
+ "tokenTotalSupply" / Int64ul,
63
+ "complete" / Flag
64
+ )
65
+ account_info = getAccountInfo(account=str(bonding_curve[0]))
66
+
67
+ if not account_info or 'value' not in account_info or 'data' not in account_info['value']:
68
+ print("Failed to retrieve account info.")
69
+ return None
70
+
71
+ data_base64 = account_info['value']['data'][0]
72
+ data = base64.b64decode(data_base64)
73
+ parsed_data = bonding_curve_struct.parse(data)
74
+ return parsed_data
75
+
76
+ # Retrieves comprehensive transaction and reserve data for the mint
77
+ def get_pump_fun_data(mint_str: str):
78
+ txn_types = change_keys_lower(getTxnTypes(mint_str))
79
+ bonding_curve = derive_bonding_curve(mint_str)
80
+ virtual_reserves = get_virtual_reserves(bonding_curve)
81
+ if virtual_reserves is None:
82
+ return None
83
+
84
+ txn_types.update({
85
+ "mint": mint_str,
86
+ "bonding_curve": str(bonding_curve[0]),
87
+ "associated_bonding_curve": str(derive_associated_bonding_curve(mint_str)),
88
+ "virtual_token_reserves": int(virtual_reserves.virtualTokenReserves),
89
+ "virtual_sol_reserves": int(virtual_reserves.virtualSolReserves),
90
+ "token_total_supply": int(virtual_reserves.tokenTotalSupply),
91
+ "complete": bool(virtual_reserves.complete)
92
+ })
93
+
94
+ return txn_types
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abstract_solana
3
- Version: 0.0.0.20
3
+ Version: 0.0.0.22
4
4
  Home-page: https://github.com/AbstractEndeavors/abstract_solana
5
5
  Author: putkoff
6
6
  Author-email: partners@abstractendeavors.com
@@ -1,14 +1,15 @@
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
5
5
  abstract_solana/index_utils.py,sha256=Ed07BYTZWp-SVfpthAUqjRY00U3ZYldPCqd7LJy9AO8,1884
6
- abstract_solana/log_message_functions.py,sha256=JZfVVqK6nRw5QZu4eSJYVcvZ9Mc-Fhndjpnur8JgDR0,8455
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=-A2fFeO5DQw9ygai7Hnhmx3U-nZlLdio-wtbEdtA22g,5882
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.20.dist-info/METADATA,sha256=PRaFtS63lUaJMzlElAt7mrK-09eOPPjLwiopPron7-s,924
12
- abstract_solana-0.0.0.20.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
13
- abstract_solana-0.0.0.20.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
14
- abstract_solana-0.0.0.20.dist-info/RECORD,,
12
+ abstract_solana-0.0.0.22.dist-info/METADATA,sha256=9N7uFov5G_b4b5_LAyGNHOVIo0bnvve9LKgh47Sct2M,924
13
+ abstract_solana-0.0.0.22.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
14
+ abstract_solana-0.0.0.22.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
15
+ abstract_solana-0.0.0.22.dist-info/RECORD,,