Skip to content

fix: replace ethers imports with viem and add type guards#59

Open
kushbosamiya wants to merge 1 commit intoStabilityNexus:mainfrom
kushbosamiya:fix/typescript-errors-v2
Open

fix: replace ethers imports with viem and add type guards#59
kushbosamiya wants to merge 1 commit intoStabilityNexus:mainfrom
kushbosamiya:fix/typescript-errors-v2

Conversation

@kushbosamiya
Copy link
Copy Markdown

@kushbosamiya kushbosamiya commented Feb 27, 2026

Problem

  • ethers module has no type declarations installed, causing TS errors in 3 files
  • Promise.all with early return produces (Auction | undefined)[] not assignable to Auction[] in dashboard

Changes

  • Replace parseEther import from ethersviem in english-auction-service.ts and allpay-auction-service.ts
  • Replace formatEther import from ethersviem in vickrey-commit-form.tsx
  • Add type predicate (auction): auction is Auction to .filter() calls in dashboard/page.tsx

viem already exports both functions and is the primary Web3 library in this project.

Summary by CodeRabbit

  • Refactor
    • Improved type safety for auction data filtering and consolidated utility function imports across services to enhance code maintainability.

- Replace parseEther import from ethers with viem in english-auction-service.ts
- Replace parseEther import from ethers with viem in allpay-auction-service.ts
- Replace formatEther import from ethers with viem in vickrey-commit-form.tsx
- Add type predicate (auction): auction is Auction to .filter() calls in dashboard/page.tsx

Resolves type errors caused by missing ethers type declarations and
(Auction | undefined)[] not being assignable to Auction[].
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 096d20f and d8d4b1a.

📒 Files selected for processing (4)
  • app/dashboard/page.tsx
  • components/auction/vickrey-commit-form.tsx
  • lib/services/allpay-auction-service.ts
  • lib/services/english-auction-service.ts

📝 Walkthrough

Walkthrough

This pull request migrates format and parse utility imports from ethers to viem across auction-related files and adds TypeScript type predicates to filter operations in the dashboard to refine null-inclusive array types to non-null auction arrays.

Changes

Cohort / File(s) Summary
Type Narrowing
app/dashboard/page.tsx
Added type predicates using is Auction keyword to three filter calls, refining return type from (Auction | null)[] to Auction[] without altering runtime behavior.
Library Migration to viem
components/auction/vickrey-commit-form.tsx, lib/services/allpay-auction-service.ts, lib/services/english-auction-service.ts
Migrated formatEther and parseEther imports from ethers to viem across multiple auction-related files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Zahnentferner

Poem

🐰 From ethers to viem, the imports now fly,
Type predicates narrowing, no null slips by,
Three auction files dancing in harmony,
A cleanup that's clean—as it ought to be! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: replacing ethers imports with viem and adding type guards in filter calls.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant