import { BaseClient, registryActions } from './chunk-ZSSNU3UF.js';

// ../admin/dist/ProtocolGovernance.js
var ProtocolGovernance = class extends BaseClient {
  registryAddress;
  entryPointAddress;
  constructor(config) {
    super(config);
    this.registryAddress = config.registryAddress;
    this.entryPointAddress = config.entryPointAddress;
  }
  // ===========================================
  // 1. Global Parameter Management
  // ===========================================
  /**
   * Update the Global Treasury Address where protocol fees are collected
   */
  async setTreasury(treasury, options) {
    throw new Error("Method not mapped to RegistryABI v1. Please verify contract capabilities.");
  }
  /**
   * Update the supported EntryPoint address
   */
  async updateEntryPoint(entryPoint, options) {
    throw new Error("Method not mapped to RegistryABI v1.");
  }
  // ===========================================
  // 2. Role & Module Governance
  // ===========================================
  /**
   * Approve a new SuperPaymaster contract address
   */
  async setSuperPaymaster(paymaster, options) {
    const registry = registryActions(this.registryAddress);
    return await registry(this.client).setSuperPaymaster({
      paymaster,
      account: options?.account
    });
  }
  /**
   * Set the Staking contract address
   */
  async setStaking(staking, options) {
    const registry = registryActions(this.registryAddress);
    return await registry(this.client).setStaking({
      staking,
      account: options?.account
    });
  }
  /**
   * Configure a Role's parameters (Admin only).
   * Reads the current on-chain config first, then merges the provided overrides
   * and writes back the full struct via configureRole.
   */
  async configureRole(params, options) {
    const registry = registryActions(this.registryAddress)(this.client);
    const current = await registry.getRoleConfig({ roleId: params.roleId });
    return await registry.configureRole({
      roleId: params.roleId,
      config: {
        ...current,
        ...params.minStake !== void 0 && { minStake: params.minStake },
        ...params.ticketPrice !== void 0 && { ticketPrice: params.ticketPrice },
        ...params.exitFeePercent !== void 0 && { exitFeePercent: params.exitFeePercent },
        ...params.minExitFee !== void 0 && { minExitFee: params.minExitFee }
      },
      account: options?.account
    });
  }
  // ===========================================
  // 3. Transfer to DAO (Exit/Upgrade)
  // ===========================================
  /**
   * Transfer Protocol Ownership to a DAO (Multisig/Timelock)
   * This is the final step of "Protocol Admin" lifecycle.
   */
  async transferToDAO(daoAddress, options) {
    const registry = registryActions(this.registryAddress);
    return await registry(this.client).transferOwnership({
      newOwner: daoAddress,
      account: options?.account
    });
  }
  // ===========================================
  // 4. Query Capabilities
  // ===========================================
  async getProtocolParams() {
    const registry = registryActions(this.registryAddress)(this.client);
    const [sp, staking] = await Promise.all([
      registry.SUPER_PAYMASTER(),
      registry.GTOKEN_STAKING()
    ]);
    return {
      minStake: 0n,
      // Global default not directly exposed, usually per role
      treasury: await registry.owner(),
      // Approximation for now
      entryPoint: this.entryPointAddress,
      superPaymaster: sp
    };
  }
};

export { ProtocolGovernance };
//# sourceMappingURL=chunk-4DVUM4MC.js.map
//# sourceMappingURL=chunk-4DVUM4MC.js.map