diff --git a/apps/remix-ide-e2e/src/tests/generalSettings.test.ts b/apps/remix-ide-e2e/src/tests/generalSettings.test.ts index 52794aa2ac..a3ddde4d1d 100644 --- a/apps/remix-ide-e2e/src/tests/generalSettings.test.ts +++ b/apps/remix-ide-e2e/src/tests/generalSettings.test.ts @@ -27,6 +27,11 @@ module.exports = { .pause(3000) .click('*[data-id="verticalIconsKindfileExplorers"]') .openFile('browser/artifacts/Ballot.json') + .openFile('browser/artifacts/Ballot_metadata.json') + .getEditorValue((content) => { + const metadata = JSON.parse(content) + browser.assert.equal(metadata.language, 'Solidity') + }) }, 'Should add new github access token': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide/src/app/files/compiler-metadata.js b/apps/remix-ide/src/app/files/compiler-metadata.js index b1dd9239e3..c77bfa7614 100644 --- a/apps/remix-ide/src/app/files/compiler-metadata.js +++ b/apps/remix-ide/src/app/files/compiler-metadata.js @@ -24,6 +24,10 @@ class CompilerMetadata extends Plugin { return path + '/' + this.innerPath + '/' + contractName + '.json' } + _MetadataFileName(path, contractName) { + return path + '/' + this.innerPath + '/' + contractName + '_metadata' + '.json' + } + onActivation () { var self = this this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => { @@ -36,6 +40,7 @@ class CompilerMetadata extends Plugin { if (contract.file !== source.target) return var fileName = self._JSONFileName(path, contract.name) + var metadataFileName = self._MetadataFileName(path, contract.name) provider.get(fileName, (error, content) => { if (!error) { content = content || '{}' @@ -51,6 +56,8 @@ class CompilerMetadata extends Plugin { deploy[network] = self._syncContext(contract, deploy[network] || {}) }) + provider.set(metadataFileName, JSON.stringify(JSON.parse(contract.object.metadata), null, '\t')) + var data = { deploy, data: {