@continuumdao/ctm-mpc-defi 0.2.51 → 0.2.53

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.
@@ -119,7 +119,7 @@ declare const CONTINUUM_DAO_LINEA_GOVERNOR_LEGACY_ADDRESS: `0x${string}`;
119
119
  */
120
120
  declare const CONTINUUM_DAO_COMMITTEE_PROPOSERS: readonly [`0x${string}`, `0x${string}`, `0x${string}`];
121
121
  declare function isContinuumDaoCommitteeProposer(addr?: string | null): boolean;
122
- /** Placeholder deployments — fill NodeProperties / Rewards / governor after redeploy. */
122
+ /** Placeholder deployments — fill NodeProperties / Rewards after redeploy. */
123
123
  declare const CONTINUUM_DAO_DEPLOYMENTS: Readonly<Record<number, ContinuumDaoDeployment>>;
124
124
  /** Public ContinuumDAO governance API (same host continuumdao-app proxies). */
125
125
  declare const CONTINUUM_DAO_GOVERNANCE_API = "https://app-api.continuumdao.org";
@@ -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>;
@@ -185,7 +185,8 @@ var init_constants = __esm({
185
185
  [CONTINUUM_DAO_LINEA_CHAIN_ID]: {
186
186
  ...UNSET,
187
187
  ctm: CTM_TOKEN_ADDRESS,
188
- votingEscrow: VOTING_ESCROW_LINEA_ADDRESS
188
+ votingEscrow: VOTING_ESCROW_LINEA_ADDRESS,
189
+ governor: CONTINUUM_DAO_LINEA_GOVERNOR_ADDRESS
189
190
  },
190
191
  [CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID]: { ...UNSET },
191
192
  [CONTINUUM_DAO_ETHEREUM_CHAIN_ID]: {
@@ -928,13 +929,38 @@ async function continuumDaoForumSignInEligible(args) {
928
929
  const st = body.status && typeof body.status === "object" ? body.status : null;
929
930
  const reason = typeof body.reason === "string" && body.reason || st && typeof st.message === "string" && st.message || void 0;
930
931
  const ok = res.ok && Boolean(body.ok ?? body.eligible);
932
+ const votingPower = typeof body.votingPower === "string" ? body.votingPower : void 0;
933
+ const threshold = typeof body.threshold === "string" ? body.threshold : void 0;
934
+ const tokenId = typeof body.tokenId === "string" ? body.tokenId : void 0;
931
935
  return {
932
936
  ok,
933
937
  eligible: ok,
934
938
  address: typeof body.address === "string" ? body.address : address,
935
- reason: ok ? void 0 : reason || "Address does not meet the veCTM threshold"
939
+ reason: ok ? void 0 : reason || "Address does not meet the veCTM threshold",
940
+ votingPower,
941
+ threshold,
942
+ tokenId
936
943
  };
937
944
  }
945
+ function assertForumSignInUsernameChoice(args) {
946
+ const nodeKey = args.nodeKey?.trim() || "";
947
+ const username = args.username?.trim() || "";
948
+ if (!nodeKey) {
949
+ throw new Error(
950
+ "KeyGen forum sign-in requires nodeKey from this node, including when the operator chose a custom username. useNodeKeyUsername only selects the username."
951
+ );
952
+ }
953
+ if (username && !FORUM_USERNAME_RE.test(username)) {
954
+ throw new Error(
955
+ "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 the same nodeKey."
956
+ );
957
+ }
958
+ if (!username && !args.useNodeKeyUsername) {
959
+ throw new Error(
960
+ "Ask the operator for a custom forum username (2\u201316 letters, numbers, . _ -). If they decline, call again with useNodeKeyUsername true and the same nodeKey. The username will be the first 16 characters of the node key. Always pass nodeKey."
961
+ );
962
+ }
963
+ }
938
964
  async function continuumDaoForumSignInNonce(args) {
939
965
  const qs2 = new URLSearchParams({
940
966
  address: args.address,
@@ -943,6 +969,18 @@ async function continuumDaoForumSignInNonce(args) {
943
969
  });
944
970
  return forumFetch(`/api/continuum/eip712/nonce?${qs2}`, { forumUrl: args.forumUrl });
945
971
  }
972
+ function forumSignInTypedExpiryUnix(message) {
973
+ const raw = message.expiresAt;
974
+ const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
975
+ if (!Number.isFinite(n) || n <= 0) return void 0;
976
+ return Math.floor(n > 1e12 ? n / 1e3 : n);
977
+ }
978
+ function forumSignInRequestExpiryUnix(message, explicit) {
979
+ const typed = forumSignInTypedExpiryUnix(message);
980
+ const caller = explicit != null && explicit > 0 ? Math.floor(explicit) : void 0;
981
+ if (typed != null && caller != null) return Math.min(typed, caller);
982
+ return typed ?? caller;
983
+ }
946
984
  async function buildEvmMultisignBodyContinuumDaoForumSignIn(args) {
947
985
  const owner = getAddress(args.executorAddress);
948
986
  const gate = await continuumDaoForumSignInEligible({ address: owner, forumUrl: args.forumUrl });
@@ -951,6 +989,7 @@ async function buildEvmMultisignBodyContinuumDaoForumSignIn(args) {
951
989
  `${gate.reason || "Address does not meet the veCTM threshold"}. Do not start a multi-sign request.`
952
990
  );
953
991
  }
992
+ assertForumSignInUsernameChoice(args);
954
993
  const typed = await continuumDaoForumSignInNonce({
955
994
  address: owner,
956
995
  nodeKey: args.nodeKey,
@@ -979,10 +1018,10 @@ async function buildEvmMultisignBodyContinuumDaoForumSignIn(args) {
979
1018
  }
980
1019
  }
981
1020
  ],
982
- expiryDate: args.expiryDate
1021
+ expiryDate: forumSignInRequestExpiryUnix(typed.message, args.expiryDate)
983
1022
  });
984
1023
  }
985
- var DEFAULT_FORUM_URL, FORUM_GOVERNANCE_SECTIONS, FORUM_IDEA_SECTION, PROPOSAL_TYPE_TO_FORUM_SECTION, IDEA_SECTION_ALIASES, FORUM_LOGIN_DELIVERY_KIND;
1024
+ 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
1025
  var init_forum = __esm({
987
1026
  "src/protocols/evm/continuum-dao/forum.ts"() {
988
1027
  init_eip712Multisign();
@@ -1004,6 +1043,7 @@ var init_forum = __esm({
1004
1043
  };
1005
1044
  IDEA_SECTION_ALIASES = /* @__PURE__ */ new Set(["ideas", "ideas-suggestions", "suggestions"]);
1006
1045
  FORUM_LOGIN_DELIVERY_KIND = "forumLogin";
1046
+ FORUM_USERNAME_RE = /^[A-Za-z0-9._-]{2,16}$/;
1007
1047
  }
1008
1048
  });
1009
1049