@continuumdao/ctm-mpc-defi 0.2.51 → 0.2.52
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 +59 -27
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +87 -21
- package/dist/agent/catalog.js +59 -27
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/continuum-dao/SKILL.md +7 -6
- package/dist/protocols/evm/continuum-dao/index.cjs +37 -3
- package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/continuum-dao/index.d.ts +7 -0
- package/dist/protocols/evm/continuum-dao/index.js +37 -3
- package/dist/protocols/evm/continuum-dao/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -4781,6 +4781,11 @@ type ForumSignInEligible = {
|
|
|
4781
4781
|
eligible: boolean;
|
|
4782
4782
|
address?: string;
|
|
4783
4783
|
reason?: string;
|
|
4784
|
+
/** Current `balanceOfNFT` wei for the veCTM that was checked. */
|
|
4785
|
+
votingPower?: string;
|
|
4786
|
+
/** `MultiSignAgentWallet.veCtmThresholdPower` wei. */
|
|
4787
|
+
threshold?: string;
|
|
4788
|
+
tokenId?: string;
|
|
4784
4789
|
};
|
|
4785
4790
|
declare function continuumDaoForumSignInEligible(args: {
|
|
4786
4791
|
address: string;
|
|
@@ -4799,6 +4804,8 @@ declare function buildEvmMultisignBodyContinuumDaoForumSignIn(args: {
|
|
|
4799
4804
|
purposeText: string;
|
|
4800
4805
|
nodeKey?: string;
|
|
4801
4806
|
username?: string;
|
|
4807
|
+
/** Set only after the operator declines a custom username. */
|
|
4808
|
+
useNodeKeyUsername?: boolean;
|
|
4802
4809
|
forumUrl?: string;
|
|
4803
4810
|
expiryDate?: number;
|
|
4804
4811
|
}): Promise<MultisignBuildResult>;
|
|
@@ -928,13 +928,33 @@ async function continuumDaoForumSignInEligible(args) {
|
|
|
928
928
|
const st = body.status && typeof body.status === "object" ? body.status : null;
|
|
929
929
|
const reason = typeof body.reason === "string" && body.reason || st && typeof st.message === "string" && st.message || void 0;
|
|
930
930
|
const ok = res.ok && Boolean(body.ok ?? body.eligible);
|
|
931
|
+
const votingPower = typeof body.votingPower === "string" ? body.votingPower : void 0;
|
|
932
|
+
const threshold = typeof body.threshold === "string" ? body.threshold : void 0;
|
|
933
|
+
const tokenId = typeof body.tokenId === "string" ? body.tokenId : void 0;
|
|
931
934
|
return {
|
|
932
935
|
ok,
|
|
933
936
|
eligible: ok,
|
|
934
937
|
address: typeof body.address === "string" ? body.address : address,
|
|
935
|
-
reason: ok ? void 0 : reason || "Address does not meet the veCTM threshold"
|
|
938
|
+
reason: ok ? void 0 : reason || "Address does not meet the veCTM threshold",
|
|
939
|
+
votingPower,
|
|
940
|
+
threshold,
|
|
941
|
+
tokenId
|
|
936
942
|
};
|
|
937
943
|
}
|
|
944
|
+
function assertForumSignInUsernameChoice(args) {
|
|
945
|
+
const nodeKey = args.nodeKey?.trim() || "";
|
|
946
|
+
const username = args.username?.trim() || "";
|
|
947
|
+
if (username && !FORUM_USERNAME_RE.test(username)) {
|
|
948
|
+
throw new Error(
|
|
949
|
+
"Ask the operator for a forum username of 2\u201316 letters, numbers, periods, underscores, or hyphens. If they want the node-key name, call again with useNodeKeyUsername true and nodeKey set."
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
if (!username && !(args.useNodeKeyUsername && nodeKey)) {
|
|
953
|
+
throw new Error(
|
|
954
|
+
"Ask the operator for a custom forum username (2\u201316 letters, numbers, . _ -). If they want the default, call again with useNodeKeyUsername true and nodeKey set. The username will be the first 16 characters of the node key."
|
|
955
|
+
);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
938
958
|
async function continuumDaoForumSignInNonce(args) {
|
|
939
959
|
const qs2 = new URLSearchParams({
|
|
940
960
|
address: args.address,
|
|
@@ -943,6 +963,18 @@ async function continuumDaoForumSignInNonce(args) {
|
|
|
943
963
|
});
|
|
944
964
|
return forumFetch(`/api/continuum/eip712/nonce?${qs2}`, { forumUrl: args.forumUrl });
|
|
945
965
|
}
|
|
966
|
+
function forumSignInTypedExpiryUnix(message) {
|
|
967
|
+
const raw = message.expiresAt;
|
|
968
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
|
|
969
|
+
if (!Number.isFinite(n) || n <= 0) return void 0;
|
|
970
|
+
return Math.floor(n > 1e12 ? n / 1e3 : n);
|
|
971
|
+
}
|
|
972
|
+
function forumSignInRequestExpiryUnix(message, explicit) {
|
|
973
|
+
const typed = forumSignInTypedExpiryUnix(message);
|
|
974
|
+
const caller = explicit != null && explicit > 0 ? Math.floor(explicit) : void 0;
|
|
975
|
+
if (typed != null && caller != null) return Math.min(typed, caller);
|
|
976
|
+
return typed ?? caller;
|
|
977
|
+
}
|
|
946
978
|
async function buildEvmMultisignBodyContinuumDaoForumSignIn(args) {
|
|
947
979
|
const owner = getAddress(args.executorAddress);
|
|
948
980
|
const gate = await continuumDaoForumSignInEligible({ address: owner, forumUrl: args.forumUrl });
|
|
@@ -951,6 +983,7 @@ async function buildEvmMultisignBodyContinuumDaoForumSignIn(args) {
|
|
|
951
983
|
`${gate.reason || "Address does not meet the veCTM threshold"}. Do not start a multi-sign request.`
|
|
952
984
|
);
|
|
953
985
|
}
|
|
986
|
+
assertForumSignInUsernameChoice(args);
|
|
954
987
|
const typed = await continuumDaoForumSignInNonce({
|
|
955
988
|
address: owner,
|
|
956
989
|
nodeKey: args.nodeKey,
|
|
@@ -979,10 +1012,10 @@ async function buildEvmMultisignBodyContinuumDaoForumSignIn(args) {
|
|
|
979
1012
|
}
|
|
980
1013
|
}
|
|
981
1014
|
],
|
|
982
|
-
expiryDate: args.expiryDate
|
|
1015
|
+
expiryDate: forumSignInRequestExpiryUnix(typed.message, args.expiryDate)
|
|
983
1016
|
});
|
|
984
1017
|
}
|
|
985
|
-
var DEFAULT_FORUM_URL, FORUM_GOVERNANCE_SECTIONS, FORUM_IDEA_SECTION, PROPOSAL_TYPE_TO_FORUM_SECTION, IDEA_SECTION_ALIASES, FORUM_LOGIN_DELIVERY_KIND;
|
|
1018
|
+
var DEFAULT_FORUM_URL, FORUM_GOVERNANCE_SECTIONS, FORUM_IDEA_SECTION, PROPOSAL_TYPE_TO_FORUM_SECTION, IDEA_SECTION_ALIASES, FORUM_LOGIN_DELIVERY_KIND, FORUM_USERNAME_RE;
|
|
986
1019
|
var init_forum = __esm({
|
|
987
1020
|
"src/protocols/evm/continuum-dao/forum.ts"() {
|
|
988
1021
|
init_eip712Multisign();
|
|
@@ -1004,6 +1037,7 @@ var init_forum = __esm({
|
|
|
1004
1037
|
};
|
|
1005
1038
|
IDEA_SECTION_ALIASES = /* @__PURE__ */ new Set(["ideas", "ideas-suggestions", "suggestions"]);
|
|
1006
1039
|
FORUM_LOGIN_DELIVERY_KIND = "forumLogin";
|
|
1040
|
+
FORUM_USERNAME_RE = /^[A-Za-z0-9._-]{2,16}$/;
|
|
1007
1041
|
}
|
|
1008
1042
|
});
|
|
1009
1043
|
|