{"size": 1286, "ext": "js", "max_stars_repo_path": "src/store/store.js", "max_stars_repo_name": "lanhaoxiang/ScatterWebExtension", "max_stars_repo_stars_event_min_datetime": "2019-06-10T08:44:48.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-07T01:57:21.000Z", "max_issues_repo_path": "src/store/store.js", "max_issues_repo_name": "lanhaoxiang/ScatterWebExtension", "max_issues_repo_issues_event_min_datetime": "2019-02-26T15:21:25.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-30T10:10:58.000Z", "max_forks_repo_path": "src/store/store.js", "max_forks_repo_name": "lanhaoxiang/ScatterWebExtension", "max_forks_repo_forks_event_min_datetime": "2018-12-17T09:04:20.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-13T23:52:40.000Z"}
{"max_stars_count": 13, "max_issues_count": 14, "max_forks_count": 4, "avg_line_length": 27.9565217391, "max_line_length": 101, "alphanum_fraction": 0.6850699844}
import Vue from 'vue';
import Vuex from 'vuex';

import { mutations } from './mutations';
import { actions } from './actions';

import { IdentityRequiredFields } from '../models/Identity';

Vue.use(Vuex);

const state = {
    scatter: null,
    mnemonic: null,

    alerts: [],
    alertResult: null,

    prompt: null,
};

const getters = {
    meta: state => state.scatter.meta,
    identities: state => state.scatter.keychain.identities,
    permissions: state => state.scatter.keychain.permissions,
    keypairs: state => state.scatter.keychain.keypairs,
    networks: state => state.scatter.settings.networks,
    supportNetworks: (state, getters) => {
        return getters.networks.filter(network => network.blockchain === 'gxc')
    },
    histories: state => state.scatter.histories,
    autoLockInterval: state => state.scatter.settings.inactivityInterval,
    language: state => state.scatter.settings.language,

    // FOR PROMPTS ONLY
    identityFields: state => IdentityRequiredFields.fromJson(state.prompt.data),
    requiredFields: state => IdentityRequiredFields.fromJson(state.prompt.data.requiredFields || {}),
    messages: state => state.prompt.data.messages || [],
};

export const store = new Vuex.Store({
    state,
    getters,
    mutations,
    actions
});
