@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, getAddress, defineChain, createPublicClient,
|
|
1
|
+
import { parseAbi, getAddress, defineChain, createPublicClient, parseUnits, encodeFunctionData, zeroAddress, maxUint256, isAddress, formatUnits, http, parseGwei, serializeTransaction, keccak256 } from 'viem';
|
|
2
2
|
import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
3
3
|
|
|
4
4
|
// src/core/registry.ts
|
|
@@ -85,6 +85,10 @@ function eulerSameAssetApproveAmountWithBuffer(args) {
|
|
|
85
85
|
const extra = args.totalPullWei * EULER_SAME_ASSET_BORROW_APPROVAL_BUFFER_BPS / 10000n;
|
|
86
86
|
return args.totalPullWei + extra + 1n;
|
|
87
87
|
}
|
|
88
|
+
function defiEvmTransport(rpcUrl, opts) {
|
|
89
|
+
const url = rpcUrl.trim();
|
|
90
|
+
return http(url, opts);
|
|
91
|
+
}
|
|
88
92
|
|
|
89
93
|
// src/core/purpose.ts
|
|
90
94
|
function mergePurposeText(purposeText, purposeSuffix) {
|
|
@@ -176,7 +180,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
176
180
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
177
181
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
178
182
|
});
|
|
179
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
183
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
180
184
|
const feeParams = await fetchChainFeeParams(rpcUrl, chainId);
|
|
181
185
|
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
182
186
|
const latestBaseFeeWei = !legacy ? (await publicClient2.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
@@ -335,7 +339,7 @@ async function fetchEulerVaultUnderlyingMeta(args) {
|
|
|
335
339
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
336
340
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
337
341
|
});
|
|
338
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
342
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
339
343
|
const assetAddrRaw = await publicClient2.readContract({
|
|
340
344
|
address: args.evault,
|
|
341
345
|
abi: erc4626AssetAbi,
|
|
@@ -374,7 +378,7 @@ async function fetchEulerVaultMaxWithdrawWei(args) {
|
|
|
374
378
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
375
379
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
376
380
|
});
|
|
377
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
381
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
378
382
|
return publicClient2.readContract({
|
|
379
383
|
address: args.evault,
|
|
380
384
|
abi: erc4626MaxWithdrawAbi,
|
|
@@ -412,7 +416,7 @@ async function eulerLendEarnEffectiveMaxWeiBySimulation(args) {
|
|
|
412
416
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
413
417
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
414
418
|
});
|
|
415
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
419
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
416
420
|
let shareBal;
|
|
417
421
|
let vaultCash;
|
|
418
422
|
try {
|
|
@@ -616,7 +620,7 @@ async function collateralMaxWithdrawBySimulation(args) {
|
|
|
616
620
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
617
621
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
618
622
|
});
|
|
619
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
623
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
620
624
|
let shareBal;
|
|
621
625
|
let assetsOwned;
|
|
622
626
|
let vaultCash;
|
|
@@ -724,7 +728,7 @@ async function buildEvmMultisignBodyEulerV2IsolatedLendDepositBatch(args) {
|
|
|
724
728
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
725
729
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
726
730
|
});
|
|
727
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
731
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
728
732
|
typeof args._registryUnderlyingDecimals === "number" ? args._registryUnderlyingDecimals : void 0;
|
|
729
733
|
const onChainDec = await publicClient2.readContract({
|
|
730
734
|
address: asset,
|
|
@@ -921,7 +925,7 @@ async function buildEvmMultisignBodyEulerV2IsolatedBorrowBatch(args) {
|
|
|
921
925
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
922
926
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
923
927
|
});
|
|
924
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
928
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
925
929
|
const cDecRaw = await publicClient2.readContract({
|
|
926
930
|
address: collateralAsset,
|
|
927
931
|
abi: erc20AllowanceAbi2,
|
|
@@ -1173,7 +1177,7 @@ async function buildEvmMultisignBodyEulerV2BorrowRepayBatch(args) {
|
|
|
1173
1177
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1174
1178
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
1175
1179
|
});
|
|
1176
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
1180
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
1177
1181
|
const bDecRaw = await publicClient2.readContract({
|
|
1178
1182
|
address: borrowAsset,
|
|
1179
1183
|
abi: erc20AllowanceAbi3,
|
|
@@ -1327,7 +1331,7 @@ async function buildEvmMultisignBodyEulerV2BorrowCollateralDepositBatch(args) {
|
|
|
1327
1331
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1328
1332
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
1329
1333
|
});
|
|
1330
|
-
const publicClient2 = createPublicClient({ chain: ch, transport:
|
|
1334
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
1331
1335
|
const dec = await fetchEulerVaultAssetDecimals({
|
|
1332
1336
|
rpcUrl: args.rpcUrl,
|
|
1333
1337
|
chainId: args.chainId,
|
|
@@ -2009,7 +2013,7 @@ async function fetchEulerVaultOnChainLendMetrics(args) {
|
|
|
2009
2013
|
nativeCurrency: { decimals: 18, name: "x", symbol: "x" },
|
|
2010
2014
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
2011
2015
|
});
|
|
2012
|
-
const client = createPublicClient({ chain: ch, transport:
|
|
2016
|
+
const client = createPublicClient({ chain: ch, transport: defiEvmTransport(args.rpcUrl) });
|
|
2013
2017
|
const addr = getAddress(args.evault);
|
|
2014
2018
|
const [[supplyRaw, borrowRaw], cashWei, totalBorrowsWei, totalAssetsWei] = await Promise.all([
|
|
2015
2019
|
client.readContract({
|
|
@@ -2121,7 +2125,7 @@ function eulerMetaPublicClient(chainId, rpcUrl) {
|
|
|
2121
2125
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
2122
2126
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
2123
2127
|
});
|
|
2124
|
-
return createPublicClient({ chain, transport:
|
|
2128
|
+
return createPublicClient({ chain, transport: defiEvmTransport(rpcUrl) });
|
|
2125
2129
|
}
|
|
2126
2130
|
async function readErc20StringMeta(client, addrLower) {
|
|
2127
2131
|
try {
|
|
@@ -2873,7 +2877,7 @@ function metaClient(chainId, rpcUrl) {
|
|
|
2873
2877
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
2874
2878
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
2875
2879
|
});
|
|
2876
|
-
return createPublicClient({ chain, transport:
|
|
2880
|
+
return createPublicClient({ chain, transport: defiEvmTransport(rpcUrl) });
|
|
2877
2881
|
}
|
|
2878
2882
|
async function fetchEulerV2BorrowPairLtvs(args) {
|
|
2879
2883
|
const rpc = (args.rpcUrl ?? "").trim();
|
|
@@ -2978,7 +2982,7 @@ function metaClient2(chainId, rpcUrl) {
|
|
|
2978
2982
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
2979
2983
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
2980
2984
|
});
|
|
2981
|
-
return createPublicClient({ chain, transport:
|
|
2985
|
+
return createPublicClient({ chain, transport: defiEvmTransport(rpcUrl) });
|
|
2982
2986
|
}
|
|
2983
2987
|
function parseEulerTrackingBorrowEntry(entry) {
|
|
2984
2988
|
const s = (entry ?? "").trim().toLowerCase();
|
|
@@ -3314,7 +3318,7 @@ function metaClient3(chainId, rpcUrl) {
|
|
|
3314
3318
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3315
3319
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
3316
3320
|
});
|
|
3317
|
-
return createPublicClient({ chain, transport:
|
|
3321
|
+
return createPublicClient({ chain, transport: defiEvmTransport(rpcUrl) });
|
|
3318
3322
|
}
|
|
3319
3323
|
async function readSupplyUnderlyingWei(client, vault, shareOwner) {
|
|
3320
3324
|
try {
|
|
@@ -3467,7 +3471,7 @@ async function fetchEulerReulVestingTranches(args) {
|
|
|
3467
3471
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
3468
3472
|
rpcUrls: { default: { http: [rpc] } }
|
|
3469
3473
|
});
|
|
3470
|
-
const client = createPublicClient({ chain: ch, transport:
|
|
3474
|
+
const client = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
3471
3475
|
const [timestamps, amounts] = await client.readContract({
|
|
3472
3476
|
address: reul,
|
|
3473
3477
|
abi: rewardTokenReadAbi,
|
|
@@ -3579,7 +3583,7 @@ function publicClient(chainId, rpcUrl) {
|
|
|
3579
3583
|
nativeCurrency: { decimals: 18, name: "x", symbol: "x" },
|
|
3580
3584
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
3581
3585
|
});
|
|
3582
|
-
return createPublicClient({ chain: ch, transport:
|
|
3586
|
+
return createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
3583
3587
|
}
|
|
3584
3588
|
async function gqlTrackingAccount(chainId, mainLower) {
|
|
3585
3589
|
if (!eulerV2GoldskyUrlForChain(chainId)) {
|