-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_wallet_migration.py
More file actions
39 lines (36 loc) · 1.18 KB
/
check_wallet_migration.py
File metadata and controls
39 lines (36 loc) · 1.18 KB
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
34
35
36
37
38
39
import os
import psycopg2
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
def check_wallet_migration(wallet_address):
conn = psycopg2.connect(
host=os.getenv('DB_HOST'),
port=os.getenv('DB_PORT'),
dbname=os.getenv('DB_NAME'),
user=os.getenv('DB_USER'),
password=os.getenv('DB_PASSWORD')
)
cur = conn.cursor()
query = """
SELECT * FROM migrated_wallets
WHERE LOWER(original_wallet) = LOWER(%s) OR LOWER(users_wallet) = LOWER(%s)
"""
cur.execute(query, (wallet_address, wallet_address))
rows = cur.fetchall()
if not rows:
print(f"No migration found for wallet: {wallet_address}")
else:
for row in rows:
print("Migration record:")
print(f" id: {row[0]}")
print(f" original_wallet: {row[1]}")
print(f" users_wallet: {row[2]}")
print(f" original_username: {row[3]}")
print(f" users_username: {row[4]}")
print("-" * 40)
cur.close()
conn.close()
if __name__ == "__main__":
wallet_address = input("Enter wallet address: ")
check_wallet_migration(wallet_address)