Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,23 +37,24 @@ class Payment(BaseModel):
|
|
| 37 |
instruction:str
|
| 38 |
|
| 39 |
|
| 40 |
-
|
| 41 |
def load_keypair(agent):
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
secret_key_bytes =bytes.fromhex(keypair)
|
| 51 |
-
keypair = Keypair.from_bytes(
|
| 52 |
|
| 53 |
print(f"✅ Keypair loaded from {path}")
|
| 54 |
print(f"📍 Public Key: {keypair.pubkey()}")
|
| 55 |
|
| 56 |
-
return keypair
|
| 57 |
|
| 58 |
|
| 59 |
|
|
@@ -79,7 +80,7 @@ async def PaymentInstruction(request:Payment):
|
|
| 79 |
return {"status_":output}
|
| 80 |
|
| 81 |
except error:
|
| 82 |
-
|
| 83 |
|
| 84 |
|
| 85 |
|
|
|
|
| 37 |
instruction:str
|
| 38 |
|
| 39 |
|
|
|
|
| 40 |
def load_keypair(agent):
|
| 41 |
|
| 42 |
+
document=coll.find_one({"owner":"system"})
|
| 43 |
+
keypair=None
|
| 44 |
+
agents=document.get("agents")
|
| 45 |
+
print(agents)
|
| 46 |
+
|
| 47 |
+
for doc in agents:
|
| 48 |
+
if doc["agent_id"]==agent:
|
| 49 |
+
keypair=doc["secret_key"]
|
| 50 |
|
| 51 |
secret_key_bytes =bytes.fromhex(keypair)
|
| 52 |
+
keypair = Keypair.from_bytes(secret_key_bytes)
|
| 53 |
|
| 54 |
print(f"✅ Keypair loaded from {path}")
|
| 55 |
print(f"📍 Public Key: {keypair.pubkey()}")
|
| 56 |
|
| 57 |
+
return keypair
|
| 58 |
|
| 59 |
|
| 60 |
|
|
|
|
| 80 |
return {"status_":output}
|
| 81 |
|
| 82 |
except error:
|
| 83 |
+
return {"status_":False}
|
| 84 |
|
| 85 |
|
| 86 |
|