Skip to content

feat(gas-models): export v2, v4 and mixed-route gas model factories - #967

Open
gomesalexandre wants to merge 1 commit into
Uniswap:mainfrom
gomesalexandre:feat_export_gas_model_factories
Open

feat(gas-models): export v2, v4 and mixed-route gas model factories#967
gomesalexandre wants to merge 1 commit into
Uniswap:mainfrom
gomesalexandre:feat_export_gas_model_factories

Conversation

@gomesalexandre

Copy link
Copy Markdown

closes #949

what

import { V2HeuristicGasModelFactory } from '@uniswap/smart-order-router' failed with "no exported member". The gas-models barrel (src/routers/alpha-router/gas-models/index.ts) only re-exported ./gas-model and the v3 factory, so the v2, v4 and mixed-route factories were unreachable from the package root even though the classes exist and the barrel chain (gas-models -> alpha-router -> routers -> src) reaches src/index.ts.

The issue names V2HeuristicGasModelFactory, but V4HeuristicGasModelFactory and MixedRouteHeuristicGasModelFactory have the identical hole, so all three are fixed in the same one-line-per-file style as the existing v3 export.

how

Three export * from lines added to the gas-models barrel, matching the existing v3 line.

Note: the v2 file also exports BASE_SWAP_COST/COST_PER_EXTRA_HOP, so those two constants now reach the package root too. There is no collision (their only other definition, in gas-costs.ts, is not re-exported by any barrel). One pre-existing naming quirk worth flagging: the root-level BASE_SWAP_COST is the v2 flat BigNumber, distinct from the chain-parameterized helper of the same name in gas-costs.ts.

testing

Added gas-model-exports.test.ts importing the four factories from the package root and asserting each is a function. It fails on the pre-fix code (the named imports resolve to undefined).

  • npx tsc --noEmit: 0 errors.
  • jest test/unit/routers/alpha-router/gas-models: 4 suites / 17 tests pass.

The gas-models barrel only re-exported the v3 factory, so
V2HeuristicGasModelFactory, V4HeuristicGasModelFactory and
MixedRouteHeuristicGasModelFactory were not reachable from the package
root even though the classes exist and the barrel chain reaches
src/index.ts. Add the three missing re-exports, matching the v3 line.
@gomesalexandre
gomesalexandre requested a review from a team as a code owner August 18, 2026 00:55
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.

'"@uniswap/smart-order-router"' has no exported member named 'V2HeuristicGasModelFactory'

1 participant