Utility package for compiling smart contracts, and generating TypeScript definitions & runtime code for them.
In your project install this package:
npm i -D @727-ventures/typechain-compiler
Now you can use it to compile smart contracts, and generate TS definitions & runtime code for them. To use typechain-compiler you need to create a config file, and pass it to the compiler.
We need to create a config file, that will contain all the information about the project, and the contracts that we want to compile.
Config file should be in .json
format, and should contain the following fields:
export interface Config {
projectFiles: string[];
skipLinting : boolean;
artifactsPath : string;
typechainGeneratedPath : string;
isWorkspace ?: boolean;
workspacePath ?: string;
}
Also you can override the config value via CLI arguments.
To compile your project, and generate TS definitions & runtime code for it, run the following command:
npx @727-ventures/typechain-compiler --config path/to/config.json
Also you can provide additional arguments to the compiler:
Options:
--version Show version number [boolean]
-c, --config Config file path
[string] [required] [default: "./config.json"]
-r, --release Compile with release
[boolean] [required] [default: false]
--noCompile, --nc Compile [boolean] [required] [default: false]
--noTypechain, --nt Compile typechain code
[boolean] [required] [default: false]
-h, --help Show help [boolean]