Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,10 @@ from pydantic import BaseModel
|
|
| 3 |
from fastapi.responses import JSONResponse
|
| 4 |
from components.mongodbconnection import provideClient
|
| 5 |
from components.agentcreation import VelocityPayableAgent
|
|
|
|
| 6 |
from fastapi.middleware.cors import CORSMiddleware
|
| 7 |
|
|
|
|
| 8 |
app=FastAPI()
|
| 9 |
|
| 10 |
origins=["*"]
|
|
@@ -37,25 +39,6 @@ class Payment(BaseModel):
|
|
| 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 |
|
| 61 |
|
|
|
|
| 3 |
from fastapi.responses import JSONResponse
|
| 4 |
from components.mongodbconnection import provideClient
|
| 5 |
from components.agentcreation import VelocityPayableAgent
|
| 6 |
+
from components.agentcreation import load_keypair
|
| 7 |
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
|
| 9 |
+
|
| 10 |
app=FastAPI()
|
| 11 |
|
| 12 |
origins=["*"]
|
|
|
|
| 39 |
instruction:str
|
| 40 |
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
|