feat(dao-mcp): dao_register accepts Phase-4 fields in one call

Closes the gap between DaoConfig schema (already has fields) and the
dao_register tool (was rejecting/ignoring them). Now Sulkta DAO can be
registered with all audit-discovered values in one call:
  proposal_addr / stake_st_policy / proposal_st_policy +
  5 reference UTxO refs (governor / stake / proposal validators +
  StakeST / ProposalST minting policies).

All fields remain optional. dao_proposal_create_unsigned errors clearly
when one's missing. Future dao_discover_scripts tool will auto-populate
from chain queries.
This commit is contained in:
Kayos 2026-05-05 20:10:22 -07:00
parent 3d95369536
commit 5913b9266a

View file

@ -1310,7 +1310,7 @@ impl WalletService {
#[tool(
name = "dao_register",
description = "Register a DAO config (Sulkta, Bob's, etc) at $ALDABRA_DATA/daos/<name>.json. First-registered DAO becomes active automatically. Args: name (lowercase letters/digits/underscore/dash), governor_addr, stakes_addr, treasury_addr (all bech32), gov_token_policy (56 hex chars), gov_token_name_hex (hex of asset name), initial_spend (txhash#index, the Agora bootstrap tx ref), max_cosigners (u32), treasury_ref_config (56 hex chars). Optional: description, network (mainnet/preprod/preview, default mainnet)."
description = "Register a DAO config (Sulkta, Bob's, etc) at $ALDABRA_DATA/daos/<name>.json. First-registered DAO becomes active automatically. Required: name (lowercase letters/digits/underscore/dash), governor_addr, stakes_addr, treasury_addr (all bech32), gov_token_policy (56 hex chars), gov_token_name_hex (hex of asset name), initial_spend (txhash#index, the Agora bootstrap tx ref), max_cosigners (u32), treasury_ref_config (56 hex chars). Optional: description, network (mainnet/preprod/preview, default mainnet), and Phase-4 prerequisites — proposal_addr, stake_st_policy, proposal_st_policy (56 hex), plus reference UTxO refs (`txhash#index`) for governor_validator / stake_validator / proposal_validator / stake_st_policy / proposal_st_policy. The optional Phase-4 fields can be populated now or later via dao_discover_scripts (when shipped)."
)]
async fn dao_register(
&self,
@ -1326,6 +1326,14 @@ impl WalletService {
max_cosigners,
treasury_ref_config,
network,
proposal_addr,
stake_st_policy,
proposal_st_policy,
governor_validator_ref,
stake_validator_ref,
proposal_validator_ref,
stake_st_policy_ref,
proposal_st_policy_ref,
}: DaoRegisterArgs,
) -> Result<String, String> {
let cfg = DaoConfig {
@ -1344,12 +1352,17 @@ impl WalletService {
Some("preview") => DaoNetwork::Preview,
_ => DaoNetwork::Mainnet,
},
// Optional discovery fields — populated by `dao_discover_scripts`
// after registration.
proposal_addr: None,
stake_st_policy: None,
proposal_st_policy: None,
script_refs: ScriptRefs::default(),
proposal_addr,
stake_st_policy,
proposal_st_policy,
script_refs: ScriptRefs {
governor_validator: governor_validator_ref,
stake_validator: stake_validator_ref,
proposal_validator: proposal_validator_ref,
treasury_validator: None,
stake_st_policy: stake_st_policy_ref,
proposal_st_policy: proposal_st_policy_ref,
},
};
self.inner
.dao_store
@ -1680,6 +1693,38 @@ pub struct DaoRegisterArgs {
/// "mainnet" | "preprod" | "preview". Default mainnet.
#[serde(default)]
pub network: Option<String>,
// ─── Phase 4 prerequisites — all optional ─────────────────────────────
//
// Populate these to unlock dao_proposal_create_unsigned and the
// upcoming vote/cosign/advance tools. Each can be discovered via
// chain queries (the audit pattern at memory/audit-sulkta-agora-*.md);
// a future dao_discover_scripts MCP tool will fill them automatically.
/// Proposal validator address (bech32). Where new proposal UTxOs land.
#[serde(default)]
pub proposal_addr: Option<String>,
/// 56 hex chars — StakeST minting policy id.
#[serde(default)]
pub stake_st_policy: Option<String>,
/// 56 hex chars — ProposalST minting policy id.
#[serde(default)]
pub proposal_st_policy: Option<String>,
/// `txhash#index` reference UTxO carrying the governor validator script.
#[serde(default)]
pub governor_validator_ref: Option<String>,
/// `txhash#index` reference UTxO carrying the stake validator script.
#[serde(default)]
pub stake_validator_ref: Option<String>,
/// `txhash#index` reference UTxO carrying the proposal validator script.
#[serde(default)]
pub proposal_validator_ref: Option<String>,
/// `txhash#index` reference UTxO carrying the StakeST minting policy script.
#[serde(default)]
pub stake_st_policy_ref: Option<String>,
/// `txhash#index` reference UTxO carrying the ProposalST minting policy script.
#[serde(default)]
pub proposal_st_policy_ref: Option<String>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]