Skip to content

Enhancement: Interactive account selection for flow accounts fund command #2024

@chasefleming

Description

@chasefleming

Improve the user experience of the flow accounts fund command by providing an interactive account selection when no address is specified as an argument.

Current Behavior

When running flow accounts fund without specifying an account address, the command likely fails or requires manual specification of the target account address.

Proposed Enhancement

When flow accounts fund <arg> is run without specifying an account address:

  1. If testnet accounts exist in flow.json: Display a list of available testnet addresses from the flow.json configuration and allow the user to select which account to fund
  2. If no testnet accounts exist: Provide helpful guidance informing the user to run flow accounts create to create an account first

Expected User Flow

Scenario 1: Testnet accounts available

$ flow accounts fund
? Select an account to fund:
  ❯ 0x1234567890abcdef (testnet-account-1)
    0xfedcba0987654321 (testnet-account-2)
    0xabcdef1234567890 (testnet-account-3)

Scenario 2: No testnet accounts

$ flow accounts fund
No testnet accounts found in flow.json.
To create a new testnet account, run: flow accounts create --network testnet

Benefits

  • Improved UX: Users don't need to remember or look up account addresses
  • Discoverability: Users can easily see what accounts are available to fund
  • Guidance: Clear next steps when no accounts are available
  • Consistency: Aligns with other interactive CLI patterns in the Flow CLI

Implementation Considerations

  • Parse flow.json to identify testnet accounts
  • Implement interactive selection UI (similar to other Flow CLI prompts)
  • Graceful fallback when flow.json doesn't exist or contains no testnet accounts
  • Maintain backward compatibility when address is explicitly provided

Acceptance Criteria

  • flow accounts fund without arguments shows account selection when testnet accounts exist
  • Account selection displays address and account name/alias if available
  • Clear error message and guidance when no testnet accounts exist
  • Existing functionality with explicit address argument remains unchanged
  • Works consistently across different terminal environments

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions