diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..69e7d588 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,24 @@ +declare module "solc" { + export function version(): string; + export function semver(): string; + export function license(): string; + + export let lowlevel: { + compileSingle: function(input: string): string; + compileMulti: function(input: string): string; + compileCallback: function(input: string): string; + compileStandard: function(input: string): string; + }; + + export let features: { + legacySingleInput: boolean, + multipleInputs: boolean, + importCallback: boolean, + nativeStandardJSON: boolean, + }; + + export type ReadCallbackResult = { contents: string } | { error: string }; + export type ReadCallback = (path: string) => ReadCallbackResult; + export type Callbacks = { import: ReadCallback }; + export function compile(input: string, readCallback?: Callbacks): string; +} diff --git a/package.json b/package.json index e5749aba..133870e3 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.5.14", "description": "Solidity compiler", "main": "index.js", + "types": "index.d.ts", "bin": { "solcjs": "solcjs" },