add suggest chain

This commit is contained in:
liangping 2023-05-28 20:57:03 +08:00
parent 8e6d1430de
commit a4b7216096
3 changed files with 10 additions and 3 deletions

View File

@ -99,7 +99,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
</div>
<div
v-if="item?.badgeContent"
class="mr-6 badge badge-sm"
class="mr-6 badge badge-sm text-white"
:class="item?.badgeClass"
>
{{ item?.badgeContent }}
@ -175,7 +175,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
</div>
<div
v-if="item?.badgeContent"
class="badge badge-sm"
class="badge badge-sm text-white"
:class="item?.badgeClass"
>
{{ item?.badgeContent }}

View File

@ -1,7 +1,8 @@
<script setup lang="ts">
import { useBaseStore, useBlockchain, useWalletStore } from '@/stores';
import { Icon } from '@iconify/vue';
import { ref, computed } from 'vue';
import { ref, computed, } from 'vue';
const walletStore = useWalletStore();
const chainStore = useBlockchain();
const baseStore = useBaseStore();
@ -108,6 +109,7 @@ const tipMsg = computed(() => {
:chain-id="baseStore.currentChainId"
:hd-path="chainStore.defaultHDPath"
@connect="walletStateChange"
@keplr-config="walletStore.suggestChain()"
/>
</Teleport>
</template>

View File

@ -9,6 +9,7 @@ import type {
WalletConnected,
} from '@/types';
import { useStakingStore } from './useStakingStore';
import router from '@/router'
export const useWalletStore = defineStore('walletStore', {
state: () => {
@ -133,6 +134,10 @@ export const useWalletStore = defineStore('walletStore', {
this.walletIsConnected = value || {}
// JSON.parse(localStorage.getItem(key) || '{}');
return this.walletIsConnected
},
suggestChain() {
// const router = useRouter()
router.push({path: '/wallet/keplr'})
}
},
});