-
Notifications
You must be signed in to change notification settings - Fork 5
/
find_sigs.py
33 lines (24 loc) · 930 Bytes
/
find_sigs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from solana.rpc.api import Client
from solders.pubkey import Pubkey
from solders.signature import Signature
import orjson
import json
import os
client = Client(os.getenv('RPC'))
ACCOUNT_PUBKEY = Pubkey.from_string('Ec9xymGeMuURLQfpMsMPkEwy5ktAiQSaFSjF5oJ3kERa')
d = {}
s_l = client.get_signatures_for_address(ACCOUNT_PUBKEY, before=None)
s_l_js = orjson.loads(s_l.to_json())
try:
while len(s_l_js['result']) > 0:
for s in s_l_js['result']:
if s['err'] is not None: continue
sig = s['signature']
slot = s['slot']
d[sig] = slot
print('lsig:', sig, 'slot:', slot, 'len:', len(d))
s_l = client.get_signatures_for_address(ACCOUNT_PUBKEY, before=Signature.from_string(sig))
s_l_js = orjson.loads(s_l.to_json())
except: pass
with open('data/signature-slot.json', 'w') as f:
f.writelines(json.dumps(d, indent=4))