|
|
|
@ -106,6 +106,13 @@ export class CompilerImports extends Plugin { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async importTestFiles () { |
|
|
|
|
const provider = await this.call('fileManager', 'getProviderOf', null) |
|
|
|
|
const content = remixTests.assertLibCode |
|
|
|
|
if (provider) provider.addExternal('.deps/remix-tests/remix-tests.sol', content, 'remix_tests.sol') |
|
|
|
|
return content |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* import the content of @arg url. |
|
|
|
|
* first look in the browser localstorage (browser explorer) or locahost explorer. if the url start with `browser/*` or `localhost/*` |
|
|
|
@ -117,7 +124,9 @@ export class CompilerImports extends Plugin { |
|
|
|
|
* @returns {Promise} - string content |
|
|
|
|
*/ |
|
|
|
|
async resolveAndSave (url, targetPath) { |
|
|
|
|
if (url.indexOf('remix_tests.sol') !== -1) return remixTests.assertLibCode |
|
|
|
|
if (url.indexOf('remix_tests.sol') !== -1) { |
|
|
|
|
return await this.importTestFiles() |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
const provider = await this.call('fileManager', 'getProviderOf', url) |
|
|
|
|
if (provider) { |
|
|
|
|