From a1494fd8acf61c0807f04f962cbf133ebfc8adc7 Mon Sep 17 00:00:00 2001 From: naz_dou <41945483+nduchak@users.noreply.github.com> Date: Wed, 12 Jun 2019 12:59:34 +0300 Subject: [PATCH] refactor(SCM): Update compatibility range for node: 3.0.1 - 4 (#474) * refactor(SCM): Update compatibility range for node: 3.0.1 - 4 and compiler: 3.1.0 - 4 BREAKING CHANGE: This change will make the release not compatible with older version of the node and compiler * chore(Compiler): Remove logs --- es/contract/compiler.js | 8 ++++++++ es/node.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/es/contract/compiler.js b/es/contract/compiler.js index 7ee52ad9b1..6616fd34df 100644 --- a/es/contract/compiler.js +++ b/es/contract/compiler.js @@ -26,6 +26,7 @@ import Http from '../utils/http' import ContractBase from './index' +import semverSatisfies from '../utils/semver-satisfies' async function getCompilerVersion (options = {}) { return this.http @@ -89,6 +90,10 @@ const ContractCompilerAPI = ContractBase.compose({ async init ({ compilerUrl = this.compilerUrl }) { this.http = Http({ baseUrl: compilerUrl }) this.compilerVersion = await this.getCompilerVersion() + if (!semverSatisfies(this.compilerVersion.split('-')[0], COMPILER_GE_VERSION, COMPILER_LT_VERSION)) { + throw new Error(`Unsupported compiler version ${this.compilerVersion}. ` + + `Supported: >= ${COMPILER_GE_VERSION} < ${COMPILER_LT_VERSION}`) + } }, methods: { contractEncodeCallDataAPI, @@ -106,4 +111,7 @@ const ContractCompilerAPI = ContractBase.compose({ } }) +const COMPILER_GE_VERSION = '3.1.0' +const COMPILER_LT_VERSION = '4.0.0' + export default ContractCompilerAPI diff --git a/es/node.js b/es/node.js index 3d778a85a6..50a1867f19 100644 --- a/es/node.js +++ b/es/node.js @@ -150,7 +150,7 @@ const Node = stampit({ } }) -const NODE_GE_VERSION = '2.3.0' +const NODE_GE_VERSION = '3.0.1' const NODE_LT_VERSION = '4.0.0' export default Node