{
  "$schema": "https://farmslot.io/schemas/recipe-v1.schema.json",
  "title": "Reset and import a MetaMask wallet through visible UI",
  "description": "Delete the current Mobile or Extension wallet through its visible reset flow, import the primary mnemonic through onboarding, and prove a selected account is ready.",
  "paramsSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "credential_source": {
        "type": "string",
        "enum": ["auto", "environment", "fixture"],
        "default": "auto",
        "description": "Read secrets from the named environment variables first, or require one source explicitly."
      },
      "srp_env": {
        "type": "string",
        "default": "MM_HARNESS_WALLET_SRP",
        "description": "Environment variable containing the Secret Recovery Phrase; the value is never stored in the recipe or evidence."
      },
      "password_env": {
        "type": "string",
        "default": "MM_HARNESS_WALLET_PASSWORD",
        "description": "Environment variable containing the wallet password; the value is never stored in the recipe or evidence."
      },
      "metametrics": {
        "type": "boolean",
        "default": false,
        "description": "Enable MetaMetrics during visible onboarding; defaults off."
      },
      "biometrics": {
        "type": "boolean",
        "enum": [false],
        "default": false,
        "description": "Enable Mobile biometric authentication during onboarding; defaults off for unattended validation."
      },
      "notifications": {
        "type": "boolean",
        "default": false,
        "description": "Enable Mobile push notifications during onboarding; defaults off."
      },
      "skip_wallet_tour": {
        "type": "boolean",
        "default": true,
        "description": "Skip the Mobile wallet-home tour so the recipe ends at a usable wallet."
      },
      "interests": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": ["swap_tokens", "trade_perpetuals", "prediction_markets", "send_receive_crypto", "earn_and_spend", "use_other_crypto_apps"]
        },
        "default": [],
        "description": "Mobile-only onboarding interests; an empty list skips the optional questionnaire."
      },
      "timeout_ms": {
        "type": "number",
        "default": 300000,
        "description": "Maximum time for each reset/import transition and final wallet readiness."
      }
    }
  },
  "workflow": {
    "entry": "validate_import",
    "nodes": {
      "validate_import": {
        "action": "metamask.wallet.validate_import",
        "credential_source": "{{params.credential_source}}",
        "srp_env": "{{params.srp_env}}",
        "password_env": "{{params.password_env}}",
        "metametrics": "{{params.metametrics}}",
        "interests": "{{params.interests}}",
        "intent": "Validate recovery credentials before deleting the current wallet",
        "next": "reset"
      },
      "reset": {
        "action": "metamask.wallet.reset",
        "timeout_ms": "{{params.timeout_ms}}",
        "intent": "Delete the current wallet through the client-visible reset flow and reach fresh onboarding",
        "next": "import"
      },
      "import": {
        "action": "metamask.wallet.import",
        "method": "ui",
        "credential_source": "{{params.credential_source}}",
        "srp_env": "{{params.srp_env}}",
        "password_env": "{{params.password_env}}",
        "metametrics": "{{params.metametrics}}",
        "biometrics": "{{params.biometrics}}",
        "notifications": "{{params.notifications}}",
        "skip_wallet_tour": "{{params.skip_wallet_tour}}",
        "interests": "{{params.interests}}",
        "timeout_ms": "{{params.timeout_ms}}",
        "intent": "Import the primary mnemonic through visible onboarding UI",
        "next": "state"
      },
      "state": {
        "action": "metamask.wallet.read_state",
        "intent": "Prove the imported wallet has a selected account",
        "next": "done"
      },
      "done": {
        "action": "end",
        "status": "pass"
      }
    }
  }
}
