forked from cerc-io/cosmos-explorer
Update
This commit is contained in:
parent
201826913b
commit
da47966021
@ -8,6 +8,7 @@ import {
|
||||
Proposal, ProposalTally, Proposer, StakingPool, Votes, Deposit,
|
||||
Validator, StakingParameters, Block, ValidatorDistribution, StakingDelegation, WrapStdTx, getUserCurrency,
|
||||
} from './data'
|
||||
import OsmosAPI from './osmos'
|
||||
|
||||
function commonProcess(res) {
|
||||
if (res && Object.keys(res).includes('result')) {
|
||||
@ -22,7 +23,11 @@ export function keybase(identity) {
|
||||
.then(res => res.json())
|
||||
}
|
||||
|
||||
const chainAPI = class ChainFetch {
|
||||
export default class ChainFetch {
|
||||
constructor() {
|
||||
this.osmosis = new OsmosAPI()
|
||||
}
|
||||
|
||||
getSelectedConfig() {
|
||||
let chain = store.state.chains.selected
|
||||
const lschains = localStorage.getItem('chains')
|
||||
@ -393,15 +398,6 @@ const chainAPI = class ChainFetch {
|
||||
// const response = axios.post((config ? config.api : this.config.api) + url, data)
|
||||
return response.json() // parses JSON response into native JavaScript objects
|
||||
}
|
||||
|
||||
// Custom Module
|
||||
async getOsmosisPools() {
|
||||
return this.get('/osmosis/gamm/v1beta1/pools')
|
||||
}
|
||||
|
||||
async getOsmosisIncentivesPools() {
|
||||
return this.get('/osmosis/pool-incentives/v1beta1/incentivized_pools')
|
||||
}
|
||||
}
|
||||
|
||||
export default chainAPI
|
||||
// export default chainAPI
|
||||
|
@ -1,11 +1,23 @@
|
||||
import fetch from 'node-fetch'
|
||||
import { getLocalChains } from './data/data'
|
||||
|
||||
export default class OsmosAPI {
|
||||
static async get(url) {
|
||||
return fetch(url)
|
||||
preHandler() {
|
||||
this.version = ''
|
||||
}
|
||||
|
||||
static async getPools() {
|
||||
return OsmosAPI.get('/osmosis/gamm/v1beta1/pools')
|
||||
async get(url) {
|
||||
const chains = getLocalChains()
|
||||
this.host = chains.osmosis.api
|
||||
return fetch(`${this.host}${url}`).then(res => res.json())
|
||||
}
|
||||
|
||||
// Custom Module
|
||||
async getPools() {
|
||||
return this.get('/osmosis/gamm/v1beta1/pools?pagination.limit=700')
|
||||
}
|
||||
|
||||
async getIncentivesPools() {
|
||||
return this.get('/osmosis/pool-incentives/v1beta1/incentivized_pools?pagination.limit=700')
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,12 @@ const modules = [
|
||||
route: 'uptime',
|
||||
},
|
||||
{
|
||||
scope: 'cosmos',
|
||||
scope: 'cos-mos',
|
||||
title: 'gravity',
|
||||
route: 'gravity',
|
||||
},
|
||||
{
|
||||
scope: 'osmosis',
|
||||
scope: 'osm-osis',
|
||||
title: 'pools',
|
||||
route: 'osmosis-pool',
|
||||
},
|
||||
|
@ -16,19 +16,19 @@
|
||||
<b-row>
|
||||
<b-col cols="8">
|
||||
<b-card-title class="mb-1 text-uppercase">
|
||||
#{{ data.id }} {{ formatDenom(data.reserve_coin_denoms[0]) }} - {{ formatDenom(data.reserve_coin_denoms[1]) }}<small class="font-small-2"> xx</small>
|
||||
#{{ data.id }} {{ formatDenom(data.poolAssets[0].token.denom) }} - {{ formatDenom(data.poolAssets[1].token.denom) }}<small class="font-small-2"> xx</small>
|
||||
</b-card-title>
|
||||
<div class="font-small-2">
|
||||
Height
|
||||
</div>
|
||||
<h5 class="mb-1">
|
||||
{{ data.height || '0' }}
|
||||
{{ data.address || '0' }}
|
||||
</h5>
|
||||
<b-card-text class="text-muted font-small-2">
|
||||
<!-- <b-card-text class="text-muted font-small-2">
|
||||
<span class="font-weight-bolder">{{ data.pool_coin_denom || '...' }}</span>
|
||||
</b-card-text>
|
||||
</b-card-text> -->
|
||||
</b-col>
|
||||
<b-col
|
||||
<!-- <b-col
|
||||
cols="4"
|
||||
>
|
||||
<b-avatar
|
||||
@ -39,7 +39,7 @@
|
||||
size="82"
|
||||
badge
|
||||
:badge-variant="data.variant"
|
||||
/></b-col>
|
||||
/></b-col> -->
|
||||
</b-row>
|
||||
</b-card>
|
||||
</router-link>
|
||||
@ -73,9 +73,12 @@ export default {
|
||||
},
|
||||
created() {
|
||||
// const api = new OsmosAPI()
|
||||
// this.$http.getOsmosisIncentivesPools().then(res => {
|
||||
// // console.log(res)
|
||||
// })
|
||||
this.$http.osmosis.getIncentivesPools().then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
this.$http.osmosis.getPools().then(res => {
|
||||
this.pools = res
|
||||
})
|
||||
// this.$http.getGravityPools().then(res => {
|
||||
// this.pools = res
|
||||
// res.pools.forEach(x => {
|
||||
@ -101,8 +104,8 @@ export default {
|
||||
methods: {
|
||||
formatDenom(v) {
|
||||
// console.log(v, this.ibcDenom[v])
|
||||
const denom = (v.startsWith('ibc') ? this.ibcDenom[v].denom_trace.base_denom : v)
|
||||
return formatTokenDenom(denom)
|
||||
// const denom = (v.startsWith('ibc') ? this.ibcDenom[v].denom_trace.base_denom : v)
|
||||
return formatTokenDenom(v)
|
||||
},
|
||||
length: v => (Array.isArray(v) ? v.length : 0),
|
||||
},
|
||||
|
@ -177,6 +177,7 @@ export default {
|
||||
},
|
||||
{
|
||||
key: 'operation',
|
||||
label: '',
|
||||
tdClass: 'text-right',
|
||||
thClass: 'text-right',
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user