File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1+ import type { FeeTier } from "@/types/utils/getPool" ;
12import type { Address , Hex } from "viem" ;
23
34/**
@@ -10,14 +11,14 @@ export interface QuoteParams {
1011 tokens : [ Address , Address ] ;
1112
1213 /**
13- * The fee tier of the pool (e.g., 500, 3000, 10000 ).
14+ * The fee tier of the pool (e.g., FeeTier.MEDIUM ).
1415 */
15- feeTier : number ;
16+ feeTier : FeeTier ;
1617
1718 /**
18- * The tick spacing for the pool. Must be a positive integer .
19+ * The tick spacing for the pool. If not provided, it will be derived from the fee tier .
1920 */
20- tickSpacing : number ;
21+ tickSpacing ? : number ;
2122
2223 /**
2324 * The amount of tokens being swapped, expressed as a bigint.
Original file line number Diff line number Diff line change 11import { V4QuoterAbi } from "@/constants/abis/V4Quoter" ;
22import { getInstance } from "@/core/uniDevKitV4Factory" ;
33import { sortTokens } from "@/helpers/tokens" ;
4+ import { FeeTier , TICK_SPACING_BY_FEE } from "@/types/utils/getPool" ;
45import type { QuoteParams , QuoteResponse } from "@/types/utils/getQuote" ;
56import { zeroAddress } from "viem" ;
67
@@ -35,12 +36,16 @@ export async function getQuote(
3536 params . tokens [ 1 ] ,
3637 ) ;
3738
39+ // Use provided tick spacing or derive from fee tier
40+ const fee = ( params . feeTier ?? FeeTier . MEDIUM ) as FeeTier ;
41+ const tickSpacing = params . tickSpacing ?? TICK_SPACING_BY_FEE [ fee ] ;
42+
3843 // Construct the poolKey
3944 const poolKey = {
4045 currency0,
4146 currency1,
42- fee : params . feeTier ,
43- tickSpacing : params . tickSpacing ,
47+ fee,
48+ tickSpacing,
4449 hooks : params . hooks || zeroAddress ,
4550 } ;
4651
You can’t perform that action at this time.
0 commit comments