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

View File

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

View File

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