Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Typechain support #1285

Merged
merged 10 commits into from
Nov 20, 2019
Merged

Typechain support #1285

merged 10 commits into from
Nov 20, 2019

Conversation

spalladino
Copy link
Contributor

I added an optional typechain step to the compilation. If this feature is enabled, after compiling, every modified contract is run through typechain to generate typescript wrappers.

The user is queried whether to enable it on two commands, and only if there is a tsconfig.json present (I'd like your thoughts on these!)

  • Running oz init
  • Running oz compile if there is no typechain info on the project.json file

The user is asked three questions:

  • Whether to enable typechain
  • Which target to use (web3, ethers, or truffle)
  • The output dir

Typechain generation is quite fast, and the packages are rather small. I had initially loaded them lazily, but it ended up not making much of a difference including them in the package (not ethers though, since we don't officially support it).

typechain-oz-sdk

Suggest reviewing commit-by-commit.

Copy link
Contributor

@ylv-io ylv-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An awesome feature to add ❤️
Quite excited for more support to TypeScript.
A few minor comments.
CLI kits test fails because new contracts-ethereum-package 2.4.0 have broke gsn tutorial. I am not sure exactly why but it has nothing to do with this PR. cc @nventuro

packages/cli/src/commands/init.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/init.ts Outdated Show resolved Hide resolved
const args = {
name: projectName,
version,
typechainEnabled: typechain ? true : typechain,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
typechainEnabled: typechain ? true : typechain,
typechainEnabled: !!typechain,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not the same here, just added a comment to clarify

@spalladino spalladino added the status:ready-to-merge Order mergify to merge label Nov 19, 2019
@mergify mergify bot merged commit 116c525 into master Nov 20, 2019
@mergify mergify bot deleted the feature/typechain branch November 20, 2019 08:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready-to-merge Order mergify to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants