diff options
author | Jacob Evans <dekz@dekz.net> | 2018-09-18 05:59:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-18 05:59:27 +0800 |
commit | 2378747570f4417908cbccda19db7554da319e8f (patch) | |
tree | d470268907021cc04e2da7e8cee83a0e41461ed3 | |
parent | 074082ec945b89dba14315a5c9d715e77724566b (diff) | |
parent | 2df569b72727bf4face8ad5f223535657f99db39 (diff) | |
download | dexon-sol-tools-2378747570f4417908cbccda19db7554da319e8f.tar.gz dexon-sol-tools-2378747570f4417908cbccda19db7554da319e8f.tar.zst dexon-sol-tools-2378747570f4417908cbccda19db7554da319e8f.zip |
Merge pull request #1063 from 0xProject/feature/0x.js/update-readme-import
0xjs README/website docs update
-rw-r--r-- | packages/0x.js/README.md | 2 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/0.0.1/async.md (renamed from packages/website/md/docs/0xjs/1.0.0/async.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/0.0.1/errors.md (renamed from packages/website/md/docs/0xjs/1.0.0/errors.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/0.0.1/installation.md (renamed from packages/website/md/docs/0xjs/1.0.0/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/0.0.1/introduction.md (renamed from packages/website/md/docs/0xjs/1.0.0/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/0.0.1/versioning.md (renamed from packages/website/md/docs/0xjs/1.0.0/versioning.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/1.0.1/async.md | 31 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/1.0.1/installation.md | 40 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/1.0.1/introduction.md (renamed from packages/website/md/docs/0xjs/2.0.0/introduction.md) | 2 | ||||
-rw-r--r-- | packages/website/md/docs/0xjs/1.0.1/versioning.md (renamed from packages/website/md/docs/0xjs/2.0.0/versioning.md) | 2 | ||||
-rw-r--r-- | packages/website/ts/containers/zero_ex_js_documentation.ts | 33 |
11 files changed, 91 insertions, 19 deletions
diff --git a/packages/0x.js/README.md b/packages/0x.js/README.md index cfe35ff3e..329037324 100644 --- a/packages/0x.js/README.md +++ b/packages/0x.js/README.md @@ -1,6 +1,6 @@ ## 0x.js -A TypeScript/Javascript library for interacting with the 0x protocol. +A TypeScript/Javascript library for interacting with the 0x protocol. It is a high level package which combines a number of underlying packages such as order-utils and order-watcher. ### Read the [Documentation](https://0xproject.com/docs/0x.js). diff --git a/packages/website/md/docs/0xjs/1.0.0/async.md b/packages/website/md/docs/0xjs/0.0.1/async.md index 8abaef331..8abaef331 100644 --- a/packages/website/md/docs/0xjs/1.0.0/async.md +++ b/packages/website/md/docs/0xjs/0.0.1/async.md diff --git a/packages/website/md/docs/0xjs/1.0.0/errors.md b/packages/website/md/docs/0xjs/0.0.1/errors.md index e97973ccf..e97973ccf 100644 --- a/packages/website/md/docs/0xjs/1.0.0/errors.md +++ b/packages/website/md/docs/0xjs/0.0.1/errors.md diff --git a/packages/website/md/docs/0xjs/1.0.0/installation.md b/packages/website/md/docs/0xjs/0.0.1/installation.md index ac0a47699..ac0a47699 100644 --- a/packages/website/md/docs/0xjs/1.0.0/installation.md +++ b/packages/website/md/docs/0xjs/0.0.1/installation.md diff --git a/packages/website/md/docs/0xjs/1.0.0/introduction.md b/packages/website/md/docs/0xjs/0.0.1/introduction.md index 008376d33..008376d33 100644 --- a/packages/website/md/docs/0xjs/1.0.0/introduction.md +++ b/packages/website/md/docs/0xjs/0.0.1/introduction.md diff --git a/packages/website/md/docs/0xjs/1.0.0/versioning.md b/packages/website/md/docs/0xjs/0.0.1/versioning.md index 6bcaa5b4d..6bcaa5b4d 100644 --- a/packages/website/md/docs/0xjs/1.0.0/versioning.md +++ b/packages/website/md/docs/0xjs/0.0.1/versioning.md diff --git a/packages/website/md/docs/0xjs/1.0.1/async.md b/packages/website/md/docs/0xjs/1.0.1/async.md new file mode 100644 index 000000000..bd5ae9d8a --- /dev/null +++ b/packages/website/md/docs/0xjs/1.0.1/async.md @@ -0,0 +1,31 @@ +0x packages are promise-based libraries. 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 { + const signature = await signatureUtils.ecSignOrderHashAsync( + providerEngine, + orderHashHex, + maker, + SignerType.Default, + ); +} catch (error) { + console.log('Caught error: ', error); +} +``` + +_Promise syntax:_ + +```javascript +signatureUtils + .ecSignOrderHashAsync(providerEngine, orderHashHex, maker, SignerType.Default) + .then(function(signature) { + console.log(signature); + }) + .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/1.0.1/installation.md b/packages/website/md/docs/0xjs/1.0.1/installation.md new file mode 100644 index 000000000..74c902afd --- /dev/null +++ b/packages/website/md/docs/0xjs/1.0.1/installation.md @@ -0,0 +1,40 @@ +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 { + assetDataUtils, + BigNumber, + ContractWrappers, + generatePseudoRandomSalt, + Order, + orderHashUtils, + signatureUtils, + SignerType, +} 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 +<script type="text/javascript" src="0x.js"></script> +``` + +### Wiki + +Check out our [wiki](https://0xproject.com/wiki) for articles on how to get 0x.js setup with Ganache, Infura and more! diff --git a/packages/website/md/docs/0xjs/2.0.0/introduction.md b/packages/website/md/docs/0xjs/1.0.1/introduction.md index d228c6855..4d5d314d3 100644 --- a/packages/website/md/docs/0xjs/2.0.0/introduction.md +++ b/packages/website/md/docs/0xjs/1.0.1/introduction.md @@ -1,3 +1 @@ -<b>**NOTE:** Release candidate versions are meant to work with V2 of 0x protocol. To interact with V1, select a 0.X version.</b> - Welcome to the [0x.js](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js) 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 token adhering to the token standards supported by the protocol (currently ERC20 & ERC721). Functionality includes generating, signing, filling and cancelling orders, verifying an orders signature, setting or checking a users ERC20/ERC721 token balance/allowance and much more. diff --git a/packages/website/md/docs/0xjs/2.0.0/versioning.md b/packages/website/md/docs/0xjs/1.0.1/versioning.md index 7f2b6fee9..6bae835d3 100644 --- a/packages/website/md/docs/0xjs/2.0.0/versioning.md +++ b/packages/website/md/docs/0xjs/1.0.1/versioning.md @@ -1 +1 @@ -Since v1.0.0, this package 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. We will publish with a major version bump for any breaking change to the public interface, use a minor version bump when introducing new features in a backwards-compatible way, and patch versions when introducing backwards-compatible bug fixes. Because of this, we recommend you import `0x.js` with a caret `^2.0.0` to take advantage of non-breaking bug fixes. +Since v1.0.0, this package 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. We will publish with a major version bump for any breaking change to the public interface, use a minor version bump when introducing new features in a backwards-compatible way, and patch versions when introducing backwards-compatible bug fixes. Because of this, we recommend you import `0x.js` with a caret `^1.0.0` to take advantage of non-breaking bug fixes. diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index 922dd3c10..2a3afd86c 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -9,14 +9,18 @@ import { DocPackages } from 'ts/types'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ -const IntroMarkdownV1 = require('md/docs/0xjs/1.0.0/introduction'); -const InstallationMarkdownV1 = require('md/docs/0xjs/1.0.0/installation'); -const AsyncMarkdownV1 = require('md/docs/0xjs/1.0.0/async'); -const ErrorsMarkdownV1 = require('md/docs/0xjs/1.0.0/errors'); -const versioningMarkdownV1 = require('md/docs/0xjs/1.0.0/versioning'); +const IntroMarkdownV0 = require('md/docs/0xjs/0.0.1/introduction'); +const InstallationMarkdownV0 = require('md/docs/0xjs/0.0.1/installation'); +const AsyncMarkdownV0 = require('md/docs/0xjs/0.0.1/async'); +const ErrorsMarkdownV0 = require('md/docs/0xjs/0.0.1/errors'); +const versioningMarkdownV0 = require('md/docs/0xjs/0.0.1/versioning'); + +const IntroMarkdownV1 = require('md/docs/0xjs/1.0.1/introduction'); +const InstallationMarkdownV1 = require('md/docs/0xjs/1.0.1/installation'); +const AsyncMarkdownV1 = require('md/docs/0xjs/1.0.1/async'); +const ErrorsMarkdownV1 = ErrorsMarkdownV0; +const versioningMarkdownV1 = require('md/docs/0xjs/1.0.1/versioning'); -const IntroMarkdownV2 = require('md/docs/0xjs/2.0.0/introduction'); -const versioningMarkdownV2 = require('md/docs/0xjs/2.0.0/versioning'); /* tslint:enable:no-var-requires */ const markdownSections = { @@ -41,17 +45,16 @@ const docsInfoConfig: DocsInfoConfig = { }, sectionNameToMarkdownByVersion: { '0.0.1': { + [markdownSections.introduction]: IntroMarkdownV0, + [markdownSections.installation]: InstallationMarkdownV0, + [markdownSections.versioning]: versioningMarkdownV0, + [markdownSections.async]: AsyncMarkdownV0, + [markdownSections.errors]: ErrorsMarkdownV0, + }, + '1.0.1': { [markdownSections.introduction]: IntroMarkdownV1, [markdownSections.installation]: InstallationMarkdownV1, - [markdownSections.async]: AsyncMarkdownV1, - [markdownSections.errors]: ErrorsMarkdownV1, [markdownSections.versioning]: versioningMarkdownV1, - }, - '1.0.0-rc.1': { - [markdownSections.introduction]: IntroMarkdownV2, - [markdownSections.versioning]: versioningMarkdownV2, - // These are the same as for V1 - [markdownSections.installation]: InstallationMarkdownV1, [markdownSections.async]: AsyncMarkdownV1, [markdownSections.errors]: ErrorsMarkdownV1, }, |