@continuumdao/ctm-mpc-defi 0.2.54 → 0.2.55

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.
@@ -258,9 +258,10 @@ function checksumOrEmpty(value) {
258
258
  if (!raw) return "";
259
259
  return getAddress(raw);
260
260
  }
261
- function normalizeInput(inp) {
261
+ function normalizeInput(inp, index) {
262
+ const explicit = String(inp?.name || "").trim();
262
263
  return {
263
- name: String(inp?.name || ""),
264
+ name: explicit || `arg${index}`,
264
265
  type: String(inp?.type || ""),
265
266
  value: String(inp?.value ?? "")
266
267
  };
@@ -277,7 +278,7 @@ function normalizeAction(action) {
277
278
  target: checksumOrEmpty(action.target),
278
279
  value: String(action.value || "0"),
279
280
  signature: String(action.signature || ""),
280
- inputs: (action.inputs || []).map(normalizeInput)
281
+ inputs: (action.inputs || []).map((inp, index) => normalizeInput(inp, index))
281
282
  };
282
283
  }
283
284
  function assertProposalCatalogConstants() {
@@ -2682,13 +2683,25 @@ async function buildEvmMultisignBodyContinuumDaoCastVoteBravoFromMcp(args) {
2682
2683
  }
2683
2684
  async function continuumDaoRegisterProposal(payload) {
2684
2685
  assertContinuumDaoForumTopicKey(payload.forumKey);
2686
+ const body = JSON.stringify(payload);
2685
2687
  const res = await fetch(`${CONTINUUM_DAO_GOVERNANCE_API}/proposals/create`, {
2686
2688
  method: "POST",
2687
2689
  headers: { "Content-Type": "application/json" },
2688
- body: JSON.stringify(payload)
2690
+ body
2689
2691
  });
2690
- if (!res.ok) throw new Error(`proposals/create: ${res.status} ${await res.text()}`);
2691
- return { ok: true, result: await res.json() };
2692
+ const text = await res.text();
2693
+ if (res.status === 409) {
2694
+ const repair = await fetch(`${CONTINUUM_DAO_GOVERNANCE_API}/proposals/repair`, {
2695
+ method: "POST",
2696
+ headers: { "Content-Type": "application/json" },
2697
+ body
2698
+ });
2699
+ const repairText = await repair.text();
2700
+ if (!repair.ok) throw new Error(`proposals/repair: ${repair.status} ${repairText}`);
2701
+ return { ok: true, result: JSON.parse(repairText) };
2702
+ }
2703
+ if (!res.ok) throw new Error(`proposals/create: ${res.status} ${text}`);
2704
+ return { ok: true, result: JSON.parse(text) };
2692
2705
  }
2693
2706
  var CONTINUUM_DAO_PROPOSE_FALLBACK, CONTINUUM_DAO_VOTE_FALLBACK, CONTINUUM_DAO_EXECUTE_FALLBACK, CONTINUUM_DAO_CANCEL_FALLBACK, CONTINUUM_DAO_GOV_EVM_TYPES, governorWriteAbi, governorReadAbi, FORUM_SECTION_TO_PROPOSAL_TYPE, GOVERNOR_STATE, GOVERNOR_STATE_LABELS;
2694
2707
  var init_governance = __esm({