@continuumdao/ctm-mpc-defi 0.2.41 → 0.2.42
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 +12 -1
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.js +12 -1
- package/dist/agent/catalog.js.map +1 -1
- 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 +14 -2
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.js +14 -2
- 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 +13 -9
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.js +14 -10
- 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, keccak256, toBytes, isAddress, getAddress, encodeAbiParameters, parseUnits, encodeFunctionData, zeroAddress, maxUint256, defineChain, createPublicClient,
|
|
1
|
+
import { parseAbi, keccak256, toBytes, isAddress, getAddress, encodeAbiParameters, parseUnits, encodeFunctionData, zeroAddress, maxUint256, defineChain, createPublicClient, formatUnits, parseGwei, serializeTransaction, decodeAbiParameters, http } from 'viem';
|
|
2
2
|
import { MidnightApi } from '@morpho-org/midnight-sdk/api';
|
|
3
3
|
import { DEFAULT_TICK_SPACING, TickLib, midnightBundlesAbi, Offer, Tree, SetterRatifierUtils, Payload, midnightAbi } from '@morpho-org/midnight-sdk';
|
|
4
4
|
import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
@@ -1982,6 +1982,10 @@ async function pickBestBlueSupplyMarketForLoan(args) {
|
|
|
1982
1982
|
}
|
|
1983
1983
|
return null;
|
|
1984
1984
|
}
|
|
1985
|
+
function defiEvmTransport(rpcUrl, opts) {
|
|
1986
|
+
const url = rpcUrl.trim();
|
|
1987
|
+
return http(url, opts);
|
|
1988
|
+
}
|
|
1985
1989
|
|
|
1986
1990
|
// src/core/purpose.ts
|
|
1987
1991
|
function mergePurposeText(purposeText, purposeSuffix) {
|
|
@@ -2073,7 +2077,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
2073
2077
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
2074
2078
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
2075
2079
|
});
|
|
2076
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
2080
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
2077
2081
|
const feeParams = await fetchChainFeeParams(rpcUrl, chainId);
|
|
2078
2082
|
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
2079
2083
|
const latestBaseFeeWei = !legacy ? (await publicClient.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
@@ -2233,7 +2237,7 @@ function publicClientFor(rpcUrl, chainId) {
|
|
|
2233
2237
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
2234
2238
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
2235
2239
|
});
|
|
2236
|
-
return createPublicClient({ chain: ch, transport:
|
|
2240
|
+
return createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
2237
2241
|
}
|
|
2238
2242
|
async function readTokenDecimals(args) {
|
|
2239
2243
|
const publicClient = publicClientFor(args.rpcUrl, args.chainId);
|
|
@@ -2719,7 +2723,7 @@ function publicClientFor2(rpcUrl, chainId) {
|
|
|
2719
2723
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
2720
2724
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
2721
2725
|
});
|
|
2722
|
-
return createPublicClient({ chain: ch, transport:
|
|
2726
|
+
return createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
2723
2727
|
}
|
|
2724
2728
|
async function readTokenDecimals2(args) {
|
|
2725
2729
|
const publicClient = publicClientFor2(args.rpcUrl, args.chainId);
|
|
@@ -3145,7 +3149,7 @@ async function fetchMorphoVaultAssetDecimals(args) {
|
|
|
3145
3149
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3146
3150
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
3147
3151
|
});
|
|
3148
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
3152
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
3149
3153
|
const vault = getAddress(args.vault);
|
|
3150
3154
|
const assetAddr = await publicClient.readContract({
|
|
3151
3155
|
address: vault,
|
|
@@ -3167,7 +3171,7 @@ async function fetchMorphoVaultMaxWithdrawWei(args) {
|
|
|
3167
3171
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3168
3172
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
3169
3173
|
});
|
|
3170
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
3174
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
3171
3175
|
return publicClient.readContract({
|
|
3172
3176
|
address: getAddress(args.vault),
|
|
3173
3177
|
abi: erc4626Abi,
|
|
@@ -3190,7 +3194,7 @@ async function previewMorphoBlueHealthAfterCollateralWithdraw(args) {
|
|
|
3190
3194
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3191
3195
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
3192
3196
|
});
|
|
3193
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
3197
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
3194
3198
|
const morpho = getAddress(args.morphoBlue);
|
|
3195
3199
|
const user = getAddress(args.user);
|
|
3196
3200
|
const id = args.marketId;
|
|
@@ -3259,7 +3263,7 @@ async function buildEvmMultisignBodyMorphoVaultDepositBatch(args) {
|
|
|
3259
3263
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3260
3264
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
3261
3265
|
});
|
|
3262
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
3266
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
3263
3267
|
const dec = await fetchMorphoVaultAssetDecimals({ rpcUrl: args.rpcUrl, chainId: args.chainId, vault });
|
|
3264
3268
|
const amountWei = parseUnits(args.amountHuman, dec);
|
|
3265
3269
|
if (amountWei === 0n) throw new Error("Deposit amount is zero after converting with token decimals.");
|
|
@@ -3445,7 +3449,7 @@ async function readTokenDecimals3(args) {
|
|
|
3445
3449
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3446
3450
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
3447
3451
|
});
|
|
3448
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
3452
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
3449
3453
|
const d = await publicClient.readContract({
|
|
3450
3454
|
address: args.token,
|
|
3451
3455
|
abi: erc20AllowanceAbi2,
|
|
@@ -3472,7 +3476,7 @@ async function buildApproveSteps3(args) {
|
|
|
3472
3476
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3473
3477
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
3474
3478
|
});
|
|
3475
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
3479
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
3476
3480
|
const currentAllowance = await publicClient.readContract({
|
|
3477
3481
|
address: spendToken,
|
|
3478
3482
|
abi: erc20AllowanceAbi2,
|