aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/package.json4
-rw-r--r--packages/connect/package.json4
-rw-r--r--packages/contracts/package.json1
-rw-r--r--packages/deployer/package.json15
-rw-r--r--packages/deployer/src/monorepo_scripts/stagedocs.ts8
-rw-r--r--packages/react-docs/CHANGELOG.md1
-rw-r--r--packages/react-docs/src/components/type.tsx14
-rw-r--r--packages/subproviders/CHANGELOG.md1
-rw-r--r--packages/subproviders/src/index.ts8
-rw-r--r--packages/subproviders/src/subproviders/empty_wallet_subprovider.ts8
-rw-r--r--packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts8
-rw-r--r--packages/subproviders/src/subproviders/ganache.ts8
-rw-r--r--packages/subproviders/src/subproviders/injected_web3.ts8
-rw-r--r--packages/subproviders/src/subproviders/ledger.ts3
-rw-r--r--packages/subproviders/src/subproviders/redundant_rpc.ts6
-rw-r--r--packages/subproviders/src/subproviders/subprovider.ts8
-rw-r--r--packages/subproviders/src/types.ts5
-rw-r--r--packages/web3-wrapper/README.md2
-rw-r--r--packages/web3-wrapper/package.json14
-rw-r--r--packages/web3-wrapper/src/monorepo_scripts/stagedocs.ts8
-rw-r--r--packages/website/md/docs/deployer/installation.md24
-rw-r--r--packages/website/md/docs/deployer/introduction.md17
-rw-r--r--packages/website/md/docs/deployer/usage.md57
-rw-r--r--packages/website/md/docs/web3_wrapper/installation.md17
-rw-r--r--packages/website/md/docs/web3_wrapper/introduction.md1
-rw-r--r--packages/website/translations/chinese.json2
-rw-r--r--packages/website/translations/english.json2
-rw-r--r--packages/website/translations/korean.json2
-rw-r--r--packages/website/translations/russian.json2
-rw-r--r--packages/website/translations/spanish.json2
-rw-r--r--packages/website/ts/components/sidebar_header.tsx2
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx42
-rw-r--r--packages/website/ts/containers/deployer_documentation.ts102
-rw-r--r--packages/website/ts/containers/web3_wrapper_documentation.ts103
-rw-r--r--packages/website/ts/index.tsx11
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx28
-rw-r--r--packages/website/ts/types.ts8
-rw-r--r--packages/website/ts/utils/constants.ts3
-rw-r--r--packages/website/ts/utils/doc_utils.ts60
-rw-r--r--packages/website/webpack.config.js44
40 files changed, 579 insertions, 84 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 0cb01d352..4bc0cc193 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -36,8 +36,8 @@
"assets": ["_bundles/index.js", "_bundles/index.min.js"],
"docPublishConfigs": {
"extraFileIncludes": ["../types/src/index.ts"],
- "s3BucketPath": "s3://0xjs-docs-jsons/",
- "s3StagingBucketPath": "s3://staging-0xjs-docs-jsons/"
+ "s3BucketPath": "s3://doc-jsons/0xjs/",
+ "s3StagingBucketPath": "s3://staging-doc-jsons/0xjs/"
}
}
},
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 61b92dc3e..63ca61693 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -29,8 +29,8 @@
"postpublish": {
"assets": ["_bundles/index.js", "_bundles/index.min.js"],
"docPublishConfigs": {
- "s3BucketPath": "s3://connect-docs-jsons/",
- "s3StagingBucketPath": "s3://staging-connect-docs-jsons/"
+ "s3BucketPath": "s3://doc-jsons/connect/",
+ "s3StagingBucketPath": "s3://staging-doc-jsons/connect/"
}
}
},
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 371aba8ab..2bb3b2465 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -57,6 +57,7 @@
"ethers-typescript-typings": "^0.0.2",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
+ "prettier": "^1.11.1",
"shx": "^0.2.2",
"solc": "^0.4.18",
"tslint": "5.8.0",
diff --git a/packages/deployer/package.json b/packages/deployer/package.json
index 71fe4d9d7..346b967e2 100644
--- a/packages/deployer/package.json
+++ b/packages/deployer/package.json
@@ -14,7 +14,19 @@
"clean": "shx rm -rf lib scripts",
"migrate": "npm run build; node lib/src/cli.js migrate",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
- "test:circleci": "yarn test:coverage"
+ "test:circleci": "yarn test:coverage",
+ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
+ "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
+ },
+ "config": {
+ "postpublish": {
+ "assets": [],
+ "docPublishConfigs": {
+ "extraFileIncludes": ["../types/src/index.ts"],
+ "s3BucketPath": "s3://doc-jsons/deployer/",
+ "s3StagingBucketPath": "s3://staging-doc-jsons/deployer/"
+ }
+ }
},
"bin": {
"0x-deployer": "lib/src/cli.js"
@@ -41,6 +53,7 @@
"shx": "^0.2.2",
"tslint": "5.8.0",
"types-bn": "^0.0.1",
+ "typedoc": "0xProject/typedoc",
"typescript": "2.7.1",
"web3-typescript-typings": "^0.10.0"
},
diff --git a/packages/deployer/src/monorepo_scripts/stagedocs.ts b/packages/deployer/src/monorepo_scripts/stagedocs.ts
new file mode 100644
index 000000000..e732ac8eb
--- /dev/null
+++ b/packages/deployer/src/monorepo_scripts/stagedocs.ts
@@ -0,0 +1,8 @@
+import { postpublishUtils } from '@0xproject/monorepo-scripts';
+
+import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
+
+const cwd = `${__dirname}/..`;
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md
index a90cf19f0..7f860739f 100644
--- a/packages/react-docs/CHANGELOG.md
+++ b/packages/react-docs/CHANGELOG.md
@@ -4,3 +4,4 @@
* Move example out into a separate sub-package
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
+ * Handle `reflection` type rendering so that anonymous function type declarations render properly
diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx
index 56425a5df..b253f0397 100644
--- a/packages/react-docs/src/components/type.tsx
+++ b/packages/react-docs/src/components/type.tsx
@@ -9,6 +9,7 @@ import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '../types';
import { constants } from '../utils/constants';
import { utils } from '../utils/utils';
+import { MethodSignature } from './method_signature';
import { TypeDefinition } from './type_definition';
const typeToSection: { [typeName: string]: string } = {
@@ -101,6 +102,19 @@ export function Type(props: TypeProps): any {
});
break;
+ case TypeDocTypes.Reflection:
+ typeName = (
+ <MethodSignature
+ method={type.method}
+ sectionName={props.sectionName}
+ shouldHideMethodName={true}
+ shouldUseArrowSyntax={true}
+ docsInfo={props.docsInfo}
+ typeDefinitionByName={props.typeDefinitionByName}
+ />
+ );
+ break;
+
case TypeDocTypes.TypeParameter:
typeName = type.name;
break;
diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index 0b631f1d7..cb053b620 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -5,6 +5,7 @@
* Export `GanacheSubprovider` and `Subprovider` (#426)
* Make all subproviders to derive from `Subprovider` (#426)
* Add types for `NextCallback`, `OnNextCompleted` (#426)
+ * Introduce `JSONRPCRequestPayloadWithMethod` type
* Ignore `ganache-core` dependency when using package in a browser environment.
## v0.7.0 - _March 8, 2018_
diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts
index cafb50fe5..a8c2b5c17 100644
--- a/packages/subproviders/src/index.ts
+++ b/packages/subproviders/src/index.ts
@@ -12,7 +12,13 @@ export { LedgerSubprovider } from './subproviders/ledger';
export { GanacheSubprovider } from './subproviders/ganache';
export { Subprovider } from './subproviders/subprovider';
export { NonceTrackerSubprovider } from './subproviders/nonce_tracker';
-export { ECSignature, LedgerWalletSubprovider, LedgerCommunicationClient, NonceSubproviderErrors } from './types';
+export {
+ ECSignature,
+ LedgerWalletSubprovider,
+ LedgerCommunicationClient,
+ NonceSubproviderErrors,
+ LedgerSubproviderConfigs,
+} from './types';
/**
* A factory method for creating a LedgerEthereumClient usable in a browser context.
diff --git a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
index f5983dd9b..d5d03a4ac 100644
--- a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
+++ b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
@@ -1,5 +1,7 @@
import * as Web3 from 'web3';
+import { Callback, ErrorCallback } from '../types';
+
import { Subprovider } from './subprovider';
/*
@@ -10,11 +12,7 @@ import { Subprovider } from './subprovider';
export class EmptyWalletSubprovider extends Subprovider {
// This method needs to be here to satisfy the interface but linter wants it to be static.
// tslint:disable-next-line:prefer-function-over-method
- public handleRequest(
- payload: Web3.JSONRPCRequestPayload,
- next: () => void,
- end: (err: Error | null, result: any) => void,
- ) {
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
switch (payload.method) {
case 'eth_accounts':
end(null, []);
diff --git a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
index 2421dcd02..faec2d9e5 100644
--- a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
+++ b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
@@ -1,5 +1,7 @@
import * as Web3 from 'web3';
+import { Callback, ErrorCallback } from '../types';
+
import { Subprovider } from './subprovider';
/*
@@ -18,11 +20,7 @@ export class FakeGasEstimateSubprovider extends Subprovider {
}
// This method needs to be here to satisfy the interface but linter wants it to be static.
// tslint:disable-next-line:prefer-function-over-method
- public handleRequest(
- payload: Web3.JSONRPCRequestPayload,
- next: () => void,
- end: (err: Error | null, result: any) => void,
- ) {
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
switch (payload.method) {
case 'eth_estimateGas':
end(null, this._constantGasAmount);
diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts
index a979aecf4..6ff939674 100644
--- a/packages/subproviders/src/subproviders/ganache.ts
+++ b/packages/subproviders/src/subproviders/ganache.ts
@@ -1,6 +1,8 @@
import * as Ganache from 'ganache-core';
import * as Web3 from 'web3';
+import { Callback, ErrorCallback } from '../types';
+
import { Subprovider } from './subprovider';
/*
@@ -16,11 +18,7 @@ export class GanacheSubprovider extends Subprovider {
}
// This method needs to be here to satisfy the interface but linter wants it to be static.
// tslint:disable-next-line:prefer-function-over-method
- public handleRequest(
- payload: Web3.JSONRPCRequestPayload,
- next: () => void,
- end: (err: Error | null, result: any) => void,
- ) {
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
this._ganacheProvider.sendAsync(payload, (err: Error | null, result: any) => {
end(err, result && result.result);
});
diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts
index 6d4e2b27b..ec7304cb7 100644
--- a/packages/subproviders/src/subproviders/injected_web3.ts
+++ b/packages/subproviders/src/subproviders/injected_web3.ts
@@ -1,6 +1,8 @@
import * as _ from 'lodash';
import * as Web3 from 'web3';
+import { Callback, ErrorCallback } from '../types';
+
import { Subprovider } from './subprovider';
/*
@@ -15,11 +17,7 @@ export class InjectedWeb3Subprovider extends Subprovider {
super();
this._injectedWeb3 = new Web3(subprovider);
}
- public handleRequest(
- payload: Web3.JSONRPCRequestPayload,
- next: () => void,
- end: (err: Error | null, result: any) => void,
- ) {
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
switch (payload.method) {
case 'web3_clientVersion':
this._injectedWeb3.version.getNode(end);
diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts
index b67b49bee..95217c84d 100644
--- a/packages/subproviders/src/subproviders/ledger.ts
+++ b/packages/subproviders/src/subproviders/ledger.ts
@@ -8,6 +8,7 @@ import { Lock } from 'semaphore-async-await';
import * as Web3 from 'web3';
import {
+ Callback,
LedgerEthereumClient,
LedgerEthereumClientFactoryAsync,
LedgerSubproviderConfigs,
@@ -62,7 +63,7 @@ export class LedgerSubprovider extends Subprovider {
// tslint:disable-next-line:async-suffix
public async handleRequest(
payload: Web3.JSONRPCRequestPayload,
- next: () => void,
+ next: Callback,
end: (err: Error | null, result?: any) => void,
) {
let accounts;
diff --git a/packages/subproviders/src/subproviders/redundant_rpc.ts b/packages/subproviders/src/subproviders/redundant_rpc.ts
index 0df2f91f4..dacd1c2c5 100644
--- a/packages/subproviders/src/subproviders/redundant_rpc.ts
+++ b/packages/subproviders/src/subproviders/redundant_rpc.ts
@@ -3,6 +3,8 @@ import * as _ from 'lodash';
import * as Web3 from 'web3';
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
+import { Callback } from '../types';
+
import { Subprovider } from './subprovider';
export class RedundantRPCSubprovider extends Subprovider {
@@ -10,7 +12,7 @@ export class RedundantRPCSubprovider extends Subprovider {
private static async _firstSuccessAsync(
rpcs: RpcSubprovider[],
payload: Web3.JSONRPCRequestPayload,
- next: () => void,
+ next: Callback,
): Promise<any> {
let lastErr: Error | undefined;
for (const rpc of rpcs) {
@@ -38,7 +40,7 @@ export class RedundantRPCSubprovider extends Subprovider {
// tslint:disable-next-line:async-suffix
public async handleRequest(
payload: Web3.JSONRPCRequestPayload,
- next: () => void,
+ next: Callback,
end: (err: Error | null, data?: any) => void,
): Promise<void> {
const rpcsCopy = this._rpcs.slice();
diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts
index d4e0de67a..4a224fc4e 100644
--- a/packages/subproviders/src/subproviders/subprovider.ts
+++ b/packages/subproviders/src/subproviders/subprovider.ts
@@ -1,5 +1,7 @@
import promisify = require('es6-promisify');
import * as Web3 from 'web3';
+
+import { JSONRPCRequestPayloadWithMethod } from '../types';
/*
* A version of the base class Subprovider found in providerEngine
* This one has an async/await `emitPayloadAsync` and also defined types.
@@ -18,8 +20,8 @@ export class Subprovider {
return datePart + extraPart;
}
private static _createFinalPayload(
- payload: Partial<Web3.JSONRPCRequestPayload> & { method: string },
- ): Web3.JSONRPCRequestPayload {
+ payload: Partial<JSONRPCRequestPayloadWithMethod>,
+ ): Partial<JSONRPCRequestPayloadWithMethod> {
const finalPayload = {
// defaults
id: Subprovider._getRandomId(),
@@ -33,7 +35,7 @@ export class Subprovider {
this._engine = engine;
}
public async emitPayloadAsync(
- payload: Partial<Web3.JSONRPCRequestPayload> & { method: string },
+ payload: Partial<JSONRPCRequestPayloadWithMethod>,
): Promise<Web3.JSONRPCResponsePayload> {
const finalPayload = Subprovider._createFinalPayload(payload);
const response = await promisify(this._engine.sendAsync, this._engine)(finalPayload);
diff --git a/packages/subproviders/src/types.ts b/packages/subproviders/src/types.ts
index 543da5947..09095a53d 100644
--- a/packages/subproviders/src/types.ts
+++ b/packages/subproviders/src/types.ts
@@ -1,4 +1,5 @@
import * as _ from 'lodash';
+import * as Web3 from 'web3';
export interface LedgerCommunicationClient {
close: () => Promise<void>;
@@ -117,3 +118,7 @@ export type ErrorCallback = (err: Error | null, data?: any) => void;
export type Callback = () => void;
export type OnNextCompleted = (err: Error | null, result: any, cb: Callback) => void;
export type NextCallback = (callback?: OnNextCompleted) => void;
+
+export interface JSONRPCRequestPayloadWithMethod extends Web3.JSONRPCRequestPayload {
+ method: string;
+}
diff --git a/packages/web3-wrapper/README.md b/packages/web3-wrapper/README.md
index 0d5defb1e..244e20708 100644
--- a/packages/web3-wrapper/README.md
+++ b/packages/web3-wrapper/README.md
@@ -1,6 +1,6 @@
## @0xproject/web3-wrapper
-Wrapped version of web3 with a nicer interface that is used across 0x projects and packages
+Wrapped version of web3 with a nicer interface that is used across 0x projects and packages. Visit [the docs](0xproject.com/docs/web3_wrapper).
## Installation
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index 6e569b993..9b41f1de6 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -8,7 +8,18 @@
"build:watch": "tsc -w",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf lib scripts",
- "lint": "tslint --project . 'src/**/*.ts'"
+ "lint": "tslint --project . 'src/**/*.ts'",
+ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
+ "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
+ },
+ "config": {
+ "postpublish": {
+ "docPublishConfigs": {
+ "extraFileIncludes": ["../types/src/index.ts"],
+ "s3BucketPath": "s3://doc-jsons/web3-wrapper/",
+ "s3StagingBucketPath": "s3://staging-doc-jsons/web3-wrapper/"
+ }
+ }
},
"license": "Apache-2.0",
"repository": {
@@ -27,6 +38,7 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
+ "typedoc": "0xProject/typedoc",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/web3-wrapper/src/monorepo_scripts/stagedocs.ts b/packages/web3-wrapper/src/monorepo_scripts/stagedocs.ts
new file mode 100644
index 000000000..e732ac8eb
--- /dev/null
+++ b/packages/web3-wrapper/src/monorepo_scripts/stagedocs.ts
@@ -0,0 +1,8 @@
+import { postpublishUtils } from '@0xproject/monorepo-scripts';
+
+import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
+
+const cwd = `${__dirname}/..`;
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/website/md/docs/deployer/installation.md b/packages/website/md/docs/deployer/installation.md
new file mode 100644
index 000000000..48dd52c1f
--- /dev/null
+++ b/packages/website/md/docs/deployer/installation.md
@@ -0,0 +1,24 @@
+#### CLI Installation
+
+```bash
+npm install @0xproject/deployer -g
+```
+
+#### API Installation
+
+```bash
+npm install @0xproject/deployer --save
+```
+
+**Import**
+
+```typescript
+import { Deployer, Compiler } from '@0xproject/deployer';
+```
+
+or
+
+```javascript
+var Deployer = require('@0xproject/deployer').Deployer;
+var Compiler = require('@0xproject/deployer').Compiler;
+```
diff --git a/packages/website/md/docs/deployer/introduction.md b/packages/website/md/docs/deployer/introduction.md
new file mode 100644
index 000000000..114b71bde
--- /dev/null
+++ b/packages/website/md/docs/deployer/introduction.md
@@ -0,0 +1,17 @@
+Welcome to the [Deployer](https://github.com/0xProject/0x-monorepo/tree/development/packages/deployer) documentation! Deployer is a tool for compiling and deploying Solidity smart contracts with ease.
+
+It serves a similar purpose as parts of the [Truffle framework](http://truffleframework.com/), but with the UNIX philosophy in mind: Make each program do one thing well. This tool is for intermediate to advanced Solidity developers that require greater configurability and reliability.
+
+Deployer has the following advantages over Truffle:
+
+* Deploy each smart contract with a specific version of Solidity
+* Improved artifact files:
+ * Properly segregated artifacts to support storing different versions of smart contract deployed on different networks.
+ * Storage of contructor args and contract source code
+* An easy to maintain codebase: TypeScript + Single package
+* Allows you to specify the deployer address
+* Migrations that work with `async/await`
+* Migrations that can be written synchronously in order to guarentee deterministic contract addresses
+* No race conditions when running migrations.
+
+Deployer can be used as a command-line tool or as an imported module.
diff --git a/packages/website/md/docs/deployer/usage.md b/packages/website/md/docs/deployer/usage.md
new file mode 100644
index 000000000..2cfd5ca37
--- /dev/null
+++ b/packages/website/md/docs/deployer/usage.md
@@ -0,0 +1,57 @@
+#### CLI Usage
+
+```bash
+$ 0x-deployer --help
+0x-deployer [command]
+
+Commands:
+ 0x-deployer compile compile contracts
+ 0x-deployer migrate compile and deploy contracts using migration scripts
+ 0x-deployer deploy deploy a single contract with provided arguments
+
+Options:
+ --version Show version number [boolean]
+ --contracts-dir path of contracts directory to compile [string] [default:
+ "/path/to/contracts"]
+ --network-id mainnet=1, kovan=42, testrpc=50 [number] [default: 50]
+ --should-optimize enable optimizer [boolean] [default: false]
+ --artifacts-dir path to write contracts artifacts to [string] [default:
+ "/path/to/artifacts"]
+ --jsonrpc-port port connected to JSON RPC [number] [default: 8545]
+ --gas-price gasPrice to be used for transactions
+ [string] [default: "2000000000"]
+ --account account to use for deploying contracts [string]
+ --contracts comma separated list of contracts to compile
+ [string] [default: "*"]
+ --help Show help [boolean]
+```
+
+#### API Usage
+
+##### Migrations
+
+You can write migration scripts (similar to `truffle migrate`), that deploys multiple contracts and configures them. Below you'll find a simple example of such a script to help you get started.
+
+```typescript
+import { Deployer } from '@0xproject/deployer';
+import * as path from 'path';
+
+const deployerOpts = {
+ artifactsDir: path.resolve('src', 'artifacts'),
+ jsonrpcUrl: 'http://localhost:8545',
+ networkId: 50,
+ defaults: {
+ gas: 1000000,
+ },
+};
+
+const deployer = new Deployer(deployerOpts);
+
+(async () => {
+ const etherToken = await deployer.deployAndSaveAsync('WETH9');
+})().catch(console.log);
+```
+
+**Tip:** Be sure to start an Ethereum node at the supplied `jsonrpcUrl`. We recommend testing with [Ganache-cli](https://github.com/trufflesuite/ganache-cli)
+
+A more sophisticated example can be found [here](https://github.com/0xProject/0x-monorepo/tree/development/packages/contracts/migrations)
diff --git a/packages/website/md/docs/web3_wrapper/installation.md b/packages/website/md/docs/web3_wrapper/installation.md
new file mode 100644
index 000000000..6e9b4cb59
--- /dev/null
+++ b/packages/website/md/docs/web3_wrapper/installation.md
@@ -0,0 +1,17 @@
+**Install**
+
+```bash
+npm install @0xproject/web3-wrapper --save
+```
+
+**Import**
+
+```javascript
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+```
+
+or
+
+```javascript
+var Web3Wrapper = require('@0xproject/web3-wrapper').Web3Wrapper;
+```
diff --git a/packages/website/md/docs/web3_wrapper/introduction.md b/packages/website/md/docs/web3_wrapper/introduction.md
new file mode 100644
index 000000000..ea2f4cf0d
--- /dev/null
+++ b/packages/website/md/docs/web3_wrapper/introduction.md
@@ -0,0 +1 @@
+Welcome to the [Web3Wrapper](https://github.com/0xProject/0x-monorepo/tree/development/packages/web3-wrapper) documentation! Web3Wrapper is a convenience library that wraps Web3 v0.x, providing promise-based endpoints and a consistent API.
diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json
index f5f906d6c..f230754ec 100644
--- a/packages/website/translations/chinese.json
+++ b/packages/website/translations/chinese.json
@@ -56,11 +56,13 @@
"ABOUT": "关于我们",
"CAREERS": "人才招聘",
"CONTACT": "联系方式",
+ "DEPLOYER": "Deployer",
"BLOG": "博客",
"FORUM": "论坛",
"CONNECT": "0x 连接",
"WHITEPAPER": "白皮书",
"WIKI": "维基",
+ "WEB3_WRAPPER": "Web3Wrapper",
"FAQ": "FAQ",
"SMART_CONTRACTS": "0x 智能合约",
"STANDARD_RELAYER_API": "中继方标准API",
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index 9a1c9b2c8..13d2c1842 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -57,11 +57,13 @@
"ABOUT": "about",
"CAREERS": "careers",
"CONTACT": "contact",
+ "DEPLOYER": "Deployer",
"BLOG": "blog",
"FORUM": "forum",
"CONNECT": "0x Connect",
"WHITEPAPER": "whitepaper",
"WIKI": "wiki",
+ "WEB3_WRAPPER": "Web3Wrapper",
"FAQ": "FAQ",
"SMART_CONTRACTS": "0x smart contracts",
"STANDARD_RELAYER_API": "standard relayer API",
diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json
index b9be664e2..2d32e5c81 100644
--- a/packages/website/translations/korean.json
+++ b/packages/website/translations/korean.json
@@ -56,11 +56,13 @@
"ABOUT": "기업 정보",
"CAREERS": "채용",
"CONTACT": "문의",
+ "DEPLOYER": "Deployer",
"BLOG": "블로그",
"FORUM": "포럼",
"CONNECT": "0x Connect",
"WHITEPAPER": "백서",
"WIKI": "위키",
+ "WEB3_WRAPPER": "Web3Wrapper",
"FAQ": "FAQ",
"SMART_CONTRACTS": "0x 스마트 계약",
"STANDARD_RELAYER_API": "Standard Relayer API",
diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json
index c103960c0..9991bb4bc 100644
--- a/packages/website/translations/russian.json
+++ b/packages/website/translations/russian.json
@@ -56,11 +56,13 @@
"ABOUT": "Kоманда",
"CAREERS": "Карьера",
"CONTACT": "Связаться с нами",
+ "DEPLOYER": "Deployer",
"BLOG": "Блог",
"FORUM": "Форум",
"CONNECT": "0x Connect",
"WHITEPAPER": "Whitepaper",
"WIKI": "Вики",
+ "WEB3_WRAPPER": "Web3Wrapper",
"FAQ": "Документация",
"SMART_CONTRACTS": "0x Смарт-контракты ",
"STANDARD_RELAYER_API": "standard relayer API",
diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json
index c2aaf384c..121115260 100644
--- a/packages/website/translations/spanish.json
+++ b/packages/website/translations/spanish.json
@@ -57,11 +57,13 @@
"ABOUT": "equipo",
"CAREERS": "empleo",
"CONTACT": "contacto",
+ "DEPLOYER": "Deployer",
"BLOG": "blog",
"FORUM": "foro",
"CONNECT": "0x Connect",
"WHITEPAPER": "documento técnico",
"WIKI": "wiki",
+ "WEB3_WRAPPER": "Web3Wrapper",
"FAQ": "preguntas frecuentes",
"SMART_CONTRACTS": "0x contratos inteligentes",
"STANDARD_RELAYER_API": "API de transmisión estándar",
diff --git a/packages/website/ts/components/sidebar_header.tsx b/packages/website/ts/components/sidebar_header.tsx
index 519b23d80..33c5ac857 100644
--- a/packages/website/ts/components/sidebar_header.tsx
+++ b/packages/website/ts/components/sidebar_header.tsx
@@ -6,6 +6,8 @@ const SHOW_DURATION_MS = 4000;
const titleToIcon: { [title: string]: string } = {
'0x.js': 'zeroExJs.png',
+ Web3Wrapper: 'zeroExJs.png',
+ Deployer: 'zeroExJs.png',
'0x Connect': 'connect.png',
'0x Smart Contracts': 'contracts.png',
Wiki: 'wiki.png',
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 29c68524c..9cde5bf3f 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -139,6 +139,18 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.Whitepaper, Deco.CapWords)}
/>
</a>,
+ <Link key="subMenuItem-web3Wrapper" to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)}
+ />
+ </Link>,
+ <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
+ />
+ </Link>,
];
const bottomBorderStyle = this._shouldDisplayBottomBar() ? styles.bottomBar : {};
const fullWidthClasses = isFullWidthPage ? 'pr4' : '';
@@ -277,6 +289,22 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem>
</Link>
)}
+ {!this._isViewingWeb3WrapperDocs() && (
+ <Link to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.Web3Wrapper, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
+ {!this._isViewingDeployerDocs() && (
+ <Link to={WebsitePaths.Deployer} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.Deployer, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
{!this._isViewingPortal() && (
<Link to={`${WebsitePaths.Portal}`} className="text-decoration-none">
<MenuItem className="py2">
@@ -304,7 +332,11 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
}
private _renderDocsMenu(): React.ReactNode {
if (
- (!this._isViewing0xjsDocs() && !this._isViewingSmartContractsDocs() && !this._isViewingConnectDocs()) ||
+ (!this._isViewing0xjsDocs() &&
+ !this._isViewingSmartContractsDocs() &&
+ !this._isViewingWeb3WrapperDocs() &&
+ !this._isViewingDeployerDocs() &&
+ !this._isViewingConnectDocs()) ||
_.isUndefined(this.props.menu)
) {
return undefined;
@@ -392,6 +424,12 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
private _isViewingSmartContractsDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.SmartContracts);
}
+ private _isViewingWeb3WrapperDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper);
+ }
+ private _isViewingDeployerDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.Deployer);
+ }
private _isViewingWiki() {
return _.includes(this.props.location.pathname, WebsitePaths.Wiki);
}
@@ -401,6 +439,8 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
this._isViewing0xjsDocs() ||
this._isViewingFAQ() ||
this._isViewingSmartContractsDocs() ||
+ this._isViewingWeb3WrapperDocs() ||
+ this._isViewingDeployerDocs() ||
this._isViewingConnectDocs()
);
}
diff --git a/packages/website/ts/containers/deployer_documentation.ts b/packages/website/ts/containers/deployer_documentation.ts
new file mode 100644
index 000000000..4e1c41f8c
--- /dev/null
+++ b/packages/website/ts/containers/deployer_documentation.ts
@@ -0,0 +1,102 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page';
+import { Dispatcher } from 'ts/redux/dispatcher';
+import { State } from 'ts/redux/reducer';
+import { DocPackages, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/deployer/introduction');
+const InstallationMarkdown = require('md/docs/deployer/installation');
+const UsageMarkdown = require('md/docs/deployer/usage');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ usage: 'usage',
+ compiler: 'compiler',
+ deployer: 'deployer',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Deployer,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Deployer',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ usage: [docSections.usage],
+ compiler: [docSections.compiler],
+ deployer: [docSections.deployer],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ [docSections.usage]: UsageMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.compiler]: ['"deployer/src/compiler"'],
+ [docSections.deployer]: ['"deployer/src/deployer"'],
+ [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [docSections.compiler, docSections.deployer],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: [
+ 'CompilerOptions',
+ 'DeployerOptions',
+ 'BaseDeployerOptions',
+ 'UrlDeployerOptions',
+ 'ProviderDeployerOptions',
+ 'TxData',
+ ],
+ typeNameToExternalLink: {
+ Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API',
+ BigNumber: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L127',
+ ContractInstance: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L98',
+ },
+ typeNameToPrefix: {
+ ContractInstance: 'Web3',
+ },
+ },
+};
+const docsInfo = new DocsInfo(docsInfoConfig);
+
+interface ConnectedState {
+ docsVersion: string;
+ availableDocVersions: string[];
+ docsInfo: DocsInfo;
+ translate: Translate;
+}
+
+interface ConnectedDispatch {
+ dispatcher: Dispatcher;
+}
+
+const mapStateToProps = (state: State, ownProps: DocPageProps): ConnectedState => ({
+ docsVersion: state.docsVersion,
+ availableDocVersions: state.availableDocVersions,
+ translate: state.translate,
+ docsInfo,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
+ dispatcher: new Dispatcher(dispatch),
+});
+
+export const Documentation: React.ComponentClass<DocPageProps> = connect(mapStateToProps, mapDispatchToProps)(
+ DocPageComponent,
+);
diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts
new file mode 100644
index 000000000..0a0911b80
--- /dev/null
+++ b/packages/website/ts/containers/web3_wrapper_documentation.ts
@@ -0,0 +1,103 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page';
+import { Dispatcher } from 'ts/redux/dispatcher';
+import { State } from 'ts/redux/reducer';
+import { DocPackages, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/web3_wrapper/introduction');
+const InstallationMarkdown = require('md/docs/web3_wrapper/installation');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ web3Wrapper: 'web3Wrapper',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Web3Wrapper,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Web3Wrapper',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ web3Wrapper: [docSections.web3Wrapper],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.web3Wrapper]: ['"web3-wrapper/src/index"'],
+ [docSections.types]: ['"types/src/index"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [docSections.web3Wrapper],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: ['TxData', 'TransactionReceipt', 'RawLogEntry'],
+ typeNameToExternalLink: {
+ Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API',
+ Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150',
+ BigNumber: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L127',
+ LogEntryEvent: 'http://mikemcl.github.io/bignumber.js',
+ CallData: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L348',
+ BlockWithoutTransactionData:
+ 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L314',
+ LogEntry: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L366',
+ FilterObject: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L109',
+ ['Web3.BlockParam']: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L278',
+ ['Web3.ContractAbi']: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L47',
+ },
+ typeNameToPrefix: {
+ Provider: 'Web3',
+ CallData: 'Web3',
+ BlockWithoutTransactionData: 'Web3',
+ LogEntry: 'Web3',
+ FilterObject: 'Web3',
+ },
+ typeNameToDocSection: {
+ Web3Wrapper: docSections.web3Wrapper,
+ },
+ },
+};
+const docsInfo = new DocsInfo(docsInfoConfig);
+
+interface ConnectedState {
+ docsVersion: string;
+ availableDocVersions: string[];
+ docsInfo: DocsInfo;
+ translate: Translate;
+}
+
+interface ConnectedDispatch {
+ dispatcher: Dispatcher;
+}
+
+const mapStateToProps = (state: State, ownProps: DocPageProps): ConnectedState => ({
+ docsVersion: state.docsVersion,
+ availableDocVersions: state.availableDocVersions,
+ translate: state.translate,
+ docsInfo,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
+ dispatcher: new Dispatcher(dispatch),
+});
+
+export const Documentation: React.ComponentClass<DocPageProps> = connect(mapStateToProps, mapDispatchToProps)(
+ DocPageComponent,
+);
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index b24517e39..cc09f2df3 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -45,6 +45,12 @@ const LazySmartContractsDocumentation = createLazyComponent('Documentation', asy
const LazyConnectDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/connect_documentation'),
);
+const LazyWeb3WrapperDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/web3_wrapper_documentation'),
+);
+const LazyDeployerDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/deployer_documentation'),
+);
analytics.init();
// tslint:disable-next-line:no-floating-promises
@@ -65,6 +71,11 @@ render(
<Route path={`${WebsitePaths.Wiki}`} component={Wiki as any} />
<Route path={`${WebsitePaths.ZeroExJs}/:version?`} component={LazyZeroExJSDocumentation} />
<Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} />
+ <Route path={`${WebsitePaths.Deployer}/:version?`} component={LazyDeployerDocumentation} />
+ <Route
+ path={`${WebsitePaths.Web3Wrapper}/:version?`}
+ component={LazyWeb3WrapperDocumentation}
+ />
<Route
path={`${WebsitePaths.SmartContracts}/:version?`}
component={LazySmartContractsDocumentation}
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 1281219c6..5f09ec9ef 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -17,17 +17,21 @@ import { utils } from 'ts/utils/utils';
const ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH = '0.32.4';
-const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT;
-const docIdToS3BucketName: { [id: string]: string } = {
- [DocPackages.ZeroExJs]: isDevelopment ? 'staging-0xjs-docs-jsons' : '0xjs-docs-jsons',
- [DocPackages.SmartContracts]: 'smart-contracts-docs-json',
- [DocPackages.Connect]: isDevelopment ? 'staging-connect-docs-jsons' : 'connect-docs-jsons',
+const isDevelopment = configs.ENVIRONMENT !== Environments.DEVELOPMENT;
+const docIdToS3FolderName: { [id: string]: string } = {
+ [DocPackages.ZeroExJs]: '0xjs',
+ [DocPackages.SmartContracts]: 'smart-contracts',
+ [DocPackages.Connect]: 'connect',
+ [DocPackages.Web3Wrapper]: 'web3-wrapper',
+ [DocPackages.Deployer]: 'deployer',
};
const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.ZeroExJs]: '0x.js',
[DocPackages.Connect]: 'connect',
[DocPackages.SmartContracts]: 'contracts',
+ [DocPackages.Web3Wrapper]: 'web3-wrapper',
+ [DocPackages.Deployer]: 'deployer',
};
export interface DocPageProps {
@@ -97,25 +101,25 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> {
);
}
private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> {
- const s3BucketName = docIdToS3BucketName[this.props.docsInfo.id];
- const docsJsonRoot = `${constants.S3_BUCKET_ROOT}/${s3BucketName}`;
- const versionToFileName = await docUtils.getVersionToFileNameAsync(docsJsonRoot);
- const versions = _.keys(versionToFileName);
+ const folderName = docIdToS3FolderName[this.props.docsInfo.id];
+ const docBucketRoot = isDevelopment ? constants.S3_STAGING_DOC_BUCKET_ROOT : constants.S3_DOC_BUCKET_ROOT;
+ const versionToFilePath = await docUtils.getVersionToFilePathAsync(docBucketRoot, folderName);
+ const versions = _.keys(versionToFilePath);
this.props.dispatcher.updateAvailableDocVersions(versions);
const sortedVersions = semverSort.desc(versions);
const latestVersion = sortedVersions[0];
let versionToFetch = latestVersion;
if (!_.isUndefined(preferredVersionIfExists)) {
- const preferredVersionFileNameIfExists = versionToFileName[preferredVersionIfExists];
+ const preferredVersionFileNameIfExists = versionToFilePath[preferredVersionIfExists];
if (!_.isUndefined(preferredVersionFileNameIfExists)) {
versionToFetch = preferredVersionIfExists;
}
}
this.props.dispatcher.updateCurrentDocsVersion(versionToFetch);
- const versionFileNameToFetch = versionToFileName[versionToFetch];
- const versionDocObj = await docUtils.getJSONDocFileAsync(versionFileNameToFetch, docsJsonRoot);
+ const versionFilePathToFetch = versionToFilePath[versionToFetch];
+ const versionDocObj = await docUtils.getJSONDocFileAsync(versionFilePathToFetch, docBucketRoot);
const docAgnosticFormat = this.props.docsInfo.convertToDocAgnosticFormat(versionDocObj);
if (!this._isUnmounted) {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index b3e4973fa..4a3426b56 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -336,7 +336,7 @@ export enum TokenVisibility {
TRACKED = 'TRACKED',
}
-export interface VersionToFileName {
+export interface VersionToFilePath {
[version: string]: string;
}
@@ -355,12 +355,16 @@ export enum WebsitePaths {
Whitepaper = '/pdfs/0x_white_paper.pdf',
SmartContracts = '/docs/contracts',
Connect = '/docs/connect',
+ Web3Wrapper = '/docs/web3_wrapper',
+ Deployer = '/docs/deployer',
}
export enum DocPackages {
Connect = 'CONNECT',
ZeroExJs = 'ZERO_EX_JS',
SmartContracts = 'SMART_CONTRACTS',
+ Web3Wrapper = 'WEB3_WRAPPER',
+ Deployer = 'DEPLOYER',
}
export interface TimestampMsRange {
@@ -442,11 +446,13 @@ export enum Key {
About = 'ABOUT',
Careers = 'CAREERS',
Contact = 'CONTACT',
+ Deployer = 'DEPLOYER',
Blog = 'BLOG',
Forum = 'FORUM',
Connect = 'CONNECT',
Whitepaper = 'WHITEPAPER',
Wiki = 'WIKI',
+ Web3Wrapper = 'WEB3_WRAPPER',
And = 'AND',
Faq = 'FAQ',
SmartContracts = 'SMART_CONTRACTS',
diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts
index f63e8617e..42a2f44d0 100644
--- a/packages/website/ts/utils/constants.ts
+++ b/packages/website/ts/utils/constants.ts
@@ -29,7 +29,8 @@ export const constants = {
PROVIDER_NAME_GENERIC: 'Injected Web3',
PROVIDER_NAME_PUBLIC: '0x Public',
ROLLBAR_ACCESS_TOKEN: 'a6619002b51c4464928201e6ea94de65',
- S3_BUCKET_ROOT: 'https://s3.amazonaws.com',
+ S3_DOC_BUCKET_ROOT: 'https://s3.amazonaws.com/doc-jsons',
+ S3_STAGING_DOC_BUCKET_ROOT: 'https://s3.amazonaws.com/staging-doc-jsons',
SUCCESS_STATUS: 200,
UNAVAILABLE_STATUS: 503,
TAKER_FEE: new BigNumber(0),
diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts
index 6b3f5f378..2a599bcbe 100644
--- a/packages/website/ts/utils/doc_utils.ts
+++ b/packages/website/ts/utils/doc_utils.ts
@@ -2,21 +2,21 @@ import { DoxityDocObj, TypeDocNode } from '@0xproject/react-docs';
import { logUtils } from '@0xproject/utils';
import findVersions = require('find-versions');
import * as _ from 'lodash';
-import { S3FileObject, VersionToFileName } from 'ts/types';
+import { S3FileObject, VersionToFilePath } from 'ts/types';
import { utils } from 'ts/utils/utils';
import convert = require('xml-js');
export const docUtils = {
- async getVersionToFileNameAsync(s3DocJsonRoot: string): Promise<VersionToFileName> {
- const versionFileNames = await this.getVersionFileNamesAsync(s3DocJsonRoot);
- const versionToFileName: VersionToFileName = {};
- _.each(versionFileNames, fileName => {
- const [version] = findVersions(fileName);
- versionToFileName[version] = fileName;
+ async getVersionToFilePathAsync(s3DocJsonRoot: string, folderName: string): Promise<VersionToFilePath> {
+ const versionFilePaths = await this.getVersionFileNamesAsync(s3DocJsonRoot, folderName);
+ const versionToFilePath: VersionToFilePath = {};
+ _.each(versionFilePaths, filePath => {
+ const [version] = findVersions(filePath);
+ versionToFilePath[version] = filePath;
});
- return versionToFileName;
+ return versionToFilePath;
},
- async getVersionFileNamesAsync(s3DocJsonRoot: string): Promise<string[]> {
+ async getVersionFileNamesAsync(s3DocJsonRoot: string, folderName: string): Promise<string[]> {
const response = await fetch(s3DocJsonRoot);
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load
@@ -33,13 +33,47 @@ export const docUtils = {
? (responseObj.ListBucketResult.Contents as S3FileObject[])
: [responseObj.ListBucketResult.Contents];
- const versionFileNames = _.map(fileObjs, fileObj => {
+ /*
+ * S3 simply pre-fixes files in "folders" with the folder name. Thus, since we
+ * store docJSONs for multiple packages in a single S3 bucket, we must filter out
+ * the versionFileNames for a given folder here (ignoring folder entries)
+ *
+ * Example S3 response:
+ * <ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
+ * <Name>staging-doc-jsons</Name>
+ * <Prefix/>
+ * <Marker/>
+ * <MaxKeys>1000</MaxKeys>
+ * <IsTruncated>false</IsTruncated>
+ * <Contents>
+ * <Key>0xjs/</Key>
+ * <LastModified>2018-03-16T13:17:46.000Z</LastModified>
+ * <ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
+ * <Size>0</Size>
+ * <StorageClass>STANDARD</StorageClass>
+ * </Contents>
+ * <Contents>
+ * <Key>0xjs/v0.1.0.json</Key>
+ * <LastModified>2018-03-16T13:18:23.000Z</LastModified>
+ * <ETag>"b4f7f74913aab4a5ad1e6a58fcb3b274"</ETag>
+ * <Size>1039050</Size>
+ * <StorageClass>STANDARD</StorageClass>
+ * </Contents>
+ */
+ const relevantObjs = _.filter(fileObjs, fileObj => {
+ const key = fileObj.Key._text;
+ const isInFolderOfInterest = _.includes(key, folderName);
+ const isFileEntry = !_.endsWith(key, '/');
+ return isInFolderOfInterest && isFileEntry;
+ });
+
+ const versionFilePaths = _.map(relevantObjs, fileObj => {
return fileObj.Key._text;
});
- return versionFileNames;
+ return versionFilePaths;
},
- async getJSONDocFileAsync(fileName: string, s3DocJsonRoot: string): Promise<TypeDocNode | DoxityDocObj> {
- const endpoint = `${s3DocJsonRoot}/${fileName}`;
+ async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise<TypeDocNode | DoxityDocObj> {
+ const endpoint = `${s3DocJsonRoot}/${filePath}`;
const response = await fetch(endpoint);
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load
diff --git a/packages/website/webpack.config.js b/packages/website/webpack.config.js
index c436888bd..e28e9e064 100644
--- a/packages/website/webpack.config.js
+++ b/packages/website/webpack.config.js
@@ -11,10 +11,7 @@ module.exports = {
},
devtool: 'source-map',
resolve: {
- modules: [
- path.join(__dirname, '/ts'),
- 'node_modules',
- ],
+ modules: [path.join(__dirname, '/ts'), 'node_modules'],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.md'],
alias: {
ts: path.join(__dirname, '/ts'),
@@ -62,25 +59,28 @@ module.exports = {
from: /^\/docs\/.*$/,
to: function() {
return 'index.html';
- }
- }
- ]
+ },
+ },
+ ],
},
disableHostCheck: true,
},
- plugins: process.env.NODE_ENV === 'production' ? [
- // Since we do not use moment's locale feature, we exclude them from the bundle.
- // This reduces the bundle size by 0.4MB.
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
- new webpack.DefinePlugin({
- 'process.env': {
- 'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
- }
- }),
- new webpack.optimize.UglifyJsPlugin({
- mangle: {
- except: ['BigNumber']
- }
- })
- ] : [],
+ plugins:
+ process.env.NODE_ENV === 'production'
+ ? [
+ // Since we do not use moment's locale feature, we exclude them from the bundle.
+ // This reduces the bundle size by 0.4MB.
+ new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
+ new webpack.DefinePlugin({
+ 'process.env': {
+ NODE_ENV: JSON.stringify(process.env.NODE_ENV),
+ },
+ }),
+ new webpack.optimize.UglifyJsPlugin({
+ mangle: {
+ except: ['BigNumber'],
+ },
+ }),
+ ]
+ : [],
};