diff --git a/src/lang/locales/en.json b/src/lang/locales/en.json index 2b7d579b..a67f263b 100644 --- a/src/lang/locales/en.json +++ b/src/lang/locales/en.json @@ -25,6 +25,8 @@ "blockchains": "Blockchains", "uptime": "Uptime", + "gravity": "Gravity", + "proposal_id": "Proposal ID", "proposal_type": "Proposal Type", "proposal_proposer": "Proposer", diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 15de8ed6..15fa47b4 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -314,6 +314,10 @@ const chainAPI = class ChainFetch { return ChainFetch.getIBCDenomTrace(baseurl, hash).then(res => res.denom_trace.base_denom) } + async getGravityPools() { + return this.get('/cosmos/liquidity/v1beta1/pools').then(data => commonProcess(data)) + } + // CoinMarketCap static async fetchCoinMarketCap(url) { const host = 'https://price.ping.pub' @@ -328,9 +332,17 @@ const chainAPI = class ChainFetch { const txString = toBase64(TxRaw.encode(bodyBytes).finish()) const txRaw = { tx_bytes: txString, - mode: 'BROADCAST_MODE_SYNC', + mode: 'BROADCAST_MODE_BLOCK', // BROADCAST_MODE_SYNC, BROADCAST_MODE_BLOCK, BROADCAST_MODE_ASYNC } - return this.post('/cosmos/tx/v1beta1/txs', txRaw, config) + return this.post('/cosmos/tx/v1beta1/txs', txRaw, config).then(res => { + if (res.code && res.code !== 0) { + throw new Error(res.message) + } + if (res.tx_response && res.tx_response.code !== 0) { + throw new Error(res.tx_response.raw_log) + } + return res + }) } async post(url = '', data = {}, config = null) { diff --git a/src/navigation/vertical/index.js b/src/navigation/vertical/index.js index 900d0cb1..49f72c9e 100644 --- a/src/navigation/vertical/index.js +++ b/src/navigation/vertical/index.js @@ -26,6 +26,11 @@ const modules = [ title: 'uptime', route: 'uptime', }, + { + scope: 'cosmos', + title: 'gravity', + route: 'gravity', + }, ] function processMenu() { diff --git a/src/router/index.js b/src/router/index.js index 6492c190..39bd09b4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -258,6 +258,20 @@ const router = new VueRouter({ ], }, }, + { + path: '/cosmos/gravity', + name: 'gravity', + component: () => import('@/views/GravityPool.vue'), + meta: { + pageTitle: 'Gravity Pools', + breadcrumb: [ + { + text: 'Gravity', + active: true, + }, + ], + }, + }, { path: '/user/login', name: 'login', diff --git a/src/views/GravityPool.vue b/src/views/GravityPool.vue new file mode 100644 index 00000000..61d0fd9d --- /dev/null +++ b/src/views/GravityPool.vue @@ -0,0 +1,115 @@ + + +