@continuumdao/ctm-mpc-defi 0.2.39 → 0.2.41
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 +50 -10
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.js +50 -10
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aave-v4/SKILL.md +1 -1
- package/dist/agent/skills/circle-cctp/SKILL.md +1 -0
- package/dist/agent/skills/gmx/SKILL.md +4 -4
- package/dist/agent/skills/morpho/SKILL.md +11 -0
- package/dist/agent/skills/uniswap-v4/SKILL.md +1 -1
- package/dist/chains/evm/index.cjs +1 -0
- package/dist/chains/evm/index.cjs.map +1 -1
- package/dist/chains/evm/index.js +1 -0
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/circle-cctp/index.cjs +16 -0
- package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
- package/dist/protocols/evm/circle-cctp/index.js +16 -0
- package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +1 -0
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.js +1 -0
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +17 -7
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.d.ts +7 -1
- package/dist/protocols/evm/gmx/index.js +17 -7
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +21 -2
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +12 -1
- package/dist/protocols/evm/morpho/index.js +17 -3
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/dist/protocols/evm/permit2/index.cjs.map +1 -1
- package/dist/protocols/evm/permit2/index.js.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs +6 -2
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.js +6 -2
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,10 +7,15 @@ declare const GMX_SUPPORTED_CHAIN_IDS: readonly [42161, 43114];
|
|
|
7
7
|
type GmxSupportedChainId = (typeof GMX_SUPPORTED_CHAIN_IDS)[number];
|
|
8
8
|
declare function isGmxChainSupported(chainId: number): chainId is GmxSupportedChainId;
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* GMX API hosts for SDK v2. `@gmx-io/sdk` 1.8+ returns the origin only
|
|
12
|
+
* (`https://{chain}.gmxapi.io`); request paths already include `/v1`.
|
|
13
|
+
* The published SDK ships empty fallbacks, so we add the documented `.ai` peer.
|
|
14
|
+
*/
|
|
11
15
|
declare function gmxResolvedApiBaseUrls(chainId: number): readonly string[];
|
|
12
16
|
type GmxApiSdkInstance = {
|
|
13
17
|
fetchMarkets: () => Promise<GmxMarketRow[]>;
|
|
18
|
+
fetchMarketsInfo: () => Promise<unknown[]>;
|
|
14
19
|
fetchMarketsTickers: (args?: {
|
|
15
20
|
symbols?: string[];
|
|
16
21
|
}) => Promise<unknown[]>;
|
|
@@ -322,6 +327,7 @@ type GmxUnstakeGmxArgs = GmxStakeMultisignCommon & {
|
|
|
322
327
|
declare function buildEvmMultisignBodyGmxStakeGmxBatch(args: GmxStakeGmxArgs): Promise<MultisignBuildResult>;
|
|
323
328
|
declare function buildEvmMultisignBodyGmxUnstakeGmxBatch(args: GmxUnstakeGmxArgs): Promise<MultisignBuildResult>;
|
|
324
329
|
|
|
330
|
+
/** v2.2c synthetics addresses from `@gmx-io/sdk`. Token approvals use `SyntheticsRouter`. */
|
|
325
331
|
declare function gmxContractAddress(chainId: number, name: string): Address;
|
|
326
332
|
|
|
327
333
|
declare function gmxEstimateGmExecutionFee(args: {
|
|
@@ -28,7 +28,14 @@ function gmxResolvedApiBaseUrls(chainId) {
|
|
|
28
28
|
if (!primary) {
|
|
29
29
|
throw new Error(`GMX API URLs are not configured for chain ${chainId}.`);
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
const urls = [primary, ...getApiFallbackUrls(chainId)].map((url) => url.replace(/\/$/, ""));
|
|
32
|
+
const peer = gmxApiPeerFallback(urls[0]);
|
|
33
|
+
if (peer && !urls.includes(peer)) urls.push(peer);
|
|
34
|
+
return urls;
|
|
35
|
+
}
|
|
36
|
+
function gmxApiPeerFallback(primary) {
|
|
37
|
+
if (primary.includes(".gmxapi.io")) return primary.replace(".gmxapi.io", ".gmxapi.ai");
|
|
38
|
+
return void 0;
|
|
32
39
|
}
|
|
33
40
|
function buildGmxUrl(baseUrl, path, query) {
|
|
34
41
|
const base = baseUrl.replace(/\/$/, "");
|
|
@@ -489,6 +496,7 @@ var require5 = createRequire(fileURLToPath(import.meta.url));
|
|
|
489
496
|
var { getMaxAllowedLeverage } = require5("@gmx-io/sdk/utils/markets");
|
|
490
497
|
function gmxMarketMaxLeverageBps(marketInfo) {
|
|
491
498
|
return getMaxAllowedLeverage({
|
|
499
|
+
marketAddress: marketInfo.marketTokenAddress,
|
|
492
500
|
minCollateralFactor: marketInfo.minCollateralFactor,
|
|
493
501
|
minCollateralFactorForLiquidation: marketInfo.minCollateralFactorForLiquidation,
|
|
494
502
|
positionFeeFactorForBalanceWasNotImproved: marketInfo.positionFeeFactorForBalanceWasNotImproved
|
|
@@ -1632,7 +1640,7 @@ async function buildApproveStepsIfNeeded(args) {
|
|
|
1632
1640
|
}
|
|
1633
1641
|
async function buildNativeWrapPrepSteps(args) {
|
|
1634
1642
|
const weth = getAddress(args.nativeWrapped);
|
|
1635
|
-
const router = getAddress(args.
|
|
1643
|
+
const router = getAddress(args.tokenRouter);
|
|
1636
1644
|
const steps = [];
|
|
1637
1645
|
steps.push({
|
|
1638
1646
|
to: weth,
|
|
@@ -1724,6 +1732,7 @@ async function buildEvmMultisignBodyGmxGmDepositBatch(args) {
|
|
|
1724
1732
|
throw new Error("Collateral token is not a pool token for the selected GM market.");
|
|
1725
1733
|
}
|
|
1726
1734
|
const exchangeRouter = gmxContractAddress(args.chainId, "ExchangeRouter");
|
|
1735
|
+
const tokenRouter = gmxContractAddress(args.chainId, "SyntheticsRouter");
|
|
1727
1736
|
const depositVault = gmxContractAddress(args.chainId, "DepositVault");
|
|
1728
1737
|
const executionFee = await gmxEstimateGmExecutionFee({
|
|
1729
1738
|
chainId: args.chainId,
|
|
@@ -1739,7 +1748,7 @@ async function buildEvmMultisignBodyGmxGmDepositBatch(args) {
|
|
|
1739
1748
|
rpcUrl: args.rpcUrl,
|
|
1740
1749
|
executorAddress: executor,
|
|
1741
1750
|
nativeWrapped: args.nativeWrapped,
|
|
1742
|
-
|
|
1751
|
+
tokenRouter,
|
|
1743
1752
|
amountWei
|
|
1744
1753
|
})
|
|
1745
1754
|
);
|
|
@@ -1750,7 +1759,7 @@ async function buildEvmMultisignBodyGmxGmDepositBatch(args) {
|
|
|
1750
1759
|
rpcUrl: args.rpcUrl,
|
|
1751
1760
|
executorAddress: executor,
|
|
1752
1761
|
token: collateralAddr,
|
|
1753
|
-
spender:
|
|
1762
|
+
spender: tokenRouter,
|
|
1754
1763
|
amountWei
|
|
1755
1764
|
})
|
|
1756
1765
|
);
|
|
@@ -1836,6 +1845,7 @@ async function buildEvmMultisignBodyGmxGmWithdrawBatch(args) {
|
|
|
1836
1845
|
const gmAmountWei = parseGmxTokenAmount(args.gmAmountHuman, gmDecimals);
|
|
1837
1846
|
if (gmAmountWei === 0n) throw new Error("GM amount is zero after converting with token decimals.");
|
|
1838
1847
|
const exchangeRouter = gmxContractAddress(args.chainId, "ExchangeRouter");
|
|
1848
|
+
const tokenRouter = gmxContractAddress(args.chainId, "SyntheticsRouter");
|
|
1839
1849
|
const withdrawalVault = gmxContractAddress(args.chainId, "WithdrawalVault");
|
|
1840
1850
|
const executionFee = await gmxEstimateGmExecutionFee({
|
|
1841
1851
|
chainId: args.chainId,
|
|
@@ -1848,7 +1858,7 @@ async function buildEvmMultisignBodyGmxGmWithdrawBatch(args) {
|
|
|
1848
1858
|
rpcUrl: args.rpcUrl,
|
|
1849
1859
|
executorAddress: executor,
|
|
1850
1860
|
token: gmToken,
|
|
1851
|
-
spender:
|
|
1861
|
+
spender: tokenRouter,
|
|
1852
1862
|
amountWei: gmAmountWei
|
|
1853
1863
|
});
|
|
1854
1864
|
const multicallData = [
|
|
@@ -2311,7 +2321,7 @@ var gmxProtocolModule = {
|
|
|
2311
2321
|
id: "gmx.gmDeposit",
|
|
2312
2322
|
protocolId: GMX_PROTOCOL_ID,
|
|
2313
2323
|
chainCategory: "evm",
|
|
2314
|
-
description: "Deposit collateral into a GMX GM liquidity pool (ExchangeRouter multicall)",
|
|
2324
|
+
description: "Deposit collateral into a GMX v2.2c GM liquidity pool (ExchangeRouter multicall)",
|
|
2315
2325
|
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2316
2326
|
params: {
|
|
2317
2327
|
marketSymbol: { type: "string", required: true, description: "GM market symbol e.g. ETH/USD [WETH-USDC]" },
|
|
@@ -2323,7 +2333,7 @@ var gmxProtocolModule = {
|
|
|
2323
2333
|
id: "gmx.gmWithdraw",
|
|
2324
2334
|
protocolId: GMX_PROTOCOL_ID,
|
|
2325
2335
|
chainCategory: "evm",
|
|
2326
|
-
description: "Withdraw GM market tokens from a GMX liquidity pool",
|
|
2336
|
+
description: "Withdraw GM market tokens from a GMX v2.2c liquidity pool",
|
|
2327
2337
|
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2328
2338
|
params: {
|
|
2329
2339
|
marketSymbol: { type: "string", required: true, description: "GM market symbol" },
|