@yummybait/uniswap-tx-builder-mcp 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/abi.d.ts ADDED
@@ -0,0 +1,310 @@
1
+ /**
2
+ * Minimal NonfungiblePositionManager ABI — only the functions we need.
3
+ */
4
+ export declare const nfpmAbi: readonly [{
5
+ readonly name: "positions";
6
+ readonly type: "function";
7
+ readonly stateMutability: "view";
8
+ readonly inputs: readonly [{
9
+ readonly name: "tokenId";
10
+ readonly type: "uint256";
11
+ }];
12
+ readonly outputs: readonly [{
13
+ readonly name: "nonce";
14
+ readonly type: "uint96";
15
+ }, {
16
+ readonly name: "operator";
17
+ readonly type: "address";
18
+ }, {
19
+ readonly name: "token0";
20
+ readonly type: "address";
21
+ }, {
22
+ readonly name: "token1";
23
+ readonly type: "address";
24
+ }, {
25
+ readonly name: "fee";
26
+ readonly type: "uint24";
27
+ }, {
28
+ readonly name: "tickLower";
29
+ readonly type: "int24";
30
+ }, {
31
+ readonly name: "tickUpper";
32
+ readonly type: "int24";
33
+ }, {
34
+ readonly name: "liquidity";
35
+ readonly type: "uint128";
36
+ }, {
37
+ readonly name: "feeGrowthInside0LastX128";
38
+ readonly type: "uint256";
39
+ }, {
40
+ readonly name: "feeGrowthInside1LastX128";
41
+ readonly type: "uint256";
42
+ }, {
43
+ readonly name: "tokensOwed0";
44
+ readonly type: "uint128";
45
+ }, {
46
+ readonly name: "tokensOwed1";
47
+ readonly type: "uint128";
48
+ }];
49
+ }, {
50
+ readonly name: "increaseLiquidity";
51
+ readonly type: "function";
52
+ readonly stateMutability: "payable";
53
+ readonly inputs: readonly [{
54
+ readonly name: "params";
55
+ readonly type: "tuple";
56
+ readonly components: readonly [{
57
+ readonly name: "tokenId";
58
+ readonly type: "uint256";
59
+ }, {
60
+ readonly name: "amount0Desired";
61
+ readonly type: "uint256";
62
+ }, {
63
+ readonly name: "amount1Desired";
64
+ readonly type: "uint256";
65
+ }, {
66
+ readonly name: "amount0Min";
67
+ readonly type: "uint256";
68
+ }, {
69
+ readonly name: "amount1Min";
70
+ readonly type: "uint256";
71
+ }, {
72
+ readonly name: "deadline";
73
+ readonly type: "uint256";
74
+ }];
75
+ }];
76
+ readonly outputs: readonly [{
77
+ readonly name: "liquidity";
78
+ readonly type: "uint128";
79
+ }, {
80
+ readonly name: "amount0";
81
+ readonly type: "uint256";
82
+ }, {
83
+ readonly name: "amount1";
84
+ readonly type: "uint256";
85
+ }];
86
+ }, {
87
+ readonly name: "burn";
88
+ readonly type: "function";
89
+ readonly stateMutability: "payable";
90
+ readonly inputs: readonly [{
91
+ readonly name: "tokenId";
92
+ readonly type: "uint256";
93
+ }];
94
+ readonly outputs: readonly [];
95
+ }, {
96
+ readonly name: "decreaseLiquidity";
97
+ readonly type: "function";
98
+ readonly stateMutability: "payable";
99
+ readonly inputs: readonly [{
100
+ readonly name: "params";
101
+ readonly type: "tuple";
102
+ readonly components: readonly [{
103
+ readonly name: "tokenId";
104
+ readonly type: "uint256";
105
+ }, {
106
+ readonly name: "liquidity";
107
+ readonly type: "uint128";
108
+ }, {
109
+ readonly name: "amount0Min";
110
+ readonly type: "uint256";
111
+ }, {
112
+ readonly name: "amount1Min";
113
+ readonly type: "uint256";
114
+ }, {
115
+ readonly name: "deadline";
116
+ readonly type: "uint256";
117
+ }];
118
+ }];
119
+ readonly outputs: readonly [{
120
+ readonly name: "amount0";
121
+ readonly type: "uint256";
122
+ }, {
123
+ readonly name: "amount1";
124
+ readonly type: "uint256";
125
+ }];
126
+ }, {
127
+ readonly name: "collect";
128
+ readonly type: "function";
129
+ readonly stateMutability: "payable";
130
+ readonly inputs: readonly [{
131
+ readonly name: "params";
132
+ readonly type: "tuple";
133
+ readonly components: readonly [{
134
+ readonly name: "tokenId";
135
+ readonly type: "uint256";
136
+ }, {
137
+ readonly name: "recipient";
138
+ readonly type: "address";
139
+ }, {
140
+ readonly name: "amount0Max";
141
+ readonly type: "uint128";
142
+ }, {
143
+ readonly name: "amount1Max";
144
+ readonly type: "uint128";
145
+ }];
146
+ }];
147
+ readonly outputs: readonly [{
148
+ readonly name: "amount0";
149
+ readonly type: "uint256";
150
+ }, {
151
+ readonly name: "amount1";
152
+ readonly type: "uint256";
153
+ }];
154
+ }, {
155
+ readonly name: "mint";
156
+ readonly type: "function";
157
+ readonly stateMutability: "payable";
158
+ readonly inputs: readonly [{
159
+ readonly name: "params";
160
+ readonly type: "tuple";
161
+ readonly components: readonly [{
162
+ readonly name: "token0";
163
+ readonly type: "address";
164
+ }, {
165
+ readonly name: "token1";
166
+ readonly type: "address";
167
+ }, {
168
+ readonly name: "fee";
169
+ readonly type: "uint24";
170
+ }, {
171
+ readonly name: "tickLower";
172
+ readonly type: "int24";
173
+ }, {
174
+ readonly name: "tickUpper";
175
+ readonly type: "int24";
176
+ }, {
177
+ readonly name: "amount0Desired";
178
+ readonly type: "uint256";
179
+ }, {
180
+ readonly name: "amount1Desired";
181
+ readonly type: "uint256";
182
+ }, {
183
+ readonly name: "amount0Min";
184
+ readonly type: "uint256";
185
+ }, {
186
+ readonly name: "amount1Min";
187
+ readonly type: "uint256";
188
+ }, {
189
+ readonly name: "recipient";
190
+ readonly type: "address";
191
+ }, {
192
+ readonly name: "deadline";
193
+ readonly type: "uint256";
194
+ }];
195
+ }];
196
+ readonly outputs: readonly [{
197
+ readonly name: "tokenId";
198
+ readonly type: "uint256";
199
+ }, {
200
+ readonly name: "liquidity";
201
+ readonly type: "uint128";
202
+ }, {
203
+ readonly name: "amount0";
204
+ readonly type: "uint256";
205
+ }, {
206
+ readonly name: "amount1";
207
+ readonly type: "uint256";
208
+ }];
209
+ }, {
210
+ readonly name: "multicall";
211
+ readonly type: "function";
212
+ readonly stateMutability: "payable";
213
+ readonly inputs: readonly [{
214
+ readonly name: "data";
215
+ readonly type: "bytes[]";
216
+ }];
217
+ readonly outputs: readonly [{
218
+ readonly name: "results";
219
+ readonly type: "bytes[]";
220
+ }];
221
+ }];
222
+ /**
223
+ * Minimal ERC-20 ABI — only `decimals`, used to convert human token amounts
224
+ * to wei when planning a position.
225
+ */
226
+ export declare const erc20Abi: readonly [{
227
+ readonly name: "decimals";
228
+ readonly type: "function";
229
+ readonly stateMutability: "view";
230
+ readonly inputs: readonly [];
231
+ readonly outputs: readonly [{
232
+ readonly name: "";
233
+ readonly type: "uint8";
234
+ }];
235
+ }];
236
+ /** Uniswap v3 factory — only `getPool`, to resolve a pool address. */
237
+ export declare const factoryAbi: readonly [{
238
+ readonly name: "getPool";
239
+ readonly type: "function";
240
+ readonly stateMutability: "view";
241
+ readonly inputs: readonly [{
242
+ readonly name: "tokenA";
243
+ readonly type: "address";
244
+ }, {
245
+ readonly name: "tokenB";
246
+ readonly type: "address";
247
+ }, {
248
+ readonly name: "fee";
249
+ readonly type: "uint24";
250
+ }];
251
+ readonly outputs: readonly [{
252
+ readonly name: "pool";
253
+ readonly type: "address";
254
+ }];
255
+ }];
256
+ /** Uniswap v3 pool — only the state reads `get_pool_state` needs. */
257
+ export declare const poolAbi: readonly [{
258
+ readonly name: "slot0";
259
+ readonly type: "function";
260
+ readonly stateMutability: "view";
261
+ readonly inputs: readonly [];
262
+ readonly outputs: readonly [{
263
+ readonly name: "sqrtPriceX96";
264
+ readonly type: "uint160";
265
+ }, {
266
+ readonly name: "tick";
267
+ readonly type: "int24";
268
+ }, {
269
+ readonly name: "observationIndex";
270
+ readonly type: "uint16";
271
+ }, {
272
+ readonly name: "observationCardinality";
273
+ readonly type: "uint16";
274
+ }, {
275
+ readonly name: "observationCardinalityNext";
276
+ readonly type: "uint16";
277
+ }, {
278
+ readonly name: "feeProtocol";
279
+ readonly type: "uint8";
280
+ }, {
281
+ readonly name: "unlocked";
282
+ readonly type: "bool";
283
+ }];
284
+ }, {
285
+ readonly name: "tickSpacing";
286
+ readonly type: "function";
287
+ readonly stateMutability: "view";
288
+ readonly inputs: readonly [];
289
+ readonly outputs: readonly [{
290
+ readonly name: "";
291
+ readonly type: "int24";
292
+ }];
293
+ }];
294
+ /** Universal Router — only `execute`, for wrap/swap calldata. */
295
+ export declare const universalRouterAbi: readonly [{
296
+ readonly name: "execute";
297
+ readonly type: "function";
298
+ readonly stateMutability: "payable";
299
+ readonly inputs: readonly [{
300
+ readonly name: "commands";
301
+ readonly type: "bytes";
302
+ }, {
303
+ readonly name: "inputs";
304
+ readonly type: "bytes[]";
305
+ }, {
306
+ readonly name: "deadline";
307
+ readonly type: "uint256";
308
+ }];
309
+ readonly outputs: readonly [];
310
+ }];
package/dist/abi.js ADDED
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Minimal NonfungiblePositionManager ABI — only the functions we need.
3
+ */
4
+ export const nfpmAbi = [
5
+ // ── read ──────────────────────────────────────────────────────────
6
+ {
7
+ name: "positions",
8
+ type: "function",
9
+ stateMutability: "view",
10
+ inputs: [{ name: "tokenId", type: "uint256" }],
11
+ outputs: [
12
+ { name: "nonce", type: "uint96" },
13
+ { name: "operator", type: "address" },
14
+ { name: "token0", type: "address" },
15
+ { name: "token1", type: "address" },
16
+ { name: "fee", type: "uint24" },
17
+ { name: "tickLower", type: "int24" },
18
+ { name: "tickUpper", type: "int24" },
19
+ { name: "liquidity", type: "uint128" },
20
+ { name: "feeGrowthInside0LastX128", type: "uint256" },
21
+ { name: "feeGrowthInside1LastX128", type: "uint256" },
22
+ { name: "tokensOwed0", type: "uint128" },
23
+ { name: "tokensOwed1", type: "uint128" },
24
+ ],
25
+ },
26
+ // ── write (used inside multicall) ─────────────────────────────────
27
+ {
28
+ name: "increaseLiquidity",
29
+ type: "function",
30
+ stateMutability: "payable",
31
+ inputs: [
32
+ {
33
+ name: "params",
34
+ type: "tuple",
35
+ components: [
36
+ { name: "tokenId", type: "uint256" },
37
+ { name: "amount0Desired", type: "uint256" },
38
+ { name: "amount1Desired", type: "uint256" },
39
+ { name: "amount0Min", type: "uint256" },
40
+ { name: "amount1Min", type: "uint256" },
41
+ { name: "deadline", type: "uint256" },
42
+ ],
43
+ },
44
+ ],
45
+ outputs: [
46
+ { name: "liquidity", type: "uint128" },
47
+ { name: "amount0", type: "uint256" },
48
+ { name: "amount1", type: "uint256" },
49
+ ],
50
+ },
51
+ {
52
+ name: "burn",
53
+ type: "function",
54
+ stateMutability: "payable",
55
+ inputs: [{ name: "tokenId", type: "uint256" }],
56
+ outputs: [],
57
+ },
58
+ {
59
+ name: "decreaseLiquidity",
60
+ type: "function",
61
+ stateMutability: "payable",
62
+ inputs: [
63
+ {
64
+ name: "params",
65
+ type: "tuple",
66
+ components: [
67
+ { name: "tokenId", type: "uint256" },
68
+ { name: "liquidity", type: "uint128" },
69
+ { name: "amount0Min", type: "uint256" },
70
+ { name: "amount1Min", type: "uint256" },
71
+ { name: "deadline", type: "uint256" },
72
+ ],
73
+ },
74
+ ],
75
+ outputs: [
76
+ { name: "amount0", type: "uint256" },
77
+ { name: "amount1", type: "uint256" },
78
+ ],
79
+ },
80
+ {
81
+ name: "collect",
82
+ type: "function",
83
+ stateMutability: "payable",
84
+ inputs: [
85
+ {
86
+ name: "params",
87
+ type: "tuple",
88
+ components: [
89
+ { name: "tokenId", type: "uint256" },
90
+ { name: "recipient", type: "address" },
91
+ { name: "amount0Max", type: "uint128" },
92
+ { name: "amount1Max", type: "uint128" },
93
+ ],
94
+ },
95
+ ],
96
+ outputs: [
97
+ { name: "amount0", type: "uint256" },
98
+ { name: "amount1", type: "uint256" },
99
+ ],
100
+ },
101
+ {
102
+ name: "mint",
103
+ type: "function",
104
+ stateMutability: "payable",
105
+ inputs: [
106
+ {
107
+ name: "params",
108
+ type: "tuple",
109
+ components: [
110
+ { name: "token0", type: "address" },
111
+ { name: "token1", type: "address" },
112
+ { name: "fee", type: "uint24" },
113
+ { name: "tickLower", type: "int24" },
114
+ { name: "tickUpper", type: "int24" },
115
+ { name: "amount0Desired", type: "uint256" },
116
+ { name: "amount1Desired", type: "uint256" },
117
+ { name: "amount0Min", type: "uint256" },
118
+ { name: "amount1Min", type: "uint256" },
119
+ { name: "recipient", type: "address" },
120
+ { name: "deadline", type: "uint256" },
121
+ ],
122
+ },
123
+ ],
124
+ outputs: [
125
+ { name: "tokenId", type: "uint256" },
126
+ { name: "liquidity", type: "uint128" },
127
+ { name: "amount0", type: "uint256" },
128
+ { name: "amount1", type: "uint256" },
129
+ ],
130
+ },
131
+ {
132
+ name: "multicall",
133
+ type: "function",
134
+ stateMutability: "payable",
135
+ inputs: [{ name: "data", type: "bytes[]" }],
136
+ outputs: [{ name: "results", type: "bytes[]" }],
137
+ },
138
+ ];
139
+ /**
140
+ * Minimal ERC-20 ABI — only `decimals`, used to convert human token amounts
141
+ * to wei when planning a position.
142
+ */
143
+ export const erc20Abi = [
144
+ {
145
+ name: "decimals",
146
+ type: "function",
147
+ stateMutability: "view",
148
+ inputs: [],
149
+ outputs: [{ name: "", type: "uint8" }],
150
+ },
151
+ ];
152
+ /** Uniswap v3 factory — only `getPool`, to resolve a pool address. */
153
+ export const factoryAbi = [
154
+ {
155
+ name: "getPool",
156
+ type: "function",
157
+ stateMutability: "view",
158
+ inputs: [
159
+ { name: "tokenA", type: "address" },
160
+ { name: "tokenB", type: "address" },
161
+ { name: "fee", type: "uint24" },
162
+ ],
163
+ outputs: [{ name: "pool", type: "address" }],
164
+ },
165
+ ];
166
+ /** Uniswap v3 pool — only the state reads `get_pool_state` needs. */
167
+ export const poolAbi = [
168
+ {
169
+ name: "slot0",
170
+ type: "function",
171
+ stateMutability: "view",
172
+ inputs: [],
173
+ outputs: [
174
+ { name: "sqrtPriceX96", type: "uint160" },
175
+ { name: "tick", type: "int24" },
176
+ { name: "observationIndex", type: "uint16" },
177
+ { name: "observationCardinality", type: "uint16" },
178
+ { name: "observationCardinalityNext", type: "uint16" },
179
+ { name: "feeProtocol", type: "uint8" },
180
+ { name: "unlocked", type: "bool" },
181
+ ],
182
+ },
183
+ {
184
+ name: "tickSpacing",
185
+ type: "function",
186
+ stateMutability: "view",
187
+ inputs: [],
188
+ outputs: [{ name: "", type: "int24" }],
189
+ },
190
+ ];
191
+ /** Universal Router — only `execute`, for wrap/swap calldata. */
192
+ export const universalRouterAbi = [
193
+ {
194
+ name: "execute",
195
+ type: "function",
196
+ stateMutability: "payable",
197
+ inputs: [
198
+ { name: "commands", type: "bytes" },
199
+ { name: "inputs", type: "bytes[]" },
200
+ { name: "deadline", type: "uint256" },
201
+ ],
202
+ outputs: [],
203
+ },
204
+ ];
205
+ //# sourceMappingURL=abi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abi.js","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,qEAAqE;IACrE;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;YACjC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;YACrC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC/B,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;YACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;YACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACtC,EAAE,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,SAAS,EAAE;YACrD,EAAE,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,SAAS,EAAE;YACrD,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI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UAAU,EAAE,IAAI,EAAE,MAAM,EAAE;SACnC;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KACvC;CACO,CAAC;AAEX,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,SAAS;QAC1B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE;YACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;YACnC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;SACtC;QACD,OAAO,EAAE,EAAE;KACZ;CACO,CAAC"}
@@ -0,0 +1,149 @@
1
+ import { type Address, type Hex } from "viem";
2
+ import { type MintAmounts, type SuggestedRange } from "./ticks.js";
3
+ export interface UnsignedTx {
4
+ to: Address;
5
+ data: Hex;
6
+ value: string;
7
+ chainId: number;
8
+ }
9
+ /**
10
+ * Unsigned EIP-1559 (type-2) serialization of a built tx:
11
+ * `0x02 || rlp([chainId, 0, 0, 0, 0, to, value, data, []])`. Nonce, both fee
12
+ * fields and gasLimit are zeroed by design — signing services (e.g. the CDP
13
+ * API) populate them at signing time. Callers that manage their own nonces
14
+ * should serialize `tx` themselves instead.
15
+ */
16
+ export declare function toUnsignedRlp(tx: UnsignedTx): Hex;
17
+ export interface PositionInfo {
18
+ token0: Address;
19
+ token1: Address;
20
+ fee: number;
21
+ tickLower: number;
22
+ tickUpper: number;
23
+ liquidity: bigint;
24
+ }
25
+ export declare function buildCollectTx(chainId: number, positionId: bigint, recipient: Address): Promise<UnsignedTx>;
26
+ export declare function buildCloseTx(chainId: number, positionId: bigint, recipient: Address, burn?: boolean): Promise<{
27
+ tx: UnsignedTx;
28
+ position: PositionInfo;
29
+ }>;
30
+ export declare function simulateTx(chainId: number, tx: UnsignedTx, from: Address): Promise<void>;
31
+ export interface MintParams {
32
+ chainId: number;
33
+ token0: Address;
34
+ token1: Address;
35
+ fee: number;
36
+ tickLower: number;
37
+ tickUpper: number;
38
+ amount0Desired: bigint;
39
+ amount1Desired: bigint;
40
+ recipient: Address;
41
+ slippageBps?: number;
42
+ }
43
+ export declare function buildMintTx(params: MintParams): UnsignedTx;
44
+ export interface IncreaseParams {
45
+ chainId: number;
46
+ positionId: bigint;
47
+ amount0Desired: bigint;
48
+ amount1Desired: bigint;
49
+ slippageBps?: number;
50
+ }
51
+ export declare function buildIncreaseLiquidityTx(params: IncreaseParams): UnsignedTx;
52
+ export interface PlanPositionParams {
53
+ chainId: number;
54
+ token0: Address;
55
+ token1: Address;
56
+ fee: number;
57
+ priceLower: number;
58
+ priceUpper: number;
59
+ amount0?: string;
60
+ amount1?: string;
61
+ }
62
+ export interface PlanPositionResult {
63
+ token0: Address;
64
+ token1: Address;
65
+ fee: number;
66
+ tickLower: number;
67
+ tickUpper: number;
68
+ tickSpacing: number;
69
+ decimals0: number;
70
+ decimals1: number;
71
+ amount0Desired: string;
72
+ amount1Desired: string;
73
+ }
74
+ /**
75
+ * Resolve a human-readable position spec into the raw values `build_mint`
76
+ * needs: reads each token's decimals over RPC, converts the price range to
77
+ * aligned ticks, and parses human amounts to wei. Does not compute the optimal
78
+ * amount ratio for the range — pass the amounts you intend to deposit.
79
+ */
80
+ export declare function planPosition(params: PlanPositionParams): Promise<PlanPositionResult>;
81
+ export interface PoolStateParams {
82
+ chainId: number;
83
+ token0: Address;
84
+ token1: Address;
85
+ fee: number;
86
+ rangePct?: number;
87
+ tickLower?: number;
88
+ tickUpper?: number;
89
+ balance0?: bigint;
90
+ balance1?: bigint;
91
+ }
92
+ export interface PoolStateResult {
93
+ pool: Address;
94
+ tick: number;
95
+ tickSpacing: number;
96
+ sqrtPriceX96: string;
97
+ price: number;
98
+ decimals0: number;
99
+ decimals1: number;
100
+ suggested?: SuggestedRange;
101
+ mintAmounts?: {
102
+ amount0Desired: string;
103
+ amount1Desired: string;
104
+ limitingSide: MintAmounts["limitingSide"];
105
+ };
106
+ }
107
+ /**
108
+ * Read a pool's LIVE state and derive the values a mint needs from it in the
109
+ * same breath: optional ±pct tick range (rounded inward to spacing) and
110
+ * optional `amount0Desired`/`amount1Desired` computed from the current
111
+ * sqrtPrice ratio — amounts computed from stale prices revert the mint with
112
+ * "Price slippage check".
113
+ */
114
+ export declare function getPoolState(params: PoolStateParams): Promise<PoolStateResult>;
115
+ export interface WrapParams {
116
+ chainId: number;
117
+ amountWei: bigint;
118
+ recipient?: Address;
119
+ deadline?: number;
120
+ }
121
+ /**
122
+ * Native ETH → wrapped native (WETH9) via Universal Router `WRAP_ETH` — a
123
+ * direct `WETH.deposit()` is unusable under NFPM/UR-scoped wallet policies.
124
+ * The tx is payable: `value` carries the ETH being wrapped.
125
+ */
126
+ export declare function buildWrapTx(params: WrapParams): UnsignedTx;
127
+ export interface SwapParams {
128
+ chainId: number;
129
+ amountInWei: bigint;
130
+ tokenOut: Address;
131
+ fee: number;
132
+ amountOutMin: bigint;
133
+ recipient?: Address;
134
+ /**
135
+ * Wrap this much native ETH first (≥ amountInWei); the un-swapped remainder
136
+ * is swept back to `recipient` as WETH. Omit when the wallet already holds
137
+ * WETH — that variant pays through Permit2, so the wallet needs a Permit2
138
+ * approval for WETH9 rather than a plain ERC-20 approval to the router.
139
+ */
140
+ wrapWei?: bigint;
141
+ deadline?: number;
142
+ }
143
+ /**
144
+ * Exact-in single-hop v3 swap WETH9 → `tokenOut` via Universal Router.
145
+ * With `wrapWei`: `WRAP_ETH(ADDRESS_THIS)` + `V3_SWAP_EXACT_IN(payerIsUser=
146
+ * false)` + `SWEEP(WETH9, recipient, remainder)` in one payable tx — the
147
+ * "wallet holds native ETH but the position needs WETH/ERC-20" path.
148
+ */
149
+ export declare function buildSwapTx(params: SwapParams): UnsignedTx;