improve tx dialog
This commit is contained in:
parent
99f9c60b34
commit
1e414d5c68
22
chains/mainnet/neutron.json
Normal file
22
chains/mainnet/neutron.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"chain_name": "neutron",
|
||||||
|
"api": ["https://neutron-api.lavenderfive.com/"],
|
||||||
|
"rpc": ["https://rpc-palvus.pion-1.ntrn.tech"],
|
||||||
|
"provider_chain": {
|
||||||
|
"api": ["https://api-cosmoshub-ia.cosmosia.notional.ventures"]
|
||||||
|
},
|
||||||
|
"features": ["dashboard", "blocks", "ibc", "cosmwasm", "uptime", "parameters", "state-sync"],
|
||||||
|
"sdk_version": "0.45.1",
|
||||||
|
"coin_type": "118",
|
||||||
|
"min_tx_fee": "8000",
|
||||||
|
"assets": [{
|
||||||
|
"base": "untrn",
|
||||||
|
"symbol": "NTRN",
|
||||||
|
"exponent": "6",
|
||||||
|
"coingecko_id": "neutron",
|
||||||
|
"logo": "/logos/nym.jpeg"
|
||||||
|
}],
|
||||||
|
"addr_prefix": "neutron",
|
||||||
|
"theme_color": "",
|
||||||
|
"logo": "/logos/nym.jpeg"
|
||||||
|
}
|
@ -27,7 +27,7 @@ const format = useFormatter();
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-show="tab === 'blocks'" class="bg-base-100 rounded overflow-x-auto">
|
<div v-show="tab === 'blocks'" class="bg-base-100 rounded overflow-x-auto">
|
||||||
<table class="table w-full">
|
<table class="table w-full table-compact">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="position: relative; z-index: 2;">Height</th>
|
<th style="position: relative; z-index: 2;">Height</th>
|
||||||
@ -60,7 +60,7 @@ const format = useFormatter();
|
|||||||
v-show="tab === 'transactions'"
|
v-show="tab === 'transactions'"
|
||||||
class="bg-base-100 rounded overflow-x-auto"
|
class="bg-base-100 rounded overflow-x-auto"
|
||||||
>
|
>
|
||||||
<table class="table w-full">
|
<table class="table w-full table-compact">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="position: relative; z-index: 2;">Height</th>
|
<th style="position: relative; z-index: 2;">Height</th>
|
||||||
|
@ -17,6 +17,8 @@ import { computed } from '@vue/reactivity';
|
|||||||
import CardStatisticsVertical from '@/components/CardStatisticsVertical.vue';
|
import CardStatisticsVertical from '@/components/CardStatisticsVertical.vue';
|
||||||
import ProposalListItem from '@/components/ProposalListItem.vue';
|
import ProposalListItem from '@/components/ProposalListItem.vue';
|
||||||
|
|
||||||
|
const props = defineProps(['chain']);
|
||||||
|
|
||||||
const blockchain = useBlockchain();
|
const blockchain = useBlockchain();
|
||||||
const store = useIndexModule();
|
const store = useIndexModule();
|
||||||
const walletStore = useWalletStore();
|
const walletStore = useWalletStore();
|
||||||
@ -229,7 +231,7 @@ const color = computed(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bg-base-100 rounded mt-4 shadow">
|
<div v-if="blockchain.supportModule('governance')" class="bg-base-100 rounded mt-4 shadow">
|
||||||
<div class="px-4 pt-4 pb-2 text-lg font-semibold text-main">
|
<div class="px-4 pt-4 pb-2 text-lg font-semibold text-main">
|
||||||
Active Proposals
|
Active Proposals
|
||||||
</div>
|
</div>
|
||||||
@ -246,8 +248,8 @@ const color = computed(() => {
|
|||||||
{{ walletStore.currentAddress || 'Not Connected' }}
|
{{ walletStore.currentAddress || 'Not Connected' }}
|
||||||
<RouterLink
|
<RouterLink
|
||||||
v-if="walletStore.currentAddress"
|
v-if="walletStore.currentAddress"
|
||||||
class="float-right font-light text-sm cursor-pointert link link-primary no-underline font-medium"
|
class="float-right text-sm cursor-pointert link link-primary no-underline font-medium"
|
||||||
to="/wallet/portfolio"
|
:to="`/${chain}/account/${walletStore.currentAddress}`"
|
||||||
>More</RouterLink
|
>More</RouterLink
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -294,7 +296,7 @@ const color = computed(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-4 pb-4">
|
<div v-if="walletStore.delegations.length > 0" class="px-4 pb-4">
|
||||||
<table class="table table-compact w-full table-zebra">
|
<table class="table table-compact w-full table-zebra">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -316,27 +318,28 @@ const color = computed(() => {
|
|||||||
<td>{{ format.formatToken(item?.balance) }}</td>
|
<td>{{ format.formatToken(item?.balance) }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{
|
{{
|
||||||
format.formatToken(
|
format.formatTokens(
|
||||||
walletStore?.rewards?.rewards?.find(
|
walletStore?.rewards?.rewards?.find(
|
||||||
(el) =>
|
(el) =>
|
||||||
el?.validator_address ===
|
el?.validator_address ===
|
||||||
item?.delegation?.validator_address
|
item?.delegation?.validator_address
|
||||||
)?.reward?.[0]
|
)?.reward)
|
||||||
)
|
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<label for="delegate"
|
||||||
class="btn btn-xs btn-primary btn-ghost text-primary rounded-sm mr-2"
|
class="btn btn-xs btn-primary btn-ghost text-primary rounded-sm mr-2"
|
||||||
|
@click="dialog.open('delegate', { validator_address: item.delegation.validator_address})"
|
||||||
>
|
>
|
||||||
Delegate
|
Delegate
|
||||||
</button>
|
</label>
|
||||||
<button
|
<label for="withdraw"
|
||||||
class="btn btn-xs btn-primary btn-ghost text-primary rounded-sm"
|
class="btn btn-xs btn-primary btn-ghost text-primary rounded-sm"
|
||||||
|
@click="dialog.open('withdraw', { validator_address: item.delegation.validator_address})"
|
||||||
>
|
>
|
||||||
Withdraw Rewards
|
Withdraw Rewards
|
||||||
</button>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -345,13 +348,9 @@ const color = computed(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-3 gap-4 px-4 pb-6 mt-4">
|
<div class="grid grid-cols-3 gap-4 px-4 pb-6 mt-4">
|
||||||
<label for="send" class="btn btn-success text-white">Send</label>
|
<label for="PingTokenConvert" class="btn btn-primary text-white">Convert</label>
|
||||||
<RouterLink to="/wallet/receive" class="btn btn-info text-white"
|
<label for="send" class="btn btn-success text-white" @click="dialog.open('send', {})">Send</label>
|
||||||
>Receive</RouterLink
|
<RouterLink to="/wallet/receive" class="btn btn-info text-white">Receive</RouterLink>
|
||||||
>
|
|
||||||
<label for="PingTokenConvert" class="btn btn-primary text-white"
|
|
||||||
>Convert</label
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<Teleport to="body">
|
<Teleport to="body">
|
||||||
<ping-token-convert
|
<ping-token-convert
|
||||||
|
@ -99,13 +99,11 @@ const loadAvatars = () => {
|
|||||||
// fetch avatar from keybase
|
// fetch avatar from keybase
|
||||||
let promise = Promise.resolve();
|
let promise = Promise.resolve();
|
||||||
staking.validators.forEach((item) => {
|
staking.validators.forEach((item) => {
|
||||||
console.log(item.description)
|
|
||||||
promise = promise.then(
|
promise = promise.then(
|
||||||
() =>
|
() =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
const identity = item.description?.identity;
|
const identity = item.description?.identity;
|
||||||
if (identity && !avatars.value[identity]) {
|
if (identity && !avatars.value[identity]) {
|
||||||
console.log("loading:", identity)
|
|
||||||
staking.keybase(identity).then((d) => {
|
staking.keybase(identity).then((d) => {
|
||||||
if (Array.isArray(d.them) && d.them.length > 0) {
|
if (Array.isArray(d.them) && d.them.length > 0) {
|
||||||
const uri = String(d.them[0]?.pictures?.primary?.url).replace(
|
const uri = String(d.them[0]?.pictures?.primary?.url).replace(
|
||||||
|
@ -11,7 +11,7 @@ const base = useBaseStore();
|
|||||||
const nodeInfo = ref({} as NodeInfo);
|
const nodeInfo = ref({} as NodeInfo);
|
||||||
|
|
||||||
const height = ref(Number(base.latest.block?.header?.height|| 2001))
|
const height = ref(Number(base.latest.block?.header?.height|| 2001))
|
||||||
const hash = ref(toHex(fromBase64(base.latest.block_id.hash)))
|
const hash = ref("")
|
||||||
|
|
||||||
if(height.value > 2000) {
|
if(height.value > 2000) {
|
||||||
height.value = Math.round((height.value - 2000) / 1000) * 1000
|
height.value = Math.round((height.value - 2000) / 1000) * 1000
|
||||||
|
@ -148,7 +148,7 @@ function changeTab(v: string) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tr v-for="({v, signing}, i) in list">
|
<tr v-for="({v, signing}, i) in list">
|
||||||
<td>{{ i+1 }}. {{ v.description.moniker }}</td>
|
<td><div class="truncate max-w-sm">{{ i+1 }}. {{ v.description.moniker }}</div></td>
|
||||||
<td>{{ signing?.start_height }}</td>
|
<td>{{ signing?.start_height }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ signing?.index_offset }}
|
{{ signing?.index_offset }}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
export const useStoreName = defineStore('bankstore', {
|
export const useStoreName = defineStore('template', {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
import { useTheme } from 'vuetify';
|
||||||
import {
|
import {
|
||||||
useDashboard,
|
useDashboard,
|
||||||
type ChainConfig,
|
type ChainConfig,
|
||||||
@ -50,6 +51,10 @@ export const useBlockchain = defineStore('blockchain', {
|
|||||||
dashboard() {
|
dashboard() {
|
||||||
return useDashboard();
|
return useDashboard();
|
||||||
},
|
},
|
||||||
|
isConsumerChain() {
|
||||||
|
// @ts-ignore
|
||||||
|
return this.current && this.current.providerChain
|
||||||
|
},
|
||||||
computedChainMenu() {
|
computedChainMenu() {
|
||||||
let currNavItem: VerticalNavItems = [];
|
let currNavItem: VerticalNavItems = [];
|
||||||
|
|
||||||
@ -61,8 +66,11 @@ export const useBlockchain = defineStore('blockchain', {
|
|||||||
title: this.current?.prettyName || this.chainName || '',
|
title: this.current?.prettyName || this.chainName || '',
|
||||||
icon: { image: this.current.logo, size: '22' },
|
icon: { image: this.current.logo, size: '22' },
|
||||||
i18n: false,
|
i18n: false,
|
||||||
|
badgeContent: this.isConsumerChain? 'Consumer': undefined,
|
||||||
|
badgeClass: 'bg-secondary',
|
||||||
children: routes
|
children: routes
|
||||||
.filter((x) => x.meta.i18n)
|
.filter((x) => x.meta.i18n) // defined menu name
|
||||||
|
.filter((x) => !this.current?.features || this.current.features.includes(String(x.meta.i18n))) // filter none-custom module
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
title: `module.${x.meta.i18n}`,
|
title: `module.${x.meta.i18n}`,
|
||||||
to: { path: x.path.replace(':chain', this.chainName) },
|
to: { path: x.path.replace(':chain', this.chainName) },
|
||||||
@ -112,6 +120,10 @@ export const useBlockchain = defineStore('blockchain', {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async initial() {
|
async initial() {
|
||||||
|
// this.current?.themeColor {
|
||||||
|
// const { global } = useTheme();
|
||||||
|
// global.current
|
||||||
|
// }
|
||||||
await this.randomSetupEndpoint();
|
await this.randomSetupEndpoint();
|
||||||
await useStakingStore().init();
|
await useStakingStore().init();
|
||||||
useBankStore().initial();
|
useBankStore().initial();
|
||||||
@ -146,5 +158,8 @@ export const useBlockchain = defineStore('blockchain', {
|
|||||||
this.chainName = name;
|
this.chainName = name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
supportModule(mod: string) {
|
||||||
|
return !this.current?.features || this.current.features.includes(mod)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -61,6 +61,7 @@ export interface ChainConfig {
|
|||||||
coinType: string;
|
coinType: string;
|
||||||
assets: Asset[];
|
assets: Asset[];
|
||||||
themeColor?: string;
|
themeColor?: string;
|
||||||
|
features?: string[]
|
||||||
endpoints: {
|
endpoints: {
|
||||||
rest?: Endpoint[];
|
rest?: Endpoint[];
|
||||||
rpc?: Endpoint[];
|
rpc?: Endpoint[];
|
||||||
@ -74,12 +75,18 @@ export interface ChainConfig {
|
|||||||
};
|
};
|
||||||
exponent: string;
|
exponent: string;
|
||||||
excludes?: string;
|
excludes?: string;
|
||||||
|
providerChain: {
|
||||||
|
api: Endpoint[]
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LocalConfig {
|
export interface LocalConfig {
|
||||||
addr_prefix: string;
|
addr_prefix: string;
|
||||||
alias: string;
|
alias: string;
|
||||||
api: string[] | Endpoint[];
|
api: string[] | Endpoint[];
|
||||||
|
provider_chain: {
|
||||||
|
api: string[] | Endpoint[]
|
||||||
|
}
|
||||||
assets: {
|
assets: {
|
||||||
base: string;
|
base: string;
|
||||||
coingecko_id: string;
|
coingecko_id: string;
|
||||||
@ -90,10 +97,12 @@ export interface LocalConfig {
|
|||||||
chain_name: string;
|
chain_name: string;
|
||||||
coin_type: string;
|
coin_type: string;
|
||||||
logo: string;
|
logo: string;
|
||||||
|
theme_color?: string;
|
||||||
min_tx_fee: string;
|
min_tx_fee: string;
|
||||||
rpc: string[] | Endpoint[];
|
rpc: string[] | Endpoint[];
|
||||||
sdk_version: string;
|
sdk_version: string;
|
||||||
registry_name?: string;
|
registry_name?: string;
|
||||||
|
features?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
function apiConverter(api: any[]) {
|
function apiConverter(api: any[]) {
|
||||||
@ -135,6 +144,12 @@ export function fromLocal(lc: LocalConfig): ChainConfig {
|
|||||||
rest: apiConverter(lc.api),
|
rest: apiConverter(lc.api),
|
||||||
rpc: apiConverter(lc.rpc),
|
rpc: apiConverter(lc.rpc),
|
||||||
};
|
};
|
||||||
|
if(lc.provider_chain) {
|
||||||
|
conf.providerChain = {
|
||||||
|
api: apiConverter(lc.provider_chain.api)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conf.features = lc.features
|
||||||
conf.logo = lc.logo;
|
conf.logo = lc.logo;
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,6 @@ export const useParamStore = defineStore('paramstore', {
|
|||||||
// this.chain.items[chainIndex].value = `${percent(res)}%`
|
// this.chain.items[chainIndex].value = `${percent(res)}%`
|
||||||
// })
|
// })
|
||||||
const res = await this.getMintParam();
|
const res = await this.getMintParam();
|
||||||
console.log(res, 'mint');
|
|
||||||
},
|
},
|
||||||
async handleSlashingParams() {
|
async handleSlashingParams() {
|
||||||
const res = await this.getSlashingParams();
|
const res = await this.getSlashingParams();
|
||||||
@ -200,7 +199,6 @@ export const useParamStore = defineStore('paramstore', {
|
|||||||
this.nodeVersion.items = Object.entries(res.default_node_info).map(
|
this.nodeVersion.items = Object.entries(res.default_node_info).map(
|
||||||
([key, value]) => ({ subtitle: key, value: value })
|
([key, value]) => ({ subtitle: key, value: value })
|
||||||
);
|
);
|
||||||
console.log('handleAbciInfo', this.nodeVersion.items);
|
|
||||||
},
|
},
|
||||||
async getBaseTendermintBlockLatest() {
|
async getBaseTendermintBlockLatest() {
|
||||||
return await this.blockchain.rpc?.getBaseBlockLatest();
|
return await this.blockchain.rpc?.getBaseBlockLatest();
|
||||||
|
@ -3,6 +3,9 @@ import { useBlockchain } from './useBlockchain';
|
|||||||
|
|
||||||
import { get } from '@/libs/http';
|
import { get } from '@/libs/http';
|
||||||
import type { StakingParam, StakingPool, Validator } from '@/types';
|
import type { StakingParam, StakingPool, Validator } from '@/types';
|
||||||
|
import { CosmosRestClient } from '@/libs/client';
|
||||||
|
import { consensusPubkeyToHexAddress, valconsToBase64 } from '@/libs';
|
||||||
|
import { toHex, fromBase64 } from '@cosmjs/encoding';
|
||||||
|
|
||||||
export const useStakingStore = defineStore('stakingStore', {
|
export const useStakingStore = defineStore('stakingStore', {
|
||||||
state: () => {
|
state: () => {
|
||||||
@ -77,6 +80,20 @@ export const useStakingStore = defineStore('stakingStore', {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
async fetchValidators(status: string) {
|
async fetchValidators(status: string) {
|
||||||
|
if(this.blockchain.isConsumerChain) {
|
||||||
|
if(this.blockchain.current?.providerChain.api && this.blockchain.current.providerChain.api.length > 0) {
|
||||||
|
const client = CosmosRestClient.newDefault(this.blockchain.current.providerChain.api[0].address)
|
||||||
|
// const vals = await client.getBaseValidatorsetLatest(0)
|
||||||
|
const res = await client.getStakingValidators(status)
|
||||||
|
const proVals = res.validators.sort(
|
||||||
|
(a, b) => Number(b.delegator_shares) - Number(a.delegator_shares)
|
||||||
|
)
|
||||||
|
if (status === 'BOND_STATUS_BONDED') {
|
||||||
|
this.validators = proVals;
|
||||||
|
}
|
||||||
|
return proVals
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.blockchain.rpc?.getStakingValidators(status).then((res) => {
|
return this.blockchain.rpc?.getStakingValidators(status).then((res) => {
|
||||||
const vals = res.validators.sort(
|
const vals = res.validators.sort(
|
||||||
(a, b) => Number(b.delegator_shares) - Number(a.delegator_shares)
|
(a, b) => Number(b.delegator_shares) - Number(a.delegator_shares)
|
||||||
@ -89,3 +106,5 @@ export const useStakingStore = defineStore('stakingStore', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user