diff --git a/apps/remix-ide-e2e/src/tests/url.spec.ts b/apps/remix-ide-e2e/src/tests/url.spec.ts index a2abb2cba2..0cb021afbf 100644 --- a/apps/remix-ide-e2e/src/tests/url.spec.ts +++ b/apps/remix-ide-e2e/src/tests/url.spec.ts @@ -38,22 +38,22 @@ module.exports = { .refresh() .pause(5000) .clickLaunchIcon('solidity') - .assert.containsText('#versionSelector option[selected="selected"]', '0.7.4+commit.3f05b770') - .assert.containsText('#evmVersionSelector option[selected="selected"]', 'istanbul') + .assert.containsText('#versionSelector option[data-id="selected"]', '0.7.4+commit.3f05b770') + .assert.containsText('#evmVersionSelector option[data-id="selected"]', 'istanbul') .verify.elementPresent('#optimize:checked') .verify.attributeEquals('#runs', 'value', '300') }, 'Should load using compiler from link passed in remix URL': function (browser: NightwatchBrowser) { browser - .url('http://127.0.0.1:8080/#version=https://solidity-blog.s3.eu-central-1.amazonaws.com/data/08preview/soljson.js') + .url('http://127.0.0.1:8080/#version=https://solidity-blog.s3.eu-central-1.amazonaws.com/data/08preview/soljson.js&optimize=false') .refresh() .pause(5000) .clickLaunchIcon('solidity') .pause(5000) - .assert.containsText('#versionSelector option[selected="selected"]', 'custom') + .assert.containsText('#versionSelector option[data-id="selected"]', 'custom') // default values - .assert.containsText('#evmVersionSelector option[selected="selected"]', 'default') + .assert.containsText('#evmVersionSelector option[data-id="selected"]', 'default') .verify.elementPresent('#optimize') .assert.elementNotPresent('#optimize:checked') .verify.elementPresent('#runs:disabled') diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index af5e571f49..37444dce22 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -56,12 +56,19 @@ export const CompilerContainer = (props: CompilerContainerProps) => { useEffect(() => { if (compileTabLogic && compileTabLogic.compiler) { setState(prevState => { + const params = queryParams.get() + const optimize = params.optimize === 'false' ? false : params.optimize === 'true' ? true : null + const runs = params.runs + const evmVersion = params.evmVersion + return { ...prevState, hideWarnings: config.get('hideWarnings') || false, autoCompile: config.get('autoCompile') || false, - optimise: config.get('optimise') || false, - includeNightlies: config.get('includeNightlies') || false + includeNightlies: config.get('includeNightlies') || false, + optimise: (optimize !== null) && (optimize !== undefined) ? optimize : config.get('optimise') || false, + runs: (runs !== null) && (runs !== 'null') && (runs !== undefined) && (runs !== 'undefined') ? runs : 200, + evmVersion: (evmVersion !== null) && (evmVersion !== 'null') && (evmVersion !== undefined) && (evmVersion !== 'undefined') ? evmVersion : 'default' } }) } @@ -505,12 +512,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => { handleLoadVersion(e.target.value) } className="custom-select" id="versionSelector" disabled={state.allversions.length <= 0}> - { state.allversions.length <= 0 && { state.defaultVersion } } - { state.allversions.length <= 0 && builtin } - { state.customVersions.map((url, i) => custom )} + { state.allversions.length <= 0 && { state.defaultVersion } } + { state.allversions.length <= 0 && builtin } + { state.customVersions.map((url, i) => custom )} { state.allversions.map((build, i) => { return _shouldBeAdded(build.longVersion) - ? {build.longVersion} + ? {build.longVersion} : null }) } @@ -529,16 +536,16 @@ export const CompilerContainer = (props: CompilerContainerProps) => { EVM Version - handleEvmVersionChange(e.target.value)} className="custom-select" id="evmVersionSelector"> - compiler default - muirGlacier - istanbul - petersburg - constantinople - byzantium - spuriousDragon - tangerineWhistle - homestead + handleEvmVersionChange(e.target.value)} className="custom-select" id="evmVersionSelector"> + compiler default + muirGlacier + istanbul + petersburg + constantinople + byzantium + spuriousDragon + tangerineWhistle + homestead @@ -556,7 +563,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { className="custom-select ml-2 remixui_runs" id="runs" placeholder="200" - defaultValue="200" + value={state.runs} type="number" title="Estimated number of times each opcode of the deployed code will be executed across the life-time of the contract." onChange={(e) => onChangeRuns(e.target.value)}