Opiniated list of tools for TypeScript development with Ethereum
23rd Mar 2022
Do you want to use TypeScript when developing an app that interfaces with Ethereum? Here are some tools in the landscape.
- Ethers - Ethers is the best library right now for interfacing with Ethereum contracts. It includes neat utilities like
BigNumber
andisAddress
. The library and utilities are typed, but the contracts are NOT automatically typed.
- TypeChain - Gives you fully typed interfaces for your
.sol
smart contracts. Paired with Ethers (or web3.js) under the hood. TypeChain basically injects Ethers with types.
- HardHat - Development environment to set up compiling, testing, deployment, and debugging when writing your own
.sol
smart contracts. Easy to add TypeChain and get types.
- Waffle - Good tool for testing. It let’s you deploy, compile and mock contracts in tests. Usually paired with Chai (assertion methods
expect
,assert
) and a test runner (Mocha).
- @openzeppelin/test-helpers - An Ethereum supercharged version of Chai. Provides ethereum specific assertion methods like
expectRevert
,expectEvent
and works well withBigNumber
.
- useDapp - React hooks for Ethereum interactions like
useEtherBalance
,useTokenBalance
. Uses Ethers under the hood. Can pair with TypeChain for types.
- solhint - Eslint but for Solidity development
This seems to be missing from the landscape
There is no good way to use Ethers with types without having your own .sol
contracts.
Imagine if you want to interface with ERC-20 contracts that you don’t develop yourself. It would be cool to have types in Ethers another way than using TypeChain.
Tools you probably don’t want to use
- Web3.js - Came out before Ethers. Ethers has better types and is generally a more solid library. You’ll probably want to use Ethers instead.
- Truffle - Similar to HardHat. Been around for longer. Hardhat provides a better experience for TypeScript.
- Drizzle - last commit in 2020, seems dead. Also, it uses redux and who wants to use redux.