@continuumdao/ctm-mpc-defi 0.2.2 → 0.2.4
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/agent/catalog.cjs +440 -45
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +836 -1
- package/dist/agent/catalog.js +423 -46
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aave-v4/SKILL.md +120 -14
- package/dist/agent/skills/curve-dao/SKILL.md +125 -6
- package/dist/agent/skills/uniswap-v4/SKILL.md +187 -11
- package/dist/index.cjs +790 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +791 -19
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/curve-dao/index.cjs +53 -19
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/curve-dao/index.d.ts +9 -9
- package/dist/protocols/evm/curve-dao/index.js +53 -19
- package/dist/protocols/evm/curve-dao/index.js.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs +1007 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.d.ts +304 -4
- package/dist/protocols/evm/uniswap-v4/index.js +965 -3
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAddress, zeroAddress, formatUnits, parseUnits, encodeFunctionData, erc20Abi,
|
|
1
|
+
import { parseAbi, parseAbiItem, getAddress, zeroAddress, formatUnits, parseUnits, encodeFunctionData, erc20Abi, decodeEventLog, defineChain, createPublicClient, http, decodeFunctionData, parseGwei, serializeTransaction, keccak256 } from 'viem';
|
|
2
2
|
import { nodeFetchWithReadAuth, fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
3
3
|
|
|
4
4
|
// src/core/registry.ts
|
|
@@ -88,9 +88,55 @@ var MAX_UINT160 = (1n << 160n) - 1n;
|
|
|
88
88
|
var MAX_UINT48 = (1n << 48n) - 1n;
|
|
89
89
|
var UNISWAP_UNIVERSAL_ROUTER_DEFAULT_GAS_UNITS = 1500000n;
|
|
90
90
|
var UNISWAP_TRADE_BASE_DEFAULT = "https://trade-api.gateway.uniswap.org/v1";
|
|
91
|
+
var UNISWAP_LP_API_BASE_DEFAULT = "https://api.uniswap.org";
|
|
91
92
|
var UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT = "2.0";
|
|
92
93
|
var UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES = 30;
|
|
93
94
|
var UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET = UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES * 60;
|
|
95
|
+
var UNISWAP_LP_DEFAULT_EXPIRY_MINUTES = 30;
|
|
96
|
+
var UNISWAP_LP_DEFAULT_DEADLINE_SEC_OFFSET = UNISWAP_LP_DEFAULT_EXPIRY_MINUTES * 60;
|
|
97
|
+
var UNISWAP_LP_DEFAULT_SLIPPAGE_PERCENT = 0.5;
|
|
98
|
+
var POSITION_MANAGER_BY_CHAIN = {
|
|
99
|
+
1: "0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e",
|
|
100
|
+
10: "0x3c3ea4b57a46241e54610e5f022e5c45859a1017",
|
|
101
|
+
137: "0x1ec2ebf4f37e7363fdfe3551602425af0b3ceef9",
|
|
102
|
+
42161: "0xd88f38f930b7952f2db2432cb002e7abbf3dd869",
|
|
103
|
+
8453: "0x7C5f5A4bBd8fD63184577525326123B519429bDc",
|
|
104
|
+
11155111: "0x4B2C77d209D3405F41a037Ec6c77F7F5b8e2ca80",
|
|
105
|
+
130: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
|
|
106
|
+
1868: "0x0e2850543f69f678257266e0907ff9a58b3f13de",
|
|
107
|
+
59144: "0x661e93cca42afacb172121ef892830ca3b70f08d"
|
|
108
|
+
};
|
|
109
|
+
function getUniswapV4PositionManagerOrThrow(chainId) {
|
|
110
|
+
const raw = POSITION_MANAGER_BY_CHAIN[chainId];
|
|
111
|
+
if (!raw || !raw.startsWith("0x") || raw.length !== 42) {
|
|
112
|
+
throw new Error(
|
|
113
|
+
`No Uniswap V4 PositionManager is configured for chainId ${chainId}. Add this chain to uniswap-v4/constants or pass position manager from LP API response.`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return getAddress(raw);
|
|
117
|
+
}
|
|
118
|
+
function tryGetUniswapV4PositionManager(chainId) {
|
|
119
|
+
try {
|
|
120
|
+
return getUniswapV4PositionManagerOrThrow(chainId);
|
|
121
|
+
} catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
var POSITION_MANAGER_DEPLOY_BLOCK_BY_CHAIN = {
|
|
126
|
+
/** Ethereum mainnet — Uniswap v4 launch (Jan 2025). */
|
|
127
|
+
1: 22938741n
|
|
128
|
+
};
|
|
129
|
+
var UNISWAP_V4_LP_LOG_CHUNK_SIZE_DEFAULT = 200n;
|
|
130
|
+
var UNISWAP_V4_LP_LOG_CHUNK_SIZE_MIN = 10n;
|
|
131
|
+
function getUniswapV4PositionManagerDeployBlock(chainId) {
|
|
132
|
+
return POSITION_MANAGER_DEPLOY_BLOCK_BY_CHAIN[chainId];
|
|
133
|
+
}
|
|
134
|
+
var UNISWAP_V4_LP_MINT_DEFAULT_GAS_UNITS = 1800000n;
|
|
135
|
+
var UNISWAP_V4_LP_INCREASE_DEFAULT_GAS_UNITS = 1500000n;
|
|
136
|
+
var UNISWAP_V4_LP_DECREASE_DEFAULT_GAS_UNITS = 1200000n;
|
|
137
|
+
var UNISWAP_V4_LP_COLLECT_DEFAULT_GAS_UNITS = 900000n;
|
|
138
|
+
var UNISWAP_V4_LP_ERC20_APPROVE_FALLBACK = 100000n;
|
|
139
|
+
var UNISWAP_V4_LP_WETH_DEPOSIT_FALLBACK = 120000n;
|
|
94
140
|
var DEFAULT_TRADE_BASE = "https://trade-api.gateway.uniswap.org/v1";
|
|
95
141
|
var UNISWAP_QUOTE_HEADERS_BASE = {
|
|
96
142
|
"Content-Type": "application/json",
|
|
@@ -343,7 +389,16 @@ function parseUniswapQuoteClassicInOut(res) {
|
|
|
343
389
|
const input = q.input;
|
|
344
390
|
const output = q.output;
|
|
345
391
|
const inAm = input?.amount;
|
|
346
|
-
|
|
392
|
+
let outAm = output?.amount;
|
|
393
|
+
if (typeof outAm !== "string" || !outAm) {
|
|
394
|
+
const agg = q.aggregatedOutputs;
|
|
395
|
+
if (Array.isArray(agg) && agg.length > 0) {
|
|
396
|
+
const first = agg[0];
|
|
397
|
+
if (typeof first?.amount === "string" && first.amount) {
|
|
398
|
+
outAm = first.amount;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
347
402
|
if (typeof inAm !== "string" || !inAm || typeof outAm !== "string" || !outAm) return null;
|
|
348
403
|
try {
|
|
349
404
|
return { inputWei: BigInt(inAm), outputWei: BigInt(outAm) };
|
|
@@ -1322,6 +1377,858 @@ async function buildEvmMultisignBodyUniswapV4SkipPermit2Batch(args) {
|
|
|
1322
1377
|
});
|
|
1323
1378
|
}
|
|
1324
1379
|
|
|
1380
|
+
// src/protocols/evm/uniswap-v4/liquidityApi.ts
|
|
1381
|
+
var LP_HEADERS_BASE = {
|
|
1382
|
+
"Content-Type": "application/json",
|
|
1383
|
+
Accept: "application/json",
|
|
1384
|
+
"User-Agent": "ctm-mpc-defi uniswapLpApi/1.0 (TS)"
|
|
1385
|
+
};
|
|
1386
|
+
function trimAddr2(a) {
|
|
1387
|
+
return a.trim();
|
|
1388
|
+
}
|
|
1389
|
+
function lpDeadlineUnix(nowSec = Math.floor(Date.now() / 1e3)) {
|
|
1390
|
+
return nowSec + UNISWAP_LP_DEFAULT_DEADLINE_SEC_OFFSET;
|
|
1391
|
+
}
|
|
1392
|
+
function resolveLpBaseUrl(baseUrl) {
|
|
1393
|
+
const raw = (baseUrl ?? UNISWAP_TRADE_BASE_DEFAULT).replace(/\/$/, "");
|
|
1394
|
+
return raw;
|
|
1395
|
+
}
|
|
1396
|
+
function resolveLpPath(baseUrl, action) {
|
|
1397
|
+
const normalized = baseUrl.replace(/\/$/, "");
|
|
1398
|
+
if (normalized.includes("api.uniswap.org")) {
|
|
1399
|
+
return `${normalized}/lp/${action}`;
|
|
1400
|
+
}
|
|
1401
|
+
return `${normalized}/lp/${action}`;
|
|
1402
|
+
}
|
|
1403
|
+
async function postUniswapLpApi(args) {
|
|
1404
|
+
const useProxy = args.useServerProxy !== false && typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
|
|
1405
|
+
if (useProxy && args.proxyPath) {
|
|
1406
|
+
const fn2 = args.fetchImpl ?? globalThis.fetch;
|
|
1407
|
+
const res2 = await fn2(args.proxyPath, {
|
|
1408
|
+
method: "POST",
|
|
1409
|
+
headers: { "Content-Type": "application/json" },
|
|
1410
|
+
body: JSON.stringify({
|
|
1411
|
+
uniswapApiKey: args.uniswapApiKey,
|
|
1412
|
+
baseUrl: args.baseUrl,
|
|
1413
|
+
body: args.body
|
|
1414
|
+
}),
|
|
1415
|
+
credentials: "same-origin"
|
|
1416
|
+
});
|
|
1417
|
+
const text2 = await res2.text();
|
|
1418
|
+
if (!res2.ok) {
|
|
1419
|
+
let errMsg = res2.statusText;
|
|
1420
|
+
try {
|
|
1421
|
+
const j = JSON.parse(text2);
|
|
1422
|
+
if (j?.error?.trim()) errMsg = j.error.trim();
|
|
1423
|
+
} catch {
|
|
1424
|
+
if (text2.trim()) errMsg = text2.slice(0, 500);
|
|
1425
|
+
}
|
|
1426
|
+
throw new Error(`Uniswap LP proxy failed: ${errMsg}`);
|
|
1427
|
+
}
|
|
1428
|
+
return JSON.parse(text2);
|
|
1429
|
+
}
|
|
1430
|
+
const base = resolveLpBaseUrl(args.baseUrl);
|
|
1431
|
+
const url = resolveLpPath(base, args.path);
|
|
1432
|
+
const fn = args.fetchImpl ?? globalThis.fetch;
|
|
1433
|
+
const res = await fn(url, {
|
|
1434
|
+
method: "POST",
|
|
1435
|
+
headers: {
|
|
1436
|
+
...LP_HEADERS_BASE,
|
|
1437
|
+
"x-api-key": args.uniswapApiKey.trim()
|
|
1438
|
+
},
|
|
1439
|
+
body: JSON.stringify(args.body)
|
|
1440
|
+
});
|
|
1441
|
+
const text = await res.text();
|
|
1442
|
+
if (!res.ok) {
|
|
1443
|
+
throw new Error(
|
|
1444
|
+
`Uniswap LP POST /${args.path} failed: ${messageFromUniswapHttpResponseBody(text, res.status, res.statusText)}`
|
|
1445
|
+
);
|
|
1446
|
+
}
|
|
1447
|
+
return JSON.parse(text);
|
|
1448
|
+
}
|
|
1449
|
+
function extractUniswapLpTransaction(response, field) {
|
|
1450
|
+
const tx = response[field];
|
|
1451
|
+
if (!tx || typeof tx !== "object" || Array.isArray(tx)) {
|
|
1452
|
+
throw new Error(`Uniswap LP response missing \`${field}\` transaction object.`);
|
|
1453
|
+
}
|
|
1454
|
+
const o = tx;
|
|
1455
|
+
const to = String(o.to ?? "").trim();
|
|
1456
|
+
const data = String(o.data ?? "").trim();
|
|
1457
|
+
if (!to.startsWith("0x") || !data.startsWith("0x") || data === "0x") {
|
|
1458
|
+
throw new Error(`Uniswap LP \`${field}\` transaction has invalid to/data.`);
|
|
1459
|
+
}
|
|
1460
|
+
return {
|
|
1461
|
+
to,
|
|
1462
|
+
from: o.from != null ? String(o.from) : void 0,
|
|
1463
|
+
data,
|
|
1464
|
+
value: String(o.value ?? "0"),
|
|
1465
|
+
chainId: typeof o.chainId === "number" ? o.chainId : void 0,
|
|
1466
|
+
gasLimit: o.gasLimit != null ? String(o.gasLimit) : void 0,
|
|
1467
|
+
gasPrice: o.gasPrice != null ? String(o.gasPrice) : void 0,
|
|
1468
|
+
maxFeePerGas: o.maxFeePerGas != null ? String(o.maxFeePerGas) : void 0,
|
|
1469
|
+
maxPriorityFeePerGas: o.maxPriorityFeePerGas != null ? String(o.maxPriorityFeePerGas) : void 0
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function extractUniswapLpTokenAmounts(response) {
|
|
1473
|
+
const read = (key) => {
|
|
1474
|
+
const raw = response[key];
|
|
1475
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
1476
|
+
const o = raw;
|
|
1477
|
+
const tokenAddress = String(o.tokenAddress ?? o.token ?? "").trim();
|
|
1478
|
+
const amount = String(o.amount ?? "").trim();
|
|
1479
|
+
if (!tokenAddress.startsWith("0x") || !amount) return void 0;
|
|
1480
|
+
return { tokenAddress, amount };
|
|
1481
|
+
};
|
|
1482
|
+
return { token0: read("token0"), token1: read("token1") };
|
|
1483
|
+
}
|
|
1484
|
+
async function uniswapLpCreatePosition(args) {
|
|
1485
|
+
const body = {
|
|
1486
|
+
protocol: "V4",
|
|
1487
|
+
walletAddress: trimAddr2(args.walletAddress),
|
|
1488
|
+
chainId: args.chainId,
|
|
1489
|
+
independentToken: {
|
|
1490
|
+
tokenAddress: trimAddr2(args.independentToken.tokenAddress),
|
|
1491
|
+
amount: String(args.independentToken.amount).trim()
|
|
1492
|
+
},
|
|
1493
|
+
slippageTolerance: args.slippageTolerance ?? UNISWAP_LP_DEFAULT_SLIPPAGE_PERCENT,
|
|
1494
|
+
deadline: args.deadline ?? lpDeadlineUnix(),
|
|
1495
|
+
simulateTransaction: args.simulateTransaction ?? false
|
|
1496
|
+
};
|
|
1497
|
+
if (args.existingPool) {
|
|
1498
|
+
body.existingPool = {
|
|
1499
|
+
token0Address: trimAddr2(args.existingPool.token0Address),
|
|
1500
|
+
token1Address: trimAddr2(args.existingPool.token1Address),
|
|
1501
|
+
poolReference: trimAddr2(args.existingPool.poolReference)
|
|
1502
|
+
};
|
|
1503
|
+
}
|
|
1504
|
+
if (args.newPool) {
|
|
1505
|
+
body.newPool = {
|
|
1506
|
+
token0Address: trimAddr2(args.newPool.token0Address),
|
|
1507
|
+
token1Address: trimAddr2(args.newPool.token1Address),
|
|
1508
|
+
fee: args.newPool.fee,
|
|
1509
|
+
tickSpacing: args.newPool.tickSpacing,
|
|
1510
|
+
initialPrice: String(args.newPool.initialPrice).trim(),
|
|
1511
|
+
...args.newPool.hooks ? { hooks: trimAddr2(args.newPool.hooks) } : {}
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
if (!args.existingPool && !args.newPool) {
|
|
1515
|
+
throw new Error("Provide existingPool or newPool for LP create.");
|
|
1516
|
+
}
|
|
1517
|
+
if (args.priceBounds) {
|
|
1518
|
+
body.priceBounds = {
|
|
1519
|
+
minPrice: String(args.priceBounds.minPrice).trim(),
|
|
1520
|
+
maxPrice: String(args.priceBounds.maxPrice).trim()
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
if (args.tickBounds) {
|
|
1524
|
+
body.tickBounds = {
|
|
1525
|
+
tickLower: args.tickBounds.tickLower,
|
|
1526
|
+
tickUpper: args.tickBounds.tickUpper
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
if (!args.priceBounds && !args.tickBounds) {
|
|
1530
|
+
throw new Error("Provide priceBounds or tickBounds for LP create.");
|
|
1531
|
+
}
|
|
1532
|
+
if (args.batchPermitData) body.batchPermitData = args.batchPermitData;
|
|
1533
|
+
if (args.signature) body.signature = args.signature;
|
|
1534
|
+
return postUniswapLpApi({
|
|
1535
|
+
uniswapApiKey: args.uniswapApiKey,
|
|
1536
|
+
path: "create",
|
|
1537
|
+
body,
|
|
1538
|
+
baseUrl: args.baseUrl,
|
|
1539
|
+
fetchImpl: args.fetchImpl,
|
|
1540
|
+
useServerProxy: args.useServerProxy,
|
|
1541
|
+
proxyPath: "/api/uniswap/liquidity/create"
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
async function uniswapLpIncreasePosition(args) {
|
|
1545
|
+
const body = {
|
|
1546
|
+
protocol: "V4",
|
|
1547
|
+
walletAddress: trimAddr2(args.walletAddress),
|
|
1548
|
+
chainId: args.chainId,
|
|
1549
|
+
token0Address: trimAddr2(args.token0Address),
|
|
1550
|
+
token1Address: trimAddr2(args.token1Address),
|
|
1551
|
+
nftTokenId: String(args.nftTokenId),
|
|
1552
|
+
independentToken: {
|
|
1553
|
+
tokenAddress: trimAddr2(args.independentToken.tokenAddress),
|
|
1554
|
+
amount: String(args.independentToken.amount).trim()
|
|
1555
|
+
},
|
|
1556
|
+
slippageTolerance: args.slippageTolerance ?? UNISWAP_LP_DEFAULT_SLIPPAGE_PERCENT,
|
|
1557
|
+
deadline: args.deadline ?? lpDeadlineUnix(),
|
|
1558
|
+
simulateTransaction: args.simulateTransaction ?? false
|
|
1559
|
+
};
|
|
1560
|
+
if (args.v4BatchPermitData) body.v4BatchPermitData = args.v4BatchPermitData;
|
|
1561
|
+
if (args.signature) body.signature = args.signature;
|
|
1562
|
+
return postUniswapLpApi({
|
|
1563
|
+
uniswapApiKey: args.uniswapApiKey,
|
|
1564
|
+
path: "increase",
|
|
1565
|
+
body,
|
|
1566
|
+
baseUrl: args.baseUrl,
|
|
1567
|
+
fetchImpl: args.fetchImpl,
|
|
1568
|
+
useServerProxy: args.useServerProxy,
|
|
1569
|
+
proxyPath: "/api/uniswap/liquidity/increase"
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
async function uniswapLpDecreasePosition(args) {
|
|
1573
|
+
const pct = Math.trunc(args.liquidityPercentageToDecrease);
|
|
1574
|
+
if (!Number.isFinite(pct) || pct < 1 || pct > 100) {
|
|
1575
|
+
throw new Error("liquidityPercentageToDecrease must be an integer from 1 to 100.");
|
|
1576
|
+
}
|
|
1577
|
+
const body = {
|
|
1578
|
+
protocol: "V4",
|
|
1579
|
+
walletAddress: trimAddr2(args.walletAddress),
|
|
1580
|
+
chainId: args.chainId,
|
|
1581
|
+
token0Address: trimAddr2(args.token0Address),
|
|
1582
|
+
token1Address: trimAddr2(args.token1Address),
|
|
1583
|
+
nftTokenId: String(args.nftTokenId),
|
|
1584
|
+
liquidityPercentageToDecrease: pct,
|
|
1585
|
+
slippageTolerance: args.slippageTolerance ?? UNISWAP_LP_DEFAULT_SLIPPAGE_PERCENT,
|
|
1586
|
+
deadline: args.deadline ?? lpDeadlineUnix(),
|
|
1587
|
+
simulateTransaction: args.simulateTransaction ?? false
|
|
1588
|
+
};
|
|
1589
|
+
return postUniswapLpApi({
|
|
1590
|
+
uniswapApiKey: args.uniswapApiKey,
|
|
1591
|
+
path: "decrease",
|
|
1592
|
+
body,
|
|
1593
|
+
baseUrl: args.baseUrl,
|
|
1594
|
+
fetchImpl: args.fetchImpl,
|
|
1595
|
+
useServerProxy: args.useServerProxy,
|
|
1596
|
+
proxyPath: "/api/uniswap/liquidity/decrease"
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
async function uniswapLpClaimFees(args) {
|
|
1600
|
+
const body = {
|
|
1601
|
+
protocol: "V4",
|
|
1602
|
+
walletAddress: trimAddr2(args.walletAddress),
|
|
1603
|
+
chainId: args.chainId,
|
|
1604
|
+
tokenId: String(args.tokenId),
|
|
1605
|
+
simulateTransaction: args.simulateTransaction ?? false
|
|
1606
|
+
};
|
|
1607
|
+
return postUniswapLpApi({
|
|
1608
|
+
uniswapApiKey: args.uniswapApiKey,
|
|
1609
|
+
path: "claim",
|
|
1610
|
+
body,
|
|
1611
|
+
baseUrl: args.baseUrl,
|
|
1612
|
+
fetchImpl: args.fetchImpl,
|
|
1613
|
+
useServerProxy: args.useServerProxy,
|
|
1614
|
+
proxyPath: "/api/uniswap/liquidity/claim"
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
var TX_FIELD_BY_ACTION = {
|
|
1618
|
+
mint: "create",
|
|
1619
|
+
increase: "increase",
|
|
1620
|
+
decrease: "decrease",
|
|
1621
|
+
collect: "claim"
|
|
1622
|
+
};
|
|
1623
|
+
function uniswapLpTxFieldForAction(action) {
|
|
1624
|
+
return TX_FIELD_BY_ACTION[action];
|
|
1625
|
+
}
|
|
1626
|
+
function parseUniswapLpApiSnapshot(args) {
|
|
1627
|
+
const field = TX_FIELD_BY_ACTION[args.action];
|
|
1628
|
+
const transaction = extractUniswapLpTransaction(args.lpResponse, field);
|
|
1629
|
+
const amounts = extractUniswapLpTokenAmounts(args.lpResponse);
|
|
1630
|
+
const tickLower = typeof args.lpResponse.tickLower === "number" ? args.lpResponse.tickLower : void 0;
|
|
1631
|
+
const tickUpper = typeof args.lpResponse.tickUpper === "number" ? args.lpResponse.tickUpper : void 0;
|
|
1632
|
+
const minPrice = typeof args.lpResponse.minPrice === "string" ? args.lpResponse.minPrice : void 0;
|
|
1633
|
+
const maxPrice = typeof args.lpResponse.maxPrice === "string" ? args.lpResponse.maxPrice : void 0;
|
|
1634
|
+
return {
|
|
1635
|
+
transaction,
|
|
1636
|
+
token0: amounts.token0,
|
|
1637
|
+
token1: amounts.token1,
|
|
1638
|
+
tickLower,
|
|
1639
|
+
tickUpper,
|
|
1640
|
+
minPrice,
|
|
1641
|
+
maxPrice
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
function formatUniswapLpAmountHuman(amountWei, decimals) {
|
|
1645
|
+
try {
|
|
1646
|
+
return formatUnits(BigInt(amountWei), decimals);
|
|
1647
|
+
} catch {
|
|
1648
|
+
return amountWei;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
var erc721BalanceAbi = parseAbi([
|
|
1652
|
+
"function balanceOf(address owner) view returns (uint256)",
|
|
1653
|
+
"function ownerOf(uint256 tokenId) view returns (address)"
|
|
1654
|
+
]);
|
|
1655
|
+
var positionInfoAbi = parseAbi([
|
|
1656
|
+
"function positionInfo(uint256 tokenId) view returns (uint256 info)"
|
|
1657
|
+
]);
|
|
1658
|
+
var UNISWAP_V4_LP_POSITION_REGISTRY_HINT = "Add the position NFT to the node token registry (tokenType ERC721: Uniswap V4 Position Manager contract + tokenId). MCP: call ctm_uniswap_v4_register_position_nft (by tokenId) or ctm_uniswap_v4_register_position_from_mint_tx (after mint execute). Or use add_to_token_registry. In the Continuum app: Add Token (ERC721), or Manage liquidity \u2192 Refresh positions (blockchain scan).";
|
|
1659
|
+
function formatUniswapV4PositionNotFoundError(args) {
|
|
1660
|
+
return `Uniswap V4 position #${args.tokenId} is not in the node token registry for chain ${args.chainId}. ` + UNISWAP_V4_LP_POSITION_REGISTRY_HINT;
|
|
1661
|
+
}
|
|
1662
|
+
var positionManagerTransferEvent = parseAbiItem(
|
|
1663
|
+
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
1664
|
+
);
|
|
1665
|
+
function uniswapV4PositionMintedTokenIdsFromReceipt(receipt, positionManager, owner) {
|
|
1666
|
+
const pm = getAddress(positionManager);
|
|
1667
|
+
const wallet = getAddress(owner);
|
|
1668
|
+
const ids = [];
|
|
1669
|
+
for (const log of receipt.logs) {
|
|
1670
|
+
try {
|
|
1671
|
+
if (getAddress(log.address) !== pm) continue;
|
|
1672
|
+
const decoded = decodeEventLog({
|
|
1673
|
+
abi: [positionManagerTransferEvent],
|
|
1674
|
+
data: log.data,
|
|
1675
|
+
topics: log.topics
|
|
1676
|
+
});
|
|
1677
|
+
if (decoded.eventName !== "Transfer") continue;
|
|
1678
|
+
const from = decoded.args.from;
|
|
1679
|
+
const to = decoded.args.to;
|
|
1680
|
+
const tokenId = decoded.args.tokenId;
|
|
1681
|
+
if (from === zeroAddress && getAddress(to) === wallet) {
|
|
1682
|
+
ids.push(tokenId);
|
|
1683
|
+
}
|
|
1684
|
+
} catch {
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
return ids;
|
|
1688
|
+
}
|
|
1689
|
+
function uniswapV4ListPositionsFromRegistryForMcp(args) {
|
|
1690
|
+
const chainId = typeof args.chainId === "number" ? args.chainId : Number.parseInt(String(args.chainId), 10);
|
|
1691
|
+
if (!Number.isFinite(chainId) || chainId <= 0) {
|
|
1692
|
+
throw new Error("chainId must be a positive integer");
|
|
1693
|
+
}
|
|
1694
|
+
const wallet = getAddress(args.walletAddress);
|
|
1695
|
+
const pm = getAddress(
|
|
1696
|
+
args.positionManagerAddress ? String(args.positionManagerAddress) : getUniswapV4PositionManagerOrThrow(chainId)
|
|
1697
|
+
);
|
|
1698
|
+
const pmLower = pm.toLowerCase();
|
|
1699
|
+
const positions = [];
|
|
1700
|
+
for (const row of args.erc721Tokens) {
|
|
1701
|
+
const addr = (row.contractAddress ?? "").trim();
|
|
1702
|
+
const tokenId = (row.tokenId ?? "").trim();
|
|
1703
|
+
if (!addr || !tokenId) continue;
|
|
1704
|
+
try {
|
|
1705
|
+
if (getAddress(addr).toLowerCase() !== pmLower) continue;
|
|
1706
|
+
} catch {
|
|
1707
|
+
continue;
|
|
1708
|
+
}
|
|
1709
|
+
positions.push({
|
|
1710
|
+
tokenId,
|
|
1711
|
+
positionManager: pm,
|
|
1712
|
+
owner: wallet,
|
|
1713
|
+
name: row.name,
|
|
1714
|
+
symbol: row.symbol
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
positions.sort((a, b) => BigInt(a.tokenId) < BigInt(b.tokenId) ? -1 : 1);
|
|
1718
|
+
return { positions, source: "token_registry" };
|
|
1719
|
+
}
|
|
1720
|
+
function throwIfScanAborted(signal) {
|
|
1721
|
+
if (signal?.aborted) {
|
|
1722
|
+
throw new DOMException("Position scan aborted.", "AbortError");
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
var TRANSFER_EVENT = {
|
|
1726
|
+
type: "event",
|
|
1727
|
+
name: "Transfer",
|
|
1728
|
+
inputs: [
|
|
1729
|
+
{ indexed: true, name: "from", type: "address" },
|
|
1730
|
+
{ indexed: true, name: "to", type: "address" },
|
|
1731
|
+
{ indexed: true, name: "tokenId", type: "uint256" }
|
|
1732
|
+
]
|
|
1733
|
+
};
|
|
1734
|
+
function isEthGetLogsBlockRangeTooLargeError(err) {
|
|
1735
|
+
const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
|
|
1736
|
+
return msg.includes("block range too large") || msg.includes("maximum allowed") || msg.includes("query returned more than") || msg.includes("exceed maximum block range") || msg.includes("block range is too large");
|
|
1737
|
+
}
|
|
1738
|
+
async function getTransferLogsForWalletInRange(args) {
|
|
1739
|
+
const { client, positionManager, wallet, fromBlock, toBlock } = args;
|
|
1740
|
+
let chunkSize = args.chunkSize < UNISWAP_V4_LP_LOG_CHUNK_SIZE_MIN ? UNISWAP_V4_LP_LOG_CHUNK_SIZE_MIN : args.chunkSize;
|
|
1741
|
+
const out = [];
|
|
1742
|
+
let from = fromBlock;
|
|
1743
|
+
while (from <= toBlock) {
|
|
1744
|
+
let to = from + chunkSize - 1n > toBlock ? toBlock : from + chunkSize - 1n;
|
|
1745
|
+
for (; ; ) {
|
|
1746
|
+
try {
|
|
1747
|
+
const [toLogs, fromLogs] = await Promise.all([
|
|
1748
|
+
client.getLogs({
|
|
1749
|
+
address: positionManager,
|
|
1750
|
+
event: TRANSFER_EVENT,
|
|
1751
|
+
args: { to: wallet },
|
|
1752
|
+
fromBlock: from,
|
|
1753
|
+
toBlock: to
|
|
1754
|
+
}),
|
|
1755
|
+
client.getLogs({
|
|
1756
|
+
address: positionManager,
|
|
1757
|
+
event: TRANSFER_EVENT,
|
|
1758
|
+
args: { from: wallet },
|
|
1759
|
+
fromBlock: from,
|
|
1760
|
+
toBlock: to
|
|
1761
|
+
})
|
|
1762
|
+
]);
|
|
1763
|
+
out.push(...toLogs, ...fromLogs);
|
|
1764
|
+
from = to + 1n;
|
|
1765
|
+
break;
|
|
1766
|
+
} catch (err) {
|
|
1767
|
+
if (!isEthGetLogsBlockRangeTooLargeError(err) || chunkSize <= UNISWAP_V4_LP_LOG_CHUNK_SIZE_MIN) {
|
|
1768
|
+
throw err;
|
|
1769
|
+
}
|
|
1770
|
+
chunkSize = chunkSize / 2n;
|
|
1771
|
+
if (chunkSize < UNISWAP_V4_LP_LOG_CHUNK_SIZE_MIN) {
|
|
1772
|
+
chunkSize = UNISWAP_V4_LP_LOG_CHUNK_SIZE_MIN;
|
|
1773
|
+
}
|
|
1774
|
+
to = from + chunkSize - 1n > toBlock ? toBlock : from + chunkSize - 1n;
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
return out;
|
|
1779
|
+
}
|
|
1780
|
+
function parseUniswapV4ScanFromDateYmd(fromDate) {
|
|
1781
|
+
const trimmed = fromDate.trim();
|
|
1782
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) {
|
|
1783
|
+
throw new Error("fromDate must be YYYY-MM-DD");
|
|
1784
|
+
}
|
|
1785
|
+
const ms = Date.parse(`${trimmed}T00:00:00.000Z`);
|
|
1786
|
+
if (!Number.isFinite(ms)) {
|
|
1787
|
+
throw new Error(`Invalid fromDate: ${fromDate}`);
|
|
1788
|
+
}
|
|
1789
|
+
return Math.floor(ms / 1e3);
|
|
1790
|
+
}
|
|
1791
|
+
async function resolveBlockAtOrAfterUnixTime(client, unixTime, bounds) {
|
|
1792
|
+
let lo = bounds.minBlock;
|
|
1793
|
+
let hi = bounds.maxBlock;
|
|
1794
|
+
let ans = hi;
|
|
1795
|
+
while (lo <= hi) {
|
|
1796
|
+
const mid = (lo + hi) / 2n;
|
|
1797
|
+
const block = await client.getBlock({ blockNumber: mid });
|
|
1798
|
+
const ts = Number(block.timestamp);
|
|
1799
|
+
if (ts >= unixTime) {
|
|
1800
|
+
ans = mid;
|
|
1801
|
+
if (mid === 0n) break;
|
|
1802
|
+
hi = mid - 1n;
|
|
1803
|
+
} else {
|
|
1804
|
+
lo = mid + 1n;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
return ans;
|
|
1808
|
+
}
|
|
1809
|
+
async function resolveUniswapV4PositionScanFromDate(args) {
|
|
1810
|
+
const unixTime = parseUniswapV4ScanFromDateYmd(args.fromDate);
|
|
1811
|
+
const chain = defineChain({
|
|
1812
|
+
id: args.chainId,
|
|
1813
|
+
name: `uniswap-v4-${args.chainId}`,
|
|
1814
|
+
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
1815
|
+
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
1816
|
+
});
|
|
1817
|
+
const client = createPublicClient({ chain, transport: http(args.rpcUrl) });
|
|
1818
|
+
const latest = await client.getBlockNumber();
|
|
1819
|
+
const deploy = getUniswapV4PositionManagerDeployBlock(args.chainId) ?? 0n;
|
|
1820
|
+
const resolved = await resolveBlockAtOrAfterUnixTime(client, unixTime, {
|
|
1821
|
+
minBlock: deploy,
|
|
1822
|
+
maxBlock: latest
|
|
1823
|
+
});
|
|
1824
|
+
return resolved < deploy ? deploy : resolved;
|
|
1825
|
+
}
|
|
1826
|
+
function defaultScanFromBlock(args) {
|
|
1827
|
+
if (args.fromBlock != null) return args.fromBlock;
|
|
1828
|
+
const deploy = getUniswapV4PositionManagerDeployBlock(args.chainId);
|
|
1829
|
+
if (deploy != null) return deploy;
|
|
1830
|
+
return args.latest > args.maxBlocksToScan ? args.latest - args.maxBlocksToScan : 0n;
|
|
1831
|
+
}
|
|
1832
|
+
async function listUniswapV4PositionsForWallet(args) {
|
|
1833
|
+
throwIfScanAborted(args.signal);
|
|
1834
|
+
const wallet = getAddress(args.walletAddress);
|
|
1835
|
+
const pm = getAddress(
|
|
1836
|
+
args.positionManagerAddress ? String(args.positionManagerAddress) : getUniswapV4PositionManagerOrThrow(args.chainId)
|
|
1837
|
+
);
|
|
1838
|
+
const chain = defineChain({
|
|
1839
|
+
id: args.chainId,
|
|
1840
|
+
name: `uniswap-v4-${args.chainId}`,
|
|
1841
|
+
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
1842
|
+
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
1843
|
+
});
|
|
1844
|
+
const client = createPublicClient({ chain, transport: http(args.rpcUrl) });
|
|
1845
|
+
const latest = await client.getBlockNumber();
|
|
1846
|
+
const maxScan = args.maxBlocksToScan ?? 500000n;
|
|
1847
|
+
const chunkSize = args.chunkSize ?? UNISWAP_V4_LP_LOG_CHUNK_SIZE_DEFAULT;
|
|
1848
|
+
const scanFrom = defaultScanFromBlock({
|
|
1849
|
+
chainId: args.chainId,
|
|
1850
|
+
latest,
|
|
1851
|
+
fromBlock: args.fromBlock,
|
|
1852
|
+
maxBlocksToScan: maxScan
|
|
1853
|
+
});
|
|
1854
|
+
const balance = await client.readContract({
|
|
1855
|
+
address: pm,
|
|
1856
|
+
abi: erc721BalanceAbi,
|
|
1857
|
+
functionName: "balanceOf",
|
|
1858
|
+
args: [wallet]
|
|
1859
|
+
});
|
|
1860
|
+
const targetCount = Number(balance);
|
|
1861
|
+
const emitProgress = (scanningFromBlock, scanningToBlock, foundCount) => {
|
|
1862
|
+
args.onProgress?.({
|
|
1863
|
+
latestBlock: latest.toString(),
|
|
1864
|
+
scanFromBlock: scanFrom.toString(),
|
|
1865
|
+
scanningFromBlock: scanningFromBlock.toString(),
|
|
1866
|
+
scanningToBlock: scanningToBlock.toString(),
|
|
1867
|
+
foundCount,
|
|
1868
|
+
targetCount
|
|
1869
|
+
});
|
|
1870
|
+
};
|
|
1871
|
+
if (balance === 0n) {
|
|
1872
|
+
emitProgress(latest, latest, 0);
|
|
1873
|
+
return [];
|
|
1874
|
+
}
|
|
1875
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
1876
|
+
const verified = /* @__PURE__ */ new Map();
|
|
1877
|
+
let toBlock = latest;
|
|
1878
|
+
while (toBlock >= scanFrom && verified.size < targetCount) {
|
|
1879
|
+
throwIfScanAborted(args.signal);
|
|
1880
|
+
let fromBlock = toBlock >= chunkSize - 1n ? toBlock - chunkSize + 1n : 0n;
|
|
1881
|
+
if (fromBlock < scanFrom) fromBlock = scanFrom;
|
|
1882
|
+
emitProgress(fromBlock, toBlock, verified.size);
|
|
1883
|
+
const logs = await getTransferLogsForWalletInRange({
|
|
1884
|
+
client,
|
|
1885
|
+
positionManager: pm,
|
|
1886
|
+
wallet,
|
|
1887
|
+
fromBlock,
|
|
1888
|
+
toBlock,
|
|
1889
|
+
chunkSize
|
|
1890
|
+
});
|
|
1891
|
+
for (const log of logs) {
|
|
1892
|
+
const tokenId = log.args.tokenId?.toString();
|
|
1893
|
+
if (!tokenId) continue;
|
|
1894
|
+
const to = log.args.to != null ? getAddress(log.args.to) : null;
|
|
1895
|
+
const from = log.args.from != null ? getAddress(log.args.from) : null;
|
|
1896
|
+
if (to === wallet) candidates.add(tokenId);
|
|
1897
|
+
if (from === wallet) candidates.delete(tokenId);
|
|
1898
|
+
}
|
|
1899
|
+
for (const tokenId of candidates) {
|
|
1900
|
+
if (verified.has(tokenId)) continue;
|
|
1901
|
+
try {
|
|
1902
|
+
const owner = await client.readContract({
|
|
1903
|
+
address: pm,
|
|
1904
|
+
abi: erc721BalanceAbi,
|
|
1905
|
+
functionName: "ownerOf",
|
|
1906
|
+
args: [BigInt(tokenId)]
|
|
1907
|
+
});
|
|
1908
|
+
if (getAddress(owner) !== wallet) continue;
|
|
1909
|
+
verified.set(tokenId, { tokenId, positionManager: pm, owner: wallet });
|
|
1910
|
+
if (verified.size >= targetCount) break;
|
|
1911
|
+
} catch {
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
if (verified.size >= targetCount) break;
|
|
1915
|
+
if (fromBlock <= scanFrom) break;
|
|
1916
|
+
toBlock = fromBlock - 1n;
|
|
1917
|
+
}
|
|
1918
|
+
const out = [...verified.values()];
|
|
1919
|
+
out.sort((a, b) => BigInt(a.tokenId) < BigInt(b.tokenId) ? -1 : 1);
|
|
1920
|
+
return out;
|
|
1921
|
+
}
|
|
1922
|
+
async function readUniswapV4PositionInfoRaw(args) {
|
|
1923
|
+
const pm = getAddress(
|
|
1924
|
+
args.positionManagerAddress ? String(args.positionManagerAddress) : getUniswapV4PositionManagerOrThrow(args.chainId)
|
|
1925
|
+
);
|
|
1926
|
+
const chain = defineChain({
|
|
1927
|
+
id: args.chainId,
|
|
1928
|
+
name: `uniswap-v4-${args.chainId}`,
|
|
1929
|
+
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
1930
|
+
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
1931
|
+
});
|
|
1932
|
+
const client = createPublicClient({ chain, transport: http(args.rpcUrl) });
|
|
1933
|
+
const info = await client.readContract({
|
|
1934
|
+
address: pm,
|
|
1935
|
+
abi: positionInfoAbi,
|
|
1936
|
+
functionName: "positionInfo",
|
|
1937
|
+
args: [BigInt(args.tokenId)]
|
|
1938
|
+
});
|
|
1939
|
+
return { info, positionManager: pm };
|
|
1940
|
+
}
|
|
1941
|
+
async function uniswapV4ListPositionsForMcp(args) {
|
|
1942
|
+
const chainId = typeof args.chainId === "number" ? args.chainId : Number.parseInt(String(args.chainId), 10);
|
|
1943
|
+
if (!Number.isFinite(chainId) || chainId <= 0) {
|
|
1944
|
+
throw new Error("chainId must be a positive integer");
|
|
1945
|
+
}
|
|
1946
|
+
const fromBlock = args.fromBlock != null && String(args.fromBlock).trim() !== "" ? BigInt(String(args.fromBlock).trim()) : void 0;
|
|
1947
|
+
const positions = await listUniswapV4PositionsForWallet({
|
|
1948
|
+
chainId,
|
|
1949
|
+
rpcUrl: args.rpcUrl,
|
|
1950
|
+
walletAddress: args.walletAddress,
|
|
1951
|
+
positionManagerAddress: args.positionManagerAddress,
|
|
1952
|
+
fromBlock,
|
|
1953
|
+
onProgress: args.onProgress,
|
|
1954
|
+
signal: args.signal
|
|
1955
|
+
});
|
|
1956
|
+
return { positions };
|
|
1957
|
+
}
|
|
1958
|
+
function uniswapV4ListPositionsRegistryMcpPlaceholder() {
|
|
1959
|
+
throw new Error(
|
|
1960
|
+
"ctm_uniswap_v4_lp_list_positions must run via continuum-node-sdk MCP (token registry, no RPC scan)."
|
|
1961
|
+
);
|
|
1962
|
+
}
|
|
1963
|
+
function uniswapV4RegisterPositionNftPlaceholder() {
|
|
1964
|
+
throw new Error(
|
|
1965
|
+
"ctm_uniswap_v4_register_position_nft must run via continuum-node-sdk MCP (management-signed addToken)."
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1968
|
+
function uniswapV4RegisterPositionFromMintTxPlaceholder() {
|
|
1969
|
+
throw new Error(
|
|
1970
|
+
"ctm_uniswap_v4_register_position_from_mint_tx must run via continuum-node-sdk MCP (management-signed addToken)."
|
|
1971
|
+
);
|
|
1972
|
+
}
|
|
1973
|
+
function isNativeUniswapLpTokenAddress(token) {
|
|
1974
|
+
try {
|
|
1975
|
+
return getAddress(token) === zeroAddress;
|
|
1976
|
+
} catch {
|
|
1977
|
+
return token.toLowerCase() === zeroAddress.toLowerCase();
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
// src/protocols/evm/uniswap-v4/liquidityMultisign.ts
|
|
1982
|
+
var wethDepositAbi = parseAbi(["function deposit() payable"]);
|
|
1983
|
+
var erc20AllowanceAbi = parseAbi([
|
|
1984
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
|
1985
|
+
"function decimals() view returns (uint8)"
|
|
1986
|
+
]);
|
|
1987
|
+
function parseOptionalGasLimitString2(raw) {
|
|
1988
|
+
if (raw == null) return null;
|
|
1989
|
+
const s = String(raw).trim();
|
|
1990
|
+
if (!s) return null;
|
|
1991
|
+
try {
|
|
1992
|
+
if (/^0x[0-9a-fA-F]+$/.test(s)) return BigInt(s);
|
|
1993
|
+
return BigInt(s);
|
|
1994
|
+
} catch {
|
|
1995
|
+
return null;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
function parseTxValueWei(tx) {
|
|
1999
|
+
const raw = tx.value ?? "0";
|
|
2000
|
+
try {
|
|
2001
|
+
if (typeof raw === "string" && /^0x[0-9a-fA-F]+$/.test(raw.trim())) return BigInt(raw.trim());
|
|
2002
|
+
return BigInt(String(raw).trim() || "0");
|
|
2003
|
+
} catch {
|
|
2004
|
+
return 0n;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
function dataHexFromTx(tx) {
|
|
2008
|
+
const d = (tx.data ?? "0x").toString().trim();
|
|
2009
|
+
return d.startsWith("0x") ? d : `0x${d}`;
|
|
2010
|
+
}
|
|
2011
|
+
function parseExtraJsonObject2(detail) {
|
|
2012
|
+
if (!detail) return null;
|
|
2013
|
+
const raw = detail.ExtraJSON ?? detail.extraJSON;
|
|
2014
|
+
if (raw == null) return null;
|
|
2015
|
+
if (typeof raw === "object" && !Array.isArray(raw)) return raw;
|
|
2016
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
2017
|
+
try {
|
|
2018
|
+
const p = JSON.parse(raw);
|
|
2019
|
+
if (p && typeof p === "object" && !Array.isArray(p)) return p;
|
|
2020
|
+
} catch {
|
|
2021
|
+
return null;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
return null;
|
|
2025
|
+
}
|
|
2026
|
+
function uniswapV4LiquidityEvmTypeFromBatchMeta(ex, batchIndex) {
|
|
2027
|
+
if (!ex) return false;
|
|
2028
|
+
const bm = ex.batchMeta;
|
|
2029
|
+
if (!Array.isArray(bm) || !bm[batchIndex] || typeof bm[batchIndex] !== "object" || Array.isArray(bm[batchIndex])) {
|
|
2030
|
+
return false;
|
|
2031
|
+
}
|
|
2032
|
+
const evm0 = bm[batchIndex].evm;
|
|
2033
|
+
if (!evm0 || typeof evm0 !== "object" || Array.isArray(evm0)) return false;
|
|
2034
|
+
return String(evm0.type ?? "") === "uniswap_v4_liquidity_tx";
|
|
2035
|
+
}
|
|
2036
|
+
function isUniswapV4LiquidityEvmSignRequest(detail, batchIndex) {
|
|
2037
|
+
const ex = parseExtraJsonObject2(detail);
|
|
2038
|
+
if (batchIndex != null && batchIndex >= 0) {
|
|
2039
|
+
if (uniswapV4LiquidityEvmTypeFromBatchMeta(ex, batchIndex)) return true;
|
|
2040
|
+
} else if (uniswapV4LiquidityEvmTypeFromBatchMeta(ex, 0)) {
|
|
2041
|
+
return true;
|
|
2042
|
+
}
|
|
2043
|
+
const evm = ex?.evm;
|
|
2044
|
+
if (!evm || typeof evm !== "object" || Array.isArray(evm)) return false;
|
|
2045
|
+
return String(evm.type ?? "") === "uniswap_v4_liquidity_tx";
|
|
2046
|
+
}
|
|
2047
|
+
function defaultGasForAction(action) {
|
|
2048
|
+
switch (action) {
|
|
2049
|
+
case "mint":
|
|
2050
|
+
return UNISWAP_V4_LP_MINT_DEFAULT_GAS_UNITS;
|
|
2051
|
+
case "increase":
|
|
2052
|
+
return UNISWAP_V4_LP_INCREASE_DEFAULT_GAS_UNITS;
|
|
2053
|
+
case "decrease":
|
|
2054
|
+
return UNISWAP_V4_LP_DECREASE_DEFAULT_GAS_UNITS;
|
|
2055
|
+
case "collect":
|
|
2056
|
+
return UNISWAP_V4_LP_COLLECT_DEFAULT_GAS_UNITS;
|
|
2057
|
+
default:
|
|
2058
|
+
return UNISWAP_V4_LP_MINT_DEFAULT_GAS_UNITS;
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
async function resolveApproveTargets(args) {
|
|
2062
|
+
const out = [];
|
|
2063
|
+
const pairs = [args.token0, args.token1].filter(Boolean);
|
|
2064
|
+
for (const row of pairs) {
|
|
2065
|
+
const amt = BigInt(row.amount);
|
|
2066
|
+
if (amt <= 0n) continue;
|
|
2067
|
+
if (isNativeUniswapLpTokenAddress(row.tokenAddress)) {
|
|
2068
|
+
if (!args.nativeWrapped) {
|
|
2069
|
+
throw new Error("nativeWrapped is required when LP uses native ETH (0x0) token.");
|
|
2070
|
+
}
|
|
2071
|
+
out.push({ token: getAddress(args.nativeWrapped), amount: amt, kind: "weth_deposit" });
|
|
2072
|
+
continue;
|
|
2073
|
+
}
|
|
2074
|
+
out.push({ token: getAddress(row.tokenAddress), amount: amt, kind: "approve" });
|
|
2075
|
+
}
|
|
2076
|
+
const deduped = [];
|
|
2077
|
+
for (const row of out) {
|
|
2078
|
+
const existing = deduped.find((d) => d.token === row.token && d.kind === row.kind);
|
|
2079
|
+
if (existing) {
|
|
2080
|
+
if (row.amount > existing.amount) existing.amount = row.amount;
|
|
2081
|
+
} else {
|
|
2082
|
+
deduped.push({ ...row });
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
const steps = [];
|
|
2086
|
+
for (const row of deduped) {
|
|
2087
|
+
if (row.kind === "weth_deposit") {
|
|
2088
|
+
steps.push(row);
|
|
2089
|
+
continue;
|
|
2090
|
+
}
|
|
2091
|
+
const allowance = await args.publicClient.readContract({
|
|
2092
|
+
address: row.token,
|
|
2093
|
+
abi: erc20AllowanceAbi,
|
|
2094
|
+
functionName: "allowance",
|
|
2095
|
+
args: [args.executor, args.spender]
|
|
2096
|
+
});
|
|
2097
|
+
if (allowance < row.amount) {
|
|
2098
|
+
steps.push(row);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
return steps;
|
|
2102
|
+
}
|
|
2103
|
+
async function buildEvmMultisignBodyUniswapV4LiquidityBatchInternal(args) {
|
|
2104
|
+
const parsed = parseUniswapLpApiSnapshot({ action: args.action, lpResponse: args.lpResponse });
|
|
2105
|
+
const tx = parsed.transaction;
|
|
2106
|
+
const to = getAddress(tx.to);
|
|
2107
|
+
const dataHex = dataHexFromTx(tx);
|
|
2108
|
+
const valueWei = parseTxValueWei(tx);
|
|
2109
|
+
const executor = getAddress(args.executorAddress);
|
|
2110
|
+
const spender = to;
|
|
2111
|
+
const chain = defineChain({
|
|
2112
|
+
id: args.chainId,
|
|
2113
|
+
name: `uniswap-v4-lp-${args.chainId}`,
|
|
2114
|
+
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
2115
|
+
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
2116
|
+
});
|
|
2117
|
+
const publicClient = createPublicClient({ chain, transport: http(args.rpcUrl) });
|
|
2118
|
+
const approveTargets = await resolveApproveTargets({
|
|
2119
|
+
publicClient,
|
|
2120
|
+
executor,
|
|
2121
|
+
spender,
|
|
2122
|
+
token0: parsed.token0,
|
|
2123
|
+
token1: parsed.token1,
|
|
2124
|
+
nativeWrapped: args.nativeWrapped
|
|
2125
|
+
});
|
|
2126
|
+
const steps = [];
|
|
2127
|
+
for (const target of approveTargets) {
|
|
2128
|
+
if (target.kind === "weth_deposit") {
|
|
2129
|
+
steps.push({
|
|
2130
|
+
to: target.token,
|
|
2131
|
+
data: encodeFunctionData({ abi: wethDepositAbi, functionName: "deposit" }),
|
|
2132
|
+
value: target.amount,
|
|
2133
|
+
fallbackGas: UNISWAP_V4_LP_WETH_DEPOSIT_FALLBACK
|
|
2134
|
+
});
|
|
2135
|
+
steps.push({
|
|
2136
|
+
to: target.token,
|
|
2137
|
+
data: encodeFunctionData({
|
|
2138
|
+
abi: erc20Abi,
|
|
2139
|
+
functionName: "approve",
|
|
2140
|
+
args: [spender, target.amount]
|
|
2141
|
+
}),
|
|
2142
|
+
value: 0n,
|
|
2143
|
+
fallbackGas: UNISWAP_V4_LP_ERC20_APPROVE_FALLBACK
|
|
2144
|
+
});
|
|
2145
|
+
} else {
|
|
2146
|
+
steps.push({
|
|
2147
|
+
to: target.token,
|
|
2148
|
+
data: encodeFunctionData({
|
|
2149
|
+
abi: erc20Abi,
|
|
2150
|
+
functionName: "approve",
|
|
2151
|
+
args: [spender, target.amount]
|
|
2152
|
+
}),
|
|
2153
|
+
value: 0n,
|
|
2154
|
+
fallbackGas: UNISWAP_V4_LP_ERC20_APPROVE_FALLBACK
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
const lpFallbackGas = defaultGasForAction(args.action);
|
|
2159
|
+
const fromTradeApi = parseOptionalGasLimitString2(tx.gasLimit) ?? parseOptionalGasLimitString2(tx.gas);
|
|
2160
|
+
steps.push({
|
|
2161
|
+
to,
|
|
2162
|
+
data: dataHex,
|
|
2163
|
+
value: valueWei,
|
|
2164
|
+
fallbackGas: fromTradeApi != null && fromTradeApi > 0n ? fromTradeApi : lpFallbackGas
|
|
2165
|
+
});
|
|
2166
|
+
const actionLabel = args.action === "mint" ? "mint liquidity" : args.action === "increase" ? "increase liquidity" : args.action === "decrease" ? "decrease liquidity" : "collect fees";
|
|
2167
|
+
const dataNo0x = dataHex.startsWith("0x") ? dataHex.slice(2) : dataHex;
|
|
2168
|
+
const lpIndex = steps.length - 1;
|
|
2169
|
+
return buildEvmMultisignBatch({
|
|
2170
|
+
context: {
|
|
2171
|
+
chainCategory: "evm",
|
|
2172
|
+
keyGen: args.keyGen,
|
|
2173
|
+
purposeText: args.purposeText,
|
|
2174
|
+
chainId: args.chainId,
|
|
2175
|
+
rpcUrl: args.rpcUrl,
|
|
2176
|
+
executorAddress: args.executorAddress,
|
|
2177
|
+
chainDetail: args.chainDetail,
|
|
2178
|
+
useCustomGas: args.useCustomGas,
|
|
2179
|
+
customGasChainDetails: args.customGasChainDetails
|
|
2180
|
+
},
|
|
2181
|
+
steps,
|
|
2182
|
+
purposeSuffix: `Uniswap V4: ${steps.length}-tx batch \u2014 ${actionLabel} (classic ERC-20 approve + Position Manager).`,
|
|
2183
|
+
firstMsgRawNo0x: dataNo0x,
|
|
2184
|
+
destinationAddress: to,
|
|
2185
|
+
buildBatchMeta: ({ index }) => {
|
|
2186
|
+
const isLpStep = index === lpIndex;
|
|
2187
|
+
return {
|
|
2188
|
+
signatureText: JSON.stringify({
|
|
2189
|
+
kind: "UniswapV4Liquidity",
|
|
2190
|
+
action: args.action,
|
|
2191
|
+
step: index,
|
|
2192
|
+
lpTx: isLpStep
|
|
2193
|
+
}),
|
|
2194
|
+
...isLpStep ? {
|
|
2195
|
+
evm: { type: "uniswap_v4_liquidity_tx", version: 1, chainId: String(args.chainId) },
|
|
2196
|
+
uniswapV4Liquidity: {
|
|
2197
|
+
action: args.action,
|
|
2198
|
+
skipPermit2Batch: true,
|
|
2199
|
+
nftTokenId: args.nftTokenId != null ? String(args.nftTokenId) : void 0,
|
|
2200
|
+
poolReference: args.poolReference,
|
|
2201
|
+
lpResponseSnapshot: args.lpResponse,
|
|
2202
|
+
token0: parsed.token0,
|
|
2203
|
+
token1: parsed.token1,
|
|
2204
|
+
tickLower: parsed.tickLower,
|
|
2205
|
+
tickUpper: parsed.tickUpper,
|
|
2206
|
+
transaction: {
|
|
2207
|
+
to: tx.to,
|
|
2208
|
+
value: tx.value,
|
|
2209
|
+
dataNibbles: dataNo0x.length,
|
|
2210
|
+
gasLimit: tx.gasLimit
|
|
2211
|
+
},
|
|
2212
|
+
originalPurpose: args.purposeText
|
|
2213
|
+
}
|
|
2214
|
+
} : {}
|
|
2215
|
+
};
|
|
2216
|
+
}
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
async function buildEvmMultisignBodyUniswapV4MintLiquidityBatch(args) {
|
|
2220
|
+
return buildEvmMultisignBodyUniswapV4LiquidityBatchInternal({ ...args, action: "mint" });
|
|
2221
|
+
}
|
|
2222
|
+
async function buildEvmMultisignBodyUniswapV4IncreaseLiquidityBatch(args) {
|
|
2223
|
+
return buildEvmMultisignBodyUniswapV4LiquidityBatchInternal({ ...args, action: "increase" });
|
|
2224
|
+
}
|
|
2225
|
+
async function buildEvmMultisignBodyUniswapV4DecreaseLiquidityBatch(args) {
|
|
2226
|
+
return buildEvmMultisignBodyUniswapV4LiquidityBatchInternal({ ...args, action: "decrease" });
|
|
2227
|
+
}
|
|
2228
|
+
async function buildEvmMultisignBodyUniswapV4CollectFeesBatch(args) {
|
|
2229
|
+
return buildEvmMultisignBodyUniswapV4LiquidityBatchInternal({ ...args, action: "collect" });
|
|
2230
|
+
}
|
|
2231
|
+
|
|
1325
2232
|
// src/protocols/evm/uniswap-v4/support.ts
|
|
1326
2233
|
function computeUniswapV4Session(args) {
|
|
1327
2234
|
const chainIdNum = typeof args.assetsChainId === "number" ? args.assetsChainId : parseInt(String(args.assetsChainId).trim(), 10);
|
|
@@ -1425,6 +2332,52 @@ var uniswapV4ProtocolModule = {
|
|
|
1425
2332
|
amount: { type: "string", required: true, description: "Amount for quote" },
|
|
1426
2333
|
type: { type: "EXACT_INPUT | EXACT_OUTPUT", required: true, description: "Trade type" }
|
|
1427
2334
|
}
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
id: "uniswap-v4.mint-liquidity",
|
|
2338
|
+
protocolId: UNISWAP_V4_PROTOCOL_ID,
|
|
2339
|
+
chainCategory: "evm",
|
|
2340
|
+
description: "Mint a new Uniswap V4 concentrated liquidity position (Position Manager NFT)",
|
|
2341
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2342
|
+
params: {
|
|
2343
|
+
lpResponse: { type: "object", required: true, description: "Full LP API create response" },
|
|
2344
|
+
nativeWrapped: { type: "address", required: false, description: "WETH when pool uses native ETH" },
|
|
2345
|
+
poolReference: { type: "string", required: false, description: "V4 pool id" },
|
|
2346
|
+
uniswapApiKey: { type: "string", required: true, description: "Uniswap API key" }
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2349
|
+
{
|
|
2350
|
+
id: "uniswap-v4.increase-liquidity",
|
|
2351
|
+
protocolId: UNISWAP_V4_PROTOCOL_ID,
|
|
2352
|
+
chainCategory: "evm",
|
|
2353
|
+
description: "Increase liquidity on an existing Uniswap V4 position NFT",
|
|
2354
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2355
|
+
params: {
|
|
2356
|
+
nftTokenId: { type: "string", required: true, description: "Position NFT token id" },
|
|
2357
|
+
lpResponse: { type: "object", required: true, description: "Full LP API increase response" }
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
id: "uniswap-v4.decrease-liquidity",
|
|
2362
|
+
protocolId: UNISWAP_V4_PROTOCOL_ID,
|
|
2363
|
+
chainCategory: "evm",
|
|
2364
|
+
description: "Decrease liquidity on an existing Uniswap V4 position NFT",
|
|
2365
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2366
|
+
params: {
|
|
2367
|
+
nftTokenId: { type: "string", required: true, description: "Position NFT token id" },
|
|
2368
|
+
lpResponse: { type: "object", required: true, description: "Full LP API decrease response" }
|
|
2369
|
+
}
|
|
2370
|
+
},
|
|
2371
|
+
{
|
|
2372
|
+
id: "uniswap-v4.collect-fees",
|
|
2373
|
+
protocolId: UNISWAP_V4_PROTOCOL_ID,
|
|
2374
|
+
chainCategory: "evm",
|
|
2375
|
+
description: "Collect accrued fees from a Uniswap V4 position NFT",
|
|
2376
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2377
|
+
params: {
|
|
2378
|
+
nftTokenId: { type: "string", required: true, description: "Position NFT token id" },
|
|
2379
|
+
lpResponse: { type: "object", required: true, description: "Full LP API claim response" }
|
|
2380
|
+
}
|
|
1428
2381
|
}
|
|
1429
2382
|
]
|
|
1430
2383
|
};
|
|
@@ -1436,9 +2389,18 @@ var uniswapV4 = {
|
|
|
1436
2389
|
swapFromQuote,
|
|
1437
2390
|
buildSwapMultisignBody: buildEvmMultisignBodyUniswapV4SkipPermit2Batch,
|
|
1438
2391
|
quote: uniswapTradeQuote,
|
|
2392
|
+
createLiquidityPosition: uniswapLpCreatePosition,
|
|
2393
|
+
increaseLiquidityPosition: uniswapLpIncreasePosition,
|
|
2394
|
+
decreaseLiquidityPosition: uniswapLpDecreasePosition,
|
|
2395
|
+
claimLiquidityFees: uniswapLpClaimFees,
|
|
2396
|
+
buildMintLiquidityMultisignBody: buildEvmMultisignBodyUniswapV4MintLiquidityBatch,
|
|
2397
|
+
buildIncreaseLiquidityMultisignBody: buildEvmMultisignBodyUniswapV4IncreaseLiquidityBatch,
|
|
2398
|
+
buildDecreaseLiquidityMultisignBody: buildEvmMultisignBodyUniswapV4DecreaseLiquidityBatch,
|
|
2399
|
+
buildCollectFeesMultisignBody: buildEvmMultisignBodyUniswapV4CollectFeesBatch,
|
|
2400
|
+
listPositions: listUniswapV4PositionsForWallet,
|
|
1439
2401
|
isChainSupported: isUniswapV4ChainSupported
|
|
1440
2402
|
};
|
|
1441
2403
|
|
|
1442
|
-
export { MAX_UINT160, MAX_UINT48, PERMIT2_ADDRESS, UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET, UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES, UNISWAP_TRADE_BASE_DEFAULT, UNISWAP_UNIVERSAL_ROUTER_DEFAULT_GAS_UNITS, UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT, UNISWAP_V4_PROTOCOL_ID, applySlippagePercentToApproveWei, buildEvmMultisignBodyUniswapV4SkipPermit2Batch, buildUniswapQuoteRequestBody, buildUniswapV4PurposePrefill, computeUniswapV4Session, createSwap, errorMessageFromUniswapJsonBody, fetchEthereumAddressForKeyGen, formatUniswapAmountFieldFromWei, formatUniswapPercentForUi, formatUniswapQuoteForDisplay, getClassicQuoteFromStoredUniswapResponse, getUniswapUniversalRouterSpenderOrThrow, isUniswapFullQuoteResponseNativeIn, isUniswapTokenInAddressNative, isUniswapV4ChainSupported, isUniswapV4SwapEvmSignRequest, messageFromUniswapHttpResponseBody, parseUniswapChainId, parseUniswapQuoteClassicInOut, parseUniswapQuoteSlippageInfo, quoteSwap, resolveRouterSwapGasUnitsFromSignRequest, swapExactInput, swapFromQuote, swapTransactionDeadlineUnixFromExpiryMinutes, uniswapCreateSwap, uniswapQuoteToJsonQuoteOneLine, uniswapTradeQuote, uniswapV4, uniswapV4ProtocolModule };
|
|
2404
|
+
export { MAX_UINT160, MAX_UINT48, PERMIT2_ADDRESS, UNISWAP_LP_API_BASE_DEFAULT, UNISWAP_LP_DEFAULT_DEADLINE_SEC_OFFSET, UNISWAP_LP_DEFAULT_EXPIRY_MINUTES, UNISWAP_LP_DEFAULT_SLIPPAGE_PERCENT, UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET, UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES, UNISWAP_TRADE_BASE_DEFAULT, UNISWAP_UNIVERSAL_ROUTER_DEFAULT_GAS_UNITS, UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT, UNISWAP_V4_LP_COLLECT_DEFAULT_GAS_UNITS, UNISWAP_V4_LP_DECREASE_DEFAULT_GAS_UNITS, UNISWAP_V4_LP_ERC20_APPROVE_FALLBACK, UNISWAP_V4_LP_INCREASE_DEFAULT_GAS_UNITS, UNISWAP_V4_LP_LOG_CHUNK_SIZE_DEFAULT, UNISWAP_V4_LP_LOG_CHUNK_SIZE_MIN, UNISWAP_V4_LP_MINT_DEFAULT_GAS_UNITS, UNISWAP_V4_LP_POSITION_REGISTRY_HINT, UNISWAP_V4_LP_WETH_DEPOSIT_FALLBACK, UNISWAP_V4_PROTOCOL_ID, applySlippagePercentToApproveWei, buildEvmMultisignBodyUniswapV4CollectFeesBatch, buildEvmMultisignBodyUniswapV4DecreaseLiquidityBatch, buildEvmMultisignBodyUniswapV4IncreaseLiquidityBatch, buildEvmMultisignBodyUniswapV4MintLiquidityBatch, buildEvmMultisignBodyUniswapV4SkipPermit2Batch, buildUniswapQuoteRequestBody, buildUniswapV4PurposePrefill, computeUniswapV4Session, createSwap, errorMessageFromUniswapJsonBody, extractUniswapLpTokenAmounts, extractUniswapLpTransaction, fetchEthereumAddressForKeyGen, formatUniswapAmountFieldFromWei, formatUniswapLpAmountHuman, formatUniswapPercentForUi, formatUniswapQuoteForDisplay, formatUniswapV4PositionNotFoundError, getClassicQuoteFromStoredUniswapResponse, getUniswapUniversalRouterSpenderOrThrow, getUniswapV4PositionManagerDeployBlock, getUniswapV4PositionManagerOrThrow, isEthGetLogsBlockRangeTooLargeError, isNativeUniswapLpTokenAddress, isUniswapFullQuoteResponseNativeIn, isUniswapTokenInAddressNative, isUniswapV4ChainSupported, isUniswapV4LiquidityEvmSignRequest, isUniswapV4SwapEvmSignRequest, listUniswapV4PositionsForWallet, messageFromUniswapHttpResponseBody, parseUniswapChainId, parseUniswapLpApiSnapshot, parseUniswapQuoteClassicInOut, parseUniswapQuoteSlippageInfo, parseUniswapV4ScanFromDateYmd, quoteSwap, readUniswapV4PositionInfoRaw, resolveBlockAtOrAfterUnixTime, resolveRouterSwapGasUnitsFromSignRequest, resolveUniswapV4PositionScanFromDate, swapExactInput, swapFromQuote, swapTransactionDeadlineUnixFromExpiryMinutes, tryGetUniswapV4PositionManager, uniswapCreateSwap, uniswapLpClaimFees, uniswapLpCreatePosition, uniswapLpDecreasePosition, uniswapLpIncreasePosition, uniswapLpTxFieldForAction, uniswapQuoteToJsonQuoteOneLine, uniswapTradeQuote, uniswapV4, uniswapV4ListPositionsForMcp, uniswapV4ListPositionsFromRegistryForMcp, uniswapV4ListPositionsRegistryMcpPlaceholder, uniswapV4PositionMintedTokenIdsFromReceipt, uniswapV4ProtocolModule, uniswapV4RegisterPositionFromMintTxPlaceholder, uniswapV4RegisterPositionNftPlaceholder };
|
|
1443
2405
|
//# sourceMappingURL=index.js.map
|
|
1444
2406
|
//# sourceMappingURL=index.js.map
|