Skip to content

02-fund-accounts.js exits 0 when funding fails and crashes on non-JSON responses #31

Closed

Description

@Busiii-adetiba

Problem

fund() calls res.json() unconditionally (Friendbot returns HTML/text on some errors) and the script always exits 0 even when accounts were not funded.

Where

  • scripts/02-fund-accounts.js

Acceptance criteria

  • Validate keys with StrKey.isValidEd25519PublicKey before calling Friendbot
  • Handle non-JSON bodies
  • Exit non-zero if any account failed
  • Treat 'already funded' as success

Activity

  1. fakayodeteminijesu45-source commented on Oct 16, 2026

    @fakayodeteminijesu45-source

    @fakayodeteminijesu45-source has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hello Maintainer, I’ve carefully reviewed the issue and understand what needs to be done. I’m interested in working on it and will do my best to provide a reliable solution that meets the project’s requirements. I’d appreciate the opportunity to contribute. Thank you for your consideration.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @fakayodeteminijesu45-source to this issue.

  2. kwest0002-lab commented on Oct 18, 2026

    @kwest0002-lab

    @kwest0002-lab has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    hi please i will love to work on this

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @kwest0002-lab to this issue.

  3. added a commit that references this issue on Oct 18, 2026
    339b08f
  4. Yuren0312 commented on Oct 18, 2026

    @Yuren0312
    Contributor

    Fix submitted in #111:

    • every key is validated with StrKey.isValidEd25519PublicKey before Friendbot is contacted (invalid keys abort with exit 1, Friendbot never called)
    • the response body is read as text first and JSON is parsed from it, so Friendbot's HTML/text error bodies are reported instead of crashing the step
    • an already funded response counts as success
    • the script exits non-zero if any account could not be funded, so the step can be chained with &&
    • the exit-code contract is covered by test/fund-accounts.test.cjs, which spawns the script with fetch stubbed (no network calls)

    Happy to adjust the wording or behaviour if you'd prefer something different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions