abstract-solana 0.0.2.79__py3-none-any.whl → 0.0.2.133__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.
- abstract_solana/__init__.py +3 -2
- abstract_solana/abstract_rpcs/__init__.py +1 -1
- abstract_solana/abstract_rpcs/get_api_gui.py +0 -6
- abstract_solana/abstract_rpcs/rate_limiter.py +117 -82
- abstract_solana/abstract_rpcs/solana_rpc_client.py +14 -8
- abstract_solana/abstract_solana_utils/__init__.py +3 -0
- abstract_solana/abstract_solana_utils/bondingCurves.py +24 -0
- abstract_solana/abstract_solana_utils/genesis_functions.py +57 -0
- abstract_solana/abstract_solana_utils/pubKeyUtils.py +79 -0
- abstract_solana/abstract_utils/__init__.py +1 -9
- abstract_solana/abstract_utils/genesis_functions.py +25 -3
- abstract_solana/abstract_utils/keypair_utils.py +0 -1
- abstract_solana/abstract_utils/log_message_functions.py +1 -0
- abstract_solana/abstract_utils/pubKeyUtils.py +77 -0
- abstract_solana/pumpFun/__init__.py +1 -0
- abstract_solana/pumpFun/constants.py +12 -0
- abstract_solana/rpc_utils/__init__.py +1 -0
- abstract_solana/rpc_utils/rpc_utils.py +48 -0
- abstract_solana/utils/__init__.py +3 -0
- abstract_solana/utils/bondingCurves.py +29 -0
- abstract_solana/utils/genesis_functions.py +38 -0
- abstract_solana/utils/pubKeyUtils.py +79 -0
- {abstract_solana-0.0.2.79.dist-info → abstract_solana-0.0.2.133.dist-info}/METADATA +12 -4
- abstract_solana-0.0.2.133.dist-info/RECORD +39 -0
- {abstract_solana-0.0.2.79.dist-info → abstract_solana-0.0.2.133.dist-info}/WHEEL +1 -1
- abstract_solana-0.0.2.79.dist-info/RECORD +0 -26
- {abstract_solana-0.0.2.79.dist-info → abstract_solana-0.0.2.133.dist-info}/top_level.txt +0 -0
abstract_solana/__init__.py
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
from .
|
|
2
|
-
from .
|
|
1
|
+
from .abstract_solana_utils import *
|
|
2
|
+
from .pumpFun import *
|
|
3
|
+
from .rpc_utils import *
|
|
@@ -102,7 +102,6 @@ def get_var_inputs():
|
|
|
102
102
|
return [inputs]
|
|
103
103
|
def clear_inputs(window):
|
|
104
104
|
for i in range(get_longest(get_list_vars())):
|
|
105
|
-
print(i)
|
|
106
105
|
window[f'var_{i}'].update(value='')
|
|
107
106
|
window[f'input_{i}'].update(value='')
|
|
108
107
|
def get_dict_from_vars(values, function):
|
|
@@ -156,7 +155,6 @@ def second_window():
|
|
|
156
155
|
# Get function by its name dynamically
|
|
157
156
|
|
|
158
157
|
try:
|
|
159
|
-
print(revsa)
|
|
160
158
|
# Pass filtered arguments
|
|
161
159
|
result = get_result(function,dictsa)
|
|
162
160
|
params =result.get('params',[])
|
|
@@ -175,12 +173,10 @@ def second_window():
|
|
|
175
173
|
|
|
176
174
|
|
|
177
175
|
|
|
178
|
-
print(params)
|
|
179
176
|
except TypeError as e:
|
|
180
177
|
print(f"Error calling function: {e}")
|
|
181
178
|
result = {}
|
|
182
179
|
results[lowered] = result
|
|
183
|
-
print(results)
|
|
184
180
|
window = sg.Window('Script launcher', layout)
|
|
185
181
|
results = {}
|
|
186
182
|
while True:
|
|
@@ -205,10 +201,8 @@ def second_window():
|
|
|
205
201
|
|
|
206
202
|
try:
|
|
207
203
|
filtered_values = get_dict_from_vars(values, function)
|
|
208
|
-
print(filtered_values)
|
|
209
204
|
# Pass filtered arguments
|
|
210
205
|
result = get_result(function,dictsa)
|
|
211
|
-
print(result)
|
|
212
206
|
except TypeError as e:
|
|
213
207
|
print(f"Error calling function: {e}")
|
|
214
208
|
result = {}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import time
|
|
1
|
+
import time
|
|
2
|
+
import os
|
|
3
|
+
import json
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
2
6
|
from abstract_utilities import *
|
|
3
|
-
from abstract_security import
|
|
7
|
+
from abstract_security import get_env_value
|
|
4
8
|
def getAbsFile():
|
|
5
9
|
return os.path.abspath(__file__)
|
|
6
10
|
def getAbsDir():
|
|
@@ -9,12 +13,12 @@ def getAbsPath(path):
|
|
|
9
13
|
return os.path.join(getAbsDir(),path)
|
|
10
14
|
def getSaveStatePath():
|
|
11
15
|
return getAbsPath('rate_limiter_state.json')
|
|
12
|
-
def readSaveState():
|
|
13
|
-
path= getSaveStatePath()
|
|
16
|
+
def readSaveState(url1,url2,path=None):
|
|
17
|
+
path= path or getSaveStatePath()
|
|
14
18
|
if not os.path.isfile(path):
|
|
15
|
-
state = {'last_method':None,'
|
|
19
|
+
state = {'last_method':None,'rate_limits': {url1: [], url2: []},'last_mb': {url1: {}, url2: {}},'cooldown_times': {url1: {}, url2: {}},'last_url':url1}
|
|
16
20
|
safe_dump_to_file(data=state,file_path=path)
|
|
17
|
-
return safe_read_from_json(
|
|
21
|
+
return safe_read_from_json(path)
|
|
18
22
|
def is_time_interval(time_obj, interval):
|
|
19
23
|
return (time.time() - time_obj) < interval-1
|
|
20
24
|
|
|
@@ -23,120 +27,151 @@ def get_mb(sum_list, limit, last_mb):
|
|
|
23
27
|
|
|
24
28
|
def datasize(data):
|
|
25
29
|
if isinstance(data, str):
|
|
26
|
-
|
|
30
|
+
size = len(data.encode('utf-8'))
|
|
27
31
|
elif isinstance(data, (bytes, bytearray)):
|
|
28
|
-
|
|
32
|
+
size = len(data)
|
|
29
33
|
elif isinstance(data, list) or isinstance(data, dict):
|
|
30
|
-
|
|
34
|
+
size = len(json.dumps(data).encode('utf-8'))
|
|
31
35
|
else:
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
size = len(str(data).encode('utf-8'))
|
|
37
|
+
return size/1000
|
|
34
38
|
class RateLimiter(metaclass=SingletonMeta):
|
|
35
|
-
def __init__(self,rpc_url
|
|
39
|
+
def __init__(self, rpc_url=None, fallback_rpc_url=None, env_directory=None,save_state_path = None):
|
|
36
40
|
if not hasattr(self, 'initialized'): # Prevent reinitialization
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
self.load_state()
|
|
50
|
-
def get_url_2(self):
|
|
51
|
-
return self.url2
|
|
41
|
+
self.initialized = True
|
|
42
|
+
self.rpc_url = rpc_url or get_env_value(key="solana_primary_rpc_url", path=env_directory) or "https://api.mainnet-beta.solana.com"
|
|
43
|
+
self.fallback_rpc_url = fallback_rpc_url or get_env_value(key="solana_fallback_rpc_url", path=env_directory)
|
|
44
|
+
self.state_file = save_state_path or getSaveStatePath()
|
|
45
|
+
self.url1 = self.rpc_url
|
|
46
|
+
self.url2 = self.fallback_rpc_url
|
|
47
|
+
self.rate_limits = {self.url1: [], self.url2: []} # Separate rate limits for each URL
|
|
48
|
+
self.last_mb = {self.url1: {}, self.url2: {}}
|
|
49
|
+
self.cooldown_times = {self.url1: {}, self.url2: {}} # Separate cooldowns for each URL
|
|
50
|
+
self.last_url = None
|
|
51
|
+
self.last_method = None
|
|
52
|
+
self.load_state()
|
|
52
53
|
|
|
53
54
|
def save_state(self):
|
|
54
55
|
state = {
|
|
55
|
-
'last_method':self.last_method,
|
|
56
|
-
'
|
|
56
|
+
'last_method': self.last_method,
|
|
57
|
+
'rate_limits': self.rate_limits,
|
|
57
58
|
'last_mb': self.last_mb,
|
|
58
|
-
'
|
|
59
|
+
'cooldown_times': self.cooldown_times,
|
|
59
60
|
'last_url': self.last_url
|
|
60
61
|
}
|
|
61
|
-
safe_dump_to_file(data=state,file_path=self.state_file)
|
|
62
|
+
safe_dump_to_file(data=state, file_path=self.state_file)
|
|
62
63
|
|
|
63
64
|
def load_state(self):
|
|
64
|
-
state = readSaveState()
|
|
65
|
+
state = readSaveState(self.url1,self.url2)
|
|
65
66
|
self.last_method = state.get('last_method')
|
|
66
|
-
self.
|
|
67
|
-
self.last_mb = state.get('last_mb', {})
|
|
68
|
-
self.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
self.rate_limits = state.get('rate_limits', {self.url1: [], self.url2: []})
|
|
68
|
+
self.last_mb = state.get('last_mb', {self.url1: {}, self.url2: {}})
|
|
69
|
+
self.cooldown_times = state.get('cooldown_times', {self.url1: {}, self.url2: {}})
|
|
70
|
+
|
|
71
|
+
def set_cooldown(self, url, method=None, add=False):
|
|
72
|
+
if method:
|
|
73
|
+
if add:
|
|
74
|
+
self.cooldown_times[url][method] = time.time() + add
|
|
75
|
+
if method in self.cooldown_times[url] and time.time() > self.cooldown_times[url][method]:
|
|
76
|
+
del self.cooldown_times[url][method]
|
|
77
|
+
return method in self.cooldown_times[url]
|
|
78
|
+
return False
|
|
79
|
+
|
|
80
|
+
def get_last_rate_limit(self, url):
|
|
81
|
+
if self.rate_limits[url]:
|
|
82
|
+
return self.rate_limits[url][-1]
|
|
81
83
|
return {}
|
|
82
84
|
|
|
83
|
-
def is_all_limit(self, method):
|
|
84
|
-
if method not in self.last_mb:
|
|
85
|
-
self.last_mb[method] = 0
|
|
85
|
+
def is_all_limit(self, url, method):
|
|
86
|
+
if method not in self.last_mb[url]:
|
|
87
|
+
self.last_mb[url][method] = 0
|
|
86
88
|
|
|
87
|
-
if self.set_cooldown():
|
|
89
|
+
if self.set_cooldown(url, method):
|
|
90
|
+
print(f'set_cooldown for method {method} in {url} hit')
|
|
88
91
|
return True
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
# Clean up expired queries for the current URL
|
|
94
|
+
self.rate_limits[url] = [
|
|
95
|
+
query for query in self.rate_limits[url] if is_time_interval(query.get('time') or 0, 30)
|
|
96
|
+
]
|
|
97
|
+
last_rate_limit = self.get_last_rate_limit(url)
|
|
98
|
+
|
|
99
|
+
# Check data size limits
|
|
100
|
+
total_mb = sum(query.get('data', 0) for query in self.rate_limits[url])
|
|
101
|
+
mb = get_mb(total_mb, 100, self.last_mb[url][method])
|
|
102
|
+
if mb:
|
|
103
|
+
print(f'mb {total_mb} of limit 100 hit')
|
|
95
104
|
return True
|
|
96
105
|
|
|
97
106
|
# Check if the last request for the same method was within 10 seconds
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
# Check if more than 100 requests in the last 10 seconds
|
|
102
|
-
time_rate = [query for query in self.rate_limit if is_time_interval(query.get('time') or 0, 10)]
|
|
107
|
+
time_rate = [
|
|
108
|
+
query for query in self.rate_limits[url] if is_time_interval(query.get('time') or 0, 10)
|
|
109
|
+
]
|
|
103
110
|
if len(time_rate) > 100:
|
|
111
|
+
print(f'time_rate {time_rate} of timerate limit 100 hit')
|
|
104
112
|
return True
|
|
105
113
|
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
method_specific_time_rate = [
|
|
115
|
+
query for query in time_rate if query['method'] == method
|
|
116
|
+
]
|
|
108
117
|
if len(method_specific_time_rate) > 40:
|
|
118
|
+
print(f'method_specific_time_rate {len(method_specific_time_rate)} of method_specific_time_rate limit 40 hit')
|
|
109
119
|
return True
|
|
110
120
|
|
|
111
121
|
return False
|
|
112
122
|
|
|
113
|
-
def log_response(self, method=None, response=None):
|
|
123
|
+
def log_response(self, method=None, response=None, retry_after=None):
|
|
114
124
|
method = method or 'default_method'
|
|
115
125
|
response = response or {}
|
|
116
126
|
data_size = datasize(response)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
active_url = self.last_url
|
|
128
|
+
|
|
129
|
+
# Handle Retry-After logic
|
|
130
|
+
if retry_after:
|
|
131
|
+
try:
|
|
132
|
+
wait_time = int(retry_after)
|
|
133
|
+
except ValueError:
|
|
134
|
+
retry_after_date = datetime.strptime(retry_after, '%a, %d %b %Y %H:%M:%S GMT')
|
|
135
|
+
wait_time = (retry_after_date - datetime.utcnow()).total_seconds()
|
|
136
|
+
self.set_cooldown(active_url, method, add=max(wait_time, 0))
|
|
137
|
+
|
|
138
|
+
if active_url == self.url1:
|
|
139
|
+
self.rate_limits[active_url].append({'method': method, 'data': data_size, 'time': time.time()})
|
|
140
|
+
|
|
141
|
+
# Clean up expired entries for the current URL
|
|
142
|
+
self.rate_limits[active_url] = [
|
|
143
|
+
query for query in self.rate_limits[active_url] if is_time_interval(query['time'], 30)
|
|
144
|
+
]
|
|
123
145
|
self.save_state()
|
|
124
|
-
|
|
146
|
+
def get_cooldown_for_method(self,url,method):
|
|
147
|
+
wait_time = 0
|
|
148
|
+
if self.set_cooldown(url,method):
|
|
149
|
+
wait_time = int(self.cooldown_times[url][method]) - time.time()
|
|
150
|
+
if wait_time <= 0:
|
|
151
|
+
del self.cooldown_times[url][method]
|
|
152
|
+
|
|
153
|
+
else:
|
|
154
|
+
return wait_time
|
|
155
|
+
return False
|
|
125
156
|
def get_url(self, method=None):
|
|
126
157
|
method = method or 'default_method'
|
|
127
|
-
|
|
128
|
-
self.last_url = self.url2
|
|
129
|
-
return self.url2
|
|
158
|
+
wait_time = self.get_cooldown_for_method(self.url1,method)
|
|
130
159
|
|
|
131
|
-
if
|
|
160
|
+
if wait_time:
|
|
161
|
+
wait_time = int(self.cooldown_times[self.url1][method]) - time.time()
|
|
162
|
+
if wait_time > 0:
|
|
163
|
+
self.last_url = self.url2
|
|
164
|
+
#retry_after_date = datetime.strptime(str(int(self.cooldown_times[method])), '%a, %d %b %Y %H:%M:%S GMT')
|
|
165
|
+
print(f"{method} is on cooldown for {wait_time} more seconds")
|
|
166
|
+
if method == 'get_url2':
|
|
167
|
+
self.last_url = self.url2
|
|
168
|
+
return self.last_url
|
|
169
|
+
# If fallback URL is selected, skip all limits
|
|
170
|
+
|
|
171
|
+
is_limit = self.is_all_limit(self.url1, method)
|
|
172
|
+
if not is_limit:
|
|
132
173
|
self.last_method = method
|
|
133
|
-
|
|
134
174
|
self.last_url = self.url1
|
|
135
|
-
|
|
136
|
-
self.last_url = self.url2
|
|
137
|
-
else:
|
|
138
|
-
return {"rate_limited":"limit has been reached"}
|
|
175
|
+
print([is_limit,self.last_url])
|
|
139
176
|
return self.last_url
|
|
140
177
|
|
|
141
|
-
|
|
142
|
-
|
|
@@ -2,7 +2,7 @@ from solana.rpc.core import _ClientCore
|
|
|
2
2
|
from typing import Dict, List, Optional, Sequence, Union
|
|
3
3
|
from solana.rpc.commitment import Commitment, Finalized
|
|
4
4
|
from .rate_limiter import RateLimiter
|
|
5
|
-
from ..abstract_utils.pubkey_utils import
|
|
5
|
+
from ..abstract_utils.pubkey_utils import *
|
|
6
6
|
import inspect,asyncio,json,requests
|
|
7
7
|
from abstract_apis import *
|
|
8
8
|
from abstract_utilities import is_number
|
|
@@ -85,11 +85,17 @@ def get_rpc_dict(endpoint,*args,**kwargs):
|
|
|
85
85
|
kwargs = get_conversions(variables,*args,**kwargs)
|
|
86
86
|
kwargs = json.loads(str(call_function(function,**kwargs)))
|
|
87
87
|
return kwargs
|
|
88
|
-
def
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
def make_call(url,body):
|
|
89
|
+
return postRpcRequest(url=url,**body,retry_after =True,status_code=True, headers=get_headers())
|
|
90
|
+
def abstract_solana_rate_limited_call(method, *args, **kwargs):
|
|
91
|
+
# Build the request body
|
|
92
|
+
body = get_rpc_dict(method, *args, **kwargs)
|
|
93
|
+
body_method = body.get('method')
|
|
94
|
+
url = rate_limiter.get_url(body_method)
|
|
95
|
+
response,status_code,retry_after = make_call(url,body)
|
|
96
|
+
rate_limiter.log_response(body_method, response, retry_after)
|
|
97
|
+
if url == rate_limiter.url1 and status_code == 429:
|
|
98
|
+
url = rate_limiter.get_url('get_url2')
|
|
99
|
+
response,status_code,retry_after = make_call(url,body)
|
|
100
|
+
rate_limiter.log_response(body_method, response)
|
|
95
101
|
return response
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from .pubKeyUtils import get_pubkey,pubkey_find_program_address,Pubkey
|
|
2
|
+
from spl.token.instructions import create_associated_token_account, get_associated_token_address
|
|
3
|
+
from ..pumpFun import PUMP_FUN_PROGRAM
|
|
4
|
+
def derive_bonding_curve_accounts(mint_str: str,programId=None):
|
|
5
|
+
mintPubKey = get_pubkey(mint_str)
|
|
6
|
+
if not mintPubKey.is_on_curve():
|
|
7
|
+
return {}
|
|
8
|
+
bonding_curve, _ = derive_bonding_curve(mintPubKey,programId)
|
|
9
|
+
associated_bonding_curve = get_associated_token_address(bonding_curve, mintPubKey)
|
|
10
|
+
return {'bonding_curve': bonding_curve, "associated_bonding_curve": associated_bonding_curve}
|
|
11
|
+
def get_bonding_curve(mint:str):
|
|
12
|
+
return derive_bonding_curve_accounts(mint).get('bonding_curve')
|
|
13
|
+
def get_associated_bonding_curve(mint:str):
|
|
14
|
+
return derive_bonding_curve_accounts(mint).get("associated_bonding_curve")
|
|
15
|
+
def isOnCurve(obj):
|
|
16
|
+
pubkey = get_pubkey(obj)
|
|
17
|
+
is_on_curve = pubkey.is_on_curve()
|
|
18
|
+
return is_on_curve
|
|
19
|
+
def derive_associated_bonding_curve(mint,programId=None):
|
|
20
|
+
programId = programId or PUMP_FUN_PROGRAM
|
|
21
|
+
return get_associated_token_address(derive_bonding_curve(mint,get_pubkey(programId))[0], get_pubkey(mint))
|
|
22
|
+
def derive_bonding_curve(mint,programId=None):
|
|
23
|
+
programId = programId or PUMP_FUN_PROGRAM
|
|
24
|
+
return pubkey_find_program_address("bonding-curve",mint,get_pubkey(programId))
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from abstract_apis import get_headers,get_response,get_text_response,load_inner_json
|
|
2
|
+
from abstract_solcatcher import call_async_function,call_solcatcher_db,async_call_solcatcher_py,async_make_rate_limited_call
|
|
3
|
+
from abstract_utilities import get_any_value,make_list
|
|
4
|
+
from ..rpc_utils import get_signatures,async_get_signatures
|
|
5
|
+
import asyncio,httpx,logging
|
|
6
|
+
def get_block_time_from_txn(txnData):
|
|
7
|
+
return int(get_any_value(txnData,'blockTime') or 0)
|
|
8
|
+
def get_error_message_from_txn(txnData):
|
|
9
|
+
return make_list(get_any_value(txnData,'err'))[0]
|
|
10
|
+
def get_errorless_txn_from_signature_array(signatureArray):
|
|
11
|
+
return [sig for sig in signatureArray or [] if get_error_message_from_txn(sig) == None]
|
|
12
|
+
def return_oldest_from_signature_array(signatureArray,errorless=False):
|
|
13
|
+
if errorless:
|
|
14
|
+
signatureArray = get_errorless_txn_from_signature_array(signatureArray)
|
|
15
|
+
if signatureArray and isinstance(signatureArray,list):
|
|
16
|
+
if get_block_time_from_txn(signatureArray[0])<get_block_time_from_txn(signatureArray[-1]):
|
|
17
|
+
return signatureArray[0].get('signature')
|
|
18
|
+
return signatureArray[-1].get('signature')
|
|
19
|
+
def return_oldest_last_and_original_length_from_signature_array(signatureArray):
|
|
20
|
+
return {"oldest":return_oldest_from_signature_array(signatureArray),
|
|
21
|
+
"oldestValid":return_oldest_from_signature_array(signatureArray,errorless=True),
|
|
22
|
+
"length":len(signatureArray or '')}
|
|
23
|
+
def get_first_sigs(address, until=None, limit=1000,get_signature_function=None):
|
|
24
|
+
get_signature_function = get_signature_function or async_get_signatures
|
|
25
|
+
original_length=None
|
|
26
|
+
while True:
|
|
27
|
+
signatureArray = call_async_function(get_signature_function,address, until=until, limit=limit)
|
|
28
|
+
if signatureArray:
|
|
29
|
+
original_length = len(signatureArray)
|
|
30
|
+
if original_length:
|
|
31
|
+
return signatureArray
|
|
32
|
+
def getGenesisSignature(address, limit=1000, until=None,encoding='jsonParsed',commitment=0,get_signature_function=None,errorProof=True,url_1_only=True,url_2_only=False):
|
|
33
|
+
method = "getGenesisSignature"
|
|
34
|
+
validBefore=None
|
|
35
|
+
get_signature_function = get_signature_function or async_get_signatures
|
|
36
|
+
signatureArray = call_async_function(get_first_sigs,address, until=until, limit=limit,get_signature_function=get_signature_function)
|
|
37
|
+
original_length=len(signatureArray)
|
|
38
|
+
while True:
|
|
39
|
+
if validBefore != None:
|
|
40
|
+
signatureArray = call_async_function(get_signature_function,address, until=until, limit=limit)
|
|
41
|
+
if signatureArray:
|
|
42
|
+
original_length = len(signatureArray)
|
|
43
|
+
else:
|
|
44
|
+
original_length = 0
|
|
45
|
+
signature_array_data = return_oldest_last_and_original_length_from_signature_array(signatureArray)
|
|
46
|
+
oldest = signature_array_data.get('oldest')
|
|
47
|
+
validOldest = signature_array_data.get('oldestValid')
|
|
48
|
+
if original_length < limit or original_length == 0 or (original_length>0 and (oldest == validOldest or oldest == validBefore) and oldest != None):
|
|
49
|
+
return validOldest
|
|
50
|
+
validBefore = oldest
|
|
51
|
+
|
|
52
|
+
def getGenesisSignature(*args,**kwargs):
|
|
53
|
+
return getGenesisSignature(*args,**kwargs)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from solders.pubkey import Pubkey
|
|
2
|
+
from solders.signature import Signature
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def pubkey_find_program_address(string,address,programId):
|
|
6
|
+
return Pubkey.find_program_address([str(string).encode(), bytes(get_pubkey(address))],get_pubkey(programId))
|
|
7
|
+
|
|
8
|
+
def get_pubString(obj):
|
|
9
|
+
return Pubkey.from_string(str(obj))
|
|
10
|
+
|
|
11
|
+
def get_sigString(obj):
|
|
12
|
+
return Signature.from_string(str(obj))
|
|
13
|
+
|
|
14
|
+
def is_sigkey(obj):
|
|
15
|
+
return isinstance(obj,Signature)
|
|
16
|
+
|
|
17
|
+
def is_pubkey(obj):
|
|
18
|
+
return isinstance(obj,Pubkey)
|
|
19
|
+
|
|
20
|
+
def get_pubBytes(obj):
|
|
21
|
+
return Pubkey.from_bytes(obj)
|
|
22
|
+
|
|
23
|
+
def get_sigBytes(obj):
|
|
24
|
+
return Signature.from_bytes(obj)
|
|
25
|
+
|
|
26
|
+
def try_pubkey(obj):
|
|
27
|
+
return is_pubkey(get_pubkey(obj))
|
|
28
|
+
|
|
29
|
+
def try_sigkey(obj):
|
|
30
|
+
return is_sigkey(get_sigkey(obj))
|
|
31
|
+
|
|
32
|
+
def get_pubkey(obj):
|
|
33
|
+
if is_pubkey(obj):
|
|
34
|
+
return obj
|
|
35
|
+
address = obj
|
|
36
|
+
if isinstance(obj,bytes):
|
|
37
|
+
pubkey = get_pubBytes(address)
|
|
38
|
+
if is_pubkey(pubkey):
|
|
39
|
+
return pubkey
|
|
40
|
+
if isinstance(obj,str):
|
|
41
|
+
try:
|
|
42
|
+
pubkey= get_pubString(obj)
|
|
43
|
+
except:
|
|
44
|
+
pubkey = obj
|
|
45
|
+
if is_pubkey(pubkey):
|
|
46
|
+
return pubkey
|
|
47
|
+
return obj
|
|
48
|
+
|
|
49
|
+
def get_pubkey_bytes(obj):
|
|
50
|
+
pubkey = get_pubkey(obj)
|
|
51
|
+
try:
|
|
52
|
+
pubKeyBytes = bytes(pubkey)
|
|
53
|
+
return pubKeyBytes
|
|
54
|
+
except:
|
|
55
|
+
return obj
|
|
56
|
+
|
|
57
|
+
def get_pubkey_base58(obj):
|
|
58
|
+
pubkey = get_pubkey(obj)
|
|
59
|
+
address = pubkey.to_base58() # Convert to string
|
|
60
|
+
return address
|
|
61
|
+
|
|
62
|
+
def get_sigkey(obj):
|
|
63
|
+
if is_sigkey(obj):
|
|
64
|
+
return obj
|
|
65
|
+
signature = obj
|
|
66
|
+
if isinstance(signature,bytes):
|
|
67
|
+
sigKey = get_sigBytes(signature)
|
|
68
|
+
if is_sigkey(sigKey):
|
|
69
|
+
return sigKey
|
|
70
|
+
if isinstance(signature,str):
|
|
71
|
+
try:
|
|
72
|
+
sigKey= get_sigString(signature)
|
|
73
|
+
except:
|
|
74
|
+
sigKey = signature
|
|
75
|
+
if is_sigkey(sigKey):
|
|
76
|
+
return sigKey
|
|
77
|
+
return obj
|
|
78
|
+
|
|
79
|
+
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
from .
|
|
1
|
+
from .pubKeyUtils import *
|
|
2
2
|
from .genesis_functions import *
|
|
3
|
-
from .index_utils import *
|
|
4
|
-
from .price_utils import *
|
|
5
|
-
from .pubkey_utils import *
|
|
6
|
-
from .signature_data_parse import *
|
|
7
|
-
from .utils import *
|
|
8
|
-
from .log_message_functions import *
|
|
9
|
-
from .constants import *
|
|
10
|
-
from .keypair_utils import *
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
from
|
|
1
|
+
from abstract_apis import get_headers,get_response,get_text_response,load_inner_json
|
|
2
|
+
from abstract_solcatcher import call_solcatcher_db,async_call_solcatcher_py,async_make_rate_limited_call
|
|
3
|
+
import asyncio
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_block_time_from_txn(txnData):
|
|
7
|
+
return int(get_any_value('txnDatablockTime') or 0)
|
|
8
|
+
def get_error_message_from_txn(txnData):
|
|
9
|
+
return make_list(get_any_value(txnData,'err'))[0]
|
|
2
10
|
def get_errorless_txn_from_signature_array(signatureArray):
|
|
3
|
-
return [sig for sig in signatureArray if get_error_message_from_txn(sig) == None]
|
|
11
|
+
return [sig for sig in signatureArray or [] if get_error_message_from_txn(sig) == None]
|
|
4
12
|
def return_oldest_from_signature_array(signatureArray,errorless=False):
|
|
5
13
|
if errorless:
|
|
6
14
|
signatureArray = get_errorless_txn_from_signature_array(signatureArray)
|
|
@@ -11,4 +19,18 @@ def return_oldest_from_signature_array(signatureArray,errorless=False):
|
|
|
11
19
|
def return_oldest_last_and_original_length_from_signature_array(signatureArray):
|
|
12
20
|
return {"oldest":return_oldest_from_signature_array(signatureArray),
|
|
13
21
|
"oldestValid":return_oldest_from_signature_array(signatureArray,errorless=True),
|
|
14
|
-
"length":len(signatureArray)}
|
|
22
|
+
"length":len(signatureArray or '')}
|
|
23
|
+
async def getGenesisSignature(address, limit=1000, before=None,encoding='jsonParsed',commitment=0,errorProof=True):
|
|
24
|
+
method = "getGenesisSignature"
|
|
25
|
+
validBefore=None
|
|
26
|
+
oldest=None
|
|
27
|
+
validOldest=None
|
|
28
|
+
while True:
|
|
29
|
+
signatureArray = await async_make_rate_limited_call(method ="getSignaturesForAddress",params=[address, {"limit":limit, "until":before}],solcatcherSettings={"getResult":'result'})
|
|
30
|
+
original_length = len(signatureArray or '')
|
|
31
|
+
signature_array_data = return_oldest_last_and_original_length_from_signature_array(signatureArray)
|
|
32
|
+
oldest = signature_array_data.get('oldest',oldest) or oldest
|
|
33
|
+
validOldest = signature_array_data.get('oldestValid',validOldest) or validOldest
|
|
34
|
+
if original_length < limit or original_length == 0 or (original_length>0 and (oldest == validOldest or oldest == before) and last_sig != None):
|
|
35
|
+
return validOldest
|
|
36
|
+
|
|
@@ -4,6 +4,7 @@ from .price_utils import *
|
|
|
4
4
|
from .signature_data_parse import get_log_messages_from_txn,get_instructions_from_txn,get_inner_instructions_from_txn
|
|
5
5
|
from .account_key_utils import get_all_account_keys
|
|
6
6
|
from .constants import TOKEN_PROGRAM_ID
|
|
7
|
+
input(TOKEN_PROGRAM_ID)
|
|
7
8
|
def ifListGetSection(list_obj,i=0):
|
|
8
9
|
if list_obj and isinstance(list_obj,list) and len(list_obj)>i:
|
|
9
10
|
list_obj = list_obj[i]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from solders.pubkey import Pubkey
|
|
2
|
+
from solders.signature import Signature
|
|
3
|
+
from spl.token.instructions import get_associated_token_address
|
|
4
|
+
TOKEN_PROGRAM_ID = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
|
|
5
|
+
|
|
6
|
+
def pubkey_find_program_address(string,address,programId):
|
|
7
|
+
return Pubkey.find_program_address([str(string).encode(), bytes(get_pubkey(address))],get_pubkey(programId))
|
|
8
|
+
|
|
9
|
+
def get_pubString(obj):
|
|
10
|
+
return Pubkey.from_string(str(obj))
|
|
11
|
+
|
|
12
|
+
def get_sigString(obj):
|
|
13
|
+
return Signature.from_string(str(obj))
|
|
14
|
+
|
|
15
|
+
def is_sigkey(obj):
|
|
16
|
+
return isinstance(obj,Signature)
|
|
17
|
+
|
|
18
|
+
def is_pubkey(obj):
|
|
19
|
+
return isinstance(obj,Pubkey)
|
|
20
|
+
|
|
21
|
+
def get_pubBytes(obj):
|
|
22
|
+
return Pubkey.from_bytes(obj)
|
|
23
|
+
|
|
24
|
+
def get_sigBytes(obj):
|
|
25
|
+
return Signature.from_bytes(obj)
|
|
26
|
+
|
|
27
|
+
def try_pubkey(obj):
|
|
28
|
+
return is_pubkey(get_pubkey(obj))
|
|
29
|
+
|
|
30
|
+
def try_sigkey(obj):
|
|
31
|
+
return is_sigkey(get_sigkey(obj))
|
|
32
|
+
|
|
33
|
+
def get_pubkey(obj):
|
|
34
|
+
if is_pubkey(obj):
|
|
35
|
+
return obj
|
|
36
|
+
address = obj
|
|
37
|
+
if isinstance(obj,bytes):
|
|
38
|
+
pubkey = get_pubBytes(address)
|
|
39
|
+
if is_pubkey(pubkey):
|
|
40
|
+
return pubkey
|
|
41
|
+
if isinstance(obj,str):
|
|
42
|
+
try:
|
|
43
|
+
pubkey= get_pubString(obj)
|
|
44
|
+
except:
|
|
45
|
+
pubkey = obj
|
|
46
|
+
if is_pubkey(pubkey):
|
|
47
|
+
return pubkey
|
|
48
|
+
return obj
|
|
49
|
+
|
|
50
|
+
def get_sigkey(obj):
|
|
51
|
+
if is_sigkey(obj):
|
|
52
|
+
return obj
|
|
53
|
+
signature = obj
|
|
54
|
+
if isinstance(signature,bytes):
|
|
55
|
+
sigKey = get_sigBytes(signature)
|
|
56
|
+
if is_sigkey(sigKey):
|
|
57
|
+
return sigKey
|
|
58
|
+
if isinstance(signature,str):
|
|
59
|
+
try:
|
|
60
|
+
sigKey= get_sigString(signature)
|
|
61
|
+
except:
|
|
62
|
+
sigKey = signature
|
|
63
|
+
if is_sigkey(sigKey):
|
|
64
|
+
return sigKey
|
|
65
|
+
return obj
|
|
66
|
+
|
|
67
|
+
def isOnCurve(obj):
|
|
68
|
+
pubkey = get_pubkey(obj)
|
|
69
|
+
is_on_curve = pubkey.is_on_curve()
|
|
70
|
+
return is_on_curve
|
|
71
|
+
|
|
72
|
+
def derive_associated_bonding_curve(mint,programId=None):
|
|
73
|
+
return get_associated_token_address(derive_bonding_curve(mint,programId)[0], get_pubkey(mint))
|
|
74
|
+
|
|
75
|
+
def derive_bonding_curve(mint,programId=None):
|
|
76
|
+
programId = programId or TOKEN_PROGRAM_ID
|
|
77
|
+
return pubkey_find_program_address("bonding-curve",mint,programId)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .constants import *
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from ..abstract_solana_utils import get_pubkey,Pubkey
|
|
2
|
+
PUMP_FUN_GLOBAL = get_pubkey("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf")
|
|
3
|
+
PUMP_FUN_FEE_RECIPIENT = get_pubkey("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM")
|
|
4
|
+
PUMP_FUN_SYSTEM_PROGRAM = get_pubkey("11111111111111111111111111111111")
|
|
5
|
+
PUMP_FUN_TOKEN_PROGRAM = get_pubkey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
|
|
6
|
+
PUMP_FUN_ASSOC_TOKEN_ACC_PROG = get_pubkey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")
|
|
7
|
+
PUMP_FUN_RENT = get_pubkey("SysvarRent111111111111111111111111111111111")
|
|
8
|
+
PUMP_FUN_EVENT_AUTHORITY = get_pubkey("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1")
|
|
9
|
+
PUMP_FUN_PROGRAM = get_pubkey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P")
|
|
10
|
+
LAMPORTS_PER_SOL = 1_000_000_000
|
|
11
|
+
UNIT_PRICE = 1_000_000
|
|
12
|
+
UNIT_BUDGET = 100_000
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .rpc_utils import *
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import requests,json
|
|
2
|
+
def get_if_None(obj,fallBack):
|
|
3
|
+
return obj if obj != None else fallBack
|
|
4
|
+
def get_rpc_payload(method,params=None,id=None,jsonrpc=None):
|
|
5
|
+
if method == None:
|
|
6
|
+
return None
|
|
7
|
+
params=get_if_None(params,[])
|
|
8
|
+
rpc_id=int(get_if_None(id,1))
|
|
9
|
+
jsonrpc=str(get_if_None(jsonrpc,"2.0"))
|
|
10
|
+
return {
|
|
11
|
+
"jsonrpc": jsonrpc,
|
|
12
|
+
"id": rpc_id,
|
|
13
|
+
"method": method,
|
|
14
|
+
"params": params
|
|
15
|
+
}
|
|
16
|
+
def get_result(response):
|
|
17
|
+
try:
|
|
18
|
+
response = response.json()
|
|
19
|
+
result = response.get('result',response)
|
|
20
|
+
except:
|
|
21
|
+
result = response.text
|
|
22
|
+
return result
|
|
23
|
+
def make_rpc_call(method, params=[]):
|
|
24
|
+
url = 'https://rpc.ankr.com/solana/c3b7fd92e298d5682b6ef095eaa4e92160989a713f5ee9ac2693b4da8ff5a370'
|
|
25
|
+
headers = {'Content-Type': 'application/json'}
|
|
26
|
+
payload = get_rpc_payload(method=method, params=params)
|
|
27
|
+
response = requests.post(url, data=json.dumps(payload), headers=headers)
|
|
28
|
+
return response
|
|
29
|
+
def get_transaction(signature):
|
|
30
|
+
transaction=None
|
|
31
|
+
method='getTransaction'
|
|
32
|
+
params=[signature,{"maxSupportedTransactionVersion": 0}]
|
|
33
|
+
while True:
|
|
34
|
+
response = make_rpc_call(method=method,params=params)
|
|
35
|
+
transaction = get_result(response)
|
|
36
|
+
if transaction:
|
|
37
|
+
break
|
|
38
|
+
return transaction
|
|
39
|
+
def get_signatures(address, until=None, limit=1000):
|
|
40
|
+
method = 'getSignaturesForAddress'
|
|
41
|
+
params = [address, {"limit": limit}]
|
|
42
|
+
response = make_rpc_call(method=method,params=params)
|
|
43
|
+
return get_result(response)
|
|
44
|
+
async def async_get_signatures(address, until=None, limit=1000):
|
|
45
|
+
method = 'getSignaturesForAddress'
|
|
46
|
+
params = [address, {"limit": limit}]
|
|
47
|
+
response = make_rpc_call(method=method,params=params)
|
|
48
|
+
return get_result(response)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from .pubKeyUtils import get_pubkey,pubkey_find_program_address,Pubkey
|
|
2
|
+
from spl.token.instructions import create_associated_token_account, get_associated_token_address
|
|
3
|
+
from ..pumpFun import PUMP_FUN_PROGRAM
|
|
4
|
+
def derive_associated_bonding_curve(mint,programId=None):
|
|
5
|
+
return get_associated_token_address(derive_bonding_curve(mint,get_pubkey(programId))[0], get_pubkey(mint))
|
|
6
|
+
def derive_bonding_curve(mint,programId=None):
|
|
7
|
+
programId = programId or PUMP_FUN_PROGRAM
|
|
8
|
+
return Pubkey.find_program_address(["bonding-curve".encode(), get_pubkey_bytes(mint)],get_pubkey(programId))
|
|
9
|
+
def derive_bonding_curve_accounts(mint_str: str,programId=None):
|
|
10
|
+
mintPubKey = get_pubkey(mint_str)
|
|
11
|
+
if not mintPubKey.is_on_curve():
|
|
12
|
+
return {}
|
|
13
|
+
bonding_curve, _ = derive_bonding_curve(mintPubKey,programId)
|
|
14
|
+
associated_bonding_curve = get_associated_token_address(bonding_curve, mintPubKey)
|
|
15
|
+
return {'bonding_curve': bonding_curve, "associated_bonding_curve": associated_bonding_curve}
|
|
16
|
+
def get_bonding_curve(mint:str):
|
|
17
|
+
return derive_bonding_curve_accounts(mint).get('bonding_curve')
|
|
18
|
+
def get_associated_bonding_curve(mint:str):
|
|
19
|
+
return derive_bonding_curve_accounts(mint).get("associated_bonding_curve")
|
|
20
|
+
def isOnCurve(obj):
|
|
21
|
+
pubkey = get_pubkey(obj)
|
|
22
|
+
is_on_curve = pubkey.is_on_curve()
|
|
23
|
+
return is_on_curve
|
|
24
|
+
def derive_associated_bonding_curve(mint,programId=None):
|
|
25
|
+
programId = programId or PUMP_FUN_PROGRAM
|
|
26
|
+
return get_associated_token_address(derive_bonding_curve(mint,get_pubkey(programId))[0], get_pubkey(mint))
|
|
27
|
+
def derive_bonding_curve(mint,programId=None):
|
|
28
|
+
programId = programId or PUMP_FUN_PROGRAM
|
|
29
|
+
return pubkey_find_program_address("bonding-curve",mint,get_pubkey(programId))
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from abstract_apis import get_headers,get_response,get_text_response,load_inner_json
|
|
2
|
+
from abstract_solcatcher import call_solcatcher_db,async_call_solcatcher_py,async_make_rate_limited_call
|
|
3
|
+
import asyncio
|
|
4
|
+
import asyncio,httpx,logging
|
|
5
|
+
def get_block_time_from_txn(txnData):
|
|
6
|
+
return int(get_any_value('txnDatablockTime') or 0)
|
|
7
|
+
def get_error_message_from_txn(txnData):
|
|
8
|
+
return make_list(get_any_value(txnData,'err'))[0]
|
|
9
|
+
def get_errorless_txn_from_signature_array(signatureArray):
|
|
10
|
+
return [sig for sig in signatureArray or [] if get_error_message_from_txn(sig) == None]
|
|
11
|
+
def return_oldest_from_signature_array(signatureArray,errorless=False):
|
|
12
|
+
if errorless:
|
|
13
|
+
signatureArray = get_errorless_txn_from_signature_array(signatureArray)
|
|
14
|
+
if signatureArray and isinstance(signatureArray,list):
|
|
15
|
+
if get_block_time_from_txn(signatureArray[0])<get_block_time_from_txn(signatureArray[-1]):
|
|
16
|
+
return signatureArray[0].get('signature')
|
|
17
|
+
return signatureArray[-1].get('signature')
|
|
18
|
+
def return_oldest_last_and_original_length_from_signature_array(signatureArray):
|
|
19
|
+
return {"oldest":return_oldest_from_signature_array(signatureArray),
|
|
20
|
+
"oldestValid":return_oldest_from_signature_array(signatureArray,errorless=True),
|
|
21
|
+
"length":len(signatureArray or '')}
|
|
22
|
+
async def getGenesisSignature(address, limit=1000, before=None,encoding='jsonParsed',commitment=0,errorProof=True):
|
|
23
|
+
method = "getGenesisSignature"
|
|
24
|
+
validBefore=None
|
|
25
|
+
oldest=None
|
|
26
|
+
validOldest=None
|
|
27
|
+
while True:
|
|
28
|
+
signatureArray = await async_make_rate_limited_call(method ="getSignaturesForAddress",params=[address, {"limit":limit, "until":before}],solcatcherSettings={"getResponse":True,"getResult":'result'})
|
|
29
|
+
original_length = len(signatureArray or '')
|
|
30
|
+
signature_array_data = return_oldest_last_and_original_length_from_signature_array(signatureArray)
|
|
31
|
+
oldest = signature_array_data.get('oldest',oldest) or oldest
|
|
32
|
+
validOldest = signature_array_data.get('oldestValid',validOldest) or validOldest
|
|
33
|
+
if original_length < limit or original_length == 0 or (original_length>0 and (oldest == validOldest or oldest == before) and last_sig != None):
|
|
34
|
+
return validOldest
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from solders.pubkey import Pubkey
|
|
2
|
+
from solders.signature import Signature
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def pubkey_find_program_address(string,address,programId):
|
|
6
|
+
return Pubkey.find_program_address([str(string).encode(), bytes(get_pubkey(address))],get_pubkey(programId))
|
|
7
|
+
|
|
8
|
+
def get_pubString(obj):
|
|
9
|
+
return Pubkey.from_string(str(obj))
|
|
10
|
+
|
|
11
|
+
def get_sigString(obj):
|
|
12
|
+
return Signature.from_string(str(obj))
|
|
13
|
+
|
|
14
|
+
def is_sigkey(obj):
|
|
15
|
+
return isinstance(obj,Signature)
|
|
16
|
+
|
|
17
|
+
def is_pubkey(obj):
|
|
18
|
+
return isinstance(obj,Pubkey)
|
|
19
|
+
|
|
20
|
+
def get_pubBytes(obj):
|
|
21
|
+
return Pubkey.from_bytes(obj)
|
|
22
|
+
|
|
23
|
+
def get_sigBytes(obj):
|
|
24
|
+
return Signature.from_bytes(obj)
|
|
25
|
+
|
|
26
|
+
def try_pubkey(obj):
|
|
27
|
+
return is_pubkey(get_pubkey(obj))
|
|
28
|
+
|
|
29
|
+
def try_sigkey(obj):
|
|
30
|
+
return is_sigkey(get_sigkey(obj))
|
|
31
|
+
|
|
32
|
+
def get_pubkey(obj):
|
|
33
|
+
if is_pubkey(obj):
|
|
34
|
+
return obj
|
|
35
|
+
address = obj
|
|
36
|
+
if isinstance(obj,bytes):
|
|
37
|
+
pubkey = get_pubBytes(address)
|
|
38
|
+
if is_pubkey(pubkey):
|
|
39
|
+
return pubkey
|
|
40
|
+
if isinstance(obj,str):
|
|
41
|
+
try:
|
|
42
|
+
pubkey= get_pubString(obj)
|
|
43
|
+
except:
|
|
44
|
+
pubkey = obj
|
|
45
|
+
if is_pubkey(pubkey):
|
|
46
|
+
return pubkey
|
|
47
|
+
return obj
|
|
48
|
+
|
|
49
|
+
def get_pubkey_bytes(obj):
|
|
50
|
+
pubkey = get_pubkey(obj)
|
|
51
|
+
try:
|
|
52
|
+
pubKeyBytes = bytes(pubkey)
|
|
53
|
+
return pubKeyBytes
|
|
54
|
+
except:
|
|
55
|
+
return obj
|
|
56
|
+
|
|
57
|
+
def get_pubkey_base58(obj):
|
|
58
|
+
pubkey = get_pubkey(obj)
|
|
59
|
+
address = pubkey.to_base58() # Convert to string
|
|
60
|
+
return address
|
|
61
|
+
|
|
62
|
+
def get_sigkey(obj):
|
|
63
|
+
if is_sigkey(obj):
|
|
64
|
+
return obj
|
|
65
|
+
signature = obj
|
|
66
|
+
if isinstance(signature,bytes):
|
|
67
|
+
sigKey = get_sigBytes(signature)
|
|
68
|
+
if is_sigkey(sigKey):
|
|
69
|
+
return sigKey
|
|
70
|
+
if isinstance(signature,str):
|
|
71
|
+
try:
|
|
72
|
+
sigKey= get_sigString(signature)
|
|
73
|
+
except:
|
|
74
|
+
sigKey = signature
|
|
75
|
+
if is_sigkey(sigKey):
|
|
76
|
+
return sigKey
|
|
77
|
+
return obj
|
|
78
|
+
|
|
79
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: abstract_solana
|
|
3
|
-
Version: 0.0.2.
|
|
3
|
+
Version: 0.0.2.133
|
|
4
4
|
Home-page: https://github.com/AbstractEndeavors/abstract_solana
|
|
5
5
|
Author: putkoff
|
|
6
6
|
Author-email: partners@abstractendeavors.com
|
|
@@ -19,9 +19,17 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Requires-Python: >=3.6
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
Requires-Dist: solders
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
22
|
+
Requires-Dist: abstract_solcatcher
|
|
23
|
+
Requires-Dist: abstract_utilities
|
|
24
24
|
Requires-Dist: solana
|
|
25
|
+
Dynamic: author
|
|
26
|
+
Dynamic: author-email
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: description-content-type
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
25
33
|
|
|
26
34
|
## Abstract Solana
|
|
27
35
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
abstract_solana/__init__.py,sha256=G02z__U8Vjkt2sosh90FoCYM2z8ibighPJ-oASG_ZsY,85
|
|
2
|
+
abstract_solana/abstract_rpcs/__init__.py,sha256=LIkUCWcuzUWVN1WjzcXjQ9Pl7cbcN8TwknXir-Uk34c,168
|
|
3
|
+
abstract_solana/abstract_rpcs/db_templates.py,sha256=sjdHfHIq9bO6VuDm3hwzn46NUrXXrGnB0knYNeVU7k8,29839
|
|
4
|
+
abstract_solana/abstract_rpcs/get_api_gui.py,sha256=zii6XCRD_wmgcupqCSH5lyXIvg5nxZdpmcQm4ykDi0o,12180
|
|
5
|
+
abstract_solana/abstract_rpcs/get_body.py,sha256=UV85217q7mIpYOhVZdnzfmgZxD3QM0w0J0oevXyYtdE,51272
|
|
6
|
+
abstract_solana/abstract_rpcs/rate_limiter.py,sha256=yfUwmdMXty05VN_A-baTrOKY4EH9fYF1Vc7SKPZgcTk,7248
|
|
7
|
+
abstract_solana/abstract_rpcs/solana_rpc_client.py,sha256=s-Mg0mDcDwjU3dm6nK_U6wWysaWTLoC4eXpSHbYsbyY,4132
|
|
8
|
+
abstract_solana/abstract_solana_utils/__init__.py,sha256=9wyZpK5Gv3xMhmhHWA9OarvH3VqLXLO6mx4RNU6bgSo,89
|
|
9
|
+
abstract_solana/abstract_solana_utils/bondingCurves.py,sha256=06vmusYnq2jcZasPNC8mzsv6Qoz0AaRenue3VCmiXzw,1342
|
|
10
|
+
abstract_solana/abstract_solana_utils/genesis_functions.py,sha256=IL94IXZXJ6j1yFdSU10U1RvBfwIf_YQhRhSyxKCw1Gs,3151
|
|
11
|
+
abstract_solana/abstract_solana_utils/pubKeyUtils.py,sha256=IZuQN7TUFCUxqv0q_FiufIw1OkNgF252gF6W-LzAluA,1856
|
|
12
|
+
abstract_solana/abstract_utils/__init__.py,sha256=d0JzaSlwLMU4GPq8PO7UucTtNXUSVdBjOAtIZ8BDAQE,60
|
|
13
|
+
abstract_solana/abstract_utils/account_key_utils.py,sha256=VMJd4GOTK1vn8UZsfXDnjxDOGoQWGY6fvflJqPZ7Xvs,877
|
|
14
|
+
abstract_solana/abstract_utils/constants.py,sha256=cSmCKzQiNZocX1YkKYrdY-O449aYhi7BT_j-45HZN-E,1418
|
|
15
|
+
abstract_solana/abstract_utils/genesis_functions.py,sha256=QUTLe4dVU4VVfI63MUctgUpqGwUkDj_ldP4B7ZT6Lv4,2174
|
|
16
|
+
abstract_solana/abstract_utils/index_utils.py,sha256=Ed07BYTZWp-SVfpthAUqjRY00U3ZYldPCqd7LJy9AO8,1884
|
|
17
|
+
abstract_solana/abstract_utils/keypair_utils.py,sha256=VgbwbX9BcXnypkbBJkPwXmSIKORUlMVakkoLk7hTXCw,572
|
|
18
|
+
abstract_solana/abstract_utils/log_message_functions.py,sha256=smkTnxpe8nMxh6NEFjzPoxrn7ojEcLwBLX21K7wAWzs,8104
|
|
19
|
+
abstract_solana/abstract_utils/price_utils.py,sha256=BLkwFLhlsTHeW0NTdzCAUi2xhc2lX7SrHz5sslDbUrY,4288
|
|
20
|
+
abstract_solana/abstract_utils/pubKeyUtils.py,sha256=pFeskDUYDGwcRVRhATeqzQIHYgx6pEPODjodlYYAl2U,2122
|
|
21
|
+
abstract_solana/abstract_utils/pubkey_utils.py,sha256=TAYF74fKAuTBnqIP2SnA-BttO5uoHbxI9BRZRpGCMNY,2010
|
|
22
|
+
abstract_solana/abstract_utils/signature_data_parse.py,sha256=5AOMtJZADWcwR0JLDbd2kXZNzW129qeB0lvYUrE_tm0,1974
|
|
23
|
+
abstract_solana/abstract_utils/utils.py,sha256=RcnGEiZ0aJbcw8ObpjHU3WUFU4Tmy-exCs6qIbEu4_c,444
|
|
24
|
+
abstract_solana/pumpFun/__init__.py,sha256=81quoggCuIypZjZs3bbf1Ty70KHdva5RGEJxi0oC57E,25
|
|
25
|
+
abstract_solana/pumpFun/constants.py,sha256=jmSZWzfH2HkfKUoIUgvTzAtn9PqsPTZJ0I3UQXV4l0c,779
|
|
26
|
+
abstract_solana/pump_functions/__init__.py,sha256=BiRxwJd1JWwEft63zqYwZ_Xs6UDp4hjczjzvuwy3sHg,85
|
|
27
|
+
abstract_solana/pump_functions/buy_sell_pump.py,sha256=gjv_1et20s1Li0ygcURofO29VPkO1v-a5G5Bo_sZs_c,7860
|
|
28
|
+
abstract_solana/pump_functions/pump_fun_keys.py,sha256=BeWbV9_wd-c6ydF33drW-gZBDPWolbsMZL4cNhP3eOU,8537
|
|
29
|
+
abstract_solana/pump_functions/token_utils.py,sha256=O-Fgj3L1NhND-k4INa3WvLAEXg2N9u1fVqyLFzn1PwM,2714
|
|
30
|
+
abstract_solana/rpc_utils/__init__.py,sha256=N0ZEvVoLpxi0lWX0ZjBt3mKWGLVvDw35moj_2e9vChk,25
|
|
31
|
+
abstract_solana/rpc_utils/rpc_utils.py,sha256=pPZz3CvEAi0HSNmCRVXGT--3bCgKa2BGVDyjvZRzyzg,1770
|
|
32
|
+
abstract_solana/utils/__init__.py,sha256=9wyZpK5Gv3xMhmhHWA9OarvH3VqLXLO6mx4RNU6bgSo,89
|
|
33
|
+
abstract_solana/utils/bondingCurves.py,sha256=gGAm0dyrth3ScTRzhIWwb1_cA7GMztdkwmuB2ylT79c,1717
|
|
34
|
+
abstract_solana/utils/genesis_functions.py,sha256=-O44ZHYb6zrhvqhPpN1cZzdUpvON2q4sPblS4Ezo-ag,2223
|
|
35
|
+
abstract_solana/utils/pubKeyUtils.py,sha256=IZuQN7TUFCUxqv0q_FiufIw1OkNgF252gF6W-LzAluA,1856
|
|
36
|
+
abstract_solana-0.0.2.133.dist-info/METADATA,sha256=xqwgNXI0I1Sb5pC4RXsj0Y2GmbemvNtoUrYDfCd_yqc,1162
|
|
37
|
+
abstract_solana-0.0.2.133.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
38
|
+
abstract_solana-0.0.2.133.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
|
|
39
|
+
abstract_solana-0.0.2.133.dist-info/RECORD,,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
abstract_solana/__init__.py,sha256=uEPtTF-WPCIwpwR8OgAI5prloYQpPbx-YExFgzZvFkQ,59
|
|
2
|
-
abstract_solana/abstract_rpcs/__init__.py,sha256=DP-TZ8GGPUu4ETVDuFFLFxkJH2_QY-j8R19zB0reA9E,158
|
|
3
|
-
abstract_solana/abstract_rpcs/db_templates.py,sha256=sjdHfHIq9bO6VuDm3hwzn46NUrXXrGnB0knYNeVU7k8,29839
|
|
4
|
-
abstract_solana/abstract_rpcs/get_api_gui.py,sha256=OZ61HHb0gwdYjirwFFmnwk8z9x5np3cecCj9MdmuF8U,12372
|
|
5
|
-
abstract_solana/abstract_rpcs/get_body.py,sha256=UV85217q7mIpYOhVZdnzfmgZxD3QM0w0J0oevXyYtdE,51272
|
|
6
|
-
abstract_solana/abstract_rpcs/rate_limiter.py,sha256=AuHtjpCfTw5os-v5kW0bt1wWOvaRvZIkoWjlexlego8,5216
|
|
7
|
-
abstract_solana/abstract_rpcs/solana_rpc_client.py,sha256=tbTUJC0gJkyRFgObqTxhIDmkuO_q9GmTnhClWi-HxfA,3751
|
|
8
|
-
abstract_solana/abstract_utils/__init__.py,sha256=HCbBVQ5BIFCVkFqqTMHp1Y__YQAO4HTq_KHVdMCe89U,296
|
|
9
|
-
abstract_solana/abstract_utils/account_key_utils.py,sha256=VMJd4GOTK1vn8UZsfXDnjxDOGoQWGY6fvflJqPZ7Xvs,877
|
|
10
|
-
abstract_solana/abstract_utils/constants.py,sha256=cSmCKzQiNZocX1YkKYrdY-O449aYhi7BT_j-45HZN-E,1418
|
|
11
|
-
abstract_solana/abstract_utils/genesis_functions.py,sha256=2WRQUxN9j-dpLfYIBiX3URM-_uDGkh-eTy08Gi-qWgo,939
|
|
12
|
-
abstract_solana/abstract_utils/index_utils.py,sha256=Ed07BYTZWp-SVfpthAUqjRY00U3ZYldPCqd7LJy9AO8,1884
|
|
13
|
-
abstract_solana/abstract_utils/keypair_utils.py,sha256=YPiyjdh6F3JOmgcmXWR72EmSZKy0UF5AbYebeKSu86w,616
|
|
14
|
-
abstract_solana/abstract_utils/log_message_functions.py,sha256=-qGO4rJRHKVEV8eqs4OCe5Rx1osTlEoc07fUruMBFp8,8080
|
|
15
|
-
abstract_solana/abstract_utils/price_utils.py,sha256=BLkwFLhlsTHeW0NTdzCAUi2xhc2lX7SrHz5sslDbUrY,4288
|
|
16
|
-
abstract_solana/abstract_utils/pubkey_utils.py,sha256=TAYF74fKAuTBnqIP2SnA-BttO5uoHbxI9BRZRpGCMNY,2010
|
|
17
|
-
abstract_solana/abstract_utils/signature_data_parse.py,sha256=5AOMtJZADWcwR0JLDbd2kXZNzW129qeB0lvYUrE_tm0,1974
|
|
18
|
-
abstract_solana/abstract_utils/utils.py,sha256=RcnGEiZ0aJbcw8ObpjHU3WUFU4Tmy-exCs6qIbEu4_c,444
|
|
19
|
-
abstract_solana/pump_functions/__init__.py,sha256=BiRxwJd1JWwEft63zqYwZ_Xs6UDp4hjczjzvuwy3sHg,85
|
|
20
|
-
abstract_solana/pump_functions/buy_sell_pump.py,sha256=gjv_1et20s1Li0ygcURofO29VPkO1v-a5G5Bo_sZs_c,7860
|
|
21
|
-
abstract_solana/pump_functions/pump_fun_keys.py,sha256=BeWbV9_wd-c6ydF33drW-gZBDPWolbsMZL4cNhP3eOU,8537
|
|
22
|
-
abstract_solana/pump_functions/token_utils.py,sha256=O-Fgj3L1NhND-k4INa3WvLAEXg2N9u1fVqyLFzn1PwM,2714
|
|
23
|
-
abstract_solana-0.0.2.79.dist-info/METADATA,sha256=1n-Q5IHzMw_bCAMyMejhnwSKOkSLnGhibwtPL8JeOCg,981
|
|
24
|
-
abstract_solana-0.0.2.79.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
25
|
-
abstract_solana-0.0.2.79.dist-info/top_level.txt,sha256=SsJYent8eZQ0FU2jmP8wTj7aFZFhNwxxP-5cCTQ2B-o,16
|
|
26
|
-
abstract_solana-0.0.2.79.dist-info/RECORD,,
|
|
File without changes
|