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:
- 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
- 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
Improve the user experience of the
flow accounts fundcommand by providing an interactive account selection when no address is specified as an argument.Current Behavior
When running
flow accounts fundwithout 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:flow accounts createto create an account firstExpected 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 testnetBenefits
Implementation Considerations
Acceptance Criteria
flow accounts fundwithout arguments shows account selection when testnet accounts exist