Skip to content

Commit

Permalink
fix: check token symbol in list
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdang committed Nov 12, 2024
1 parent 1f62544 commit 67fcf96
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions silverback/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,18 @@ def create_payment_stream(
sm = platform.get_stream_manager(network.chain_id)
product = configuration.get_product_code(account.address, cluster.id)

accepted_tokens = platform.get_accepted_tokens(network.chain_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.")
token_symbol = Contract(token).symbol()
token = accepted_tokens.get(token_symbol)
except ValueError:
raise click.UsageError(f"Token address '{token}' not found.")
token = accepted_tokens.get(token)

if token is None:
raise click.UsageError("Token not found in accepted tokens.")

if not token:
accepted_tokens = platform.get_accepted_tokens(network.chain_id)
token = accepted_tokens.get(
click.prompt(
"Select one of the following tokens to fund your stream with",
Expand Down

0 comments on commit 67fcf96

Please sign in to comment.