@continuumdao/ctm-mpc-defi 0.2.41 → 0.2.43
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 +219 -27
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +914 -197
- package/dist/agent/catalog.js +214 -28
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aerodrome/SKILL.md +1 -1
- package/dist/agent/skills/arcus/SKILL.md +1 -1
- package/dist/agent/skills/morpho/SKILL.md +32 -5
- package/dist/agent/skills/yield-compare/SKILL.md +6 -2
- package/dist/chains/evm/index.cjs +6 -2
- package/dist/chains/evm/index.cjs.map +1 -1
- package/dist/chains/evm/index.js +7 -3
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/core/index.cjs +14 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +7 -2
- package/dist/core/index.js +13 -2
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +45 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +44 -8
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs +11 -7
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/aave-v4/index.js +12 -8
- package/dist/protocols/evm/aave-v4/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +81 -50
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +8 -8
- package/dist/protocols/evm/aerodrome/index.js +96 -65
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/arcus/index.cjs +6 -2
- package/dist/protocols/evm/arcus/index.cjs.map +1 -1
- package/dist/protocols/evm/arcus/index.js +7 -3
- package/dist/protocols/evm/arcus/index.js.map +1 -1
- package/dist/protocols/evm/circle-cctp/index.cjs +7 -3
- package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
- package/dist/protocols/evm/circle-cctp/index.js +8 -4
- package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
- package/dist/protocols/evm/compound-v3/index.cjs +9 -3
- package/dist/protocols/evm/compound-v3/index.cjs.map +1 -1
- package/dist/protocols/evm/compound-v3/index.js +10 -4
- package/dist/protocols/evm/compound-v3/index.js.map +1 -1
- package/dist/protocols/evm/continuum-dao/index.cjs +11 -5
- package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/continuum-dao/index.js +12 -6
- package/dist/protocols/evm/continuum-dao/index.js.map +1 -1
- package/dist/protocols/evm/curve-dao/index.cjs +8 -4
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/curve-dao/index.js +9 -5
- package/dist/protocols/evm/curve-dao/index.js.map +1 -1
- package/dist/protocols/evm/ethena/index.cjs +13 -9
- package/dist/protocols/evm/ethena/index.cjs.map +1 -1
- package/dist/protocols/evm/ethena/index.js +14 -10
- package/dist/protocols/evm/ethena/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +20 -16
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.js +21 -17
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +12 -8
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.js +13 -9
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.cjs +5 -1
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.js +6 -2
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/lido/index.cjs +7 -3
- package/dist/protocols/evm/lido/index.cjs.map +1 -1
- package/dist/protocols/evm/lido/index.js +8 -4
- package/dist/protocols/evm/lido/index.js.map +1 -1
- package/dist/protocols/evm/maple/index.cjs +7 -3
- package/dist/protocols/evm/maple/index.cjs.map +1 -1
- package/dist/protocols/evm/maple/index.js +8 -4
- package/dist/protocols/evm/maple/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +454 -64
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +123 -2
- package/dist/protocols/evm/morpho/index.js +432 -66
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/dist/protocols/evm/pendle/index.cjs +9 -3
- package/dist/protocols/evm/pendle/index.cjs.map +1 -1
- package/dist/protocols/evm/pendle/index.js +10 -4
- package/dist/protocols/evm/pendle/index.js.map +1 -1
- package/dist/protocols/evm/sky/index.cjs +17 -13
- package/dist/protocols/evm/sky/index.cjs.map +1 -1
- package/dist/protocols/evm/sky/index.js +18 -14
- package/dist/protocols/evm/sky/index.js.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs +13 -7
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.js +14 -8
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/dist/protocols/evm/venice/index.cjs +10 -4
- package/dist/protocols/evm/venice/index.cjs.map +1 -1
- package/dist/protocols/evm/venice/index.js +10 -4
- package/dist/protocols/evm/venice/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseAbi, parseAbiParameters, parseAbiItem, getAddress, createPublicClient,
|
|
1
|
+
import { parseAbi, parseAbiParameters, parseAbiItem, getAddress, createPublicClient, defineChain, zeroAddress, formatUnits, parseUnits, encodeFunctionData, keccak256, encodeAbiParameters, decodeEventLog, http, decodeFunctionData, parseGwei, serializeTransaction, erc20Abi, hashTypedData, stringToHex } 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
|
|
@@ -260,6 +260,12 @@ var UNISWAP_V4_LP_WETH_DEPOSIT_FALLBACK = 120000n;
|
|
|
260
260
|
var UNISWAP_V4_LP_PERMIT2_APPROVE_FALLBACK = 100000n;
|
|
261
261
|
var UNISWAP_V4_PERMISSION_FLAG_SWAP = 1;
|
|
262
262
|
var UNISWAP_V4_PERMISSION_FLAG_LIQUIDITY = 2;
|
|
263
|
+
function defiEvmTransport(rpcUrl, opts) {
|
|
264
|
+
const url = rpcUrl.trim();
|
|
265
|
+
return http(url, opts);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// src/protocols/evm/uniswap-v4/permissions.ts
|
|
263
269
|
var permissionsAdapterAbi = parseAbi([
|
|
264
270
|
"function isAllowed(address account, uint8 permission) view returns (bool)",
|
|
265
271
|
"function PERMISSIONED_TOKEN() view returns (address)"
|
|
@@ -413,7 +419,7 @@ async function readUniswapV4OnChainPermissionFlags(args) {
|
|
|
413
419
|
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
414
420
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
415
421
|
}),
|
|
416
|
-
transport:
|
|
422
|
+
transport: defiEvmTransport(args.rpcUrl)
|
|
417
423
|
});
|
|
418
424
|
const wallet = getAddress(args.walletAddress);
|
|
419
425
|
const out = [];
|
|
@@ -1048,7 +1054,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
1048
1054
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1049
1055
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
1050
1056
|
});
|
|
1051
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
1057
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
1052
1058
|
const feeParams = await fetchChainFeeParams(rpcUrl, chainId);
|
|
1053
1059
|
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
1054
1060
|
const latestBaseFeeWei = !legacy ? (await publicClient.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
@@ -1683,7 +1689,7 @@ async function buildEvmMultisignBodyUniswapV4SkipPermit2Batch(args) {
|
|
|
1683
1689
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1684
1690
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
1685
1691
|
}),
|
|
1686
|
-
transport:
|
|
1692
|
+
transport: defiEvmTransport(args.rpcUrl)
|
|
1687
1693
|
});
|
|
1688
1694
|
const erc20ApproveSteps = await buildConditionalErc20ApproveSteps({
|
|
1689
1695
|
publicClient,
|
|
@@ -2538,7 +2544,7 @@ async function resolveUniswapV4PositionScanFromDate(args) {
|
|
|
2538
2544
|
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
2539
2545
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
2540
2546
|
});
|
|
2541
|
-
const client = createPublicClient({ chain, transport:
|
|
2547
|
+
const client = createPublicClient({ chain, transport: defiEvmTransport(args.rpcUrl) });
|
|
2542
2548
|
const latest = await client.getBlockNumber();
|
|
2543
2549
|
const deploy = getUniswapV4PositionManagerDeployBlock(args.chainId) ?? 0n;
|
|
2544
2550
|
const resolved = await resolveBlockAtOrAfterUnixTime(client, unixTime, {
|
|
@@ -2565,7 +2571,7 @@ async function listUniswapV4PositionsForWallet(args) {
|
|
|
2565
2571
|
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
2566
2572
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
2567
2573
|
});
|
|
2568
|
-
const client = createPublicClient({ chain, transport:
|
|
2574
|
+
const client = createPublicClient({ chain, transport: defiEvmTransport(args.rpcUrl) });
|
|
2569
2575
|
const latest = await client.getBlockNumber();
|
|
2570
2576
|
const maxScan = args.maxBlocksToScan ?? 500000n;
|
|
2571
2577
|
const chunkSize = args.chunkSize ?? UNISWAP_V4_LP_LOG_CHUNK_SIZE_DEFAULT;
|
|
@@ -2653,7 +2659,7 @@ async function readUniswapV4PositionInfoRaw(args) {
|
|
|
2653
2659
|
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
2654
2660
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
2655
2661
|
});
|
|
2656
|
-
const client = createPublicClient({ chain, transport:
|
|
2662
|
+
const client = createPublicClient({ chain, transport: defiEvmTransport(args.rpcUrl) });
|
|
2657
2663
|
const info = await client.readContract({
|
|
2658
2664
|
address: pm,
|
|
2659
2665
|
abi: positionInfoAbi,
|
|
@@ -2843,7 +2849,7 @@ async function buildEvmMultisignBodyUniswapV4LiquidityBatchInternal(args) {
|
|
|
2843
2849
|
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
2844
2850
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
2845
2851
|
});
|
|
2846
|
-
const publicClient = createPublicClient({ chain, transport:
|
|
2852
|
+
const publicClient = createPublicClient({ chain, transport: defiEvmTransport(args.rpcUrl) });
|
|
2847
2853
|
const needsTokenApproves = args.action === "mint" || args.action === "increase";
|
|
2848
2854
|
const approveTargets = needsTokenApproves ? await resolveApproveTargets({
|
|
2849
2855
|
publicClient,
|