Skip to content

Comments

feat(sdk): add workspace:* protocol and @uniswap/sdk umbrella package#489

Draft
thomasthachil wants to merge 1 commit intomainfrom
feat/workspace-protocol-umbrella-sdk
Draft

feat(sdk): add workspace:* protocol and @uniswap/sdk umbrella package#489
thomasthachil wants to merge 1 commit intomainfrom
feat/workspace-protocol-umbrella-sdk

Conversation

@thomasthachil
Copy link
Collaborator

@thomasthachil thomasthachil commented Jan 12, 2026

Summary

This PR addresses the SDK update chaos by making three key architectural changes:

1. Switch internal dependencies to workspace:* protocol

All internal @uniswap/* dependencies now use workspace:* instead of explicit npm version ranges.

Before:

"@uniswap/sdk-core": "^7.10.0"

After:

"@uniswap/sdk-core": "workspace:*"

Benefits:

  • At publish time, yarn automatically replaces workspace:* with the actual version
  • Eliminates cascading version bump PRs (6+ PRs → 1 PR for changes like X-Layer)
  • No more waiting for sequential npm publishes and manual PRs

2. Add @uniswap/sdk umbrella package

New package that re-exports all SDKs for simplified internal usage:

import {
  Token, CurrencyAmount,  // from sdk-core (direct export)
  V2, V3, V4,             // protocol SDKs (namespaced)
  Router, UniversalRouter, // routing SDKs (namespaced)
  Permit2, UniswapX,      // trading protocols (namespaced)
  SmartWallet, Flashtestations, TamperproofTx  // utilities
} from '@uniswap/sdk'

Benefits:

  • Single dependency for internal services
  • Tree shaking ensures minimal bundle size
  • Individual packages still published for external consumers

3. Use yarn npm publish for workspace protocol support

Changed semantic-release config across all packages:

  • @semantic-release/npm with npmPublish: false → only bumps version in package.json
  • @semantic-release/exec with publishCmd: "yarn npm publish" → publishes with workspace resolution

Why this is needed: The default npm publish doesn't resolve workspace protocols. yarn npm publish does.

4. Release ordering via turbo

Updated turbo.json to ensure packages release in dependency order:

"release": {
  "dependsOn": ["^release"]  // was: []
}

How it works:

  1. turbo run release --concurrency=1 runs releases sequentially
  2. dependsOn: ["^release"] ensures dependencies release first
  3. sdk-core releases first → updates package.json to 7.11.0
  4. v2-sdk releases next → sees sdk-core's 7.11.0workspace:* resolves to ^7.11.0
  5. Package published with correct dependency versions

Packages updated

Package Changes
v2-sdk, v3-sdk, v4-sdk workspace:* deps, yarn npm publish
router-sdk, universal-router-sdk workspace:* deps, yarn npm publish
uniswapx-sdk, smart-wallet-sdk workspace:* deps, yarn npm publish
permit2-sdk, sdk-core yarn npm publish
flashtestations-sdk, tamperproof-transactions yarn npm publish
NEW: @uniswap/sdk Umbrella package
turbo.json release.dependsOn: ["^release"]

Impact on common scenarios

Scenario Before After
New chain (X-Layer) 6+ sequential PRs 1 PR
Address fix 2+ PRs 1 PR
SDK logic change 5+ PRs 1 PR
Internal service update Update 3-5 deps Update 1 dep (@uniswap/sdk)

Test plan

  • All packages build successfully (yarn g:build)
  • Unit tests pass for sdk-core, v2-sdk, v3-sdk
  • Umbrella package compiles and exports correctly
  • Verify release workflow publishes with correct versions (needs CI run)

🤖 Generated with Claude Code


✨ Claude-Generated Content

Summary

Addresses SDK update chaos by switching all internal @uniswap/* dependencies to workspace:* protocol and adding a new @uniswap/sdk umbrella package for simplified internal usage.

Changes

1. Switch internal dependencies to workspace:* protocol

All internal @uniswap/* dependencies now use workspace:* instead of explicit npm version ranges:

Package Dependencies converted to workspace:*
v2-sdk sdk-core
v3-sdk sdk-core
v4-sdk sdk-core, v3-sdk
router-sdk sdk-core, v2-sdk, v3-sdk, v4-sdk
universal-router-sdk sdk-core, v2-sdk, v3-sdk, v4-sdk, router-sdk, permit2-sdk
uniswapx-sdk sdk-core, permit2-sdk
smart-wallet-sdk sdk-core
Benefits:
  • At publish time, yarn automatically replaces workspace:* with the actual version
  • All packages publish together atomically
  • Eliminates cascading version bump PRs (6+ PRs → 1 PR)

2. Add @uniswap/sdk umbrella package

New package (sdks/sdk/) that re-exports all SDKs:

  • sdk-core exports directly (Token, CurrencyAmount, etc.)
  • Protocol SDKs namespaced as V2, V3, V4
  • Routing SDKs namespaced as Router, UniversalRouter
  • Trading protocols namespaced as Permit2, UniswapX
  • Utility SDKs namespaced as SmartWallet, Flashtestations, TamperproofTx

3. Build and publish configuration

  • Updated turbo.json to add dependsOn: ["^build"] for proper build ordering with workspace dependencies
  • Added dependsOn: ["^release"] for release task ordering
  • Updated semantic-release config across all packages to use yarn npm publish via @semantic-release/exec instead of direct @semantic-release/npm publish

Impact

Scenario Before After
New chain (X-Layer) 6+ sequential PRs 1 PR
Address fix 2+ PRs 1 PR
SDK logic change 5+ PRs 1 PR
Internal service update Update 3-5 deps Update 1 dep (@uniswap/sdk)

How Has This Been Tested?

  • All packages build successfully (yarn g:build)
  • Unit tests pass for sdk-core, v2-sdk, v3-sdk
  • Umbrella package compiles and exports correctly

Are there any breaking changes?

No breaking changes for external consumers. Individual packages still published to npm with resolved versions. The umbrella package is additive.

Follow Ups

  • Verify publish workflow in dry-run mode
  • Test import from @uniswap/sdk in a consuming project

@thomasthachil thomasthachil requested a review from a team as a code owner January 12, 2026 17:25
@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2026

🤖 Claude Code Review

Review complete

Summary

This PR introduces two main changes:

  1. New @uniswap/sdk umbrella package - A convenience package that re-exports all Uniswap SDKs with namespacing to avoid conflicts
  2. Semantic-release configuration updates - Switches all packages from @semantic-release/npm to using yarn npm publish via @semantic-release/exec
  3. Workspace protocol adoption - Converts inter-package dependencies from version ranges to workspace:*
  4. Turbo build dependency changes - Adds ^build and ^release dependencies for proper topological ordering

Analysis

The Umbrella Package

The umbrella package design is clean:

  • Exports sdk-core directly (foundational types)
  • Namespaces everything else (V2, V3, V4, Router, UniversalRouter, etc.) to avoid conflicts between classes like Pool, Route, SwapRouter
  • Marks sideEffects: false for tree-shaking

Publishing Configuration Change

The switch from @semantic-release/npm (with npmPublish: false) + @semantic-release/exec for yarn npm publish is applied consistently across all packages. This appears to be a migration to use Yarn's publishing mechanism instead of npm directly, likely for better Yarn workspace integration.

Turbo Changes

The turbo.json changes add:

  • "dependsOn": ["^build"] for the build task - ensures dependencies are built first
  • "dependsOn": ["^release"] for the release task - ensures dependency packages are released first

The ^release dependency is notable - in monorepo release scenarios, this ensures proper topological ordering so that if sdk-core is a dependency of v3-sdk, sdk-core releases first.

Minor Note

The new @uniswap/sdk package is missing a version field, but this appears to be consistent with other packages in this repo (e.g., sdk-core, v3-sdk) which rely on semantic-release to manage versioning.

Verdict

The changes are consistent, well-structured, and follow the existing patterns in the repository. The umbrella package provides a clean developer experience, and the publishing configuration changes appear to be a systematic improvement across all packages.


💡 Want a fresh review? Add a comment containing @request-claude-review to trigger a new review at any time.

github-actions[bot]
github-actions bot previously approved these changes Jan 12, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

📋 Review verdict: APPROVE

👆 The main review comment above is the source of truth for this PR review. It is automatically updated on each review cycle, so always refer to it for the most current feedback.

This formal review submission is for the verdict only.

@thomasthachil thomasthachil changed the title feat: add workspace:* protocol and @uniswap/sdk umbrella package feat(sdk): add workspace:* protocol and @uniswap/sdk umbrella package Jan 12, 2026
This PR makes two key changes to simplify SDK dependency management:

1. **Switch internal dependencies to workspace:* protocol**
   - All internal @uniswap/* dependencies now use `workspace:*`
   - At publish time, yarn replaces with actual version numbers
   - Eliminates cascading version bump PRs (6+ PRs → 1 PR)

2. **Add @uniswap/sdk umbrella package**
   - Single package that re-exports all SDKs
   - Namespaced exports to avoid conflicts (V2, V3, V4, etc.)
   - Tree shaking ensures minimal bundle size
   - Simplifies internal service dependencies

3. **Use yarn npm publish for workspace protocol support**
   - Changed semantic-release config to use `yarn npm publish`
   - `@semantic-release/npm` with `npmPublish: false` for version bumping
   - `@semantic-release/exec` with `publishCmd: "yarn npm publish"` for publishing
   - Ensures workspace:* gets replaced with actual versions

Updated packages:
- v2-sdk, v3-sdk, v4-sdk
- router-sdk, universal-router-sdk
- uniswapx-sdk, smart-wallet-sdk
- permit2-sdk, sdk-core
- flashtestations-sdk, tamperproof-transactions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@thomasthachil thomasthachil force-pushed the feat/workspace-protocol-umbrella-sdk branch from ef7e639 to 4c805f2 Compare January 14, 2026 22:00
@thomasthachil thomasthachil requested review from a team as code owners January 14, 2026 22:00
@github-actions github-actions bot dismissed their stale review January 14, 2026 22:02

Superseded by new review after PR update

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

📋 Review verdict: APPROVE

👆 The main review comment above is the source of truth for this PR review. It is automatically updated on each review cycle, so always refer to it for the most current feedback.

This formal review submission is for the verdict only.

@thomasthachil thomasthachil marked this pull request as draft January 14, 2026 22:02
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