Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Reduce type de-duplication and finalize all APIs #900

Open
albrow opened this issue Aug 10, 2020 · 0 comments
Open

Reduce type de-duplication and finalize all APIs #900

albrow opened this issue Aug 10, 2020 · 0 comments

Comments

@albrow
Copy link
Contributor

albrow commented Aug 10, 2020

Related to #859. The combination of the new GraphQL API and the big database upgrade has left our types in a pretty bad place. There is a lot of code in the repository related purely to describing types with subtle differences and how to convert between them. There are a few different steps that we could take to address the problem. We need to prioritize any potential changes that could affect backwards compatibility so that they get included in the v10 release instead of afterwards.

  1. Use strings whenever possible instead of common.Address, common.Hash, and common.Bytes. Strings are easy to convert to JavaScript, JSON, GraphQL, and SQL, but the types from the common package need to be converted manually. This change alone would remove a lot of type conversion code.
  2. Make the browser API, native Go API, and GraphQL API match more closely. Ideally the browser API and the TypeScript GraphQL client should have the same interface. This will help us accomplish some of the goals laid out in GraphQL API Draft Specification #854 and simplify the experience of using 0x Mesh.
  3. Create a types package in the TypeScript monorepo (i.e. the packages/ directory) which contains all common types and conversion between them. @0x/mesh-browser, @0x/mesh-browser-lite, and @0x/mesh-graphql-client can all depend on this types package.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant