Skip to content

Commit

Permalink
API breaking fix: check if CosmosBFT version is v0.37 or v0.38
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulBernal committed Oct 29, 2024
1 parent 82eb4f1 commit 83bc4ee
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
13 changes: 11 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,37 @@ export default defineNuxtConfig({
app: {
pageTransition: { name: 'page', mode: 'out-in' }
},

devtools: {
enabled: false
},

modules: [
'@pinia/nuxt',
],

plugins: [
//'~/plugins/sequentialEntrance.js', // only in client side
],

css: [
'vuetify/lib/styles/main.sass',
'@mdi/font/css/materialdesignicons.min.css'
],

build: {
transpile: ['vuetify', 'qrcode-vue3', 'nuxt-storage', 'lodash'],
},

vite: {
define: {
'process.env.DEBUG': false,
},
},

devServer: {
port: 42022
}
})
},

compatibilityDate: '2024-10-29'
})
20 changes: 18 additions & 2 deletions pages/transactions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -762,17 +762,33 @@ export default {
async beforeMount() {
//await this.$store.dispatch("keplr/checkLogin");
//await this.$store.dispatch("data/getAllValidators");
//let's check if CosmosBFT version is v0.37 or v0.38
const nodeInfoResponse = await axios.get(
cosmosConfig[this.store.chainSelected].apiURL +
"/cosmos/base/tendermint/v1beta1/node_info"
);
const minorVersion = parseInt(nodeInfoResponse.data.default_node_info.version.split('.')[1], 10);
let paramName;
if (minorVersion >= 38) {
// For v0.38.x and above
paramName = 'query';
} else {
// For v0.37.x and below
paramName = 'events';
}
const resultSender = await axios(
cosmosConfig[this.store.chainSelected].apiURL +
"/cosmos/tx/v1beta1/txs?query=message.sender=%27" +
"/cosmos/tx/v1beta1/txs?"+paramName+"=message.sender=%27" +
this.store.addrWallet +
"%27&limit=" +
cosmosConfig[this.store.chainSelected].maxTxSender +
"&order_by=2"
);
const resultRecipient = await axios(
cosmosConfig[this.store.chainSelected].apiURL +
"/cosmos/tx/v1beta1/txs?query=transfer.recipient=%27" +
"/cosmos/tx/v1beta1/txs?"+paramName+"=transfer.recipient=%27" +
this.store.addrWallet +
"%27&limit=" +
cosmosConfig[this.store.chainSelected].maxTxRecipient +
Expand Down

0 comments on commit 83bc4ee

Please sign in to comment.