{
  "$schema": "https://farmslot.io/schemas/recipe-v1.schema.json",
  "title": "Mobile release custom-network persistence",
  "description": "Adds a custom network through native settings, proves it survives lock/unlock, and removes it.",
  "paramsSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "network": { "type": "string", "default": "PulseChain" },
      "rpc_url": { "type": "string", "default": "https://rpc.pulsechain.com" },
      "chain_id": { "type": "integer", "minimum": 1, "default": 369 },
      "symbol": { "type": "string", "default": "PLS" },
      "explorer_url": { "type": "string", "default": "https://scan.pulsechain.com" },
      "timeout_ms": { "type": "integer", "minimum": 1000, "default": 60000 }
    }
  },
  "workflow": {
    "entry": "open-wallet",
    "nodes": {
      "open-wallet": {
        "action": "ui.navigate",
        "page": "home",
        "intent": "Open the wallet before custom-network setup",
        "next": "add-network"
      },
      "add-network": {
        "action": "metamask.networks.add_custom",
        "network": "{{params.network}}",
        "rpc_url": "{{params.rpc_url}}",
        "chain_id": "{{params.chain_id}}",
        "symbol": "{{params.symbol}}",
        "explorer_url": "{{params.explorer_url}}",
        "timeout_ms": "{{params.timeout_ms}}",
        "intent": "Add the custom network through visible settings",
        "next": "assert-added"
      },
      "assert-added": {
        "action": "metamask.networks.read_visible_state",
        "network": "{{params.network}}",
        "chain_id": "{{params.chain_id}}",
        "settle_ms": 1000,
        "timeout_ms": "{{params.timeout_ms}}",
        "intent": "Prove the custom network is present",
        "next": "capture-before"
      },
      "capture-before": {
        "action": "ui.screenshot",
        "path": "screenshots/custom-network-before-lock.png",
        "label": "Custom network before lock",
        "intent": "Preserve pre-lock network evidence",
        "next": "lock-wallet"
      },
      "lock-wallet": {
        "action": "metamask.wallet.lock",
        "intent": "Lock the wallet through visible native controls",
        "next": "unlock-wallet"
      },
      "unlock-wallet": {
        "action": "metamask.wallet.ensure_unlocked",
        "intent": "Unlock the same persisted profile",
        "next": "assert-persisted"
      },
      "assert-persisted": {
        "action": "metamask.networks.read_visible_state",
        "network": "{{params.network}}",
        "chain_id": "{{params.chain_id}}",
        "settle_ms": 1000,
        "timeout_ms": "{{params.timeout_ms}}",
        "intent": "Prove the custom network survived lock and unlock",
        "next": "capture-after"
      },
      "capture-after": {
        "action": "ui.screenshot",
        "path": "screenshots/custom-network-after-unlock.png",
        "label": "Custom network after unlock",
        "intent": "Preserve post-unlock network evidence",
        "next": "remove-network"
      },
      "remove-network": {
        "action": "metamask.networks.remove_custom",
        "network": "{{params.network}}",
        "chain_id": "{{params.chain_id}}",
        "timeout_ms": "{{params.timeout_ms}}",
        "intent": "Remove the custom network and prove it is absent",
        "next": "done"
      },
      "done": { "action": "end", "status": "pass" }
    }
  }
}
