This repository has been archived by the owner on Oct 7, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://www.notion.so/statechannels/Add-TypeChain-tooling-f17342226cb44244be4820b9937c9fae
This didn't go completely smoothly, unfortunately.
The first issue I hit was that the typings exported by typechain did not inherit from the ethers
Contract
class properly: meaning that I got errors when trying to access e.g.nitroAdjudicator.address
. I tracked this down to a mismatch in versions between ethers and typechain. Newer versions of ethers have aBaseContract
class, which is imported by typechain. Older versions (still v5) do not export such a class. See ethers-io/ethers.js#1384 for more info.The next issue was with the typechain contract factories. I got some typescript errors when trying to use these, so I had to fall back to regular ethers contract factories plus type asserting the return value as a typechain class.
Nevertheless, this PR brings us to a state where we can do this:
I didn't spread the types around the codebase much, yet. For now I just used them in the gas benchmarking test. We can do more of that kind of thing in future PRs.