diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 6b6e48fe..24023de8 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -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 diff --git a/src/libs/osmos.js b/src/libs/osmos.js index 84634c1c..64549e15 100644 --- a/src/libs/osmos.js +++ b/src/libs/osmos.js @@ -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') } } diff --git a/src/navigation/vertical/index.js b/src/navigation/vertical/index.js index 1294edf3..52cc34e6 100644 --- a/src/navigation/vertical/index.js +++ b/src/navigation/vertical/index.js @@ -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', }, diff --git a/src/views/OsmosisPools.vue b/src/views/OsmosisPools.vue index a799d9fb..7c1d879a 100644 --- a/src/views/OsmosisPools.vue +++ b/src/views/OsmosisPools.vue @@ -16,19 +16,19 @@ - #{{ data.id }} {{ formatDenom(data.reserve_coin_denoms[0]) }} - {{ formatDenom(data.reserve_coin_denoms[1]) }} xx + #{{ data.id }} {{ formatDenom(data.poolAssets[0].token.denom) }} - {{ formatDenom(data.poolAssets[1].token.denom) }} xx
Height
- {{ data.height || '0' }} + {{ data.address || '0' }}
- +
- + /> -->
@@ -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), }, diff --git a/src/views/Staking.vue b/src/views/Staking.vue index 7a5ec7c1..b5b82ffb 100644 --- a/src/views/Staking.vue +++ b/src/views/Staking.vue @@ -177,6 +177,7 @@ export default { }, { key: 'operation', + label: '', tdClass: 'text-right', thClass: 'text-right', },