From 0993394e1ca0090311fd06a7246e7766f078ece9 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 4 Apr 2022 16:59:02 +0800 Subject: [PATCH] add timestamp --- src/libs/fetch.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libs/fetch.js b/src/libs/fetch.js index bc17ec8f..83457768 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -60,7 +60,7 @@ export default class ChainFetch { if (conf.chain_name === 'injective') { return ChainFetch.fetch('https://tm.injective.network', '/block').then(data => Block.create(commonProcess(data))) } - return this.get('/blocks/latest', config).then(data => Block.create(data)) + return this.get(`/blocks/latest?${new Date().getTime()}`, config).then(data => Block.create(data)) } async getBlockByHeight(height, config = null) { @@ -386,6 +386,19 @@ export default class ChainFetch { return ChainFetch.fetchCoinMarketCap(`/quote/${symbol}`) } + // Simulate Execution of tx + async simulate(tx, config = null) { + return this.post('/cosmos/tx/v1beta1/simulate', tx, 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 + }) + } + // Tx Submit async broadcastTx(bodyBytes, config = null) { const txString = toBase64(TxRaw.encode(bodyBytes).finish())