From fb028faeb1ca1e0e9c4499ec8af8c902df604d86 Mon Sep 17 00:00:00 2001 From: Salman Wahib Date: Tue, 16 May 2023 09:48:41 +0000 Subject: [PATCH 01/22] update: add routerlink to transaction Signed-off-by: Salman Wahib --- src/modules/[chain]/account/[address].vue | 4 +++- src/modules/[chain]/block/index.vue | 8 ++++++-- src/modules/[chain]/staking/[validator].vue | 4 +++- src/modules/[chain]/tx/[hash].vue | 6 +++--- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/modules/[chain]/account/[address].vue b/src/modules/[chain]/account/[address].vue index 63f5ff34..c87e94a4 100644 --- a/src/modules/[chain]/account/[address].vue +++ b/src/modules/[chain]/account/[address].vue @@ -458,8 +458,10 @@ loadAccount(props.address); v.height }} - + + {{ v.txhash }} +
diff --git a/src/modules/[chain]/block/index.vue b/src/modules/[chain]/block/index.vue index e916d2e5..9a0fe409 100644 --- a/src/modules/[chain]/block/index.vue +++ b/src/modules/[chain]/block/index.vue @@ -71,8 +71,12 @@ const format = useFormatter(); - {{ item.height }} - + + {{ item.height }} + {{ item.hash }} diff --git a/src/modules/[chain]/staking/[validator].vue b/src/modules/[chain]/staking/[validator].vue index c0fe3110..a0fc40e1 100644 --- a/src/modules/[chain]/staking/[validator].vue +++ b/src/modules/[chain]/staking/[validator].vue @@ -397,8 +397,10 @@ onMounted(() => { item.height }} - + + {{ item.txhash }} +
diff --git a/src/modules/[chain]/tx/[hash].vue b/src/modules/[chain]/tx/[hash].vue index 85465c94..0556e609 100644 --- a/src/modules/[chain]/tx/[hash].vue +++ b/src/modules/[chain]/tx/[hash].vue @@ -39,7 +39,7 @@ const messages = computed(() => { Height - + {{ tx.tx_response.height }} { tx.tx_response.code === 0 ? 'success' : 'error' }`" > - + > {{ tx.tx_response.code === 0 ? 'Success' : 'Failded' }}
From db7b1a65fca6cd429cdb684aca885dfe3ee25a87 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 16 May 2023 20:19:31 +0800 Subject: [PATCH 02/22] hidden badge --- src/modules/[chain]/uptime/index.vue | 2 +- src/modules/[chain]/uptime/overview.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/[chain]/uptime/index.vue b/src/modules/[chain]/uptime/index.vue index 9f25e1ab..4ab0bb66 100644 --- a/src/modules/[chain]/uptime/index.vue +++ b/src/modules/[chain]/uptime/index.vue @@ -162,7 +162,7 @@ function changeTab(v: string) { {{ signing?.start_height }} {{ signing?.index_offset }} - {{ signing?.missed_blocks_counter }} + {{ signing?.missed_blocks_counter }} {{ format.percent(Number(signing.index_offset)/(latest-Number(signing.start_height))) }} diff --git a/src/modules/[chain]/uptime/overview.vue b/src/modules/[chain]/uptime/overview.vue index d627f458..6d6035b1 100644 --- a/src/modules/[chain]/uptime/overview.vue +++ b/src/modules/[chain]/uptime/overview.vue @@ -155,7 +155,7 @@ function color(v: string) { {{ v.chainName }} {{ v.v.name }} - {{ v.sigingInfo?.missed_blocks_counter }} + {{ v.sigingInfo?.missed_blocks_counter }} {{ Number(v.sigingInfo.index_offset) - Number(v.sigingInfo.start_height) }}
From 1c44a04cd47ce1147fc80164a8847711508ea70a Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 16 May 2023 22:42:05 +0800 Subject: [PATCH 03/22] fix error --- src/modules/[chain]/indexStore.ts | 21 ++++++---- src/modules/[chain]/statesync/index.vue | 16 +++++--- src/modules/[chain]/uptime/index.vue | 52 ++++++++++++------------- 3 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/modules/[chain]/indexStore.ts b/src/modules/[chain]/indexStore.ts index 771976df..3ffc64d0 100644 --- a/src/modules/[chain]/indexStore.ts +++ b/src/modules/[chain]/indexStore.ts @@ -87,29 +87,35 @@ export const useIndexModule = defineStore('module-index', { return useBankStore(); }, twitter(): string { - return `https://twitter.com/${this.coinInfo.links.twitter_screen_name}`; + if(!this.coinInfo?.links?.twitter_screen_name) return "" + return `https://twitter.com/${this.coinInfo?.links.twitter_screen_name}`; }, homepage(): string { - const [page1, page2, page3] = this.coinInfo.links?.homepage; + if(!this.coinInfo?.links?.homepage) return "" + const [page1, page2, page3] = this.coinInfo?.links?.homepage; return page1 || page2 || page3; }, github(): string { - const [page1, page2, page3] = this.coinInfo.links?.repos_url?.github; + if(!this.coinInfo?.links?.repos_url) return "" + const [page1, page2, page3] = this.coinInfo?.links?.repos_url?.github; return page1 || page2 || page3; }, telegram(): string { - return `https://t.me/${this.coinInfo.links.telegram_channel_identifier}`; + if(!this.coinInfo?.links?.homepage) return "" + return `https://t.me/${this.coinInfo?.links.telegram_channel_identifier}`; }, priceChange(): string { + if(!this.coinInfo?.market_data?.price_change_percentage_24h) return "" const change = - this.coinInfo.market_data?.price_change_percentage_24h || 0; + this.coinInfo?.market_data?.price_change_percentage_24h || 0; return numeral(change).format('+0.[00]'); }, priceColor(): string { + if(!this.coinInfo?.market_data?.price_change_percentage_24h) return "" const change = - this.coinInfo.market_data?.price_change_percentage_24h || 0; + this.coinInfo?.market_data?.price_change_percentage_24h || 0; switch (true) { case change > 0: return 'text-success'; @@ -120,7 +126,8 @@ export const useIndexModule = defineStore('module-index', { } }, trustColor(): string { - const change = this.coinInfo.tickers[this.tickerIndex]?.trust_score; + if(!this.coinInfo?.tickers) return "" + const change = this.coinInfo?.tickers[this.tickerIndex]?.trust_score; return colorMap(change); }, diff --git a/src/modules/[chain]/statesync/index.vue b/src/modules/[chain]/statesync/index.vue index 178b9a52..df75088b 100644 --- a/src/modules/[chain]/statesync/index.vue +++ b/src/modules/[chain]/statesync/index.vue @@ -10,6 +10,15 @@ const blockchain = useBlockchain(); const base = useBaseStore(); const nodeInfo = ref({} as NodeInfo); +const height = ref(Number(base.latest.block?.header?.height|| 2001)) +const hash = ref(toHex(fromBase64(base.latest.block_id.hash))) + +if(height.value > 2000) { + height.value = Math.round((height.value - 2000) / 1000) * 1000 + base.fetchBlock(height.value).then(res => { + hash.value = toHex(fromBase64(res.block_id.hash)).toUpperCase() + }) +} const state = computed(() => { const rpcs = blockchain.current?.endpoints?.rpc ?.map((x) => x.address) @@ -17,10 +26,8 @@ const state = computed(() => { return `[statesync] enable = true rpc_servers = "${rpcs}" -trust_height = ${base.latest.block?.header?.height || 'loading'} -trust_hash = "${ - base.latest.block_id ? toHex(fromBase64(base.latest.block_id?.hash)) : '' - }" +trust_height = ${height.value || 'loading'} +trust_hash = "${hash.value}" trust_period = "168h" # 2/3 of unbonding time" `; }); @@ -31,7 +38,6 @@ const appName = computed(() => { onMounted(() => { blockchain.rpc.getBaseNodeInfo().then((x) => { - console.log('node info', x); nodeInfo.value = x; }); }); diff --git a/src/modules/[chain]/uptime/index.vue b/src/modules/[chain]/uptime/index.vue index 4ab0bb66..f52d5869 100644 --- a/src/modules/[chain]/uptime/index.vue +++ b/src/modules/[chain]/uptime/index.vue @@ -49,24 +49,22 @@ onMounted(() => { latest.value = Number(b.block.header.height); commits.value.unshift(b.block.last_commit); const height = Number(b.block.header?.height || 0); - if (height === 0) { + if (height > 50) { // constructs sequence for loading blocks let promise = Promise.resolve(); for (let i = height - 1; i > height - 50; i -= 1) { - if (i > height - 48) { - promise = promise.then( - () => - new Promise((resolve, reject) => { - if (live.value && commits2.value.length < 50) { - // continue only if the page is living - baseStore.fetchBlock(i).then((x) => { - commits.value.unshift(x.block.last_commit); - resolve(); - }); - } - }) - ); - } + promise = promise.then( + () => + new Promise((resolve, reject) => { + if (live.value && commits2.value.length < 50) { + // continue only if the page is living + baseStore.fetchBlock(i).then((x) => { + commits.value.unshift(x.block.last_commit); + resolve(); + }); + } + }) + ); } } }); @@ -143,28 +141,26 @@ function changeTab(v: string) {
- + - - - - - - - - - - + + + + + + - + - From fc707e04753e13b9037d04ae78aafde5df46caee Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 17 May 2023 08:33:44 +0800 Subject: [PATCH 05/22] fix: logo loading --- src/modules/[chain]/staking/[validator].vue | 14 +++++++------ src/modules/[chain]/staking/index.vue | 23 ++++++--------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/modules/[chain]/staking/[validator].vue b/src/modules/[chain]/staking/[validator].vue index c0fe3110..d4d3319a 100644 --- a/src/modules/[chain]/staking/[validator].vue +++ b/src/modules/[chain]/staking/[validator].vue @@ -56,7 +56,6 @@ staking const txs = ref({} as PaginatedTxs); blockchain.rpc.getTxsBySender(addresses.value.account).then((x) => { - console.log('txs', x); txs.value = x; }); @@ -78,14 +77,19 @@ const selfRate = computed(() => { } return '-'; }); - +const logo = (identity?: string) => { + if (!identity) return ''; + const url = avatars.value[identity] || ''; + return url.startsWith('http') + ? url + : `https://s3.amazonaws.com/keybase_processed_uploads/${url}`; +}; onMounted(() => { if (validator) { staking.fetchValidator(validator).then((res) => { v.value = res.validator; identity.value = res.validator?.description?.identity || ''; if (identity.value && !avatars.value[identity.value]) { - console.log(identity.value, avatars); staking.keybase(identity.value).then((d) => { if (Array.isArray(d.them) && d.them.length > 0) { const uri = String(d.them[0]?.pictures?.primary?.url).replace( @@ -144,9 +148,7 @@ onMounted(() => {
{ const changes = {} as Record; Object.keys(latest.value).forEach((k) => { @@ -92,12 +90,6 @@ const change24Color = (key?: Key) => { if (v < 0) return 'text-error'; }; -const update = (m: DebuggerEvent) => { - if (m.key === 'validators') { - loadAvatars(); - } -}; - const list = computed(() => { return tab.value === 'active' ? staking.validators : unbondList.value; // return staking.validators @@ -107,11 +99,13 @@ const loadAvatars = () => { // fetch avatar from keybase let promise = Promise.resolve(); staking.validators.forEach((item) => { + console.log(item.description) promise = promise.then( () => new Promise((resolve) => { const identity = item.description?.identity; if (identity && !avatars.value[identity]) { + console.log("loading:", identity) staking.keybase(identity).then((d) => { if (Array.isArray(d.them) && d.them.length > 0) { const uri = String(d.them[0]?.pictures?.primary?.url).replace( @@ -136,15 +130,6 @@ const loadAvatars = () => { }); }; -staking.$subscribe((m, s) => { - if (Array.isArray(m.events)) { - m.events.forEach((x) => { - update(x); - }); - } else { - update(m.events); - } -}); const logo = (identity?: string) => { if (!identity) return ''; const url = avatars.value[identity] || ''; @@ -168,6 +153,10 @@ const rank = function (position: number) { return 'primary'; } }; + +fetchChange(); +loadAvatars(); +
ValidatorStart HeightSigned BlocksMissing blocksLast Jailed TimeTombstoned
In WindowOver AllValidatorStart HeightSigned PrecommitsMissing blocksLast Jailed TimeTombstoned
{{ i+1 }}. {{ v.description.moniker }} {{ signing?.start_height }}{{ signing?.index_offset }} + {{ signing?.index_offset }} + {{ format.percent(Number(signing.index_offset)/(latest-Number(signing.start_height))) }} + {{ signing?.missed_blocks_counter }} {{ format.percent(Number(signing.index_offset)/(latest-Number(signing.start_height))) }}
{{ format.toDay(signing?.jailed_until, "from") }} From 8cfad1708066e299dad88ca21415a97176412e58 Mon Sep 17 00:00:00 2001 From: Salman Wahib Date: Tue, 16 May 2023 23:25:52 +0000 Subject: [PATCH 04/22] update: rollback tx_response.code to span Signed-off-by: Salman Wahib --- src/modules/[chain]/tx/[hash].vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/[chain]/tx/[hash].vue b/src/modules/[chain]/tx/[hash].vue index 0556e609..d725154e 100644 --- a/src/modules/[chain]/tx/[hash].vue +++ b/src/modules/[chain]/tx/[hash].vue @@ -55,12 +55,12 @@ const messages = computed(() => { tx.tx_response.code === 0 ? 'success' : 'error' }`" > - + > {{ tx.tx_response.code === 0 ? 'Success' : 'Failded' }}