From cf46d2c7049461e25441239e71f486bfbd2a986a Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Thu, 13 Sep 2018 13:51:09 +0200 Subject: 0xjs README/website docs update --- packages/website/md/docs/0xjs/0.0.1/async.md | 26 ++++++++++++++++++ packages/website/md/docs/0xjs/0.0.1/errors.md | 1 + .../website/md/docs/0xjs/0.0.1/installation.md | 31 ++++++++++++++++++++++ .../website/md/docs/0xjs/0.0.1/introduction.md | 1 + packages/website/md/docs/0xjs/0.0.1/versioning.md | 1 + 5 files changed, 60 insertions(+) create mode 100644 packages/website/md/docs/0xjs/0.0.1/async.md create mode 100644 packages/website/md/docs/0xjs/0.0.1/errors.md create mode 100644 packages/website/md/docs/0xjs/0.0.1/installation.md create mode 100644 packages/website/md/docs/0xjs/0.0.1/introduction.md create mode 100644 packages/website/md/docs/0xjs/0.0.1/versioning.md (limited to 'packages/website/md/docs/0xjs/0.0.1') diff --git a/packages/website/md/docs/0xjs/0.0.1/async.md b/packages/website/md/docs/0xjs/0.0.1/async.md new file mode 100644 index 000000000..8abaef331 --- /dev/null +++ b/packages/website/md/docs/0xjs/0.0.1/async.md @@ -0,0 +1,26 @@ +0x.js is a promise-based library. This means that whenever an asynchronous call is required, the library method will return a native Javascript promise. You can therefore choose between using `promise` or `async/await` syntax when calling our async methods. + +_Async/await syntax (recommended):_ + +```javascript +try { + var availableAddresses = await zeroEx.getAvailableAddressesAsync(); +} catch (error) { + console.log('Caught error: ', error); +} +``` + +_Promise syntax:_ + +```javascript +zeroEx + .getAvailableAddressesAsync() + .then(function(availableAddresses) { + console.log(availableAddresses); + }) + .catch(function(error) { + console.log('Caught error: ', error); + }); +``` + +As is the convention with promise-based libraries, if an error occurs, it is thrown. It is the callers responsibility to catch thrown errors and to handle them appropriately. diff --git a/packages/website/md/docs/0xjs/0.0.1/errors.md b/packages/website/md/docs/0xjs/0.0.1/errors.md new file mode 100644 index 000000000..e97973ccf --- /dev/null +++ b/packages/website/md/docs/0xjs/0.0.1/errors.md @@ -0,0 +1 @@ +All error messages thrown by the 0x.js library are part of a documented string enum. Each error message is in all-caps, snake-case format. This makes the error messages easily identifiable, unique and grep-able. The error enums listing all possible errors the library could throw can be found in the `Types` section. diff --git a/packages/website/md/docs/0xjs/0.0.1/installation.md b/packages/website/md/docs/0xjs/0.0.1/installation.md new file mode 100644 index 000000000..ac0a47699 --- /dev/null +++ b/packages/website/md/docs/0xjs/0.0.1/installation.md @@ -0,0 +1,31 @@ +0x.js ships as both a [UMD](https://github.com/umdjs/umd) module and a [CommonJS](https://en.wikipedia.org/wiki/CommonJS) package. + +#### CommonJS _(recommended)_: + +**Install** + +```bash +npm install 0x.js --save +``` + +**Import** + +```javascript +import { ZeroEx } from '0x.js'; +``` + +#### UMD: + +**Install** + +Download the UMD module from our [releases page](https://github.com/0xProject/0x-monorepo/releases) and add it to your project. + +**Import** + +```html + +``` + +### Wiki + +Check out our [wiki](https://0xproject.com/wiki) for articles on how to get 0x.js setup with TestRPC, Infura and more! diff --git a/packages/website/md/docs/0xjs/0.0.1/introduction.md b/packages/website/md/docs/0xjs/0.0.1/introduction.md new file mode 100644 index 000000000..008376d33 --- /dev/null +++ b/packages/website/md/docs/0xjs/0.0.1/introduction.md @@ -0,0 +1 @@ +Welcome to the [0x.js](https://github.com/0xProject/0x-monorepo) documentation! 0x.js is a Javascript library for interacting with the 0x protocol. With it, you can easily make calls to the 0x smart contracts as well as any ERC20 token. Functionality includes generating, signing, filling and cancelling orders, verifying an orders signature, setting or checking a users ERC20 token balance/allowance and much more. diff --git a/packages/website/md/docs/0xjs/0.0.1/versioning.md b/packages/website/md/docs/0xjs/0.0.1/versioning.md new file mode 100644 index 000000000..6bcaa5b4d --- /dev/null +++ b/packages/website/md/docs/0xjs/0.0.1/versioning.md @@ -0,0 +1 @@ +This project adheres to the [Semantic Versioning 2.0.0](http://semver.org/) specification. The library's public interface includes all the methods, properties and types included in the documentation. Since the library is still an alpha, it's public interface is not yet stable and we will introduce backward incompatible changes to the interface without incrementing the major version until the `1.0.0` release. Our convention until then will be to increment the minor version whenever we introduce backward incompatible changes to the public interface, and to increment the patch version otherwise. This way, it is safe for you to include 0x.js in your projects with the tilda (e.g `~0.22.0`) without fear that a patch update would break your app. -- cgit v1.2.3