fix: merge conflicts

This commit is contained in:
Alisa | Side.one 2023-06-12 17:11:10 +08:00
commit b7224b5387
12 changed files with 222 additions and 24 deletions

View File

@ -17,6 +17,7 @@
"@cosmjs/encoding": "^0.29.5",
"@iconify/vue": "^4.1.0",
"@intlify/unplugin-vue-i18n": "^0.8.2",
"@leapwallet/name-matcha": "^1.1.0",
"@osmonauts/lcd": "^0.8.0",
"@ping-pub/chain-registry-client": "^0.0.25",
"@vitejs/plugin-vue-jsx": "^3.0.0",

View File

@ -18,16 +18,8 @@ const header = computed(() => {
});
</script>
<template>
<div class="overflow-auto h-[500px] p-4">
<div
v-if="header.length > 0"
class="table table-compact w-full"
density="compact"
:height="value.length > 5? '300px': ''"
fixed-header
hover
>
<div class="overflow-auto p-4 " :class=" value.length > 5 ? 'h-[500px]': ''">
<table class="table table-compact w-full">
<thead v-if="thead">
<tr>
<th
@ -46,8 +38,6 @@ const header = computed(() => {
</td>
</tr>
</tbody>
</div>
<div v-else class="h-[300px]"></div>
</table>
</div>
</template>

View File

@ -9,7 +9,7 @@ const props = defineProps(['value']);
<tbody>
<tr v-for="(v, k) of value">
<td
class="text-capitalize whitespace-break-spaces w-1/5"
class="capitalize whitespace-break-spaces w-1/5"
style="min-width: 180px"
>
{{ String(k).replaceAll('_', ' ') }}

View File

@ -12,7 +12,7 @@ const changeTab = (val: string) => {
<div>
<div class="tabs">
<a
class="tab tab-bordered text-gray-400 uppercase"
class="tab tab-bordered text-gray-400 capitalize"
v-for="(item, index) of value"
:value="index"
:class="{ 'tab-active': tab === String(index) }"

View File

@ -1,8 +1,11 @@
<script lang="ts" setup>
import { useFormatter } from '@/stores';
import { isBech32Address } from '@/libs/utils';
import { useBlockchain, useFormatter } from '@/stores';
import MdEditor from 'md-editor-v3';
import { computed } from 'vue';
import { computed, onMounted, ref } from 'vue';
import nameMatcha from '@leapwallet/name-matcha'
const chainStore = useBlockchain()
const props = defineProps(['value']);
const format = useFormatter();
function isMD() {
@ -15,16 +18,33 @@ function isMD() {
return false;
}
function isAddress() {
return isBech32Address(props.value) && String(props.value).indexOf('valoper1') === -1
}
const text = computed(() => {
if(!props.value) return ""
const v = props.value
switch(true) {
case v.length === 28 && v.endsWith("="): {
return format.validator(v)
return format.validator(v) || v
}
// 2023-06-12T03:09:38.253756368Z
case v.search(/^[1-9]\d{3}-\d{1,2}-\d{1,2}T\d{1,2}:\d{2}:\d{2}[.\d]*Z$/g) > -1: {
return new Date(v).toLocaleString(navigator.language)
}
}
return v
})
const names = ref([] as {name?: string | null, provider?: string}[])
onMounted(() => {
if(isAddress()) nameMatcha.lookupAll(props.value).then(re => {
names.value = Object.keys(re).map(key => ({name: re[key], provider: key})).filter( x => x.name)
})
})
</script>
<template>
<MdEditor
@ -33,6 +53,15 @@ const text = computed(() => {
previewOnly
class="md-editor-recover"
></MdEditor>
<span v-else-if="isAddress()" class="flex">
<RouterLink :to="`/${chainStore.chainName}/account/${text}`">{{ text }}</RouterLink>
<div v-for="{name, provider} in names">
<span class="text-xs truncate relative py-1 px-2 p2-4 w-fit ml-2 rounded text-success tooltip" :data-tip="provider" :title="provider">
<span class="inset-x-0 inset-y-0 opacity-10 absolute bg-success"></span>
<button>{{ name }}</button>
</span>
</div>
</span>
<span v-else>{{ text }}</span>
</template>

View File

@ -0,0 +1,10 @@
<script lang="ts" setup>
const props = defineProps(['value']);
</script>
<template>
<div class="overflow-auto">
{{ value["amount"] }} {{ value["denom"] }}
</div>
</template>

View File

@ -3,7 +3,7 @@ import TextElement from './TextElement.vue';
import ArrayElement from './ArrayElement.vue';
import UInt8Array from './UInt8Array.vue';
import NumberElement from './NumberElement.vue';
import TxsElement from './TxsElement.vue';
import TokenElement from './TokenElement.vue';
import ObjectHorizontalElement from './ObjectHorizontalElement.vue';
import Long from 'long';
@ -31,6 +31,9 @@ function selectObject(v: Object, direct?: string) {
return UInt8Array;
case Array.isArray(v):
return ArrayElement;
case v && Object.keys(v).includes('amount') && Object.keys(v).includes('denom'): {
return TokenElement;
}
case direct === 'horizontal':
return ObjectHorizontalElement;
default:

View File

@ -103,6 +103,12 @@ export function isHexAddress(v: any) {
return v.length === 28;
}
export function isBech32Address(v?: string) {
if(!v) return ""
const pattern = /^[a-z\d]+1[a-z\d]{38}$/g
return v.search(pattern) > -1
}
export function hexToRgb(hex: string) {
// remove '#'
hex = hex.replace('#', '');

View File

@ -56,7 +56,7 @@ const messages = computed(() => {
<tr>
<td>Time</td>
<td>
{{ tx.tx_response.timestamp }} ({{
{{ format.toLocaleDate(tx.tx_response.timestamp) }} ({{
format.toDay(tx.tx_response.timestamp, 'from')
}})
</td>
@ -92,9 +92,8 @@ const messages = computed(() => {
<h2 class="card-title truncate mb-2">
Messages: ({{ messages.length }})
</h2>
<div class="divider"></div>
<div v-for="(msg, i) in messages">
<div>
<div class="border border-slate-400 rounded-md mt-4">
<DynamicComponent :value="msg" />
</div>
</div>

View File

@ -278,7 +278,9 @@ export const useDashboard = defineStore('dashboard', {
},
loadingPrices() {
const coinIds = [] as string[]
Object.keys(this.favoriteMap).forEach(k => {
const keys = Object.keys(this.chains) // load all blockchain
// Object.keys(this.favoriteMap) //only load favorite once it has too many chains
keys.forEach(k => {
if(this.chains[k]) this.chains[k].assets.forEach(a => {
if(a.coingecko_id !== undefined && a.coingecko_id.length > 0) {
coinIds.push(a.coingecko_id)

View File

@ -236,6 +236,10 @@ export const useFormatter = defineStore('formatter', {
numberAndSign(input: number, fmt = '+0,0') {
return numeral(input).format(fmt);
},
toLocaleDate(time?: string | number | Date) {
if(!time) return ""
return new Date(time).toLocaleString(navigator.language)
},
toDay(time?: string | number| Date, format = 'long') {
if (!time) return '';
if (format === 'long') {

156
yarn.lock
View File

@ -1256,6 +1256,33 @@
"@cosmjs/math" "^0.29.3"
"@cosmjs/utils" "^0.29.3"
"@cosmjs/amino@^0.30.0", "@cosmjs/amino@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.30.1.tgz#7c18c14627361ba6c88e3495700ceea1f76baace"
integrity sha512-yNHnzmvAlkETDYIpeCTdVqgvrdt1qgkOXwuRVi8s27UKI5hfqyE9fJ/fuunXE6ZZPnKkjIecDznmuUOMrMvw4w==
dependencies:
"@cosmjs/crypto" "^0.30.1"
"@cosmjs/encoding" "^0.30.1"
"@cosmjs/math" "^0.30.1"
"@cosmjs/utils" "^0.30.1"
"@cosmjs/cosmwasm-stargate@0.30.0":
version "0.30.0"
resolved "https://registry.yarnpkg.com/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.30.0.tgz#b03c6c1383ef658695fcb02e6e1f4df2ddbd4710"
integrity sha512-nPJWpwSGpc15K88/9uxZmolEbixkeGzmxpTv6IbMAH23LXeJs7P+tXtgPe41ZjUw8Lt9Zc7ZOaOAqVveqqRktQ==
dependencies:
"@cosmjs/amino" "^0.30.0"
"@cosmjs/crypto" "^0.30.0"
"@cosmjs/encoding" "^0.30.0"
"@cosmjs/math" "^0.30.0"
"@cosmjs/proto-signing" "^0.30.0"
"@cosmjs/stargate" "^0.30.0"
"@cosmjs/tendermint-rpc" "^0.30.0"
"@cosmjs/utils" "^0.30.0"
cosmjs-types "^0.7.1"
long "^4.0.0"
pako "^2.0.2"
"@cosmjs/crypto@^0.29.3", "@cosmjs/crypto@^0.29.5":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.29.5.tgz"
@ -1269,6 +1296,19 @@
elliptic "^6.5.4"
libsodium-wrappers "^0.7.6"
"@cosmjs/crypto@^0.30.0", "@cosmjs/crypto@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.30.1.tgz#21e94d5ca8f8ded16eee1389d2639cb5c43c3eb5"
integrity sha512-rAljUlake3MSXs9xAm87mu34GfBLN0h/1uPPV6jEwClWjNkAMotzjC0ab9MARy5FFAvYHL3lWb57bhkbt2GtzQ==
dependencies:
"@cosmjs/encoding" "^0.30.1"
"@cosmjs/math" "^0.30.1"
"@cosmjs/utils" "^0.30.1"
"@noble/hashes" "^1"
bn.js "^5.2.0"
elliptic "^6.5.4"
libsodium-wrappers "^0.7.6"
"@cosmjs/encoding@^0.29.3", "@cosmjs/encoding@^0.29.5":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.29.5.tgz"
@ -1278,6 +1318,15 @@
bech32 "^1.1.4"
readonly-date "^1.0.0"
"@cosmjs/encoding@^0.30.0", "@cosmjs/encoding@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.30.1.tgz#b5c4e0ef7ceb1f2753688eb96400ed70f35c6058"
integrity sha512-rXmrTbgqwihORwJ3xYhIgQFfMSrwLu1s43RIK9I8EBudPx3KmnmyAKzMOVsRDo9edLFNuZ9GIvysUCwQfq3WlQ==
dependencies:
base64-js "^1.3.0"
bech32 "^1.1.4"
readonly-date "^1.0.0"
"@cosmjs/json-rpc@^0.29.5":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.29.5.tgz"
@ -1286,6 +1335,14 @@
"@cosmjs/stream" "^0.29.5"
xstream "^11.14.0"
"@cosmjs/json-rpc@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.30.1.tgz#16f21305fc167598c8a23a45549b85106b2372bc"
integrity sha512-pitfC/2YN9t+kXZCbNuyrZ6M8abnCC2n62m+JtU9vQUfaEtVsgy+1Fk4TRQ175+pIWSdBMFi2wT8FWVEE4RhxQ==
dependencies:
"@cosmjs/stream" "^0.30.1"
xstream "^11.14.0"
"@cosmjs/math@^0.29.3", "@cosmjs/math@^0.29.5":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/math/-/math-0.29.5.tgz"
@ -1293,6 +1350,13 @@
dependencies:
bn.js "^5.2.0"
"@cosmjs/math@^0.30.0", "@cosmjs/math@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.30.1.tgz#8b816ef4de5d3afa66cb9fdfb5df2357a7845b8a"
integrity sha512-yaoeI23pin9ZiPHIisa6qqLngfnBR/25tSaWpkTm8Cy10MX70UF5oN4+/t1heLaM6SSmRrhk3psRkV4+7mH51Q==
dependencies:
bn.js "^5.2.0"
"@cosmjs/proto-signing@0.29.3", "@cosmjs/proto-signing@^0.29.3":
version "0.29.3"
resolved "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.29.3.tgz"
@ -1306,6 +1370,19 @@
cosmjs-types "^0.5.2"
long "^4.0.0"
"@cosmjs/proto-signing@^0.30.0", "@cosmjs/proto-signing@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.30.1.tgz#f0dda372488df9cd2677150b89b3e9c72b3cb713"
integrity sha512-tXh8pPYXV4aiJVhTKHGyeZekjj+K9s2KKojMB93Gcob2DxUjfKapFYBMJSgfKPuWUPEmyr8Q9km2hplI38ILgQ==
dependencies:
"@cosmjs/amino" "^0.30.1"
"@cosmjs/crypto" "^0.30.1"
"@cosmjs/encoding" "^0.30.1"
"@cosmjs/math" "^0.30.1"
"@cosmjs/utils" "^0.30.1"
cosmjs-types "^0.7.1"
long "^4.0.0"
"@cosmjs/socket@^0.29.5":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.29.5.tgz"
@ -1316,6 +1393,16 @@
ws "^7"
xstream "^11.14.0"
"@cosmjs/socket@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.30.1.tgz#00b22f4b5e2ab01f4d82ccdb7b2e59536bfe5ce0"
integrity sha512-r6MpDL+9N+qOS/D5VaxnPaMJ3flwQ36G+vPvYJsXArj93BjgyFB7BwWwXCQDzZ+23cfChPUfhbINOenr8N2Kow==
dependencies:
"@cosmjs/stream" "^0.30.1"
isomorphic-ws "^4.0.1"
ws "^7"
xstream "^11.14.0"
"@cosmjs/stargate@0.29.3":
version "0.29.3"
resolved "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.29.3.tgz"
@ -1334,6 +1421,24 @@
protobufjs "~6.11.3"
xstream "^11.14.0"
"@cosmjs/stargate@^0.30.0":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.30.1.tgz#e1b22e1226cffc6e93914a410755f1f61057ba04"
integrity sha512-RdbYKZCGOH8gWebO7r6WvNnQMxHrNXInY/gPHPzMjbQF6UatA6fNM2G2tdgS5j5u7FTqlCI10stNXrknaNdzog==
dependencies:
"@confio/ics23" "^0.6.8"
"@cosmjs/amino" "^0.30.1"
"@cosmjs/encoding" "^0.30.1"
"@cosmjs/math" "^0.30.1"
"@cosmjs/proto-signing" "^0.30.1"
"@cosmjs/stream" "^0.30.1"
"@cosmjs/tendermint-rpc" "^0.30.1"
"@cosmjs/utils" "^0.30.1"
cosmjs-types "^0.7.1"
long "^4.0.0"
protobufjs "~6.11.3"
xstream "^11.14.0"
"@cosmjs/stream@^0.29.3", "@cosmjs/stream@^0.29.5":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.29.5.tgz"
@ -1341,6 +1446,13 @@
dependencies:
xstream "^11.14.0"
"@cosmjs/stream@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.30.1.tgz#ba038a2aaf41343696b1e6e759d8e03a9516ec1a"
integrity sha512-Fg0pWz1zXQdoxQZpdHRMGvUH5RqS6tPv+j9Eh7Q953UjMlrwZVo0YFLC8OTf/HKVf10E4i0u6aM8D69Q6cNkgQ==
dependencies:
xstream "^11.14.0"
"@cosmjs/tendermint-rpc@^0.29.3":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.29.5.tgz"
@ -1357,11 +1469,32 @@
readonly-date "^1.0.0"
xstream "^11.14.0"
"@cosmjs/tendermint-rpc@^0.30.0", "@cosmjs/tendermint-rpc@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.30.1.tgz#c16378892ba1ac63f72803fdf7567eab9d4f0aa0"
integrity sha512-Z3nCwhXSbPZJ++v85zHObeUggrEHVfm1u18ZRwXxFE9ZMl5mXTybnwYhczuYOl7KRskgwlB+rID0WYACxj4wdQ==
dependencies:
"@cosmjs/crypto" "^0.30.1"
"@cosmjs/encoding" "^0.30.1"
"@cosmjs/json-rpc" "^0.30.1"
"@cosmjs/math" "^0.30.1"
"@cosmjs/socket" "^0.30.1"
"@cosmjs/stream" "^0.30.1"
"@cosmjs/utils" "^0.30.1"
axios "^0.21.2"
readonly-date "^1.0.0"
xstream "^11.14.0"
"@cosmjs/utils@^0.29.3", "@cosmjs/utils@^0.29.5":
version "0.29.5"
resolved "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.29.5.tgz"
integrity sha512-m7h+RXDUxOzEOGt4P+3OVPX7PuakZT3GBmaM/Y2u+abN3xZkziykD/NvedYFvvCCdQo714XcGl33bwifS9FZPQ==
"@cosmjs/utils@^0.30.0", "@cosmjs/utils@^0.30.1":
version "0.30.1"
resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.30.1.tgz#6d92582341be3c2ec8d82090253cfa4b7f959edb"
integrity sha512-KvvX58MGMWh7xA+N+deCfunkA/ZNDvFLw4YbOmX3f/XBIkqrVY7qlotfy2aNb1kgp6h4B6Yc8YawJPDTfvWX7g==
"@cosmwasm/ts-codegen@0.21.1":
version "0.21.1"
resolved "https://registry.npmjs.org/@cosmwasm/ts-codegen/-/ts-codegen-0.21.1.tgz"
@ -1698,6 +1831,14 @@
resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz"
integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==
"@leapwallet/name-matcha@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@leapwallet/name-matcha/-/name-matcha-1.1.0.tgz#d06ed4fb1fba78553b6d6a304ac728f01e977952"
integrity sha512-KzjPon2WKgEmdrJdrWlaS9OXF9uKVBXZB00/VHA7bCRbZffnbxQXASvhpiRWEylINLNvWfBtftgg2s1g9jC46w==
dependencies:
"@cosmjs/cosmwasm-stargate" "0.30.0"
bech32 "1.1.4"
"@noble/hashes@^1", "@noble/hashes@^1.0.0":
version "1.2.0"
resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz"
@ -2591,7 +2732,7 @@ base64-js@^1.3.0, base64-js@^1.3.1:
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
bech32@^1.1.4:
bech32@1.1.4, bech32@^1.1.4:
version "1.1.4"
resolved "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz"
integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==
@ -2937,6 +3078,14 @@ cosmjs-types@^0.5.2:
long "^4.0.0"
protobufjs "~6.11.2"
cosmjs-types@^0.7.1:
version "0.7.2"
resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.7.2.tgz#a757371abd340949c5bd5d49c6f8379ae1ffd7e2"
integrity sha512-vf2uLyktjr/XVAgEq0DjMxeAWh1yYREe7AMHDKd7EiHVqxBPCaBS+qEEQUkXbR9ndnckqr1sUG8BQhazh4X5lA==
dependencies:
long "^4.0.0"
protobufjs "~6.11.2"
create-require@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz"
@ -4870,6 +5019,11 @@ p-try@^2.0.0:
resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz"
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
pako@^2.0.2:
version "2.1.0"
resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"
integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==
parse-code-context@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/parse-code-context/-/parse-code-context-1.0.0.tgz"