diff --git a/package.json b/package.json index 57418fc8..3b8aa610 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "md-editor-v3": "^2.8.1", "numeral": "^2.0.6", "osmojs": "^14.0.0-rc.0", - "ping-widget": "^0.0.37", + "ping-widget": "^0.0.38", "pinia": "^2.0.28", "postcss": "^8.4.23", "qrcode": "^1.5.3", diff --git a/src/components/TxDialog.vue b/src/components/TxDialog.vue index 69f5078a..e3e83e01 100644 --- a/src/components/TxDialog.vue +++ b/src/components/TxDialog.vue @@ -8,6 +8,7 @@ const store = useTxDialog(); :sender="store.sender" :endpoint="store.endpoint" :params='store.params' + :hd-path="store.hdPaths" @view="store.view" @confirmed="store.confirmed" > diff --git a/src/stores/useBlockchain.ts b/src/stores/useBlockchain.ts index 30373c3a..ae60f4f7 100644 --- a/src/stores/useBlockchain.ts +++ b/src/stores/useBlockchain.ts @@ -43,11 +43,7 @@ export const useBlockchain = defineStore('blockchain', { }, defaultHDPath(): string { const cointype = this.current?.coinType || '118'; - // if(cointype === "60") { - // return `m/44'/${cointype}` - // } return `m/44'/${cointype}/0'/0/0`; - //return "connected-wallet" }, dashboard() { return useDashboard(); diff --git a/src/stores/useTxDialog.ts b/src/stores/useTxDialog.ts index efb813d6..b0196682 100644 --- a/src/stores/useTxDialog.ts +++ b/src/stores/useTxDialog.ts @@ -23,7 +23,10 @@ export const useTxDialog = defineStore('txDialogStore', { }, blockchain() { return useBlockchain() - } + }, + hdPaths() { + return useBlockchain().defaultHDPath + }, }, actions: { setParams(param: any) { diff --git a/src/stores/useWalletStore.ts b/src/stores/useWalletStore.ts index a7cb9e77..58502a94 100644 --- a/src/stores/useWalletStore.ts +++ b/src/stores/useWalletStore.ts @@ -18,7 +18,7 @@ export const useWalletStore = defineStore('walletStore', { delegations: [] as Delegation[], unbonding: [] as UnbondingResponses[], rewards: {total: [], rewards: []} as DelegatorRewards, - walletIsConnected: {} as WalletConnected + wallet: {} as WalletConnected }; }, getters: { @@ -26,12 +26,13 @@ export const useWalletStore = defineStore('walletStore', { return useBlockchain(); }, connectedWallet() { + // @ts-ignore + if(this.wallet.cosmosAddress) return this.wallet + console.log("orrect", this.wallet) const chainStore = useBlockchain(); const key = chainStore.defaultHDPath; - let connected = {} as WalletConnected - if (!this.walletIsConnected?.cosmosAddress){ - connected = JSON.parse(localStorage.getItem(key) || '{}'); - } + const connected = JSON.parse(localStorage.getItem(key) || '{}'); + console.log("connected:", connected) return connected }, balanceOfStakingToken(): Coin { @@ -62,7 +63,6 @@ export const useWalletStore = defineStore('walletStore', { }, unbondingAmount() { let amt = 0; - let denom = ''; this.unbonding.forEach((i) => { i.entries.forEach((e) => { amt += Number(e.balance); @@ -123,17 +123,11 @@ export const useWalletStore = defineStore('walletStore', { disconnect() { const chainStore = useBlockchain(); const key = chainStore.defaultHDPath; - console.log(key, 'key') - console.log(localStorage.getItem(key)) localStorage.removeItem(key); this.$reset() }, - setConnectedWallet(value: any) { - const chainStore = useBlockchain(); - const key = chainStore.defaultHDPath; - this.walletIsConnected = value || {} - // JSON.parse(localStorage.getItem(key) || '{}'); - return this.walletIsConnected + setConnectedWallet(value: WalletConnected) { + if(value) this.wallet = value }, suggestChain() { // const router = useRouter() diff --git a/yarn.lock b/yarn.lock index 9ca11294..b254c7c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5675,10 +5675,10 @@ ping-widget@^0.0.33: vue "^3.2.47" vue3-webcomponent-wrapper "^0.2.0" -ping-widget@^0.0.37: - version "0.0.37" - resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.37.tgz#2829442ce171ab8a50450910ea5b99a8bbb86b97" - integrity sha512-+dh+50NbVTLmcis57YT+XGWrrNn0GXkpivCHE14KzV0xwIXGx1gZSLQp1g2jEu4Y2ud0k/NbQMxFP4aJH/XOVg== +ping-widget@^0.0.38: + version "0.0.38" + resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.38.tgz#ab25e3f24d1b53002c552a181431a96f4340a1e8" + integrity sha512-x1VwKvV71Ds7BW1U4RiGCYVVb45XU4M/b09j2wpt8MdMZ8uo5y1eFnwsABJfGVQV2MuBSgXg626uhfCIBkH3TQ== dependencies: "@cosmjs/amino" "^0.30.1" "@cosmjs/cosmwasm-stargate" "^0.30.1"