Skip to content

feat: migrate SDK from ethers.js to viem, modernize toolchain - #135

Draft
janek26 wants to merge 1 commit into
mainfrom
viem
Draft

feat: migrate SDK from ethers.js to viem, modernize toolchain#135
janek26 wants to merge 1 commit into
mainfrom
viem

Conversation

@janek26

@janek26 janek26 commented Feb 18, 2026

Copy link
Copy Markdown

Summary

Replaces ethers.js with viem and modernizes the entire SDK toolchain. This is a breaking change for consumers.

viem migration

  • All contract interactions use typed ABIs via parseAbi — zero as any casts in the codebase
  • signPermit now uses walletClient.signTypedData() instead of raw private key signing via @metamask/eth-sig-util — works with any wallet type (browser, hardware, etc.)
  • Properly typed QuoteExecutionDetails, PermitSignature, CrosschainQuoteExecutionDetails, and all public API functions
  • Removed dependencies: @ethersproject/*, @ethereumjs/util, @metamask/eth-sig-util

Toolchain modernization

  • Build: tsdxzile (ESM-only, nodenext module resolution, TypeScript 5.5)
  • Test: Jest (bundled in tsdx) → vitest
  • Lint: ESLint + eslint-config-rainbow + 4 plugins → oxlint
  • Format: Prettier → oxfmt
  • tsconfig: Split into tsconfig.json (IDE + typecheck, includes tests) and tsconfig.build.json (zile build, src only)

CI

  • SDK job now runs: typecheck → lint → format:check → build → test

Docs

  • README.md updated with current API examples and dev commands
  • MIGRATION.md added with full before/after guide for consumers migrating from ethers

Breaking changes

Before (ethers) After (viem)
BigNumberish BigIntish (string | number | bigint)
Signer / Wallet WalletClient
StaticJsonRpcProvider PublicClient
Transaction return Hash (tx hash)
signPermit(publicClient, privateKey, ...) signPermit(publicClient, walletClient, ...)
getWrappedAssetMethod(name, ...) getWrappedAssetMethod('deposit' | 'withdraw', ...)
method(...methodArgs) method() (args pre-bound)

Test plan

  • yarn typecheck passes (src + tests)
  • yarn lint passes (1 pre-existing warning: duplicate enum value)
  • yarn format:check passes
  • yarn build succeeds
  • yarn test — 10/10 tests pass
  • Verify consumer integration with wagmi/RainbowKit

Made with Cursor

Replace ethers.js with viem throughout the SDK for full type safety:
- All contract interactions use typed ABIs via parseAbi (zero `as any`)
- signPermit uses walletClient.signTypedData instead of raw private keys
- Remove @metamask/eth-sig-util dependency
- Properly typed QuoteExecutionDetails, PermitSignature, and all public APIs

Modernize the build and dev toolchain:
- Replace tsdx with zile (ESM-only, nodenext module resolution)
- Replace Jest with vitest
- Replace ESLint + Prettier with oxlint + oxfmt
- Split tsconfig: tsconfig.json (IDE + typecheck) / tsconfig.build.json (zile)
- CI now runs typecheck, lint, format:check, build, and test

Add MIGRATION.md documenting all breaking API changes for consumers.

Co-authored-by: Cursor <cursoragent@cursor.com>
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