From 9981eee44fb2db8193a3a27874fcb430a40911f5 Mon Sep 17 00:00:00 2001 From: wizard <112275929+famouswizard@users.noreply.github.com> Date: Sun, 13 Apr 2025 22:31:44 +0300 Subject: [PATCH 1/4] chore: fixed issues with Vue 3 component setup --- src/components/charts/DonutChart.vue | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/charts/DonutChart.vue b/src/components/charts/DonutChart.vue index 5ac20c2d..bfc5e41d 100644 --- a/src/components/charts/DonutChart.vue +++ b/src/components/charts/DonutChart.vue @@ -22,9 +22,3 @@ const expenseRationChartConfig = computed(() => { :series="series" /> - - From d62497da779e378c0fa62fa30b0c17b456cbea72 Mon Sep 17 00:00:00 2001 From: 2xburnt <169301814+2xburnt@users.noreply.github.com> Date: Mon, 28 Apr 2025 15:11:02 -0500 Subject: [PATCH 2/4] add xion chain customizations --- src/libs/api/customization/xion.ts | 104 +++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/libs/api/customization/xion.ts diff --git a/src/libs/api/customization/xion.ts b/src/libs/api/customization/xion.ts new file mode 100644 index 00000000..9928a74c --- /dev/null +++ b/src/libs/api/customization/xion.ts @@ -0,0 +1,104 @@ +import type { RequestRegistry } from '@/libs/api/registry'; +import { adapter } from '@/libs/api/registry' +import { CosmosRestClient } from '@/libs/client'; +import { useBlockchain } from '@/stores'; +import type { + GovProposal, + PaginatedProposals, +} from '@/types/'; + +// which registry is store +export const store = 'name'; // name or version +// Blockchain Name +export const name = 'xion'; + +export function proposalAdapter(p: any): GovProposal { + if (p) { + if (p.messages && p.messages.length >= 1) p.content = p.messages[0].content || p.messages[0] + p.proposal_id = p.id + p.final_tally_result = { + yes: p.final_tally_result?.yes_count, + no: p.final_tally_result?.no_count, + no_with_veto: p.final_tally_result?.no_with_veto_count, + abstain: p.final_tally_result?.abstain_count, + } + } + return p +} + +// xion custom request +export const requests: Partial = { + bank_supply_by_denom: { url: '/cosmos/bank/v1beta1/supply/by_denom?denom={denom}', adapter }, + gov_params_voting: { url: '/cosmos/gov/v1/params/voting', adapter }, + gov_params_tally: { url: '/cosmos/gov/v1/params/tallying', adapter }, + gov_params_deposit: { url: '/cosmos/gov/v1/params/deposit', adapter }, + gov_proposals: { + url: '/cosmos/gov/v1/proposals', adapter: async (source: any): Promise => { + const proposals = source.proposals.map((p: any) => proposalAdapter(p)) + return { + proposals, + pagination: source.pagination + } + } + }, + gov_proposals_proposal_id: { + url: '/cosmos/gov/v1/proposals/{proposal_id}', + adapter: async (source: any): Promise<{ proposal: GovProposal }> => { + return { + proposal: proposalAdapter(source.proposal) + } + }, + }, + gov_proposals_deposits: { + url: '/cosmos/gov/v1/proposals/{proposal_id}/deposits', + adapter, + }, + gov_proposals_tally: { + url: '/cosmos/gov/v1/proposals/{proposal_id}/tally', + adapter, + }, + gov_proposals_votes: { + url: '/cosmos/gov/v1/proposals/{proposal_id}/votes', + adapter, + }, + gov_proposals_votes_voter: { + url: '/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter}', + adapter, + }, + mint_inflation: { + url: '/xion/mint/v1/inflation', + adapter: async (data: any): Promise<{ inflation: string }> => { + try { + const client = CosmosRestClient.newDefault( + useBlockchain().endpoint.address + ); + + // Get distribution params to fetch community tax + const { params } = await client.getDistributionParams().catch((e) => { + console.error('[Xion Adapter] Failed to fetch distribution params:', { + error: e instanceof Error ? e.message : e, + endpoint: '/distribution/params', + }); + return { params: { community_tax: '0' } }; + }); + + const communityTax = params.community_tax; + + // apr calcuation is inflation * (1 - communityTax) + const adjustedInflation = + parseFloat(data.inflation) * (1 - parseFloat(communityTax)); + + return { inflation: adjustedInflation.toString() }; + } catch (e) { + console.error('[Xion Adapter] Error calculating inflation:', { + error: e instanceof Error ? e.message : e, + timestamp: new Date().toISOString(), + endpoint: useBlockchain().endpoint.address, + }); + return { inflation: '0' }; + } + }, + }, + mint_params: { url: '/xion/mint/v1/params', adapter }, + mint_annual_provisions: { url: '/xion/mint/v1beta1/annual_provisions', adapter } +} From 67fd8f452f41c1d36c9ed93ce0cf76d135eccddb Mon Sep 17 00:00:00 2001 From: 2xburnt <169301814+2xburnt@users.noreply.github.com> Date: Mon, 28 Apr 2025 17:51:56 -0500 Subject: [PATCH 3/4] improve supply page --- src/modules/[chain]/supply/index.vue | 100 +++++++++++++++++++-------- 1 file changed, 72 insertions(+), 28 deletions(-) diff --git a/src/modules/[chain]/supply/index.vue b/src/modules/[chain]/supply/index.vue index 2216f0eb..85644f57 100644 --- a/src/modules/[chain]/supply/index.vue +++ b/src/modules/[chain]/supply/index.vue @@ -1,52 +1,96 @@ From 6f0cb3582aa5275c2d5971bfd8cf8bc59378ff49 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 22 May 2025 13:00:41 +0800 Subject: [PATCH 4/4] update txs type --- src/components/dynamic/TxsElement.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/dynamic/TxsElement.vue b/src/components/dynamic/TxsElement.vue index 2f0cbd8f..d16621cc 100644 --- a/src/components/dynamic/TxsElement.vue +++ b/src/components/dynamic/TxsElement.vue @@ -12,11 +12,11 @@ const txs = computed(() => { return props.value?.map((x) => { const tx_bytes = fromBase64(x); let tx = null - let injected = false + let injected = 'Standard' try { tx = decodeTxRaw(fromBase64(x)) } catch(e) { - injected = true + injected = 'Injected' } return { hash: hashTx(tx_bytes), @@ -34,7 +34,7 @@ const chain = useBlockchain(); - + @@ -44,7 +44,7 @@ const chain = useBlockchain();
InjectedType Hash Msgs Memo
{{ item.injected }} - {{ item.hash }} + {{ item.hash }} {{ item.hash }}