Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: token flag for cluster pay #171

Merged
merged 7 commits into from
Nov 25, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion 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,8 +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_symbol = Contract(token).symbol()
fubuloubu marked this conversation as resolved.
Show resolved Hide resolved
token = accepted_tokens.get(token_symbol)
except ValueError:
token = accepted_tokens.get(token)

if token is None:
raise click.UsageError("Token not found in accepted tokens.")
dtdang marked this conversation as resolved.
Show resolved Hide resolved

if not token:
fubuloubu marked this conversation as resolved.
Show resolved Hide resolved
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
Loading