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


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


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;
   }

}

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




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