0.1.1 • Published 5 years ago

resolver-engine v0.1.1

Weekly downloads
7
License
LGPL-3.0-or-later
Repository
github
Last release
5 years ago

Usage

We provide a pre-built complete engine with sane defaults.

import { SolidityImportResolver } from "resolver-engine";

const resolver = SolidityImportResolver();

resolver
  .require("@zeppelin-solidity/contracts/Ownable.sol")
  .then(console.log)
  .catch(console.error);

Otherwise, you can build your own engines

import { ResolverEngine, NodeResolver, FsResolver, FsParser } from "resolver-engine";

const resolver = new ResolverEngine<string>()
  .addResolver(FsResolver("contracts/"))
  .addResolver(NodeResolver())
  .addParser(FsParser());

resolver
  .resolve("@zeppelin-solidity/contracts/Ownable.sol")
  .then(console.log)
  .catch(console.error);

In the examples/ folder more granular examples can be found

Why

Each Solidity framework has different logic concerning Solidity import statements as well as creating different format of artifacts. This becomes problematic when target developers want to use multiple tools on the same codebase.

For example, Truffle artifacts are not compatible with 0xProject's solidity coverage tooling. Documentation generation doesn't support NPM-like Solidity imports which are supported by both Truffle and 0x, at the same time, neither of which support github import statements as the ones Remix does.

The goal of this library is to provide tooling for framework developers so that they can implement multiple artifacts and solidity importing with ease, as well as providing sane defaults that would standarize the functionallity.

0.1.1

5 years ago

0.1.0

5 years ago