@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 txParams_js = require('@continuumdao/continuum-node-sdk/dist/evm/tx-params.js');
|
|
6
|
+
var chainFees_js = require('@continuumdao/continuum-node-sdk/dist/evm/chain-fees.js');
|
|
7
|
+
var getSigFeeSpeed_js = require('@continuumdao/continuum-node-sdk/dist/evm/get-sig-fee-speed.js');
|
|
8
|
+
var gwei_js = require('@continuumdao/continuum-node-sdk/dist/evm/gwei.js');
|
|
5
9
|
|
|
6
10
|
var __defProp = Object.defineProperty;
|
|
7
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -370,7 +374,7 @@ function finalizeMultisign(input) {
|
|
|
370
374
|
const ph = (keyGen.pubkeyhex ?? "").trim();
|
|
371
375
|
if (!ph) throw new Error("keyGen pubKey (pubkeyhex) is required");
|
|
372
376
|
const keyList = keyGen.keylist ?? [];
|
|
373
|
-
const clientId =
|
|
377
|
+
const clientId = rpcUtils_js.getClientIdFromKeyGenResult(keyGen);
|
|
374
378
|
const first = legs[0];
|
|
375
379
|
const messageHashes = legs.map((l) => l.msgHash);
|
|
376
380
|
const messageRawBatch = legs.map((l) => l.msgRaw);
|
|
@@ -421,7 +425,7 @@ var init_envelope = __esm({
|
|
|
421
425
|
});
|
|
422
426
|
function routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimit) {
|
|
423
427
|
if (chainGasLimit != null && Number.isFinite(chainGasLimit) && chainGasLimit > 0) {
|
|
424
|
-
return
|
|
428
|
+
return txParams_js.gasLimitFromEstimateAndChainConfig(estimatedGas, chainGasLimit);
|
|
425
429
|
}
|
|
426
430
|
return (estimatedGas * 12n + 9n) / 10n;
|
|
427
431
|
}
|
|
@@ -429,6 +433,15 @@ var init_routerSwapGas = __esm({
|
|
|
429
433
|
"src/chains/evm/routerSwapGas.ts"() {
|
|
430
434
|
}
|
|
431
435
|
});
|
|
436
|
+
|
|
437
|
+
// src/chains/evm/unsignedMessageRaw.ts
|
|
438
|
+
function evmUnsignedMessageRaw(serialized) {
|
|
439
|
+
return serialized.startsWith("0x") ? serialized.slice(2) : serialized;
|
|
440
|
+
}
|
|
441
|
+
var init_unsignedMessageRaw = __esm({
|
|
442
|
+
"src/chains/evm/unsignedMessageRaw.ts"() {
|
|
443
|
+
}
|
|
444
|
+
});
|
|
432
445
|
async function buildEvmMultisignBatch(args) {
|
|
433
446
|
const { context, steps } = args;
|
|
434
447
|
const {
|
|
@@ -449,7 +462,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
449
462
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
450
463
|
});
|
|
451
464
|
const publicClient3 = viem.createPublicClient({ chain: ch, transport: defiEvmTransport(rpcUrl) });
|
|
452
|
-
const feeParams = await
|
|
465
|
+
const feeParams = await chainFees_js.fetchChainFeeParams(rpcUrl, chainId);
|
|
453
466
|
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
454
467
|
const latestBaseFeeWei = !legacy ? (await publicClient3.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
455
468
|
const gasLimitConfig = useCustomGas && chainDetail?.gasLimit != null ? Number(chainDetail.gasLimit) : void 0;
|
|
@@ -482,7 +495,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
482
495
|
} else if (step.routerSwap) {
|
|
483
496
|
gasLimitI = routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimitRouter);
|
|
484
497
|
} else {
|
|
485
|
-
gasLimitI = useCustomGas ?
|
|
498
|
+
gasLimitI = useCustomGas ? txParams_js.gasLimitFromEstimateAndChainConfig(estimatedGas, gasLimitConfig) : estimatedGas;
|
|
486
499
|
}
|
|
487
500
|
let proposalTxParams;
|
|
488
501
|
let feeSnapshot;
|
|
@@ -493,7 +506,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
493
506
|
gasPriceWei = gasPriceWei * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
494
507
|
}
|
|
495
508
|
if (useCustomGas && chainDetail?.gasPrice != null && chainDetail.gasPrice > 0) {
|
|
496
|
-
const configured = viem.parseGwei(
|
|
509
|
+
const configured = viem.parseGwei(gwei_js.gweiToDecimalString(Number(chainDetail.gasPrice)));
|
|
497
510
|
if (configured > gasPriceWei) gasPriceWei = configured;
|
|
498
511
|
}
|
|
499
512
|
serialized = viem.serializeTransaction({
|
|
@@ -512,7 +525,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
512
525
|
txType: "legacy",
|
|
513
526
|
gasPrice: gasPriceWei.toString()
|
|
514
527
|
};
|
|
515
|
-
feeSnapshot =
|
|
528
|
+
feeSnapshot = txParams_js.proposalTxParamsToFeeSnapshot(proposalTxParams);
|
|
516
529
|
} else {
|
|
517
530
|
const fetchedBase = feeParams.baseFeeGwei ?? 0;
|
|
518
531
|
const fetchedPriority = feeParams.priorityFeeGwei ?? 0;
|
|
@@ -523,13 +536,13 @@ async function buildEvmMultisignBatch(args) {
|
|
|
523
536
|
const baseFeeMultiplierPct = useCustomGas && chainDetail?.baseFeeMultiplier != null ? Math.max(100, Number(chainDetail.baseFeeMultiplier)) : 100;
|
|
524
537
|
const baseComponentGwei = effectiveBaseFeeGwei * baseFeeMultiplierPct / 100;
|
|
525
538
|
const maxFeePerGasGwei = baseComponentGwei + effectivePriorityFeeGwei;
|
|
526
|
-
let maxPriorityFeePerGas = effectivePriorityFeeGwei > 0 ? viem.parseGwei(
|
|
527
|
-
let maxFeePerGas = viem.parseGwei(
|
|
539
|
+
let maxPriorityFeePerGas = effectivePriorityFeeGwei > 0 ? viem.parseGwei(gwei_js.gweiToDecimalString(effectivePriorityFeeGwei)) : viem.parseGwei("1");
|
|
540
|
+
let maxFeePerGas = viem.parseGwei(gwei_js.gweiToDecimalString(maxFeePerGasGwei));
|
|
528
541
|
if (useCustomGas && gasFeeMultiplier != null && gasFeeMultiplier > 0) {
|
|
529
542
|
maxPriorityFeePerGas = maxPriorityFeePerGas * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
530
543
|
maxFeePerGas = maxFeePerGas * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
531
544
|
}
|
|
532
|
-
({ maxFeePerGas, maxPriorityFeePerGas } =
|
|
545
|
+
({ maxFeePerGas, maxPriorityFeePerGas } = getSigFeeSpeed_js.alignEip1559FeesWithLatestBase(
|
|
533
546
|
maxFeePerGas,
|
|
534
547
|
maxPriorityFeePerGas,
|
|
535
548
|
latestBaseFeeWei
|
|
@@ -552,14 +565,14 @@ async function buildEvmMultisignBatch(args) {
|
|
|
552
565
|
maxFeePerGas: maxFeePerGas.toString(),
|
|
553
566
|
maxPriorityFeePerGas: maxPriorityFeePerGas.toString()
|
|
554
567
|
};
|
|
555
|
-
feeSnapshot = i === 0 ?
|
|
568
|
+
feeSnapshot = i === 0 ? txParams_js.proposalTxParamsToFeeSnapshot(proposalTxParams) : {};
|
|
556
569
|
}
|
|
557
570
|
const h = viem.keccak256(serialized);
|
|
558
571
|
const msgHash = h.startsWith("0x") ? h.slice(2) : h;
|
|
559
572
|
const batchMetaExtra = args.buildBatchMeta({ step, index: i, gasLimit: gasLimitI });
|
|
560
573
|
legs.push({
|
|
561
574
|
msgHash,
|
|
562
|
-
msgRaw:
|
|
575
|
+
msgRaw: evmUnsignedMessageRaw(serialized),
|
|
563
576
|
destinationAddress: step.to,
|
|
564
577
|
signatureText: typeof batchMetaExtra.signatureText === "string" ? batchMetaExtra.signatureText : JSON.stringify(batchMetaExtra.signatureText ?? {}),
|
|
565
578
|
audit: batchMetaExtra,
|
|
@@ -567,9 +580,6 @@ async function buildEvmMultisignBatch(args) {
|
|
|
567
580
|
proposalTxParams,
|
|
568
581
|
valueWei: i === 0 ? step.value : void 0
|
|
569
582
|
});
|
|
570
|
-
if (i === 0 && args.firstMsgRawNo0x != null) {
|
|
571
|
-
legs[0].msgRaw = args.firstMsgRawNo0x;
|
|
572
|
-
}
|
|
573
583
|
}
|
|
574
584
|
const extraJSON = {};
|
|
575
585
|
if (useCustomGas && customGasChainDetails && Object.keys(customGasChainDetails).length > 0) {
|
|
@@ -596,6 +606,7 @@ var init_buildBatch = __esm({
|
|
|
596
606
|
init_defiEvmClient();
|
|
597
607
|
init_envelope();
|
|
598
608
|
init_routerSwapGas();
|
|
609
|
+
init_unsignedMessageRaw();
|
|
599
610
|
}
|
|
600
611
|
});
|
|
601
612
|
function msgHashNo0x(digest) {
|
|
@@ -731,6 +742,10 @@ function assertContinuumDaoForumTopicKey(forumKey, forumUrl) {
|
|
|
731
742
|
}
|
|
732
743
|
return raw.replace(/\/+$/, "");
|
|
733
744
|
}
|
|
745
|
+
function continuumDaoForumTopicCatalogKey(forumKey, forumUrl) {
|
|
746
|
+
const absolute = assertContinuumDaoForumTopicKey(forumKey, forumUrl);
|
|
747
|
+
return new URL(absolute).pathname.replace(/^\/+/, "");
|
|
748
|
+
}
|
|
734
749
|
function forumError(body, status) {
|
|
735
750
|
const o = body && typeof body === "object" ? body : {};
|
|
736
751
|
const st = o.status && typeof o.status === "object" ? o.status : null;
|
|
@@ -2425,6 +2440,7 @@ async function buildProposeCatalog(args) {
|
|
|
2425
2440
|
throw new Error("type must be 0\u20134 (Admin, Constitution, Decision, Election, Treasury).");
|
|
2426
2441
|
}
|
|
2427
2442
|
await assertProposalTypeMatchesForum(args.forumKey, args.type, args.forumUrl);
|
|
2443
|
+
const catalogForumKey = continuumDaoForumTopicCatalogKey(args.forumKey, args.forumUrl);
|
|
2428
2444
|
const hashed = await continuumDaoHashProposal({
|
|
2429
2445
|
chainId: args.chainId,
|
|
2430
2446
|
rpcUrl: args.rpcUrl,
|
|
@@ -2439,7 +2455,7 @@ async function buildProposeCatalog(args) {
|
|
|
2439
2455
|
title: args.title.trim(),
|
|
2440
2456
|
description: args.description,
|
|
2441
2457
|
proposer: args.proposer,
|
|
2442
|
-
forumKey:
|
|
2458
|
+
forumKey: catalogForumKey,
|
|
2443
2459
|
type: args.type,
|
|
2444
2460
|
configuration: args.configuration,
|
|
2445
2461
|
pendingOnChain: true,
|
|
@@ -3011,8 +3027,10 @@ async function buildEvmMultisignBodyContinuumDaoCastVoteBravoFromMcp(args) {
|
|
|
3011
3027
|
return buildEvmMultisignBodyContinuumDaoCastVoteBravo({ ...args, support });
|
|
3012
3028
|
}
|
|
3013
3029
|
async function continuumDaoRegisterProposal(payload) {
|
|
3014
|
-
|
|
3015
|
-
|
|
3030
|
+
const body = JSON.stringify({
|
|
3031
|
+
...payload,
|
|
3032
|
+
forumKey: continuumDaoForumTopicCatalogKey(payload.forumKey)
|
|
3033
|
+
});
|
|
3016
3034
|
const res = await fetch(`${exports.CONTINUUM_DAO_GOVERNANCE_API}/proposals/create`, {
|
|
3017
3035
|
method: "POST",
|
|
3018
3036
|
headers: { "Content-Type": "application/json" },
|
|
@@ -7931,6 +7949,7 @@ exports.continuumDaoForumSections = continuumDaoForumSections;
|
|
|
7931
7949
|
exports.continuumDaoForumSignInEligible = continuumDaoForumSignInEligible;
|
|
7932
7950
|
exports.continuumDaoForumSignInNonce = continuumDaoForumSignInNonce;
|
|
7933
7951
|
exports.continuumDaoForumSignOut = continuumDaoForumSignOut;
|
|
7952
|
+
exports.continuumDaoForumTopicCatalogKey = continuumDaoForumTopicCatalogKey;
|
|
7934
7953
|
exports.continuumDaoForumUnread = continuumDaoForumUnread;
|
|
7935
7954
|
exports.continuumDaoForumUrl = continuumDaoForumUrl;
|
|
7936
7955
|
exports.continuumDaoForumUserPostIds = continuumDaoForumUserPostIds;
|