Skip to content

Commit

Permalink
remove-gateway-list-command
Browse files Browse the repository at this point in the history
  • Loading branch information
nikspz committed Mar 15, 2024
1 parent f7ab92d commit 29672e1
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 45 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 0 additions & 23 deletions hummingbot/client/command/gateway_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
gateway_connector_trading_pairs,
)
from hummingbot.client.ui.completer import load_completer
from hummingbot.client.ui.interface_utils import format_df_for_printout
from hummingbot.core.gateway import get_gateway_paths
from hummingbot.core.gateway.gateway_http_client import GatewayHttpClient
from hummingbot.core.gateway.gateway_status_monitor import GatewayStatus
Expand All @@ -33,7 +32,6 @@
build_config_dict_display,
build_connector_display,
build_connector_tokens_display,
build_list_display,
build_wallet_display,
flatten,
native_tokens,
Expand Down Expand Up @@ -101,10 +99,6 @@ def generate_certs(self):
def test_connection(self):
safe_ensure_future(self._test_connection(), loop=self.ev_loop)

@ensure_gateway_online
def gateway_list(self):
safe_ensure_future(self._gateway_list(), loop=self.ev_loop)

@ensure_gateway_online
def gateway_config(self,
key: Optional[str] = None,
Expand Down Expand Up @@ -681,23 +675,6 @@ async def _update_gateway_connector_tokens(
self.notify(
f"The 'gateway balance' command will now report token balances {new_tokens} for '{chain_network}'.")

async def _gateway_list(
self # type: HummingbotApplication
):
connector_list: List[Dict[str, Any]] = await self._get_gateway_instance().get_connectors()
connectors_tiers: List[Dict[str, Any]] = []
for connector in connector_list["connectors"]:
available_networks: List[Dict[str, Any]
] = connector["available_networks"]
chains: List[str] = [d['chain'] for d in available_networks]
connector['chains'] = chains
connectors_tiers.append(connector)
connectors_df: pd.DataFrame = build_list_display(connectors_tiers)
lines = [" " + line for line in format_df_for_printout(
connectors_df,
table_format=self.client_config_map.tables_format).split("\n")]
self.notify("\n".join(lines))

async def _update_gateway_approve_tokens(
self, # type: HummingbotApplication
connector_chain_network: str,
Expand Down
2 changes: 1 addition & 1 deletion hummingbot/client/ui/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, hummingbot_application):
self._export_completer = WordCompleter(["keys", "trades"], ignore_case=True)
self._balance_completer = WordCompleter(["limit", "paper"], ignore_case=True)
self._history_completer = WordCompleter(["--days", "--verbose", "--precision"], ignore_case=True)
self._gateway_completer = WordCompleter(["balance", "config", "connect", "connector-tokens", "generate-certs", "test-connection", "list", "approve-tokens"], ignore_case=True)
self._gateway_completer = WordCompleter(["balance", "config", "connect", "connector-tokens", "generate-certs", "test-connection", "approve-tokens"], ignore_case=True)
self._gateway_connect_completer = WordCompleter(GATEWAY_CONNECTORS, ignore_case=True)
self._gateway_connector_tokens_completer = WordCompleter(
GatewayTokenSetting.get_gateway_chains_with_network(), ignore_case=True
Expand Down
3 changes: 0 additions & 3 deletions hummingbot/client/ui/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ def load_parser(hummingbot: "HummingbotApplication", command_tabs) -> [ThrowingA
gateway_cert_parser = gateway_subparsers.add_parser("generate-certs", help="Create ssl certifcate for gateway")
gateway_cert_parser.set_defaults(func=hummingbot.generate_certs)

gateway_list_parser = gateway_subparsers.add_parser("list", help="List gateway connectors and chains and tiers")
gateway_list_parser.set_defaults(func=hummingbot.gateway_list)

gateway_test_parser = gateway_subparsers.add_parser("test-connection", help="Ping gateway api server")
gateway_test_parser.set_defaults(func=hummingbot.test_connection)

Expand Down
18 changes: 0 additions & 18 deletions hummingbot/core/utils/gateway_config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,6 @@ def build_connector_display(connectors: List[Dict[str, Any]]) -> pd.DataFrame:
return pd.DataFrame(data=data, columns=columns)


def build_list_display(connectors: List[Dict[str, Any]]) -> pd.DataFrame:
"""
Display connector information as a table
"""
columns = ["Exchange", "Chains", "Tier"]
data = []
for connector_spec in connectors:
data.extend([
[
connector_spec["name"],
', '.join(connector_spec['chains']),
connector_spec["tier"],
]
])

return pd.DataFrame(data=data, columns=columns)


def build_connector_tokens_display(chain_networks: Dict[str, List[str]]) -> pd.DataFrame:
"""
Display connector and the tokens the balance command will report on
Expand Down

0 comments on commit 29672e1

Please sign in to comment.