Created
March 14, 2022 07:02
-
-
Save duartefdias/a548a185ce811772fe22bcd9a7531fb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const state = () => ({ | |
metamaskConnected: false, | |
ethereum: null, | |
accounts: [] | |
}) | |
export const mutations = { | |
setMetamaskConnected(state, value) { | |
state.metamaskConnected = value | |
}, | |
setEthereum(state, value) { | |
state.ethereum = value | |
}, | |
setAccounts(state, value) { | |
state.accounts = value | |
} | |
} | |
export const getters = { | |
metamaskConnected: state => state.metamaskConnected, | |
ethereum: state => { if(process.client) { return window.ethereum } }, | |
getFirstAccount: state => { return state.accounts[0] } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment