From 1f6254441ba05487bad76e1101ad55dc7c99a311 Mon Sep 17 00:00:00 2001 From: Dalena Date: Tue, 12 Nov 2024 16:19:52 -0600 Subject: [PATCH] fix: token flag for cluster pay --- silverback/_cli.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/silverback/_cli.py b/silverback/_cli.py index 043ff5e6..cec07627 100644 --- a/silverback/_cli.py +++ b/silverback/_cli.py @@ -6,6 +6,7 @@ import click import yaml # type: ignore[import-untyped] +from ape import Contract from ape.cli import ( AccountAliasPromptChoice, ConnectedProviderCommand, @@ -546,6 +547,15 @@ def create_payment_stream( sm = platform.get_stream_manager(network.chain_id) product = configuration.get_product_code(account.address, cluster.id) + if token: + try: + token = Contract(token).symbol() + accepted_tokens = platform.get_accepted_tokens(network.chain_id) + if token not in accepted_tokens: + raise click.UsageError(f"Token symbol '{token}' not found in token list.") + except ValueError: + raise click.UsageError(f"Token address '{token}' not found.") + if not token: accepted_tokens = platform.get_accepted_tokens(network.chain_id) token = accepted_tokens.get(