Skip to content

chore: migrate app/util/test/ganache.js to TypeScript#617

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1777568923-migrate-ganache-to-ts
Open

chore: migrate app/util/test/ganache.js to TypeScript#617
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1777568923-migrate-ganache-to-ts

Conversation

@devin-ai-integration
Copy link
Copy Markdown

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

Summary

Migrates app/util/test/ganache.js from JavaScript to TypeScript as part of the ongoing JS→TS migration effort.

Changes:

  • Renamed ganache.jsganache.ts
  • Added a private _server field with proper type (ReturnType<typeof ganache.server> | undefined)
  • Defined GanacheStartOptions type as ServerOptions & { mnemonic: string } to enforce the required mnemonic
  • Typed getProvider() return as EthereumProvider | undefined
  • Typed getAccounts() return as Promise<string[]> with a null guard on the provider
  • Typed getBalance() return as Promise<number | string> with a null guard on the provider
  • Typed quit() return as Promise<void>
  • Imported EthereumProvider and ServerOptions types from ganache
  • No behavioral changes — only type annotations added

Importers (e2e/fixtures/fixture-helper.js, e2e/fixtures/utils.js, wdio/utils/ganache.js) are unaffected since TypeScript's module resolution resolves .ts files from extensionless imports.

Review & Testing Checklist for Human

  • Verify the GanacheStartOptions type (ServerOptions & { mnemonic: string }) is compatible with all call sites (e.g., fixture-helper.js passing defaultGanacheOptions)
  • Confirm no snapshot or test regressions by running yarn test --findRelatedTests app/util/test/ganache.ts

Notes

  • The ganache package is declared as a dependency (^7.9.2) but may not be installed locally due to a known yarn install issue with a deleted transitive dependency. Types were verified against the published ganache@7.9.2 type definitions.
  • Existing importers are all .js files and use extensionless imports, so no import path updates are needed.

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


Devin Review

Status Commit
⚪ Not started

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)
Open in Devin Review

- Rename ganache.js to ganache.ts
- Add typed private _server field
- Type start() opts parameter with GanacheStartOptions (ServerOptions & { mnemonic: string })
- Type getProvider() return as EthereumProvider | undefined
- Type getAccounts() return as Promise<string[]>
- Type getBalance() return as Promise<number | string>
- Type quit() return as Promise<void>
- Add null checks for provider access with proper error messages

Co-Authored-By: shayan <shayan@cognition.ai>
@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

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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