Skip to content

Add --ledger to stellar keys fund#2558

Merged
fnando merged 2 commits intomainfrom
keys-fund-ledger
May 6, 2026
Merged

Add --ledger to stellar keys fund#2558
fnando merged 2 commits intomainfrom
keys-fund-ledger

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented May 5, 2026

What

Add a --ledger flag to stellar keys fund that connects to an attached Ledger hardware wallet, derives the public key at m/44'/148'/N', and funds the resulting account via the configured Friendbot. N defaults to 0 and can be set with --hd-path N.

stellar keys fund --ledger
stellar keys fund --ledger --hd-path 1

fund now flattens public_key::Cmd directly (the temporary Args shape introduced in #2557 to keep --ledger off fund is removed — Cmd is the single shape used by both keys address and keys fund). The Account <X> funded on <network> status line uses the resolved public key for <X> only when no name was supplied; the existing message format is unchanged when funding a named identity.

--ledger is mutually exclusive with the positional identity name; if neither is provided, clap rejects the command. Errors from a missing/locked device or a closed Stellar app surface through the existing signer::ledger error chain. Friendbot errors propagate through network::Error exactly as they do today.

Verified end-to-end against a real Ledger device.

Closes #2555.

Why

Hardware wallets are a primary key-management option in the CLI, and funding a freshly-derived address on testnet/futurenet is a routine first step in any development workflow. Without --ledger on fund, Ledger users have to derive their address out-of-band and fund it via other means — inconsistent with every other key type, which can be funded directly.

Known limitations

  • Nothing is persisted — there is no keys add --ledger yet, so each invocation re-derives from the device and --hd-path lives only on the current call.

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX May 5, 2026
@fnando fnando force-pushed the keys-address-ledger branch from 68f58a8 to 3939779 Compare May 5, 2026 21:29
Base automatically changed from keys-address-ledger to main May 5, 2026 21:45
@fnando fnando force-pushed the keys-fund-ledger branch from 67bc746 to 1771977 Compare May 5, 2026 21:47
@fnando fnando marked this pull request as ready for review May 5, 2026 21:47
Copilot AI review requested due to automatic review settings May 5, 2026 21:47
@fnando fnando self-assigned this May 5, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX May 5, 2026
@fnando fnando requested review from leighmcculloch and mootz12 May 5, 2026 21:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Ledger-backed address resolution to stellar keys fund by reusing the existing keys address argument shape, so funding can target a connected hardware wallet without requiring a named local identity.

Changes:

  • Replaces keys fund’s custom address args with public_key::Cmd, enabling --ledger and optional --hd-path.
  • Updates keys fund success output so unnamed Ledger funding prints the resolved public key instead of a missing identity name.
  • Refreshes help/docs and parser tests for the new keys fund --ledger CLI shape.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
FULL_HELP_DOCS.md Updates the documented keys fund usage and options to mention optional NAME and --ledger.
cmd/soroban-cli/src/commands/keys/public_key.rs Removes the older shared Args wrapper so Cmd becomes the shared address-resolution shape.
cmd/soroban-cli/src/commands/keys/fund.rs Switches keys fund to the shared address command args, adjusts the status label, and adds parser tests.
Comments suppressed due to low confidence (1)

FULL_HELP_DOCS.md:1176

  • The help text is now inconsistent with the command parser: NAME is shown as optional in the usage line, but the argument description still says the default test identity is used when it is omitted. In the new parser, omitting both NAME and --ledger is rejected, so these docs will send users to a command that now fails.
**Usage:** `stellar keys fund [OPTIONS] [NAME]`

###### **Arguments:**

- `<NAME>` — Name of identity to lookup, default test identity used if not provided

Comment thread cmd/soroban-cli/src/commands/keys/fund.rs
@fnando
Copy link
Copy Markdown
Member Author

fnando commented May 5, 2026

Fixed the stale <NAME> description in FULL_HELP_DOCS.md in 8233638 — regenerated via cargo run --package doc-gen so it now matches the parser ("Required unless --ledger is provided"). The [NAME] being optional in the usage line is correct: --ledger satisfies the requirement.

@fnando fnando merged commit 2015ee7 into main May 6, 2026
211 checks passed
@fnando fnando deleted the keys-fund-ledger branch May 6, 2026 01:32
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support funding Ledger hardware wallet addresses via stellar keys fund --ledger

3 participants