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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ v2 ]
|
branches: [ master ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ v2 ]
|
branches: [ master ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
"juno": "Juno",
|
"juno": "Juno",
|
||||||
"certik": "Certik",
|
"certik": "Certik",
|
||||||
"sentinel": "Sentinel",
|
"sentinel": "Sentinel",
|
||||||
|
"sifchain": "Sifchain",
|
||||||
|
"starname": "Starname",
|
||||||
|
|
||||||
"staking": "Staking",
|
"staking": "Staking",
|
||||||
"governance": "Governance",
|
"governance": "Governance",
|
||||||
|
@ -269,10 +269,16 @@ export function formatTokenDenom(tokenDenom) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
|
export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
|
||||||
if (denom.startsWith('u')) {
|
let decimals = 1000000n
|
||||||
// for special case
|
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) {
|
if (amount > 10) {
|
||||||
return parseFloat(amount.toFixed(fraction))
|
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>
|
<template>
|
||||||
<div>
|
<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-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<summary-parmeters-component :data="chain" />
|
<summary-parmeters-component :data="chain" />
|
||||||
@ -39,9 +47,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { BRow, BCol } from 'bootstrap-vue'
|
import { BRow, BCol, BAlert } from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
formatNumber, isToken, percent, toDuration, tokenFormatter,
|
formatNumber, formatTokenAmount, isToken, percent, timeIn, toDay, toDuration, tokenFormatter,
|
||||||
} from '@/libs/data'
|
} from '@/libs/data'
|
||||||
|
|
||||||
import SummaryParmetersComponent from './SummaryParmetersComponent.vue'
|
import SummaryParmetersComponent from './SummaryParmetersComponent.vue'
|
||||||
@ -51,11 +59,14 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
BRow,
|
BRow,
|
||||||
BCol,
|
BCol,
|
||||||
|
BAlert,
|
||||||
SummaryParmetersComponent,
|
SummaryParmetersComponent,
|
||||||
SummaryAssetsComponent,
|
SummaryAssetsComponent,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
syncing: false,
|
||||||
|
latestTime: '',
|
||||||
chain: {
|
chain: {
|
||||||
title: '',
|
title: '',
|
||||||
class: 'border-primary',
|
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, 'title', `Chain ID: ${res.block.header.chain_id}`)
|
||||||
this.$set(this.chain.items[height], 'title', res.block.header.height)
|
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 => {
|
this.$http.getMintingInflation().then(res => {
|
||||||
@ -176,9 +193,8 @@ export default {
|
|||||||
this.staking = this.normalize(res, 'Staking Parameters')
|
this.staking = this.normalize(res, 'Staking Parameters')
|
||||||
Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)])
|
Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)])
|
||||||
.then(pool => {
|
.then(pool => {
|
||||||
const nano = 1000000
|
|
||||||
const bondedAndSupply = this.chain.items.findIndex(x => x.subtitle === 'bonded_and_supply')
|
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')
|
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)}%`)
|
this.$set(this.chain.items[bondedRatio], 'title', `${percent(pool[0].bondedToken / pool[1].amount)}%`)
|
||||||
})
|
})
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { BTable, BCardTitle, BCard } from 'bootstrap-vue'
|
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'
|
import chainAPI from '@/libs/fetch'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -53,7 +53,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const xh = x
|
const xh = x
|
||||||
const amount = Number(x.amount) / 1000000
|
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
|
return xh
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
<span class="ml-25">{{ token.percent }}%</span>
|
<span class="ml-25">{{ token.percent }}%</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-column">
|
<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>
|
<small class="text-right">{{ currency }}{{ token.currency }}</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -443,7 +443,7 @@ export default {
|
|||||||
return this.transactions.txs.map(x => ({
|
return this.transactions.txs.map(x => ({
|
||||||
height: Number(x.height),
|
height: Number(x.height),
|
||||||
txhash: x.txhash,
|
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),
|
time: toDay(x.timestamp),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -641,14 +641,14 @@ export default {
|
|||||||
formatDenom(v) {
|
formatDenom(v) {
|
||||||
return formatTokenDenom(this.denoms[v] ? this.denoms[v] : v)
|
return formatTokenDenom(this.denoms[v] ? this.denoms[v] : v)
|
||||||
},
|
},
|
||||||
formatAmount(v) {
|
formatAmount(v, dec, denom) {
|
||||||
return formatTokenAmount(v)
|
return formatTokenAmount(v, dec, denom)
|
||||||
},
|
},
|
||||||
formatToken(v) {
|
formatToken(v) {
|
||||||
return tokenFormatter(v)
|
return tokenFormatter(v)
|
||||||
},
|
},
|
||||||
formatCurrency(amount, denom) {
|
formatCurrency(amount, denom) {
|
||||||
const qty = this.formatAmount(amount)
|
const qty = this.formatAmount(amount, 2, denom)
|
||||||
const d2 = this.formatDenom(denom)
|
const d2 = this.formatDenom(denom)
|
||||||
const userCurrency = getUserCurrency()
|
const userCurrency = getUserCurrency()
|
||||||
const quote = this.$store.state.chains.quotes[d2]
|
const quote = this.$store.state.chains.quotes[d2]
|
||||||
|
@ -105,6 +105,15 @@
|
|||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
/>
|
/>
|
||||||
</template>
|
</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
|
<b-dropdown-item
|
||||||
v-if="balances[acc.addr]"
|
v-if="balances[acc.addr]"
|
||||||
v-b-modal.transfer-window
|
v-b-modal.transfer-window
|
||||||
@ -119,12 +128,6 @@
|
|||||||
>
|
>
|
||||||
<feather-icon icon="SendIcon" /> IBC Transfer
|
<feather-icon icon="SendIcon" /> IBC Transfer
|
||||||
</b-dropdown-item>
|
</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)">
|
<b-dropdown-item @click="removeAddress(acc.addr)">
|
||||||
<feather-icon icon="Trash2Icon" /> Remove
|
<feather-icon icon="Trash2Icon" /> Remove
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
@ -168,7 +171,7 @@
|
|||||||
{{ formatDenom(b.denom) }}
|
{{ formatDenom(b.denom) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-column text-right">
|
<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>
|
<span class="font-small-2 text-muted text-nowrap">{{ currency }}{{ formatCurrency(b.amount, b.denom) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -192,7 +195,7 @@
|
|||||||
{{ formatDenom(b.denom) }}
|
{{ formatDenom(b.denom) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-column text-right">
|
<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>
|
<span class="font-small-2 text-muted text-nowrap">{{ currency }}{{ formatCurrency(b.amount, b.denom) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -221,9 +224,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { $themeColors } from '@themeConfig'
|
|
||||||
import {
|
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'
|
} from 'bootstrap-vue'
|
||||||
import Ripple from 'vue-ripple-directive'
|
import Ripple from 'vue-ripple-directive'
|
||||||
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
|
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
|
||||||
@ -253,6 +255,7 @@ export default {
|
|||||||
BCardTitle,
|
BCardTitle,
|
||||||
BDropdown,
|
BDropdown,
|
||||||
BDropdownItem,
|
BDropdownItem,
|
||||||
|
BDropdownDivider,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
OperationTransferComponent,
|
OperationTransferComponent,
|
||||||
// eslint-disable-next-line vue/no-unused-components
|
// eslint-disable-next-line vue/no-unused-components
|
||||||
@ -403,7 +406,7 @@ export default {
|
|||||||
{
|
{
|
||||||
label: 'Holdings',
|
label: 'Holdings',
|
||||||
data: Object.values(prices),
|
data: Object.values(prices),
|
||||||
backgroundColor: $themeColors.success,
|
backgroundColor: chartColors(),
|
||||||
borderWidth: 0,
|
borderWidth: 0,
|
||||||
pointStyle: 'rectRounded',
|
pointStyle: 'rectRounded',
|
||||||
yAxisID: 'y-axis-1',
|
yAxisID: 'y-axis-1',
|
||||||
@ -470,14 +473,14 @@ export default {
|
|||||||
const denom = (v.startsWith('ibc') ? this.ibcDenom[v] : v)
|
const denom = (v.startsWith('ibc') ? this.ibcDenom[v] : v)
|
||||||
return formatTokenDenom(denom)
|
return formatTokenDenom(denom)
|
||||||
},
|
},
|
||||||
formatAmount(v) {
|
formatAmount(v, denom = 'uatom') {
|
||||||
return formatTokenAmount(v)
|
return formatTokenAmount(v, 2, denom)
|
||||||
},
|
},
|
||||||
formatAddr(v) {
|
formatAddr(v) {
|
||||||
return v.substring(0, 10).concat('...', v.substring(v.length - 10))
|
return v.substring(0, 10).concat('...', v.substring(v.length - 10))
|
||||||
},
|
},
|
||||||
formatCurrency(amount, denom) {
|
formatCurrency(amount, denom) {
|
||||||
const qty = this.formatAmount(amount)
|
const qty = this.formatAmount(amount, denom)
|
||||||
const d2 = this.formatDenom(denom)
|
const d2 = this.formatDenom(denom)
|
||||||
const quote = this.$store.state.chains.quotes[d2]
|
const quote = this.$store.state.chains.quotes[d2]
|
||||||
if (quote) {
|
if (quote) {
|
||||||
|
Loading…
Reference in New Issue
Block a user