0xProject / 0x-launch-kit-frontend

Apache License 2.0
112 stars 207 forks source link

Thunks extra argument #338

Closed fvictorio closed 5 years ago

fvictorio commented 5 years ago

This is an alternative to #333.

Thunks now get helper functions (getWeb3Wrapper, getContractWrappers, etc.) from the extra (third) argument. This makes them more testable.

A side-effect of this is that now all thunks are typed: you'll see that the ThunkCreator signature was added to all of them. But this means that dispatch is smarter now, and it detects floating promises. I added a bunch of comments ignoring this error. I think this is good, though: those floating promises come from places where thunks are too tightly coupled. We can improve this later with some middleware that dispatches certain thunks when certain events happen.

I also added some tests to have as examples. They need to mock a lot of stuff, and might be a little too white-box, but it's a start.

mariano-aguero commented 5 years ago

@fvictorio Please solve the conflicts, question: Maybe is a good idea to change the base branch to the https://github.com/0xProject/0x-launch-kit-frontend/tree/erc721 ? What do you think ? Thanks