diff --git a/remix-resolve/README.md b/remix-resolve/README.md index 3fadaf5d72..387d8588ae 100644 --- a/remix-resolve/README.md +++ b/remix-resolve/README.md @@ -12,3 +12,25 @@ 'greeter.sol': { content: 'pragma solidity ^0.5.0;\nimport \'mortal.sol\';\n\ncontract Greeter is Mortal {\n /* Define variable greeting of the type string */\n string greeting;\n\n /* This runs when the contract is executed */\n constructor(string memory _greeting) public {\n greeting = _greeting;\n }\n\n /* Main function */\n function greet() public view returns (string memory) {\n return greeting;\n }\n}\n' } } ``` +#### API + +`combineSource(sources)` + +Returns `json` object with exact same path as `import` statement. + +**Output** +```json +{ + './mortal.sol': { content: '...' }, + 'greeter.sol': { content: '...' } +} +``` + +`resolve(path, combinedSources)` function should be called from within `handleImportCb` function of `solc.compile(input, handleImportCb)`. + +```javascript +const rr = require('remix-resolve') +function handleImportCb(path) { + return rr.resolve(path, combinedSources) +} +``` diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 05e337d69a..42e7de4667 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -2,10 +2,6 @@ const rr = require('../src/index.js') const assert = require('assert') const fs = require('fs') const solc = require('solc') -const Compiler = require('remix-solidity').Compiler -const async = require('async') -const Promise = require('promise') -const sleep = require('sleep') describe('testRunner', function () { describe('#combineSource', function() {