Junaidb commited on
Commit
616e72e
·
verified ·
1 Parent(s): c0be303

Update components/paymenthandling.py

Browse files
Files changed (1) hide show
  1. components/paymenthandling.py +18 -2
components/paymenthandling.py CHANGED
@@ -3,7 +3,6 @@ from solana.rpc.async_api import AsyncClient
3
  from .mongodbconnection import provideClient
4
 
5
 
6
-
7
  client=provideClient()
8
  db=client["agentpaymentdb"]
9
  coll=db["agentpaymentcol"]
@@ -57,4 +56,21 @@ class PaymentHandler():
57
  except Exception as e:
58
  print(f"❌ Transfer failed: {e}")
59
  return False
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  from .mongodbconnection import provideClient
4
 
5
 
 
6
  client=provideClient()
7
  db=client["agentpaymentdb"]
8
  coll=db["agentpaymentcol"]
 
56
  except Exception as e:
57
  print(f"❌ Transfer failed: {e}")
58
  return False
59
+
60
+ def load_keypair(self):
61
+ """Load keypair from file"""
62
+
63
+ documents=coll.find_one({"owner":"system"})
64
+ keypair=None
65
+
66
+ for doc in documents:
67
+ if doc["agent_id"]==self.agent:
68
+ keypair=doc["secret_key"]
69
+
70
+ secret_key_bytes =bytes.fromhex(keypair)
71
+ keypair = Keypair.from_bytes(secret_key)
72
+
73
+ print(f"✅ Keypair loaded from {path}")
74
+ print(f"📍 Public Key: {keypair.pubkey()}")
75
+
76
+ return keypair