@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.
Files changed (91) hide show
  1. package/dist/agent/catalog.cjs +12 -1
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.js +12 -1
  4. package/dist/agent/catalog.js.map +1 -1
  5. package/dist/chains/evm/index.cjs +6 -2
  6. package/dist/chains/evm/index.cjs.map +1 -1
  7. package/dist/chains/evm/index.js +7 -3
  8. package/dist/chains/evm/index.js.map +1 -1
  9. package/dist/core/index.cjs +14 -0
  10. package/dist/core/index.cjs.map +1 -1
  11. package/dist/core/index.d.ts +7 -2
  12. package/dist/core/index.js +13 -2
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/index.cjs +45 -6
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +44 -8
  18. package/dist/index.js.map +1 -1
  19. package/dist/protocols/evm/aave-v4/index.cjs +11 -7
  20. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  21. package/dist/protocols/evm/aave-v4/index.js +12 -8
  22. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  23. package/dist/protocols/evm/aerodrome/index.cjs +14 -2
  24. package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
  25. package/dist/protocols/evm/aerodrome/index.js +14 -2
  26. package/dist/protocols/evm/aerodrome/index.js.map +1 -1
  27. package/dist/protocols/evm/arcus/index.cjs +6 -2
  28. package/dist/protocols/evm/arcus/index.cjs.map +1 -1
  29. package/dist/protocols/evm/arcus/index.js +7 -3
  30. package/dist/protocols/evm/arcus/index.js.map +1 -1
  31. package/dist/protocols/evm/circle-cctp/index.cjs +7 -3
  32. package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
  33. package/dist/protocols/evm/circle-cctp/index.js +8 -4
  34. package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
  35. package/dist/protocols/evm/compound-v3/index.cjs +9 -3
  36. package/dist/protocols/evm/compound-v3/index.cjs.map +1 -1
  37. package/dist/protocols/evm/compound-v3/index.js +10 -4
  38. package/dist/protocols/evm/compound-v3/index.js.map +1 -1
  39. package/dist/protocols/evm/continuum-dao/index.cjs +11 -5
  40. package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -1
  41. package/dist/protocols/evm/continuum-dao/index.js +12 -6
  42. package/dist/protocols/evm/continuum-dao/index.js.map +1 -1
  43. package/dist/protocols/evm/curve-dao/index.cjs +8 -4
  44. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  45. package/dist/protocols/evm/curve-dao/index.js +9 -5
  46. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  47. package/dist/protocols/evm/ethena/index.cjs +13 -9
  48. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  49. package/dist/protocols/evm/ethena/index.js +14 -10
  50. package/dist/protocols/evm/ethena/index.js.map +1 -1
  51. package/dist/protocols/evm/euler-v2/index.cjs +20 -16
  52. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  53. package/dist/protocols/evm/euler-v2/index.js +21 -17
  54. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  55. package/dist/protocols/evm/gmx/index.cjs +12 -8
  56. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  57. package/dist/protocols/evm/gmx/index.js +13 -9
  58. package/dist/protocols/evm/gmx/index.js.map +1 -1
  59. package/dist/protocols/evm/hyperliquid/index.cjs +5 -1
  60. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  61. package/dist/protocols/evm/hyperliquid/index.js +6 -2
  62. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  63. package/dist/protocols/evm/lido/index.cjs +7 -3
  64. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  65. package/dist/protocols/evm/lido/index.js +8 -4
  66. package/dist/protocols/evm/lido/index.js.map +1 -1
  67. package/dist/protocols/evm/maple/index.cjs +7 -3
  68. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  69. package/dist/protocols/evm/maple/index.js +8 -4
  70. package/dist/protocols/evm/maple/index.js.map +1 -1
  71. package/dist/protocols/evm/morpho/index.cjs +13 -9
  72. package/dist/protocols/evm/morpho/index.cjs.map +1 -1
  73. package/dist/protocols/evm/morpho/index.js +14 -10
  74. package/dist/protocols/evm/morpho/index.js.map +1 -1
  75. package/dist/protocols/evm/pendle/index.cjs +9 -3
  76. package/dist/protocols/evm/pendle/index.cjs.map +1 -1
  77. package/dist/protocols/evm/pendle/index.js +10 -4
  78. package/dist/protocols/evm/pendle/index.js.map +1 -1
  79. package/dist/protocols/evm/sky/index.cjs +17 -13
  80. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  81. package/dist/protocols/evm/sky/index.js +18 -14
  82. package/dist/protocols/evm/sky/index.js.map +1 -1
  83. package/dist/protocols/evm/uniswap-v4/index.cjs +13 -7
  84. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  85. package/dist/protocols/evm/uniswap-v4/index.js +14 -8
  86. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  87. package/dist/protocols/evm/venice/index.cjs +10 -4
  88. package/dist/protocols/evm/venice/index.cjs.map +1 -1
  89. package/dist/protocols/evm/venice/index.js +10 -4
  90. package/dist/protocols/evm/venice/index.js.map +1 -1
  91. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { parseAbi, keccak256, toBytes, isAddress, getAddress, encodeAbiParameters, parseUnits, encodeFunctionData, zeroAddress, maxUint256, defineChain, createPublicClient, http, formatUnits, parseGwei, serializeTransaction, decodeAbiParameters } from 'viem';
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: http(rpcUrl) });
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: http(rpcUrl) });
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: http(rpcUrl) });
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: http(args.rpcUrl) });
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: http(args.rpcUrl) });
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: http(args.rpcUrl) });
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: http(args.rpcUrl) });
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: http(args.rpcUrl) });
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: http(args.rpcUrl) });
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,