0x Developer Update: New 0x.js public interface (August 26th, 2018)


#1

Hi everyone!

We recently published new release candidate versions of our libraries, and one of the largest changes introduced is the new public interface for 0x.js. Up until this point, we have been trying to maintain it’s legacy interface. Over the last few months however, we have quietly split up 0x.js into several stand-alone NPM packages:

Despite creating these new packages, we still wanted to have all of this functionality available in a single 0x.js package. Because of this, we will continue to publish 0x.js, however we have decided that for the RC releases and the V2 release, we will be modifying the legacy interface and instead export the same exports as these sub-packages. This means there will no longer be a ZeroEx class. Instead, it’s contents are now found through different exports discoverable on the 0x.js doc reference page. This change reduces the amount of code the 0x dev team needs to maintain, and also makes it easier for developers to migrate from the 0x.js monolith package to a smaller subset of sub-packages they actually rely on.

An additional change to the 0x.js interface is that some of the static helper functions that used to be exposed through 0x.js now only exist through @0xproject/web3-wrapper. These include:

Some of this functionality is also available on alternative “Web3” libraries such as Ethers.js and Web3.js. Feel free to use your preferred library.

Thank you for your understanding and please let us know in the comments before if you feel anything is missing or not intuitive enough. We are always looking for feedback so as to improve the 0x developer experience.


#2

Will the 0x-v2-beta-starter-project be updated to reflect the changes? Currently code in the V2 starter projects are still using “import { ZeroEx } from ‘0x.js’”


#3

Yup see the branch in the official repo: https://github.com/0xProject/0x-starter-project/tree/feature/v2


#4

Thanks! Yes, that branch contains new code that no longer uses the ZeroEx class.

However, I see in this branch 0x.js is still a dependency and I see "import { … } from ‘0x.js’ in the code. Please correct me if I’m wrong. I though the 0x.js itself will retire and we should use import { … } from ‘@0xproject/contract-wrappers’ (or other individual packages) instead.

Pleas clarify. Thanks!


#5

0x.js basically exists to re-export the other packages functionality. You can choose to ‘import { ContractWrappers } from “0x.js”’ or you can pull directly from the underlying packages, ‘import { ContractWrappers } from “@0xproject/contract-wrappers”’.

Advantage of using 0x.js (which has contract wrappers etc as a dependency) as bring in the most useful packages by default.