<commit_before>var alt = require("../alt-instance");
var SettingsActions = require("../actions/SettingsActions");
var IntlActions = require("../actions/IntlActions");
var Immutable = require("immutable");
import {merge} from "lodash";
import ls from "common/localStorage";

const CORE_ASSET = "BTS"; // Setting this to BTS to prevent loading issues when used with BTS chain which is the most usual case currently

const STORAGE_KEY = "__graphene__";
let ss = new ls(STORAGE_KEY);

class SettingsStore {
    constructor() {
        this.exportPublicMethods({getSetting: this.getSetting.bind(this)});

        this.defaultSettings = Immutable.Map({
            locale: "en",
            apiServer: "wss://bitshares.openledger.info/ws",
            faucet_address: "https://bitshares.openledger.info",
            unit: CORE_ASSET,
            showSettles: false,
            showAssetPercent: false,
            walletLockTimeout: 60 * 10,
            themes: "darkTheme",
            disableChat: false
        });

        // Default markets setup
        let topMarkets = [
            "MKR", "OPEN.MKR", "BTS", "OPEN.ETH", "ICOO", "BTC", "OPEN.LISK",
            "OPEN.STEEM", "OPEN.DAO", "PEERPLAYS", "USD", "CNY", "BTSR", "OBITS",
            "OPEN.DGD", "EUR", "TRADE.BTC", "CASH.BTC", "GOLD", "SILVER",
            "OPEN.USDT", "OPEN.EURT", "OPEN.BTC", "CADASTRAL"
        ];

        this.preferredBases = Immutable.List([CORE_ASSET, "OPEN.BTC", "USD", "CNY", "BTC"]);
        // Openledger
        // this.preferredBases = Immutable.List(["OPEN.BTC", "OPEN.ETH", "OPEN.USDT", "OPEN.EURT", CORE_ASSET]);

        function addMarkets(target, base, markets) {
            markets.filter(a => {
                return a !== base;
            }).forEach(market => {
                target.push([`${market}_${base}`, {"quote": market,"base": base}]);
            });
        }

        let defaultMarkets = [];
        this.preferredBases.forEach(base => {
            addMarkets(defaultMarkets, base, topMarkets);
        });

        // If you want a default value to be translated, add the translation to settings in locale-xx.js
        // and use an object {translate: key} in the defaults array
        let apiServer = [
            {url: "wss://bitshares.openledger.info/ws", location: "Nuremberg, Germany"},
            {url: "wss://bit.btsabc.org/ws", location: "Hong Kong"},
            {url: "wss://bts.transwiser.com/ws", location: "Hangzhou, China"},
            {url: "wss://bitshares.dacplay.org:8089/ws", location:  "Hangzhou, China"},
            {url: "wss://openledger.hk/ws", location: "Hong Kong"},
            {url: "wss://secure.freedomledger.com/ws", location: "Toronto, Canada"},
            {url: "wss://testnet.bitshares.eu/ws", location: "Frankfurt, Germany"}
        ];

        let defaults = {
            locale: [
                "en",
                "cn",
                "fr",
                "ko",
                "de",
                "es",
                "tr"
            ],
            apiServer: [],
            unit: [
                CORE_ASSET,
                "USD",
                "CNY",
                "BTC",
                "EUR",
                "GBP"
            ],<commit_msg>Update SettingsStore.js<commit_after>var alt = require("../alt-instance");
var SettingsActions = require("../actions/SettingsActions");
var IntlActions = require("../actions/IntlActions");
var Immutable = require("immutable");
import {merge} from "lodash";
import ls from "common/localStorage";

const CORE_ASSET = "BTS"; // Setting this to BTS to prevent loading issues when used with BTS chain which is the most usual case currently

const STORAGE_KEY = "__graphene__";
let ss = new ls(STORAGE_KEY);

class SettingsStore {
    constructor() {
        this.exportPublicMethods({getSetting: this.getSetting.bind(this)});

        this.defaultSettings = Immutable.Map({
            locale: "en",
            apiServer: "wss://bitshares.openledger.info/ws",
            faucet_address: "https://bitshares.openledger.info",
            unit: CORE_ASSET,
            showSettles: false,
            showAssetPercent: false,
            walletLockTimeout: 60 * 10,
            themes: "darkTheme",
            disableChat: false
        });

        // Default markets setup
        let topMarkets = [
            "MKR", "OPEN.MKR", "BTS", "OPEN.ETH", "ICOO", "BTC", "OPEN.LISK",
            "OPEN.STEEM", "OPEN.DAO", "PEERPLAYS", "USD", "CNY", "BTSR", "OBITS",
            "OPEN.DGD", "EUR", "TRADE.BTC", "CASH.BTC", "GOLD", "SILVER",
            "OPEN.USDT", "OPEN.EURT", "OPEN.BTC", "CADASTRAL"
        ];

        this.preferredBases = Immutable.List([CORE_ASSET, "OPEN.BTC", "USD", "CNY", "BTC"]);
        // Openledger
        // this.preferredBases = Immutable.List(["OPEN.BTC", "OPEN.ETH", "OPEN.USDT", "OPEN.EURT", CORE_ASSET]);

        function addMarkets(target, base, markets) {
            markets.filter(a => {
                return a !== base;
            }).forEach(market => {
                target.push([`${market}_${base}`, {"quote": market,"base": base}]);
            });
        }

        let defaultMarkets = [];
        this.preferredBases.forEach(base => {
            addMarkets(defaultMarkets, base, topMarkets);
        });

        // If you want a default value to be translated, add the translation to settings in locale-xx.js
        // and use an object {translate: key} in the defaults array
        let apiServer = [
            {url: "wss://bitshares.openledger.info/ws", location: "Nuremberg, Germany"},
            {url: "wss://bit.btsabc.org/ws", location: "Hong Kong"},
            {url: "wss://bts.transwiser.com/ws", location: "Hangzhou, China"},
            {url: "wss://bitshares.dacplay.org:8089/ws", location:  "Hangzhou, China"},
            {url: "wss://openledger.hk/ws", location: "Hong Kong"},
            {url: "wss://secure.freedomledger.com/ws", location: "Toronto, Canada"},
            {url: "wss://testnet.bitshares.eu/ws", location: "Public Testnet Server (Frankfurt, Germany)"}
        ];

        let defaults = {
            locale: [
                "en",
                "cn",
                "fr",
                "ko",
                "de",
                "es",
                "tr"
            ],
            apiServer: [],
            unit: [
                CORE_ASSET,
                "USD",
                "CNY",
                "BTC",
                "EUR",
                "GBP"
            ],
{'fraction_non_alphanumeric': 0.1558941212680825, 'fraction_numerical': 0.0024622960911049553, 'mean_word_length': 1.8987511150758252, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '7223814', 'n_tokens_mistral': 2067, 'n_tokens_neox': 1980, 'n_words': 440}