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

add typechain support to nitro-protocol #3575

Closed
wants to merge 7 commits into from
Closed

add typechain support to nitro-protocol #3575

wants to merge 7 commits into from

Conversation

geoknee
Copy link
Contributor

@geoknee geoknee commented Jun 7, 2021

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 a BaseContract 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:

Screenshot 2021-06-07 at 13 11 49

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.

geoknee added 5 commits June 7, 2021 10:27
required the use of skipLibCheck to slience a ts error in this package
but case return value as typechain classes
@geoknee geoknee self-assigned this Jun 7, 2021
@geoknee
Copy link
Contributor Author

geoknee commented Jun 15, 2021

In favour of #3604

@geoknee geoknee closed this Jun 15, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant