add timestamp

This commit is contained in:
liangping 2022-04-04 16:59:02 +08:00
parent 20f787e1b8
commit 0993394e1c

View File

@ -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())