All files / src/store/web3 mutations.ts

100% Statements 9/9
100% Branches 2/2
100% Functions 5/5
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 302x   2x           3x       5x       5x       4x     4x 4x       2x  
import { SUPPORTED_NETWORK } from "src/contracts/contract";
import { MutationTree } from "vuex";
import { Web3MutationName } from "./names";
import { Web3State } from "./state";
 
const mutations: MutationTree<Web3State> = {
  // Mutations to set initialized
  [Web3MutationName.setInitialized](state, initialized: boolean) {
    state.initialized = initialized;
  },
  // Mutations to set loading
  [Web3MutationName.setLoading](state, loading: boolean) {
    state.loading = loading;
  },
  // Mutations to set status
  [Web3MutationName.setStatus](state, status: "login" | "logout" | "loading") {
    state.status = status;
  },
  // Mutations to set message
  [Web3MutationName.setMessage](state, message: string) {
    state.message = message;
  },
  [Web3MutationName.setNetwork](state, network: number) {
    state.network = network;
    state.networkName = SUPPORTED_NETWORK[network] || "";
  }
};
 
export default mutations;