Merge pull request #19 from ping-pub/master

merge
This commit is contained in:
Alisa 2023-06-09 11:07:40 +08:00 committed by GitHub
commit 8dc462c15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 24 deletions

View File

@ -35,7 +35,7 @@
"md-editor-v3": "^2.8.1", "md-editor-v3": "^2.8.1",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"osmojs": "^14.0.0-rc.0", "osmojs": "^14.0.0-rc.0",
"ping-widget": "^0.0.35", "ping-widget": "^0.0.38",
"pinia": "^2.0.28", "pinia": "^2.0.28",
"postcss": "^8.4.23", "postcss": "^8.4.23",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",

View File

@ -8,6 +8,7 @@ const store = useTxDialog();
:sender="store.sender" :sender="store.sender"
:endpoint="store.endpoint" :endpoint="store.endpoint"
:params='store.params' :params='store.params'
:hd-path="store.hdPaths"
@view="store.view" @view="store.view"
@confirmed="store.confirmed" @confirmed="store.confirmed"
></ping-tx-dialog> ></ping-tx-dialog>

View File

@ -26,7 +26,7 @@ const chains = computed(() => {
</script> </script>
<template> <template>
<div class=""> <div class="">
<div class="flex flex-col md:flex-row items-center justify-center mb-6 mt-14 gap-3"> <div class="flex md:!flex-row flex-col items-center justify-center mb-6 mt-14 gap-2">
<div class="w-16 rounded-full"> <div class="w-16 rounded-full">
<img src="/logo.svg" /> <img src="/logo.svg" />
</div> </div>
@ -53,7 +53,7 @@ const chains = computed(() => {
<div class="flex items-center rounded-lg bg-base-100 border border-gray-200 dark:border-gray-700 mt-10"> <div class="flex items-center rounded-lg bg-base-100 border border-gray-200 dark:border-gray-700 mt-10">
<Icon icon="mdi:magnify" class="text-2xl text-gray-400 ml-3"/> <Icon icon="mdi:magnify" class="text-2xl text-gray-400 ml-3"/>
<input :placeholder="$t('index.search_placeholder')" class="px-4 h-10 bg-transparent flex-1 outline-none text-base" v-model="keywords" /> <input :placeholder="$t('index.search_placeholder')" class="px-4 h-10 bg-transparent flex-1 outline-none text-base" v-model="keywords" />
<div class="px-4 text-base hidden md:block">{{ chains.length }}/{{ dashboard.length }}</div> <div class="px-4 text-base hidden md:!block">{{ chains.length }}/{{ dashboard.length }}</div>
</div> </div>
<div <div

View File

@ -48,11 +48,7 @@ export const useBlockchain = defineStore('blockchain', {
}, },
defaultHDPath(): string { defaultHDPath(): string {
const cointype = this.current?.coinType || '118'; const cointype = this.current?.coinType || '118';
// if(cointype === "60") {
// return `m/44'/${cointype}`
// }
return `m/44'/${cointype}/0'/0/0`; return `m/44'/${cointype}/0'/0/0`;
//return "connected-wallet"
}, },
dashboard() { dashboard() {
return useDashboard(); return useDashboard();

View File

@ -23,7 +23,10 @@ export const useTxDialog = defineStore('txDialogStore', {
}, },
blockchain() { blockchain() {
return useBlockchain() return useBlockchain()
} },
hdPaths() {
return useBlockchain().defaultHDPath
},
}, },
actions: { actions: {
setParams(param: any) { setParams(param: any) {

View File

@ -18,7 +18,7 @@ export const useWalletStore = defineStore('walletStore', {
delegations: [] as Delegation[], delegations: [] as Delegation[],
unbonding: [] as UnbondingResponses[], unbonding: [] as UnbondingResponses[],
rewards: {total: [], rewards: []} as DelegatorRewards, rewards: {total: [], rewards: []} as DelegatorRewards,
walletIsConnected: {} as WalletConnected wallet: {} as WalletConnected
}; };
}, },
getters: { getters: {
@ -26,12 +26,13 @@ export const useWalletStore = defineStore('walletStore', {
return useBlockchain(); return useBlockchain();
}, },
connectedWallet() { connectedWallet() {
// @ts-ignore
if(this.wallet.cosmosAddress) return this.wallet
console.log("orrect", this.wallet)
const chainStore = useBlockchain(); const chainStore = useBlockchain();
const key = chainStore.defaultHDPath; const key = chainStore.defaultHDPath;
let connected = {} as WalletConnected const connected = JSON.parse(localStorage.getItem(key) || '{}');
if (!this.walletIsConnected?.cosmosAddress){ console.log("connected:", connected)
connected = JSON.parse(localStorage.getItem(key) || '{}');
}
return connected return connected
}, },
balanceOfStakingToken(): Coin { balanceOfStakingToken(): Coin {
@ -62,7 +63,6 @@ export const useWalletStore = defineStore('walletStore', {
}, },
unbondingAmount() { unbondingAmount() {
let amt = 0; let amt = 0;
let denom = '';
this.unbonding.forEach((i) => { this.unbonding.forEach((i) => {
i.entries.forEach((e) => { i.entries.forEach((e) => {
amt += Number(e.balance); amt += Number(e.balance);
@ -126,12 +126,8 @@ export const useWalletStore = defineStore('walletStore', {
localStorage.removeItem(key); localStorage.removeItem(key);
this.$reset() this.$reset()
}, },
setConnectedWallet(value: any) { setConnectedWallet(value: WalletConnected) {
const chainStore = useBlockchain(); if(value) this.wallet = value
const key = chainStore.defaultHDPath;
this.walletIsConnected = value || {}
// JSON.parse(localStorage.getItem(key) || '{}');
return this.walletIsConnected
}, },
suggestChain() { suggestChain() {
// const router = useRouter() // const router = useRouter()

View File

@ -5675,10 +5675,10 @@ ping-widget@^0.0.33:
vue "^3.2.47" vue "^3.2.47"
vue3-webcomponent-wrapper "^0.2.0" vue3-webcomponent-wrapper "^0.2.0"
ping-widget@^0.0.35: ping-widget@^0.0.38:
version "0.0.35" version "0.0.38"
resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.35.tgz#646c1680021f0575f144ea943afe5ba551e1b7ea" resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.38.tgz#ab25e3f24d1b53002c552a181431a96f4340a1e8"
integrity sha512-u9Hd51jmEMLgvDKNBFmNMI1gFC0D0Nn5/0qtcWr+FZsbLfmj1bIF62p+D6gt367l/QS4/UlxqyA0SfpW34OzSw== integrity sha512-x1VwKvV71Ds7BW1U4RiGCYVVb45XU4M/b09j2wpt8MdMZ8uo5y1eFnwsABJfGVQV2MuBSgXg626uhfCIBkH3TQ==
dependencies: dependencies:
"@cosmjs/amino" "^0.30.1" "@cosmjs/amino" "^0.30.1"
"@cosmjs/cosmwasm-stargate" "^0.30.1" "@cosmjs/cosmwasm-stargate" "^0.30.1"