Skip to content

Commit b4b67a5

Browse files
Staking FLR could work now
1 parent 0e69f21 commit b4b67a5

File tree

1 file changed

+10
-10
lines changed
  • src/flare_ai_defai/api/routes

1 file changed

+10
-10
lines changed

src/flare_ai_defai/api/routes/chat.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,15 @@ async def handle_stake(self, message: str, user: UserInfo) -> dict[str, str]:
511511
follow_up_response = self.ai.generate(prompt)
512512
return {"response": follow_up_response.text + " \n " + json.dumps(response_json)}
513513

514-
514+
txs = self.kinetic_market.swapFLRtoSFLR(user, 1)
515+
516+
self.blockchain.add_tx_to_queue(msg=message, txs=txs)
517+
formatted_preview = (
518+
"Transaction Preview: "
519+
+ f"Staking {response_json["amount"]} FLR"
520+
+ f"\nType CONFIRM to proceed."
521+
)
522+
return {"response": formatted_preview}
515523

516524
# Return stringified JSON
517525
return {"response": json.dumps(response_json)}
@@ -552,15 +560,7 @@ async def handle_borrow(self, message: str, user: UserInfo) -> dict[str, str]:
552560
if (ai_response_json.get("amount") == 0.0):
553561
return {"response": "Sorry, amount must be more than 0.0 \n " + json.dumps(ai_response_json)}
554562

555-
txs = self.kinetic_market.swapFLRtoSFLR(user, 1)
556-
557-
self.blockchain.add_tx_to_queue(msg=message, txs=txs)
558-
formatted_preview = (
559-
"Transaction Preview: "
560-
#+ f"Staking {Web3.from_wei(tx.get('value', 0), 'ether')} "
561-
+ f"FLR to sFLR\nType CONFIRM to proceed."
562-
)
563-
return {"response": formatted_preview}
563+
return {"response": "Sorry, not implemented yet"}
564564

565565

566566

0 commit comments

Comments
 (0)