Skip to content

Feat/enhance flows#19

Merged
Arshia-r-m merged 5 commits into
masterfrom
feat/enhance-flows
Jun 11, 2026
Merged

Feat/enhance flows#19
Arshia-r-m merged 5 commits into
masterfrom
feat/enhance-flows

Conversation

@Arshia-r-m

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 9, 2026 12:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors several CLI “flows” to centralize shared behaviors (prompting/validation, quote resolution, swap request building, and error handling) and expands test coverage around these shared utilities. It primarily targets swap/market flows (live pair catalog + shared quote builder) while also standardizing error handling across multiple command modules.

Changes:

  • Introduces shared utility modules for quote resolution (utils/quotes.py), CLI error normalization (utils/errors.py), and RGB asset helpers (utils/assets.py), plus swap request builders in utils/swaps.py.
  • Refactors multiple commands (swap/market/wallet/payment/channel/asset/node/peer/node_swap) to reuse the new helpers and reduce duplicated prompt/error-handling code.
  • Adds new unit tests for the new/shared utilities and updates swap command tests for the new interactive pair-selection behavior; updates Makefile pyright invocation to include dev extras.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_utils_swaps.py Adds tests for new atomic swap request builder helpers.
tests/test_utils_prompts.py Adds tests for new prompt/validation helpers (resolve_required_int, resolve_accept_reject, require_option_when_set, resolve_optional_text).
tests/test_utils_errors.py Adds tests for raise_cli_error behavior (preserve exits, normalize unexpected errors).
tests/test_utils_assets.py Adds tests for streaming SHA-256 helper and optional path handling.
tests/test_cmd_swap.py Updates quote mocks to use SDK models and adds coverage for live pair catalog fetching + interactive pair selection.
Makefile Updates pyright target to install project with dev extras.
kaleido_cli/utils/swaps.py Adds swap_request_from_quote and confirm_swap_request helpers for SDK request construction.
kaleido_cli/utils/quotes.py New shared “resolve inputs → build request → fetch quote” flow, including interactive pair selection.
kaleido_cli/utils/prompts.py Enhances prompting/validation helpers; simplifies amount prompting flow.
kaleido_cli/utils/pairs.py Adds interactive pair-direction selection (resolve_pair_from_options) and helper to enumerate directions.
kaleido_cli/utils/errors.py New shared error normalizer that preserves Typer exits/aborts.
kaleido_cli/utils/assets.py New helpers for optional metadata prompting and streaming file SHA-256.
kaleido_cli/commands/wallet.py Uses shared prompt/error helpers instead of repeated inline checks.
kaleido_cli/commands/swap.py Switches to shared quote-resolution flow, shared request builders, and shared error handling.
kaleido_cli/commands/peer.py Uses shared prompt/error helpers.
kaleido_cli/commands/payment.py Uses shared option dependency validation and shared prompt/error helpers where applicable.
kaleido_cli/commands/node.py Uses shared error handling for several node operations.
kaleido_cli/commands/node_swap.py Uses shared prompt/error helpers for required numeric/text inputs.
kaleido_cli/commands/market.py Uses shared quote-resolution flow and shared error handling.
kaleido_cli/commands/channel.py Uses shared prompt/validation helpers and shared error handling in many flows.
kaleido_cli/commands/asset.py Uses shared metadata prompting + streaming SHA-256 and shared prompt/error helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kaleido_cli/utils/quotes.py
Comment on lines 192 to +205
try:
client = get_client()
quote = await _fetch_quote(pair, from_amount, to_amount, from_layer, to_layer)
resolved_quote = await resolve_and_fetch_quote(
client,
pair=pair,
from_amount=from_amount,
to_amount=to_amount,
from_layer=from_layer,
to_layer=to_layer,
)
resolved_receiver_address = resolve_required_text(
receiver_address, "Receiver address / invoice", "--receiver-address"
)
resolved_receiver_format = resolve_required_text(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the validation for --receiver-address and --receiver-format before resolve_and_fetch_quote in non-interactive mode. (b5f292a)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Arshia-r-m Arshia-r-m merged commit dbd599e into master Jun 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants