@continuumdao/ctm-mpc-defi 0.2.13 → 0.2.17
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 +1149 -287
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +1655 -306
- package/dist/agent/catalog.js +1144 -288
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/_shared/multisign-mcp-gas.md +7 -4
- package/dist/agent/skills/circle-cctp/SKILL.md +63 -0
- package/dist/chains/evm/index.cjs +75 -0
- package/dist/chains/evm/index.cjs.map +1 -1
- package/dist/chains/evm/index.d.ts +31 -1
- package/dist/chains/evm/index.js +73 -2
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/index.cjs +140 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +138 -34
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/circle-cctp/index.cjs +1067 -0
- package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -0
- package/dist/protocols/evm/circle-cctp/index.d.ts +281 -0
- package/dist/protocols/evm/circle-cctp/index.js +1026 -0
- package/dist/protocols/evm/circle-cctp/index.js.map +1 -0
- package/dist/protocols/evm/euler-v2/index.cjs +29 -2
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +23 -1
- package/dist/protocols/evm/euler-v2/index.js +29 -3
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +42 -8
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.d.ts +20 -4
- package/dist/protocols/evm/gmx/index.js +42 -9
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/maple/index.cjs +9 -1
- package/dist/protocols/evm/maple/index.cjs.map +1 -1
- package/dist/protocols/evm/maple/index.d.ts +2 -1
- package/dist/protocols/evm/maple/index.js +9 -1
- package/dist/protocols/evm/maple/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +56 -0
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +28 -1
- package/dist/protocols/evm/morpho/index.js +56 -1
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs +98 -26
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.js +99 -27
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/package.json +6 -1
|
@@ -397,10 +397,14 @@ async function gmxFormatPositionsForDisplay(chainId, positions) {
|
|
|
397
397
|
}
|
|
398
398
|
const source = enriched ?? raw;
|
|
399
399
|
const collateralToken = source.collateralToken;
|
|
400
|
+
const isLong = Boolean(source.isLong ?? raw.isLong);
|
|
401
|
+
const symbol = marketInfo ? String(marketInfo.name ?? marketInfo.symbol ?? "").trim() || null : null;
|
|
400
402
|
return {
|
|
401
403
|
key: String(raw.key ?? raw.contractKey ?? `${marketAddress}-${i}`),
|
|
404
|
+
symbol,
|
|
402
405
|
indexName: pickIndexName(raw, enriched),
|
|
403
|
-
isLong
|
|
406
|
+
isLong,
|
|
407
|
+
direction: isLong ? "long" : "short",
|
|
404
408
|
sizeUsd: formatGmxUsd30(asBigint(source.sizeInUsd ?? raw.sizeInUsd)),
|
|
405
409
|
collateralUsd: formatGmxUsd30(asBigint(source.collateralUsd ?? raw.collateralUsd)),
|
|
406
410
|
collateralSymbol: collateralToken?.symbol ? String(collateralToken.symbol) : null,
|
|
@@ -437,20 +441,33 @@ function gmxContractAddress(chainId, name) {
|
|
|
437
441
|
}
|
|
438
442
|
|
|
439
443
|
// src/protocols/evm/gmx/reads.ts
|
|
440
|
-
async function
|
|
444
|
+
async function gmxFetchRawPositionsForExecutor(args) {
|
|
441
445
|
const sdk = getGmxApiSdk(args.chainId);
|
|
442
446
|
const positions = await sdk.fetchPositionsInfo({
|
|
443
447
|
address: args.executorAddress,
|
|
444
448
|
includeRelatedOrders: true
|
|
445
449
|
});
|
|
446
|
-
return
|
|
447
|
-
positions
|
|
448
|
-
};
|
|
450
|
+
return positions;
|
|
449
451
|
}
|
|
450
452
|
async function gmxFetchPositionDisplayRows(args) {
|
|
451
|
-
const
|
|
453
|
+
const positions = await gmxFetchRawPositionsForExecutor(args);
|
|
452
454
|
return gmxFormatPositionsForDisplay(args.chainId, positions);
|
|
453
455
|
}
|
|
456
|
+
async function gmxFetchPositionsForExecutor(args) {
|
|
457
|
+
const positions = await gmxFetchPositionDisplayRows(args);
|
|
458
|
+
return { positions };
|
|
459
|
+
}
|
|
460
|
+
async function gmxFetchOrdersSummary(args) {
|
|
461
|
+
const orders = await gmxFetchOrdersForExecutor(args);
|
|
462
|
+
return {
|
|
463
|
+
orders: orders.map((o) => ({
|
|
464
|
+
orderId: String(o.key ?? "").trim(),
|
|
465
|
+
isLong: o.isLong,
|
|
466
|
+
sizeDeltaUsd: o.sizeDeltaUsd != null ? String(o.sizeDeltaUsd) : null,
|
|
467
|
+
triggerPrice: o.triggerPrice != null ? String(o.triggerPrice) : null
|
|
468
|
+
}))
|
|
469
|
+
};
|
|
470
|
+
}
|
|
454
471
|
async function gmxFetchOrdersForExecutor(args) {
|
|
455
472
|
const sdk = getGmxApiSdk(args.chainId);
|
|
456
473
|
return sdk.fetchOrders({ address: args.executorAddress });
|
|
@@ -1465,7 +1482,8 @@ var GMX_WETH_DEPOSIT_FALLBACK2 = 120000n;
|
|
|
1465
1482
|
var GMX_ERC20_APPROVE_FALLBACK2 = 100000n;
|
|
1466
1483
|
var wethDepositAbi2 = viem.parseAbi(["function deposit() payable"]);
|
|
1467
1484
|
var erc20AllowanceAbi2 = viem.parseAbi([
|
|
1468
|
-
"function allowance(address owner, address spender) view returns (uint256)"
|
|
1485
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
|
1486
|
+
"function decimals() view returns (uint8)"
|
|
1469
1487
|
]);
|
|
1470
1488
|
var erc20ApproveAbi2 = viem.parseAbi(["function approve(address spender, uint256 amount) returns (bool)"]);
|
|
1471
1489
|
async function buildApproveStepsIfNeeded(args) {
|
|
@@ -1687,7 +1705,22 @@ async function buildEvmMultisignBodyGmxGmWithdrawBatch(args) {
|
|
|
1687
1705
|
const executor = viem.getAddress(args.executorAddress);
|
|
1688
1706
|
const market = await gmxResolveMarketBySymbol(args.chainId, args.marketSymbol);
|
|
1689
1707
|
const gmToken = viem.getAddress(market.marketTokenAddress);
|
|
1690
|
-
|
|
1708
|
+
let gmDecimals = args.gmDecimals;
|
|
1709
|
+
if (gmDecimals == null) {
|
|
1710
|
+
const ch = viem.defineChain({
|
|
1711
|
+
id: args.chainId,
|
|
1712
|
+
name: "GMX",
|
|
1713
|
+
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1714
|
+
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
1715
|
+
});
|
|
1716
|
+
const publicClient = viem.createPublicClient({ chain: ch, transport: viem.http(args.rpcUrl) });
|
|
1717
|
+
const onChain = await publicClient.readContract({
|
|
1718
|
+
address: gmToken,
|
|
1719
|
+
abi: erc20AllowanceAbi2,
|
|
1720
|
+
functionName: "decimals"
|
|
1721
|
+
});
|
|
1722
|
+
gmDecimals = Number(onChain);
|
|
1723
|
+
}
|
|
1691
1724
|
const gmAmountWei = parseGmxTokenAmount(args.gmAmountHuman, gmDecimals);
|
|
1692
1725
|
if (gmAmountWei === 0n) throw new Error("GM amount is zero after converting with token decimals.");
|
|
1693
1726
|
const exchangeRouter = gmxContractAddress(args.chainId, "ExchangeRouter");
|
|
@@ -2218,6 +2251,7 @@ exports.gmxFetchMarkets = gmxFetchMarkets;
|
|
|
2218
2251
|
exports.gmxFetchMarketsSummary = gmxFetchMarketsSummary;
|
|
2219
2252
|
exports.gmxFetchOhlcv = gmxFetchOhlcv;
|
|
2220
2253
|
exports.gmxFetchOrdersForExecutor = gmxFetchOrdersForExecutor;
|
|
2254
|
+
exports.gmxFetchOrdersSummary = gmxFetchOrdersSummary;
|
|
2221
2255
|
exports.gmxFetchPositionDisplayRows = gmxFetchPositionDisplayRows;
|
|
2222
2256
|
exports.gmxFetchPositionsForExecutor = gmxFetchPositionsForExecutor;
|
|
2223
2257
|
exports.gmxFetchStakingPower = gmxFetchStakingPower;
|