@continuumdao/ctm-mpc-defi 0.2.64 → 0.2.66
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 +1227 -2928
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +1620 -1631
- package/dist/agent/catalog.js +1226 -2929
- package/dist/agent/catalog.js.map +1 -1
- package/dist/chains/evm/index.cjs +22 -15
- package/dist/chains/evm/index.cjs.map +1 -1
- package/dist/chains/evm/index.d.ts +13 -2
- package/dist/chains/evm/index.js +12 -6
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +25 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs +22 -16
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/aave-v4/index.js +11 -5
- package/dist/protocols/evm/aave-v4/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +21 -15
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +5 -1
- package/dist/protocols/evm/aerodrome/index.js +11 -5
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/arcus/index.cjs +21 -15
- package/dist/protocols/evm/arcus/index.cjs.map +1 -1
- package/dist/protocols/evm/arcus/index.js +11 -5
- package/dist/protocols/evm/arcus/index.js.map +1 -1
- package/dist/protocols/evm/circle-cctp/index.cjs +21 -15
- package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
- package/dist/protocols/evm/circle-cctp/index.js +11 -5
- package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
- package/dist/protocols/evm/compound-v3/index.cjs +21 -15
- package/dist/protocols/evm/compound-v3/index.cjs.map +1 -1
- package/dist/protocols/evm/compound-v3/index.js +11 -5
- package/dist/protocols/evm/compound-v3/index.js.map +1 -1
- package/dist/protocols/evm/continuum-dao/index.cjs +37 -18
- package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/continuum-dao/index.d.ts +3 -1
- package/dist/protocols/evm/continuum-dao/index.js +27 -9
- package/dist/protocols/evm/continuum-dao/index.js.map +1 -1
- package/dist/protocols/evm/curve-dao/index.cjs +21 -15
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/curve-dao/index.d.ts +1 -1
- package/dist/protocols/evm/curve-dao/index.js +11 -5
- package/dist/protocols/evm/curve-dao/index.js.map +1 -1
- package/dist/protocols/evm/derive/index.cjs +24 -18
- package/dist/protocols/evm/derive/index.cjs.map +1 -1
- package/dist/protocols/evm/derive/index.js +11 -5
- package/dist/protocols/evm/derive/index.js.map +1 -1
- package/dist/protocols/evm/ethena/index.cjs +22 -16
- package/dist/protocols/evm/ethena/index.cjs.map +1 -1
- package/dist/protocols/evm/ethena/index.js +11 -5
- package/dist/protocols/evm/ethena/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +21 -15
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.js +11 -5
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +21 -15
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.js +11 -5
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.cjs +21 -15
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.js +11 -5
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquidOutcome/index.cjs +2 -2
- package/dist/protocols/evm/hyperliquidOutcome/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquidOutcome/index.js +1 -1
- package/dist/protocols/evm/hyperliquidOutcome/index.js.map +1 -1
- package/dist/protocols/evm/lido/index.cjs +21 -15
- package/dist/protocols/evm/lido/index.cjs.map +1 -1
- package/dist/protocols/evm/lido/index.js +11 -5
- package/dist/protocols/evm/lido/index.js.map +1 -1
- package/dist/protocols/evm/maple/index.cjs +21 -15
- package/dist/protocols/evm/maple/index.cjs.map +1 -1
- package/dist/protocols/evm/maple/index.js +11 -5
- package/dist/protocols/evm/maple/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +21 -15
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.js +11 -5
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/dist/protocols/evm/pendle/index.cjs +21 -15
- package/dist/protocols/evm/pendle/index.cjs.map +1 -1
- package/dist/protocols/evm/pendle/index.d.ts +5 -1
- package/dist/protocols/evm/pendle/index.js +11 -5
- package/dist/protocols/evm/pendle/index.js.map +1 -1
- package/dist/protocols/evm/permit2/index.cjs +2 -2
- package/dist/protocols/evm/permit2/index.cjs.map +1 -1
- package/dist/protocols/evm/permit2/index.js +1 -1
- package/dist/protocols/evm/permit2/index.js.map +1 -1
- package/dist/protocols/evm/railgun/index.cjs +21 -15
- package/dist/protocols/evm/railgun/index.cjs.map +1 -1
- package/dist/protocols/evm/railgun/index.js +11 -5
- package/dist/protocols/evm/railgun/index.js.map +1 -1
- package/dist/protocols/evm/sky/index.cjs +21 -15
- package/dist/protocols/evm/sky/index.cjs.map +1 -1
- package/dist/protocols/evm/sky/index.js +11 -5
- package/dist/protocols/evm/sky/index.js.map +1 -1
- package/dist/protocols/evm/trueo/index.cjs +21 -15
- package/dist/protocols/evm/trueo/index.cjs.map +1 -1
- package/dist/protocols/evm/trueo/index.js +11 -5
- package/dist/protocols/evm/trueo/index.js.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs +23 -16
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.d.ts +1 -1
- package/dist/protocols/evm/uniswap-v4/index.js +12 -5
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/dist/protocols/evm/venice/index.cjs +22 -16
- package/dist/protocols/evm/venice/index.cjs.map +1 -1
- package/dist/protocols/evm/venice/index.js +11 -5
- package/dist/protocols/evm/venice/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var viem = require('viem');
|
|
4
|
-
var
|
|
4
|
+
var rpcUtils_js = require('@continuumdao/continuum-node-sdk/dist/evm/rpc-utils.js');
|
|
5
|
+
var chainFees_js = require('@continuumdao/continuum-node-sdk/dist/evm/chain-fees.js');
|
|
6
|
+
var getSigFeeSpeed_js = require('@continuumdao/continuum-node-sdk/dist/evm/get-sig-fee-speed.js');
|
|
7
|
+
var gwei_js = require('@continuumdao/continuum-node-sdk/dist/evm/gwei.js');
|
|
8
|
+
var txParams_js = require('@continuumdao/continuum-node-sdk/dist/evm/tx-params.js');
|
|
5
9
|
|
|
6
10
|
// src/core/registry.ts
|
|
7
11
|
var modules = [];
|
|
@@ -774,7 +778,7 @@ var spokeStaticAbi = [
|
|
|
774
778
|
];
|
|
775
779
|
async function fetchAaveV4SpokeReserveIdForUnderlying(args) {
|
|
776
780
|
const url = (args.rpcUrl ?? "").trim();
|
|
777
|
-
if (!
|
|
781
|
+
if (!rpcUtils_js.isValidRpcUrl(url)) return null;
|
|
778
782
|
if (!Number.isFinite(args.chainId) || args.chainId < 0) return null;
|
|
779
783
|
const spoke = viem.getAddress(args.spoke);
|
|
780
784
|
const want = viem.getAddress(args.underlying).toLowerCase();
|
|
@@ -850,7 +854,7 @@ function finalizeMultisign(input) {
|
|
|
850
854
|
const ph = (keyGen.pubkeyhex ?? "").trim();
|
|
851
855
|
if (!ph) throw new Error("keyGen pubKey (pubkeyhex) is required");
|
|
852
856
|
const keyList = keyGen.keylist ?? [];
|
|
853
|
-
const clientId =
|
|
857
|
+
const clientId = rpcUtils_js.getClientIdFromKeyGenResult(keyGen);
|
|
854
858
|
const first = legs[0];
|
|
855
859
|
const messageHashes = legs.map((l) => l.msgHash);
|
|
856
860
|
const messageRawBatch = legs.map((l) => l.msgRaw);
|
|
@@ -896,11 +900,16 @@ function finalizeMultisign(input) {
|
|
|
896
900
|
}
|
|
897
901
|
function routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimit) {
|
|
898
902
|
if (chainGasLimit != null && Number.isFinite(chainGasLimit) && chainGasLimit > 0) {
|
|
899
|
-
return
|
|
903
|
+
return txParams_js.gasLimitFromEstimateAndChainConfig(estimatedGas, chainGasLimit);
|
|
900
904
|
}
|
|
901
905
|
return (estimatedGas * 12n + 9n) / 10n;
|
|
902
906
|
}
|
|
903
907
|
|
|
908
|
+
// src/chains/evm/unsignedMessageRaw.ts
|
|
909
|
+
function evmUnsignedMessageRaw(serialized) {
|
|
910
|
+
return serialized.startsWith("0x") ? serialized.slice(2) : serialized;
|
|
911
|
+
}
|
|
912
|
+
|
|
904
913
|
// src/chains/evm/buildBatch.ts
|
|
905
914
|
async function buildEvmMultisignBatch(args) {
|
|
906
915
|
const { context, steps } = args;
|
|
@@ -922,7 +931,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
922
931
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
923
932
|
});
|
|
924
933
|
const publicClient = viem.createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
925
|
-
const feeParams = await
|
|
934
|
+
const feeParams = await chainFees_js.fetchChainFeeParams(rpcUrl, chainId);
|
|
926
935
|
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
927
936
|
const latestBaseFeeWei = !legacy ? (await publicClient.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
928
937
|
const gasLimitConfig = useCustomGas && chainDetail?.gasLimit != null ? Number(chainDetail.gasLimit) : void 0;
|
|
@@ -955,7 +964,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
955
964
|
} else if (step.routerSwap) {
|
|
956
965
|
gasLimitI = routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimitRouter);
|
|
957
966
|
} else {
|
|
958
|
-
gasLimitI = useCustomGas ?
|
|
967
|
+
gasLimitI = useCustomGas ? txParams_js.gasLimitFromEstimateAndChainConfig(estimatedGas, gasLimitConfig) : estimatedGas;
|
|
959
968
|
}
|
|
960
969
|
let proposalTxParams;
|
|
961
970
|
let feeSnapshot;
|
|
@@ -966,7 +975,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
966
975
|
gasPriceWei = gasPriceWei * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
967
976
|
}
|
|
968
977
|
if (useCustomGas && chainDetail?.gasPrice != null && chainDetail.gasPrice > 0) {
|
|
969
|
-
const configured = viem.parseGwei(
|
|
978
|
+
const configured = viem.parseGwei(gwei_js.gweiToDecimalString(Number(chainDetail.gasPrice)));
|
|
970
979
|
if (configured > gasPriceWei) gasPriceWei = configured;
|
|
971
980
|
}
|
|
972
981
|
serialized = viem.serializeTransaction({
|
|
@@ -985,7 +994,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
985
994
|
txType: "legacy",
|
|
986
995
|
gasPrice: gasPriceWei.toString()
|
|
987
996
|
};
|
|
988
|
-
feeSnapshot =
|
|
997
|
+
feeSnapshot = txParams_js.proposalTxParamsToFeeSnapshot(proposalTxParams);
|
|
989
998
|
} else {
|
|
990
999
|
const fetchedBase = feeParams.baseFeeGwei ?? 0;
|
|
991
1000
|
const fetchedPriority = feeParams.priorityFeeGwei ?? 0;
|
|
@@ -996,13 +1005,13 @@ async function buildEvmMultisignBatch(args) {
|
|
|
996
1005
|
const baseFeeMultiplierPct = useCustomGas && chainDetail?.baseFeeMultiplier != null ? Math.max(100, Number(chainDetail.baseFeeMultiplier)) : 100;
|
|
997
1006
|
const baseComponentGwei = effectiveBaseFeeGwei * baseFeeMultiplierPct / 100;
|
|
998
1007
|
const maxFeePerGasGwei = baseComponentGwei + effectivePriorityFeeGwei;
|
|
999
|
-
let maxPriorityFeePerGas = effectivePriorityFeeGwei > 0 ? viem.parseGwei(
|
|
1000
|
-
let maxFeePerGas = viem.parseGwei(
|
|
1008
|
+
let maxPriorityFeePerGas = effectivePriorityFeeGwei > 0 ? viem.parseGwei(gwei_js.gweiToDecimalString(effectivePriorityFeeGwei)) : viem.parseGwei("1");
|
|
1009
|
+
let maxFeePerGas = viem.parseGwei(gwei_js.gweiToDecimalString(maxFeePerGasGwei));
|
|
1001
1010
|
if (useCustomGas && gasFeeMultiplier != null && gasFeeMultiplier > 0) {
|
|
1002
1011
|
maxPriorityFeePerGas = maxPriorityFeePerGas * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
1003
1012
|
maxFeePerGas = maxFeePerGas * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
1004
1013
|
}
|
|
1005
|
-
({ maxFeePerGas, maxPriorityFeePerGas } =
|
|
1014
|
+
({ maxFeePerGas, maxPriorityFeePerGas } = getSigFeeSpeed_js.alignEip1559FeesWithLatestBase(
|
|
1006
1015
|
maxFeePerGas,
|
|
1007
1016
|
maxPriorityFeePerGas,
|
|
1008
1017
|
latestBaseFeeWei
|
|
@@ -1025,14 +1034,14 @@ async function buildEvmMultisignBatch(args) {
|
|
|
1025
1034
|
maxFeePerGas: maxFeePerGas.toString(),
|
|
1026
1035
|
maxPriorityFeePerGas: maxPriorityFeePerGas.toString()
|
|
1027
1036
|
};
|
|
1028
|
-
feeSnapshot = i === 0 ?
|
|
1037
|
+
feeSnapshot = i === 0 ? txParams_js.proposalTxParamsToFeeSnapshot(proposalTxParams) : {};
|
|
1029
1038
|
}
|
|
1030
1039
|
const h = viem.keccak256(serialized);
|
|
1031
1040
|
const msgHash = h.startsWith("0x") ? h.slice(2) : h;
|
|
1032
1041
|
const batchMetaExtra = args.buildBatchMeta({ step, index: i, gasLimit: gasLimitI });
|
|
1033
1042
|
legs.push({
|
|
1034
1043
|
msgHash,
|
|
1035
|
-
msgRaw:
|
|
1044
|
+
msgRaw: evmUnsignedMessageRaw(serialized),
|
|
1036
1045
|
destinationAddress: step.to,
|
|
1037
1046
|
signatureText: typeof batchMetaExtra.signatureText === "string" ? batchMetaExtra.signatureText : JSON.stringify(batchMetaExtra.signatureText ?? {}),
|
|
1038
1047
|
audit: batchMetaExtra,
|
|
@@ -1040,9 +1049,6 @@ async function buildEvmMultisignBatch(args) {
|
|
|
1040
1049
|
proposalTxParams,
|
|
1041
1050
|
valueWei: i === 0 ? step.value : void 0
|
|
1042
1051
|
});
|
|
1043
|
-
if (i === 0 && args.firstMsgRawNo0x != null) {
|
|
1044
|
-
legs[0].msgRaw = args.firstMsgRawNo0x;
|
|
1045
|
-
}
|
|
1046
1052
|
}
|
|
1047
1053
|
const extraJSON = {};
|
|
1048
1054
|
if (useCustomGas && customGasChainDetails && Object.keys(customGasChainDetails).length > 0) {
|