@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, defineChain, createPublicClient,
|
|
1
|
+
import { parseAbi, defineChain, createPublicClient, getAddress, parseUnits, encodeFunctionData, decodeFunctionData, formatUnits, parseGwei, serializeTransaction, keccak256, http } from 'viem';
|
|
2
2
|
import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
3
3
|
|
|
4
4
|
// src/core/registry.ts
|
|
@@ -24,6 +24,10 @@ var SKY_LOCKSTAKE_DEFAULT_FARM_REF = 1;
|
|
|
24
24
|
var SKY_LOCKSTAKE_UI_COLLATERAL_FACTOR = 0.65;
|
|
25
25
|
var SKY_TOKEN_DECIMALS = 18;
|
|
26
26
|
var USDS_DECIMALS = 18;
|
|
27
|
+
function defiEvmTransport(rpcUrl, opts) {
|
|
28
|
+
const url = rpcUrl.trim();
|
|
29
|
+
return http(url, opts);
|
|
30
|
+
}
|
|
27
31
|
|
|
28
32
|
// src/core/purpose.ts
|
|
29
33
|
function mergePurposeText(purposeText, purposeSuffix) {
|
|
@@ -115,7 +119,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
115
119
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
116
120
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
117
121
|
});
|
|
118
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
122
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
119
123
|
const feeParams = await fetchChainFeeParams(rpcUrl, chainId);
|
|
120
124
|
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
121
125
|
const latestBaseFeeWei = !legacy ? (await publicClient.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
@@ -323,7 +327,7 @@ async function buildSkyLockstakeStakePositionBatch(args) {
|
|
|
323
327
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
324
328
|
rpcUrls: { default: { http: [rpc] } }
|
|
325
329
|
});
|
|
326
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
330
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
327
331
|
const executor = getAddress(args.executorAddress);
|
|
328
332
|
const sky = getAddress(SKY_ETHEREUM_MAINNET);
|
|
329
333
|
const engine = getAddress(SKY_LOCKSTAKE_ENGINE_MAINNET);
|
|
@@ -569,7 +573,7 @@ async function buildSkyLockstakeDrawBatch(args) {
|
|
|
569
573
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
570
574
|
rpcUrls: { default: { http: [rpc] } }
|
|
571
575
|
});
|
|
572
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
576
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
573
577
|
const executor = getAddress(args.executorAddress);
|
|
574
578
|
const engine = getAddress(SKY_LOCKSTAKE_ENGINE_MAINNET);
|
|
575
579
|
const usds = getAddress(USDS_ETHEREUM_MAINNET);
|
|
@@ -634,7 +638,7 @@ async function buildSkyLockstakeGetRewardBatch(args) {
|
|
|
634
638
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
635
639
|
rpcUrls: { default: { http: [rpc] } }
|
|
636
640
|
});
|
|
637
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
641
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
638
642
|
const executor = getAddress(args.executorAddress);
|
|
639
643
|
const engine = getAddress(SKY_LOCKSTAKE_ENGINE_MAINNET);
|
|
640
644
|
const farm = getAddress(args.farmAddress);
|
|
@@ -711,7 +715,7 @@ async function buildSkyLockstakeWipeBatch(args) {
|
|
|
711
715
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
712
716
|
rpcUrls: { default: { http: [rpc] } }
|
|
713
717
|
});
|
|
714
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
718
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
715
719
|
const executor = getAddress(args.executorAddress);
|
|
716
720
|
const engine = getAddress(SKY_LOCKSTAKE_ENGINE_MAINNET);
|
|
717
721
|
const usds = getAddress(USDS_ETHEREUM_MAINNET);
|
|
@@ -865,7 +869,7 @@ async function buildSkyLockstakeCloseBatch(args) {
|
|
|
865
869
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
866
870
|
rpcUrls: { default: { http: [rpc] } }
|
|
867
871
|
});
|
|
868
|
-
createPublicClient({ chain: ch, transport:
|
|
872
|
+
createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
869
873
|
const executor = getAddress(args.executorAddress);
|
|
870
874
|
const engine = getAddress(SKY_LOCKSTAKE_ENGINE_MAINNET);
|
|
871
875
|
const usds = getAddress(USDS_ETHEREUM_MAINNET);
|
|
@@ -1024,7 +1028,7 @@ async function buildSkySusdsRedeemToUsdsBatch(args) {
|
|
|
1024
1028
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1025
1029
|
rpcUrls: { default: { http: [rpc] } }
|
|
1026
1030
|
});
|
|
1027
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
1031
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
1028
1032
|
const executor = getAddress(args.executorAddress);
|
|
1029
1033
|
const receiver = getAddress(args.receiver ?? executor);
|
|
1030
1034
|
const underlying = await publicClient.readContract({
|
|
@@ -1099,7 +1103,7 @@ async function buildSkySusdsDepositFromUsdsBatch(args) {
|
|
|
1099
1103
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1100
1104
|
rpcUrls: { default: { http: [rpc] } }
|
|
1101
1105
|
});
|
|
1102
|
-
const publicClient = createPublicClient({ chain: ch, transport:
|
|
1106
|
+
const publicClient = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
1103
1107
|
const executor = getAddress(args.executorAddress);
|
|
1104
1108
|
const underlying = await publicClient.readContract({
|
|
1105
1109
|
address: vault,
|
|
@@ -1229,7 +1233,7 @@ function skyClient(rpcUrl) {
|
|
|
1229
1233
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1230
1234
|
rpcUrls: { default: { http: [rpc] } }
|
|
1231
1235
|
});
|
|
1232
|
-
return createPublicClient({ chain: ch, transport:
|
|
1236
|
+
return createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
1233
1237
|
}
|
|
1234
1238
|
function skyUsdsDebtWeiFromUrnArt(art, rate) {
|
|
1235
1239
|
if (art === 0n || rate === 0n) return 0n;
|
|
@@ -1338,7 +1342,7 @@ async function readSusdsVaultShareBalanceWei(args) {
|
|
|
1338
1342
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1339
1343
|
rpcUrls: { default: { http: [rpc] } }
|
|
1340
1344
|
});
|
|
1341
|
-
const client = createPublicClient({ chain: ch, transport:
|
|
1345
|
+
const client = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
1342
1346
|
const vault = getAddress(SUSDS_VAULT_ERC4626_MAINNET);
|
|
1343
1347
|
return client.readContract({
|
|
1344
1348
|
address: vault,
|
|
@@ -1355,7 +1359,7 @@ async function readSusdsVaultDecimals(args) {
|
|
|
1355
1359
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1356
1360
|
rpcUrls: { default: { http: [rpc] } }
|
|
1357
1361
|
});
|
|
1358
|
-
const client = createPublicClient({ chain: ch, transport:
|
|
1362
|
+
const client = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
1359
1363
|
const vault = getAddress(SUSDS_VAULT_ERC4626_MAINNET);
|
|
1360
1364
|
const d = await client.readContract({
|
|
1361
1365
|
address: vault,
|
|
@@ -1373,7 +1377,7 @@ async function readSusdsPreviewRedeemAssetsWei(args) {
|
|
|
1373
1377
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1374
1378
|
rpcUrls: { default: { http: [rpc] } }
|
|
1375
1379
|
});
|
|
1376
|
-
const client = createPublicClient({ chain: ch, transport:
|
|
1380
|
+
const client = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
1377
1381
|
const vault = getAddress(SUSDS_VAULT_ERC4626_MAINNET);
|
|
1378
1382
|
return client.readContract({
|
|
1379
1383
|
address: vault,
|
|
@@ -1411,7 +1415,7 @@ async function skyFetchSusdsRateSummary(args) {
|
|
|
1411
1415
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1412
1416
|
rpcUrls: { default: { http: [rpc] } }
|
|
1413
1417
|
});
|
|
1414
|
-
const client = createPublicClient({ chain: ch, transport:
|
|
1418
|
+
const client = createPublicClient({ chain: ch, transport: defiEvmTransport(rpc) });
|
|
1415
1419
|
const vault = getAddress(SUSDS_VAULT_ERC4626_MAINNET);
|
|
1416
1420
|
const [ssr, assets] = await Promise.all([
|
|
1417
1421
|
client.readContract({ address: vault, abi: susdsRateAbi, functionName: "ssr" }),
|