import { init } from '@/api/demoMETAMASK'


const state = {
    currentWalletAddress: '',
    interfaceSignature: '',
    expireTime: '',
    showConnectWalletModal: false,
    
};


const mutations = {
  SET_CURRENT_WALLET_ADDRESS:  (state, address) => {
    state.currentWalletAddress = address;
  },
  SET_INTERFACE_SIGNATURE: (state, signature) => {
    state.interfaceSignature = signature;
  },
  SET_EXPIRE_TIME: (state, expireTime) => {
    state.expireTime = expireTime;
  },
  CHANGE_CONNECT_WALLET_MODAL_STATUS: (state, status) => {
    console.log('--status', status);
    state.showConnectWalletModal = status;
  },

}

const actions = {
    async connectWallet({commit, state, dispatch}){
         const { address } = await init();
         commit('SET_CURRENT_WALLET_ADDRESS', address);
    }
}




export default {
    namespaced: true,
    state,
    mutations,
    actions
  }
  