Created
March 8, 2018 13:40
-
-
Save kyriediculous/95af1fea9ecf4b1b65e0f2e19d8047ea 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
<template> | |
<div class='metamask-info'> | |
<p v-if="isInjected" id="has-metamask"><i aria-hidden="true" class="fa fa-check"></i> Metamask installed</p> | |
<p v-else id="no-metamask"><i aria-hidden="true" class="fa fa-times"></i> Metamask not found</p> | |
<p>Network: {{ network }}</p> | |
<p>Account: {{ coinbase }}</p> | |
<p>Balance: {{ balance }} Wei </p> | |
</div> | |
</template> | |
<script> | |
import {NETWORKS} from '../util/constants/networks' | |
import {mapState} from 'vuex' | |
export default { | |
name: 'hello-metamask', | |
computed: mapState({ | |
isInjected: state => state.web3.isInjected, | |
network: state => NETWORKS[state.web3.networkId], | |
coinbase: state => state.web3.coinbase, | |
balance: state => state.web3.balance | |
}) | |
} | |
</script> | |
<style scoped> | |
#has-metamask { | |
color: green; | |
} | |
#no-metamask { | |
color:red; | |
}</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment