Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
TypedDataUtils
to be called unbound
Previously the functions exposed as `TypedDataUtils` could only be called from the `TypedDataUtils` object. If they were called unbound, they would throw errors because of the use of `this`. They have all been updated to no longer rely upon `this`, so they now work the same way regardless how they are bound when called. They are still exported as the `TypedDataUtils` object, so this should not change the API. This was done to simplify the code, specifically to make it easier for functions outside of `TypedDataUtils` to reuse code inside of `TypedDataUtils`. Some types requried adjustments, as type mistakes were brought to light that TypeScript for some reason wasn't aware of when these were declared as properties of the `TypedDataUtils` object. These were fixed by adding two type assertions, and by making the `types` parameter to `hashStruct` more strict. The type assertions (warrranted or not) preserve the types used previously. We can replace them later with validation.
- Loading branch information