From 2c34b57fee0d7fb9279b467d0dd0ce78c9b08731 Mon Sep 17 00:00:00 2001 From: Prafful <46891804+iamsahu@users.noreply.github.com> Date: Thu, 21 Sep 2023 20:50:39 +0200 Subject: [PATCH] Updated Lido integration (#159) * Update widgets.yaml * feat: reth * tested * Update README.md * Update display_widgets.py * update for reth * Update constants.py * chore: update widget idx * fix: use items --------- Co-authored-by: marcomariscal --- README.md | 1 + chat/display_widgets.py | 14 ++++++++++- knowledge_base/widgets.yaml | 46 ++++++++++++++++++++++++++++++++++++- utils/constants.py | 2 +- 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8f41a81..a4f7c80 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ The usage guide for the Cacti chatbot is available [here](./usage_guide.md) ## Steps to add new widget command - Update `widgets.yaml` with the widget command details + - If no value has to be returned please specify an empty string '' for `return_value_description` - Increment the numeric version in `WIDGET_INDEX_NAME` constant in `utils/constants.py` - For local env, the widget index name would use your OS login name to create an isolated index. For dev/prod, the widget index would be the numeric version mentioned above. (more info in `scripts/check_update_widget_index.py`) - Run this Python command to update your widget index with the new widget `python -m scripts.check_update_widget_index` diff --git a/chat/display_widgets.py b/chat/display_widgets.py index 67fdc5f..9236f0d 100644 --- a/chat/display_widgets.py +++ b/chat/display_widgets.py @@ -170,13 +170,25 @@ def _widgetize_inner(command: str, params: str, depth: int = 0) -> str: lines.append(f"yield protocol borrow action for borrow token: {items[0]}, borrow amount: {items[1]}, collateral token: {items[2]}, collateral amount: {items[3]}.") elif command == 'yield-protocol-borrow-close': items = params.split(",") - lines.append(f"yield protocol borrow close action: {items[0]}") + lines.append(f"yield protocol borrow close action: {items[0]}") elif command == 'hop-protocol-bridge': items = params.split(",") lines.append(f"hop protocol bridge action for amount: {items[0]}, token symbol: {items[1]}, from chain: {items[2]}, to chain: {items[3]}.") elif command == 'tx-replay': items = params.split(",") lines.append(f"replay transaction with tx hash: {items[0]}") + elif command == "deposit-eth-lido": + items = params.split(",") + lines.append(f"deposit eth to lido action for amount: {items[0]}.") + elif command == "withdraw-eth-lido": + items = params.split(",") + lines.append(f"withdraw eth from lido action for amount: {items[0]}.") + elif command == "deposit-eth-reth": + items = params.split(",") + lines.append(f"deposit eth to reth action for amount: {items[0]}.") + elif command == "withdraw-eth-reth": + items = params.split(",") + lines.append(f"withdraw eth from reth action for amount: {items[0]}.") else: # assert 0, f'unrecognized command: {command}({params})' lines.append(f"An unrecognized command: {command}({params})") diff --git a/knowledge_base/widgets.yaml b/knowledge_base/widgets.yaml index afeb6c9..099f4ba 100644 --- a/knowledge_base/widgets.yaml +++ b/knowledge_base/widgets.yaml @@ -731,4 +731,48 @@ required: - txHash type: object - return_value_description: "" \ No newline at end of file + return_value_description: "" +- _name_: display_deposit_eth_lido + description: This widget is only used when the user wants to deposit/stake ETH into the Lido protocol to get steth + parameters: + properties: + amount: + description: Amount of ETH to deposit/stake into Lido (and obtain stETH) + type: string + required: + - amount + type: object + return_value_description: '' +- _name_: display_withdraw_eth_lido + description: This widget is only used when the user wants to withdraw ETH from Lido (convert stETH to ETH) + parameters: + properties: + amount: + description: Amount of ETH to withdraw from Lido + type: string + required: + - amount + type: object + return_value_description: '' +- _name_: deposit_eth_reth + description: This widget is only used when the user wants to deposit ETH into the rocket pool protocol to get rETH + parameters: + properties: + amount: + description: Amount of ETH to deposit into rocket pool (and obtain rETH) + type: string + required: + - amount + type: object + return_value_description: '' +- _name_: display_withdraw_eth_reth + description: This widget is only used when the user wants to withdraw ETH from rETH (convert rETH to ETH) + parameters: + properties: + amount: + description: Amount of ETH to withdraw from rocket pool + type: string + required: + - amount + type: object + return_value_description: '' \ No newline at end of file diff --git a/utils/constants.py b/utils/constants.py index 20bfb48..b65c534 100644 --- a/utils/constants.py +++ b/utils/constants.py @@ -53,7 +53,7 @@ WIDGET_INFO_TOKEN_LIMIT = 4000 # Widget Index -WIDGET_INDEX_NAME = "WidgetV22" +WIDGET_INDEX_NAME = "WidgetV23" def get_widget_index_name(): if env.is_local():