Skip to content

Commit

Permalink
Merge pull request #56 from unification-com/semver
Browse files Browse the repository at this point in the history
Semver - ensure wallet can only connect to updated REST API
  • Loading branch information
Codegnosis authored Mar 9, 2022
2 parents 5bd14ee + 1c24e4a commit 1186e41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-wallet",
"version": "0.20.2-beta",
"version": "0.20.3",
"private": true,
"description": "Unification Mainchain Web Wallet",
"engines": {
Expand All @@ -26,6 +26,7 @@
"create-hash": "^1.2.0",
"jquery": "^3.5.1",
"lodash": "^4.17.21",
"semver": "^7.3.5",
"vue": "^2.6.12",
"vue-notification": "^1.3.20",
"vuex": "^3.6.2"
Expand Down
12 changes: 12 additions & 0 deletions src/components/Wallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ import Unlocked from "./Unlocked.vue"
import Help from "./Help.vue"
const { UndClient } = require("@unification-com/und-js-v2")
const semver = require("semver")
export default {
name: "Wallet",
Expand Down Expand Up @@ -381,6 +382,17 @@ export default {
try {
this.undClient = new UndClient(this.rest)
await this.undClient.initChain()
const cosmosSemVer = semver.coerce(this.undClient?.node_app_version?.cosmos_sdk_version)
const satisfies = semver.satisfies(cosmosSemVer, ">=0.42.11")
if (!satisfies) {
this.showToast(
"error",
"Error",
`${this.rest} (${this.undClient.chainId}) is not running Cosmos SDK >= v0.42.11`,
)
return
}
await this.$store.dispatch("client/setIsConnected")
await this.$store.dispatch("client/setChainId", this.undClient.chainId)
await this.$store.dispatch("client/setNodeInfo", this.undClient.node_info)
Expand Down

0 comments on commit 1186e41

Please sign in to comment.