<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security;
using Stratis.Bitcoin.Common.JsonErrors;
using Microsoft.AspNetCore.Mvc;
using Stratis.Bitcoin.Wallet.Models;
using NBitcoin;
using Stratis.Bitcoin.Configuration;
using Stratis.Bitcoin.Connection;
using Stratis.Bitcoin.Notifications;

namespace Stratis.Bitcoin.Wallet.Controllers
{
    /// <summary>
    /// Controller providing operations on a wallet.
    /// </summary>
    [Route("api/[controller]")]
    public class WalletController : Controller
    {
        private readonly IWalletManager walletManager;

        private readonly IWalletSyncManager walletSyncManager;

        private readonly CoinType coinType;

        private readonly Network network;

        private readonly ConnectionManager connectionManager;

        private readonly ConcurrentChain chain;

        private readonly DataFolder dataFolder;

        public WalletController(IWalletManager walletManager, IWalletSyncManager walletSyncManager, ConnectionManager connectionManager, Network network,
            ConcurrentChain chain, DataFolder dataFolder)
        {
            this.walletManager = walletManager;
            this.walletSyncManager = walletSyncManager;
            this.connectionManager = connectionManager;
            this.network = network;
            this.coinType = (CoinType)network.Consensus.CoinType;
            this.chain = chain;
            this.dataFolder = dataFolder;
        }

        /// <summary>
        /// Creates a new wallet on the local machine.
        /// </summary>        
        /// <param name="language">The language for the words in the mnemonic. Options are: English, French, Spanish, Japanese, ChineseSimplified and ChineseTraditional. The default is 'English'.</param>
        /// <param name="wordCount">The number of words in the mnemonic. Options are: 12,15,18,21 or 24. the default is 12.</param>
        /// <returns>A JSON object containing the mnemonic created for the new wallet.</returns>
        [Route("mnemonic")]
        [HttpGet]
        public IActionResult GenerateMnemonic([FromQuery] string language = "English", int wordCount = 12)
        {
            try
            {
                Wordlist wordList;
                switch (language.ToLowerInvariant())
                {
                    case "english":
                        wordList = Wordlist.English;
                        break;
                    case "french":
                        wordList = Wordlist.French;
                        break;
                    case "spanish":
                        wordList = Wordlist.Spanish;
                        break;
                    case "japanese":<commit_msg>Fixed comments in the GenerateMnemonic method<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security;
using Stratis.Bitcoin.Common.JsonErrors;
using Microsoft.AspNetCore.Mvc;
using Stratis.Bitcoin.Wallet.Models;
using NBitcoin;
using Stratis.Bitcoin.Configuration;
using Stratis.Bitcoin.Connection;
using Stratis.Bitcoin.Notifications;

namespace Stratis.Bitcoin.Wallet.Controllers
{
    /// <summary>
    /// Controller providing operations on a wallet.
    /// </summary>
    [Route("api/[controller]")]
    public class WalletController : Controller
    {
        private readonly IWalletManager walletManager;

        private readonly IWalletSyncManager walletSyncManager;

        private readonly CoinType coinType;

        private readonly Network network;

        private readonly ConnectionManager connectionManager;

        private readonly ConcurrentChain chain;

        private readonly DataFolder dataFolder;

        public WalletController(IWalletManager walletManager, IWalletSyncManager walletSyncManager, ConnectionManager connectionManager, Network network,
            ConcurrentChain chain, DataFolder dataFolder)
        {
            this.walletManager = walletManager;
            this.walletSyncManager = walletSyncManager;
            this.connectionManager = connectionManager;
            this.network = network;
            this.coinType = (CoinType)network.Consensus.CoinType;
            this.chain = chain;
            this.dataFolder = dataFolder;
        }

        /// <summary>
        /// Generates a new mnemonic. The call can optionally specify a language and the number of words in the mnemonic.
        /// </summary>        
        /// <param name="language">The language for the words in the mnemonic. Options are: English, French, Spanish, Japanese, ChineseSimplified and ChineseTraditional. The default is 'English'.</param>
        /// <param name="wordCount">The number of words in the mnemonic. Options are: 12,15,18,21 or 24. the default is 12.</param>
        /// <returns>A JSON object containing the mnemonic generated.</returns>
        [Route("mnemonic")]
        [HttpGet]
        public IActionResult GenerateMnemonic([FromQuery] string language = "English", int wordCount = 12)
        {
            try
            {
                Wordlist wordList;
                switch (language.ToLowerInvariant())
                {
                    case "english":
                        wordList = Wordlist.English;
                        break;
                    case "french":
                        wordList = Wordlist.French;
                        break;
                    case "spanish":
                        wordList = Wordlist.Spanish;
                        break;
                    case "japanese":
{'fraction_non_alphanumeric': 0.07846262840949345, 'fraction_numerical': 0.00495926319518243, 'mean_word_length': 2.154748603351955, 'pattern_counts': {'":': 8, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3134799', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1331, 'n_words': 389}