0xjs README/website docs update
This commit is contained in:
parent
df5779b6d1
commit
cf46d2c704
@ -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).
|
||||
|
||||
@ -19,7 +19,14 @@ npm install 0x.js --save
|
||||
**Import**
|
||||
|
||||
```javascript
|
||||
import { ZeroEx } from '0x.js';
|
||||
import {
|
||||
assetDataUtils,
|
||||
BigNumber,
|
||||
ContractWrappers,
|
||||
generatePseudoRandomSalt,
|
||||
orderHashUtils,
|
||||
signatureUtils,
|
||||
} from '0x.js';
|
||||
```
|
||||
|
||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
|
||||
|
26
packages/website/md/docs/0xjs/0.0.1/async.md
vendored
Normal file
26
packages/website/md/docs/0xjs/0.0.1/async.md
vendored
Normal file
@ -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.
|
31
packages/website/md/docs/0xjs/0.0.1/installation.md
vendored
Normal file
31
packages/website/md/docs/0xjs/0.0.1/installation.md
vendored
Normal file
@ -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
|
||||
<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 TestRPC, Infura and more!
|
1
packages/website/md/docs/0xjs/0.0.1/introduction.md
vendored
Normal file
1
packages/website/md/docs/0xjs/0.0.1/introduction.md
vendored
Normal file
@ -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.
|
1
packages/website/md/docs/0xjs/0.0.1/versioning.md
vendored
Normal file
1
packages/website/md/docs/0xjs/0.0.1/versioning.md
vendored
Normal file
@ -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.
|
17
packages/website/md/docs/0xjs/1.0.0/async.md
vendored
17
packages/website/md/docs/0xjs/1.0.0/async.md
vendored
@ -1,10 +1,15 @@
|
||||
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.
|
||||
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 {
|
||||
var availableAddresses = await zeroEx.getAvailableAddressesAsync();
|
||||
const signature = await signatureUtils.ecSignOrderHashAsync(
|
||||
providerEngine,
|
||||
orderHashHex,
|
||||
maker,
|
||||
SignerType.Default,
|
||||
);
|
||||
} catch (error) {
|
||||
console.log('Caught error: ', error);
|
||||
}
|
||||
@ -13,10 +18,10 @@ try {
|
||||
_Promise syntax:_
|
||||
|
||||
```javascript
|
||||
zeroEx
|
||||
.getAvailableAddressesAsync()
|
||||
.then(function(availableAddresses) {
|
||||
console.log(availableAddresses);
|
||||
signature = signatureUtils
|
||||
.ecSignOrderHashAsync(providerEngine, orderHashHex, maker, SignerType.Default)
|
||||
.then(function(signature) {
|
||||
console.log(signature);
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log('Caught error: ', error);
|
||||
|
@ -11,7 +11,16 @@ npm install 0x.js --save
|
||||
**Import**
|
||||
|
||||
```javascript
|
||||
import { ZeroEx } from '0x.js';
|
||||
import {
|
||||
assetDataUtils,
|
||||
BigNumber,
|
||||
ContractWrappers,
|
||||
generatePseudoRandomSalt,
|
||||
Order,
|
||||
orderHashUtils,
|
||||
signatureUtils,
|
||||
SignerType,
|
||||
} from '0x.js';
|
||||
```
|
||||
|
||||
#### UMD:
|
||||
@ -28,4 +37,4 @@ Download the UMD module from our [releases page](https://github.com/0xProject/0x
|
||||
|
||||
### Wiki
|
||||
|
||||
Check out our [wiki](https://0xproject.com/wiki) for articles on how to get 0x.js setup with TestRPC, Infura and more!
|
||||
Check out our [wiki](https://0xproject.com/wiki) for articles on how to get 0x.js setup with Ganache, Infura and more!
|
||||
|
@ -1 +1,3 @@
|
||||
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.
|
||||
<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.
|
||||
|
@ -1 +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.
|
||||
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.
|
||||
|
@ -1,3 +0,0 @@
|
||||
<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.
|
@ -1 +0,0 @@
|
||||
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.
|
@ -9,14 +9,15 @@ 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 IntroMarkdownV1 = require('md/docs/0xjs/0.0.1/introduction');
|
||||
const InstallationMarkdownV1 = require('md/docs/0xjs/0.0.1/installation');
|
||||
const AsyncMarkdownV1 = require('md/docs/0xjs/0.0.1/async');
|
||||
const ErrorsMarkdownV1 = require('md/docs/0xjs/0.0.1/errors');
|
||||
const versioningMarkdownV1 = require('md/docs/0xjs/0.0.1/versioning');
|
||||
|
||||
const IntroMarkdownV2 = require('md/docs/0xjs/1.0.0/introduction');
|
||||
const versioningMarkdownV2 = require('md/docs/0xjs/1.0.0/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 = {
|
||||
@ -28,6 +29,12 @@ const markdownSections = {
|
||||
versioning: 'versioning',
|
||||
};
|
||||
|
||||
const sharedMarkdownSections = {
|
||||
[markdownSections.installation]: InstallationMarkdownV1,
|
||||
[markdownSections.async]: AsyncMarkdownV1,
|
||||
[markdownSections.errors]: ErrorsMarkdownV1,
|
||||
};
|
||||
|
||||
const docsInfoConfig: DocsInfoConfig = {
|
||||
id: DocPackages.ZeroExJs,
|
||||
packageName: '0x.js',
|
||||
@ -42,18 +49,14 @@ const docsInfoConfig: DocsInfoConfig = {
|
||||
sectionNameToMarkdownByVersion: {
|
||||
'0.0.1': {
|
||||
[markdownSections.introduction]: IntroMarkdownV1,
|
||||
[markdownSections.installation]: InstallationMarkdownV1,
|
||||
[markdownSections.async]: AsyncMarkdownV1,
|
||||
[markdownSections.errors]: ErrorsMarkdownV1,
|
||||
[markdownSections.versioning]: versioningMarkdownV1,
|
||||
...sharedMarkdownSections,
|
||||
},
|
||||
'1.0.0-rc.1': {
|
||||
'1.0.1': {
|
||||
[markdownSections.introduction]: IntroMarkdownV2,
|
||||
[markdownSections.versioning]: versioningMarkdownV2,
|
||||
// These are the same as for V1
|
||||
[markdownSections.installation]: InstallationMarkdownV1,
|
||||
[markdownSections.async]: AsyncMarkdownV1,
|
||||
[markdownSections.errors]: ErrorsMarkdownV1,
|
||||
...sharedMarkdownSections,
|
||||
},
|
||||
},
|
||||
markdownSections,
|
||||
|
Loading…
x
Reference in New Issue
Block a user