Closed MicahZoltu closed 5 years ago
The construction interface is simpler. It does seem like in the short-run, it is more tightly bound to ethers, but it's fine for MVP
Internally it always had a hard dependency on ethers, but the public surface area made it appear that wasn't the case. This fixes the bug where we incorrectly give people the idea they have a choice. 😬
The goal here is to make it more obvious/clear how the library is intended to be used, and to also hide the
ethers
implementation detail from users thus allowing us to swap it out in the future. The primary change is removing almost all exports fromindex.ts
. This makes it clear to userse that they should importLiquidLong
and nothing else. To facilitate this, theLiquidLong
class now has a couple factory methods on it that take mostly mundane parameters (such as strings and numbers). The one exception is theweb3Provider
parameter which is really just asking forwindow.web3.currentProvider
(MetaMask and MetaMask like things).To make this work, the library needs to reach inside the library in a couple places for testing. I'm generally not a fan of this pattern, but have left it in for now as something to be addressed later. I believe the correct solution here would be to split the project up into several packages that are tested and released separately, but that is probably overkill at this point.