Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enables MetaMask snap only in dev mode #952

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/components/header/modals/ModalConnectWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</span>
</div>
<div class="wrapper--wallets">
<div
<button
v-for="(wallet, index) in evmWallets"
:key="index"
class="box__row--wallet box--hover--active"
Expand All @@ -29,7 +29,7 @@
{{ castWalletName(wallet.name) }}
</span>
</div>
</div>
</button>
</div>
</div>
<div>
Expand All @@ -39,12 +39,13 @@
</span>
</div>
<div class="wrapper--wallets">
<div
<button
v-for="(wallet, index) in nativeWallets"
:key="index"
:disabled="checkIsDisabledWallet(wallet.source)"
class="box__row--wallet box--hover--active"
:class="currentWallet === wallet.source && 'border--active'"
@click="setSubstrateWalletModal(wallet.source)"
@click="!checkIsDisabledWallet(wallet.source) && setSubstrateWalletModal(wallet.source)"
>
<div class="box--img">
<img :src="wallet.img" />
Expand All @@ -54,7 +55,7 @@
{{ castWalletName(wallet.name) }}
</span>
</div>
</div>
</button>
</div>
<div v-if="selWallet && isNoExtension" class="box--no-extension">
<div class="title--no-extension">
Expand Down Expand Up @@ -108,7 +109,7 @@
</span>
</div>
<div class="wrapper--wallets">
<div
<button
class="box__row--wallet box--hover--active"
:class="currentWallet === SupportMultisig.Polkasafe && 'border--active'"
@click="setPolkasafeModal()"
Expand All @@ -122,7 +123,7 @@
<div>
<span> PolkaSafe </span>
</div>
</div>
</button>
</div>
</div>
<button :disabled="!currentAccountName" class="btn--disconnect" @click="disconnectAccount()">
Expand Down Expand Up @@ -198,6 +199,13 @@ export default defineComponent({
props.setCloseModal();
};

const checkIsDisabledWallet = (source: SupportWallet): boolean => {
if (!process.env.DEV && source === SupportWallet.Snap) {
return true;
}
return false;
};

const nativeWallets = computed(() => {
return supportWallets
.map((it) => {
Expand Down Expand Up @@ -290,6 +298,7 @@ export default defineComponent({
setEvmWalletModal,
disconnectAccount,
setPolkasafeModal,
checkIsDisabledWallet,
currentNetworkIdx,
endpointKey,
};
Expand Down
Loading