Skip to content

Commit

Permalink
fix: token flag for cluster pay
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdang committed Nov 12, 2024
1 parent 6a2df5b commit 1f62544
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions silverback/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import click
import yaml # type: ignore[import-untyped]
from ape import Contract
from ape.cli import (
AccountAliasPromptChoice,
ConnectedProviderCommand,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1f62544

Please sign in to comment.