Using @typechain/truffle-v5

Open
#548 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
blockchain

Research direction

Start in package.json, where the Truffle v5 and TypeChain dependencies are declared, then inspect uses of LockupInstance and depositToProperty. Update the affected calls and type inferences for @typechain/truffle-v5 while preserving existing assertions and behavior; done means the existing test cases pass in CI without type errors.

Written by the indexing model from the issue text.

Description

enhancement
Detailed description

Currently, this project is using Truffle v5.

https://github.com/dev-protocol/protocol-v2/blob/2abee70352043073e5841ec04cb1d0363b774cf1/package.json#L49

But Typechain is targeted as @typechain/truffle-v4.

https://github.com/dev-protocol/protocol-v2/blob/2abee70352043073e5841ec04cb1d0363b774cf1/package.json#L7
https://github.com/dev-protocol/protocol-v2/blob/2abee70352043073e5841ec04cb1d0363b774cf1/package.json#L28

We need to use @typechain/truffle-v5.

Context

Changing the Typechain version should result in many type errors, but as long as the existing test cases pass the CI, the existing codes are certainly executable code.

So, we will need to change function callings or type inferences to accommodate the new types, but basically the assertions and behavior itself should not need to change.

Possible implementation

No response

Additional information

As I tried it locally... it seems like the following major changes are needed:

  • LockupInstance type is no longer exports depositToProperty, it exports methods['depositToProperty(address,uint256)'] and methods['depositToProperty(address,uint256,bytes32)'] instead of it.
  • Truffle is no longer uses BigNumber.js, it uses bn.js instead of it. But we only use the interfaces common to both and test cases have no problem.
Code of Conduct
  • I agree to follow this project's Code of Conduct
Dominant language
TypeScript
Stars
18
Forks
3
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dev-protocol/protocol-v2

All issues in dev-protocol/protocol-v2

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.