Skip to content

chore(js-ts): migrate app/util/test/ganache.js to TypeScript#595

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777406577-migrate-ganache-to-ts
Open

chore(js-ts): migrate app/util/test/ganache.js to TypeScript#595
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777406577-migrate-ganache-to-ts

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 28, 2026

Summary

Migrates app/util/test/ganache.js from JavaScript to TypeScript.

Changes:

  • Renamed ganache.jsganache.ts
  • Added explicit TypeScript types for all class properties, method parameters, and return types
  • Imported EthereumProvider and ServerOptions types from the ganache package
  • Defined GanacheOptions type that extends ServerOptions<'ethereum'> with a required mnemonic field
  • Typed the private _server property using ReturnType<typeof ganache.server>
  • Added explicit provider null checks in getAccounts() and getBalance() to preserve the original fail-fast behavior (instead of silently returning undefined/NaN via optional chaining)
  • No import path changes needed in consuming files — extensionless imports resolve to .ts automatically

Review & Testing Checklist for Human

  • Verify the ganache package exports EthereumProvider and ServerOptions types correctly (ganache v7.9.2)
  • Run the e2e test suite that exercises Ganache (fixture-helper / ganache-seeder flows) to confirm no runtime regressions

Notes

  • Three files import from this module (e2e/fixtures/utils.js, e2e/fixtures/fixture-helper.js, wdio/utils/ganache.js) — all use extensionless import paths so no changes are required
  • The GanacheOptions type enforces the mnemonic field at the type level, matching the existing runtime check
  • CI failures are all pre-existing infrastructure issues unrelated to this change (react-native-tcp 404, missing CLA branch, missing CI secrets)

Link to Devin session: https://app.devin.ai/sessions/7a79f1cc0e8c4fd3bef7dacb53bf19e5
Requested by: @shayanshafii


Open in Devin Review

- Rename ganache.js to ganache.ts
- Add proper TypeScript types for class properties, method parameters, and return types
- Import EthereumProvider and ServerOptions types from ganache package
- Define GanacheOptions type requiring mnemonic field
- No import path changes needed (extensionless imports resolve to .ts)

Co-Authored-By: shayan <shayan@cognition.ai>
@staging-devin-ai-integration
Copy link
Copy Markdown

Devin Review

Status Commit
⚪ Not started

Open in Devin Review (Staging)

💡 Connect your GitHub account to enable automatic code reviews.

@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

Address Devin Review feedback: replace optional chaining with explicit
null checks in getAccounts() and getBalance() to throw clear errors
when the provider is absent, matching the original JS behavior.

Co-Authored-By: shayan <shayan@cognition.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant