Flattener

Flattener

Flattener class. Abstracts flattener functionality for the use of the user, as well as general code modularity.

Constructor

new Flattener(options)

Source:

Initializes a Flattener instance.

Parameters:
Name Type Description
options object

Options object.

{Logger.state.ENUM)

logSetting - Log setting to use with all class functions.

Methods

(async) flatten(files, filepath, writeToFileopt) → {string}

Source:

ASYNC - Flattens all files passed, and optionally writes to file. Generic function in order to work with various kinds of flatteners (truffle-flattener is currently the only one used, but will very likely introduce more options for users in the near future)

Parameters:
Name Type Attributes Default Description
files Array.<string>

Files to flatten; an array of filepaths to be passed, e.g. (['./contracts/meme.sol']) (note; this should usually only be one in most instances; this piece of the API may change soon)

filepath string null

Filepath to write flattened contract to.

writeToFile boolean <optional>
false
Returns:

flattened - Flattened contract. [NOTE FOR DEV]: Seems to be a conflict in using this.options to determine write location, or even whether to write at all; return to this later, commenting out "const dir" line.

Type
string

(async) flattenAndCompile(filepath, writeToFileopt) → {object}

Source:

ASYNC - Flattens the contract at the specified filepath, and compiles the flattened output, returning the compiler.compileSource() output.

Parameters:
Name Type Attributes Default Description
filepath string

Filepath of the single contract to flatten and compile.

writeToFile boolean <optional>
false
Returns:

compiled - See Compiler class for what the output of this may look like.

Type
object