2020-10-30 09:01:41 +01:00
|
|
|
<template>
|
2020-11-03 07:54:19 +01:00
|
|
|
<div class="modal-card box box-modal">
|
|
|
|
<header class="box-modal-header is-spaced">
|
|
|
|
<div class="box-modal-title">{{ $t('yourWallet') }}</div>
|
|
|
|
<button type="button" class="delete" @click="$emit('close')" />
|
|
|
|
</header>
|
2020-10-30 09:01:41 +01:00
|
|
|
<div class="note">
|
|
|
|
{{ $t('pleaseSelectYourWeb3Wallet') }}
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="field is-grouped is-grouped-centered is-grouped-multiline wallets"
|
|
|
|
>
|
2020-11-03 07:54:19 +01:00
|
|
|
<!-- <div v-show="isGeneric" class="control">
|
2020-10-30 09:01:41 +01:00
|
|
|
<button
|
|
|
|
class="button is-small is-black is-generic"
|
|
|
|
@click="_web3Connect('generic')"
|
|
|
|
>
|
|
|
|
{{ $t('otherWallet') }}
|
|
|
|
</button>
|
2020-11-03 07:54:19 +01:00
|
|
|
</div> -->
|
|
|
|
<div class="control">
|
|
|
|
<b-tooltip
|
|
|
|
:label="$t('pleaseInstallMetamask')"
|
|
|
|
position="is-top"
|
|
|
|
:active="!isMetamask"
|
|
|
|
multilined
|
2020-10-30 09:01:41 +01:00
|
|
|
>
|
2020-11-03 07:54:19 +01:00
|
|
|
<button
|
|
|
|
:disabled="!isMetamask"
|
|
|
|
class="button is-small is-black is-metamask"
|
|
|
|
@click="_web3Connect('metamask')"
|
|
|
|
>
|
|
|
|
Metamask
|
|
|
|
</button>
|
|
|
|
</b-tooltip>
|
|
|
|
</div>
|
|
|
|
<div v-show="isTrust" class="control">
|
2020-10-30 09:01:41 +01:00
|
|
|
<button
|
|
|
|
class="button is-small is-black is-trustwallet"
|
|
|
|
@click="_web3Connect('trustwallet')"
|
|
|
|
>
|
|
|
|
Trust Wallet
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
isMetamask() {
|
|
|
|
return window.web3 && window.web3.currentProvider.isMetaMask
|
|
|
|
},
|
2020-11-03 07:54:19 +01:00
|
|
|
// isGeneric() {
|
|
|
|
// return (
|
|
|
|
// !this.isMetamask && !this.isTrust && (window.web3 || window.ethereum)
|
|
|
|
// )
|
|
|
|
// },
|
2020-10-30 09:01:41 +01:00
|
|
|
isTrust() {
|
|
|
|
return window.web3 && window.web3.currentProvider.isTrust
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2020-11-05 11:17:59 +01:00
|
|
|
async _web3Connect(name, network) {
|
2020-10-30 09:01:41 +01:00
|
|
|
this.$store.dispatch('loading/enable', {})
|
|
|
|
try {
|
2020-11-03 12:48:03 +01:00
|
|
|
await this.$store.dispatch(
|
|
|
|
'provider/initProvider',
|
|
|
|
{ name, network },
|
|
|
|
{ root: true }
|
|
|
|
)
|
2020-11-05 11:17:59 +01:00
|
|
|
this.$store.dispatch('steps/fetchDeploymentStatus', {})
|
2020-10-30 09:01:41 +01:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
|
|
|
}
|
|
|
|
this.$store.dispatch('loading/disable')
|
|
|
|
this.$parent.close()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|