forked from cerc-io/cosmos-explorer
add sifchain starname
This commit is contained in:
parent
78c33d2d8f
commit
50623614ab
4
.github/workflows/deploy.yaml
vendored
4
.github/workflows/deploy.yaml
vendored
@ -3,9 +3,9 @@ name: Ping Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ v2 ]
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ v2 ]
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
@ -18,6 +18,8 @@
|
||||
"juno": "Juno",
|
||||
"certik": "Certik",
|
||||
"sentinel": "Sentinel",
|
||||
"sifchain": "Sifchain",
|
||||
"starname": "Starname",
|
||||
|
||||
"staking": "Staking",
|
||||
"governance": "Governance",
|
||||
|
@ -269,10 +269,16 @@ export function formatTokenDenom(tokenDenom) {
|
||||
}
|
||||
|
||||
export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
|
||||
if (denom.startsWith('u')) {
|
||||
// for special case
|
||||
let decimals = 1000000n
|
||||
if (denom.startsWith('rowan')) {
|
||||
decimals = 1000000000000000000n
|
||||
}
|
||||
const amount = tokenAmount / 1000000
|
||||
let ta = tokenAmount
|
||||
if (typeof tokenAmount === 'string' && tokenAmount.indexOf('.') > 1) {
|
||||
ta = tokenAmount.substring(0, tokenAmount.indexOf('.'))
|
||||
}
|
||||
// eslint-disable-next-line no-undef
|
||||
const amount = Number(BigInt(ta) / decimals)
|
||||
if (amount > 10) {
|
||||
return parseFloat(amount.toFixed(fraction))
|
||||
}
|
||||
|
7
src/store/chains/sifchain.json
Normal file
7
src/store/chains/sifchain.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"chain_name": "sifchain",
|
||||
"api": "https://api.sifchain.finance",
|
||||
"sdk_version": "0.42.6",
|
||||
"addr_prefix": "sif",
|
||||
"logo": "https://dl.airtable.com/.attachments/990cb076d7566e53e976c1fa69d60b09/3c05e786/71144030.jpeg"
|
||||
}
|
7
src/store/chains/starname.json
Normal file
7
src/store/chains/starname.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"chain_name": "starname",
|
||||
"api": "http://lcd-private-iov-mainnet-2.iov.one",
|
||||
"sdk_version": "0.42.6",
|
||||
"addr_prefix": "star",
|
||||
"logo": "https://dl.airtable.com/.attachments/69f75a1b45803d70d8ef69f7f83198e1/d991d407/ZUZfz7Th_400x400.jpg"
|
||||
}
|
@ -1,5 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-alert
|
||||
variant="danger"
|
||||
:show="syncing"
|
||||
>
|
||||
<div class="alert-body">
|
||||
<span>No new block is produced since <strong>{{ latestTime }}</strong> </span>
|
||||
</div>
|
||||
</b-alert>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<summary-parmeters-component :data="chain" />
|
||||
@ -39,9 +47,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { BRow, BCol } from 'bootstrap-vue'
|
||||
import { BRow, BCol, BAlert } from 'bootstrap-vue'
|
||||
import {
|
||||
formatNumber, isToken, percent, toDuration, tokenFormatter,
|
||||
formatNumber, formatTokenAmount, isToken, percent, timeIn, toDay, toDuration, tokenFormatter,
|
||||
} from '@/libs/data'
|
||||
|
||||
import SummaryParmetersComponent from './SummaryParmetersComponent.vue'
|
||||
@ -51,11 +59,14 @@ export default {
|
||||
components: {
|
||||
BRow,
|
||||
BCol,
|
||||
BAlert,
|
||||
SummaryParmetersComponent,
|
||||
SummaryAssetsComponent,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
syncing: false,
|
||||
latestTime: '',
|
||||
chain: {
|
||||
title: '',
|
||||
class: 'border-primary',
|
||||
@ -165,6 +176,12 @@ export default {
|
||||
|
||||
this.$set(this.chain, 'title', `Chain ID: ${res.block.header.chain_id}`)
|
||||
this.$set(this.chain.items[height], 'title', res.block.header.height)
|
||||
if (timeIn(res.block.header.time, 3, 'm')) {
|
||||
this.syncing = true
|
||||
} else {
|
||||
this.syncing = false
|
||||
}
|
||||
this.latestTime = toDay(res.block.header.time, 'long')
|
||||
})
|
||||
|
||||
this.$http.getMintingInflation().then(res => {
|
||||
@ -176,9 +193,8 @@ export default {
|
||||
this.staking = this.normalize(res, 'Staking Parameters')
|
||||
Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)])
|
||||
.then(pool => {
|
||||
const nano = 1000000
|
||||
const bondedAndSupply = this.chain.items.findIndex(x => x.subtitle === 'bonded_and_supply')
|
||||
this.$set(this.chain.items[bondedAndSupply], 'title', `${formatNumber(pool[0].bondedToken / nano, true, 1)} / ${formatNumber(pool[1].amount / nano, true, 1)}`)
|
||||
this.$set(this.chain.items[bondedAndSupply], 'title', `${formatNumber(formatTokenAmount(pool[0].bondedToken, 2, res.bond_denom), true, 2)} / ${formatNumber(formatTokenAmount(pool[1].amount, 2, res.bond_denom), true, 2)}`)
|
||||
const bondedRatio = this.chain.items.findIndex(x => x.subtitle === 'bonded_ratio')
|
||||
this.$set(this.chain.items[bondedRatio], 'title', `${percent(pool[0].bondedToken / pool[1].amount)}%`)
|
||||
})
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
<script>
|
||||
import { BTable, BCardTitle, BCard } from 'bootstrap-vue'
|
||||
import { formatNumber, formatTokenDenom } from '@/libs/data'
|
||||
import { formatNumber, formatTokenAmount, formatTokenDenom } from '@/libs/data'
|
||||
import chainAPI from '@/libs/fetch'
|
||||
|
||||
export default {
|
||||
@ -53,7 +53,7 @@ export default {
|
||||
}
|
||||
const xh = x
|
||||
const amount = Number(x.amount) / 1000000
|
||||
xh.abbr = amount > 1 ? formatNumber(amount, true) : amount
|
||||
xh.abbr = amount > 1 ? formatNumber(formatTokenAmount(x.amount, 0, x.denom), true, 2) : amount
|
||||
return xh
|
||||
})
|
||||
})
|
||||
|
@ -104,7 +104,7 @@
|
||||
<span class="ml-25">{{ token.percent }}%</span>
|
||||
</div>
|
||||
<div class="d-flex flex-column">
|
||||
<span class="text-right">{{ formatAmount(token.amount) }} {{ formatDenom(token.denom) }}</span>
|
||||
<span class="text-right">{{ formatToken(token) }}</span>
|
||||
<small class="text-right">{{ currency }}{{ token.currency }}</small>
|
||||
</div>
|
||||
</div>
|
||||
@ -443,7 +443,7 @@ export default {
|
||||
return this.transactions.txs.map(x => ({
|
||||
height: Number(x.height),
|
||||
txhash: x.txhash,
|
||||
msgs: abbrMessage(x.tx.value.msg),
|
||||
msgs: abbrMessage(x.tx.msg ? x.tx.msg : x.tx.value.msg),
|
||||
time: toDay(x.timestamp),
|
||||
}))
|
||||
}
|
||||
@ -641,14 +641,14 @@ export default {
|
||||
formatDenom(v) {
|
||||
return formatTokenDenom(this.denoms[v] ? this.denoms[v] : v)
|
||||
},
|
||||
formatAmount(v) {
|
||||
return formatTokenAmount(v)
|
||||
formatAmount(v, dec, denom) {
|
||||
return formatTokenAmount(v, dec, denom)
|
||||
},
|
||||
formatToken(v) {
|
||||
return tokenFormatter(v)
|
||||
},
|
||||
formatCurrency(amount, denom) {
|
||||
const qty = this.formatAmount(amount)
|
||||
const qty = this.formatAmount(amount, 2, denom)
|
||||
const d2 = this.formatDenom(denom)
|
||||
const userCurrency = getUserCurrency()
|
||||
const quote = this.$store.state.chains.quotes[d2]
|
||||
|
@ -105,6 +105,15 @@
|
||||
class="cursor-pointer"
|
||||
/>
|
||||
</template>
|
||||
<b-dropdown-item
|
||||
v-if="balances[acc.addr]"
|
||||
:to="`/${acc.chain}/account/${acc.addr}`"
|
||||
>
|
||||
<feather-icon icon="TrelloIcon" /> Detail
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-divider
|
||||
v-if="balances[acc.addr]"
|
||||
/>
|
||||
<b-dropdown-item
|
||||
v-if="balances[acc.addr]"
|
||||
v-b-modal.transfer-window
|
||||
@ -119,12 +128,6 @@
|
||||
>
|
||||
<feather-icon icon="SendIcon" /> IBC Transfer
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
v-if="balances[acc.addr]"
|
||||
:to="`/${acc.chain}/account/${acc.addr}`"
|
||||
>
|
||||
<feather-icon icon="TrelloIcon" /> Detail
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item @click="removeAddress(acc.addr)">
|
||||
<feather-icon icon="Trash2Icon" /> Remove
|
||||
</b-dropdown-item>
|
||||
@ -168,7 +171,7 @@
|
||||
{{ formatDenom(b.denom) }}
|
||||
</div>
|
||||
<div class="d-flex flex-column text-right">
|
||||
<span class="font-weight-bold mb-0">{{ formatAmount(b.amount) }}</span>
|
||||
<span class="font-weight-bold mb-0">{{ formatAmount(b.amount, b.denom) }}</span>
|
||||
<span class="font-small-2 text-muted text-nowrap">{{ currency }}{{ formatCurrency(b.amount, b.denom) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -192,7 +195,7 @@
|
||||
{{ formatDenom(b.denom) }}
|
||||
</div>
|
||||
<div class="d-flex flex-column text-right">
|
||||
<span class="font-weight-bold mb-0">{{ formatAmount(b.amount) }}</span>
|
||||
<span class="font-weight-bold mb-0">{{ formatAmount(b.amount, b.denom) }}</span>
|
||||
<span class="font-small-2 text-muted text-nowrap">{{ currency }}{{ formatCurrency(b.amount, b.denom) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -221,9 +224,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { $themeColors } from '@themeConfig'
|
||||
import {
|
||||
BCard, BCardHeader, BCardTitle, BCardBody, VBModal, BRow, BCol, BTabs, BTab, BAvatar, BDropdown, BDropdownItem,
|
||||
BCard, BCardHeader, BCardTitle, BCardBody, VBModal, BRow, BCol, BTabs, BTab, BAvatar, BDropdown, BDropdownItem, BDropdownDivider,
|
||||
} from 'bootstrap-vue'
|
||||
import Ripple from 'vue-ripple-directive'
|
||||
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
|
||||
@ -253,6 +255,7 @@ export default {
|
||||
BCardTitle,
|
||||
BDropdown,
|
||||
BDropdownItem,
|
||||
BDropdownDivider,
|
||||
FeatherIcon,
|
||||
OperationTransferComponent,
|
||||
// eslint-disable-next-line vue/no-unused-components
|
||||
@ -403,7 +406,7 @@ export default {
|
||||
{
|
||||
label: 'Holdings',
|
||||
data: Object.values(prices),
|
||||
backgroundColor: $themeColors.success,
|
||||
backgroundColor: chartColors(),
|
||||
borderWidth: 0,
|
||||
pointStyle: 'rectRounded',
|
||||
yAxisID: 'y-axis-1',
|
||||
@ -470,14 +473,14 @@ export default {
|
||||
const denom = (v.startsWith('ibc') ? this.ibcDenom[v] : v)
|
||||
return formatTokenDenom(denom)
|
||||
},
|
||||
formatAmount(v) {
|
||||
return formatTokenAmount(v)
|
||||
formatAmount(v, denom = 'uatom') {
|
||||
return formatTokenAmount(v, 2, denom)
|
||||
},
|
||||
formatAddr(v) {
|
||||
return v.substring(0, 10).concat('...', v.substring(v.length - 10))
|
||||
},
|
||||
formatCurrency(amount, denom) {
|
||||
const qty = this.formatAmount(amount)
|
||||
const qty = this.formatAmount(amount, denom)
|
||||
const d2 = this.formatDenom(denom)
|
||||
const quote = this.$store.state.chains.quotes[d2]
|
||||
if (quote) {
|
||||
|
Loading…
Reference in New Issue
Block a user